Эх сурвалжийг харах

examRecord和examRecordData表合并为一个表

lideyin 5 жил өмнө
parent
commit
1165236969
25 өөрчлөгдсөн 527 нэмэгдсэн , 802 устгасан
  1. 0 1
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/bean/ExamRecordDataBeanConvert.java
  2. 5 17
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/bean/ExamRecordDataDomain.java
  3. 2 12
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamAuditController.java
  4. 13 22
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamRecordController.java
  5. 12 20
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamRecordDataController.java
  6. 18 26
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamRecordCloudServiceProvider.java
  7. 262 287
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamScoreDataCloudServiceProvider.java
  8. 11 20
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamStudentCloudServiceProvider.java
  9. 17 36
      examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncCloudServiceProvider.java
  10. 2 2
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamCaptureService.java
  11. 0 7
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamRecordService.java
  12. 1 13
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditInfo.java
  13. 8 9
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditMapper.java
  14. 0 10
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examcapture/ExamCaptureAuditInfo.java
  15. 3 6
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examrecord/ExamRecordEntityConvert.java
  16. 18 19
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamAuditServiceImpl.java
  17. 18 35
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamCaptureServiceImpl.java
  18. 20 29
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordPaperStructServiceImpl.java
  19. 11 14
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordQuestionsServiceImpl.java
  20. 53 128
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordServiceImpl.java
  21. 0 3
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamScoreServiceImpl.java
  22. 5 13
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamStudentServiceImpl.java
  23. 2 4
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/pushscore/cugr/CugrExamScorePushServiceImpl.java
  24. 22 30
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/pushscore/cup/CupExamScorePushServiceImpl.java
  25. 24 39
      examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/pushscore/swufe/SwufeExamScorePushServiceImpl.java

+ 0 - 1
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/bean/ExamRecordDataBeanConvert.java

