|
@@ -0,0 +1,88 @@
|
|
|
+package cn.com.qmth.stmms.api.controller.admin;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import com.qmth.boot.core.collection.PageResult;
|
|
|
+
|
|
|
+import cn.com.qmth.stmms.api.controller.BaseApiController;
|
|
|
+import cn.com.qmth.stmms.biz.exam.bean.StudentCheckVo;
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.CheckStudent;
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
|
+import cn.com.qmth.stmms.biz.exam.query.CheckStudentSearchQuery;
|
|
|
+import cn.com.qmth.stmms.biz.exam.query.ExamStudentSearchQuery;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.CheckStudentService;
|
|
|
+import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
|
+import cn.com.qmth.stmms.biz.utils.PageUtil;
|
|
|
+import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
+import cn.com.qmth.stmms.common.enums.CheckType;
|
|
|
+import cn.com.qmth.stmms.common.enums.LogType;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+@Api(tags = "人工确认")
|
|
|
+@Controller("adminCheckStudentController")
|
|
|
+@RequestMapping("/api/admin/exam/check/student")
|
|
|
+public class CheckStudentController extends BaseApiController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentService studentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CheckStudentService checkStudentService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "确认类型")
|
|
|
+ @RequestMapping(value = "types", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public List<CheckType> typeList() {
|
|
|
+ return Arrays.asList(CheckType.values());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Logging(menu = "人工确认查询", type = LogType.QUERY)
|
|
|
+ @ApiOperation(value = "人工确认查询")
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "list", method = RequestMethod.POST)
|
|
|
+ public PageResult<StudentCheckVo> list(CheckStudentSearchQuery query) {
|
|
|
+ int examId = getSessionExamId();
|
|
|
+ List<CheckStudent> list = null;
|
|
|
+ if (StringUtils.isNotBlank(query.getSubjectCode())) {
|
|
|
+ list = checkStudentService.findByExamIdAndSubjectCodeAndCheckedAndType(examId, query.getSubjectCode(),
|
|
|
+ false, CheckType.MANUAL);
|
|
|
+ } else {
|
|
|
+ list = checkStudentService.findByExamIdAndCheckedAndType(examId, false, CheckType.MANUAL);
|
|
|
+ }
|
|
|
+ List<Integer> studentIds = new ArrayList<Integer>();
|
|
|
+ for (CheckStudent c : list) {
|
|
|
+ studentIds.add(c.getStudentId());
|
|
|
+ }
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ ExamStudentSearchQuery sQuery = new ExamStudentSearchQuery();
|
|
|
+ sQuery.setExamId(examId);
|
|
|
+ sQuery.setPageNumber(query.getPageNumber());
|
|
|
+ sQuery.setPageSize(query.getPageSize());
|
|
|
+ sQuery.setSubjectCode(query.getSubjectCode());
|
|
|
+ sQuery.setExamSite(query.getExamSite());
|
|
|
+ sQuery.setStudentIds(studentIds);
|
|
|
+ List<ExamStudent> studentList = studentService.findByQuery(sQuery).getResult();
|
|
|
+ query.setTotalCount(sQuery.getTotalCount());
|
|
|
+ query.setTotalPage(sQuery.getTotalPage());
|
|
|
+ List<StudentCheckVo> ret = new ArrayList<>();
|
|
|
+ for (ExamStudent student : studentList) {
|
|
|
+ ret.add(StudentCheckVo.of(student));
|
|
|
+ }
|
|
|
+ return PageUtil.of(ret, query);
|
|
|
+ } else {
|
|
|
+ return PageUtil.emptyPage();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|