浏览代码

监考已审增加筛选审核类型:人工审核,系统审核

deason 1 年之前
父节点
当前提交
bd13e52d05

+ 11 - 0
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/examaudit/ExamAuditQuery.java

@@ -66,6 +66,9 @@ public class ExamAuditQuery implements JsonSerializable {
 	@ApiModelProperty("审核人")
 	private String auditUserName;
 
+	@ApiModelProperty("审核类型:系统审核=1,人工审核=0")
+	private String auditType;
+
 	@ApiModelProperty("开考起始时间")
 	private String startTime;
 
@@ -312,4 +315,12 @@ public class ExamAuditQuery implements JsonSerializable {
 		this.taskId = taskId;
 	}
 
+	public String getAuditType() {
+		return auditType;
+	}
+
+	public void setAuditType(String auditType) {
+		this.auditType = auditType;
+	}
+
 }

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

@@ -7,32 +7,6 @@
 
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditMapper.EXAM_RECORD_DATA_ID;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.commons.lang3.StringUtils;
-import org.hibernate.query.NativeQuery;
-import org.hibernate.transform.Transformers;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import com.google.common.collect.Lists;
-
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.commons.util.DateUtil;
@@ -41,45 +15,12 @@ import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SpecUtils;
 import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SqlWrapper;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.CommonUtil;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamAuditRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamFaceLiveVerifyRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamFaceLivenessVerifyRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordForMarkingRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamStudentFinalScoreRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.FaceBiopsyItemRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.IllegallyTypeRepo;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamAuditEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamFaceLiveVerifyEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamFaceLivenessVerifyEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordForMarkingEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamScoreEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentFinalScoreEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.FaceBiopsyItemEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.IllegallyTypeEntity;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.AuditStatus;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.DisciplineType;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FaceVerifyResult;
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.SelectType;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamAuditService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordQuestionsService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreObtainQueueService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushQueueService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentFinalScoreService;
-import cn.com.qmth.examcloud.core.oe.admin.service.ExportTaskService;
-import cn.com.qmth.examcloud.core.oe.admin.service.GainBaseDataService;
-import cn.com.qmth.examcloud.core.oe.admin.service.IllegallyTypeService;
+import cn.com.qmth.examcloud.core.oe.admin.dao.*;
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.*;
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.*;
+import cn.com.qmth.examcloud.core.oe.admin.service.*;
 import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditEntityConvert;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditInfo;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditMapper;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditQuery;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.RedoAuditInfo;
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.*;
 import cn.com.qmth.examcloud.marking.api.MarkWorkCloudService;
 import cn.com.qmth.examcloud.marking.api.request.AppendMarkWorkPaperReq;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
@@ -91,6 +32,29 @@ import cn.com.qmth.examcloud.support.enums.FaceBiopsyScheme;
 import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.hibernate.query.NativeQuery;
+import org.hibernate.transform.Transformers;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditMapper.EXAM_RECORD_DATA_ID;
 
 /**
  * 考试记录审核相关接口
@@ -100,8 +64,10 @@ import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
  */
 @Service
 public class ExamAuditServiceImpl implements ExamAuditService {
+
     @Autowired
     private ExportTaskService exportTaskService;
+
     @Autowired
     private ExamAuditRepo examAuditRepo;
 
@@ -168,19 +134,19 @@ public class ExamAuditServiceImpl implements ExamAuditService {
      */
     private static final String AUDIT_USER_NAME = "SYSTEM";
 
-    @SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
-	@Override
-    public Page<ExamAuditInfo> getExamAuditList(UserDataRules uds,ExamAuditQuery query) {
-    	if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
-    		return Page.empty();
-    	}
+    @SuppressWarnings({"deprecation", "unchecked", "rawtypes"})
+    @Override
+    public Page<ExamAuditInfo> getExamAuditList(UserDataRules uds, ExamAuditQuery query) {
+        if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
+            return Page.empty();
+        }
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "请先选择考试批次!");
         //封装查询条件
         Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize());
 
         final String columns = ExamAuditMapper.defaultColumns();
-        SqlWrapper wrapper = getSqlWrapper(uds,query);
+        SqlWrapper wrapper = getSqlWrapper(uds, query);
 
         long totalSize = 0;
         //查询总记录数
@@ -240,9 +206,9 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         return new PageImpl<ExamAuditInfo>(list, pageable, totalSize);
     }
 