@@ -38,7 +38,6 @@ public class ExamRecordDataBeanConvert implements JsonSerializable {
         result.setCreationTime(erdEntity.getCreationTime());
         result.setEndTime(erdEntity.getEndTime());
         result.setExamOrder(erdEntity.getExamOrder());
-        result.setExamRecordId(erdEntity.getExamRecordId());
         result.setExamOrder(erdEntity.getExamOrder());
         result.setExamRecordQuestionsId(erdEntity.getExamRecordQuestionsId());
         result.setExamRecordStatus(erdEntity.getExamRecordStatus());

+ 5 - 17
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/bean/ExamRecordDataDomain.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.core.oe.admin.api.bean;
 
 import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.core.oe.common.enums.IsSuccess;
 
@@ -23,10 +23,6 @@ public class ExamRecordDataDomain implements JsonSerializable {
      * 考试作答记录id
      */
     private String examRecordQuestionsId;
-    /**
-     * 考试记录id
-     */
-    private Long examRecordId;
     /**
      * 考试记录状态(考试中,考试结束,考试过期,考试作废)
      */
@@ -122,9 +118,9 @@ public class ExamRecordDataDomain implements JsonSerializable {
     private Double faceLandmarkVal;
 
     /**
-     * 考试记录对象//TODO 应该再加一个实体转换一下比较好,由于时间问题,暂时先这么处理
+     * 考试记录对象//TODO 合并后,此实体不再需要,需要前台一起修改,暂时先这么处理
      */
-    private ExamRecordEntity examRecord;
+    private ExamRecordDataEntity examRecord;
 
     /**
      * 修改时间
@@ -152,14 +148,6 @@ public class ExamRecordDataDomain implements JsonSerializable {
         this.examRecordQuestionsId = examRecordQuestionsId;
     }
 
-    public Long getExamRecordId() {
-        return examRecordId;
-    }
-
-    public void setExamRecordId(Long examRecordId) {
-        this.examRecordId = examRecordId;
-    }
-
     public ExamRecordStatus getExamRecordStatus() {
         return examRecordStatus;
     }
@@ -336,11 +324,11 @@ public class ExamRecordDataDomain implements JsonSerializable {
         this.faceLandmarkVal = faceLandmarkVal;
     }
 
-    public ExamRecordEntity getExamRecord() {
+    public ExamRecordDataEntity getExamRecord() {
         return examRecord;
     }
 
-    public void setExamRecord(ExamRecordEntity examRecord) {
+    public void setExamRecord(ExamRecordDataEntity examRecord) {
         this.examRecord = examRecord;
     }
 

+ 2 - 12
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamAuditController.java

@@ -10,20 +10,17 @@ package cn.com.qmth.examcloud.core.oe.admin.api.controller;
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamAuditService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.*;
 import cn.com.qmth.examcloud.core.oe.common.base.Constants;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.JsonMapper;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.excel.ExportUtils;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.AuditStatus;
 import cn.com.qmth.examcloud.core.oe.common.enums.DisciplineType;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamProperties;
 import cn.com.qmth.examcloud.core.oe.common.enums.SelectType;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
@@ -53,16 +50,10 @@ public class ExamAuditController extends ControllerSupport {
 	
     @Autowired
     private ExamAuditService examAuditService;
-    
-    @Autowired
-    private ExamRecordService examRecordService;
-    
+
     @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
 
-    @Autowired
-    private ExamRecordRepo examRecordRepo;
-    
     @Autowired
     private GainBaseDataService gainBaseDataService;
 
@@ -143,8 +134,7 @@ public class ExamAuditController extends ControllerSupport {
     	Set<Long> examIds = new HashSet<Long>();
 		for(Long examRecordDataId:redoAuditInfo.getExamRecordDataIds()){
 			ExamRecordDataEntity examRecordData =GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
-            ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
-			examIds.add(examRecord.getExamId().longValue());
+			examIds.add(examRecordData.getExamId().longValue());
 		}
 		if(examIds.size()>1){
 			throw new StatusException("redoAudit-004", "考试ID中包含了多个批次");

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

@@ -7,21 +7,6 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.api.controller;
 
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-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.core.oe.admin.service.ExamRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordQuery;
@@ -29,15 +14,23 @@ import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamStudentQu
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.JsonMapper;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.excel.ExportUtils;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordForMarkingEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamType;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordForMarkingRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.web.support.Naked;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 考试记录相关接口
@@ -53,7 +46,7 @@ public class ExamRecordController extends ControllerSupport {
     private ExamRecordService examRecordService;
     
     @Autowired
-    private ExamRecordRepo examRecodRepo;
+    private ExamRecordDataRepo examRecordDataRepo;
     
     @Autowired
     private ExamRecordForMarkingRepo examRecordForMarkingRepo;
@@ -119,8 +112,8 @@ public class ExamRecordController extends ControllerSupport {
 
     @GetMapping("/select/byExamStudentId")
     @ApiOperation(value = "根据考生ID查询考试记录")
-    public List<ExamRecordEntity> getExamRecordByExamStudentId(@RequestParam Long examStudentId){
-    	List<ExamRecordEntity> examRecordEntityList = examRecodRepo.findByExamStudentId(examStudentId);
+    public List<ExamRecordDataEntity> getExamRecordByExamStudentId(@RequestParam Long examStudentId){
+    	List<ExamRecordDataEntity> examRecordEntityList = examRecordDataRepo.findByExamStudentId(examStudentId);
     	return 	examRecordEntityList;	
     }
     
@@ -131,7 +124,5 @@ public class ExamRecordController extends ControllerSupport {
         Check.isBlank(courseCode, "课程代码不能空!");
         List<ExamStudentQuestionScoreInfo> examRecordInfoList = examRecordService.getExamStudentQuestionScoreList(examId,courseCode);
         ExportUtils.exportEXCEL("考试明细列表", ExamStudentQuestionScoreInfo.class,examRecordInfoList,response);
-        
-//        return examRecordInfoList;List<ExamStudentQuestionScoreInfo>
     }
 }

+ 12 - 20
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/controller/ExamRecordDataController.java

@@ -1,23 +1,19 @@
 package cn.com.qmth.examcloud.core.oe.admin.api.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordDataBeanConvert;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordDataDomain;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import io.swagger.annotations.Api;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 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.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
-import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import java.util.ArrayList;
+import java.util.List;
 
 
 @RestController
@@ -28,25 +24,21 @@ public class ExamRecordDataController {
     @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
 
-    @Autowired
-    private ExamRecordRepo examRecordRepo;
-
     @GetMapping("/findExamRecordDataEntity")
     public ExamRecordDataDomain findExamRecordDataEntity(@RequestParam Long examRecordDataId) {
-        ExamRecordDataDomain domain = ExamRecordDataBeanConvert.copyFrom(
-                GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class));
-        domain.setExamRecord(GlobalHelper.getEntity(examRecordRepo, domain.getExamRecordId(), ExamRecordEntity.class));
+        ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
+        ExamRecordDataDomain domain = ExamRecordDataBeanConvert.copyFrom(examRecordDataEntity);
+        domain.setExamRecord(examRecordDataEntity);
         return domain;
     }
 
     @GetMapping("/findByExamStudentId")
     public List<ExamRecordDataDomain> findByExamStudentId(@RequestParam Long examStudentId) {
-        List<ExamRecordEntity> examRecordEntities = examRecordRepo.findByExamStudentId(examStudentId);
+        List<ExamRecordDataEntity> examRecordEntities = examRecordDataRepo.findByExamStudentId(examStudentId);
         List<ExamRecordDataDomain> examRecordDataList = new ArrayList<ExamRecordDataDomain>();
-        for (ExamRecordEntity examRecord : examRecordEntities) {
-            ExamRecordDataDomain domain = ExamRecordDataBeanConvert.copyFrom(
-                    examRecordDataRepo.findByExamRecordId(examRecord.getId()));
-            domain.setExamRecord(examRecord);
+        for (ExamRecordDataEntity examRecordData : examRecordEntities) {
+            ExamRecordDataDomain domain = ExamRecordDataBeanConvert.copyFrom(examRecordData);
+            domain.setExamRecord(examRecordData);
             examRecordDataList.add(domain);
         }
         return examRecordDataList;

+ 18 - 26
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamRecordCloudServiceProvider.java

@@ -1,15 +1,5 @@
 package cn.com.qmth.examcloud.core.oe.admin.api.provider;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Example;
-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.RestController;
-
 import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordForSelectScore;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
@@ -21,16 +11,23 @@ import cn.com.qmth.examcloud.core.oe.admin.api.response.QueryExamRecordForSelect
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamCaptureEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamCaptureRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+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.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 
@@ -49,9 +46,6 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
 	 */
 	private static final long serialVersionUID = 7678785677176906341L;
 	
-	@Autowired
-	private ExamRecordRepo examRecordRepo;
-	
 	@Autowired
 	private ExamScoreRepo examScoreRepo;
 	
@@ -66,11 +60,11 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
 	@PostMapping("/checkExamIsStarted")
 	public CheckExamIsStartedResp checkExamIsStarted(@RequestBody CheckExamIsStartedReq examRecordReq) {
 		Check.isNull(examRecordReq.getExamId(), "examId不能为空");
-		ExamRecordEntity examRecordEntity = new ExamRecordEntity();
-		examRecordEntity.setExamId(examRecordReq.getExamId());
-		examRecordEntity.setCourseId(examRecordReq.getCourseId());
-		examRecordEntity.setStudentId(examRecordReq.getStudentId());
-		long examRecordNum = examRecordRepo.count(Example.of(examRecordEntity));
+		ExamRecordDataEntity examRecordDataEntity = new ExamRecordDataEntity();
+		examRecordDataEntity.setExamId(examRecordReq.getExamId());
+		examRecordDataEntity.setCourseId(examRecordReq.getCourseId());
+		examRecordDataEntity.setStudentId(examRecordReq.getStudentId());
+		long examRecordNum = examRecordDataRepo.count(Example.of(examRecordDataEntity));
 		CheckExamIsStartedResp checkExamIsStartedResp = new CheckExamIsStartedResp();
 		checkExamIsStartedResp.setIsStarted(examRecordNum>0);
 		return checkExamIsStartedResp;
@@ -97,10 +91,9 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
 	public QueryExamRecordForSelectScoreResp queryExamRecordForSelectScoreByExamStudentId(@RequestBody QueryExamRecordForSelectScoreReq req) {
 		QueryExamRecordForSelectScoreResp resp = new QueryExamRecordForSelectScoreResp();
 		if(req.getExamStudentId() != null){
-			List<ExamRecordEntity> examRecordList = examRecordRepo.findByExamStudentId(req.getExamStudentId());
+			List<ExamRecordDataEntity> examRecordList = examRecordDataRepo.findByExamStudentId(req.getExamStudentId());
 			List<ExamRecordForSelectScore> examRecordForSelectScoreList = new ArrayList<ExamRecordForSelectScore>();
-			for(ExamRecordEntity examRecord:examRecordList){
-				ExamRecordDataEntity examRecordData = examRecordDataRepo.findByExamRecordId(examRecord.getId());
+			for(ExamRecordDataEntity examRecordData:examRecordList){
 				examRecordForSelectScoreList.add(buildExamRecordForSelectScore(examRecordData));
 			}
 			resp.setExamRecordForSelectScoreList(examRecordForSelectScoreList);
@@ -110,9 +103,8 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
 
 	public ExamRecordForSelectScore buildExamRecordForSelectScore(ExamRecordDataEntity examRecordData){
 		ExamRecordForSelectScore examRecordForSelectScore = new ExamRecordForSelectScore();
-		ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
-		examRecordForSelectScore.setExamStudentId(examRecord.getExamStudentId());
-		examRecordForSelectScore.setRootOrgId(examRecord.getRootOrgId());
+		examRecordForSelectScore.setExamStudentId(examRecordData.getExamStudentId());
+		examRecordForSelectScore.setRootOrgId(examRecordData.getRootOrgId());
 		examRecordForSelectScore.setExamRecordDataId(examRecordData.getId());
 		examRecordForSelectScore.setStartTime(examRecordData.getStartTime());
 		examRecordForSelectScore.setEndTime(examRecordData.getEndTime());

+ 262 - 287
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamScoreDataCloudServiceProvider.java

@@ -1,19 +1,5 @@
 package cn.com.qmth.examcloud.core.oe.admin.api.provider;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
-import org.apache.commons.lang3.StringUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Example;
-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.RestController;
-
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
@@ -23,30 +9,13 @@ import cn.com.qmth.examcloud.core.oe.admin.api.ExamScoreDataCloudService;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamScoreDataBean;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.QueryCapturePhotoBean;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.ScoreDataBean;
-import cn.com.qmth.examcloud.core.oe.admin.api.request.FindExamScoreDataReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.request.GetAuditDataReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.request.GetScoreDataReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.request.QueryCapturePhotoReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.request.QueryScoreDataReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.FindExamScoreDataResp;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.GetAuditDataResp;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.GetScoreDataResp;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.QueryCapturePhotoResp;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.QueryScoreDataResp;
+import cn.com.qmth.examcloud.core.oe.admin.api.request.*;
+import cn.com.qmth.examcloud.core.oe.admin.api.response.*;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamAuditEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamCaptureEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.*;
 import cn.com.qmth.examcloud.core.oe.common.enums.DisciplineType;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamAuditRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamCaptureRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.*;
 import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
 import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
@@ -57,282 +26,288 @@ import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 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.json.JSONException;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+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.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
 
 @Api(tags = "考试分数信息相关接口")
 @RestController
 @RequestMapping("${$rmp.cloud.oe}/examScoreData")
-public class ExamScoreDataCloudServiceProvider extends ControllerSupport implements ExamScoreDataCloudService{
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 8280332746440316604L;
-	
-	@Autowired
-	private ExamScoreRepo examScoreRepo;
-	
-	@Autowired
-	private ExamRecordDataRepo examRecordDataRepo;
-	
-	@Autowired
-	private ExamRecordRepo examRecordRepo;
-	
-	@Autowired
-	private ExamStudentRepo examStudentRepo;
-	
-	@Autowired
-	private ExamAuditRepo examAuditRepo;
-	
-	@Autowired
-	private ExamCaptureRepo examCaptureRepo;
-	
+public class ExamScoreDataCloudServiceProvider extends ControllerSupport implements ExamScoreDataCloudService {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 8280332746440316604L;
+
+    @Autowired
+    private ExamScoreRepo examScoreRepo;
+
+    @Autowired
+    private ExamRecordDataRepo examRecordDataRepo;
+
+    @Autowired
+    private ExamStudentRepo examStudentRepo;
+
+    @Autowired
+    private ExamAuditRepo examAuditRepo;
+
+    @Autowired
+    private ExamCaptureRepo examCaptureRepo;
+
     @Autowired
     private GainBaseDataService gainBaseDataService;
-    
+
     @Autowired
     private ExamCloudService examCloudService;
-    
+
     @Autowired
     private CourseCloudService courseCloudService;
-    
-	@Override
-	@ApiOperation(value = "根据分数id查询考试记录,学生信息,分数信息等数据")
-	@PostMapping("/findExamScoreDataByScoreId")
-	public FindExamScoreDataResp findExamScoreDataByScoreId(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
-		long scoreId = findExamScoreDataReq.getScoreId();
-		ExamScoreEntity examScore = GlobalHelper.getEntity(examScoreRepo,scoreId,ExamScoreEntity.class);
-		ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo,examScore.getExamRecordDataId(),ExamRecordDataEntity.class);
-		ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examScore.getExamRecordDataId(),ExamRecordEntity.class);
-		ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examRecord.getExamStudentId());
-		
-		FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
-		List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
-		examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordDataEntity, examStudentEntity));
-		findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
-		
-		return findExamScoreDataResp;
-	}
-	
-	@Override
-	@ApiOperation(value = "根据examIdAndStudentCode查询考试记录,学生信息,分数信息等数据")
-	@PostMapping("/findExamScoreDataByExamIdAndStudentCode")
-	public FindExamScoreDataResp findExamScoreDataByExamIdAndStudentCode(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
-		Long examId = findExamScoreDataReq.getExamId();
-		String studentCode = findExamScoreDataReq.getStudentCode();
-		List<ExamRecordEntity> examRecordList = examRecordRepo.findByExamIdAndStudentCode(examId, studentCode);
-		
-		List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
-		for(ExamRecordEntity examRecord:examRecordList){
-			ExamRecordDataEntity examRecordData = examRecordDataRepo.findByExamRecordId(examRecord.getId());
-			ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
-			ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecord.getExamStudentId());
-			examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordData, examStudent));
-		}
-		
-		FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
-		findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
-		return findExamScoreDataResp;
-	}
-
-	private ExamScoreDataBean buildExamScoreDataBean(ExamScoreEntity examScore,ExamRecordDataEntity examRecordDataEntity,ExamStudentEntity examStudentEntity){
-		ExamScoreDataBean examScoreDataBean = new ExamScoreDataBean();
-		examScoreDataBean.setExamId(examStudentEntity.getExamId());
-		examScoreDataBean.setStudentName(examStudentEntity.getStudentName());
-		examScoreDataBean.setStudentCode(examStudentEntity.getStudentCode());
-		examScoreDataBean.setIdentityNumber(examStudentEntity.getIdentityNumber());
-		
-		CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentEntity.getCourseId());
-		examScoreDataBean.setCourseName(courseBean.getName());
-		examScoreDataBean.setCourseCode(examStudentEntity.getCourseCode());
-		examScoreDataBean.setStartTime(examRecordDataEntity.getStartTime());
-		examScoreDataBean.setEndTime(examRecordDataEntity.getEndTime());
-		examScoreDataBean.setSuccPercent(examRecordDataEntity.getFaceSuccessPercent());
-		examScoreDataBean.setIsIllegality(examRecordDataEntity.getIsIllegality());
-		examScoreDataBean.setScoreId(examScore.getId());
-		examScoreDataBean.setTotalScore(examScore.getTotalScore());
-		examScoreDataBean.setObjectiveScore(examScore.getObjectiveScore());
-		examScoreDataBean.setSubjectiveScore(examScore.getSubjectiveScore());
-		return examScoreDataBean;
-	}
-
-	@Override
-	@ApiOperation(value = "根据examRecordDataId查询成绩数据")
-	@PostMapping("/getScoreData")
-	public GetScoreDataResp getScoreData(@RequestBody GetScoreDataReq req) {
-		Long examRecordDataId = req.getExamRecordDataId();
-		ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
-		if(null ==examRecordData) {
-			throw new StatusException("getScoreData-exception", "请求参数不正确");
-		}
-		ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
-		ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordDataId);
-		
-		GetScoreDataResp resp = new GetScoreDataResp();
-		resp.setExamRecordDataId(examRecordDataId);
-		resp.setStudentCode(examRecord.getStudentCode());
-		resp.setStudentName(examRecord.getStudentName());
-		resp.setIdentityNumber(examRecord.getIdentityNumber());
-		
-		CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examRecord.getCourseId());
-		resp.setCourseCode(courseBean.getCode());
-		resp.setCourseName(courseBean.getName());
-		resp.setStartTime(examRecordData.getStartTime());
-		resp.setEndTime(examRecordData.getEndTime());
-		resp.setTotalScore(examScore.getTotalScore());
-		
-		resp.setIsWarn(examRecordData.getIsWarn());
-		resp.setIsAudit(examRecordData.getIsAudit());
-		resp.setIsIllegality(examRecordData.getIsIllegality());
-		
-		return resp;
-	}
-
-	@Override
-	@ApiOperation(value = "根据examRecordDataId查询成绩审核数据")
-	@PostMapping("/getAuditData")
-	public GetAuditDataResp getAuditData(@RequestBody GetAuditDataReq req) {
-		Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
-		ExamAuditEntity examAuditEntity = examAuditRepo.findByExamRecordDataId(req.getExamRecordDataId());
-		//考试记录
-		ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,req.getExamRecordDataId(),ExamRecordDataEntity.class);
-		if(null == examRecordData) {
-			throw new StatusException("100001", "找不到考试记录id为"+req.getExamRecordDataId()+"数据");
-		}
-		GetAuditDataResp resp = new GetAuditDataResp();
-		if(examAuditEntity!=null){
-			resp.setExamRecordDataId(examAuditEntity.getExamRecordDataId());
-			DisciplineType disciplineType = examAuditEntity.getDisciplineType();
-			if(disciplineType!=null){
-				resp.setDisciplineType(disciplineType.getName());
-			}
-			resp.setDisciplineDetail(examAuditEntity.getDisciplineDetail());
-			resp.setCreationTime(examAuditEntity.getCreationTime());
-			resp.setAuditUserName(examAuditEntity.getAuditUserName());
-			//是否违纪
-			resp.setIsDiscipline(examRecordData.getIsIllegality()?1:0);			 
-		}
-		return resp;
-	}
-
-	@Override
-	@ApiOperation(value = "根据examRecordDataId查询抓拍照片数据")
-	@PostMapping("/queryCapturePhoto")
-	public QueryCapturePhotoResp queryCapturePhoto(@RequestBody QueryCapturePhotoReq req) {
-		Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
-		List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(req.getExamRecordDataId());
-		QueryCapturePhotoResp queryCapturePhotoResp = new QueryCapturePhotoResp();
-		queryCapturePhotoResp.setExamRecordDataId(req.getExamRecordDataId());
-		List<QueryCapturePhotoBean> capturePhotoList = new ArrayList<QueryCapturePhotoBean>();
-		if(examCaptureList.size()>0){
-			for(ExamCaptureEntity examCaptureEntity:examCaptureList){
-				QueryCapturePhotoBean queryCapturePhotoBean = new QueryCapturePhotoBean();
-				queryCapturePhotoBean.setFileUrl(examCaptureEntity.getFileUrl());
-				queryCapturePhotoBean.setIsPass(examCaptureEntity.getIsPass());
-				queryCapturePhotoBean.setIsStranger(examCaptureEntity.getIsStranger());
-				String faceLivenessResult = examCaptureEntity.getFacelivenessResult();
-				queryCapturePhotoBean.setIsLivenessPass(isLivenessPass(faceLivenessResult));
-				capturePhotoList.add(queryCapturePhotoBean);
-			}
-		}
-		queryCapturePhotoResp.setCapturePhotoList(capturePhotoList);
-		return queryCapturePhotoResp;
-	}
-	
-	/**
-	 * 人脸真实性是否通过
-	 * @param faceLivenessResult
-	 * @return
-	 */
-	private Boolean isLivenessPass(String faceLivenessResult){
-		if(StringUtils.isNotBlank(faceLivenessResult)){
-			JSONObject jsonObject;
-			try {
-				jsonObject = new JSONObject(faceLivenessResult);
-				if(jsonObject.has("error_code")&&jsonObject.getInt("error_code") == 0&&jsonObject.has("result")){
-					JSONObject resultJson = jsonObject.getJSONObject("result");
-					if(resultJson.has("face_liveness")){
-						double faceLivenessVal = resultJson.getDouble("face_liveness");
-						double baiduFacelivenessThreshold = Double.parseDouble(PropertyHolder.getString("$baidu.faceliveness.threshold"));
-						if(faceLivenessVal > baiduFacelivenessThreshold){
-							return true;
-						}
-					}
-				}
-			} catch (JSONException e) {
-				e.printStackTrace();
-				return false;
-			}
-			
-		}
-		return false;
-	}
-
-	@Override
-	@ApiOperation(value = "按考试名称,rootOrgId,courseCode,身份证号或学号查询成绩信息")
-	@PostMapping("/queryScoreData")
-	public QueryScoreDataResp queryScoreData(@RequestBody QueryScoreDataReq req) {
-		if(StringUtils.isBlank(req.getExamName())){
-			throw new StatusException("OE-ADMIN-1000005", "考试名称不能为空");
-		}
-		if(StringUtils.isBlank(req.getCourseCode())){
-			throw new StatusException("OE-ADMIN-1000005", "课程code不能为空");
-		}
-		if(req.getRootOrgId() == null){
-			throw new StatusException("OE-ADMIN-1000005", "rootOrgId不能为空");
-		}
-		if(StringUtils.isBlank(req.getIdentityNumber()) && StringUtils.isBlank(req.getStudentCode())){
-			throw new StatusException("OE-ADMIN-1000005", "身份证号和学号不能都为空");
-		}
-		GetExamReq getExamReq = new GetExamReq();
-		getExamReq.setRootOrgId(req.getRootOrgId());
+
+    @Override
+    @ApiOperation(value = "根据分数id查询考试记录,学生信息,分数信息等数据")
+    @PostMapping("/findExamScoreDataByScoreId")
+    public FindExamScoreDataResp findExamScoreDataByScoreId(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
+        long scoreId = findExamScoreDataReq.getScoreId();
+        ExamScoreEntity examScore = GlobalHelper.getEntity(examScoreRepo, scoreId, ExamScoreEntity.class);
+        ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo, examScore.getExamRecordDataId(), ExamRecordDataEntity.class);
+        ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examRecordDataEntity.getExamStudentId());
+
+        FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
+        List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
+        examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordDataEntity, examStudentEntity));
+        findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
+
+        return findExamScoreDataResp;
+    }
+
+    @Override
+    @ApiOperation(value = "根据examIdAndStudentCode查询考试记录,学生信息,分数信息等数据")
+    @PostMapping("/findExamScoreDataByExamIdAndStudentCode")
+    public FindExamScoreDataResp findExamScoreDataByExamIdAndStudentCode(@RequestBody FindExamScoreDataReq findExamScoreDataReq) {
+        Long examId = findExamScoreDataReq.getExamId();
+        String studentCode = findExamScoreDataReq.getStudentCode();
+        List<ExamRecordDataEntity> examRecordDataList = examRecordDataRepo.findByExamIdAndStudentCode(examId, studentCode);
+
+        List<ExamScoreDataBean> examScoreDatas = new ArrayList<ExamScoreDataBean>();
+        for (ExamRecordDataEntity examRecordData : examRecordDataList) {
+            ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
+            ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecordData.getExamStudentId());
+            examScoreDatas.add(buildExamScoreDataBean(examScore, examRecordData, examStudent));
+        }
+
+        FindExamScoreDataResp findExamScoreDataResp = new FindExamScoreDataResp();
+        findExamScoreDataResp.setExamScoreDatas(examScoreDatas);
+        return findExamScoreDataResp;
+    }
+
+    private ExamScoreDataBean buildExamScoreDataBean(ExamScoreEntity examScore, ExamRecordDataEntity examRecordDataEntity, ExamStudentEntity examStudentEntity) {
+        ExamScoreDataBean examScoreDataBean = new ExamScoreDataBean();
+        examScoreDataBean.setExamId(examStudentEntity.getExamId());
+        examScoreDataBean.setStudentName(examStudentEntity.getStudentName());
+        examScoreDataBean.setStudentCode(examStudentEntity.getStudentCode());
+        examScoreDataBean.setIdentityNumber(examStudentEntity.getIdentityNumber());
+
+        CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentEntity.getCourseId());
+        examScoreDataBean.setCourseName(courseBean.getName());
+        examScoreDataBean.setCourseCode(examStudentEntity.getCourseCode());
+        examScoreDataBean.setStartTime(examRecordDataEntity.getStartTime());
+        examScoreDataBean.setEndTime(examRecordDataEntity.getEndTime());
+        examScoreDataBean.setSuccPercent(examRecordDataEntity.getFaceSuccessPercent());
+        examScoreDataBean.setIsIllegality(examRecordDataEntity.getIsIllegality());
+        examScoreDataBean.setScoreId(examScore.getId());
+        examScoreDataBean.setTotalScore(examScore.getTotalScore());
+        examScoreDataBean.setObjectiveScore(examScore.getObjectiveScore());
+        examScoreDataBean.setSubjectiveScore(examScore.getSubjectiveScore());
+        return examScoreDataBean;
+    }
+
+    @Override
+    @ApiOperation(value = "根据examRecordDataId查询成绩数据")
+    @PostMapping("/getScoreData")
+    public GetScoreDataResp getScoreData(@RequestBody GetScoreDataReq req) {
+        Long examRecordDataId = req.getExamRecordDataId();
+        ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
+        if (null == examRecordData) {
+            throw new StatusException("getScoreData-exception", "请求参数不正确");
+        }
+        ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordDataId);
+
+        GetScoreDataResp resp = new GetScoreDataResp();
+        resp.setExamRecordDataId(examRecordDataId);
+        resp.setStudentCode(examRecordData.getStudentCode());
+        resp.setStudentName(examRecordData.getStudentName());
+        resp.setIdentityNumber(examRecordData.getIdentityNumber());
+
+        CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examRecordData.getCourseId());
+        resp.setCourseCode(courseBean.getCode());
+        resp.setCourseName(courseBean.getName());
+        resp.setStartTime(examRecordData.getStartTime());
+        resp.setEndTime(examRecordData.getEndTime());
+        resp.setTotalScore(examScore.getTotalScore());
+
+        resp.setIsWarn(examRecordData.getIsWarn());
+        resp.setIsAudit(examRecordData.getIsAudit());
+        resp.setIsIllegality(examRecordData.getIsIllegality());
+
+        return resp;
+    }
+
+    @Override
+    @ApiOperation(value = "根据examRecordDataId查询成绩审核数据")
+    @PostMapping("/getAuditData")
+    public GetAuditDataResp getAuditData(@RequestBody GetAuditDataReq req) {
+        Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
+        ExamAuditEntity examAuditEntity = examAuditRepo.findByExamRecordDataId(req.getExamRecordDataId());
+        //考试记录
+        ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, req.getExamRecordDataId(), ExamRecordDataEntity.class);
+        if (null == examRecordData) {
+            throw new StatusException("100001", "找不到考试记录id为" + req.getExamRecordDataId() + "数据");
+        }
+        GetAuditDataResp resp = new GetAuditDataResp();
+        if (examAuditEntity != null) {
+            resp.setExamRecordDataId(examAuditEntity.getExamRecordDataId());
+            DisciplineType disciplineType = examAuditEntity.getDisciplineType();
+            if (disciplineType != null) {
+                resp.setDisciplineType(disciplineType.getName());
+            }
+            resp.setDisciplineDetail(examAuditEntity.getDisciplineDetail());
+            resp.setCreationTime(examAuditEntity.getCreationTime());
+            resp.setAuditUserName(examAuditEntity.getAuditUserName());
+            //是否违纪
+            resp.setIsDiscipline(examRecordData.getIsIllegality() ? 1 : 0);
+        }
+        return resp;
+    }
+
+    @Override
+    @ApiOperation(value = "根据examRecordDataId查询抓拍照片数据")
+    @PostMapping("/queryCapturePhoto")
+    public QueryCapturePhotoResp queryCapturePhoto(@RequestBody QueryCapturePhotoReq req) {
+        Check.isEmpty(req.getExamRecordDataId(), "考试记录ID不能为空");
+        List<ExamCaptureEntity> examCaptureList = examCaptureRepo.findByExamRecordDataId(req.getExamRecordDataId());
+        QueryCapturePhotoResp queryCapturePhotoResp = new QueryCapturePhotoResp();
+        queryCapturePhotoResp.setExamRecordDataId(req.getExamRecordDataId());
+        List<QueryCapturePhotoBean> capturePhotoList = new ArrayList<QueryCapturePhotoBean>();
+        if (examCaptureList.size() > 0) {
+            for (ExamCaptureEntity examCaptureEntity : examCaptureList) {
+                QueryCapturePhotoBean queryCapturePhotoBean = new QueryCapturePhotoBean();
+                queryCapturePhotoBean.setFileUrl(examCaptureEntity.getFileUrl());
+                queryCapturePhotoBean.setIsPass(examCaptureEntity.getIsPass());
+                queryCapturePhotoBean.setIsStranger(examCaptureEntity.getIsStranger());
+                String faceLivenessResult = examCaptureEntity.getFacelivenessResult();
+                queryCapturePhotoBean.setIsLivenessPass(isLivenessPass(faceLivenessResult));
+                capturePhotoList.add(queryCapturePhotoBean);
+            }
+        }
+        queryCapturePhotoResp.setCapturePhotoList(capturePhotoList);
+        return queryCapturePhotoResp;
+    }
+
+    /**
+     * 人脸真实性是否通过
+     *
+     * @param faceLivenessResult
+     * @return
+     */
+    private Boolean isLivenessPass(String faceLivenessResult) {
+        if (StringUtils.isNotBlank(faceLivenessResult)) {
+            JSONObject jsonObject;
+            try {
+                jsonObject = new JSONObject(faceLivenessResult);
+                if (jsonObject.has("error_code") && jsonObject.getInt("error_code") == 0 && jsonObject.has("result")) {
+                    JSONObject resultJson = jsonObject.getJSONObject("result");
+                    if (resultJson.has("face_liveness")) {
+                        double faceLivenessVal = resultJson.getDouble("face_liveness");
+                        double baiduFacelivenessThreshold = Double.parseDouble(PropertyHolder.getString("$baidu.faceliveness.threshold"));
+                        if (faceLivenessVal > baiduFacelivenessThreshold) {
+                            return true;
+                        }
+                    }
+                }
+            } catch (JSONException e) {
+                e.printStackTrace();
+                return false;
+            }
+
+        }
+        return false;
+    }
+
+    @Override
+    @ApiOperation(value = "按考试名称,rootOrgId,courseCode,身份证号或学号查询成绩信息")
+    @PostMapping("/queryScoreData")
+    public QueryScoreDataResp queryScoreData(@RequestBody QueryScoreDataReq req) {
+        if (StringUtils.isBlank(req.getExamName())) {
+            throw new StatusException("OE-ADMIN-1000005", "考试名称不能为空");
+        }
+        if (StringUtils.isBlank(req.getCourseCode())) {
+            throw new StatusException("OE-ADMIN-1000005", "课程code不能为空");
+        }
+        if (req.getRootOrgId() == null) {
+            throw new StatusException("OE-ADMIN-1000005", "rootOrgId不能为空");
+        }
+        if (StringUtils.isBlank(req.getIdentityNumber()) && StringUtils.isBlank(req.getStudentCode())) {
+            throw new StatusException("OE-ADMIN-1000005", "身份证号和学号不能都为空");
+        }
+        GetExamReq getExamReq = new GetExamReq();
+        getExamReq.setRootOrgId(req.getRootOrgId());
         getExamReq.setName(req.getExamName());
         GetExamResp getExamResp = examCloudService.getExam(getExamReq);
         ExamBean examBean = getExamResp.getExamBean();
-        
+
         GetCourseReq getCourseReq = new GetCourseReq();
         getCourseReq.setRootOrgId(req.getRootOrgId());
         getCourseReq.setCode(req.getCourseCode());
         GetCourseResp getCourseResp = courseCloudService.getCourse(getCourseReq);
         CourseBean courseBean = getCourseResp.getCourseBean();
-        
-        ExamRecordEntity selectCondition = new ExamRecordEntity();
+
+        ExamRecordDataEntity selectCondition = new ExamRecordDataEntity();
         selectCondition.setExamId(examBean.getId());
         selectCondition.setCourseId(courseBean.getId());
-        if(StringUtils.isNotBlank(req.getIdentityNumber())){
-        	selectCondition.setIdentityNumber(req.getIdentityNumber());
+        if (StringUtils.isNotBlank(req.getIdentityNumber())) {
+            selectCondition.setIdentityNumber(req.getIdentityNumber());
         }
-        if(StringUtils.isNotBlank(req.getStudentCode())){
-        	selectCondition.setStudentCode(req.getStudentCode());
+        if (StringUtils.isNotBlank(req.getStudentCode())) {
+            selectCondition.setStudentCode(req.getStudentCode());
         }
         //查询考试记录
         List<ScoreDataBean> scoreDataBeanList = new ArrayList<ScoreDataBean>();
-        List<ExamRecordEntity> examRecordList = examRecordRepo.findAll(Example.of(selectCondition));
-        for(ExamRecordEntity examRecord:examRecordList){
-        	ExamRecordDataEntity examRecordData = examRecordDataRepo.findByExamRecordId(examRecord.getId());
-        	ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
-        	if (examScore==null){
-				throw  new StatusException("100001","该考生未交卷");
-			}
-        	
-        	ScoreDataBean scoreDataBean = new ScoreDataBean();
-        	scoreDataBean.setExamRecordDataId(examRecordData.getId());
-        	scoreDataBean.setStudentCode(examRecord.getStudentCode());
-        	scoreDataBean.setStudentName(examRecord.getStudentName());
-        	scoreDataBean.setIdentityNumber(examRecord.getIdentityNumber());
-    		
-        	scoreDataBean.setCourseCode(courseBean.getCode());
-        	scoreDataBean.setCourseName(courseBean.getName());
-        	scoreDataBean.setStartTime(examRecordData.getStartTime());
-        	scoreDataBean.setEndTime(examRecordData.getEndTime());
-        	scoreDataBean.setTotalScore(examScore.getTotalScore());
-    		
-        	scoreDataBean.setIsWarn(examRecordData.getIsWarn());
-        	scoreDataBean.setIsAudit(examRecordData.getIsAudit());
-        	scoreDataBean.setIsIllegality(examRecordData.getIsIllegality());
-        	scoreDataBeanList.add(scoreDataBean);
+        List<ExamRecordDataEntity> examRecordList = examRecordDataRepo.findAll(Example.of(selectCondition));
+        for (ExamRecordDataEntity examRecordData : examRecordList) {
+            ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examRecordData.getId());
+            if (examScore == null) {
+                throw new StatusException("100001", "该考生未交卷");
+            }
+
+            ScoreDataBean scoreDataBean = new ScoreDataBean();
+            scoreDataBean.setExamRecordDataId(examRecordData.getId());
+            scoreDataBean.setStudentCode(examRecordData.getStudentCode());
+            scoreDataBean.setStudentName(examRecordData.getStudentName());
+            scoreDataBean.setIdentityNumber(examRecordData.getIdentityNumber());
+
+            scoreDataBean.setCourseCode(courseBean.getCode());
+            scoreDataBean.setCourseName(courseBean.getName());
+            scoreDataBean.setStartTime(examRecordData.getStartTime());
+            scoreDataBean.setEndTime(examRecordData.getEndTime());
+            scoreDataBean.setTotalScore(examScore.getTotalScore());
+
+            scoreDataBean.setIsWarn(examRecordData.getIsWarn());
+            scoreDataBean.setIsAudit(examRecordData.getIsAudit());
+            scoreDataBean.setIsIllegality(examRecordData.getIsIllegality());
+            scoreDataBeanList.add(scoreDataBean);
         }
         QueryScoreDataResp queryScoreDataResp = new QueryScoreDataResp();
         queryScoreDataResp.setScoreDataBeanList(scoreDataBeanList);
-		return queryScoreDataResp;
-	}
+        return queryScoreDataResp;
+    }
 }

