This commit is contained in:
alvis 2021-01-07 11:03:11 +08:00
parent 4de5327e87
commit 01f9ff0f80
7 changed files with 44 additions and 18 deletions

View File

@ -8,7 +8,6 @@ import com.mindskip.xzs.service.FileUpload;
import com.mindskip.xzs.service.UserService; import com.mindskip.xzs.service.UserService;
import com.mindskip.xzs.viewmodel.admin.file.UeditorConfigVM; import com.mindskip.xzs.viewmodel.admin.file.UeditorConfigVM;
import com.mindskip.xzs.viewmodel.admin.file.UploadResultVM; import com.mindskip.xzs.viewmodel.admin.file.UploadResultVM;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +22,6 @@ import java.io.InputStream;
import java.util.Arrays; import java.util.Arrays;
@Slf4j
@RequestMapping("/api/admin/upload") @RequestMapping("/api/admin/upload")
@RestController("AdminUploadController") @RestController("AdminUploadController")
public class UploadController extends BaseApiController { public class UploadController extends BaseApiController {

View File

@ -5,7 +5,6 @@ import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.base.RestResponse; import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.service.FileUpload; import com.mindskip.xzs.service.FileUpload;
import com.mindskip.xzs.service.UserService; import com.mindskip.xzs.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -18,7 +17,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@Slf4j
@RequestMapping("/api/student/upload") @RequestMapping("/api/student/upload")
@RestController("StudentUploadController") @RestController("StudentUploadController")
public class UploadController extends BaseApiController { public class UploadController extends BaseApiController {

View File

@ -11,7 +11,7 @@ import com.mindskip.xzs.service.UserTokenService;
import com.mindskip.xzs.utility.WxUtil; import com.mindskip.xzs.utility.WxUtil;
import com.mindskip.xzs.viewmodel.wx.student.user.BindInfo; import com.mindskip.xzs.viewmodel.wx.student.user.BindInfo;
import com.mindskip.xzs.domain.User; import com.mindskip.xzs.domain.User;
import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -21,7 +21,6 @@ import javax.validation.constraints.NotBlank;
@Controller("WXStudentAuthController") @Controller("WXStudentAuthController")
@RequestMapping(value = "/api/wx/student/auth") @RequestMapping(value = "/api/wx/student/auth")
@AllArgsConstructor
@ResponseBody @ResponseBody
public class AuthController extends BaseWXApiController { public class AuthController extends BaseWXApiController {
@ -30,6 +29,14 @@ public class AuthController extends BaseWXApiController {
private final UserService userService; private final UserService userService;
private final UserTokenService userTokenService; private final UserTokenService userTokenService;
@Autowired
public AuthController(SystemConfig systemConfig, AuthenticationService authenticationService, UserService userService, UserTokenService userTokenService) {
this.systemConfig = systemConfig;
this.authenticationService = authenticationService;
this.userService = userService;
this.userTokenService = userTokenService;
}
@RequestMapping(value = "/bind", method = RequestMethod.POST) @RequestMapping(value = "/bind", method = RequestMethod.POST)
public RestResponse bind(@Valid BindInfo model) { public RestResponse bind(@Valid BindInfo model) {
User user = userService.getUserByUserName(model.getUserName()); User user = userService.getUserByUserName(model.getUserName());

View File

@ -16,8 +16,7 @@ import com.mindskip.xzs.service.TextContentService;
import com.mindskip.xzs.utility.DateTimeUtil; import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.JsonUtil; import com.mindskip.xzs.utility.JsonUtil;
import com.mindskip.xzs.viewmodel.student.dashboard.*; import com.mindskip.xzs.viewmodel.student.dashboard.*;
import com.mindskip.xzs.viewmodel.student.dashboard.*; import org.springframework.beans.factory.annotation.Autowired;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -31,7 +30,6 @@ import java.util.stream.Collectors;
@Controller("WXStudentDashboardController") @Controller("WXStudentDashboardController")
@RequestMapping(value = "/api/wx/student/dashboard") @RequestMapping(value = "/api/wx/student/dashboard")
@AllArgsConstructor
@ResponseBody @ResponseBody
public class DashboardController extends BaseWXApiController { public class DashboardController extends BaseWXApiController {
@ -40,6 +38,14 @@ public class DashboardController extends BaseWXApiController {
private final TaskExamService taskExamService; private final TaskExamService taskExamService;
private final TaskExamCustomerAnswerService taskExamCustomerAnswerService; private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
@Autowired
public DashboardController(ExamPaperService examPaperService, TextContentService textContentService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService) {
this.examPaperService = examPaperService;
this.textContentService = textContentService;
this.taskExamService = taskExamService;
this.taskExamCustomerAnswerService = taskExamCustomerAnswerService;
}
@RequestMapping(value = "/index", method = RequestMethod.POST) @RequestMapping(value = "/index", method = RequestMethod.POST)
public RestResponse<IndexVM> index() { public RestResponse<IndexVM> index() {
IndexVM indexVM = new IndexVM(); IndexVM indexVM = new IndexVM();

View File

@ -13,15 +13,13 @@ import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.ExamUtil; import com.mindskip.xzs.utility.ExamUtil;
import com.mindskip.xzs.utility.PageInfoHelper; import com.mindskip.xzs.utility.PageInfoHelper;
import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;
import com.mindskip.xzs.viewmodel.student.exam.*;
import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM;
import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.domain.*;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperReadVM; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperReadVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM;
import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -34,7 +32,6 @@ import java.util.stream.Collectors;
@Controller("WXStudentExamPaperAnswerController") @Controller("WXStudentExamPaperAnswerController")
@RequestMapping(value = "/api/wx/student/exampaper/answer") @RequestMapping(value = "/api/wx/student/exampaper/answer")
@AllArgsConstructor
@ResponseBody @ResponseBody
public class ExamPaperAnswerController extends BaseWXApiController { public class ExamPaperAnswerController extends BaseWXApiController {
@ -43,6 +40,14 @@ public class ExamPaperAnswerController extends BaseWXApiController {
private final ApplicationEventPublisher eventPublisher; private final ApplicationEventPublisher eventPublisher;
private final ExamPaperService examPaperService; private final ExamPaperService examPaperService;
@Autowired
public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperService examPaperService) {
this.examPaperAnswerService = examPaperAnswerService;
this.subjectService = subjectService;
this.eventPublisher = eventPublisher;
this.examPaperService = examPaperService;
}
@RequestMapping(value = "/pageList", method = RequestMethod.POST) @RequestMapping(value = "/pageList", method = RequestMethod.POST)
public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@Valid ExamPaperAnswerPageVM model) { public RestResponse<PageInfo<ExamPaperAnswerPageResponseVM>> pageList(@Valid ExamPaperAnswerPageVM model) {
model.setCreateUser(getCurrentUser().getId()); model.setCreateUser(getCurrentUser().getId());

View File

@ -12,7 +12,7 @@ import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageResponseVM; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageResponseVM;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -21,13 +21,18 @@ import javax.validation.Valid;
@Controller("WXStudentExamController") @Controller("WXStudentExamController")
@RequestMapping(value = "/api/wx/student/exampaper") @RequestMapping(value = "/api/wx/student/exampaper")
@AllArgsConstructor
@ResponseBody @ResponseBody
public class ExamPaperController extends BaseWXApiController { public class ExamPaperController extends BaseWXApiController {
private final ExamPaperService examPaperService; private final ExamPaperService examPaperService;
private final SubjectService subjectService; private final SubjectService subjectService;
@Autowired
public ExamPaperController(ExamPaperService examPaperService, SubjectService subjectService) {
this.examPaperService = examPaperService;
this.subjectService = subjectService;
}
@RequestMapping(value = "/select/{id}", method = RequestMethod.POST) @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) { public RestResponse<ExamPaperEditRequestVM> select(@PathVariable Integer id) {

View File

@ -17,9 +17,8 @@ import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.PageInfoHelper; import com.mindskip.xzs.utility.PageInfoHelper;
import com.mindskip.xzs.viewmodel.student.user.*; import com.mindskip.xzs.viewmodel.student.user.*;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.viewmodel.student.user.*;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -36,7 +35,6 @@ import java.util.stream.Collectors;
*/ */
@Controller("WXStudentUserController") @Controller("WXStudentUserController")
@RequestMapping(value = "/api/wx/student/user") @RequestMapping(value = "/api/wx/student/user")
@AllArgsConstructor
@ResponseBody @ResponseBody
public class UserController extends BaseWXApiController { public class UserController extends BaseWXApiController {
@ -46,6 +44,15 @@ public class UserController extends BaseWXApiController {
private final AuthenticationService authenticationService; private final AuthenticationService authenticationService;
private final ApplicationEventPublisher eventPublisher; private final ApplicationEventPublisher eventPublisher;
@Autowired
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) @RequestMapping(value = "/current", method = RequestMethod.POST)
public RestResponse<UserResponseVM> current() { public RestResponse<UserResponseVM> current() {
User user = getCurrentUser(); User user = getCurrentUser();