Răsfoiți Sursa

clear @Deprecated

deason 10 luni în urmă
părinte
comite
9088b0c693

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

@@ -1,21 +1,8 @@
-/*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-08-27 16:20:17.
- * *************************************************
- */
-
 package cn.com.qmth.examcloud.core.oe.admin.service;
 
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
 import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamAuditEntity;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.UserDataRules;
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAuditInfo;
-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 org.springframework.data.domain.Page;
-
-import java.util.List;
 
 /**
  * 考试记录审核相关接口
@@ -25,16 +12,6 @@ import java.util.List;
  */
 public interface ExamAuditService {
 
-    /**
-     * 查询监考已审列表(分页)
-     *
-     * @param query
-     * @return
-     */
-    Page<ExamAuditInfo> getExamAuditList(UserDataRules uds,ExamAuditQuery query);
-
-
-
     /**
      * 获取审核信息
      *
@@ -43,15 +20,6 @@ public interface ExamAuditService {
      */
     ExamAuditEntity getExamAuditByExamRecordDataId(Long examRecordDataId);
 
-    /**
-     * 监考待审-批量审核
-     *
-     * @param examRecordDataIds
-     * @param isPass
-     * @param user
-     */
-    void batchAudit(List<Long> examRecordDataIds, Boolean isPass, User user);
-
     /**
      * 单个审核
      *
@@ -90,12 +58,8 @@ public interface ExamAuditService {
 
     void saveExamAuditForIllegalClient(Long realExamRecordDataId, String reason);
 
-	void saveExceedMaxSwitchScreenCount(Long realExamRecordDataId);
-
-	List<ExamAuditInfo> getExamAudit(UserDataRules uds, ExamAuditQuery query);
-
-
+    void saveExceedMaxSwitchScreenCount(Long realExamRecordDataId);
 
-	boolean updateExamAuditByAllPass(Long examRecordDataId);
+    boolean updateExamAuditByAllPass(Long examRecordDataId);
 
 }

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

@@ -1,53 +0,0 @@
-/*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-08-27 16:25:43.
- * *************************************************
- */
-
-package cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit;
-
-/**
- * 实体元数据
- *
- * @author: QMTH
- * @since: 2018/8/24
- */
-public class ExamAuditMapper {
-
-    public static final String EXAM_RECORD_DATA_ID = "examRecordDataId";
-
-    public static String defaultColumns() {
-        StringBuilder columns = new StringBuilder();
-        columns.append("audit.id as id,");
-        columns.append("audit.status as status,");
-        columns.append("audit.discipline_detail as disciplineDetail,");
-        columns.append("audit.discipline_type as disciplineType,");
-        columns.append("audit.audit_user_name as auditUserName,");
-        columns.append("audit.update_time as paperAuditTime,");
-        columns.append("record.exam_type as examType,");
-        columns.append("record.exam_id as examId,");
-        columns.append("record.exam_student_id as examStudentId,");
-        columns.append("record.student_id as studentId,");
-        columns.append("record.student_code as studentCode,");
-        columns.append("record.student_name as studentName,");
-        columns.append("record.identity_number as identityNumber,");
-        columns.append("record.course_id as courseId,");
-        columns.append("record.org_id as orgId,");
-        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,");
-        columns.append("record.start_time as paperStartTime,");
-        columns.append("record.end_time as paperSubmitTime,");
-        columns.append("record.switch_screen_count as switchScreenCount,");
-        columns.append("record.exam_stage_id as examStageId,");
-        columns.append("GROUP_CONCAT(DISTINCT process.source_ip) ip");
-        return columns.toString();
-    }
-
-}

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

@@ -1,60 +1,32 @@
-/*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-08-27 16:24:08.
- * *************************************************
- */
-
 package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
 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;
 import cn.com.qmth.examcloud.core.oe.admin.base.jpa.Searcher;
 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.*;
 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.dao.enums.AuditStatus;
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.DisciplineType;
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FaceVerifyResult;
 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.*;
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.RedoAuditInfo;
 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;
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamStageCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
 import cn.com.qmth.examcloud.support.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;
 
 /**
  * 考试记录审核相关接口
@@ -65,18 +37,12 @@ import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit.ExamAud
 @Service
 public class ExamAuditServiceImpl implements ExamAuditService {
 
-    @Autowired
-    private ExportTaskService exportTaskService;
-
     @Autowired
     private ExamAuditRepo examAuditRepo;
 
     @Autowired
     private ExamScoreRepo examScoreRepo;
 
-    @Autowired
-    private EntityManager entityManager;
-
     @Autowired
     private ExamRecordDataRepo examRecordDataRepo;
 
@@ -86,9 +52,6 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     @Autowired
     private ExamRecordForMarkingRepo examRecordForMarkingRepo;
 
-    @Autowired
-    private GainBaseDataService gainBaseDataService;
-
     @Autowired
     private ExamScorePushQueueService examScorePushQueueService;
 
@@ -96,14 +59,11 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     private ExamScoreObtainQueueService examScoreObtainQueueService;
 
     @Autowired
-    MarkWorkCloudService markWorkCloudService;
+    private MarkWorkCloudService markWorkCloudService;
 
     @Autowired
     private ExamFaceLivenessVerifyRepo examFaceLivenessVerifyRepo;
 
-    @Autowired
-    private IllegallyTypeService illegallyTypeService;
-
     @Autowired
     private FaceBiopsyItemRepo faceBiopsyItemRepo;
 
@@ -114,10 +74,10 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     private ExamStudentFinalScoreService examStudentFinalScoreService;
 
     @Autowired
-    IllegallyTypeRepo illegallyTypeRepo;
+    private IllegallyTypeRepo illegallyTypeRepo;
 
     @Autowired
-    ExamStudentFinalScoreRepo examStudentFinalScoreRepo;
+    private ExamStudentFinalScoreRepo examStudentFinalScoreRepo;
 
     /**
      * 活体检测失败自动审核
@@ -134,274 +94,6 @@ 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();
-        }
-        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);
-
-        long totalSize = 0;
-        //查询总记录数
-        if (query.getSelectType() == null || query.getSelectType() != SelectType.EXPORT) {
-            final String count = "count(0)";
-            final String leftJoin = "LEFT JOIN ec_oe_exam_process_record AS process ON record.id = process.exam_record_data_id";
-            String countSql = wrapper.build().replace(columns, count).replace(leftJoin, " ");
-            Query countQuery = entityManager.createNativeQuery(countSql);
-            BigInteger element = (BigInteger) countQuery.getSingleResult();
-            totalSize = element.longValue();
-            if (totalSize == 0) {
-                return new PageImpl<>(Lists.newArrayList(), pageable, totalSize);
-            }
-        }
-
-        wrapper.groupBy("record.id ");
-        //查询分页记录
-        wrapper.orderBy("record.update_time", true);//需求调整20200816:按审核时间排序
-        Query dataQuery = entityManager.createNativeQuery(wrapper.build());
-
-        //        dataQuery.unwrap(SQLQuery.class).setResultTransformer(Transformers.aliasToBean(HashMap.class));
-        dataQuery.unwrap(NativeQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
-        if (query.getSelectType() == null || query.getSelectType() != SelectType.EXPORT) {
-            dataQuery.setFirstResult((int) pageable.getOffset());
-            dataQuery.setMaxResults(pageable.getPageSize());
-        }
-        List resultList = dataQuery.getResultList();
-
-        List<ExamAuditInfo> list = ExamAuditEntityConvert.of(resultList);
-
-        for (ExamAuditInfo examAuditInfo : list) {
-            OrgCacheBean orgBean = gainBaseDataService.getOrgBean(examAuditInfo.getOrgId());
-            examAuditInfo.setOrgName(orgBean.getName());
-
-            //将违纪类型重赋值为文本,万恶的历史原因,不该这么做的。 待优化
-            if (StringUtils.isNotEmpty(examAuditInfo.getDisciplineType())) {
-                IllegallyTypeEntity illegallyType = illegallyTypeService.getIllegallyType(orgBean.getRootId(), examAuditInfo.getDisciplineType());
-                examAuditInfo.setDisciplineType(illegallyType.getName());
-            }
-
-
-            CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(examAuditInfo.getCourseId());
-            examAuditInfo.setCourseName(courseBean.getName());
-            examAuditInfo.setCourseCode(courseBean.getCode());
-            examAuditInfo.setCourseLevel(CourseLevel.getCourseLevel(courseBean.getLevel()).getTitle());
-
-            //考试名称
-            ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
-            examAuditInfo.setExamName(examBean.getName());
-
-            //客观分
-            ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examAuditInfo.getExamRecordDataId());
-            examAuditInfo.setObjectiveScore(String.valueOf(examScore.getObjectiveScore()));
-
-        }
-        fillStage(list);
-        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);
-
-        wrapper.groupBy("record.id ");
-        //查询分页记录
-        wrapper.orderBy("record.update_time", true);//需求调整20200816:按审核时间排序
-        Query dataQuery = entityManager.createNativeQuery(wrapper.build());
-        dataQuery.unwrap(NativeQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
-        int currentNum = (pageNo - 1) * pageSize;
-        dataQuery.setFirstResult(currentNum);
-        dataQuery.setMaxResults(pageSize);
-        List resultList = dataQuery.getResultList();
-        return resultList;
-    }
-
-    @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);
-            if (tem == null || tem.size() == 0) {
-                break;
-            } else {
-                pageNo++;
-                resultList.addAll(tem);
-            }
-        }
-
-        List<ExamAuditInfo> list = ExamAuditEntityConvert.of(resultList);
-
-        for (ExamAuditInfo examAuditInfo : list) {
-            exportTaskService.checkStopExportTaskById(query.getTaskId());
-            OrgCacheBean orgBean = gainBaseDataService.getOrgBean(examAuditInfo.getOrgId());
-            examAuditInfo.setOrgName(orgBean.getName());
-
-            //将违纪类型重赋值为文本,万恶的历史原因,不该这么做的。 待优化
-            if (StringUtils.isNotEmpty(examAuditInfo.getDisciplineType())) {
-                IllegallyTypeEntity illegallyType = illegallyTypeService.getIllegallyType(orgBean.getRootId(), examAuditInfo.getDisciplineType());
-                examAuditInfo.setDisciplineType(illegallyType.getName());
-            }
-
-            CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(examAuditInfo.getCourseId());
-            examAuditInfo.setCourseName(courseBean.getName());
-            examAuditInfo.setCourseCode(courseBean.getCode());
-            examAuditInfo.setCourseLevel(CourseLevel.getCourseLevel(courseBean.getLevel()).getTitle());
-
-            //考试名称
-            ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
-            examAuditInfo.setExamName(examBean.getName());
-
-            //客观分
-            ExamScoreEntity examScore = examScoreRepo.findByExamRecordDataId(examAuditInfo.getExamRecordDataId());
-            examAuditInfo.setObjectiveScore(String.valueOf(examScore.getObjectiveScore()));
-
-        }
-        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) {
-        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) {
-        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("record").on("record.id", "audit.exam_record_data_id")
-                .leftJoin("ec_oe_exam_process_record").as("process").on("record.id", "process.exam_record_data_id")
-                .where().notEq("record.exam_record_status", ExamRecordStatus.EXAM_INVALID.name());
-        if (query.getSwitchScreenCountStart() != null) {
-            wrapper.and().gte("record.switch_screen_count", query.getSwitchScreenCountStart());
-        }
-        if (query.getSwitchScreenCountEnd() != null) {
-            wrapper.and().lte("record.switch_screen_count", query.getSwitchScreenCountEnd());
-        }
-        if (query.getOrgId() != null) {
-            wrapper.and().eq("record.org_id", query.getOrgId());
-        }
-        if (query.getExamId() != null) {
-            wrapper.and().eq("record.exam_id", query.getExamId());
-        }
-        if (query.getExamStageId() != null) {
-            wrapper.and().eq("record.exam_stage_id", query.getExamStageId());
-        }
-        if (StringUtils.isNotBlank(query.getStudentCode())) {
-            wrapper.and().rightLike("record.student_code", query.getStudentCode());
-        }
-        if (StringUtils.isNotBlank(query.getStudentName())) {
-            wrapper.and().rightLike("record.student_name", query.getStudentName());
-        }
-        if (StringUtils.isNotBlank(query.getIdentityNumber())) {
-            wrapper.and().rightLike("record.identity_number", query.getIdentityNumber());
-        }
-        if (query.getCourseId() != null) {
-            wrapper.and().eq("record.course_id", query.getCourseId());
-        }
-        if (StringUtils.isNotBlank(query.getCourseLevel())) {
-            wrapper.and().eq("record.course_level", query.getCourseLevel());
-        }
-        if (query.getExamRecordDataId() != null) {
-            wrapper.and().eq("record.id", query.getExamRecordDataId());
-        }
-        if (StringUtils.isNotBlank(query.getStatus())) {
-            wrapper.and().eq("audit.status", query.getStatus());
-        }
-        if (StringUtils.isNotBlank(query.getDisciplineType())) {
-            wrapper.and().eq("audit.discipline_type", query.getDisciplineType());
-        }
-
-        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())) {
-                    if (AUDIT_USER_NAME.equals(query.getAuditUserName())) {
-                        // 排除SYSTEM关键字
-                        wrapper.and().notEq("audit.audit_user_name", AUDIT_USER_NAME);
-                    }
-                    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())) {
-            wrapper.and().gte("record.start_time", query.getStartTime());
-            wrapper.and().lte("record.start_time", query.getEndTime());
-        }
-
-        if (StringUtils.isNotBlank(query.getSubmitStartTime()) && StringUtils.isNotBlank(query.getSubmitEndTime())) {
-            wrapper.and().isNotNull("record.end_time");
-            wrapper.and().gte("record.end_time", query.getSubmitStartTime());
-            wrapper.and().lte("record.end_time", query.getSubmitEndTime());
-        }
-
-        if (StringUtils.isNotBlank(query.getAuditStartTime()) && StringUtils.isNotBlank(query.getAuditEndTime())) {
-            wrapper.and().isNotNull("audit.update_time");
-            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.getCourseRule().assertNeedQueryRefIds()) {
-            wrapper.and().in("record.course_id", uds.getCourseRule().getRefIds());
-        }
-        return wrapper;
-    }
 
     @Override
     public ExamAuditEntity getExamAuditByExamRecordDataId(Long examRecordDataId) {
@@ -409,7 +101,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
             return null;
         }
         Searcher searchers = new Searcher()
-                .eq(EXAM_RECORD_DATA_ID, examRecordDataId);
+                .eq("examRecordDataId", examRecordDataId);
         Specification<ExamAuditEntity> spec = SpecUtils.buildSearchers(ExamAuditEntity.class, searchers.build());
         List<ExamAuditEntity> list = examAuditRepo.findAll(spec);
         if (list != null && list.size() > 0) {
@@ -418,22 +110,6 @@ public class ExamAuditServiceImpl implements ExamAuditService {
         return null;
     }
 
-    @Override
-    public void batchAudit(List<Long> examRecordDataIds, Boolean isPass, User user) {
-        //系统默认违纪类型
-        List<IllegallyTypeEntity> sysIllegallyTypeList = illegallyTypeService.getSystemIllegallyTypes();
-        if (null == sysIllegallyTypeList || sysIllegallyTypeList.isEmpty()) {
-            throw new StatusException("100001", "默认违纪类型未配置");
-        }
-        for (Long examRecordDataId : examRecordDataIds) {
-            String disciplineType = isPass ? DisciplineType.BATCH_PASS.name() : DisciplineType.BATCH_NOTPASS.name();
-            IllegallyTypeEntity illType = sysIllegallyTypeList.stream()
-                    .filter(p -> p.getCode().equals(disciplineType))
-                    .collect(Collectors.toList()).get(0);
-            singleAudit(examRecordDataId, isPass, "批量审核", disciplineType, user, illType.getId());
-        }
-    }
-
     @Override
     @Transactional
     public void singleAudit(Long examRecordDataId, Boolean isPass, String disciplineDetail,
@@ -520,7 +196,7 @@ public class ExamAuditServiceImpl implements ExamAuditService {
             examRecordData.setUpdateTime(new Date());
             examRecordDataRepo.save(examRecordData);
 
-            doAuditPostProcesser(redoAuditInfo.getIsPass(), examRecordData,redoAuditInfo.getFromMarking());
+            doAuditPostProcesser(redoAuditInfo.getIsPass(), examRecordData, redoAuditInfo.getFromMarking());
         }
     }
 
@@ -698,18 +374,19 @@ public class ExamAuditServiceImpl implements ExamAuditService {
      * @param isPass
      * @param examRecordData
      */
-    private void doAuditPostProcesser(Boolean isPass, ExamRecordDataEntity examRecordData,Boolean fromMarking) {
+    private void doAuditPostProcesser(Boolean isPass, ExamRecordDataEntity examRecordData, Boolean fromMarking) {
         if (isPass) {
             auditPassPostProcesser(examRecordData);
         } else {
-            auditUnPassPostProcesser(examRecordData,fromMarking);
+            auditUnPassPostProcesser(examRecordData, fromMarking);
         }
 
         //重新计算考生的最终分数
         examStudentFinalScoreService.calcAndSaveFinalScore(examRecordData.getExamStudentId());
     }
+
     private void doAuditPostProcesser(Boolean isPass, ExamRecordDataEntity examRecordData) {
-    	doAuditPostProcesser(isPass, examRecordData, null);
+        doAuditPostProcesser(isPass, examRecordData, null);
     }
 
     /**
@@ -764,13 +441,13 @@ public class ExamAuditServiceImpl implements ExamAuditService {
      *
      * @param examRecordData
      */
-    private void auditUnPassPostProcesser(ExamRecordDataEntity examRecordData,Boolean fromMarking) {
-        if(fromMarking==null||!fromMarking) {
-	    	ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo.findByExamRecordDataId(examRecordData.getId());
-	        if (examRecordForMarking != null) {
-	            //删除阅卷需要数据,防止违纪数据进入阅卷
-	            examRecordForMarkingRepo.delete(examRecordForMarking);
-	        }
+    private void auditUnPassPostProcesser(ExamRecordDataEntity examRecordData, Boolean fromMarking) {
+        if (fromMarking == null || !fromMarking) {
+            ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo.findByExamRecordDataId(examRecordData.getId());
+            if (examRecordForMarking != null) {
+                //删除阅卷需要数据,防止违纪数据进入阅卷
+                examRecordForMarkingRepo.delete(examRecordForMarking);
+            }
         }
 
         //删除考生的最终分数,后续会重新计算

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

@@ -2,27 +2,18 @@ package cn.com.qmth.examcloud.core.oe.admin.service.impl;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
-import cn.com.qmth.examcloud.core.oe.admin.base.utils.NewQuestionType;
-import cn.com.qmth.examcloud.core.oe.admin.base.utils.Sentence;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordPaperStructRepo;
 import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
 import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordPaperStructEntity;
 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.web.helpers.GlobalHelper;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-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;
-
 /**
  * @author chenken
  * @date 2018年11月13日 上午11:52:02
@@ -40,9 +31,6 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
     @Autowired
     private ExamRecordPaperStructRepo examRecordPaperStructRepo;
 
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-
     @Override
     public ExamRecordPaperStructEntity getExamRecordPaperStruct(Long examRecordDataId) {
         Check.isNull(examRecordDataId, "examRecordDataId不能为空");
@@ -61,97 +49,4 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
         }
     }
 
-    /**
-     * 使用examRecordId查询paperId
-     */
-    @Deprecated
-    private Map<String, Object> getPaperInfoFromOeExamQuestion(Long examRecordId) {
-        String sql = "select paper_id,paper_type from oe_exam_question where exam_record_id = " + examRecordId + " limit 1";
-        Map<String, Object> examQuestionMap = jdbcTemplate.queryForMap(sql);
-        return examQuestionMap;
-    }
-
-    /**
-     * 封装ExamQuestion
-     */
-    @Deprecated
-    private List<ExamRecordQuestionsInfo> encapsulationExamQuestion(ExamRecordDataEntity examRecordDataEntity) {
-        List<ExamRecordQuestionsInfo> examRecordQuestionList = new ArrayList<ExamRecordQuestionsInfo>();
-        ExamRecordQuestionsInfo examRecordQuestion = new ExamRecordQuestionsInfo();
-        examRecordQuestion.setExamRecordDataId(examRecordDataEntity.getId());
-        examRecordQuestion.setCreationTime(examRecordDataEntity.getStartTime());
-        List<Map<String, Object>> rows = jdbcTemplate.queryForList(selectOldRecordQuestionByExamRecordIdSql(examRecordDataEntity.getId()));
-        for (Map<String, Object> row : rows) {
-            ExamRecordQuestionsInfo.ExamQuestionEntity examQuestion = ExamRecordQuestionsInfo.createExamQuestionEntity();
-
-            //转换试题型
-            NewQuestionType questionType = NewQuestionType.convert(Sentence.dealString(row.get("question_type")));
-            if (questionType == null || questionType == NewQuestionType.NESTED) {
-                continue;
-            }
-
-            //获取试题ID
-            String questionId = Sentence.dealString(row.get("question_id"));
-            if (questionId == null || "".equals(questionId)) {
-                questionId = Sentence.dealString(row.get("parent_question_id"));
-            }
-
-            //计算考生试题得分
-            Float questionScore = Sentence.dealFloat(row.get("score"));
-            String correctAnswer = Sentence.dealString(row.get("answer"));
-            String studentAnswer = Sentence.dealString(row.get("stu_answer"));
-            Float studentScore = computeStudentScore(questionType, questionScore, correctAnswer, studentAnswer);
-
-            examQuestion.setQuestionId(questionId);
-            examQuestion.setMainNumber(Sentence.dealInteger(row.get("main_number")));
-            examQuestion.setOrder(Sentence.dealInteger(row.get("orders")));
-            examQuestion.setQuestionScore(questionScore);
-            examQuestion.setQuestionType(questionType);
-            examQuestion.setCorrectAnswer(correctAnswer);
-            examQuestion.setStudentAnswer(studentAnswer);
-            examQuestion.setStudentScore(studentScore);
-            examQuestion.setAnswer(Sentence.dealBoolean(row.get("is_answered")));
-            examQuestion.setSign(Sentence.dealBoolean(row.get("is_sign")));
-            examQuestion.setOptionPermutation(new Integer[]{0, 1, 2, 3});
-            examRecordQuestion.addExamQuestion(examQuestion);
-        }
-        examRecordQuestionList.add(examRecordQuestion);
-        return examRecordQuestionList;
-    }
-
-    @Deprecated
-    private String selectOldRecordQuestionByExamRecordIdSql(Long examRecordId) {
-        return new StringBuilder().append("SELECT ")
-                .append("id,exam_record_id,is_answered,is_multiple,is_nested_question,is_sign,orders,")
-                .append("main_number,sub_number,base_paper_id,paper_id,paper_name,paper_number,paper_type,")
-                .append("parent_question_id,question_id,question_type,score,stu_score,answer,stu_answer,create_at")
-                .append(" FROM oe_exam_question")
-                .append(" WHERE exam_record_id = ").append(examRecordId)
-                .append(" ORDER BY orders ASC").toString();
-    }
-
-    @Deprecated
-    private Float computeStudentScore(NewQuestionType questionType, Float questionScore, String correctAnswer, String studentAnswer) {
-        //若为客观题重新计算考生试题得分
-        if (questionType == null || !questionType.isObjective()) {
-            return 0F;
-        }
-        if (studentAnswer == null || "".equals(studentAnswer)) {
-            return 0F;
-        }
-
-        //按字母顺序排序  D,A,C --> ACD
-        String[] answers = studentAnswer.split(",");
-        Arrays.sort(answers);
-        String answerStr = new String();
-        for (String answer : answers) {
-            answerStr += answer;
-        }
-
-        if (!answerStr.equals(correctAnswer)) {
-            return 0F;
-        }
-        return questionScore;
-    }
-
 }

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

@@ -19,8 +19,6 @@ import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionGroup;
 import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionStructureWrapper;
 import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionUnitWrapper;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,7 +28,6 @@ import org.springframework.stereotype.Service;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 @Service("examRecordQuestionsService")
@@ -47,10 +44,6 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
     @Autowired
     private ExamScoreRepo examScoreRepo;
 
-    //本地题干缓存,最大200道题,默认缓存120秒
-    private Cache<String, String> questionContentCache = CacheBuilder.newBuilder().maximumSize(200)
-            .expireAfterWrite(120, TimeUnit.SECONDS).build();
-
     @Autowired
     private ExamStudentFinalScoreService examStudentFinalScoreService;
 

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

@@ -312,18 +312,6 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         return examStudentList;
     }
 
-    // @Override
-    // public List<ExamScoreInfo> exportExamScoreList(ExamScoreQuery query) {
-    // Check.isNull(query, "查询参数不能为空!");
-    // Check.isNull(query.getExamId(), "请先选择考试批次!");
-    //
-    // //阅卷方式
-    // String markingType = ExamCacheTransferHelper.
-    // getDefaultCachedExamProperty(query.getExamId(),
-    // ExamProperties.MARKING_TYPE.name()).getValue();
-    // return getExamStudentInfoListOfScoreExport(query, markingType);
-    // }
-
     @Override
     public List<ExamScoreEntity> getAllExamScoreList(Long examId, String identityNumber, Long courseId) {
         List<ExamRecordDataEntity> allExamRecordDataList = examRecordDataRepo.findByExamIdAndIdentityNumberAndCourseId(
@@ -336,74 +324,6 @@ public class ExamScoreServiceImpl implements ExamScoreService {
         return examScoreRepo.findByExamRecordDataIdIn(examRecordDataIds);
     }
 
-    //    private List<ExamScoreInfo> getExamStudentInfoListOfScoreExport(UserDataRules uds, ExamScoreQuery query, String markingType) {
-    //        Check.isNull(query, "查询参数不能为空!");
-    //        //查询条件
-    //        StringBuffer sql = new StringBuffer();
-    //        sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level,finished,student_id,student_code,student_name,identity_number"
-    //                + ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
-    //                + ",specialty_code,specialty_name,grade,exam_stage_id from ec_oe_exam_student where 1=1 ");
-    //        if (query.getOrgId() != null) {
-    //            sql.append(" and org_id=" + query.getOrgId());
-    //        }
-    //        if (query.getExamId() != null) {
-    //            sql.append(" and exam_id=" + query.getExamId());
-    //        }
-    //        if (query.getExamStageId() != null) {
-    //            sql.append(" and exam_stage_id=" + query.getExamStageId());
-    //        }
-    //        if (StringUtils.isNotBlank(query.getStudentCode())) {
-    //            sql.append(" and student_code LIKE '" + query.getStudentCode() + "%'");
-    //        }
-    //        if (StringUtils.isNotBlank(query.getStudentName())) {
-    //            sql.append(" and student_name LIKE '" + query.getStudentName() + "%'");
-    //        }
-    //        if (StringUtils.isNotBlank(query.getIdentityNumber())) {
-    //            sql.append(" and identity_number LIKE '" + query.getIdentityNumber() + "%'");
-    //        }
-    //        if (query.getCourseId() != null) {
-    //            sql.append(" and course_id=" + query.getCourseId());
-    //        }
-    //        if (StringUtils.isNotBlank(query.getCourseLevel())) {
-    //            sql.append(" and course_level= '" + query.getCourseLevel() + "'");
-    //        }
-    //        if (query.getFinished() != null) {
-    //            sql.append(" and finished= " + query.getFinished());
-    //        }
-    //        if (uds.getOrgRule().assertNeedQueryRefIds()) {
-    //            sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
-    //        }
-    //        if (uds.getCourseRule().assertNeedQueryRefIds()) {
-    //            sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
-    //        }
-    //        sql.append(" order by id");
-    //
-    //        if (query.getStartLimit() != null && query.getEndLimit() != null) {
-    //            int offset = query.getEndLimit() - query.getStartLimit() + 1;
-    //            sql.append(" limit " + (query.getStartLimit() - 1) + "," + offset);
-    //        }
-    //        List<ExamStudentEntity> examStudentList = jdbcTemplate.query(sql.toString(), new RowMapper<ExamStudentEntity>() {
-    //            @Override
-    //            public ExamStudentEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
-    //                return getExamStudentEntityByResultSet(rs);
-    //            }
-    //        });
-    //
-    //        List<ExamScoreInfo> examScoreInfoList = new ArrayList<ExamScoreInfo>();
-    //        //缓存
-    //        for (ExamStudentEntity examStudent : examStudentList) {
-    //            long courseId = examStudent.getCourseId();
-    //            CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);
-    //
-    //            long orgId = examStudent.getOrgId();
-    //            OrgCacheBean orgBean = gainBaseDataService.getOrgBean(orgId);
-    //
-    //            examScoreInfoList.add(convertToExamScoreInfo(examStudent, courseBean, orgBean, markingType));
-    //        }
-    //        fillStage(examScoreInfoList);
-    //        return examScoreInfoList;
-    //    }
-
     private ExamScoreInfo convertToExamScoreInfo(ExamStudentEntity examStudent, CourseCacheBean courseBean,
             OrgCacheBean orgBean, String markingType) {
         if (examStudent == null) {