+ 11 - 20
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamStudentCloudServiceProvider.java

@@ -7,18 +7,6 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.api.provider;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import cn.com.qmth.examcloud.core.oe.admin.api.request.UnbindExamStudentReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.UnbindExamStudentResp;
-import com.mysql.cj.util.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-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.RestController;
-
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.oe.admin.api.OeExamStudentCloudService;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.FindStudentType;
@@ -26,16 +14,25 @@ import cn.com.qmth.examcloud.core.oe.admin.api.bean.OeExamStudentBean;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.ExamStudentSyncAllDataReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.ExamStudentSyncPartDataReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.FindExamStudentInfoReq;
+import cn.com.qmth.examcloud.core.oe.admin.api.request.UnbindExamStudentReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.response.ExamStudentSyncAllDataResp;
 import cn.com.qmth.examcloud.core.oe.admin.api.response.ExamStudentSyncPartDataResp;
 import cn.com.qmth.examcloud.core.oe.admin.api.response.FindExamStudentInfoResp;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
+import cn.com.qmth.examcloud.core.oe.admin.api.response.UnbindExamStudentResp;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import com.mysql.cj.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 考生信息接口
@@ -52,15 +49,9 @@ public class ExamStudentCloudServiceProvider extends ControllerSupport implement
      */
     private static final long serialVersionUID = 1638873981075522570L;
 
