|
@@ -10,6 +10,7 @@ package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.util.DateUtil;
|
|
import cn.com.qmth.examcloud.commons.util.DateUtil;
|
|
|
|
+import cn.com.qmth.examcloud.commons.util.StringUtil;
|
|
import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetStudentListByIdsReq;
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetStudentListByIdsReq;
|
|
@@ -18,12 +19,7 @@ import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SqlWrapper;
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.BatchSetDataUtil;
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.BatchSetDataUtil;
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.DateUtils;
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.DateUtils;
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureCameraInfoRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamCaptureRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamProcessRecordRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordQuestionsRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
|
|
|
|
|
|
+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.entity.*;
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.enums.*;
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.enums.*;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
|
|
@@ -37,11 +33,7 @@ import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordQue
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamStudentQuestionScoreInfo;
|
|
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.admin.service.bean.examstudent.ExamStudentInfo;
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
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.cache.bean.StudentCacheBean;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.*;
|
|
import cn.com.qmth.examcloud.support.enums.ExamProperties;
|
|
import cn.com.qmth.examcloud.support.enums.ExamProperties;
|
|
import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
@@ -96,18 +88,18 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
@Autowired
|
|
@Autowired
|
|
private ExamRecordEntityConvert examRecordEntityConvert;
|
|
private ExamRecordEntityConvert examRecordEntityConvert;
|
|
|
|
|
|
-// @Autowired
|
|
|
|
-// private LocalCacheService localCacheService;
|
|
|
|
|
|
+ // @Autowired
|
|
|
|
+ // private LocalCacheService localCacheService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private StudentCloudService studentCloudService;
|
|
private StudentCloudService studentCloudService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ExamCaptureRepo examCaptureRepo;
|
|
private ExamCaptureRepo examCaptureRepo;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ExamCaptureCameraInfoRepo examCaptureCameraInfoRepo;
|
|
private ExamCaptureCameraInfoRepo examCaptureCameraInfoRepo;
|
|
-
|
|
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ExamProcessRecordRepo examProcessRecordRepo;
|
|
private ExamProcessRecordRepo examProcessRecordRepo;
|
|
|
|
|
|
@@ -210,7 +202,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
"record_data.switch_screen_count switchScreenCount," +
|
|
"record_data.switch_screen_count switchScreenCount," +
|
|
"record_data.exam_stage_id examStageId," +
|
|
"record_data.exam_stage_id examStageId," +
|
|
"audit.audit_user_name audit_user_name ";
|
|
"audit.audit_user_name audit_user_name ";
|
|
-
|
|
|
|
|
|
+
|
|
private static final String EXAM_RECORD_FROM_SQL = " from ec_oe_exam_record_data record_data " +
|
|
private static final String EXAM_RECORD_FROM_SQL = " from ec_oe_exam_record_data record_data " +
|
|
" LEFT JOIN ec_oe_exam_process_record AS process ON record_data.id = process.exam_record_data_id " +
|
|
" LEFT JOIN ec_oe_exam_process_record AS process ON record_data.id = process.exam_record_data_id " +
|
|
" LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id " +
|
|
" LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id " +
|
|
@@ -231,65 +223,82 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Page<ExamRecordInfo> getExamRecordDetailListForPage(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
|
|
+ public Page<ExamRecordInfo> getExamRecordDetailListForPage(UserDataRules uds, ExamRecordQuery query) {
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
- return this.loadData(_getExamRecordDetailListForPage(uds,query), query.getExamId());
|
|
|
|
|
|
+
|
|
|
|
+ Page<ExamRecordInfo> page = _getExamRecordDetailListForPage(uds, query);
|
|
|
|
+ return this.loadData(page, query.getExamId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 考试 是否开启身份检测
|
|
|
|
+ */
|
|
|
|
+ private boolean isFaceEnable(Long examId) {
|
|
|
|
+ ExamPropertyCacheBean examProperty = CacheHelper.getExamProperty(examId, ExamProperties.IS_FACE_ENABLE.name());
|
|
|
|
+ String examValue = examProperty.getValue();
|
|
|
|
+ if (StringUtils.isBlank(examValue)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isTrue(examValue)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Page<ExamRecordInfo> getExamRecordWaitingAuditList(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
|
|
+ public Page<ExamRecordInfo> getExamRecordWaitingAuditList(UserDataRules uds, ExamRecordQuery query) {
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
//默认条件
|
|
//默认条件
|
|
query.setIsAudit(false);
|
|
query.setIsAudit(false);
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
- return this.getExamRecordList(uds,query);
|
|
|
|
|
|
+ return this.getExamRecordList(uds, query);
|
|
}
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
|
-// public List<ExamRecordInfo> getExamRecordWaitingAudit(ExamRecordQuery query) {
|
|
|
|
-// Check.isNull(query, "查询参数不能为空!");
|
|
|
|
-// //默认条件
|
|
|
|
-// query.setIsAudit(false);
|
|
|
|
-// query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
|
|
-// query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
|
|
-//
|
|
|
|
-// //查询条件
|
|
|
|
-// StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
-// //待审核(按原先的sql,多了一个ip字段)
|
|
|
|
-// sqlBuilder.append(EXAM_RECORD_SQL);
|
|
|
|
-// sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
|
|
-// if (query.getIsWarn() != null) {
|
|
|
|
-// //只查有异常未审核
|
|
|
|
-// if (query.getIsWarn()) {
|
|
|
|
-// sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0 ");
|
|
|
|
-// } else {
|
|
|
|
-// sqlBuilder.append(" and record_data.is_warn = 0 ");
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// 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(" group by record_data.id ");
|
|
|
|
-//
|
|
|
|
-// sqlBuilder.append(" order by record_data.id desc");
|
|
|
|
-// List<ExamRecordDataEntity> entities = jdbcTemplate.query(sqlBuilder.toString(), (rs, rowNum) -> getExamRecordDataEntityByResultSet(rs));
|
|
|
|
-//
|
|
|
|
-// return examRecordEntityConvert.ofList(entities);
|
|
|
|
-// }
|
|
|
|
|
|
+ // @Override
|
|
|
|
+ // public List<ExamRecordInfo> getExamRecordWaitingAudit(ExamRecordQuery query) {
|
|
|
|
+ // Check.isNull(query, "查询参数不能为空!");
|
|
|
|
+ // //默认条件
|
|
|
|
+ // query.setIsAudit(false);
|
|
|
|
+ // query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
|
|
+ // query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
|
|
+ //
|
|
|
|
+ // //查询条件
|
|
|
|
+ // StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
+ // //待审核(按原先的sql,多了一个ip字段)
|
|
|
|
+ // sqlBuilder.append(EXAM_RECORD_SQL);
|
|
|
|
+ // sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
|
|
+ // if (query.getIsWarn() != null) {
|
|
|
|
+ // //只查有异常未审核
|
|
|
|
+ // if (query.getIsWarn()) {
|
|
|
|
+ // sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0 ");
|
|
|
|
+ // } else {
|
|
|
|
+ // sqlBuilder.append(" and record_data.is_warn = 0 ");
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // 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(" group by record_data.id ");
|
|
|
|
+ //
|
|
|
|
+ // sqlBuilder.append(" order by record_data.id desc");
|
|
|
|
+ // List<ExamRecordDataEntity> entities = jdbcTemplate.query(sqlBuilder.toString(), (rs, rowNum) -> getExamRecordDataEntityByResultSet(rs));
|
|
|
|
+ //
|
|
|
|
+ // return examRecordEntityConvert.ofList(entities);
|
|
|
|
+ // }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Long getExamRecordWaitingAuditNextId(UserDataRules uds,ExamRecordQuery query, Long examRecordDataId, String next) {
|
|
|
|
- //****注意按ID倒序排列的****,上一条,下一条
|
|
|
|
- if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- Check.isNull(query, "查询参数不能为空!");
|
|
|
|
|
|
+ public Long getExamRecordWaitingAuditNextId(UserDataRules uds, ExamRecordQuery query, Long examRecordDataId, String next) {
|
|
|
|
+ //****注意按ID倒序排列的****,上一条,下一条
|
|
|
|
+ if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
Check.isBlank(next, "[next]参数不能为空!");
|
|
Check.isBlank(next, "[next]参数不能为空!");
|
|
//默认条件
|
|
//默认条件
|
|
@@ -300,11 +309,11 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
//查询条件
|
|
//查询条件
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
if ("1".equals(next)) {//下一条
|
|
if ("1".equals(next)) {//下一条
|
|
- sqlBuilder.append("select max(record_data.id) id from ec_oe_exam_record_data record_data where 1 = 1 ");
|
|
|
|
|
|
+ sqlBuilder.append("select max(record_data.id) id from ec_oe_exam_record_data record_data where 1 = 1 ");
|
|
} else if ("0".equals(next)) {//上一条
|
|
} else if ("0".equals(next)) {//上一条
|
|
- sqlBuilder.append("select min(record_data.id) id from ec_oe_exam_record_data record_data where 1 = 1 ");
|
|
|
|
|
|
+ sqlBuilder.append("select min(record_data.id) id from ec_oe_exam_record_data record_data where 1 = 1 ");
|
|
}
|
|
}
|
|
- sqlBuilder.append(buildExamRecordCommonSelectCondition(uds,query));
|
|
|
|
|
|
+ sqlBuilder.append(buildExamRecordCommonSelectCondition(uds, query));
|
|
if (query.getIsWarn() != null) {
|
|
if (query.getIsWarn() != null) {
|
|
//只查有异常未审核
|
|
//只查有异常未审核
|
|
if (query.getIsWarn()) {
|
|
if (query.getIsWarn()) {
|
|
@@ -320,7 +329,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
sqlBuilder.append(" and record_data.id < ");
|
|
sqlBuilder.append(" and record_data.id < ");
|
|
sqlBuilder.append(examRecordDataId);
|
|
sqlBuilder.append(examRecordDataId);
|
|
} else if ("0".equals(next)) {//上一条
|
|
} else if ("0".equals(next)) {//上一条
|
|
- sqlBuilder.append(" and record_data.id > ");
|
|
|
|
|
|
+ sqlBuilder.append(" and record_data.id > ");
|
|
sqlBuilder.append(examRecordDataId);
|
|
sqlBuilder.append(examRecordDataId);
|
|
}
|
|
}
|
|
List<Long> ids = jdbcTemplate.query(sqlBuilder.toString(), (rs, rowNum) -> rs.getLong("id"));
|
|
List<Long> ids = jdbcTemplate.query(sqlBuilder.toString(), (rs, rowNum) -> rs.getLong("id"));
|
|
@@ -333,50 +342,52 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
* @param query
|
|
* @param query
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private Page<ExamRecordInfo> _getExamRecordDetailListForPage(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
|
|
+ private Page<ExamRecordInfo> _getExamRecordDetailListForPage(UserDataRules uds, ExamRecordQuery query) {
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
Check.isNull(query.getExamId(), "请先选择考试批次!");
|
|
//查询条件
|
|
//查询条件
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
sqlBuilder.append(EXAM_RECORD_FROM_SQL);
|
|
sqlBuilder.append(EXAM_RECORD_FROM_SQL);
|
|
- sqlBuilder.append(buildExamRecordCommonSelectCondition(uds,query));
|
|
|
|
|
|
+ sqlBuilder.append(buildExamRecordCommonSelectCondition(uds, query));
|
|
sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
sqlBuilder.append(" group by record_data.id ");
|
|
sqlBuilder.append(" group by record_data.id ");
|
|
//分页条件
|
|
//分页条件
|
|
int currentNum = (query.getPageNo() - 1) * query.getPageSize();
|
|
int currentNum = (query.getPageNo() - 1) * query.getPageSize();
|
|
List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(
|
|
List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(
|
|
- EXAM_RECORD_HEAD_SQL+sqlBuilder.toString()+" order by record_data.id desc limit " + currentNum + "," + query.getPageSize(),
|
|
|
|
- new RowMapper<ExamRecordDataEntity>() {
|
|
|
|
- @Override
|
|
|
|
- public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
|
- return getExamRecordDataEntityByResultSet(rs);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ EXAM_RECORD_HEAD_SQL + sqlBuilder.toString() + " order by record_data.id desc limit " + currentNum + "," + query.getPageSize(),
|
|
|
|
+ new RowMapper<ExamRecordDataEntity>() {
|
|
|
|
+ @Override
|
|
|
|
+ public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
|
+ return getExamRecordDataEntityByResultSet(rs);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
//查询总数
|
|
//查询总数
|
|
-// long total = countExamRecordDetailListForPage(query);
|
|
|
|
- long total=jdbcTemplate.queryForObject("SELECT count(1) FROM (SELECT record_data.id "+sqlBuilder.toString()+") temtb", Long.class);
|
|
|
|
|
|
+ // long total = countExamRecordDetailListForPage(query);
|
|
|
|
+ long total = jdbcTemplate.queryForObject("SELECT count(1) FROM (SELECT record_data.id " + sqlBuilder.toString() + ") temtb", Long.class);
|
|
Pageable pageable = PageRequest.of(query.getPageNo() - 1, query.getPageSize());
|
|
Pageable pageable = PageRequest.of(query.getPageNo() - 1, query.getPageSize());
|
|
Page<ExamRecordDataEntity> page = new PageImpl<ExamRecordDataEntity>(examRecordDataList, pageable, total);
|
|
Page<ExamRecordDataEntity> page = new PageImpl<ExamRecordDataEntity>(examRecordDataList, pageable, total);
|
|
- Page<ExamRecordInfo> ret=examRecordEntityConvert.of(page);
|
|
|
|
|
|
+ Page<ExamRecordInfo> ret = examRecordEntityConvert.of(page);
|
|
fillStage(ret.getContent());
|
|
fillStage(ret.getContent());
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+
|
|
private void fillStage(List<ExamRecordInfo> list) {
|
|
private void fillStage(List<ExamRecordInfo> list) {
|
|
- if(CollectionUtils.isEmpty(list)) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- for(ExamRecordInfo info:list) {
|
|
|
|
- if(info.getExamStageId()!=null) {
|
|
|
|
- ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
|
|
|
|
- info.setExamStageOrder(stage.getStageOrder());
|
|
|
|
- info.setStageStartTime(stage.getStartTime());
|
|
|
|
- info.setStageEndTime(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 (ExamRecordInfo info : list) {
|
|
|
|
+ if (info.getExamStageId() != null) {
|
|
|
|
+ ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
|
|
|
|
+ info.setExamStageOrder(stage.getStageOrder());
|
|
|
|
+ info.setStageStartTime(stage.getStartTime());
|
|
|
|
+ info.setStageEndTime(stage.getEndTime());
|
|
|
|
+ info.setExamStage(stage.getStageOrder() + "("
|
|
|
|
+ + DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
|
|
|
|
+ + DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
private ExamRecordDataEntity getExamRecordDataEntityByResultSet(ResultSet rs) throws SQLException {
|
|
private ExamRecordDataEntity getExamRecordDataEntityByResultSet(ResultSet rs) throws SQLException {
|
|
ExamRecordDataEntity examRecordData = new ExamRecordDataEntity();
|
|
ExamRecordDataEntity examRecordData = new ExamRecordDataEntity();
|
|
examRecordData.setId(rs.getLong("id"));
|
|
examRecordData.setId(rs.getLong("id"));
|
|
@@ -402,23 +413,23 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
examRecordData.setBaiduFaceLivenessSuccessPercent(rs.getDouble("baidu_face_liveness_success_percent"));
|
|
examRecordData.setBaiduFaceLivenessSuccessPercent(rs.getDouble("baidu_face_liveness_success_percent"));
|
|
examRecordData.setAuditUserName(rs.getString("audit_user_name"));
|
|
examRecordData.setAuditUserName(rs.getString("audit_user_name"));
|
|
examRecordData.setSwitchScreenCount(rs.getInt("switchScreenCount"));
|
|
examRecordData.setSwitchScreenCount(rs.getInt("switchScreenCount"));
|
|
- if(rs.getString("examStageId")!=null) {
|
|
|
|
- examRecordData.setExamStageId(rs.getLong("examStageId"));
|
|
|
|
|
|
+ if (rs.getString("examStageId") != null) {
|
|
|
|
+ examRecordData.setExamStageId(rs.getLong("examStageId"));
|
|
}
|
|
}
|
|
|
|
|
|
return examRecordData;
|
|
return examRecordData;
|
|
}
|
|
}
|
|
|
|
|
|
-// private long countExamRecordDetailListForPage(ExamRecordQuery query) {
|
|
|
|
-// StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
-// sqlBuilder.append("select count(distinct record_data.id) from ec_oe_exam_record_data record_data " +
|
|
|
|
-// " LEFT JOIN ec_oe_exam_process_record AS process ON record_data.id = process.exam_record_data_id " +
|
|
|
|
-// " LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id 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))");
|
|
|
|
-// sqlBuilder.append(" group by record_data.id ");
|
|
|
|
-// return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
|
|
-// }
|
|
|
|
|
|
+ // private long countExamRecordDetailListForPage(ExamRecordQuery query) {
|
|
|
|
+ // StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
+ // sqlBuilder.append("select count(distinct record_data.id) from ec_oe_exam_record_data record_data " +
|
|
|
|
+ // " LEFT JOIN ec_oe_exam_process_record AS process ON record_data.id = process.exam_record_data_id " +
|
|
|
|
+ // " LEFT JOIN ec_oe_exam_audit AS audit ON record_data.id = audit.exam_record_data_id 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))");
|
|
|
|
+ // sqlBuilder.append(" group by record_data.id ");
|
|
|
|
+ // return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 构建查询 考试明细sql语句
|
|
* 构建查询 考试明细sql语句
|
|
@@ -426,13 +437,13 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
* @param query
|
|
* @param query
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private StringBuilder buildExamRecordCommonSelectCondition(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
|
|
+ private StringBuilder buildExamRecordCommonSelectCondition(UserDataRules uds, ExamRecordQuery query) {
|
|
StringBuilder sql = new StringBuilder();
|
|
StringBuilder sql = new StringBuilder();
|
|
if (query.getSwitchScreenCountStart() != null) {
|
|
if (query.getSwitchScreenCountStart() != null) {
|
|
- sql.append(" and record_data.switch_screen_count >= " +query.getSwitchScreenCountStart());
|
|
|
|
|
|
+ sql.append(" and record_data.switch_screen_count >= " + query.getSwitchScreenCountStart());
|
|
}
|
|
}
|
|
if (query.getSwitchScreenCountEnd() != null) {
|
|
if (query.getSwitchScreenCountEnd() != null) {
|
|
- sql.append(" and record_data.switch_screen_count <= " +query.getSwitchScreenCountEnd());
|
|
|
|
|
|
+ sql.append(" and record_data.switch_screen_count <= " + query.getSwitchScreenCountEnd());
|
|
}
|
|
}
|
|
if (query.getExamRecordDataId() != null) {
|
|
if (query.getExamRecordDataId() != null) {
|
|
sql.append(" and record_data.id = " + query.getExamRecordDataId());
|
|
sql.append(" and record_data.id = " + query.getExamRecordDataId());
|
|
@@ -519,31 +530,31 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
//是否有虚拟设备
|
|
//是否有虚拟设备
|
|
if (query.getHasVirtual() != null) {
|
|
if (query.getHasVirtual() != null) {
|
|
if (query.getHasVirtual()) {
|
|
if (query.getHasVirtual()) {
|
|
- sql.append(" AND EXISTS( ");
|
|
|
|
- sql.append(" select 1 from ec_oe_exam_capture_camera_info v where record_data.id = v.exam_record_data_id and v.virtual_camera=1 ");
|
|
|
|
- sql.append(" ) ");
|
|
|
|
|
|
+ sql.append(" AND EXISTS( ");
|
|
|
|
+ sql.append(" select 1 from ec_oe_exam_capture_camera_info v where record_data.id = v.exam_record_data_id and v.virtual_camera=1 ");
|
|
|
|
+ sql.append(" ) ");
|
|
} else {
|
|
} else {
|
|
- sql.append(" AND NOT EXISTS( ");
|
|
|
|
- sql.append(" select 1 from ec_oe_exam_capture_camera_info v where record_data.id = v.exam_record_data_id and v.virtual_camera=1 ");
|
|
|
|
- sql.append(" ) ");
|
|
|
|
|
|
+ sql.append(" AND NOT EXISTS( ");
|
|
|
|
+ sql.append(" select 1 from ec_oe_exam_capture_camera_info v where record_data.id = v.exam_record_data_id and v.virtual_camera=1 ");
|
|
|
|
+ sql.append(" ) ");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getVirtualName())) {
|
|
if (StringUtils.isNotBlank(query.getVirtualName())) {
|
|
- sql.append(" AND EXISTS( ");
|
|
|
|
- sql.append(" select 1 from ec_oe_exam_capture_camera_info ci where record_data.id = ci.exam_record_data_id ");
|
|
|
|
- sql.append(" and ci.virtual_camera=1 and ci.name='"+query.getVirtualName()+"' ");
|
|
|
|
- sql.append(" ) ");
|
|
|
|
|
|
+ sql.append(" AND EXISTS( ");
|
|
|
|
+ sql.append(" select 1 from ec_oe_exam_capture_camera_info ci where record_data.id = ci.exam_record_data_id ");
|
|
|
|
+ sql.append(" and ci.virtual_camera=1 and ci.name='" + query.getVirtualName() + "' ");
|
|
|
|
+ sql.append(" ) ");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
//ip
|
|
//ip
|
|
if (StringUtils.isNotBlank(query.getIp())) {
|
|
if (StringUtils.isNotBlank(query.getIp())) {
|
|
- sql.append(" and process.source_ip='"+query.getIp()+"' ");
|
|
|
|
|
|
+ sql.append(" and process.source_ip='" + query.getIp() + "' ");
|
|
}
|
|
}
|
|
- if(uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
|
- sql.append(" and record_data.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
|
|
|
|
|
|
+ if (uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
|
+ sql.append(" and record_data.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
|
|
}
|
|
}
|
|
- if(uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
|
- sql.append(" and record_data.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
|
|
|
|
|
|
+ if (uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
|
+ sql.append(" and record_data.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
|
|
}
|
|
}
|
|
return sql;
|
|
return sql;
|
|
}
|
|
}
|
|
@@ -553,16 +564,16 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
* 查询无异常的数据和有异常未审核的数据
|
|
* 查询无异常的数据和有异常未审核的数据
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Page<ExamRecordInfo> getExamRecordList(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
- if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
|
- return Page.empty();
|
|
|
|
- }
|
|
|
|
|
|
+ public Page<ExamRecordInfo> getExamRecordList(UserDataRules uds, ExamRecordQuery query) {
|
|
|
|
+ if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
|
+ return Page.empty();
|
|
|
|
+ }
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
//查询条件
|
|
//查询条件
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
//待审核(按原先的sql,多了一个ip字段)
|
|
//待审核(按原先的sql,多了一个ip字段)
|
|
sqlBuilder.append(EXAM_RECORD_FROM_SQL);
|
|
sqlBuilder.append(EXAM_RECORD_FROM_SQL);
|
|
- sqlBuilder.append(buildExamRecordCommonSelectCondition(uds,query));
|
|
|
|
|
|
+ sqlBuilder.append(buildExamRecordCommonSelectCondition(uds, query));
|
|
if (query.getIsWarn() != null) {
|
|
if (query.getIsWarn() != null) {
|
|
//只查有异常未审核
|
|
//只查有异常未审核
|
|
if (query.getIsWarn()) {
|
|
if (query.getIsWarn()) {
|
|
@@ -576,20 +587,20 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
sqlBuilder.append(" and record_data.is_illegality = 0");
|
|
sqlBuilder.append(" and record_data.is_illegality = 0");
|
|
//查询分页记录
|
|
//查询分页记录
|
|
sqlBuilder.append(" group by record_data.id ");
|
|
sqlBuilder.append(" group by record_data.id ");
|
|
-// sqlBuilder.append(" order by record_data.id desc");
|
|
|
|
|
|
+ // sqlBuilder.append(" order by record_data.id desc");
|
|
//分页条件
|
|
//分页条件
|
|
int currentNum = (query.getPageNo() - 1) * query.getPageSize();
|
|
int currentNum = (query.getPageNo() - 1) * query.getPageSize();
|
|
-// sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
|
|
|
|
|
|
+ // sqlBuilder.append(" limit " + currentNum + "," + query.getPageSize());
|
|
List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(
|
|
List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(
|
|
- EXAM_RECORD_HEAD_SQL+sqlBuilder.toString()+" order by record_data.id desc limit " + currentNum + "," + query.getPageSize(), new RowMapper<ExamRecordDataEntity>() {
|
|
|
|
- @Override
|
|
|
|
- public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
|
- return getExamRecordDataEntityByResultSet(rs);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ EXAM_RECORD_HEAD_SQL + sqlBuilder.toString() + " order by record_data.id desc limit " + currentNum + "," + query.getPageSize(), new RowMapper<ExamRecordDataEntity>() {
|
|
|
|
+ @Override
|
|
|
|
+ public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
|
+ return getExamRecordDataEntityByResultSet(rs);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
//查询总数
|
|
//查询总数
|
|
-// long total = countExamRecordListForPage(query);
|
|
|
|
- long total=jdbcTemplate.queryForObject("SELECT count(1) FROM (SELECT record_data.id "+sqlBuilder.toString()+") temtb", Long.class);
|
|
|
|
|
|
+ // long total = countExamRecordListForPage(query);
|
|
|
|
+ long total = jdbcTemplate.queryForObject("SELECT count(1) FROM (SELECT record_data.id " + sqlBuilder.toString() + ") temtb", Long.class);
|
|
Pageable pageable = PageRequest.of(query.getPageNo() - 1, query.getPageSize());
|
|
Pageable pageable = PageRequest.of(query.getPageNo() - 1, query.getPageSize());
|
|
|
|
|
|
Page<ExamRecordDataEntity> page = new PageImpl<ExamRecordDataEntity>(examRecordDataList, pageable, total);
|
|
Page<ExamRecordDataEntity> page = new PageImpl<ExamRecordDataEntity>(examRecordDataList, pageable, total);
|
|
@@ -600,25 +611,24 @@ 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 where 1=1");
|
|
|
|
-// sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
|
|
-// if (query.getIsWarn() != null) {
|
|
|
|
-// if (query.getIsWarn()) {
|
|
|
|
-// sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0 ");
|
|
|
|
-// } else {
|
|
|
|
-// sqlBuilder.append(" and record_data.is_warn = 0 ");
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// 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");
|
|
|
|
-// return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
|
|
+ // private long countExamRecordListForPage(ExamRecordQuery query) {
|
|
|
|
+ // StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
+ // 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()) {
|
|
|
|
+ // sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0 ");
|
|
|
|
+ // } else {
|
|
|
|
+ // sqlBuilder.append(" and record_data.is_warn = 0 ");
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // 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");
|
|
|
|
+ // return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
|
|
+ // }
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
- @Override
|
|
|
|
|
|
+ @Override
|
|
public List<Long> getExamRecordingStudentIds(Long examId) {
|
|
public List<Long> getExamRecordingStudentIds(Long examId) {
|
|
Check.isNull(examId, "考试ID不能为空!");
|
|
Check.isNull(examId, "考试ID不能为空!");
|
|
|
|
|
|
@@ -647,12 +657,23 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
}
|
|
}
|
|
|
|
|
|
private Page<ExamRecordInfo> loadData(Page<ExamRecordInfo> page, Long examId) {
|
|
private Page<ExamRecordInfo> loadData(Page<ExamRecordInfo> page, Long examId) {
|
|
- if (page == null || page.getContent() == null) {
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(page.getContent())) {
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //获取考试名称
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
+
|
|
|
|
+ //考试 是否开启身份检测
|
|
|
|
+ final boolean faceEnable;
|
|
|
|
+ if (ExamType.ONLINE.name().equals(examBean.getExamType())) {
|
|
|
|
+ faceEnable = this.isFaceEnable(examId);
|
|
|
|
+ } else {
|
|
|
|
+ faceEnable = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
//缓存
|
|
//缓存
|
|
- Map<String, Object> cahcheMap = new HashMap<String, Object>();
|
|
|
|
|
|
+ Map<String, Object> cahcheMap = new HashMap<>();
|
|
|
|
|
|
page.getContent().forEach(e -> {
|
|
page.getContent().forEach(e -> {
|
|
ExamStudentInfo examStudent = examStudentService.getExamStudentInfo(e.getExamStudentId());
|
|
ExamStudentInfo examStudent = examStudentService.getExamStudentInfo(e.getExamStudentId());
|
|
@@ -674,8 +695,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
e.setOrgName(orgBean.getName());
|
|
e.setOrgName(orgBean.getName());
|
|
}
|
|
}
|
|
|
|
|
|
- //获取考试名称
|
|
|
|
- ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
e.setExamName(examBean.getName());
|
|
e.setExamName(examBean.getName());
|
|
Map<String, String> data = this.getPaperScore(e.getDataId());
|
|
Map<String, String> data = this.getPaperScore(e.getDataId());
|
|
//试卷总分
|
|
//试卷总分
|
|
@@ -684,7 +703,10 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
e.setObjectiveTotalScore(data.get("objectiveTotalScore"));
|
|
e.setObjectiveTotalScore(data.get("objectiveTotalScore"));
|
|
//主观题总分
|
|
//主观题总分
|
|
e.setSubjectiveTotalScore(data.get("subjectiveTotalScore"));
|
|
e.setSubjectiveTotalScore(data.get("subjectiveTotalScore"));
|
|
|
|
+
|
|
|
|
+ e.setShowReAudit(faceEnable);
|
|
});
|
|
});
|
|
|
|
+
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -712,20 +734,20 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Long existsWarnExamRecordDetail(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
- if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
|
- return 0L;
|
|
|
|
- }
|
|
|
|
|
|
+ public Long existsWarnExamRecordDetail(UserDataRules uds, ExamRecordQuery query) {
|
|
|
|
+ if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
|
+ return 0L;
|
|
|
|
+ }
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data "
|
|
sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data "
|
|
+ " where 1=1 ");
|
|
+ " where 1=1 ");
|
|
- sqlBuilder.append(buildExamRecordCommonSelectCondition(uds,query));
|
|
|
|
|
|
+ sqlBuilder.append(buildExamRecordCommonSelectCondition(uds, query));
|
|
sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0");
|
|
sqlBuilder.append(" and record_data.is_warn = 1 and record_data.is_audit = 0");
|
|
return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<ExamRecordInfo> getExamRecordDetailListForAsync(UserDataRules uds,ExamRecordQuery query) {
|
|
|
|
|
|
+ public List<ExamRecordInfo> getExamRecordDetailListForAsync(UserDataRules uds, ExamRecordQuery query) {
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
@@ -734,11 +756,11 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
int pageNo = 1;
|
|
int pageNo = 1;
|
|
int pageSize = 200;
|
|
int pageSize = 200;
|
|
for (; ; ) {
|
|
for (; ; ) {
|
|
- List<ExamRecordInfo> tem = getExamRecordDetailPageForExport(uds,query, pageNo,pageSize);
|
|
|
|
|
|
+ List<ExamRecordInfo> tem = getExamRecordDetailPageForExport(uds, query, pageNo, pageSize);
|
|
if (tem == null || tem.size() == 0) {
|
|
if (tem == null || tem.size() == 0) {
|
|
break;
|
|
break;
|
|
} else {
|
|
} else {
|
|
- pageNo++;
|
|
|
|
|
|
+ pageNo++;
|
|
examRecordDataList.addAll(tem);
|
|
examRecordDataList.addAll(tem);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -829,7 +851,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
public void setData(List<ExamRecordInfo> dataList) {
|
|
public void setData(List<ExamRecordInfo> dataList) {
|
|
List<Long> ids = dataList.stream().map(dto -> dto.getId()).distinct().collect(Collectors.toList());
|
|
List<Long> ids = dataList.stream().map(dto -> dto.getId()).distinct().collect(Collectors.toList());
|
|
Map<Long, Set<String>> map = new HashMap<>();
|
|
Map<Long, Set<String>> map = new HashMap<>();
|
|
- List<ExamCaptureCameraInfoEntity> examCaptureList = examCaptureCameraInfoRepo.findByExamRecordDataIdInAndVirtualCamera(ids,true);
|
|
|
|
|
|
+ List<ExamCaptureCameraInfoEntity> examCaptureList = examCaptureCameraInfoRepo.findByExamRecordDataIdInAndVirtualCamera(ids, true);
|
|
if (examCaptureList != null && examCaptureList.size() > 0) {
|
|
if (examCaptureList != null && examCaptureList.size() > 0) {
|
|
for (ExamCaptureCameraInfoEntity examCapture : examCaptureList) {
|
|
for (ExamCaptureCameraInfoEntity examCapture : examCaptureList) {
|
|
Set<String> virtualCameraNames = map.get(examCapture.getExamRecordDataId());
|
|
Set<String> virtualCameraNames = map.get(examCapture.getExamRecordDataId());
|
|
@@ -851,7 +873,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
};
|
|
};
|
|
tool.setDataForBatch(examRecordDataList, 100);
|
|
tool.setDataForBatch(examRecordDataList, 100);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private void setIps(List<ExamRecordInfo> examRecordDataList) {
|
|
private void setIps(List<ExamRecordInfo> examRecordDataList) {
|
|
BatchSetDataUtil<ExamRecordInfo> tool = new BatchSetDataUtil<ExamRecordInfo>() {
|
|
BatchSetDataUtil<ExamRecordInfo> tool = new BatchSetDataUtil<ExamRecordInfo>() {
|
|
@Override
|
|
@Override
|
|
@@ -863,7 +885,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
for (ExamProcessRecordEntity ep : list) {
|
|
for (ExamProcessRecordEntity ep : list) {
|
|
Set<String> ips = map.get(ep.getExamRecordDataId());
|
|
Set<String> ips = map.get(ep.getExamRecordDataId());
|
|
if (ips == null) {
|
|
if (ips == null) {
|
|
- ips = new HashSet<String>();
|
|
|
|
|
|
+ ips = new HashSet<String>();
|
|
map.put(ep.getExamRecordDataId(), ips);
|
|
map.put(ep.getExamRecordDataId(), ips);
|
|
}
|
|
}
|
|
String ip = ep.getSourceIp();
|
|
String ip = ep.getSourceIp();
|
|
@@ -947,10 +969,10 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private List<ExamRecordInfo> getExamRecordDetailPageForExport(UserDataRules uds,ExamRecordQuery query,int pageNo, int pageSize) {
|
|
|
|
|
|
+ private List<ExamRecordInfo> getExamRecordDetailPageForExport(UserDataRules uds, ExamRecordQuery query, int pageNo, int pageSize) {
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
sqlBuilder.append(EXAM_RECORD_EXPORT_SQL);
|
|
sqlBuilder.append(EXAM_RECORD_EXPORT_SQL);
|
|
- sqlBuilder.append(buildExamRecordCommonSelectCondition(uds,query));
|
|
|
|
|
|
+ sqlBuilder.append(buildExamRecordCommonSelectCondition(uds, query));
|
|
sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
sqlBuilder.append(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
sqlBuilder.append(" group by record_data.id ");
|
|
sqlBuilder.append(" group by record_data.id ");
|
|
//根据ip查询
|
|
//根据ip查询
|
|
@@ -965,68 +987,68 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
|
-// public List<ExamRecordInfo> getExamRecordDetailList(ExamRecordQuery query) {
|
|
|
|
-// Check.isNull(query, "查询参数不能为空!");
|
|
|
|
-// query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
|
|
-// query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
|
|
-//
|
|
|
|
-// StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
-// 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(" group by record_data.id ");
|
|
|
|
-// //根据ip查询
|
|
|
|
-// /*if (StringUtils.isNoneBlank(query.getIp())) {
|
|
|
|
-// sqlBuilder.append(" having ip like '%"+query.getIp()+"%' ");
|
|
|
|
-// }*/
|
|
|
|
-// sqlBuilder.append(" order by record_data.id desc");
|
|
|
|
-//
|
|
|
|
-// List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
|
|
|
|
-// @Override
|
|
|
|
-// public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
|
-// return getExamRecordDataEntityByResultSet(rs);
|
|
|
|
-// }
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// List<ExamRecordInfo> examRecordInfoList = examRecordEntityConvert.of(examRecordDataList);
|
|
|
|
-// return this.loadExamRecordDetailData(examRecordInfoList, query.getExamId());
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// private List<ExamRecordInfo> loadExamRecordDetailData(List<ExamRecordInfo> list, Long examId) {
|
|
|
|
-// if (list == null || list.size() == 0) {
|
|
|
|
-// return new ArrayList<ExamRecordInfo>();
|
|
|
|
-// }
|
|
|
|
-// //缓存
|
|
|
|
-// Map<String, Object> cahcheMap = new HashMap<String, Object>();
|
|
|
|
-//
|
|
|
|
-// list.forEach(examRecordInfo -> {
|
|
|
|
-// //获取考试名称
|
|
|
|
-// ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
-// examRecordInfo.setExamName(examBean.getName());
|
|
|
|
-//
|
|
|
|
-// ExamStudentInfo examStudent = (ExamStudentInfo) cahcheMap.get("examStudentinfo_" + examRecordInfo.getExamStudentId());
|
|
|
|
-// if (examStudent == null) {
|
|
|
|
-// examStudent = examStudentService.getExamStudentInfo(examRecordInfo.getExamStudentId());
|
|
|
|
-// cahcheMap.put("examStudentinfo_" + examRecordInfo.getExamStudentId(), examStudent);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// String photoNumber = localCacheService.getStudentPhotoNumber(cahcheMap, examRecordInfo.getStudentId());
|
|
|
|
-// examRecordInfo.setPhone(photoNumber);//电话号码
|
|
|
|
-// if (examStudent != null) {
|
|
|
|
-// examRecordInfo.setSpecialtyName(examStudent.getSpecialtyName());
|
|
|
|
-// examRecordInfo.setGrade(examStudent.getGrade());
|
|
|
|
-// }
|
|
|
|
-// Map<String, String> data = this.getPaperScore(examRecordInfo.getDataId());
|
|
|
|
-// //试卷总分
|
|
|
|
-// examRecordInfo.setPaperTotalScore(data.get("paperTotalScore"));
|
|
|
|
-// //客观题总分
|
|
|
|
-// examRecordInfo.setObjectiveTotalScore(data.get("objectiveTotalScore"));
|
|
|
|
-// //主观题总分
|
|
|
|
-// examRecordInfo.setSubjectiveTotalScore(data.get("subjectiveTotalScore"));
|
|
|
|
-// });
|
|
|
|
-// return list;
|
|
|
|
-// }
|
|
|
|
|
|
+ // @Override
|
|
|
|
+ // public List<ExamRecordInfo> getExamRecordDetailList(ExamRecordQuery query) {
|
|
|
|
+ // Check.isNull(query, "查询参数不能为空!");
|
|
|
|
+ // query.addRecordStatus(ExamRecordStatus.EXAM_END.name());
|
|
|
|
+ // query.addRecordStatus(ExamRecordStatus.EXAM_OVERDUE.name());
|
|
|
|
+ //
|
|
|
|
+ // StringBuilder sqlBuilder = new StringBuilder();
|
|
|
|
+ // 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(" group by record_data.id ");
|
|
|
|
+ // //根据ip查询
|
|
|
|
+ // /*if (StringUtils.isNoneBlank(query.getIp())) {
|
|
|
|
+ // sqlBuilder.append(" having ip like '%"+query.getIp()+"%' ");
|
|
|
|
+ // }*/
|
|
|
|
+ // sqlBuilder.append(" order by record_data.id desc");
|
|
|
|
+ //
|
|
|
|
+ // List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
|
|
|
|
+ // @Override
|
|
|
|
+ // public ExamRecordDataEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
|
+ // return getExamRecordDataEntityByResultSet(rs);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // List<ExamRecordInfo> examRecordInfoList = examRecordEntityConvert.of(examRecordDataList);
|
|
|
|
+ // return this.loadExamRecordDetailData(examRecordInfoList, query.getExamId());
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // private List<ExamRecordInfo> loadExamRecordDetailData(List<ExamRecordInfo> list, Long examId) {
|
|
|
|
+ // if (list == null || list.size() == 0) {
|
|
|
|
+ // return new ArrayList<ExamRecordInfo>();
|
|
|
|
+ // }
|
|
|
|
+ // //缓存
|
|
|
|
+ // Map<String, Object> cahcheMap = new HashMap<String, Object>();
|
|
|
|
+ //
|
|
|
|
+ // list.forEach(examRecordInfo -> {
|
|
|
|
+ // //获取考试名称
|
|
|
|
+ // ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
+ // examRecordInfo.setExamName(examBean.getName());
|
|
|
|
+ //
|
|
|
|
+ // ExamStudentInfo examStudent = (ExamStudentInfo) cahcheMap.get("examStudentinfo_" + examRecordInfo.getExamStudentId());
|
|
|
|
+ // if (examStudent == null) {
|
|
|
|
+ // examStudent = examStudentService.getExamStudentInfo(examRecordInfo.getExamStudentId());
|
|
|
|
+ // cahcheMap.put("examStudentinfo_" + examRecordInfo.getExamStudentId(), examStudent);
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // String photoNumber = localCacheService.getStudentPhotoNumber(cahcheMap, examRecordInfo.getStudentId());
|
|
|
|
+ // examRecordInfo.setPhone(photoNumber);//电话号码
|
|
|
|
+ // if (examStudent != null) {
|
|
|
|
+ // examRecordInfo.setSpecialtyName(examStudent.getSpecialtyName());
|
|
|
|
+ // examRecordInfo.setGrade(examStudent.getGrade());
|
|
|
|
+ // }
|
|
|
|
+ // Map<String, String> data = this.getPaperScore(examRecordInfo.getDataId());
|
|
|
|
+ // //试卷总分
|
|
|
|
+ // examRecordInfo.setPaperTotalScore(data.get("paperTotalScore"));
|
|
|
|
+ // //客观题总分
|
|
|
|
+ // examRecordInfo.setObjectiveTotalScore(data.get("objectiveTotalScore"));
|
|
|
|
+ // //主观题总分
|
|
|
|
+ // examRecordInfo.setSubjectiveTotalScore(data.get("subjectiveTotalScore"));
|
|
|
|
+ // });
|
|
|
|
+ // return list;
|
|
|
|
+ // }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<ExamStudentQuestionScoreInfo> getExamStudentQuestionScoreList(Long examId, String courseCode) {
|
|
public List<ExamStudentQuestionScoreInfo> getExamStudentQuestionScoreList(Long examId, String courseCode) {
|
|
@@ -1145,6 +1167,14 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
examStudentQuestionScoreInfo.setOrder(qa.getOrder());
|
|
examStudentQuestionScoreInfo.setOrder(qa.getOrder());
|
|
examStudentQuestionScoreInfo.setStudentScore(qa.getStudentScore());
|
|
examStudentQuestionScoreInfo.setStudentScore(qa.getStudentScore());
|
|
examStudentQuestionScoreInfo.setStudentAnswer(qa.getStudentAnswer());
|
|
examStudentQuestionScoreInfo.setStudentAnswer(qa.getStudentAnswer());
|
|
|
|
+
|
|
|
|
+ // if (QuestionType.SINGLE_CHOICE == qa.getQuestionType() || QuestionType.MULTIPLE_CHOICE == qa.getQuestionType()) {
|
|
|
|
+ // // 选择题 - 转换为新答案格式(兼容旧格式)
|
|
|
|
+ // examStudentQuestionScoreInfo.setStudentAnswer(QuestionOptionHelper.parseNumbers(qa.getStudentAnswer()));
|
|
|
|
+ // } else {
|
|
|
|
+ // examStudentQuestionScoreInfo.setStudentAnswer(qa.getStudentAnswer());
|
|
|
|
+ // }
|
|
|
|
+
|
|
return examStudentQuestionScoreInfo;
|
|
return examStudentQuestionScoreInfo;
|
|
}
|
|
}
|
|
|
|
|