ソースを参照

update for devops tool api

deason 2 年 前
コミット
5dc2a737ba
15 ファイル変更834 行追加641 行削除
  1. 26 0
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/DevOpsController.java
  2. 22 13
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamScoreController.java
  3. 45 58
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamStudentController.java
  4. 2 0
      examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamRecordDataRepo.java
  5. 13 16
      examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamRecordQuestionsRepo.java
  6. 5 3
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamScoreService.java
  7. 9 6
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamStudentService.java
  8. 6 6
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditEntityConvert.java
  9. 44 44
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditExcel.java
  10. 10 2
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examscore/ExamScoreInfo.java
  11. 219 219
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentEntityConvert.java
  12. 46 45
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentExcel.java
  13. 4 0
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordServiceImpl.java
  14. 227 79
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamScoreServiceImpl.java
  15. 156 150
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamStudentServiceImpl.java

+ 26 - 0
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/DevOpsController.java

@@ -0,0 +1,26 @@
+package cn.com.qmth.examcloud.core.oe.admin.api.controller;
+
+import cn.com.qmth.examcloud.web.support.Naked;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "运维接口")
+@RestController
+@RequestMapping("${$rmp.ctr.oe}")
+public class DevOpsController {
+
+    private static final Logger log = LoggerFactory.getLogger(DevOpsController.class);
+
+    @Naked
+    @ApiOperation(value = "运维监控检测接口")
+    @GetMapping("/devops")
+    public Long devops() {
+        return System.currentTimeMillis();
+    }
+
+}

+ 22 - 13
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamScoreController.java