-    @Autowired
-    private ExamStudentService examStudentService;
-
     @Autowired
     private ExamStudentRepo examStudentRepo;
 
-    @Autowired
-    private ExamRecordRepo examRecordRepo;
-
     @Deprecated
     @ApiOperation(value = "同步考生(全部)数据")
     @PostMapping("/sync/all/data")

+ 17 - 36
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncCloudServiceProvider.java

@@ -1,44 +1,26 @@
 package cn.com.qmth.examcloud.core.oe.admin.api.provider;
 
-import cn.com.qmth.examcloud.core.oe.admin.api.request.UnbindExamStudentReq;
-import cn.com.qmth.examcloud.core.oe.admin.api.response.UnbindExamStudentResp;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Example;
-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.RestController;
-
-import com.google.common.collect.Lists;
-
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamStudentBeanConvert;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
 import cn.com.qmth.examcloud.global.api.HandleSyncCloudService;
-import cn.com.qmth.examcloud.global.api.request.SyncCourseReq;
-import cn.com.qmth.examcloud.global.api.request.SyncExamReq;
-import cn.com.qmth.examcloud.global.api.request.SyncExamStudentReq;
-import cn.com.qmth.examcloud.global.api.request.SyncOrgReq;
-import cn.com.qmth.examcloud.global.api.request.SyncSpecialtyReq;
-import cn.com.qmth.examcloud.global.api.request.SyncStudentReq;
-import cn.com.qmth.examcloud.global.api.request.SyncUserReq;
-import cn.com.qmth.examcloud.global.api.response.SyncCourseResp;
-import cn.com.qmth.examcloud.global.api.response.SyncExamResp;
-import cn.com.qmth.examcloud.global.api.response.SyncExamStudentResp;
-import cn.com.qmth.examcloud.global.api.response.SyncOrgResp;
-import cn.com.qmth.examcloud.global.api.response.SyncSpecialtyResp;
-import cn.com.qmth.examcloud.global.api.response.SyncStudentResp;
-import cn.com.qmth.examcloud.global.api.response.SyncUserResp;
+import cn.com.qmth.examcloud.global.api.request.*;
+import cn.com.qmth.examcloud.global.api.response.*;
 import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import com.google.common.collect.Lists;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-