-    @SuppressWarnings({ "rawtypes", "deprecation" })
-	private List getExamAuditForAsyncPage(UserDataRules uds,ExamAuditQuery query,int pageNo, int pageSize) {
-    	SqlWrapper wrapper = getSqlWrapper(uds,query);
+    @SuppressWarnings({"rawtypes", "deprecation"})
+    private List getExamAuditForAsyncPage(UserDataRules uds, ExamAuditQuery query, int pageNo, int pageSize) {
+        SqlWrapper wrapper = getSqlWrapper(uds, query);
 
         wrapper.groupBy("record.id ");
         //查询分页记录
@@ -255,18 +221,18 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         List resultList = dataQuery.getResultList();
         return resultList;
     }
-    
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-	@Override
-    public List<ExamAuditInfo> getExamAudit(UserDataRules uds,ExamAuditQuery query) {
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    @Override
+    public List<ExamAuditInfo> getExamAudit(UserDataRules uds, ExamAuditQuery query) {
         Check.isNull(query, "查询参数不能为空!");
         Check.isNull(query.getExamId(), "请先选择考试批次!");
         List resultList = new ArrayList<ExamStudentEntity>();
         int pageNo = 1;
         int pageSize = 5000;
         for (; ; ) {
-        	exportTaskService.checkStopExportTaskById(query.getTaskId());
-            List tem = getExamAuditForAsyncPage(uds,query,pageNo, pageSize);
+            exportTaskService.checkStopExportTaskById(query.getTaskId());
+            List tem = getExamAuditForAsyncPage(uds, query, pageNo, pageSize);
             if (tem == null || tem.size() == 0) {
                 break;
             } else {
@@ -278,7 +244,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         List<ExamAuditInfo> list = ExamAuditEntityConvert.of(resultList);
 
         for (ExamAuditInfo examAuditInfo : list) {
-        	exportTaskService.checkStopExportTaskById(query.getTaskId());
+            exportTaskService.checkStopExportTaskById(query.getTaskId());
             OrgCacheBean orgBean = gainBaseDataService.getOrgBean(examAuditInfo.getOrgId());
             examAuditInfo.setOrgName(orgBean.getName());
 
@@ -302,45 +268,47 @@ public class ExamAuditServiceImpl implements ExamAuditService {
             examAuditInfo.setObjectiveScore(String.valueOf(examScore.getObjectiveScore()));
 
         }
-        fillStage(list,query.getTaskId());
+        fillStage(list, query.getTaskId());
         return list;
     }
-    private void fillStage(List<ExamAuditInfo> list,Long taskId) {
-    	if(CollectionUtils.isEmpty(list)) {
-    		return;
-    	}
-    	for(ExamAuditInfo info:list) {
-    		exportTaskService.checkStopExportTaskById(taskId);
-    		if(info.getExamStageId()!=null) {
-    			ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
-    			info.setExamStageOrder(stage.getStageOrder());
-    			info.setStartTime(stage.getStartTime());
-    			info.setEndTime(stage.getEndTime());
-    			info.setExamStage(stage.getStageOrder() + "("
-						+ DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
-						+ DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
-    		}
-    	}
+
+    private void fillStage(List<ExamAuditInfo> list, Long taskId) {
+        if (CollectionUtils.isEmpty(list)) {
+            return;
+        }
+        for (ExamAuditInfo info : list) {
+            exportTaskService.checkStopExportTaskById(taskId);
+            if (info.getExamStageId() != null) {
+                ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
+                info.setExamStageOrder(stage.getStageOrder());
+                info.setStartTime(stage.getStartTime());
+                info.setEndTime(stage.getEndTime());
+                info.setExamStage(stage.getStageOrder() + "("
+                        + DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
+                        + DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
+            }
+        }
     }
+
     private void fillStage(List<ExamAuditInfo> list) {
-    	if(CollectionUtils.isEmpty(list)) {
-    		return;
-    	}
-    	for(ExamAuditInfo info:list) {
-    		if(info.getExamStageId()!=null) {
-    			ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
-    			info.setExamStageOrder(stage.getStageOrder());
-    			info.setStartTime(stage.getStartTime());
-    			info.setEndTime(stage.getEndTime());
-    			info.setExamStage(stage.getStageOrder() + "("
-						+ DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
-						+ DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
-    		}
-    	}
+        if (CollectionUtils.isEmpty(list)) {
+            return;
+        }
+        for (ExamAuditInfo info : list) {
+            if (info.getExamStageId() != null) {
+                ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
+                info.setExamStageOrder(stage.getStageOrder());
+                info.setStartTime(stage.getStartTime());
+                info.setEndTime(stage.getEndTime());
+                info.setExamStage(stage.getStageOrder() + "("
+                        + DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
+                        + DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
+            }
+        }
     }
 
 
-    private SqlWrapper getSqlWrapper(UserDataRules uds,ExamAuditQuery query) {
+    private SqlWrapper getSqlWrapper(UserDataRules uds, ExamAuditQuery query) {
         final String columns = ExamAuditMapper.defaultColumns();
         SqlWrapper wrapper = new SqlWrapper()
                 .select(columns).from("ec_oe_exam_audit").as("audit")
@@ -383,11 +351,26 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         if (StringUtils.isNotBlank(query.getStatus())) {
             wrapper.and().eq("audit.status", query.getStatus());
         }
-        if (StringUtils.isNoneBlank(query.getDisciplineType())) {
+        if (StringUtils.isNotBlank(query.getDisciplineType())) {
             wrapper.and().eq("audit.discipline_type", query.getDisciplineType());
         }
-        if (StringUtils.isNoneBlank(query.getAuditUserName())) {
-            wrapper.and().rightLike("audit.audit_user_name", query.getAuditUserName());
+
+        if (StringUtils.isNotBlank(query.getAuditType())) {
+            if ("1".equals(query.getAuditType())) {
+                // 系统审核
+                wrapper.and().eq("audit.audit_user_name", AUDIT_USER_NAME);
+            } else {
+                // 人工审核
+                if (StringUtils.isNotBlank(query.getAuditUserName())) {
+                    wrapper.and().rightLike("audit.audit_user_name", query.getAuditUserName());
+                } else {
+                    wrapper.and().notEq("audit.audit_user_name", AUDIT_USER_NAME);
+                }
+            }
+        } else {
+            if (StringUtils.isNotBlank(query.getAuditUserName())) {
+                wrapper.and().rightLike("audit.audit_user_name", query.getAuditUserName());
+            }
         }
 
         if (StringUtils.isNotBlank(query.getStartTime()) && StringUtils.isNotBlank(query.getEndTime())) {
@@ -406,12 +389,12 @@ public class ExamAuditServiceImpl implements ExamAuditService {
             wrapper.and().gte("audit.update_time", query.getAuditStartTime());
             wrapper.and().lte("audit.update_time", query.getAuditEndTime());
         }
-        
-        if(uds.getOrgRule().assertNeedQueryRefIds()) {
-        	wrapper.and().in("record.org_id", uds.getOrgRule().getRefIds());
+
+        if (uds.getOrgRule().assertNeedQueryRefIds()) {
+            wrapper.and().in("record.org_id", uds.getOrgRule().getRefIds());
         }
-        if(uds.getCourseRule().assertNeedQueryRefIds()) {
-        	wrapper.and().in("record.course_id", uds.getCourseRule().getRefIds());
+        if (uds.getCourseRule().assertNeedQueryRefIds()) {
+            wrapper.and().in("record.course_id", uds.getCourseRule().getRefIds());
         }
         return wrapper;
     }
@@ -485,6 +468,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         //保存考试记录
         examRecordData.setIsAudit(true);
         examRecordData.setIsIllegality(isPass ? false : true);
+        examRecordData.setUpdateTime(new Date());
         examRecordDataRepo.save(examRecordData);
 
         doAuditPostProcesser(isPass, examRecordData);
@@ -529,6 +513,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
             examRecordData.setIsWarn(true);
             examRecordData.setIsAudit(true);
             examRecordData.setIsIllegality(!redoAuditInfo.getIsPass());//是否违纪
+            examRecordData.setUpdateTime(new Date());
             examRecordDataRepo.save(examRecordData);
 
             doAuditPostProcesser(redoAuditInfo.getIsPass(), examRecordData);
@@ -788,9 +773,9 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         examScoreObtainQueueService.sendObtainScoreNotify(examRecordData.getRootOrgId());
     }
 
-	@Override
-	public void saveExceedMaxSwitchScreenCount(Long realExamRecordDataId) {
-		ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(realExamRecordDataId);
+    @Override
+    public void saveExceedMaxSwitchScreenCount(Long realExamRecordDataId) {
+        ExamAuditEntity examAudit = examAuditRepo.findByExamRecordDataId(realExamRecordDataId);
         if (examAudit != null) {
             return;
         }
@@ -805,8 +790,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
 
         // 修改考试记录为违纪、异常、已审
         this.disciplineExamRecordData(realExamRecordDataId);
-	}
-	
+    }
+
     @Override
     public boolean updateExamAuditByAllPass(Long examRecordDataId) {
         ExamAuditEntity examAuditEntity = examAuditRepo.findByExamRecordDataId(examRecordDataId);