Sfoglia il codice sorgente

违纪名单列表

deason 11 mesi fa
parent
commit
cede61df3c

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

@@ -17,6 +17,8 @@ public interface IllegallyTypeService {
 
     IllegallyTypeEntity getIllegallyType(Long rootOrgId, String code);
 
+    Map<String, String> getIllegallyTypes(Long rootOrgId);
+
     List<IllegallyTypeEntity> getSystemIllegallyTypes();
 
     /**

+ 31 - 12
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamRecordIllegallyServiceImpl.java

@@ -6,12 +6,12 @@ import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
 import cn.com.qmth.examcloud.core.oe.admin.dao.enums.SelectType;
 import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordIllegallyService;
+import cn.com.qmth.examcloud.core.oe.admin.service.IllegallyTypeService;
 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.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.OrgCacheBean;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -24,19 +24,24 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class ExamRecordIllegallyServiceImpl implements ExamRecordIllegallyService {
 
     private static final Logger log = LoggerFactory.getLogger(ExamRecordIllegallyServiceImpl.class);
 
+    @Autowired
+    private IllegallyTypeService illegallyTypeService;
+
     @Autowired
     private JdbcTemplate jdbcTemplate;
 
     @Override
     public Page<ExamAuditInfo> getExamRecordIllegallyList(ExamAuditQuery query, UserDataRule courseRule,
-            UserDataRule orgRule) {
+                                                          UserDataRule orgRule) {
         Check.isNull(query, "请求参数不能为空!");
         Check.isNull(query.getExamId(), "请先选择考试!");
 
@@ -75,25 +80,41 @@ public class ExamRecordIllegallyServiceImpl implements ExamRecordIllegallyServic
     }
 
     private void fillOtherInfo(List<ExamAuditInfo> list, Long examId) {
-        ExamSettingsCacheBean exam = CacheHelper.getExamSettings(examId);
+        ExamSettingsCacheBean examCache = CacheHelper.getExamSettings(examId);
+        Map<Long, String> orgMaps = new HashMap<>();
+        Map<Long, CourseCacheBean> courseMaps = new HashMap<>();
+
+        Map<String, String> illegallyTypeMaps = illegallyTypeService.getIllegallyTypes(examCache.getRootOrgId());
+
         for (ExamAuditInfo info : list) {
             // 考试名称
-            info.setExamName(exam.getName());
+            info.setExamName(examCache.getName());
 
             // 学习中心名称
-            OrgCacheBean org = CacheHelper.getOrg(info.getOrgId());
-            info.setOrgName(org.getName());
+            String orgName = orgMaps.get(info.getOrgId());
+            if (orgName == null) {
+                orgName = CacheHelper.getOrg(info.getOrgId()).getName();
+                orgMaps.put(info.getOrgId(), orgName);
+            }
+            info.setOrgName(orgName);
 
             // 课程信息
-            CourseCacheBean course = CacheHelper.getCourse(info.getCourseId());
+            CourseCacheBean course = courseMaps.get(info.getCourseId());
+            if (course == null) {
+                course = CacheHelper.getCourse(info.getCourseId());
+                courseMaps.put(info.getCourseId(), course);
+            }
             info.setCourseCode(course.getCode());
             info.setCourseName(course.getName());
             info.setCourseLevel(CourseLevel.getCourseLevel(course.getLevel()).getTitle());
+
+            // 违规类型名称
+            info.setDisciplineType(illegallyTypeMaps.get(info.getDisciplineType()));
         }
     }
 
-    private String queryExamRecordIllegallyListSql(ExamAuditQuery query, boolean isCount, UserDataRule courseRule,
-            UserDataRule orgRule) {
+    private String queryExamRecordIllegallyListSql(ExamAuditQuery query, boolean isCount
+            , UserDataRule courseRule, UserDataRule orgRule) {
         StringBuilder sql = new StringBuilder();
         if (isCount) {
             sql.append(" select count(1)");
@@ -104,7 +125,7 @@ public class ExamRecordIllegallyServiceImpl implements ExamRecordIllegallyServic
             sql.append(" rd.start_time AS paperStartTime,rd.end_time AS paperSubmitTime,rd.exam_order,");
             sql.append(" rd.face_total_count,rd.face_success_count,rd.face_failed_count,");
             sql.append(" rd.face_success_percent,rd.face_stranger_count,rd.face_verify_result,");
-            sql.append(" rd.switch_screen_count,sco.objective_score,a.id,a.status,ill.name AS discipline_type,");
+            sql.append(" rd.switch_screen_count,sco.objective_score,a.id,a.status,a.discipline_type,");
             sql.append(" a.discipline_detail,a.audit_user_name,a.update_time AS paperAuditTime,");
             sql.append(" (select GROUP_CONCAT(DISTINCT pr.source_ip) from ec_oe_exam_process_record pr")
                     .append(" where pr.exam_record_data_id = rd.id) ip");
@@ -112,8 +133,6 @@ public class ExamRecordIllegallyServiceImpl implements ExamRecordIllegallyServic
 
         sql.append(" from ec_oe_exam_record_data rd ");
         sql.append(" left join ec_oe_exam_audit a on a.exam_record_data_id = rd.id");
-        sql.append(" left join ec_oe_illegally_type ill on ill.code = a.discipline_type")
-                .append(" and (ill.root_org_id = -1 or ill.root_org_id = rd.root_org_id)");
         sql.append(" left join ec_oe_exam_score sco on sco.exam_record_data_id = rd.id");
 
         sql.append(" where rd.exam_id = ").append(query.getExamId());

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

@@ -14,13 +14,12 @@ import com.google.common.collect.Maps;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 
+import javax.persistence.criteria.Predicate;
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class IllegallyTypeServiceImpl implements IllegallyTypeService {
@@ -50,6 +49,30 @@ public class IllegallyTypeServiceImpl implements IllegallyTypeService {
         return result;
     }
 
+    @Override
+    public Map<String, String> getIllegallyTypes(Long rootOrgId) {
+        if (null == rootOrgId) {
+            return new HashMap<>();
+        }
+
+        Specification<IllegallyTypeEntity> specification = (root, query, cb) -> {
+            List<Predicate> predicates = new ArrayList<>();
+            predicates.add(cb.equal(root.get("rootOrgId"), -1L));
+            predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
+            return cb.or(predicates.toArray(new Predicate[predicates.size()]));
+        };
+        List<IllegallyTypeEntity> list = illegallyTypeRepo.findAll(specification);
+
+        Map<String, String> maps = new HashMap<>();
+        for (IllegallyTypeEntity entity : list) {
+            if (!entity.getEnable()) {
+                continue;
+            }
+            maps.put(entity.getCode(), entity.getName());
+        }
+        return maps;
+    }
+
     /**
      * 获取系统级别的违纪类型
      *