-import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+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.RestController;
 
 /**
  * 
@@ -62,18 +44,17 @@ public class SyncCloudServiceProvider  extends ControllerSupport implements Hand
 	
     @Autowired
     private ExamStudentRepo examStudentRepo;
-    
     @Autowired
-    private ExamRecordRepo examRecordRepo;
+    private ExamRecordDataRepo examRecordDataRepo;
 
 	@ApiOperation(value = "同步考生")
     @PostMapping("/syncExamStudent")
     public SyncExamStudentResp syncExamStudent(@RequestBody SyncExamStudentReq req) {
     	if("deleteByExamId".equals(req.getSyncType())){
     		long examId = req.getExamId();
-    		ExamRecordEntity examRecordEntity = new ExamRecordEntity();
-    		examRecordEntity.setExamId(examId);
-    		long examRecordNum = examRecordRepo.count(Example.of(examRecordEntity));
+    		ExamRecordDataEntity examRecordDataEntity = new ExamRecordDataEntity();
+    		examRecordDataEntity.setExamId(examId);
+    		long examRecordNum = examRecordDataRepo.count(Example.of(examRecordDataEntity));
     		if(examRecordNum > 0){
     			throw new StatusException("syncExamStudent-exception", "该考试已开始,不能删除考生");
     		}
@@ -96,7 +77,7 @@ public class SyncCloudServiceProvider  extends ControllerSupport implements Hand
     	Long courseId = req.getId();
     	String courseLevel = req.getLevel();
     	examStudentRepo.updateCourse(courseId, courseLevel);
-    	examRecordRepo.updateCourse(courseId, courseLevel);
+		examRecordDataRepo.updateCourse(courseId, courseLevel);
         return null;
     }
 
@@ -110,7 +91,7 @@ public class SyncCloudServiceProvider  extends ControllerSupport implements Hand
 //		examStudentRepo.updateStudentNameAndStudentCode(studentId, studentName, studentCode);
 //    	examRecordRepo.updateStudentNameAndStudentCode(studentId, studentName, studentCode);
 		examStudentRepo.updateStudentName(studentId,studentName);
-		examRecordRepo.updateStudentName(studentId, studentName);
+		examRecordDataRepo.updateStudentName(studentId, studentName);
 		//如果有需要解绑的学号信息,需要对学号进行解绑
 		if (null != req.getUnboundStudentCodeList() && !req.getUnboundStudentCodeList().isEmpty()) {
 			examStudentRepo.updateExamStudentCode(req.getIdentityNumber(), req.getUnboundStudentCodeList());

+ 2 - 2
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamCaptureService.java

@@ -23,7 +23,7 @@ public interface ExamCaptureService {
     /**
      * 抓拍详情-审核详细信息
      *
-     * @param examRecordId
+     * @param examRecordDataId
      * @return
      */
     ExamCaptureAuditInfo getExamCaptureAuditDetail(Long examRecordDataId);
