|
@@ -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());
|