Merge pull request #35 from mindskip/alvis

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

View File

@ -13,9 +13,6 @@ 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 com.mindskip.xzs.service.*;
import com.mindskip.xzs.viewmodel.student.dashboard.*;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@ -27,7 +24,6 @@ import java.util.stream.Collectors;
@RestController("StudentDashboardController")
@RequestMapping(value = "/api/student/dashboard")
@AllArgsConstructor
public class DashboardController extends BaseApiController {
private final UserService userService;
@ -37,6 +33,15 @@ public class DashboardController extends BaseApiController {
private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
private final TextContentService textContentService;
public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) {
this.userService = userService;
this.examPaperService = examPaperService;
this.questionService = questionService;
this.taskExamService = taskExamService;
this.taskExamCustomerAnswerService = taskExamCustomerAnswerService;
this.textContentService = textContentService;
}
@RequestMapping(value = "/index", method = RequestMethod.POST)
public RestResponse<IndexVM> index() {
IndexVM indexVM = new IndexVM();

View File

@ -8,7 +8,6 @@ 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 lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -16,11 +15,14 @@ import java.util.stream.Collectors;
@RestController("StudentEducationController")
@RequestMapping(value = "/api/student/education")
@AllArgsConstructor
public class EducationController extends BaseApiController {
private final SubjectService subjectService;
public EducationController(SubjectService subjectService) {
this.subjectService = subjectService;
}
@RequestMapping(value = "/subject/list", method = RequestMethod.POST)
public RestResponse<List<SubjectVM>> list() {
User user = getCurrentUser();

View File

@ -18,8 +18,6 @@ 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 com.mindskip.xzs.domain.*;
import lombok.AllArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@ -28,7 +26,6 @@ import java.util.Date;
@RestController("StudentExamPaperAnswerController")
@RequestMapping(value = "/api/student/exampaper/answer")
@AllArgsConstructor
public class ExamPaperAnswerController extends BaseApiController {
private final ExamPaperAnswerService examPaperAnswerService;
@ -36,6 +33,13 @@ public class ExamPaperAnswerController extends BaseApiController {
private final SubjectService subjectService;
private final ApplicationEventPublisher eventPublisher;
public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher) {
this.examPaperAnswerService = examPaperAnswerService;
this.examPaperService = examPaperService;
this.subjectService = subjectService;
this.eventPublisher = eventPublisher;
}
@RequestMapping(value = "/pageList", method = RequestMethod.POST)
public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@RequestBody @Valid ExamPaperAnswerPageVM model) {

View File

@ -11,7 +11,6 @@ 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 lombok.AllArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@ -19,13 +18,18 @@ import javax.validation.Valid;
@RestController("StudentExamPaperController")
@RequestMapping(value = "/api/student/exam/paper")
@AllArgsConstructor
public class ExamPaperController extends BaseApiController {
private final ExamPaperService examPaperService;
private final ExamPaperAnswerService examPaperAnswerService;
private final ApplicationEventPublisher eventPublisher;
public ExamPaperController(ExamPaperService examPaperService, ExamPaperAnswerService examPaperAnswerService, ApplicationEventPublisher eventPublisher) {
this.examPaperService = examPaperService;
this.examPaperAnswerService = examPaperAnswerService;
this.eventPublisher = eventPublisher;
}
@RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) {

View File

@ -20,12 +20,10 @@ 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 lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController("StudentQuestionAnswerController")
@RequestMapping(value = "/api/student/question/answer")
@AllArgsConstructor
public class QuestionAnswerController extends BaseApiController {
private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
@ -33,6 +31,13 @@ public class QuestionAnswerController extends BaseApiController {
private final TextContentService textContentService;
private final SubjectService subjectService;
public QuestionAnswerController(ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, QuestionService questionService, TextContentService textContentService, SubjectService subjectService) {
this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
this.questionService = questionService;
this.textContentService = textContentService;
this.subjectService = subjectService;
}
@RequestMapping(value = "/page", method = RequestMethod.POST)
public RestResponse<PageInfo<QuestionPageStudentResponseVM>> pageList(@RequestBody QuestionPageStudentRequestVM model) {
model.setCreateUser(getCurrentUser().getId());

View File

@ -2,15 +2,16 @@ package com.mindskip.xzs.controller.student;
import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.service.QuestionService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController("StudentQuestionController")
@RequestMapping(value = "/api/student/question")
@AllArgsConstructor
public class QuestionController extends BaseApiController {
private final QuestionService questionService;
public QuestionController(QuestionService questionService) {
this.questionService = questionService;
}
}

View File

@ -5,7 +5,6 @@ import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.service.FileUpload;
import com.mindskip.xzs.service.UserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -19,7 +18,6 @@ import java.io.InputStream;
@Slf4j
@AllArgsConstructor
@RequestMapping("/api/student/upload")
@RestController("StudentUploadController")
public class UploadController extends BaseApiController {
@ -27,6 +25,11 @@ public class UploadController extends BaseApiController {
private final FileUpload fileUpload;
private final UserService userService;
public UploadController(FileUpload fileUpload, UserService userService) {
this.fileUpload = fileUpload;
this.userService = userService;
}
@RequestMapping("/image")
@ResponseBody

View File

@ -17,8 +17,6 @@ import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.PageInfoHelper;
import com.mindskip.xzs.viewmodel.student.user.*;
import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.viewmodel.student.user.*;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@ -35,7 +33,6 @@ import java.util.stream.Collectors;
*/
@RestController("StudentUserController")
@RequestMapping(value = "/api/student/user")
@AllArgsConstructor
public class UserController extends BaseApiController {
private final UserService userService;
@ -44,6 +41,14 @@ public class UserController extends BaseApiController {
private final AuthenticationService authenticationService;
private final ApplicationEventPublisher eventPublisher;
public UserController(UserService userService, UserEventLogService userEventLogService, MessageService messageService, AuthenticationService authenticationService, ApplicationEventPublisher eventPublisher) {
this.userService = userService;
this.userEventLogService = userEventLogService;
this.messageService = messageService;
this.authenticationService = authenticationService;
this.eventPublisher = eventPublisher;
}
@RequestMapping(value = "/current", method = RequestMethod.POST)
public RestResponse<UserResponseVM> current() {
User user = getCurrentUser();