@@ -31,7 +31,7 @@ public interface ExamCaptureService {
     /**
      * 抓拍详情-抓拍记录列表
      *
-     * @param examRecordId
+     * @param examRecordDataId
      * @return
      */
     List<ExamCaptureInfo> getExamCaptureList(Long examRecordDataId);

+ 0 - 7
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/ExamRecordService.java

@@ -65,13 +65,6 @@ public interface ExamRecordService {
      */
     List<ExamRecordDataEntity> getExamRecordListByExamStudentId(Long examStudentId);
 
-    /**
-     * 获取考试记录详细数据ID
-     *
-     * @param examRecordId
-     * @return
-     */
-    Long findExamRecordDataId(Long examRecordId);
     /**
      * 查询“考试明细” 是否存在待审数据
      * @param query

+ 1 - 13
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditInfo.java

@@ -24,11 +24,7 @@ public class ExamAuditInfo implements JsonSerializable {
      * 主键
      */
     private Long id;
-    /**
-     * 考试记录ID
-     */
-    private Long examRecordId;
-    
+
     private Long examRecordDataId;
     
     /**
@@ -175,14 +171,6 @@ public class ExamAuditInfo implements JsonSerializable {
         this.id = id;
     }
 
-    public Long getExamRecordId() {
-        return examRecordId;
-    }
-
-    public void setExamRecordId(Long examRecordId) {
-        this.examRecordId = examRecordId;
-    }
-
     public String getStatus() {
         return status;
     }

+ 8 - 9
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditMapper.java

@@ -24,7 +24,6 @@ public class ExamAuditMapper {
         columns.append("audit.discipline_detail as disciplineDetail,");
         columns.append("audit.discipline_type as disciplineType,");
         columns.append("audit.audit_user_name as auditUserName,");
-        columns.append("record.id as examRecordId,");
         columns.append("record.exam_id as examId,");
         columns.append("record.exam_student_id as examStudentId,");
         columns.append("record.student_id as studentId,");
@@ -33,14 +32,14 @@ public class ExamAuditMapper {
         columns.append("record.identity_number as identityNumber,");
         columns.append("record.course_id as courseId,");
         columns.append("record.org_id as orgId,");
-        columns.append("data.id as examRecordDataId,");
-        columns.append("data.exam_order as examOrder,");
-        columns.append("data.face_total_count as faceTotalCount,");
-        columns.append("data.face_success_count as faceSuccessCount,");
-        columns.append("data.face_failed_count as faceFailedCount,");
-        columns.append("data.face_stranger_count as faceStrangerCount,");
-        columns.append("data.face_success_percent as faceSuccessPercent,");
-        columns.append("data.face_verify_result as faceVerifyResult");
+        columns.append("record.id as examRecordDataId,");
+        columns.append("record.exam_order as examOrder,");
+        columns.append("record.face_total_count as faceTotalCount,");
+        columns.append("record.face_success_count as faceSuccessCount,");
+        columns.append("record.face_failed_count as faceFailedCount,");
+        columns.append("record.face_stranger_count as faceStrangerCount,");
+        columns.append("record.face_success_percent as faceSuccessPercent,");
+        columns.append("record.face_verify_result as faceVerifyResult");
         return columns.toString();
     }
 

+ 0 - 10
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examcapture/ExamCaptureAuditInfo.java

@@ -26,8 +26,6 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
      */
 	private Long examRecordDataId;
 	
-    private Long examRecordId;
-    
     private Long studentId;
     
     private String studentName;
@@ -101,14 +99,6 @@ public class ExamCaptureAuditInfo implements JsonSerializable {
      */
     private String virtualCameraNames;
 
-    public Long getExamRecordId() {
-        return examRecordId;
-    }
-
-    public void setExamRecordId(Long examRecordId) {
-        this.examRecordId = examRecordId;
-    }
-
     public String getStatus() {
         return status;
     }

+ 3 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examrecord/ExamRecordEntityConvert.java

@@ -13,14 +13,12 @@ import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.core.oe.common.base.Constants;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.DateUtils;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.CourseLevel;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.core.oe.common.enums.IsSuccess;
 import cn.com.qmth.examcloud.core.oe.common.enums.TrueFalse;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.common.service.LocalCacheService;
 import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import com.google.common.collect.Lists;
@@ -31,7 +29,6 @@ import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -47,7 +44,7 @@ import java.util.stream.Collectors;
 public class ExamRecordEntityConvert {
 	
 	@Autowired
-	private ExamRecordRepo examRecordRepo;
+	private ExamRecordDataRepo examRecordDataRepo;
 
     @Autowired
     private GainBaseDataService gainBaseDataService;
@@ -55,7 +52,7 @@ public class ExamRecordEntityConvert {
         if (recordData == null) {
             return null;
         }
-        ExamRecordEntity record = GlobalHelper.getEntity(examRecordRepo,recordData.getExamRecordId(),ExamRecordEntity.class);
+        ExamRecordDataEntity record = GlobalHelper.getEntity(examRecordDataRepo,recordData.getId(),ExamRecordDataEntity.class);
         if (record == null) {
             throw new StatusException(Constants.OE_CODE_500, "考试记录基础信息不存在!");
         }

+ 18 - 19
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamAuditServiceImpl.java

@@ -17,9 +17,15 @@ import cn.com.qmth.examcloud.core.oe.common.base.jpa.Searcher;
 import cn.com.qmth.examcloud.core.oe.common.base.jpa.SpecUtils;
 import cn.com.qmth.examcloud.core.oe.common.base.jpa.SqlWrapper;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
-import cn.com.qmth.examcloud.core.oe.common.entity.*;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamAuditEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordForMarkingEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.*;
-import cn.com.qmth.examcloud.core.oe.common.repository.*;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamAuditRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordForMarkingRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
 import cn.com.qmth.examcloud.core.oe.common.service.ExamScoreObtainQueueService;
 import cn.com.qmth.examcloud.core.oe.common.service.ExamScorePushQueueService;
 import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
@@ -29,7 +35,6 @@ import cn.com.qmth.examcloud.core.oe.student.api.request.SaveExamRecordForMarkin
 import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
 import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
-import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
 import org.hibernate.query.NativeQuery;
@@ -80,8 +85,6 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     private ExamScoreObtainQueueService examScoreObtainQueueService;
     @Autowired
     private LocalCacheService localCacheService;
-    @Autowired
-    private ExamRecordRepo examRecordRepo;
     @Override
     public Page<ExamAuditInfo> getExamAuditList(ExamAuditQuery query) {
         Check.isNull(query, "查询参数不能为空!");
@@ -91,9 +94,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         final String columns = ExamAuditMapper.defaultColumns();
         SqlWrapper wrapper = new SqlWrapper()
                 .select(columns).from("ec_oe_exam_audit").as("audit")
-                .innerJoin("ec_oe_exam_record_data").as("data").on("data.id", "audit.exam_record_data_id")
-                .innerJoin("ec_oe_exam_record").as("record").on("record.id", "data.exam_record_id")
-                .where().notEq("data.exam_record_status", ExamRecordStatus.EXAM_INVALID.name());
+                .innerJoin("ec_oe_exam_record_data").as("record").on("record.id", "audit.exam_record_data_id")
+                .where().notEq("record.exam_record_status", ExamRecordStatus.EXAM_INVALID.name());
         if (query.getOrgId() != null) {
             wrapper.and().eq("record.org_id", query.getOrgId());
         }
@@ -116,7 +118,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
             wrapper.and().eq("record.course_level", query.getCourseLevel());
         }
         if (query.getExamRecordDataId() != null) {
-            wrapper.and().eq("data.id", query.getExamRecordDataId());
+            wrapper.and().eq("record.id", query.getExamRecordDataId());
         }
         if (StringUtils.isNotBlank(query.getStatus())) {
             wrapper.and().eq("audit.status", query.getStatus());
@@ -278,9 +280,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         examScorePushQueueService.saveScoreDataInfoToQueue(examRecordData, examScore.getId());
         //保存获取分数队列
         examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordData);
-        ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
         //发送通知
-        examScoreObtainQueueService.sendObtainScoreNotify(examRecord.getRootOrgId());
+        examScoreObtainQueueService.sendObtainScoreNotify(examRecordData.getRootOrgId());
 	}
 	
 	/**
@@ -290,14 +291,13 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 	 */
 	private void saveExamRecordForMarkingWithAudit(ExamRecordDataEntity examRecordData,ExamScoreEntity examScore){
     	if(examRecordData.getIsAllObjectivePaper() != null && !examRecordData.getIsAllObjectivePaper()){
-            ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
     		SaveExamRecordForMarkingReq req = new SaveExamRecordForMarkingReq();
     		req.setExamRecordDataId(examRecordData.getId());
-    		req.setExamId(examRecord.getExamId());
-    		req.setExamStudentId(examRecord.getExamStudentId());
-    		req.setPaperType(examRecord.getPaperType());
-    		req.setBasePaperId(examRecord.getBasePaperId());
-    		req.setCourseId(examRecord.getCourseId());
+    		req.setExamId(examRecordData.getExamId());
+    		req.setExamStudentId(examRecordData.getExamStudentId());
+    		req.setPaperType(examRecordData.getPaperType());
+    		req.setBasePaperId(examRecordData.getBasePaperId());
+    		req.setCourseId(examRecordData.getCourseId());
     		req.setObjectiveScore(examScore.getObjectiveScore());
     		oeExamRecordForMarkingCloudService.saveExamRecordForMarking(req);
     	}
@@ -316,7 +316,6 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 		//保存获取分数队列
         examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordData);
         //发送通知
-        ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
-        examScoreObtainQueueService.sendObtainScoreNotify(examRecord.getRootOrgId());
+        examScoreObtainQueueService.sendObtainScoreNotify(examRecordData.getRootOrgId());
 	}
 }

+ 18 - 35
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamCaptureServiceImpl.java

@@ -7,42 +7,33 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
-import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
-import org.apache.commons.lang3.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-import com.netflix.discovery.CommonConstants;
-
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamAuditService;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCaptureService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examcapture.ExamCaptureAuditInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examcapture.ExamCaptureInfo;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamAuditEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamCaptureEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.AuditStatus;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamCaptureRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
 import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * 考试抓拍检测相关接口
@@ -57,13 +48,7 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
     @Autowired
     private ExamAuditService examAuditService;
     @Autowired
-    private ExamRecordService examRecordService;
-    @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
-    @Autowired
-    private GainBaseDataService gainBaseDataService;
-    @Autowired
-    private ExamRecordRepo examRecordRepo;
 
     @Override
     public ExamCaptureAuditInfo getExamCaptureAuditDetail(Long examRecordDataId) {
@@ -74,7 +59,6 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         if (recordData == null) {
             return null;
         }
-        ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,recordData.getExamRecordId(),ExamRecordEntity.class);
 
         ExamAuditEntity audit = examAuditService.getExamAuditByExamRecordDataId(examRecordDataId);
         ExamCaptureAuditInfo detail = new ExamCaptureAuditInfo();
@@ -91,13 +75,12 @@ public class ExamCaptureServiceImpl implements ExamCaptureService {
         }
         
         detail.setExamRecordDataId(examRecordDataId);
-        detail.setExamRecordId(examRecord.getId());
-        detail.setStudentId(examRecord.getStudentId());
-        detail.setStudentCode(examRecord.getStudentCode());
-        detail.setStudentName(examRecord.getStudentName());
-        detail.setIdentityNumber(examRecord.getIdentityNumber());
+        detail.setStudentId(recordData.getStudentId());
+        detail.setStudentCode(recordData.getStudentCode());
+        detail.setStudentName(recordData.getStudentName());
+        detail.setIdentityNumber(recordData.getIdentityNumber());
         
-        CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examRecord.getCourseId());
+        CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(recordData.getCourseId());
 
         detail.setCourseCode(courseBean.getCode());
         detail.setCourseName(courseBean.getName());

+ 20 - 29
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordPaperStructServiceImpl.java

@@ -1,33 +1,28 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.BasePaperCacheBean;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.mongodb.core.MongoTemplate;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.stereotype.Service;
-
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordPaperStructService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.ExamRecordQuestionsInfo;
 import cn.com.qmth.examcloud.core.oe.common.base.Constants;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.NewQuestionType;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Sentence;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordPaperStructEntity;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordPaperStructRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
-import cn.com.qmth.examcloud.core.questions.api.request.GetBasePaperReq;
-import cn.com.qmth.examcloud.core.questions.api.response.GetBasePaperResp;
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
+import cn.com.qmth.examcloud.support.cache.bean.BasePaperCacheBean;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 
@@ -41,10 +36,7 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
 
 	@Autowired
 	private ExamRecordDataRepo examRecordDataRepo;
-	
-	@Autowired
-	private ExamRecordRepo examRecordRepo;
-	
+
 	@Autowired
 	private ExamRecordPaperStructRepo examRecordPaperStructRepo;
 	
@@ -60,11 +52,10 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
 	@Override
 	public ExamRecordPaperStructEntity getExamRecordPaperStruct(Long examRecordDataId) {
 		ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
-		ExamRecordEntity examRecordEntity =GlobalHelper.getEntity(examRecordRepo,examRecordDataEntity.getExamRecordId(),ExamRecordEntity.class);
-		String paperStructId = examRecordEntity.getPaperStructId();
+		String paperStructId = examRecordDataEntity.getPaperStructId();
 		ExamRecordPaperStructEntity examRecordPaperStruct = null;
 		if(StringUtils.isBlank(paperStructId)){
-			Map<String,Object> paperInfoMap = getPaperInfoFromOeExamQuestion(examRecordEntity.getId());
+			Map<String,Object> paperInfoMap = getPaperInfoFromOeExamQuestion(examRecordDataEntity.getId());
 			String paperId = paperInfoMap.get("paper_id").toString();
 			//从缓存中获取试卷结构
 			BasePaperCacheBean getBasePaperResp = CacheHelper.getBasePaper(paperId);
@@ -80,10 +71,10 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
 			examRecordPaperStruct = examRecordPaperStructRepo.save(examRecordPaperStruct);
 			//保存考试记录
 			//经测试,从oe_exam_question中获取的paperId最准确
-			examRecordEntity.setBasePaperId(paperId);
-			examRecordEntity.setPaperType(paperInfoMap.get("paper_type").toString());
-			examRecordEntity.setPaperStructId(examRecordPaperStruct.getId());
-			examRecordRepo.save(examRecordEntity);
+			examRecordDataEntity.setBasePaperId(paperId);
+			examRecordDataEntity.setPaperType(paperInfoMap.get("paper_type").toString());
+			examRecordDataEntity.setPaperStructId(examRecordPaperStruct.getId());
+			examRecordDataRepo.save(examRecordDataEntity);
 			return examRecordPaperStruct;
 		}else{
 			examRecordPaperStruct =GlobalHelper.getEntity(examRecordPaperStructRepo,paperStructId,ExamRecordPaperStructEntity.class);
@@ -111,7 +102,7 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
 		 ExamRecordQuestionsInfo examRecordQuestion = new ExamRecordQuestionsInfo();
          examRecordQuestion.setExamRecordDataId(examRecordDataEntity.getId());
          examRecordQuestion.setCreationTime(examRecordDataEntity.getStartTime());
-         List<Map<String, Object>> rows = jdbcTemplate.queryForList(selectOldRecordQuestionByExamRecordIdSql(examRecordDataEntity.getExamRecordId()));
+         List<Map<String, Object>> rows = jdbcTemplate.queryForList(selectOldRecordQuestionByExamRecordIdSql(examRecordDataEntity.getId()));
          for (Map<String, Object> row : rows) {
              ExamRecordQuestionsInfo.ExamQuestionEntity examQuestion = ExamRecordQuestionsInfo.createExamQuestionEntity();
 

+ 11 - 14
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordQuestionsServiceImpl.java

@@ -1,21 +1,22 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import java.util.List;
-import java.util.stream.Collectors;
-
-import cn.com.qmth.examcloud.core.oe.common.entity.*;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordQuestionsService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.SubjectiveQuestionScoreInfo;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.QuestionTypeUtil;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamQuestionEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordQuestionsEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamType;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordQuestionsRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.stream.Collectors;
 
 @Service("examRecordQuestionsService")
 public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsService {
@@ -29,9 +30,6 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
 	@Autowired
 	private ExamScoreRepo examScoreRepo;
 
-	@Autowired
-	private ExamRecordRepo examRecordRepo;
-	
 	@Override
 	public List<ExamQuestionEntity> querySubjectiveAnswerList(Long examRecordDataId) {
 		ExamRecordQuestionsEntity examRecordQuestionsEntity = examRecordQuestionsRepo.findByExamRecordDataId(examRecordDataId);
@@ -44,9 +42,8 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
 
 	@Override
 	public void saveSubjectiveQuestionScore(Long examRecordDataId,List<SubjectiveQuestionScoreInfo> subjectiveQuestionScoreInfoList) {
-		ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
-		ExamRecordEntity examRecord =GlobalHelper.getEntity(examRecordRepo,examRecordDataEntity.getExamRecordId(),ExamRecordEntity.class);
-		if(examRecord.getExamType() == ExamType.ONLINE){
+		ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
+		if(examRecordData.getExamType() == ExamType.ONLINE){
 			ExamRecordQuestionsEntity examRecordQuestionsEntity = examRecordQuestionsRepo.findByExamRecordDataId(examRecordDataId);
 			List<ExamQuestionEntity> examRecordQuestionList = examRecordQuestionsEntity.getExamQuestionEntities();
 			

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

@@ -8,11 +8,8 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
-import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.ExamStudentEffectiveScoreInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordEntityConvert;
@@ -20,57 +17,43 @@ import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordInf
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordQuery;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamStudentQuestionScoreInfo;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
-import cn.com.qmth.examcloud.core.oe.common.base.jpa.Searcher;
-import cn.com.qmth.examcloud.core.oe.common.base.jpa.SpecUtils;
 import cn.com.qmth.examcloud.core.oe.common.base.jpa.SqlWrapper;
-import cn.com.qmth.examcloud.core.oe.common.enums.MarkingType;
-import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.common.service.LocalCacheService;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamQuestionEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordQuestionsEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamRecordStatus;
-import cn.com.qmth.examcloud.core.oe.common.enums.ExamType;
 import cn.com.qmth.examcloud.core.oe.common.enums.IsSuccess;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamAuditRepo;
+import cn.com.qmth.examcloud.core.oe.common.enums.MarkingType;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordQuestionsRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
+import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
+import cn.com.qmth.examcloud.core.oe.common.service.LocalCacheService;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
-
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
 import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
 import com.google.common.collect.Lists;
-
 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.PageRequest;
 import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Service;
 
 import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
 import javax.persistence.Query;
-
 import java.math.BigInteger;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordMapper.*;
-
 /**
  * 考试记录接口
  *
@@ -79,35 +62,26 @@ import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRe
  */
 @Service
 public class ExamRecordServiceImpl implements ExamRecordService {
-    @Autowired
-    private ExamRecordRepo examRecordRepo;
     @Autowired
     private ExamScoreRepo examScoreRepo;
     @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
     @Autowired
-    private ExamAuditRepo examAuditRepo;
-    @Autowired
     private EntityManager entityManager;
     @Autowired
-    private ExamService examService;
-    @Autowired
     private ExamStudentService examStudentService;
     @Autowired
     private GainBaseDataService gainBaseDataService;
     @Autowired
     private JdbcTemplate jdbcTemplate;
     @Autowired
-    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
-    @Autowired
     private ExamRecordEntityConvert examRecordEntityConvert;
     @Autowired
     private LocalCacheService localCacheService;
     /**
-     * ec_oe_exam_record_data 联合 ec_oe_exam_record 查询sql
+     * ec_oe_exam_record_data  查询sql
      */
     private static final String EXAM_RECORD_SQL = "select  record_data.id," +
-            "record_data.exam_record_id," +
             "record_data.exam_record_status," +
             "record_data.start_time," +
             "record_data.end_time," +
@@ -130,33 +104,32 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             "record_data.baidu_face_liveness_success_percent," +
             "record_data.creation_time," +
             "record_data.update_time," +
-            "record.exam_id exam_id," +
-            "record.exam_type exam_type," +
-            "record.exam_student_id exam_student_id," +
-            "record.student_id student_id," +
-            "record.student_code student_code," +
-            "record.student_name student_name," +
-            "record.identity_number identity_number," +
-            "record.course_id course_id," +
-            "record.course_level course_level," +
-            "record.root_org_id root_org_id," +
-            "record.org_id org_id," +
-            "record.base_paper_id base_paper_id," +
-            "record.paper_type paper_type," +
-            "record.paper_struct_id paper_struct_id," +
-            "record.info_collector info_collector" +
+            "record_data.exam_id exam_id," +
+            "record_data.exam_type exam_type," +
+            "record_data.exam_student_id exam_student_id," +
+            "record_data.student_id student_id," +
+            "record_data.student_code student_code," +
+            "record_data.student_name student_name," +
+            "record_data.identity_number identity_number," +
+            "record_data.course_id course_id," +
+            "record_data.course_level course_level," +
+            "record_data.root_org_id root_org_id," +
+            "record_data.org_id org_id," +
+            "record_data.base_paper_id base_paper_id," +
+            "record_data.paper_type paper_type," +
+            "record_data.paper_struct_id paper_struct_id," +
+            "record_data.info_collector info_collector" +
             " from ec_oe_exam_record_data record_data " +
-            " left join ec_oe_exam_record record on record_data.exam_record_id = record.id where 1=1";
+            " where 1=1";
     /**
      * 考生作答成绩
      */
     private static final String EXAM_STUDENT_QUESTION_SCORE_SQL = "select " +
             "erd.id exam_record_data_id,co.`code` course_code,co.`name` course_name, ex.`name` exam_name" +
-            ",er.student_code,er.base_paper_id " +
-            "from ec_oe_exam_record er " +
-            "inner join ec_oe_exam_record_data erd on er.id=erd.exam_record_id " +
-            "inner join ec_b_course co on er.course_id=co.id " +
-            "inner join ec_e_exam ex on er.exam_id=ex.id " +
+            ",erd.student_code,erd.base_paper_id " +
+            "from ec_oe_exam_record_data erd " +
+            "inner join ec_b_course co on erd.course_id=co.id " +
+            "inner join ec_e_exam ex on erd.exam_id=ex.id " +
             "where 1=1 ";
     @Autowired
     private ExamRecordQuestionsRepo examRecordQuestionsRepo;
@@ -192,7 +165,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         sqlBuilder.append(EXAM_RECORD_SQL);
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
-        sqlBuilder.append(" order by record.id desc");
+        sqlBuilder.append(" order by record_data.id desc");
         //分页条件
         int currentNum = (query.getPageNo() - 1) * query.getPageSize();
         sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
@@ -233,30 +206,12 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         examRecordData.setFaceVerifyResult(IsSuccess.strToEnum(rs.getString("face_verify_result")));
         examRecordData.setBaiduFaceLivenessSuccessPercent(rs.getDouble("baidu_face_liveness_success_percent"));
 
-//        ExamRecordEntity examRecord = new ExamRecordEntity();
-//        examRecord.setId(rs.getLong("exam_record_id"));
-//        examRecord.setExamId(rs.getLong("exam_id"));
-//        examRecord.setExamType(ExamType.strToEnum(rs.getString("exam_type")));
-//        examRecord.setExamStudentId(rs.getLong("exam_student_id"));
-//        examRecord.setStudentId(rs.getLong("student_id"));
-//        examRecord.setStudentCode(rs.getString("student_code"));
-//        examRecord.setStudentName(rs.getString("student_name"));
-//        examRecord.setIdentityNumber(rs.getString("identity_number"));
-//        examRecord.setCourseId(rs.getLong("course_id"));
-//        examRecord.setCourseLevel(rs.getString("course_level"));
-//        examRecord.setRootOrgId(rs.getLong("root_org_id"));
-//        examRecord.setOrgId(rs.getLong("org_id"));
-//        examRecord.setBasePaperId(rs.getString("base_paper_id"));
-//        examRecord.setPaperStructId(rs.getString("paper_struct_id"));
-//        examRecord.setInfoCollector(rs.getString("info_collector"));
-        examRecordData.setExamRecordId(rs.getLong("exam_record_id"));
-
         return examRecordData;
     }
 
     private long countExamRecordDetailListForPage(ExamRecordQuery query) {
         StringBuilder sqlBuilder = new StringBuilder();
-        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data left join ec_oe_exam_record record on record_data.exam_record_id = record.id where 1=1");
+        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data where 1=1");
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
         return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
@@ -274,31 +229,31 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             sql.append(" and record_data.id = " + query.getExamRecordDataId());
         }
         if (query.getOrgId() != null) {
-            sql.append(" and record.org_id = " + query.getOrgId());
+            sql.append(" and record_data.org_id = " + query.getOrgId());
         }
         if (query.getExamId() != null) {
-            sql.append(" and record.exam_id = " + query.getExamId());
+            sql.append(" and record_data.exam_id = " + query.getExamId());
         }
         if (StringUtils.isNotBlank(query.getStudentCode())) {
-            sql.append(" and record.student_code LIKE '%" + query.getStudentCode() + "%'");
+            sql.append(" and record_data.student_code LIKE '%" + query.getStudentCode() + "%'");
         }
         if (StringUtils.isNotBlank(query.getStudentName())) {
-            sql.append(" and record.student_name LIKE '%" + query.getStudentName() + "%'");
+            sql.append(" and record_data.student_name LIKE '%" + query.getStudentName() + "%'");
         }
         if (StringUtils.isNotBlank(query.getIdentityNumber())) {
-            sql.append(" and record.identity_number LIKE '%" + query.getIdentityNumber() + "%'");
+            sql.append(" and record_data.identity_number LIKE '%" + query.getIdentityNumber() + "%'");
         }
         if (StringUtils.isNotBlank(query.getInfoCollector())) {
-            sql.append(" and record.info_collector LIKE '%" + query.getInfoCollector() + "%'");
+            sql.append(" and record_data.info_collector LIKE '%" + query.getInfoCollector() + "%'");
         }
         if (query.getCourseId() != null) {
-            sql.append(" and record.course_id = " + query.getCourseId());
+            sql.append(" and record_data.course_id = " + query.getCourseId());
         }
         if (StringUtils.isNotBlank(query.getCourseLevel())) {
-            sql.append(" and record.course_level = '" + query.getCourseLevel() + "'");
+            sql.append(" and record_data.course_level = '" + query.getCourseLevel() + "'");
         }
         if (query.getExamRecordId() != null) {
-            sql.append(" and record.id = " + query.getExamRecordId());
+            sql.append(" and record_data.id = " + query.getExamRecordId());
         }
         if (StringUtils.isNotBlank(query.getStartTime()) && StringUtils.isNotBlank(query.getEndTime())) {
             sql.append(" and record_data.start_time >= str_to_date('" + query.getStartTime() + "','%Y/%m/%d %H:%i:%s')"
@@ -356,7 +311,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 0))");
         }
         sqlBuilder.append(" and record_data.is_illegality = 0");
-        sqlBuilder.append(" order by record.id desc");
+        sqlBuilder.append(" order by record_data.id desc");
         //分页条件
         int currentNum = (query.getPageNo() - 1) * query.getPageSize();
         sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
@@ -379,7 +334,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
      */
     private long countExamRecordListForPage(ExamRecordQuery query) {
         StringBuilder sqlBuilder = new StringBuilder();
-        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data left join ec_oe_exam_record record on record_data.exam_record_id = record.id where 1=1");
+        sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data where 1=1");
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         if (query.getIsWarn() != null) {
             if (query.getIsWarn()) {
@@ -399,12 +354,10 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         Check.isNull(examId, "考试ID不能为空!");
 
         SqlWrapper wrapper = new SqlWrapper()
-                .select("record.exam_student_id")
-                .from("ec_oe_exam_record").as("record")
-                .innerJoin("ec_oe_exam_record_data").as("data")
-                .on("record.id", "data.exam_record_id")
+                .select("record_data.exam_student_id")
+                .from("ec_oe_exam_record_data").as("data")
                 .where().eq("data.exam_record_status", ExamRecordStatus.EXAM_ING.name())
-                .and().eq("record.exam_id", examId);
+                .and().eq("record_data.exam_id", examId);
 
         Query query = entityManager.createNativeQuery(wrapper.build());
         List<BigInteger> list = query.getResultList();
@@ -424,25 +377,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         return examRecordDataRepo.findByExamStudentId(examStudentId);
     }
 
-    @Override
-    public Long findExamRecordDataId(Long examRecordId) {
-        SqlWrapper wrapper = new SqlWrapper()
-                .select("exam_record_id")
-                .from("ec_oe_exam_record_data")
-                .where()
-                .eq("exam_record_id", examRecordId);
-        Query query = entityManager.createNativeQuery(wrapper.build());
-        try {
-            BigInteger result = (BigInteger) query.getSingleResult();
-            if (result != null) {
-                return result.longValue();
-            }
-        } catch (NoResultException e) {
-            //ignore
-        }
-        return null;
-    }
-
     private Page<ExamRecordInfo> loadData(Page<ExamRecordInfo> page, Long examId) {
         if (page == null || page.getContent() == null) {
             return page;
@@ -512,7 +446,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
     public Long existsWarnExamRecordDetail(ExamRecordQuery query) {
         StringBuilder sqlBuilder = new StringBuilder();
         sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data "
-                + " left join ec_oe_exam_record record on record_data.exam_record_id = record.id "
                 + " where 1=1 ");
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0");
@@ -529,7 +462,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         sqlBuilder.append(EXAM_RECORD_SQL);
         sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
         sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn  = 1 and record_data.is_audit = 1))");
-        sqlBuilder.append(" order by record.id desc");
+        sqlBuilder.append(" order by record_data.id desc");
 
         List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
             @Override
@@ -608,13 +541,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
     public List<ExamStudentEffectiveScoreInfo> getExamStudentEffectiveScoreList(String markingType, List<Long> examStudentIdList) {
         List<ExamStudentEffectiveScoreInfo> resultList = new ArrayList<>();
         //考生所有的考试记录
-        List<ExamRecordEntity> allExamRecordList = examRecordRepo.findByExamStudentIdList(examStudentIdList);
-        if (allExamRecordList==null || allExamRecordList.isEmpty()){
-            return null;
-        }
-        List<Long> examRecordIdList = allExamRecordList.stream().map(p -> p.getId()).collect(Collectors.toList());
-
-        List<ExamRecordDataEntity> allExamRecordDataList = examRecordDataRepo.findByExamRecordIdIn(examRecordIdList);
+        List<ExamRecordDataEntity> allExamRecordDataList = examRecordDataRepo.findByExamStudentIdList(examStudentIdList);
         if (allExamRecordDataList==null || allExamRecordDataList.isEmpty()){
             return null;
         }
@@ -624,14 +551,13 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         if (allExamScoreList==null || allExamScoreList.isEmpty()){
             return null;
         }
-        Map<Long, List<ExamRecordEntity>> groupedByExamStudentExamRecordMap = allExamRecordList.stream().collect(Collectors.groupingBy(ExamRecordEntity::getExamStudentId));
+        Map<Long, List<ExamRecordDataEntity>> groupedByExamStudentExamRecordMap = allExamRecordDataList.stream().collect(Collectors.groupingBy(ExamRecordDataEntity::getExamStudentId));
         for (Long examStudentId: groupedByExamStudentExamRecordMap.keySet()){
             //当前考生的所有考试记录集合
-            List<ExamRecordEntity> curExamRecordList=groupedByExamStudentExamRecordMap.get(examStudentId);
-            List<Long> curExamRecordIdList=curExamRecordList.stream().map(p->p.getId()).collect(Collectors.toList());
-            List<ExamRecordDataEntity> curExamRecordDataList=allExamRecordDataList.stream().
-                    filter(p-> curExamRecordIdList.contains(p.getExamRecordId())).collect(Collectors.toList());
-            List<Long> curExamRecordDataIdList = curExamRecordDataList.stream().map(p->p.getId()).collect(Collectors.toList());
+            List<ExamRecordDataEntity> curExamRecordDataList=groupedByExamStudentExamRecordMap.get(examStudentId);
+            //当前考试记录id集合
+            List<Long> curExamRecordDataIdList=curExamRecordDataList.stream().map(p->p.getId()).collect(Collectors.toList());
+
             //当前考生的所有考试成绩集合
             List<ExamScoreEntity> curExamScoreList=allExamScoreList.stream().
                     filter(p->curExamRecordDataIdList.contains(p.getExamRecordDataId())).collect(Collectors.toList());
@@ -641,14 +567,13 @@ public class ExamRecordServiceImpl implements ExamRecordService {
             //最终生效的考试记录
             ExamRecordDataEntity effectiveExamRecordData=curExamRecordDataList.stream().
                     filter(p->p.getId().equals(effectiveScore.getExamRecordDataId())).collect(Collectors.toList()).get(0);
-            ExamRecordEntity effectiveExamRecord = curExamRecordList.stream().
-                    filter(p->p.getId().equals(effectiveExamRecordData.getExamRecordId())).collect(Collectors.toList()).get(0);
+
             ExamStudentEffectiveScoreInfo info = new ExamStudentEffectiveScoreInfo();
             info.setExamStudentId(examStudentId);
-            info.setRootOrgId(effectiveExamRecord.getRootOrgId());
-            info.setOrgId(effectiveExamRecord.getOrgId());
-            info.setBasePaperId(effectiveExamRecord.getBasePaperId());
-            info.setCourseId(effectiveExamRecord.getCourseId());
+            info.setRootOrgId(effectiveExamRecordData.getRootOrgId());
+            info.setOrgId(effectiveExamRecordData.getOrgId());
+            info.setBasePaperId(effectiveExamRecordData.getBasePaperId());
+            info.setCourseId(effectiveExamRecordData.getCourseId());
             info.setScore(effectiveScore.getTotalScore());
             info.setExamRecordDataId(effectiveExamRecordData.getId());
             resultList.add(info);
@@ -712,7 +637,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
         //查询条件
         StringBuilder sqlBuilder = new StringBuilder();
         sqlBuilder.append(EXAM_STUDENT_QUESTION_SCORE_SQL);
-        sqlBuilder.append(" and er.exam_id=" + examId);
+        sqlBuilder.append(" and erd.exam_id=" + examId);
         sqlBuilder.append(" and co.`code`='" + courseCode + "'");
         List<ExamStudentQuestionScoreInfo> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamStudentQuestionScoreInfo>() {
             @Override

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

@@ -43,9 +43,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -190,7 +188,6 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         
         List<ExamScoreInfo> examScoreInfoList = new ArrayList<ExamScoreInfo>();
         //缓存
-        Map<String,Object> cahcheMap = new HashMap<String, Object>();
         for(ExamStudentEntity examStudent:examStudentList){
         	long courseId = examStudent.getCourseId();
         	CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);

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

@@ -10,7 +10,6 @@ package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamService;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
 import cn.com.qmth.examcloud.core.oe.common.base.jpa.SpecUtils;
@@ -22,7 +21,6 @@ import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.*;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordForMarkingRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
 import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
 import cn.com.qmth.examcloud.core.oe.common.service.LocalCacheService;
@@ -66,16 +64,12 @@ public class ExamStudentServiceImpl implements ExamStudentService {
     @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
     @Autowired
-    private ExamRecordRepo examRecordRepo;
-    @Autowired
     private ExamRecordForMarkingRepo examRecordForMarkingRepo;
     @Autowired
     private ExamRecordService examRecordService;
     @Autowired
     private EntityManager entityManager;
     @Autowired
-    private ExamService examService;
-    @Autowired
     private GainBaseDataService gainBaseDataService;
     @Autowired
     private JdbcTemplate jdbcTemplate;
@@ -133,7 +127,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 String studentName = examStudentEntity.getStudentName();
                 String studentCode = examStudentEntity.getStudentCode();
                 String infoCollector = examStudentEntity.getInfoCollector();
-                examRecordRepo.syncUpdateExamStudentInfo(examStudentId, studentName, studentCode, infoCollector);
+                examRecordDataRepo.syncUpdateExamStudentInfo(examStudentId, studentName, studentCode, infoCollector);
             }
         }
     }
@@ -388,11 +382,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 " AND normal_exam_times >= " + examBean.getExamTimes().longValue() +
                 " AND ((is_reexamine = 0 OR is_reexamine is null) OR ( is_reexamine = 1 AND reexamine_completed = 1))" +
                 " AND NOT EXISTS (" +
-                "	SELECT * FROM ec_oe_exam_record t1" +
-                "	LEFT JOIN ec_oe_exam_record_data t2 ON t1.id = t2.exam_record_id" +
+                "	SELECT * FROM ec_oe_exam_record_data t1" +
                 "	WHERE" +
                 "		t1.exam_id = " + examBean.getId() + " and student.exam_student_id = t1.exam_student_id" +
-                "	AND t2.exam_record_status = 'EXAM_ING'" +
+                "	AND t1.exam_record_status = 'EXAM_ING'" +
                 ") ");
 
         sql.append(" order by student.id desc ");
@@ -466,11 +459,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
                 " AND normal_exam_times >= " + examBean.getExamTimes().longValue() +
                 " AND ((is_reexamine = 0 OR is_reexamine is null) OR ( is_reexamine = 1 AND reexamine_completed = 1))" +
                 " AND NOT EXISTS (" +
-                "	SELECT * FROM ec_oe_exam_record t1" +
-                "	LEFT JOIN ec_oe_exam_record_data t2 ON t1.id = t2.exam_record_id" +
+                "	SELECT * FROM ec_oe_exam_record_data t1" +
                 "	WHERE t1.exam_id = " + examBean.getId() +
                 "   AND student.exam_student_id = t1.exam_student_id" +
-                "	AND t2.exam_record_status = 'EXAM_ING'" +
+                "	AND t1.exam_record_status = 'EXAM_ING'" +
                 ")");
         if (query.getOrgId() != null) {
             sql.append(" and student.org_id = " + query.getOrgId());

+ 2 - 4
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/pushscore/cugr/CugrExamScorePushServiceImpl.java

@@ -8,8 +8,6 @@ import java.sql.SQLException;
 import java.util.List;
 
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
-import cn.com.qmth.examcloud.support.cache.CacheHelper;
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpEntity;
@@ -109,10 +107,10 @@ public class CugrExamScorePushServiceImpl implements ExamScorePushService{
 		}
 	}
 	private String getUrl(ExamScorePushQueue examScorePushQueue){
-		long examRecordId = examScorePushQueue.getExamRecordId();
+		long examRecordDataId = examScorePushQueue.getExamRecordDataId();
 		long scoreId = examScorePushQueue.getExamScoreId();
 		
-		String examRecordsql = "select identity_number,course_id from ec_oe_exam_record where id="+examRecordId;
+		String examRecordsql = "select identity_number,course_id from ec_oe_exam_record_data where id="+examRecordDataId;
 		String scoreSql = "select total_score from  ec_oe_exam_score where id="+scoreId;
 		
 		List<TmpExamRecord> examRecordList = jdbcTemplate.query(examRecordsql,new RowMapper<TmpExamRecord>(){

+ 22 - 30
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/pushscore/cup/CupExamScorePushServiceImpl.java

@@ -1,15 +1,23 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl.pushscore.cup;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URI;
-
+import cn.com.qmth.examcloud.commons.util.JsonUtil;
+import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
-import cn.com.qmth.examcloud.core.oe.common.entity.*;
-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.ExamOrgSettingsCacheBean;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushService;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreQueueService;
+import cn.com.qmth.examcloud.core.oe.admin.service.impl.pushscore.bean.ExamScorePushInfo;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamScorePushQueue;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
+import cn.com.qmth.examcloud.core.oe.common.enums.ExamScoreQueueStatus;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamScorePushQueueRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
+import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
+import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.config.RequestConfig;
@@ -24,20 +32,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import cn.com.qmth.examcloud.commons.util.JsonUtil;
-import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreQueueService;
-import cn.com.qmth.examcloud.core.oe.admin.service.impl.pushscore.bean.ExamScorePushInfo;
-import cn.com.qmth.examcloud.core.oe.common.enums.ExamScoreQueueStatus;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamScorePushQueueRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
-import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
-import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
-import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
 
 /**
  * 
@@ -57,9 +55,6 @@ public class CupExamScorePushServiceImpl implements ExamScorePushService{
 	@Autowired
 	private ExamRecordDataRepo examRecordDataRepo;
 	
-	@Autowired
-	private ExamRecordRepo examRecordRepo;
-	
 	@Autowired
 	private ExamStudentRepo examStudentRepo;
 	
@@ -85,10 +80,7 @@ public class CupExamScorePushServiceImpl implements ExamScorePushService{
 		ExamScoreEntity examScore = GlobalHelper.getEntity(examScoreRepo,scoreId,ExamScoreEntity.class);
 		ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,examScore.getExamRecordDataId(),ExamRecordDataEntity.class);
 
-		ExamRecordEntity examRecord =GlobalHelper.getEntity(
-				examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
-
-		ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecord.getExamStudentId());
+		ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecordData.getExamStudentId());
 		if(examScore == null || examRecordData == null || examStudent == null){
 			return;
 		}

+ 24 - 39
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/pushscore/swufe/SwufeExamScorePushServiceImpl.java

@@ -1,17 +1,21 @@
 package cn.com.qmth.examcloud.core.oe.admin.service.impl.pushscore.swufe;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
+import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
-import cn.com.qmth.examcloud.core.oe.common.entity.*;
-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.ExamOrgSettingsCacheBean;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushService;
+import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreQueueService;
+import cn.com.qmth.examcloud.core.oe.admin.service.impl.pushscore.bean.ExamScorePushInfo;
+import cn.com.qmth.examcloud.core.oe.common.base.utils.CommonUtil;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamScorePushQueue;
+import cn.com.qmth.examcloud.core.oe.common.entity.ExamStudentEntity;
+import cn.com.qmth.examcloud.core.oe.common.enums.ExamScoreQueueStatus;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
+import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
+import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.NameValuePair;
@@ -27,20 +31,12 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
-import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.common.base.utils.CommonUtil;
-import cn.com.qmth.examcloud.core.oe.common.enums.ExamScoreQueueStatus;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamScorePushQueueRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamStudentRepo;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreQueueService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushService;
-import cn.com.qmth.examcloud.core.oe.admin.service.impl.pushscore.bean.ExamScorePushInfo;
-import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
-import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 
@@ -59,19 +55,10 @@ public class SwufeExamScorePushServiceImpl implements ExamScorePushService{
 	
 	@Autowired
 	private ExamRecordDataRepo examRecordDataRepo;
-	
-	@Autowired
-	private ExamRecordRepo examRecordRepo;
-	
+
 	@Autowired
 	private ExamStudentRepo examStudentRepo;
-	
-	@Autowired
-	private ExamScorePushQueueRepo examScorePushQueueRepo;
-	
-    @Autowired
-    private GainBaseDataService gainBaseDataService;
-    
+
 	@Autowired
 	private ExamScoreQueueService examScoreQueueService;
 	
@@ -84,9 +71,7 @@ public class SwufeExamScorePushServiceImpl implements ExamScorePushService{
 		ExamScoreEntity examScore = GlobalHelper.getEntity(examScoreRepo,scoreId,ExamScoreEntity.class);
 		ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,examScore.getExamRecordDataId(),ExamRecordDataEntity.class);
 
-		ExamRecordEntity examRecord =GlobalHelper.getEntity(
-				examRecordRepo,examRecordData.getExamRecordId(),ExamRecordEntity.class);
-		ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecord.getExamStudentId());
+		ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examRecordData.getExamStudentId());
 		if(examScore == null || examRecordData == null || examStudent == null){
 			return;
 		}