@@ -40,12 +40,12 @@ public class ExamScoreController extends ControllerSupport {
     @Autowired
     private ExamScoreService examScoreService;
 
-    @DataRule(type = {DataRuleType.COURSE,DataRuleType.ORG})
+    @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @PostMapping("/statistic/list")
     @ApiOperation(value = "查询“成绩统计”列表(分页)")
     public Page<ExamScoreInfo> getExamAuditList(@RequestBody ExamScoreQuery query) {
-    	UserDataRules uds=new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
-        Page<ExamScoreInfo> examScoreList = examScoreService.getExamScoreList(uds,query);
+        UserDataRules uds = new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
+        Page<ExamScoreInfo> examScoreList = examScoreService.getExamScoreList(uds, query);
 
         examScoreList.getContent().forEach(p -> {
             p.setIdentityNumber(IdentityNumberHelper.conceal(getRootOrgId(), p.getIdentityNumber()));
@@ -53,16 +53,16 @@ public class ExamScoreController extends ControllerSupport {
         return examScoreList;
     }
 
-//    @Naked
-//    @GetMapping("/statistic/list/export")
-//    @ApiOperation(value = "导出“成绩统计”列表(Excel)", notes = "参数示例:query={\"pageNo\":1,\"pageSize\":10,\"examId\":123, ...}")
-//    public void exportExamRecordDetailList(@RequestParam String query, HttpServletResponse response) throws Exception {
-//        ExamScoreQuery newQuery = new JsonMapper().parseJson(query, ExamScoreQuery.class);
-//        Check.isNull(newQuery, "请求参数不能为空!");
-//        Check.isNull(newQuery.getExamId(), "请先选择考试批次!");
-//        List<ExamScoreInfo> examScoreList = examScoreService.exportExamScoreList(newQuery);
-//        ExportUtils.exportEXCEL("成绩统计列表", ExamScoreInfo.class, examScoreList, response);
-//    }
+    //    @Naked
+    //    @GetMapping("/statistic/list/export")
+    //    @ApiOperation(value = "导出“成绩统计”列表(Excel)", notes = "参数示例:query={\"pageNo\":1,\"pageSize\":10,\"examId\":123, ...}")
+    //    public void exportExamRecordDetailList(@RequestParam String query, HttpServletResponse response) throws Exception {
+    //        ExamScoreQuery newQuery = new JsonMapper().parseJson(query, ExamScoreQuery.class);
+    //        Check.isNull(newQuery, "请求参数不能为空!");
+    //        Check.isNull(newQuery.getExamId(), "请先选择考试批次!");
+    //        List<ExamScoreInfo> examScoreList = examScoreService.exportExamScoreList(newQuery);
+    //        ExportUtils.exportEXCEL("成绩统计列表", ExamScoreInfo.class, examScoreList, response);
+    //    }
 
     @GetMapping("/statistic/list/export/async")
     @ApiOperation(value = "导出“成绩统计”列表(异步)",
@@ -80,4 +80,13 @@ public class ExamScoreController extends ControllerSupport {
         return examScoreService.queryObjectiveScoreList(examStudentId);
     }
 
+    @ApiOperation(value = "按考生ID更新正确答案并重新算分")
+    @GetMapping("/updateCorrectAnswerAndReFixScore")
+    public void updateCorrectAnswerAndReFixScore(
+            @RequestParam Long examId,
+            @RequestParam Long courseId,
+            @RequestParam Long examStudentId) {
+        examScoreService.updateCorrectAnswerAndReFixScore(examId, courseId, examStudentId);
+    }
+
 }

+ 45 - 58
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamStudentController.java

@@ -7,25 +7,6 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.api.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
 import cn.com.qmth.examcloud.api.commons.enums.AdminOperateType;
 import cn.com.qmth.examcloud.api.commons.enums.DataRuleType;
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
@@ -35,20 +16,12 @@ import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.excel.ExportUtils;
 import cn.com.qmth.examcloud.core.oe.admin.dao.IllegallyTypeRepo;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.oe.admin.dao.entity.IllegallyTypeEntity;
 import cn.com.qmth.examcloud.core.oe.admin.service.AsyncExportService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.CourseCompleteProgressExcel;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.CourseProgressInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentEntityConvert;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentExcel;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentFinishedStatistic;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentOrgStatistic;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentQuery;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentUnFinishedExcel;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.OrgCompleteProgressExcel;
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.util.AsyncExportConcurrentUtil;
 import cn.com.qmth.examcloud.reports.commons.bean.AdminOperateReport;
 import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
@@ -59,6 +32,14 @@ import cn.com.qmth.examcloud.web.security.DataRule;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * 考生信息接口
@@ -107,14 +88,14 @@ public class ExamStudentController extends ControllerSupport {
         timer.schedule(new CleanCourseBeanCacheTask(), delay, period);
     }
 
-    @DataRule(type = {DataRuleType.COURSE,DataRuleType.ORG})
+    @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @PostMapping("/examScheduling/list")
     @ApiOperation(value = "查询“考试进度详情”列表(分页)")
     public Page<ExamStudentInfo> getExamScheduling(@RequestBody ExamStudentQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "考试批次不能为空!");
-        UserDataRules uds=new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
-        Page<ExamStudentInfo> examStudentListPage = examStudentService.getExamStudentListPage(uds,query);
+        UserDataRules uds = new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
+        Page<ExamStudentInfo> examStudentListPage = examStudentService.getExamStudentListPage(uds, query);
 
         examStudentListPage.getContent().forEach(p -> {
             p.setIdentityNumber(IdentityNumberHelper.conceal(p.getRootOrgId(), p.getIdentityNumber()));
@@ -122,15 +103,15 @@ public class ExamStudentController extends ControllerSupport {
         return examStudentListPage;
     }
 
-    @DataRule(type = {DataRuleType.COURSE,DataRuleType.ORG})
+    @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @GetMapping("/examScheduling/list/export")
     @ApiOperation(value = "导出“考试进度详情”列表(Excel)", notes = "参数示例:query={\"pageNo\":1,\"pageSize\":10,\"examId\":123, ...}")
     public void exportExamStudentList(@RequestParam String query, HttpServletResponse response) throws Exception {
         ExamStudentQuery newQuery = new JsonMapper().parseJson(query, ExamStudentQuery.class);
         Check.isNull(newQuery, "请求参数不能为空!");
         Check.isNull(newQuery.getExamId(), "请先选择考试批次!");
-        UserDataRules uds=new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
-        List<ExamStudentInfo> examStudentInfoList = examStudentService.getExamStudentInfoList(uds,newQuery);
+        UserDataRules uds = new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
+        List<ExamStudentInfo> examStudentInfoList = examStudentService.getExamStudentInfoList(uds, newQuery);
         List<ExamStudentExcel> list = ExamStudentEntityConvert.ofExcel(examStudentInfoList);
         ExportUtils.exportEXCEL("考试详情列表", ExamStudentExcel.class, list, response);
         //        ExcelExportUtil.exportExcel("考试详情列表", ExamStudentExcel.class, list, response);
@@ -145,43 +126,43 @@ public class ExamStudentController extends ControllerSupport {
         ReportsUtil.report(new AdminOperateReport(user.getRootOrgId(), user.getUserId(), AdminOperateType.TYPE19.getDesc(), "导出条件:" + query));
     }
 
-    @DataRule(type = {DataRuleType.COURSE,DataRuleType.ORG})
+    @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @PostMapping("/unfinished/list")
     @ApiOperation(value = "查询“缺考登记”列表(分页)")
     public Page<ExamStudentInfo> getExamStudentUnFinishedList(@RequestBody ExamStudentQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "考试批次不能为空!");
         query.setFinished(0);
-        UserDataRules uds=new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
-        Page<ExamStudentInfo> examStudentListPage = examStudentService.getExamStudentListPage(uds,query);
+        UserDataRules uds = new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
+        Page<ExamStudentInfo> examStudentListPage = examStudentService.getExamStudentListPage(uds, query);
         examStudentListPage.getContent().forEach(p -> {
             p.setIdentityNumber(IdentityNumberHelper.conceal(p.getRootOrgId(), p.getIdentityNumber()));
         });
         return examStudentListPage;
     }
 
-    @DataRule(type = {DataRuleType.COURSE,DataRuleType.ORG})
+    @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @GetMapping("/unfinished/list/export")
     @ApiOperation(value = "导出“缺考登记”列表(Excel)", notes = "参数示例:query={\"pageNo\":1,\"pageSize\":10,\"examId\":123, ...}")
     public void exportExamStudentUnFinishedList(@RequestParam String query, HttpServletResponse response) throws Exception {
-    	ExamStudentQuery newQuery = new JsonMapper().parseJson(query, ExamStudentQuery.class);
+        ExamStudentQuery newQuery = new JsonMapper().parseJson(query, ExamStudentQuery.class);
         Check.isNull(newQuery, "请求参数不能为空!");
         Check.isNull(newQuery.getExamId(), "请先选择考试批次!");
         newQuery.setFinished(0);//未完成
-        UserDataRules uds=new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
-        List<ExamStudentInfo> examStudentInfos = examStudentService.getExamStudentInfoList(uds,newQuery);
+        UserDataRules uds = new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
+        List<ExamStudentInfo> examStudentInfos = examStudentService.getExamStudentInfoList(uds, newQuery);
         List<ExamStudentUnFinishedExcel> list = ExamStudentEntityConvert.ofUnFinishedExcel(examStudentInfos);
         ExportUtils.exportEXCEL("缺考登记列表", ExamStudentUnFinishedExcel.class, list, response);
     }
 
-    @DataRule(type = {DataRuleType.COURSE,DataRuleType.ORG})
+    @DataRule(type = {DataRuleType.COURSE, DataRuleType.ORG})
     @PostMapping("/reexamine/list")
     @ApiOperation(value = "查询重考考生列表(分页)")
     public Page<ExamStudentInfo> getReExamineStudentList(@RequestBody ExamStudentQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "考试批次不能为空!");
-        UserDataRules uds=new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
-        Page<ExamStudentInfo> reExamineStudentList = examStudentService.getReExamineStudentList(uds,query);
+        UserDataRules uds = new UserDataRules(getUserDataRule(DataRuleType.ORG), getUserDataRule(DataRuleType.COURSE));
+        Page<ExamStudentInfo> reExamineStudentList = examStudentService.getReExamineStudentList(uds, query);
         reExamineStudentList.getContent().forEach(p -> {
             p.setIdentityNumber(IdentityNumberHelper.conceal(p.getRootOrgId(), p.getIdentityNumber()));
         });
@@ -231,7 +212,7 @@ public class ExamStudentController extends ControllerSupport {
         if (examId == null) {
             return null;
         }
-        return examStudentService.getExamStudentStatisticByOrg(getUserDataRule(DataRuleType.ORG),examId, examStageId, orgId);
+        return examStudentService.getExamStudentStatisticByOrg(getUserDataRule(DataRuleType.ORG), examId, examStageId, orgId);
     }
 
     @DataRule(type = {DataRuleType.ORG})
@@ -243,7 +224,7 @@ public class ExamStudentController extends ControllerSupport {
                                                 HttpServletResponse response) throws Exception {
         Check.isNull(examId, "请选择考试批次!");
         List<ExamStudentOrgStatistic> examStudentStatisticByOrgList =
-                examStudentService.getExamStudentStatisticByOrg(getUserDataRule(DataRuleType.ORG),examId, examStageId, orgId);
+                examStudentService.getExamStudentStatisticByOrg(getUserDataRule(DataRuleType.ORG), examId, examStageId, orgId);
         List<OrgCompleteProgressExcel> resultList =
                 ExamStudentEntityConvert.copyFromExamStudentOrgStatistic(examStudentStatisticByOrgList);
         ExportUtils.exportEXCEL("学习中心完成进度", OrgCompleteProgressExcel.class, resultList, response);
@@ -266,16 +247,16 @@ public class ExamStudentController extends ControllerSupport {
             return null;
         }
         List<Long> courseIdList = examStudentService.findCoursesFromExamStudent(examId, examStageId, orgId);
-        UserDataRule ud=getUserDataRule(DataRuleType.COURSE);
+        UserDataRule ud = getUserDataRule(DataRuleType.COURSE);
         List<CourseCacheBean> courseBeanList = new ArrayList<CourseCacheBean>();
-        if(ud.assertEmptyQueryResult()) {
-        	return courseBeanList;
+        if (ud.assertEmptyQueryResult()) {
+            return courseBeanList;
         }
         for (Long courseId : courseIdList) {
-        	if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(courseId)) {
-	            CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);
-	            courseBeanList.add(courseBean);
-        	}
+            if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(courseId)) {
+                CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);
+                courseBeanList.add(courseBean);
+            }
         }
         return courseBeanList;
     }
@@ -297,9 +278,9 @@ public class ExamStudentController extends ControllerSupport {
         if (examId == null) {
             return null;
         }
-        UserDataRule ud=getUserDataRule(DataRuleType.COURSE);
+        UserDataRule ud = getUserDataRule(DataRuleType.COURSE);
         List<CourseProgressInfo> courseProgressInfoList =
-                examStudentService.queryCourseProgressInfos(ud,examId, examStageId, courseId, orderColumn);
+                examStudentService.queryCourseProgressInfos(ud, examId, examStageId, courseId, orderColumn);
         if (courseProgressInfoList != null && courseProgressInfoList.size() > 0) {
             for (CourseProgressInfo courseProgressInfo : courseProgressInfoList) {
                 long key = courseProgressInfo.getCourseId();
@@ -320,9 +301,9 @@ public class ExamStudentController extends ControllerSupport {
                                           @RequestParam(required = false) String orderColumn,
                                           HttpServletResponse response) throws Exception {
         Check.isNull(examId, "请选择考试批次!");
-        UserDataRule ud=getUserDataRule(DataRuleType.COURSE);
+        UserDataRule ud = getUserDataRule(DataRuleType.COURSE);
         List<CourseProgressInfo> courseProgressInfoList =
-                examStudentService.queryCourseProgressInfos(ud,examId, examStageId, courseId, orderColumn);
+                examStudentService.queryCourseProgressInfos(ud, examId, examStageId, courseId, orderColumn);
         if (courseProgressInfoList != null && courseProgressInfoList.size() > 0) {
             for (CourseProgressInfo courseProgressInfo : courseProgressInfoList) {
                 long key = courseProgressInfo.getCourseId();
@@ -336,4 +317,10 @@ public class ExamStudentController extends ControllerSupport {
         ExportUtils.exportEXCEL("课程完成进度", CourseCompleteProgressExcel.class, resultList, response);
     }
 
+    @PostMapping("/simple/list")
+    @ApiOperation(value = "查询网考考生列表(分页)")
+    public Page<ExamStudentEntity> getExamStudentSimpleList(@RequestBody ExamStudentQuery query) {
+        return examStudentService.getExamStudentSimpleList(query);
+    }
+
 }

+ 2 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamRecordDataRepo.java

@@ -24,6 +24,8 @@ public interface ExamRecordDataRepo extends JpaRepository<ExamRecordDataEntity,
 
     List<ExamRecordDataEntity> findByExamStudentId(Long examStudentId);
 
+    List<ExamRecordDataEntity> findByExamIdAndCourseIdAndExamStudentId(Long examId, Long courseId, Long examStudentId);
+
     /**
      * 查询有效的考试记录(已结束且未违纪的)
      *

+ 13 - 16
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamRecordQuestionsRepo.java

@@ -1,29 +1,26 @@
 package cn.com.qmth.examcloud.core.oe.admin.dao;
 
-import java.util.List;
-
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordQuestionsEntity;
 import org.springframework.data.mongodb.repository.MongoRepository;
 import org.springframework.data.repository.query.QueryByExampleExecutor;
 import org.springframework.stereotype.Repository;
 
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordQuestionsEntity;
+import java.util.List;
 
 /**
- * 
- * @author  	chenken
- * @date    	2018年9月3日 上午10:48:39
- * @company 	QMTH
+ * @author chenken
+ * @date 2018年9月3日 上午10:48:39
+ * @company QMTH
  * @description ExamRecordQuestionsRepo.java
  */
 @Repository
-public interface ExamRecordQuestionsRepo  extends MongoRepository<ExamRecordQuestionsEntity, String>,QueryByExampleExecutor<ExamRecordQuestionsEntity>{
-	
-	ExamRecordQuestionsEntity findByExamRecordDataId(Long examRecordDataId);
-	/**
-	 * 考试记录id集合获取相应的考试记录
-	 * @param examRecordDataId
-	 * @return
-	 */
-	List<ExamRecordQuestionsEntity> findByExamRecordDataIdIn(List<Long> examRecordDataIdList);
+public interface ExamRecordQuestionsRepo extends MongoRepository<ExamRecordQuestionsEntity, String>, QueryByExampleExecutor<ExamRecordQuestionsEntity> {
+
+    ExamRecordQuestionsEntity findByExamRecordDataId(Long examRecordDataId);
+
+    /**
+     * 考试记录id集合获取相应的考试记录
+     */
+    List<ExamRecordQuestionsEntity> findByExamRecordDataIdIn(List<Long> examRecordDataIdList);
 
 }

+ 5 - 3
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamScoreService.java

@@ -24,9 +24,9 @@ import java.util.List;
  */
 public interface ExamScoreService {
 
-    Page<ExamScoreInfo> getExamScoreList(UserDataRules uds,ExamScoreQuery query);
+    Page<ExamScoreInfo> getExamScoreList(UserDataRules uds, ExamScoreQuery query);
 
-//    List<ExamScoreInfo> exportExamScoreList(ExamScoreQuery query);
+    //    List<ExamScoreInfo> exportExamScoreList(ExamScoreQuery query);
 
     /**
      * 获取所有的考试分数集合
@@ -55,6 +55,8 @@ public interface ExamScoreService {
      */
     public List<ObjectiveScoreInfo> queryObjectiveScoreList(Long examStudentId);
 
-    List<ExamScoreInfo> exportExamScoreListForAsync(UserDataRules uds,ExamScoreQuery query);
+    List<ExamScoreInfo> exportExamScoreListForAsync(UserDataRules uds, ExamScoreQuery query);
+
+    void updateCorrectAnswerAndReFixScore(Long examId, Long courseId, Long examStudentId);
 
 }

+ 9 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamStudentService.java

@@ -9,6 +9,7 @@ package cn.com.qmth.examcloud.core.oe.admin.service;
 
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.api.commons.security.bean.UserDataRule;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.OnHandExamInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
@@ -50,8 +51,8 @@ public interface ExamStudentService {
 
     /**
      * 查询考生列表(分页)
-     * @param uds 
      *
+     * @param uds
      * @param query
      * @return
      */
@@ -64,7 +65,7 @@ public interface ExamStudentService {
      * @param query
      * @return
      */
-    Page<ExamStudentInfo> getReExamineStudentList(UserDataRules uds,ExamStudentQuery query);
+    Page<ExamStudentInfo> getReExamineStudentList(UserDataRules uds, ExamStudentQuery query);
 
     /**
      * 考试概况-按考试完成进度统计
@@ -82,7 +83,7 @@ public interface ExamStudentService {
      * @param examStageId
      * @return
      */
-    List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(UserDataRule ud,Long examId, Long examStageId, Long orgId);
+    List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(UserDataRule ud, Long examId, Long examStageId, Long orgId);
 
     /**
      * 获取考生信息
@@ -124,7 +125,7 @@ public interface ExamStudentService {
      * @param examId
      * @param courseId
      */
-    public List<CourseProgressInfo> queryCourseProgressInfos(UserDataRule ud,Long examId, Long examStageId, Long courseId, String orderColumn);
+    public List<CourseProgressInfo> queryCourseProgressInfos(UserDataRule ud, Long examId, Long examStageId, Long courseId, String orderColumn);
 
     /**
      * @return java.util.List<cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo>
@@ -147,8 +148,10 @@ public interface ExamStudentService {
 
     List<OnHandExamInfo> queryOnlineExamEndList(Long userId, ExamType online);
 
-	List<ExamStudentInfo> getExamStudentInfoList(UserDataRules uds, ExamStudentQuery query);
+    List<ExamStudentInfo> getExamStudentInfoList(UserDataRules uds, ExamStudentQuery query);
 
-	List<ExamStudentInfo> getExamStudentInfoListForAsync(UserDataRules uds, ExamStudentQuery query);
+    List<ExamStudentInfo> getExamStudentInfoListForAsync(UserDataRules uds, ExamStudentQuery query);
+
+    Page<ExamStudentEntity> getExamStudentSimpleList(ExamStudentQuery query);
 
 }

+ 6 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditEntityConvert.java

@@ -97,14 +97,14 @@ public class ExamAuditEntityConvert {
 			 */
 			excel.setExamStageId(e.getExamStageId());
 			if(excel.getExamStageId()!=null) {
-				ExamStageCacheBean stage=CacheHelper.getExamStage(excel.getExamId(), excel.getExamStageId());
-				excel.setExamStageOrder(stage.getStageOrder());
-				excel.setStartTime(stage.getStartTime());
-				excel.setEndTime(stage.getEndTime());
-				excel.setExamStage(stage.getStageOrder() + "("
+    			ExamStageCacheBean stage=CacheHelper.getExamStage(excel.getExamId(), excel.getExamStageId());
+    			excel.setExamStageOrder(stage.getStageOrder());
+    			excel.setStartTime(stage.getStartTime());
+    			excel.setEndTime(stage.getEndTime());
+    			excel.setExamStage(stage.getStageOrder() + "("
 						+ DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
 						+ DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
-			}
+    		}
 			excel.setOrgName(e.getOrgName());
 			excel.setDisciplineType(e.getDisciplineType());
 			excel.setExamName(e.getExamName());

+ 44 - 44
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditExcel.java

@@ -72,21 +72,21 @@ public class ExamAuditExcel implements JsonSerializable {
 
     @ExcelProperty(name = "Ip", index = 16)
     private String ip;
-
+    
     private Long examId;
-
+    
     @ExcelProperty(name = "场次", width = 30, index = 17)
     private String examStage;
-
+    
     private Long examStageId;
-
+    
     private Integer examStageOrder;
-
+    
     /**
      * 场次开始时间
      */
     private Date startTime;
-
+    
     /**
      * 场次结束时间
      */
@@ -228,54 +228,54 @@ public class ExamAuditExcel implements JsonSerializable {
         this.ip = ip;
     }
 
-    public Integer getExamStageOrder() {
-        return examStageOrder;
-    }
-
-    public void setExamStageOrder(Integer examStageOrder) {
-        this.examStageOrder = examStageOrder;
-    }
-
-    public String getExamStage() {
-        return examStage;
-    }
+	public Integer getExamStageOrder() {
+		return examStageOrder;
+	}
 
-    public void setExamStage(String examStage) {
-        this.examStage = examStage;
-    }
+	public void setExamStageOrder(Integer examStageOrder) {
+		this.examStageOrder = examStageOrder;
+	}
 
-    public Long getExamStageId() {
-        return examStageId;
-    }
+	public String getExamStage() {
+		return examStage;
+	}
 
-    public void setExamStageId(Long examStageId) {
-        this.examStageId = examStageId;
-    }
+	public void setExamStage(String examStage) {
+		this.examStage = examStage;
+	}
 
-    public Date getStartTime() {
-        return startTime;
-    }
+	public Long getExamStageId() {
+		return examStageId;
+	}
 
-    public void setStartTime(Date startTime) {
-        this.startTime = startTime;
-    }
+	public void setExamStageId(Long examStageId) {
+		this.examStageId = examStageId;
+	}
 
-    public Date getEndTime() {
-        return endTime;
-    }
+	public Date getStartTime() {
+		return startTime;
+	}
 
-    public void setEndTime(Date endTime) {
-        this.endTime = endTime;
-    }
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
 
-    public Long getExamId() {
-        return examId;
-    }
+	public Date getEndTime() {
+		return endTime;
+	}
 
-    public void setExamId(Long examId) {
-        this.examId = examId;
-    }
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
 
+	public Long getExamId() {
+		return examId;
+	}
 
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
 
+	
+    
 }

+ 10 - 2
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examscore/ExamScoreInfo.java

@@ -184,6 +184,8 @@ public class ExamScoreInfo implements JsonSerializable {
      */
     private Date stageEndTime;
 
+    private Long examRecordDataId;
+
     public Long getExamId() {
         return examId;
     }
@@ -431,7 +433,13 @@ public class ExamScoreInfo implements JsonSerializable {
 	public void setStageEndTime(Date stageEndTime) {
 		this.stageEndTime = stageEndTime;
 	}
-    
-    
+
+    public Long getExamRecordDataId() {
+        return examRecordDataId;
+    }
+
+    public void setExamRecordDataId(Long examRecordDataId) {
+        this.examRecordDataId = examRecordDataId;
+    }
 
 }

+ 219 - 219
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentEntityConvert.java

@@ -33,237 +33,237 @@ import java.util.stream.Collectors;
  */
 public class ExamStudentEntityConvert {
 
-    public static ExamStudentEntity of(ExamStudentInfo info) {
-        if (info == null) {
-            return null;
-        }
-        ExamStudentEntity entity = new ExamStudentEntity();
-        entity.setId(info.getId());
-        entity.setExamStudentId(info.getExamStudentId());
-        entity.setExamId(info.getExamId());
-        entity.setStudentId(info.getStudentId());
-        entity.setStudentCode(info.getStudentCode());
-        entity.setStudentName(info.getStudentName());
-        entity.setIdentityNumber(info.getIdentityNumber());
-        entity.setCourseId(info.getCourseId());
-        entity.setCourseCode(info.getCourseCode());
-        entity.setCourseLevel(info.getCourseLevel());
-        entity.setOrgId(info.getOrgId());
-        entity.setRootOrgId(info.getRootOrgId());
-        entity.setSpecialtyCode(info.getSpecialtyCode());
-        entity.setSpecialtyName(info.getSpecialtyName());
-        entity.setPaperType(info.getPaperType());
-        entity.setInfoCollector(info.getInfoCollector());
-        entity.setFinished(info.getFinished());
-        entity.setUsedNum(info.getUsedNum());
-        entity.setExtraNum(info.getExtraNum());
-        return entity;
-    }
+	public static ExamStudentEntity of(ExamStudentInfo info) {
+		if (info == null) {
+			return null;
+		}
+		ExamStudentEntity entity = new ExamStudentEntity();
+		entity.setId(info.getId());
+		entity.setExamStudentId(info.getExamStudentId());
+		entity.setExamId(info.getExamId());
+		entity.setStudentId(info.getStudentId());
+		entity.setStudentCode(info.getStudentCode());
+		entity.setStudentName(info.getStudentName());
+		entity.setIdentityNumber(info.getIdentityNumber());
+		entity.setCourseId(info.getCourseId());
+		entity.setCourseCode(info.getCourseCode());
+		entity.setCourseLevel(info.getCourseLevel());
+		entity.setOrgId(info.getOrgId());
+		entity.setRootOrgId(info.getRootOrgId());
+		entity.setSpecialtyCode(info.getSpecialtyCode());
+		entity.setSpecialtyName(info.getSpecialtyName());
+		entity.setPaperType(info.getPaperType());
+		entity.setInfoCollector(info.getInfoCollector());
+		entity.setFinished(info.getFinished());
+		entity.setUsedNum(info.getUsedNum());
+		entity.setExtraNum(info.getExtraNum());
+		return entity;
+	}
 
-    public static ExamStudentInfo of(ExamStudentEntity entity) {
-        if (entity == null) {
-            return null;
-        }
-        ExamStudentInfo info = new ExamStudentInfo();
-        info.setId(entity.getId());
-        info.setExamStudentId(entity.getExamStudentId());
-        info.setExamId(entity.getExamId());
-        info.setStudentId(entity.getStudentId());
-        info.setStudentCode(entity.getStudentCode());
-        info.setStudentName(entity.getStudentName());
-        info.setIdentityNumber(entity.getIdentityNumber());
-        info.setCourseId(entity.getCourseId());
-        info.setCourseCode(entity.getCourseCode());
-        info.setCourseLevel(CourseLevel.getCourseLevelTitle(entity.getCourseLevel()));
-        info.setOrgId(entity.getOrgId());
-        info.setRootOrgId(entity.getRootOrgId());
-        info.setSpecialtyCode(entity.getSpecialtyCode());
-        info.setSpecialtyName(entity.getSpecialtyName());
-        info.setPaperType(entity.getPaperType());
-        info.setInfoCollector(entity.getInfoCollector());
-        info.setFinished(entity.getFinished());
-        info.setUsedNum(entity.getUsedNum());
-        info.setExtraNum(entity.getExtraNum());
-        info.setGrade(entity.getGrade());
-        info.setExamStageId(entity.getExamStageId());
-        return info;
-    }
+	public static ExamStudentInfo of(ExamStudentEntity entity) {
+		if (entity == null) {
+			return null;
+		}
+		ExamStudentInfo info = new ExamStudentInfo();
+		info.setId(entity.getId());
+		info.setExamStudentId(entity.getExamStudentId());
+		info.setExamId(entity.getExamId());
+		info.setStudentId(entity.getStudentId());
+		info.setStudentCode(entity.getStudentCode());
+		info.setStudentName(entity.getStudentName());
+		info.setIdentityNumber(entity.getIdentityNumber());
+		info.setCourseId(entity.getCourseId());
+		info.setCourseCode(entity.getCourseCode());
+		info.setCourseLevel(CourseLevel.getCourseLevelTitle(entity.getCourseLevel()));
+		info.setOrgId(entity.getOrgId());
+		info.setRootOrgId(entity.getRootOrgId());
+		info.setSpecialtyCode(entity.getSpecialtyCode());
+		info.setSpecialtyName(entity.getSpecialtyName());
+		info.setPaperType(entity.getPaperType());
+		info.setInfoCollector(entity.getInfoCollector());
+		info.setFinished(entity.getFinished());
+		info.setUsedNum(entity.getUsedNum());
+		info.setExtraNum(entity.getExtraNum());
+		info.setGrade(entity.getGrade());
+		info.setExamStageId(entity.getExamStageId());
+		return info;
+	}
 
-    public static List<ExamStudentExcel> ofExcel(List<ExamStudentInfo> examStudentInfoList) {
-        List<ExamStudentExcel> list = new ArrayList<>();
-        if (examStudentInfoList == null || examStudentInfoList.size() == 0) {
-            return list;
-        }
-        examStudentInfoList.forEach(e -> {
-            ExamStudentExcel excel = new ExamStudentExcel();
-            excel.setStudentCode(e.getStudentCode());
-            excel.setStudentName(e.getStudentName());
-            excel.setIdentityNumber(e.getIdentityNumber());
-            excel.setGrade(e.getGrade());
-            excel.setPhone(e.getPhone());
-            excel.setInfoCollector(e.getInfoCollector());
-            excel.setCourseCode(e.getCourseCode());
-            excel.setCourseName(e.getCourseName());
-            excel.setSpecialtyName(e.getSpecialtyName());
-            excel.setOrgName(e.getOrgName());
-            excel.setFinished(e.getFinishedStatus());
-            excel.setExamStageId(e.getExamStageId());
-            excel.setExamId(e.getExamId());
-            list.add(excel);
-        });
-        return list;
-    }
+	public static List<ExamStudentExcel> ofExcel(List<ExamStudentInfo> examStudentInfoList) {
+		List<ExamStudentExcel> list = new ArrayList<>();
+		if (examStudentInfoList == null || examStudentInfoList.size() == 0) {
+			return list;
+		}
+		examStudentInfoList.forEach(e -> {
+			ExamStudentExcel excel = new ExamStudentExcel();
+			excel.setStudentCode(e.getStudentCode());
+			excel.setStudentName(e.getStudentName());
+			excel.setIdentityNumber(e.getIdentityNumber());
+			excel.setGrade(e.getGrade());
+			excel.setPhone(e.getPhone());
+			excel.setInfoCollector(e.getInfoCollector());
+			excel.setCourseCode(e.getCourseCode());
+			excel.setCourseName(e.getCourseName());
+			excel.setSpecialtyName(e.getSpecialtyName());
+			excel.setOrgName(e.getOrgName());
+			excel.setFinished(e.getFinishedStatus());
+			excel.setExamStageId(e.getExamStageId());
+			excel.setExamId(e.getExamId());
+			list.add(excel);
+		});
+		return list;
+	}
 
-    public static List<ExamStudentUnFinishedExcel> ofUnFinishedExcel(Page<ExamStudentInfo> page) {
-        List<ExamStudentUnFinishedExcel> list = new ArrayList<>();
-        if (page == null || page.getContent() == null) {
-            return list;
-        }
-        page.getContent().forEach(e -> {
-            ExamStudentUnFinishedExcel excel = new ExamStudentUnFinishedExcel();
-            excel.setStudentCode(e.getStudentCode());
-            excel.setStudentName(e.getStudentName());
-            excel.setIdentityNumber(e.getIdentityNumber());
-            excel.setCourseCode(e.getCourseCode());
-            excel.setCourseName(e.getCourseName());
-            excel.setOrgCode(e.getOrgCode());
-            excel.setOrgName(e.getOrgName());
-            excel.setInfoCollector(e.getInfoCollector());
-            excel.setPaperType(e.getPaperType());
-            excel.setSpecialtyName(e.getSpecialtyName());
-            excel.setExamSiteName(e.getExamSiteName());
-            excel.setGrade(e.getGrade());
-            excel.setPhone(e.getPhone());
-            list.add(excel);
-        });
-        return list;
-    }
+	public static List<ExamStudentUnFinishedExcel> ofUnFinishedExcel(Page<ExamStudentInfo> page) {
+		List<ExamStudentUnFinishedExcel> list = new ArrayList<>();
+		if (page == null || page.getContent() == null) {
+			return list;
+		}
+		page.getContent().forEach(e -> {
+			ExamStudentUnFinishedExcel excel = new ExamStudentUnFinishedExcel();
+			excel.setStudentCode(e.getStudentCode());
+			excel.setStudentName(e.getStudentName());
+			excel.setIdentityNumber(e.getIdentityNumber());
+			excel.setCourseCode(e.getCourseCode());
+			excel.setCourseName(e.getCourseName());
+			excel.setOrgCode(e.getOrgCode());
+			excel.setOrgName(e.getOrgName());
+			excel.setInfoCollector(e.getInfoCollector());
+			excel.setPaperType(e.getPaperType());
+			excel.setSpecialtyName(e.getSpecialtyName());
+			excel.setExamSiteName(e.getExamSiteName());
+			excel.setGrade(e.getGrade());
+			excel.setPhone(e.getPhone());
+			list.add(excel);
+		});
+		return list;
+	}
 
-    public static List<ExamStudentUnFinishedExcel> ofUnFinishedExcel(List<ExamStudentInfo> examStudentInfos) {
-        List<ExamStudentUnFinishedExcel> list = new ArrayList<>();
-        if (examStudentInfos == null || examStudentInfos.size() == 0) {
-            return list;
-        }
-        examStudentInfos.forEach(e -> {
-            ExamStudentUnFinishedExcel excel = new ExamStudentUnFinishedExcel();
-            excel.setStudentCode(e.getStudentCode());
-            excel.setStudentName(e.getStudentName());
-            excel.setIdentityNumber(e.getIdentityNumber());
-            excel.setCourseCode(e.getCourseCode());
-            excel.setCourseName(e.getCourseName());
-            excel.setOrgCode(e.getOrgCode());
-            excel.setOrgName(e.getOrgName());
-            excel.setInfoCollector(e.getInfoCollector());
-            excel.setPaperType(e.getPaperType());
-            excel.setSpecialtyName(e.getSpecialtyName());
-            excel.setExamSiteName(e.getExamSiteName());
-            excel.setGrade(e.getGrade());
-            excel.setPhone(e.getPhone());
-            excel.setExamStageOrder(e.getExamStageOrder());
-            excel.setStartTime(e.getStartTime());
-            excel.setEndTime(e.getEndTime());
-            if (e.getExamStageOrder() != null) {
-                excel.setExamStage(e.getExamStageOrder() + "("
-                        + DateUtil.format(e.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
-                        + DateUtil.format(e.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
-            }
-            list.add(excel);
-        });
-        return list;
-    }
+	public static List<ExamStudentUnFinishedExcel> ofUnFinishedExcel(List<ExamStudentInfo> examStudentInfos) {
+		List<ExamStudentUnFinishedExcel> list = new ArrayList<>();
+		if (examStudentInfos == null || examStudentInfos.size() == 0) {
+			return list;
+		}
+		examStudentInfos.forEach(e -> {
+			ExamStudentUnFinishedExcel excel = new ExamStudentUnFinishedExcel();
+			excel.setStudentCode(e.getStudentCode());
+			excel.setStudentName(e.getStudentName());
+			excel.setIdentityNumber(e.getIdentityNumber());
+			excel.setCourseCode(e.getCourseCode());
+			excel.setCourseName(e.getCourseName());
+			excel.setOrgCode(e.getOrgCode());
+			excel.setOrgName(e.getOrgName());
+			excel.setInfoCollector(e.getInfoCollector());
+			excel.setPaperType(e.getPaperType());
+			excel.setSpecialtyName(e.getSpecialtyName());
+			excel.setExamSiteName(e.getExamSiteName());
+			excel.setGrade(e.getGrade());
+			excel.setPhone(e.getPhone());
+			excel.setExamStageOrder(e.getExamStageOrder());
+			excel.setStartTime(e.getStartTime());
+			excel.setEndTime(e.getEndTime());
+			if (e.getExamStageOrder() != null) {
+				excel.setExamStage(e.getExamStageOrder() + "("
+						+ DateUtil.format(e.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
+						+ DateUtil.format(e.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
+			}
+			list.add(excel);
+		});
+		return list;
+	}
 
-    public static Page<ExamStudentInfo> of(Page<ExamStudentEntity> page) {
-        Pageable pageable = PageRequest.of(page.getNumber(), page.getSize());
-        List<ExamStudentEntity> entities = page.getContent();
-        if (entities == null || entities.size() == 0) {
-            return new PageImpl<>(Lists.newArrayList(), pageable, page.getTotalElements());
-        }
-        List<ExamStudentInfo> list = entities.stream().map(entity -> of(entity)).collect(Collectors.toList());
-        return new PageImpl<>(list, pageable, page.getTotalElements());
-    }
+	public static Page<ExamStudentInfo> of(Page<ExamStudentEntity> page) {
+		Pageable pageable = PageRequest.of(page.getNumber(), page.getSize());
+		List<ExamStudentEntity> entities = page.getContent();
+		if (entities == null || entities.size() == 0) {
+			return new PageImpl<>(Lists.newArrayList(), pageable, page.getTotalElements());
+		}
+		List<ExamStudentInfo> list = entities.stream().map(entity -> of(entity)).collect(Collectors.toList());
+		return new PageImpl<>(list, pageable, page.getTotalElements());
+	}
 
-    public static List<ExamStudentInfo> of(List<HashMap> maps) {
-        if (maps == null || maps.size() == 0) {
-            return Lists.newArrayList();
-        }
-        List<ExamStudentInfo> list = new ArrayList<>();
-        for (Map map : maps) {
-            try {
-                // 转换Map数据
-                ExamStudentInfo info = new ExamStudentInfo();
-                BeanUtils.populate(info, map);
-                // 转换枚举名称
-                info.setCourseLevel(CourseLevel.getCourseLevelTitle(info.getCourseLevel()));
-                list.add(info);
-            } catch (Exception e) {
-                throw new ExamCloudRuntimeException(e.getMessage(), e.getCause());
-            }
-        }
-        return list;
-    }
+	public static List<ExamStudentInfo> of(List<HashMap> maps) {
+		if (maps == null || maps.size() == 0) {
+			return Lists.newArrayList();
+		}
+		List<ExamStudentInfo> list = new ArrayList<>();
+		for (Map map : maps) {
+			try {
+				// 转换Map数据
+				ExamStudentInfo info = new ExamStudentInfo();
+				BeanUtils.populate(info, map);
+				// 转换枚举名称
+				info.setCourseLevel(CourseLevel.getCourseLevelTitle(info.getCourseLevel()));
+				list.add(info);
+			} catch (Exception e) {
+				throw new ExamCloudRuntimeException(e.getMessage(), e.getCause());
+			}
+		}
+		return list;
+	}
 
-    public static List<ExamStudentOrgStatistic> ofList(List<HashMap> maps) {
-        if (maps == null || maps.size() == 0) {
-            return Lists.newArrayList();
-        }
-        List<ExamStudentOrgStatistic> list = new ArrayList<>();
-        for (Map map : maps) {
-            try {
-                // 转换Map数据
-                ExamStudentOrgStatistic info = new ExamStudentOrgStatistic();
-                BeanUtils.populate(info, map);
-                if (info.getTotalCount() == 0 || info.getFinishedCount() == 0) {
-                    info.setFinishedPercent("0");
-                } else {
-                    double percent = (double) info.getFinishedCount() / info.getTotalCount();
-                    info.setFinishedPercent(new DecimalFormat("#.00").format(percent * 100));
-                }
-                list.add(info);
-            } catch (Exception e) {
-                throw new ExamCloudRuntimeException(e.getMessage(), e.getCause());
-            }
-        }
-        return list;
-    }
+	public static List<ExamStudentOrgStatistic> ofList(List<HashMap> maps) {
+		if (maps == null || maps.size() == 0) {
+			return Lists.newArrayList();
+		}
+		List<ExamStudentOrgStatistic> list = new ArrayList<>();
+		for (Map map : maps) {
+			try {
+				// 转换Map数据
+				ExamStudentOrgStatistic info = new ExamStudentOrgStatistic();
+				BeanUtils.populate(info, map);
+				if (info.getTotalCount() == 0 || info.getFinishedCount() == 0) {
+					info.setFinishedPercent("0");
+				} else {
+					double percent = (double) info.getFinishedCount() / info.getTotalCount();
+					info.setFinishedPercent(new DecimalFormat("#.00").format(percent * 100));
+				}
+				list.add(info);
+			} catch (Exception e) {
+				throw new ExamCloudRuntimeException(e.getMessage(), e.getCause());
+			}
+		}
+		return list;
+	}
 
-    public static List<CourseCompleteProgressExcel> copyFromCourseProgressInfo(
-            List<CourseProgressInfo> courseProgressInfoList) {
-        List<CourseCompleteProgressExcel> resultList = new ArrayList<>();
-        if (courseProgressInfoList == null || courseProgressInfoList.isEmpty()) {
-            return resultList;
-        }
+	public static List<CourseCompleteProgressExcel> copyFromCourseProgressInfo(
+			List<CourseProgressInfo> courseProgressInfoList) {
+		List<CourseCompleteProgressExcel> resultList = new ArrayList<>();
+		if (courseProgressInfoList == null || courseProgressInfoList.isEmpty()) {
+			return resultList;
+		}
 
-        courseProgressInfoList.forEach(info -> {
-            CourseCompleteProgressExcel excel = new CourseCompleteProgressExcel();
-            excel.setAllNum(info.getAllNum());
-            excel.setCompletedNum(info.getCompletedNum());
-            excel.setCompletedProportion(info.getCompletedProportion());
-            excel.setCourseCode(info.getCourseCode());
-            excel.setCourseName(info.getCourseName());
-            resultList.add(excel);
-        });
+		courseProgressInfoList.forEach(info -> {
+			CourseCompleteProgressExcel excel = new CourseCompleteProgressExcel();
+			excel.setAllNum(info.getAllNum());
+			excel.setCompletedNum(info.getCompletedNum());
+			excel.setCompletedProportion(info.getCompletedProportion());
+			excel.setCourseCode(info.getCourseCode());
+			excel.setCourseName(info.getCourseName());
+			resultList.add(excel);
+		});
 
-        return resultList;
-    }
+		return resultList;
+	}
 
-    public static List<OrgCompleteProgressExcel> copyFromExamStudentOrgStatistic(
-            List<ExamStudentOrgStatistic> examStudentOrgStatisticList) {
-        List<OrgCompleteProgressExcel> resultList = new ArrayList<>();
-        if (examStudentOrgStatisticList == null || examStudentOrgStatisticList.isEmpty()) {
-            return resultList;
-        }
+	public static List<OrgCompleteProgressExcel> copyFromExamStudentOrgStatistic(
+			List<ExamStudentOrgStatistic> examStudentOrgStatisticList) {
+		List<OrgCompleteProgressExcel> resultList = new ArrayList<>();
+		if (examStudentOrgStatisticList == null || examStudentOrgStatisticList.isEmpty()) {
+			return resultList;
+		}
 
-        examStudentOrgStatisticList.forEach(info -> {
-            OrgCompleteProgressExcel excel = new OrgCompleteProgressExcel();
-            excel.setFinishedCount(info.getFinishedCount());
-            excel.setFinishedPercent(info.getFinishedPercent());
-            excel.setOrgCode(info.getOrgCode());
-            excel.setOrgName(info.getOrgName());
-            excel.setTotalCount(info.getTotalCount());
-            resultList.add(excel);
-        });
+		examStudentOrgStatisticList.forEach(info -> {
+			OrgCompleteProgressExcel excel = new OrgCompleteProgressExcel();
+			excel.setFinishedCount(info.getFinishedCount());
+			excel.setFinishedPercent(info.getFinishedPercent());
+			excel.setOrgCode(info.getOrgCode());
+			excel.setOrgName(info.getOrgName());
+			excel.setTotalCount(info.getTotalCount());
+			resultList.add(excel);
+		});
 
-        return resultList;
-    }
+		return resultList;
+	}
 
 }

+ 46 - 45
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examstudent/ExamStudentExcel.java

@@ -8,11 +8,11 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent;
 
 
-import cn.com.qmth.examcloud.support.excel.ExcelProperty;
-
 import java.io.Serializable;
 import java.util.Date;
 
+import cn.com.qmth.examcloud.support.excel.ExcelProperty;
+
 /**
  * 考生信息-Excel格式
  *
@@ -53,21 +53,21 @@ public class ExamStudentExcel implements Serializable {
 
     @ExcelProperty(name = "完成状态", index = 11)
     private String finished;
-
+    
     private Long examId;
-
+    
     @ExcelProperty(name = "场次", width = 30, index = 12)
     private String examStage;
-
+    
     private Long examStageId;
-
+    
     private Integer examStageOrder;
-
+    
     /**
      * 场次开始时间
      */
     private Date stageStartTime;
-
+    
     /**
      * 场次结束时间
      */
@@ -161,53 +161,54 @@ public class ExamStudentExcel implements Serializable {
         this.finished = finished;
     }
 
-    public Integer getExamStageOrder() {
-        return examStageOrder;
-    }
+	public Integer getExamStageOrder() {
+		return examStageOrder;
+	}
 
-    public void setExamStageOrder(Integer examStageOrder) {
-        this.examStageOrder = examStageOrder;
-    }
+	public void setExamStageOrder(Integer examStageOrder) {
+		this.examStageOrder = examStageOrder;
+	}
 
-    public Long getExamId() {
-        return examId;
-    }
+	public Long getExamId() {
+		return examId;
+	}
 
-    public void setExamId(Long examId) {
-        this.examId = examId;
-    }
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
 
-    public String getExamStage() {
-        return examStage;
-    }
+	public String getExamStage() {
+		return examStage;
+	}
 
-    public void setExamStage(String examStage) {
-        this.examStage = examStage;
-    }
+	public void setExamStage(String examStage) {
+		this.examStage = examStage;
+	}
 
-    public Long getExamStageId() {
-        return examStageId;
-    }
+	public Long getExamStageId() {
+		return examStageId;
+	}
 
-    public void setExamStageId(Long examStageId) {
-        this.examStageId = examStageId;
-    }
+	public void setExamStageId(Long examStageId) {
+		this.examStageId = examStageId;
+	}
 
-    public Date getStageStartTime() {
-        return stageStartTime;
-    }
+	public Date getStageStartTime() {
+		return stageStartTime;
+	}
 
-    public void setStageStartTime(Date stageStartTime) {
-        this.stageStartTime = stageStartTime;
-    }
+	public void setStageStartTime(Date stageStartTime) {
+		this.stageStartTime = stageStartTime;
+	}
 
-    public Date getStageEndTime() {
-        return stageEndTime;
-    }
-
-    public void setStageEndTime(Date stageEndTime) {
-        this.stageEndTime = stageEndTime;
-    }
+	public Date getStageEndTime() {
+		return stageEndTime;
+	}
 
+	public void setStageEndTime(Date stageEndTime) {
+		this.stageEndTime = stageEndTime;
+	}
+    
+    
 
 }

+ 4 - 0
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordServiceImpl.java

@@ -254,6 +254,10 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         Check.isNull(query.getExamId(), "请先选择考试批次!");
         //默认条件
         query.setIsAudit(false);
+
+        // 改为只查询“需要审核的”
+        // query.setIsWarn(true);
+
         query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
         query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
         return this.getExamRecordList(uds, query);

+ 227 - 79
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamScoreServiceImpl.java

@@ -7,60 +7,52 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Pageable;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
-import com.google.common.collect.Lists;
-
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.commons.util.DateUtil;
 import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SpecUtils;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.CommonUtil;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordForMarkingRepo;
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordQuestionsRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamScoreEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentFinalScoreEntity;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.*;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentFinalScoreService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
-import cn.com.qmth.examcloud.core.oe.admin.service.GainBaseDataService;
+import cn.com.qmth.examcloud.core.oe.admin.service.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examscore.ExamScoreEntityConvert;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examscore.ExamScoreInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examscore.ExamScoreQuery;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examscore.ObjectiveScoreInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
+import cn.com.qmth.examcloud.question.commons.core.question.QuestionType;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamStageCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.*;
 import cn.com.qmth.examcloud.support.enums.ExamProperties;
 import cn.com.qmth.examcloud.support.examing.ExamBoss;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
 import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.DecimalFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 考试分数相关接口
@@ -70,13 +62,24 @@ import cn.com.qmth.examcloud.web.redis.RedisClient;
  */
 @Service
 public class ExamScoreServiceImpl implements ExamScoreService {
-	
+
+    private static final Logger log = LoggerFactory.getLogger(ExamScoreServiceImpl.class);
+
     @Autowired
     private ExamScoreRepo examScoreRepo;
 
     @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
 
+    @Autowired
+    private ExamRecordQuestionsRepo examRecordQuestionsRepo;
+
+    @Autowired
+    private ExamRecordForMarkingRepo examRecordForMarkingRepo;
+
+    @Autowired
+    private ExamRecordQuestionsService examRecordQuestionsService;
+
     @Autowired
     private ExamStudentService examStudentService;
 
@@ -96,7 +99,7 @@ public class ExamScoreServiceImpl implements ExamScoreService {
     private ExamStudentFinalScoreService examStudentFinalScoreService;
 
     @Override
-    public Page<ExamScoreInfo> getExamScoreList(UserDataRules uds,ExamScoreQuery query) {
+    public Page<ExamScoreInfo> getExamScoreList(UserDataRules uds, ExamScoreQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "请先选择考试批次!");
         Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize());
@@ -107,7 +110,7 @@ public class ExamScoreServiceImpl implements ExamScoreService {
                 getDefaultCachedExamProperty(query.getExamId(), ExamProperties.MARKING_TYPE.name()).getValue();
 
         //获取考生列表
-        Page<ExamStudentInfo> page = examStudentService.getExamStudentListPage(uds,ExamScoreEntityConvert.of(query));
+        Page<ExamStudentInfo> page = examStudentService.getExamStudentListPage(uds, ExamScoreEntityConvert.of(query));
         List<ExamStudentInfo> examStudentList = page.getContent();
         if (examStudentList == null || examStudentList.size() == 0) {
             return new PageImpl<ExamScoreInfo>(Lists.newArrayList(), pageable, page.getTotalElements());
@@ -123,22 +126,22 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         fillStage(examScoreList);
         return new PageImpl<ExamScoreInfo>(examScoreList, pageable, page.getTotalElements());
     }
-    
+
     private void fillStage(List<ExamScoreInfo> list) {
-    	if(CollectionUtils.isEmpty(list)) {
-    		return;
-    	}
-    	for(ExamScoreInfo info:list) {
-    		if(info.getExamStageId()!=null) {
-    			ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
-    			info.setExamStageOrder(stage.getStageOrder());
-    			info.setStageStartTime(stage.getStartTime());
-    			info.setStageEndTime(stage.getEndTime());
-    			info.setExamStage(stage.getStageOrder() + "("
-						+ DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
-						+ DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
-    		}
-    	}
+        if (CollectionUtils.isEmpty(list)) {
+            return;
+        }
+        for (ExamScoreInfo info : list) {
+            if (info.getExamStageId() != null) {
+                ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
+                info.setExamStageOrder(stage.getStageOrder());
+                info.setStageStartTime(stage.getStartTime());
+                info.setStageEndTime(stage.getEndTime());
+                info.setExamStage(stage.getStageOrder() + "("
+                        + DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
+                        + DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
+            }
+        }
     }
 
     /**
@@ -177,10 +180,10 @@ public class ExamScoreServiceImpl implements ExamScoreService {
     }
 
     @Override
-    public List<ExamScoreInfo> exportExamScoreListForAsync(UserDataRules uds,ExamScoreQuery query) {
-    	if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
-    		return Lists.newArrayList();
-    	}
+    public List<ExamScoreInfo> exportExamScoreListForAsync(UserDataRules uds, ExamScoreQuery query) {
+        if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
+            return Lists.newArrayList();
+        }
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "请先选择考试批次!");
 
@@ -188,17 +191,17 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         String markingType = ExamCacheTransferHelper.
                 getDefaultCachedExamProperty(query.getExamId(), ExamProperties.MARKING_TYPE.name()).getValue();
         if (query.getStartLimit() != null && query.getEndLimit() != null) {
-            return getExamStudentInfoListOfScoreExport(uds,query, markingType);
+            return getExamStudentInfoListOfScoreExport(uds, query, markingType);
         } else {
             List<ExamStudentEntity> examStudentList = new ArrayList<ExamStudentEntity>();
             int pageNo = 1;
             int pageSize = 200;
             for (; ; ) {
-                List<ExamStudentEntity> tem = getExamStudentInfoListOfScoreExportByPage(uds,query, markingType, pageNo,pageSize);
+                List<ExamStudentEntity> tem = getExamStudentInfoListOfScoreExportByPage(uds, query, markingType, pageNo, pageSize);
                 if (tem == null || tem.size() == 0) {
                     break;
                 } else {
-                	pageNo++;
+                    pageNo++;
                     examStudentList.addAll(tem);
                 }
             }
@@ -219,7 +222,7 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         }
     }
 
-    private List<ExamStudentEntity> getExamStudentInfoListOfScoreExportByPage(UserDataRules uds,ExamScoreQuery query, String markingType,int pageNo, int pageSize) {
+    private List<ExamStudentEntity> getExamStudentInfoListOfScoreExportByPage(UserDataRules uds, ExamScoreQuery query, String markingType, int pageNo, int pageSize) {
         //查询条件
         StringBuffer sql = new StringBuffer();
         sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level,finished,student_id,student_code,student_name,identity_number"
@@ -252,11 +255,11 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         if (query.getFinished() != null) {
             sql.append(" and finished= " + query.getFinished());
         }
-        if(uds.getOrgRule().assertNeedQueryRefIds()) {
-        	sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
+        if (uds.getOrgRule().assertNeedQueryRefIds()) {
+            sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
         }
-        if(uds.getCourseRule().assertNeedQueryRefIds()) {
-        	sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
+        if (uds.getCourseRule().assertNeedQueryRefIds()) {
+            sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
         }
         int currentNum = (pageNo - 1) * pageSize;
         sql.append(" order by id limit " + currentNum + "," + pageSize);
@@ -271,16 +274,16 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         return examStudentList;
     }
 
-//    @Override
-//    public List<ExamScoreInfo> exportExamScoreList(ExamScoreQuery query) {
-//        Check.isNull(query, "查询参数不能为空!");
-//        Check.isNull(query.getExamId(), "请先选择考试批次!");
-//
-//        //阅卷方式
-//        String markingType = ExamCacheTransferHelper.
-//                getDefaultCachedExamProperty(query.getExamId(), ExamProperties.MARKING_TYPE.name()).getValue();
-//        return getExamStudentInfoListOfScoreExport(query, markingType);
-//    }
+    //    @Override
+    //    public List<ExamScoreInfo> exportExamScoreList(ExamScoreQuery query) {
+    //        Check.isNull(query, "查询参数不能为空!");
+    //        Check.isNull(query.getExamId(), "请先选择考试批次!");
+    //
+    //        //阅卷方式
+    //        String markingType = ExamCacheTransferHelper.
+    //                getDefaultCachedExamProperty(query.getExamId(), ExamProperties.MARKING_TYPE.name()).getValue();
+    //        return getExamStudentInfoListOfScoreExport(query, markingType);
+    //    }
 
     @Override
     public List<ExamScoreEntity> getAllExamScoreList(Long examId, String identityNumber, Long courseId) {
@@ -294,7 +297,7 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         return examScoreRepo.findByExamRecordDataIdIn(examRecordDataIds);
     }
 
-    private List<ExamScoreInfo> getExamStudentInfoListOfScoreExport(UserDataRules uds,ExamScoreQuery query, String markingType) {
+    private List<ExamScoreInfo> getExamStudentInfoListOfScoreExport(UserDataRules uds, ExamScoreQuery query, String markingType) {
         Check.isNull(query, "查询参数不能为空!");
         //查询条件
         StringBuffer sql = new StringBuffer();
@@ -328,11 +331,11 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         if (query.getFinished() != null) {
             sql.append(" and finished= " + query.getFinished());
         }
-        if(uds.getOrgRule().assertNeedQueryRefIds()) {
-        	sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
+        if (uds.getOrgRule().assertNeedQueryRefIds()) {
+            sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
         }
-        if(uds.getCourseRule().assertNeedQueryRefIds()) {
-        	sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
+        if (uds.getCourseRule().assertNeedQueryRefIds()) {
+            sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
         }
         sql.append(" order by id");
 
@@ -420,6 +423,11 @@ public class ExamScoreServiceImpl implements ExamScoreService {
             ExamStudentFinalScoreEntity finalExamScore = examStudentFinalScoreService.getFinalEffectiveExamScore(examStudentId);
             setFinalExamScore(examScoreInfo, finalExamScore);
 
+            if (finalExamScore != null) {
+                // 违纪未审核 存在最终分为空情况
+                examScoreInfo.setExamRecordDataId(finalExamScore.getExamRecordDataId());
+            }
+
             //需求调整20200923:将开考时间,改为最终成绩的更新时间
             examScoreInfo.setStartTime(getExamStudentFinalScoreUpdateTime(finalExamScore));
         } else {
@@ -432,6 +440,7 @@ public class ExamScoreServiceImpl implements ExamScoreService {
             examScoreInfo.setFinalExamScore("--");//最终成绩
             examScoreInfo.setStartTime("--");//考试开始时间
         }
+
         return examScoreInfo;
     }
 
@@ -528,8 +537,8 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         examStudentEntity.setSpecialtyCode(rs.getString("specialty_code"));
         examStudentEntity.setSpecialtyName(rs.getString("specialty_name"));
         examStudentEntity.setGrade(rs.getString("grade"));
-        if(rs.getString("exam_stage_id")!=null) {
-        	examStudentEntity.setExamStageId(rs.getLong("exam_stage_id"));
+        if (rs.getString("exam_stage_id") != null) {
+            examStudentEntity.setExamStageId(rs.getLong("exam_stage_id"));
         }
         return examStudentEntity;
     }
@@ -709,4 +718,143 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         return false;
     }
 
+    @Override
+    public void updateCorrectAnswerAndReFixScore(Long examId, Long courseId, Long examStudentId) {
+        List<ExamRecordDataEntity> examRecordDataList = examRecordDataRepo.findByExamIdAndCourseIdAndExamStudentId(examId, courseId, examStudentId);
+        if (CollectionUtils.isEmpty(examRecordDataList)) {
+            log.warn("updateCorrectAnswerAndReFixScore examRecordDataList is empty, examStudentId = {}", examStudentId);
+            return;
+        }
+
+        // Map<试题ID, 正确答案列表>
+        Map<String, List<String>> questionAnswerMaps = new HashMap<>();
+        boolean needUpdateFinalScore = false;
+
+        for (ExamRecordDataEntity examRecordData : examRecordDataList) {
+            ExamRecordQuestionsEntity examRecordQuestion = examRecordQuestionsService.getExamRecordQuestionsAndFixExamRecordDataIfNecessary(examRecordData);
+            if (examRecordQuestion == null) {
+                log.warn("updateCorrectAnswerAndReFixScore examRecordQuestions is null, examRecordDataId = {}", examRecordData.getId());
+                continue;
+            }
+
+            // 所有客观题的试题ID列表
+            List<ExamQuestionEntity> examQuestions = examRecordQuestion.getExamQuestionEntities();
+            Set<String> objectiveQuestionIds = examQuestions.stream()
+                    .filter(e -> isObjective(e.getQuestionType()))
+                    .map(ExamQuestionEntity::getQuestionId)
+                    .collect(Collectors.toSet());
+
+            double objectiveScore = 0d; // 客观题得分
+            int totalObjective = 0; // 客观题总数
+            int totalRightObjective = 0; // 客观题作答正确数
+            boolean needUpdateExamRecordQuestions = false;
+
+            for (String curQuestionId : objectiveQuestionIds) {
+                // 按题号由小到大提取相同题ID的小题列表(注:套题的子题ID相同)
+                List<ExamQuestionEntity> questionUnits = examQuestions.stream().
+                        filter(e -> e.getQuestionId().equals(curQuestionId)).
+                        sorted(Comparator.comparingInt(ExamQuestionEntity::getOrder))
+                        .collect(Collectors.toList());
+
+                for (ExamQuestionEntity e : questionUnits) {
+                    if (isObjective(e.getQuestionType())) {
+                        totalObjective++;
+                    }
+                }
+
+                // 获取当前题的正确答案
+                List<String> rightAnswers;
+                if (questionAnswerMaps.containsKey(curQuestionId)) {
+                    rightAnswers = questionAnswerMaps.get(curQuestionId);
+                } else {
+                    QuestionAnswerCacheBean questionAnswer = CacheHelper.getQuestionAnswer(curQuestionId);
+                    rightAnswers = questionAnswer.getRightAnswers();
+                    questionAnswerMaps.put(curQuestionId, rightAnswers);
+                }
+
+                if (CollectionUtils.isEmpty(rightAnswers)) {
+                    log.warn("updateCorrectAnswerAndReFixScore rightAnswers is empty, questionId = {}", curQuestionId);
+                    continue;
+                }
+
+                if (questionUnits.size() != rightAnswers.size()) {
+                    log.warn("updateCorrectAnswerAndReFixScore rightAnswers incorrect, questionId = {}", curQuestionId);
+                    continue;
+                }
+
+                for (int i = 0; i < questionUnits.size(); i++) {
+                    ExamQuestionEntity curQuestion = questionUnits.get(i);
+                    if (!isObjective(curQuestion.getQuestionType())) {
+                        // 跳过套题内主观题
+                        continue;
+                    }
+
+                    // 答案不一致,则更新
+                    String rightAnswer = rightAnswers.get(i);
+                    if (rightAnswer != null && !rightAnswer.equals(curQuestion.getCorrectAnswer())) {
+                        curQuestion.setCorrectAnswer(rightAnswer);
+                        needUpdateExamRecordQuestions = true;
+                    }
+
+                    // 计算得分
+                    String correctAnswer = curQuestion.getCorrectAnswer();
+                    String studentAnswer = curQuestion.getStudentAnswer();
+                    // if (correctAnswer != null && QuestionOptionHelper.isEqualAnswer(correctAnswer, studentAnswer)) {
+                    if (correctAnswer != null && correctAnswer.equals(studentAnswer)) {
+                        objectiveScore += curQuestion.getQuestionScore();
+                        totalRightObjective++;
+                    }
+                }
+            }
+
+            if (needUpdateExamRecordQuestions) {
+                needUpdateFinalScore = true;
+
+                examRecordQuestionsRepo.save(examRecordQuestion);
+
+                ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
+                if (examScore != null) {
+                    double subjectiveScore = examScore.getSubjectiveScore() != null ? examScore.getSubjectiveScore() : 0d;
+
+                    double objectiveAccuracy = 0d;// 客观题正确率
+                    if (totalObjective > 0) {
+                        objectiveAccuracy = totalRightObjective * 100d / totalObjective;
+                        objectiveAccuracy = Double.parseDouble(new DecimalFormat("#.00").format(objectiveAccuracy));
+                    }
+
+                    examScore.setObjectiveScore(objectiveScore);
+                    examScore.setObjectiveAccuracy(objectiveAccuracy);
+                    examScore.setTotalScore(objectiveScore + subjectiveScore);
+                    examScoreRepo.save(examScore);
+                }
+
+                ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo.findByExamRecordDataId(examRecordData.getId());
+                if (examRecordForMarking != null) {
+                    examRecordForMarking.setObjectiveScore(objectiveScore);
+                    examRecordForMarkingRepo.save(examRecordForMarking);
+                }
+
+                log.info("updateCorrectAnswerAndReFixScore examRecordQuestions examRecordDataId = {}", examRecordData.getId());
+            }
+        }
+
+        if (needUpdateFinalScore) {
+            examStudentFinalScoreService.calcAndSaveFinalScore(examStudentId);
+            log.info("updateCorrectAnswerAndReFixScore finalScore examStudentId = {}", examStudentId);
+        }
+    }
+
+    /**
+     * 是否为客观题
+     */
+    public static boolean isObjective(QuestionType type) {
+        if (type == null) {
+            return false;
+        }
+
+        return QuestionType.SINGLE_CHOICE == type
+                || QuestionType.MULTIPLE_CHOICE == type
+                || QuestionType.TRUE_OR_FALSE == type;
+    }
+
 }

+ 156 - 150
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamStudentServiceImpl.java

@@ -7,44 +7,6 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticFinishedColumns;
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticOrgColumns;
-
-import java.math.BigDecimal;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.hibernate.query.NativeQuery;
-import org.hibernate.transform.Transformers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Pageable;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
-
 import cn.com.qmth.examcloud.api.commons.enums.ExamSpecialSettingsType;
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.api.commons.security.bean.UserDataRule;
@@ -69,21 +31,11 @@ import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FinishStatus;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentFinalScoreService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
-import cn.com.qmth.examcloud.core.oe.admin.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.admin.service.LocalCacheService;
+import cn.com.qmth.examcloud.core.oe.admin.service.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.OnHandExamInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordFileAnswerInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.CourseProgressInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentEntityConvert;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentFinishedStatistic;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentOrgStatistic;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentPartInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentQuery;
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.cache.ExamStudentCache;
 import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
 import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
@@ -91,12 +43,7 @@ import cn.com.qmth.examcloud.examwork.api.bean.ExamSpecialSettingsBean;
 import cn.com.qmth.examcloud.examwork.api.request.GetOngoingExamListReq;
 import cn.com.qmth.examcloud.examwork.api.response.GetOngoingExamListResp;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamStageCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.*;
 import cn.com.qmth.examcloud.support.enums.ExamProperties;
 import cn.com.qmth.examcloud.support.examing.ExamBoss;
 import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
@@ -104,6 +51,35 @@ import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
 import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.hibernate.query.NativeQuery;
+import org.hibernate.transform.Transformers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.persistence.criteria.Predicate;
+import java.math.BigDecimal;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.DecimalFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticFinishedColumns;
+import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticOrgColumns;
 
 /**
  * 考生信息接口
@@ -254,10 +230,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     }
 
     @Override
-    public Page<ExamStudentInfo> getExamStudentListPage(UserDataRules uds,ExamStudentQuery query) {
-    	if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
-    		return Page.empty();
-    	}
+    public Page<ExamStudentInfo> getExamStudentListPage(UserDataRules uds, ExamStudentQuery query) {
+        if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
+            return Page.empty();
+        }
         Check.isNull(query, "查询参数不能为空!");
 
         ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
@@ -274,7 +250,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         sql.append(",student_id,student_code,student_name,identity_number"
                 + ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
                 + ",specialty_code,specialty_name,grade,t1.exam_stage_id from ec_oe_exam_student t1 where 1=1 ");
-        sql.append(selectExamStudentConfitionSql(uds,query, examBean.getExamType()));
+        sql.append(selectExamStudentConfitionSql(uds, query, examBean.getExamType()));
         sql.append(" order by id desc");
         int currentNum = (query.getPageNo() - 1) * query.getPageSize();
         sql.append(" limit " + currentNum + "," + query.getPageSize());
@@ -307,35 +283,35 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         }
         cahcheMap.clear();
         Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize());
-        long totalSize = countExamStudent(uds,query, examBean.getExamType());
+        long totalSize = countExamStudent(uds, query, examBean.getExamType());
         fillStage(examStudentInfoList);
         return new PageImpl<>(examStudentInfoList, pageable, totalSize);
     }
 
     private void fillStage(List<ExamStudentInfo> list) {
-    	if(CollectionUtils.isEmpty(list)) {
-    		return;
-    	}
-    	for(ExamStudentInfo info:list) {
-    		if(info.getExamStageId()!=null) {
-    			ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
-    			info.setExamStageOrder(stage.getStageOrder());
-    			info.setStartTime(stage.getStartTime());
-    			info.setEndTime(stage.getEndTime());
-    		}
-    	}
+        if (CollectionUtils.isEmpty(list)) {
+            return;
+        }
+        for (ExamStudentInfo info : list) {
+            if (info.getExamStageId() != null) {
+                ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
+                info.setExamStageOrder(stage.getStageOrder());
+                info.setStartTime(stage.getStartTime());
+                info.setEndTime(stage.getEndTime());
+            }
+        }
     }
 
-    private long countExamStudent(UserDataRules uds,ExamStudentQuery query, String examType) {
+    private long countExamStudent(UserDataRules uds, ExamStudentQuery query, String examType) {
         //查询条件
         StringBuffer sql = new StringBuffer();
         sql.append("select count(t1.id) from ec_oe_exam_student t1 where 1=1 ");
-        sql.append(selectExamStudentConfitionSql(uds,query, examType));
+        sql.append(selectExamStudentConfitionSql(uds, query, examType));
         return jdbcTemplate.queryForObject(sql.toString(), Long.class);
     }
 
     @Override
-    public List<ExamStudentInfo> getExamStudentInfoListForAsync(UserDataRules uds,ExamStudentQuery query) {
+    public List<ExamStudentInfo> getExamStudentInfoListForAsync(UserDataRules uds, ExamStudentQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
 
@@ -343,7 +319,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         int pageNo = 1;
         int pageSize = 200;
         for (; ; ) {
-            List<ExamStudentEntity> tem = getExamStudentInfoListByPage(uds,query, examBean, pageNo, pageSize);
+            List<ExamStudentEntity> tem = getExamStudentInfoListByPage(uds, query, examBean, pageNo, pageSize);
             if (tem == null || tem.size() == 0) {
                 break;
             } else {
@@ -430,7 +406,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         tool.setDataForBatch(dataList, 100);
     }
 
-    private List<ExamStudentEntity> getExamStudentInfoListByPage(UserDataRules uds,ExamStudentQuery query, ExamSettingsCacheBean examBean, int pageNo, int pageSize) {
+    private List<ExamStudentEntity> getExamStudentInfoListByPage(UserDataRules uds, ExamStudentQuery query, ExamSettingsCacheBean examBean, int pageNo, int pageSize) {
         //查询条件
         StringBuffer sql = new StringBuffer();
         sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level");
@@ -443,7 +419,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         sql.append(",student_id,student_code,student_name,identity_number"
                 + ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
                 + ",specialty_code,specialty_name,grade,exam_stage_id from ec_oe_exam_student t1 where 1=1 ");
-        sql.append(selectExamStudentConfitionSql(uds,query, examBean.getExamType()));
+        sql.append(selectExamStudentConfitionSql(uds, query, examBean.getExamType()));
         int currentNum = (pageNo - 1) * pageSize;
         sql.append(" order by id limit " + currentNum + "," + pageSize);
 
@@ -458,10 +434,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     }
 
     @Override
-    public List<ExamStudentInfo> getExamStudentInfoList(UserDataRules uds,ExamStudentQuery query) {
-    	if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
-    		return Lists.newArrayList();
-    	}
+    public List<ExamStudentInfo> getExamStudentInfoList(UserDataRules uds, ExamStudentQuery query) {
+        if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
+            return Lists.newArrayList();
+        }
         Check.isNull(query, "查询参数不能为空!");
         ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
 
@@ -477,7 +453,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         sql.append(",student_id,student_code,student_name,identity_number"
                 + ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
                 + ",specialty_code,specialty_name,grade,t1.exam_stage_id from ec_oe_exam_student t1 where 1=1 ");
-        sql.append(selectExamStudentConfitionSql(uds,query, examBean.getExamType()));
+        sql.append(selectExamStudentConfitionSql(uds, query, examBean.getExamType()));
         sql.append(" order by id desc");
 
         List<ExamStudentEntity> examStudentList = jdbcTemplate.query(sql.toString(), new RowMapper<ExamStudentEntity>() {
@@ -511,7 +487,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         return examStudentInfoList;
     }
 
-    private StringBuffer selectExamStudentConfitionSql(UserDataRules uds,ExamStudentQuery query, String examType) {
+    private StringBuffer selectExamStudentConfitionSql(UserDataRules uds, ExamStudentQuery query, String examType) {
         StringBuffer sql = new StringBuffer();
         if (query.getOrgId() != null) {
             sql.append(" and org_id=" + query.getOrgId());
@@ -565,11 +541,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
 
             }
         }
-        if(uds.getOrgRule().assertNeedQueryRefIds()) {
-            sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
+        if (uds.getOrgRule().assertNeedQueryRefIds()) {
+            sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
         }
-        if(uds.getCourseRule().assertNeedQueryRefIds()) {
-            sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
+        if (uds.getCourseRule().assertNeedQueryRefIds()) {
+            sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
         }
         return sql;
     }
@@ -672,18 +648,18 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         examStudentEntity.setSpecialtyCode(rs.getString("specialty_code"));
         examStudentEntity.setSpecialtyName(rs.getString("specialty_name"));
         examStudentEntity.setGrade(rs.getString("grade"));
-        if(rs.getString("exam_stage_id")!=null) {
-        	examStudentEntity.setExamStageId(rs.getLong("exam_stage_id"));
+        if (rs.getString("exam_stage_id") != null) {
+            examStudentEntity.setExamStageId(rs.getLong("exam_stage_id"));
         }
 
         return examStudentEntity;
     }
 
     @Override
-    public Page<ExamStudentInfo> getReExamineStudentList(UserDataRules uds,ExamStudentQuery query) {
-    	if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
-    		return Page.empty();
-    	}
+    public Page<ExamStudentInfo> getReExamineStudentList(UserDataRules uds, ExamStudentQuery query) {
+        if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
+            return Page.empty();
+        }
         //获取考试的默认次数
         ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
 
@@ -743,11 +719,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         if (StringUtils.isNotBlank(query.getCourseLevel())) {
             sql.append(" and t.course_level= '" + query.getCourseLevel() + "'");
         }
-        if(uds.getOrgRule().assertNeedQueryRefIds()) {
-        	sql.append(" and t.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
+        if (uds.getOrgRule().assertNeedQueryRefIds()) {
+            sql.append(" and t.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
         }
-        if(uds.getCourseRule().assertNeedQueryRefIds()) {
-        	sql.append(" and t.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
+        if (uds.getCourseRule().assertNeedQueryRefIds()) {
+            sql.append(" and t.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
         }
         int currentNum = (query.getPageNo() - 1) * query.getPageSize();
         sql.append(" limit " + currentNum + "," + query.getPageSize());
@@ -776,7 +752,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 return examStudentEntity;
             }
         });
-        long totalSize = countReExamine(uds,query, examBean);
+        long totalSize = countReExamine(uds, query, examBean);
         List<ExamStudentInfo> list = new ArrayList<ExamStudentInfo>();
         for (ExamStudentEntity examStudentEntity : examStudentList) {
             ExamStudentInfo examStudentInfo = ExamStudentEntityConvert.of(examStudentEntity);
@@ -790,7 +766,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         return new PageImpl<>(list, pageable, totalSize);
     }
 
-    private Long countReExamine(UserDataRules uds,ExamStudentQuery query, ExamSettingsCacheBean examBean) {
+    private Long countReExamine(UserDataRules uds, ExamStudentQuery query, ExamSettingsCacheBean examBean) {
         StringBuffer sql = new StringBuffer();
         sql.append("SELECT count(*)" +
                 " FROM " +
@@ -822,17 +798,17 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         if (StringUtils.isNotBlank(query.getCourseLevel())) {
             sql.append(" and student.course_level= '" + query.getCourseLevel() + "'");
         }
-        if(uds.getOrgRule().assertNeedQueryRefIds()) {
-        	sql.append(" and student.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
+        if (uds.getOrgRule().assertNeedQueryRefIds()) {
+            sql.append(" and student.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
         }
-        if(uds.getCourseRule().assertNeedQueryRefIds()) {
-        	sql.append(" and student.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
+        if (uds.getCourseRule().assertNeedQueryRefIds()) {
+            sql.append(" and student.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
         }
         return jdbcTemplate.queryForObject(sql.toString(), Long.class);
     }
 
-    @SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
-	@Override
+    @SuppressWarnings({"deprecation", "unchecked", "rawtypes"})
+    @Override
     public ExamStudentFinishedStatistic getExamStudentStatisticByFinished(Long examId, Long examStageId) {
         ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
         if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
@@ -886,13 +862,13 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         }
     }
 
-    @SuppressWarnings({ "deprecation", "unchecked", "unused" })
-	@Override
-    public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(UserDataRule ud,Long examId, Long examStageId, Long orgId) {
-    	if(ud.assertEmptyQueryResult()) {
-    		return Lists.newArrayList();
-    	}
-    	ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
+    @SuppressWarnings({"deprecation", "unchecked", "unused"})
+    @Override
+    public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(UserDataRule ud, Long examId, Long examStageId, Long orgId) {
+        if (ud.assertEmptyQueryResult()) {
+            return Lists.newArrayList();
+        }
+        ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
         if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
                 ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
             StringBuffer totalsql = new StringBuffer();
@@ -936,11 +912,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                     statistic.setFinishedPercent(new DecimalFormat("#.00").format(percent * 100));
                 }
             }
-            List<ExamStudentOrgStatistic> ret=Lists.newArrayList();
+            List<ExamStudentOrgStatistic> ret = Lists.newArrayList();
             for (ExamStudentOrgStatistic statistic : totalList) {
-            	if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getOrgId())) {
-            		ret.add(statistic);
-            	}
+                if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getOrgId())) {
+                    ret.add(statistic);
+                }
             }
             return ret;
         } else {
@@ -965,11 +941,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 statistic.setOrgCode(orgBean.getCode());
                 statistic.setOrgName(orgBean.getName());
             }
-            List<ExamStudentOrgStatistic> ret=Lists.newArrayList();
+            List<ExamStudentOrgStatistic> ret = Lists.newArrayList();
             for (ExamStudentOrgStatistic statistic : examStudentOrgStatisticList) {
-            	if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getOrgId())) {
-            		ret.add(statistic);
-            	}
+                if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getOrgId())) {
+                    ret.add(statistic);
+                }
             }
             return ret;
         }
@@ -1046,11 +1022,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     }
 
     @Override
-    public List<CourseProgressInfo> queryCourseProgressInfos(UserDataRule ud,Long examId, Long examStageId,
+    public List<CourseProgressInfo> queryCourseProgressInfos(UserDataRule ud, Long examId, Long examStageId,
                                                              Long courseId, String orderColumn) {
-    	if(ud.assertEmptyQueryResult()) {
-    		return Lists.newArrayList();
-    	}
+        if (ud.assertEmptyQueryResult()) {
+            return Lists.newArrayList();
+        }
         if (examId == null) {
             return null;
         }
@@ -1099,11 +1075,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                     statistic.setCompletedProportion(Double.valueOf(new DecimalFormat("#.00").format(percent * 100)));
                 }
             }
-            List<CourseProgressInfo> ret=Lists.newArrayList();
+            List<CourseProgressInfo> ret = Lists.newArrayList();
             for (CourseProgressInfo statistic : totalList) {
-            	if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getCourseId())) {
-            		ret.add(statistic);
-            	}
+                if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getCourseId())) {
+                    ret.add(statistic);
+                }
             }
             return ret;
         } else {
@@ -1127,7 +1103,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
             }
             sql += " group by course_id ) tb ORDER BY " + orderColumn + " desc";
 
-            List<CourseProgressInfo> totalList= jdbcTemplate.query(sql, new RowMapper<CourseProgressInfo>() {
+            List<CourseProgressInfo> totalList = jdbcTemplate.query(sql, new RowMapper<CourseProgressInfo>() {
                 @Override
                 public CourseProgressInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
                     CourseProgressInfo courseProgressInfo = new CourseProgressInfo();
@@ -1139,11 +1115,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                     return courseProgressInfo;
                 }
             });
-            List<CourseProgressInfo> ret=Lists.newArrayList();
+            List<CourseProgressInfo> ret = Lists.newArrayList();
             for (CourseProgressInfo statistic : totalList) {
-            	if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getCourseId())) {
-            		ret.add(statistic);
-            	}
+                if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getCourseId())) {
+                    ret.add(statistic);
+                }
             }
             return ret;
         }
@@ -1229,13 +1205,13 @@ public class ExamStudentServiceImpl implements ExamStudentService {
             }
             ExamPropertyCacheBean showUndertaking = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.SHOW_UNDERTAKING.name());
             if (showUndertaking != null && StringUtil.isTrue(showUndertaking.getValue())) {
-            	info.setShowUndertaking(true);
-            	ExamPropertyCacheBean undertaking = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.UNDERTAKING.name());
-            	if (undertaking != null) {
-            		info.setUndertaking(undertaking.getValue());
-            	}
-            }else {
-            	info.setShowUndertaking(false);
+                info.setShowUndertaking(true);
+                ExamPropertyCacheBean undertaking = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.UNDERTAKING.name());
+                if (undertaking != null) {
+                    info.setUndertaking(undertaking.getValue());
+                }
+            } else {
+                info.setShowUndertaking(false);
             }
 
             info.setExamType(examType.name());
@@ -1388,13 +1364,43 @@ public class ExamStudentServiceImpl implements ExamStudentService {
         examStudentInfo.setUsedNum(ret);
     }
 
-//    //获取考试的考生信息
-//    private ExamStudentBean getRemoteExamStudent(Long rootOrgId, Long examStudentId) {
-//        GetExamStudentReq req = new GetExamStudentReq();
-//        req.setExamStudentId(examStudentId);
-//        req.setRootOrgId(rootOrgId);
-//        GetExamStudentResp resp = examStudentCloudService.getExamStudent(req);
-//        return resp.getExamStudentBean();
-//    }
+    @Override
+    public Page<ExamStudentEntity> getExamStudentSimpleList(ExamStudentQuery req) {
+        if (req.getPageNo() == null || req.getPageNo() < 1) {
+            req.setPageNo(1);
+        }
+
+        if (req.getPageSize() == null || req.getPageSize() < 1) {
+            req.setPageSize(10);
+        }
+
+        if (req.getExamId() == null) {
+            throw new StatusException("考试ID不能为空!");
+        }
+
+        Specification<ExamStudentEntity> spec = (root, query, cb) -> {
+            List<Predicate> predicates = new ArrayList<>();
+            predicates.add(cb.equal(root.get("examId"), req.getExamId()));
+
+            if (req.getCourseId() != null) {
+                predicates.add(cb.equal(root.get("courseId"), req.getCourseId()));
+            }
+
+            return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+        };
+
+        Sort sort = Sort.by(Sort.Order.desc("id"));
+        Pageable pageable = PageRequest.of(req.getPageNo() - 1, req.getPageSize(), sort);
+        return examStudentRepo.findAll(spec, pageable);
+    }
+
+    //    //获取考试的考生信息
+    //    private ExamStudentBean getRemoteExamStudent(Long rootOrgId, Long examStudentId) {
+    //        GetExamStudentReq req = new GetExamStudentReq();
+    //        req.setExamStudentId(examStudentId);
+    //        req.setRootOrgId(rootOrgId);
+    //        GetExamStudentResp resp = examStudentCloudService.getExamStudent(req);
+    //        return resp.getExamStudentBean();
+    //    }
 
 }