From ac7702ad20863349053ffc055eef0974559a2e6f Mon Sep 17 00:00:00 2001 From: alvis Date: Mon, 4 Jan 2021 15:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4lombok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xzs/controller/admin/DashboardController.java | 12 ++++++++---- .../xzs/controller/admin/EducationController.java | 6 ++++-- .../xzs/controller/admin/ExamPaperController.java | 6 ++++-- .../xzs/controller/admin/MessageController.java | 7 +++++-- .../xzs/controller/admin/QuestionController.java | 8 +++++--- .../xzs/controller/admin/TaskController.java | 6 ++++-- .../xzs/controller/admin/UploadController.java | 8 ++++++-- .../xzs/controller/admin/UserController.java | 9 ++++++--- 8 files changed, 42 insertions(+), 20 deletions(-) diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/DashboardController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/DashboardController.java index cfc0c31..0c3291f 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/DashboardController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/DashboardController.java @@ -5,8 +5,6 @@ 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 com.mindskip.xzs.service.*; -import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -15,16 +13,22 @@ import java.util.List; @RestController("AdminDashboardController") @RequestMapping(value = "/api/admin/dashboard") -@AllArgsConstructor public class DashboardController extends BaseApiController { - private final ExamPaperService examPaperService; private final QuestionService questionService; private final ExamPaperAnswerService examPaperAnswerService; private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService; private final UserEventLogService userEventLogService; + public DashboardController(ExamPaperService examPaperService, QuestionService questionService, ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, UserEventLogService userEventLogService) { + this.examPaperService = examPaperService; + this.questionService = questionService; + this.examPaperAnswerService = examPaperAnswerService; + this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService; + this.userEventLogService = userEventLogService; + } + @RequestMapping(value = "/index", method = RequestMethod.POST) public RestResponse Index() { IndexVM vm = new IndexVM(); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java index 36d16f3..d243757 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/EducationController.java @@ -10,7 +10,6 @@ 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 lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @@ -18,11 +17,14 @@ import java.util.List; @RestController("AdminEducationController") @RequestMapping(value = "/api/admin/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() { List subjects = subjectService.allSubject(); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/ExamPaperController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/ExamPaperController.java index c8485be..81ae57f 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/ExamPaperController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/ExamPaperController.java @@ -10,18 +10,20 @@ 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 lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @RestController("AdminExamPaperController") @RequestMapping(value = "/api/admin/exam/paper") -@AllArgsConstructor public class ExamPaperController extends BaseApiController { private final ExamPaperService examPaperService; + public ExamPaperController(ExamPaperService examPaperService) { + this.examPaperService = examPaperService; + } + @RequestMapping(value = "/page", method = RequestMethod.POST) public RestResponse> pageList(@RequestBody ExamPaperPageRequestVM model) { PageInfo pageInfo = examPaperService.page(model); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/MessageController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/MessageController.java index 4c2d421..587da48 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/MessageController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/MessageController.java @@ -14,7 +14,6 @@ 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 lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -27,12 +26,16 @@ import java.util.stream.Collectors; @RestController("AdminMessageController") @RequestMapping(value = "/api/admin/message") -@AllArgsConstructor public class MessageController extends BaseApiController { private final MessageService messageService; private final UserService userService; + public MessageController(MessageService messageService, UserService userService) { + this.messageService = messageService; + this.userService = userService; + } + @RequestMapping(value = "/page", method = RequestMethod.POST) public RestResponse> pageList(@RequestBody MessagePageRequestVM model) { PageInfo pageInfo = messageService.page(model); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/QuestionController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/QuestionController.java index 03b9616..eb30916 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/QuestionController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/QuestionController.java @@ -14,8 +14,6 @@ import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM; import com.mindskip.xzs.viewmodel.admin.question.QuestionPageRequestVM; import com.mindskip.xzs.viewmodel.admin.question.QuestionResponseVM; import com.github.pagehelper.PageInfo; -import com.mindskip.xzs.utility.*; -import lombok.AllArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -23,12 +21,16 @@ import javax.validation.Valid; @RestController("AdminQuestionController") @RequestMapping(value = "/api/admin/question") -@AllArgsConstructor public class QuestionController extends BaseApiController { private final QuestionService questionService; private final TextContentService textContentService; + public QuestionController(QuestionService questionService, TextContentService textContentService) { + this.questionService = questionService; + this.textContentService = textContentService; + } + @RequestMapping(value = "/page", method = RequestMethod.POST) public RestResponse> pageList(@RequestBody QuestionPageRequestVM model) { PageInfo pageInfo = questionService.page(model); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/TaskController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/TaskController.java index 38ea70e..75161c1 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/TaskController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/TaskController.java @@ -11,18 +11,20 @@ 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 lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @RestController("AdminTaskController") @RequestMapping(value = "/api/admin/task") -@AllArgsConstructor public class TaskController extends BaseApiController { private final TaskExamService taskExamService; + public TaskController(TaskExamService taskExamService) { + this.taskExamService = taskExamService; + } + @RequestMapping(value = "/page", method = RequestMethod.POST) public RestResponse> pageList(@RequestBody TaskPageRequestVM model) { PageInfo pageInfo = taskExamService.page(model); diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UploadController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UploadController.java index d7b9739..ecf7907 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UploadController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UploadController.java @@ -8,7 +8,6 @@ import com.mindskip.xzs.service.FileUpload; import com.mindskip.xzs.service.UserService; import com.mindskip.xzs.viewmodel.admin.file.UeditorConfigVM; import com.mindskip.xzs.viewmodel.admin.file.UploadResultVM; -import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,7 +23,6 @@ import java.util.Arrays; @Slf4j -@AllArgsConstructor @RequestMapping("/api/admin/upload") @RestController("AdminUploadController") public class UploadController extends BaseApiController { @@ -36,6 +34,12 @@ public class UploadController extends BaseApiController { private static final String IMAGE_UPLOAD_FILE = "upFile"; private final UserService userService; + public UploadController(FileUpload fileUpload, SystemConfig systemConfig, UserService userService) { + this.fileUpload = fileUpload; + this.systemConfig = systemConfig; + this.userService = userService; + } + @ResponseBody @RequestMapping("/configAndUpload") public Object upload(HttpServletRequest request, HttpServletResponse response) { diff --git a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UserController.java b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UserController.java index 7f4d403..092f78f 100644 --- a/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UserController.java +++ b/source/xzs/src/main/java/com/mindskip/xzs/controller/admin/UserController.java @@ -13,8 +13,6 @@ import com.mindskip.xzs.utility.DateTimeUtil; import com.mindskip.xzs.viewmodel.admin.user.*; import com.mindskip.xzs.utility.PageInfoHelper; import com.github.pagehelper.PageInfo; -import com.mindskip.xzs.viewmodel.admin.user.*; -import lombok.AllArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -30,13 +28,18 @@ import java.util.UUID; */ @RestController("AdminUserController") @RequestMapping(value = "/api/admin/user") -@AllArgsConstructor public class UserController extends BaseApiController { private final UserService userService; private final UserEventLogService userEventLogService; private final AuthenticationService authenticationService; + public UserController(UserService userService, UserEventLogService userEventLogService, AuthenticationService authenticationService) { + this.userService = userService; + this.userEventLogService = userEventLogService; + this.authenticationService = authenticationService; + } + @RequestMapping(value = "/page/list", method = RequestMethod.POST) public RestResponse> pageList(@RequestBody UserPageRequestVM model) {