Merge pull request #36 from mindskip/alvis

优化
This commit is contained in:
alvis 2021-01-06 10:40:08 +08:00 committed by GitHub
commit ea53348511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 58 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.service.*;
import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.viewmodel.admin.dashboard.IndexVM;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@ -21,6 +22,7 @@ public class DashboardController extends BaseApiController {
private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
private final UserEventLogService userEventLogService;
@Autowired
public DashboardController(ExamPaperService examPaperService, QuestionService questionService, ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, UserEventLogService userEventLogService) {
this.examPaperService = examPaperService;
this.questionService = questionService;

View File

@ -10,6 +10,7 @@ import com.mindskip.xzs.viewmodel.admin.education.SubjectEditRequestVM;
import com.mindskip.xzs.viewmodel.admin.education.SubjectPageRequestVM;
import com.mindskip.xzs.viewmodel.admin.education.SubjectResponseVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -21,6 +22,7 @@ public class EducationController extends BaseApiController {
private final SubjectService subjectService;
@Autowired
public EducationController(SubjectService subjectService) {
this.subjectService = subjectService;
}

View File

@ -10,6 +10,7 @@ import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM;
import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;
import com.mindskip.xzs.viewmodel.admin.exam.ExamResponseVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -20,6 +21,7 @@ public class ExamPaperController extends BaseApiController {
private final ExamPaperService examPaperService;
@Autowired
public ExamPaperController(ExamPaperService examPaperService) {
this.examPaperService = examPaperService;
}

View File

@ -14,6 +14,7 @@ import com.mindskip.xzs.viewmodel.admin.message.MessagePageRequestVM;
import com.mindskip.xzs.viewmodel.admin.message.MessageResponseVM;
import com.mindskip.xzs.viewmodel.admin.message.MessageSendVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -31,6 +32,7 @@ public class MessageController extends BaseApiController {
private final MessageService messageService;
private final UserService userService;
@Autowired
public MessageController(MessageService messageService, UserService userService) {
this.messageService = messageService;
this.userService = userService;

View File

@ -15,6 +15,7 @@ import com.mindskip.xzs.viewmodel.admin.question.QuestionPageRequestVM;
import com.mindskip.xzs.viewmodel.admin.question.QuestionResponseVM;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -26,6 +27,7 @@ public class QuestionController extends BaseApiController {
private final QuestionService questionService;
private final TextContentService textContentService;
@Autowired
public QuestionController(QuestionService questionService, TextContentService textContentService) {
this.questionService = questionService;
this.textContentService = textContentService;

View File

@ -11,6 +11,7 @@ import com.mindskip.xzs.viewmodel.admin.task.TaskPageRequestVM;
import com.mindskip.xzs.viewmodel.admin.task.TaskPageResponseVM;
import com.mindskip.xzs.viewmodel.admin.task.TaskRequestVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -21,6 +22,7 @@ public class TaskController extends BaseApiController {
private final TaskExamService taskExamService;
@Autowired
public TaskController(TaskExamService taskExamService) {
this.taskExamService = taskExamService;
}

View File

@ -11,6 +11,7 @@ import com.mindskip.xzs.viewmodel.admin.file.UploadResultVM;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -34,6 +35,7 @@ public class UploadController extends BaseApiController {
private static final String IMAGE_UPLOAD_FILE = "upFile";
private final UserService userService;
@Autowired
public UploadController(FileUpload fileUpload, SystemConfig systemConfig, UserService userService) {
this.fileUpload = fileUpload;
this.systemConfig = systemConfig;

View File

@ -15,6 +15,7 @@ import com.mindskip.xzs.utility.PageInfoHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -34,6 +35,7 @@ public class UserController extends BaseApiController {
private final UserEventLogService userEventLogService;
private final AuthenticationService authenticationService;
@Autowired
public UserController(UserService userService, UserEventLogService userEventLogService, AuthenticationService authenticationService) {
this.userService = userService;
this.userEventLogService = userEventLogService;

View File

@ -13,6 +13,7 @@ import com.mindskip.xzs.service.*;
import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.JsonUtil;
import com.mindskip.xzs.viewmodel.student.dashboard.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@ -33,6 +34,7 @@ public class DashboardController extends BaseApiController {
private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
private final TextContentService textContentService;
@Autowired
public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) {
this.userService = userService;
this.examPaperService = examPaperService;

View File

@ -8,6 +8,7 @@ import com.mindskip.xzs.domain.User;
import com.mindskip.xzs.service.SubjectService;
import com.mindskip.xzs.viewmodel.student.education.SubjectEditRequestVM;
import com.mindskip.xzs.viewmodel.student.education.SubjectVM;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -19,6 +20,7 @@ public class EducationController extends BaseApiController {
private final SubjectService subjectService;
@Autowired
public EducationController(SubjectService subjectService) {
this.subjectService = subjectService;
}

View File

@ -18,6 +18,7 @@ import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM;
import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM;
import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@ -33,6 +34,7 @@ public class ExamPaperAnswerController extends BaseApiController {
private final SubjectService subjectService;
private final ApplicationEventPublisher eventPublisher;
@Autowired
public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher) {
this.examPaperAnswerService = examPaperAnswerService;
this.examPaperService = examPaperService;

View File

@ -11,6 +11,7 @@ import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageResponseVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@ -24,6 +25,7 @@ public class ExamPaperController extends BaseApiController {
private final ExamPaperAnswerService examPaperAnswerService;
private final ApplicationEventPublisher eventPublisher;
@Autowired
public ExamPaperController(ExamPaperService examPaperService, ExamPaperAnswerService examPaperAnswerService, ApplicationEventPublisher eventPublisher) {
this.examPaperService = examPaperService;
this.examPaperAnswerService = examPaperAnswerService;

View File

@ -20,6 +20,7 @@ import com.mindskip.xzs.viewmodel.student.question.answer.QuestionAnswerVM;
import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentRequestVM;
import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController("StudentQuestionAnswerController")
@ -31,6 +32,7 @@ public class QuestionAnswerController extends BaseApiController {
private final TextContentService textContentService;
private final SubjectService subjectService;
@Autowired
public QuestionAnswerController(ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, QuestionService questionService, TextContentService textContentService, SubjectService subjectService) {
this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
this.questionService = questionService;

View File

@ -2,6 +2,7 @@ package com.mindskip.xzs.controller.student;
import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController("StudentQuestionController")
@ -10,7 +11,7 @@ public class QuestionController extends BaseApiController {
private final QuestionService questionService;
@Autowired
public QuestionController(QuestionService questionService) {
this.questionService = questionService;
}

View File

@ -6,6 +6,7 @@ import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.service.FileUpload;
import com.mindskip.xzs.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@ -25,6 +26,7 @@ public class UploadController extends BaseApiController {
private final FileUpload fileUpload;
private final UserService userService;
@Autowired
public UploadController(FileUpload fileUpload, UserService userService) {
this.fileUpload = fileUpload;
this.userService = userService;

View File

@ -18,6 +18,7 @@ import com.mindskip.xzs.utility.PageInfoHelper;
import com.mindskip.xzs.viewmodel.student.user.*;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@ -41,6 +42,7 @@ public class UserController extends BaseApiController {
private final AuthenticationService authenticationService;
private final ApplicationEventPublisher eventPublisher;
@Autowired
public UserController(UserService userService, UserEventLogService userEventLogService, MessageService messageService, AuthenticationService authenticationService, ApplicationEventPublisher eventPublisher) {
this.userService = userService;
this.userEventLogService = userEventLogService;

View File

@ -5,21 +5,25 @@ import com.mindskip.xzs.domain.User;
import com.mindskip.xzs.service.AuthenticationService;
import com.mindskip.xzs.service.UserService;
import com.mindskip.xzs.utility.RsaUtil;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author 武汉思维跳跃科技有限公司
*/
@Service
@AllArgsConstructor
public class AuthenticationServiceImpl implements AuthenticationService {
private final UserService userService;
private final SystemConfig systemConfig;
@Autowired
public AuthenticationServiceImpl(UserService userService, SystemConfig systemConfig) {
this.userService = userService;
this.systemConfig = systemConfig;
}
/**
* @param username username

View File

@ -4,10 +4,13 @@ import com.mindskip.xzs.repository.BaseMapper;
import com.mindskip.xzs.service.BaseService;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public abstract class BaseServiceImpl<T> implements BaseService<T> {
BaseMapper<T> baseMapper;
private final BaseMapper<T> baseMapper;
public BaseServiceImpl(BaseMapper<T> baseMapper) {
this.baseMapper = baseMapper;
}
@Override
public int deleteById(Integer id) {

View File

@ -14,16 +14,22 @@ import com.qiniu.util.Auth;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.InputStream;
@Service
@AllArgsConstructor
public class FileUploadImpl implements FileUpload {
private final Logger logger = LoggerFactory.getLogger(FileUpload.class);
private final SystemConfig systemConfig;
@Autowired
public FileUploadImpl(SystemConfig systemConfig) {
this.systemConfig = systemConfig;
}
@Override
public String uploadFile(InputStream inputStream, long size, String extName) {
QnConfig qnConfig = systemConfig.getQn();

View File

@ -10,6 +10,7 @@ import com.mindskip.xzs.viewmodel.student.user.MessageRequestVM;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -17,12 +18,17 @@ import java.util.Date;
import java.util.List;
@Service
@AllArgsConstructor
public class MessageServiceImpl implements MessageService {
private final MessageMapper messageMapper;
private final MessageUserMapper messageUserMapper;
@Autowired
public MessageServiceImpl(MessageMapper messageMapper, MessageUserMapper messageUserMapper) {
this.messageMapper = messageMapper;
this.messageUserMapper = messageUserMapper;
}
@Override
public List<Message> selectMessageByIds(List<Integer> ids) {
return messageMapper.selectByIds(ids);