|
@@ -8,11 +8,8 @@
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
-import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
|
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamCacheTransferHelper;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordService;
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamService;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.ExamStudentEffectiveScoreInfo;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.ExamStudentEffectiveScoreInfo;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordEntityConvert;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordEntityConvert;
|
|
@@ -20,57 +17,43 @@ import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordInf
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordQuery;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordQuery;
|
|
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.core.oe.common.base.jpa.Searcher;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.base.jpa.SpecUtils;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.jpa.SqlWrapper;
|
|
import cn.com.qmth.examcloud.core.oe.common.base.jpa.SqlWrapper;
|
|
-import cn.com.qmth.examcloud.core.oe.common.enums.MarkingType;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.common.service.LocalCacheService;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
|
|
import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamQuestionEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamQuestionEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
|
|
-import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordEntity;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordQuestionsEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordQuestionsEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.entity.ExamScoreEntity;
|
|
import cn.com.qmth.examcloud.core.oe.common.enums.ExamRecordStatus;
|
|
import cn.com.qmth.examcloud.core.oe.common.enums.ExamRecordStatus;
|
|
-import cn.com.qmth.examcloud.core.oe.common.enums.ExamType;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.common.enums.IsSuccess;
|
|
import cn.com.qmth.examcloud.core.oe.common.enums.IsSuccess;
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamAuditRepo;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.enums.MarkingType;
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordQuestionsRepo;
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordQuestionsRepo;
|
|
-import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordRepo;
|
|
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
|
|
import cn.com.qmth.examcloud.core.oe.common.repository.ExamScoreRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.common.service.LocalCacheService;
|
|
import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
-
|
|
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
|
|
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.StudentCacheBean;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
-
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.PageImpl;
|
|
import org.springframework.data.domain.PageImpl;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
-import org.springframework.data.jpa.domain.Specification;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.RowMapper;
|
|
import org.springframework.jdbc.core.RowMapper;
|
|
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
|
import javax.persistence.EntityManager;
|
|
-import javax.persistence.NoResultException;
|
|
|
|
import javax.persistence.Query;
|
|
import javax.persistence.Query;
|
|
-
|
|
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
import java.sql.ResultSet;
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
import java.sql.SQLException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordMapper.*;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 考试记录接口
|
|
* 考试记录接口
|
|
*
|
|
*
|
|
@@ -79,35 +62,26 @@ import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRe
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class ExamRecordServiceImpl implements ExamRecordService {
|
|
public class ExamRecordServiceImpl implements ExamRecordService {
|
|
- @Autowired
|
|
|
|
- private ExamRecordRepo examRecordRepo;
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ExamScoreRepo examScoreRepo;
|
|
private ExamScoreRepo examScoreRepo;
|
|
@Autowired
|
|
@Autowired
|
|
private ExamRecordDataRepo examRecordDataRepo;
|
|
private ExamRecordDataRepo examRecordDataRepo;
|
|
@Autowired
|
|
@Autowired
|
|
- private ExamAuditRepo examAuditRepo;
|
|
|
|
- @Autowired
|
|
|
|
private EntityManager entityManager;
|
|
private EntityManager entityManager;
|
|
@Autowired
|
|
@Autowired
|
|
- private ExamService examService;
|
|
|
|
- @Autowired
|
|
|
|
private ExamStudentService examStudentService;
|
|
private ExamStudentService examStudentService;
|
|
@Autowired
|
|
@Autowired
|
|
private GainBaseDataService gainBaseDataService;
|
|
private GainBaseDataService gainBaseDataService;
|
|
@Autowired
|
|
@Autowired
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
@Autowired
|
|
@Autowired
|
|
- private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
|
|
|
- @Autowired
|
|
|
|
private ExamRecordEntityConvert examRecordEntityConvert;
|
|
private ExamRecordEntityConvert examRecordEntityConvert;
|
|
@Autowired
|
|
@Autowired
|
|
private LocalCacheService localCacheService;
|
|
private LocalCacheService localCacheService;
|
|
/**
|
|
/**
|
|
- * ec_oe_exam_record_data 联合 ec_oe_exam_record 查询sql
|
|
|
|
|
|
+ * ec_oe_exam_record_data 查询sql
|
|
*/
|
|
*/
|
|
private static final String EXAM_RECORD_SQL = "select record_data.id," +
|
|
private static final String EXAM_RECORD_SQL = "select record_data.id," +
|
|
- "record_data.exam_record_id," +
|
|
|
|
"record_data.exam_record_status," +
|
|
"record_data.exam_record_status," +
|
|
"record_data.start_time," +
|
|
"record_data.start_time," +
|
|
"record_data.end_time," +
|
|
"record_data.end_time," +
|
|
@@ -130,33 +104,32 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
"record_data.baidu_face_liveness_success_percent," +
|
|
"record_data.baidu_face_liveness_success_percent," +
|
|
"record_data.creation_time," +
|
|
"record_data.creation_time," +
|
|
"record_data.update_time," +
|
|
"record_data.update_time," +
|
|
- "record.exam_id exam_id," +
|
|
|
|
- "record.exam_type exam_type," +
|
|
|
|
- "record.exam_student_id exam_student_id," +
|
|
|
|
- "record.student_id student_id," +
|
|
|
|
- "record.student_code student_code," +
|
|
|
|
- "record.student_name student_name," +
|
|
|
|
- "record.identity_number identity_number," +
|
|
|
|
- "record.course_id course_id," +
|
|
|
|
- "record.course_level course_level," +
|
|
|
|
- "record.root_org_id root_org_id," +
|
|
|
|
- "record.org_id org_id," +
|
|
|
|
- "record.base_paper_id base_paper_id," +
|
|
|
|
- "record.paper_type paper_type," +
|
|
|
|
- "record.paper_struct_id paper_struct_id," +
|
|
|
|
- "record.info_collector info_collector" +
|
|
|
|
|
|
+ "record_data.exam_id exam_id," +
|
|
|
|
+ "record_data.exam_type exam_type," +
|
|
|
|
+ "record_data.exam_student_id exam_student_id," +
|
|
|
|
+ "record_data.student_id student_id," +
|
|
|
|
+ "record_data.student_code student_code," +
|
|
|
|
+ "record_data.student_name student_name," +
|
|
|
|
+ "record_data.identity_number identity_number," +
|
|
|
|
+ "record_data.course_id course_id," +
|
|
|
|
+ "record_data.course_level course_level," +
|
|
|
|
+ "record_data.root_org_id root_org_id," +
|
|
|
|
+ "record_data.org_id org_id," +
|
|
|
|
+ "record_data.base_paper_id base_paper_id," +
|
|
|
|
+ "record_data.paper_type paper_type," +
|
|
|
|
+ "record_data.paper_struct_id paper_struct_id," +
|
|
|
|
+ "record_data.info_collector info_collector" +
|
|
" from ec_oe_exam_record_data record_data " +
|
|
" from ec_oe_exam_record_data record_data " +
|
|
- " left join ec_oe_exam_record record on record_data.exam_record_id = record.id where 1=1";
|
|
|
|
|
|
+ " where 1=1";
|
|
/**
|
|
/**
|
|
* 考生作答成绩
|
|
* 考生作答成绩
|
|
*/
|
|
*/
|
|
private static final String EXAM_STUDENT_QUESTION_SCORE_SQL = "select " +
|
|
private static final String EXAM_STUDENT_QUESTION_SCORE_SQL = "select " +
|
|
"erd.id exam_record_data_id,co.`code` course_code,co.`name` course_name, ex.`name` exam_name" +
|
|
"erd.id exam_record_data_id,co.`code` course_code,co.`name` course_name, ex.`name` exam_name" +
|
|
- ",er.student_code,er.base_paper_id " +
|
|
|
|
- "from ec_oe_exam_record er " +
|
|
|
|
- "inner join ec_oe_exam_record_data erd on er.id=erd.exam_record_id " +
|
|
|
|
- "inner join ec_b_course co on er.course_id=co.id " +
|
|
|
|
- "inner join ec_e_exam ex on er.exam_id=ex.id " +
|
|
|
|
|
|
+ ",erd.student_code,erd.base_paper_id " +
|
|
|
|
+ "from ec_oe_exam_record_data erd " +
|
|
|
|
+ "inner join ec_b_course co on erd.course_id=co.id " +
|
|
|
|
+ "inner join ec_e_exam ex on erd.exam_id=ex.id " +
|
|
"where 1=1 ";
|
|
"where 1=1 ";
|
|
@Autowired
|
|
@Autowired
|
|
private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
@@ -192,7 +165,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
sqlBuilder.append(EXAM_RECORD_SQL);
|
|
sqlBuilder.append(EXAM_RECORD_SQL);
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
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(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
- sqlBuilder.append(" order by record.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());
|
|
@@ -233,30 +206,12 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
examRecordData.setFaceVerifyResult(IsSuccess.strToEnum(rs.getString("face_verify_result")));
|
|
examRecordData.setFaceVerifyResult(IsSuccess.strToEnum(rs.getString("face_verify_result")));
|
|
examRecordData.setBaiduFaceLivenessSuccessPercent(rs.getDouble("baidu_face_liveness_success_percent"));
|
|
examRecordData.setBaiduFaceLivenessSuccessPercent(rs.getDouble("baidu_face_liveness_success_percent"));
|
|
|
|
|
|
-// ExamRecordEntity examRecord = new ExamRecordEntity();
|
|
|
|
-// examRecord.setId(rs.getLong("exam_record_id"));
|
|
|
|
-// examRecord.setExamId(rs.getLong("exam_id"));
|
|
|
|
-// examRecord.setExamType(ExamType.strToEnum(rs.getString("exam_type")));
|
|
|
|
-// examRecord.setExamStudentId(rs.getLong("exam_student_id"));
|
|
|
|
-// examRecord.setStudentId(rs.getLong("student_id"));
|
|
|
|
-// examRecord.setStudentCode(rs.getString("student_code"));
|
|
|
|
-// examRecord.setStudentName(rs.getString("student_name"));
|
|
|
|
-// examRecord.setIdentityNumber(rs.getString("identity_number"));
|
|
|
|
-// examRecord.setCourseId(rs.getLong("course_id"));
|
|
|
|
-// examRecord.setCourseLevel(rs.getString("course_level"));
|
|
|
|
-// examRecord.setRootOrgId(rs.getLong("root_org_id"));
|
|
|
|
-// examRecord.setOrgId(rs.getLong("org_id"));
|
|
|
|
-// examRecord.setBasePaperId(rs.getString("base_paper_id"));
|
|
|
|
-// examRecord.setPaperStructId(rs.getString("paper_struct_id"));
|
|
|
|
-// examRecord.setInfoCollector(rs.getString("info_collector"));
|
|
|
|
- examRecordData.setExamRecordId(rs.getLong("exam_record_id"));
|
|
|
|
-
|
|
|
|
return examRecordData;
|
|
return examRecordData;
|
|
}
|
|
}
|
|
|
|
|
|
private long countExamRecordDetailListForPage(ExamRecordQuery query) {
|
|
private long countExamRecordDetailListForPage(ExamRecordQuery query) {
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
- sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data left join ec_oe_exam_record record on record_data.exam_record_id = record.id where 1=1");
|
|
|
|
|
|
+ sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data where 1=1");
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
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(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
return jdbcTemplate.queryForObject(sqlBuilder.toString(), Long.class);
|
|
@@ -274,31 +229,31 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
sql.append(" and record_data.id = " + query.getExamRecordDataId());
|
|
sql.append(" and record_data.id = " + query.getExamRecordDataId());
|
|
}
|
|
}
|
|
if (query.getOrgId() != null) {
|
|
if (query.getOrgId() != null) {
|
|
- sql.append(" and record.org_id = " + query.getOrgId());
|
|
|
|
|
|
+ sql.append(" and record_data.org_id = " + query.getOrgId());
|
|
}
|
|
}
|
|
if (query.getExamId() != null) {
|
|
if (query.getExamId() != null) {
|
|
- sql.append(" and record.exam_id = " + query.getExamId());
|
|
|
|
|
|
+ sql.append(" and record_data.exam_id = " + query.getExamId());
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getStudentCode())) {
|
|
if (StringUtils.isNotBlank(query.getStudentCode())) {
|
|
- sql.append(" and record.student_code LIKE '%" + query.getStudentCode() + "%'");
|
|
|
|
|
|
+ sql.append(" and record_data.student_code LIKE '%" + query.getStudentCode() + "%'");
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getStudentName())) {
|
|
if (StringUtils.isNotBlank(query.getStudentName())) {
|
|
- sql.append(" and record.student_name LIKE '%" + query.getStudentName() + "%'");
|
|
|
|
|
|
+ sql.append(" and record_data.student_name LIKE '%" + query.getStudentName() + "%'");
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getIdentityNumber())) {
|
|
if (StringUtils.isNotBlank(query.getIdentityNumber())) {
|
|
- sql.append(" and record.identity_number LIKE '%" + query.getIdentityNumber() + "%'");
|
|
|
|
|
|
+ sql.append(" and record_data.identity_number LIKE '%" + query.getIdentityNumber() + "%'");
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getInfoCollector())) {
|
|
if (StringUtils.isNotBlank(query.getInfoCollector())) {
|
|
- sql.append(" and record.info_collector LIKE '%" + query.getInfoCollector() + "%'");
|
|
|
|
|
|
+ sql.append(" and record_data.info_collector LIKE '%" + query.getInfoCollector() + "%'");
|
|
}
|
|
}
|
|
if (query.getCourseId() != null) {
|
|
if (query.getCourseId() != null) {
|
|
- sql.append(" and record.course_id = " + query.getCourseId());
|
|
|
|
|
|
+ sql.append(" and record_data.course_id = " + query.getCourseId());
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getCourseLevel())) {
|
|
if (StringUtils.isNotBlank(query.getCourseLevel())) {
|
|
- sql.append(" and record.course_level = '" + query.getCourseLevel() + "'");
|
|
|
|
|
|
+ sql.append(" and record_data.course_level = '" + query.getCourseLevel() + "'");
|
|
}
|
|
}
|
|
if (query.getExamRecordId() != null) {
|
|
if (query.getExamRecordId() != null) {
|
|
- sql.append(" and record.id = " + query.getExamRecordId());
|
|
|
|
|
|
+ sql.append(" and record_data.id = " + query.getExamRecordId());
|
|
}
|
|
}
|
|
if (StringUtils.isNotBlank(query.getStartTime()) && StringUtils.isNotBlank(query.getEndTime())) {
|
|
if (StringUtils.isNotBlank(query.getStartTime()) && StringUtils.isNotBlank(query.getEndTime())) {
|
|
sql.append(" and record_data.start_time >= str_to_date('" + query.getStartTime() + "','%Y/%m/%d %H:%i:%s')"
|
|
sql.append(" and record_data.start_time >= str_to_date('" + query.getStartTime() + "','%Y/%m/%d %H:%i:%s')"
|
|
@@ -356,7 +311,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
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_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 0))");
|
|
}
|
|
}
|
|
sqlBuilder.append(" and record_data.is_illegality = 0");
|
|
sqlBuilder.append(" and record_data.is_illegality = 0");
|
|
- sqlBuilder.append(" order by record.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());
|
|
@@ -379,7 +334,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
*/
|
|
*/
|
|
private long countExamRecordListForPage(ExamRecordQuery query) {
|
|
private long countExamRecordListForPage(ExamRecordQuery query) {
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
- sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data left join ec_oe_exam_record record on record_data.exam_record_id = record.id where 1=1");
|
|
|
|
|
|
+ sqlBuilder.append("select count(record_data.id) from ec_oe_exam_record_data record_data where 1=1");
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
if (query.getIsWarn() != null) {
|
|
if (query.getIsWarn() != null) {
|
|
if (query.getIsWarn()) {
|
|
if (query.getIsWarn()) {
|
|
@@ -399,12 +354,10 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
Check.isNull(examId, "考试ID不能为空!");
|
|
Check.isNull(examId, "考试ID不能为空!");
|
|
|
|
|
|
SqlWrapper wrapper = new SqlWrapper()
|
|
SqlWrapper wrapper = new SqlWrapper()
|
|
- .select("record.exam_student_id")
|
|
|
|
- .from("ec_oe_exam_record").as("record")
|
|
|
|
- .innerJoin("ec_oe_exam_record_data").as("data")
|
|
|
|
- .on("record.id", "data.exam_record_id")
|
|
|
|
|
|
+ .select("record_data.exam_student_id")
|
|
|
|
+ .from("ec_oe_exam_record_data").as("data")
|
|
.where().eq("data.exam_record_status", ExamRecordStatus.EXAM_ING.name())
|
|
.where().eq("data.exam_record_status", ExamRecordStatus.EXAM_ING.name())
|
|
- .and().eq("record.exam_id", examId);
|
|
|
|
|
|
+ .and().eq("record_data.exam_id", examId);
|
|
|
|
|
|
Query query = entityManager.createNativeQuery(wrapper.build());
|
|
Query query = entityManager.createNativeQuery(wrapper.build());
|
|
List<BigInteger> list = query.getResultList();
|
|
List<BigInteger> list = query.getResultList();
|
|
@@ -424,25 +377,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
return examRecordDataRepo.findByExamStudentId(examStudentId);
|
|
return examRecordDataRepo.findByExamStudentId(examStudentId);
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public Long findExamRecordDataId(Long examRecordId) {
|
|
|
|
- SqlWrapper wrapper = new SqlWrapper()
|
|
|
|
- .select("exam_record_id")
|
|
|
|
- .from("ec_oe_exam_record_data")
|
|
|
|
- .where()
|
|
|
|
- .eq("exam_record_id", examRecordId);
|
|
|
|
- Query query = entityManager.createNativeQuery(wrapper.build());
|
|
|
|
- try {
|
|
|
|
- BigInteger result = (BigInteger) query.getSingleResult();
|
|
|
|
- if (result != null) {
|
|
|
|
- return result.longValue();
|
|
|
|
- }
|
|
|
|
- } catch (NoResultException e) {
|
|
|
|
- //ignore
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
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 (page == null || page.getContent() == null) {
|
|
return page;
|
|
return page;
|
|
@@ -512,7 +446,6 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
public Long existsWarnExamRecordDetail(ExamRecordQuery query) {
|
|
public Long existsWarnExamRecordDetail(ExamRecordQuery query) {
|
|
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 "
|
|
- + " left join ec_oe_exam_record record on record_data.exam_record_id = record.id "
|
|
|
|
+ " where 1=1 ");
|
|
+ " where 1=1 ");
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(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");
|
|
@@ -529,7 +462,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
sqlBuilder.append(EXAM_RECORD_SQL);
|
|
sqlBuilder.append(EXAM_RECORD_SQL);
|
|
sqlBuilder.append(buildExamRecordCommonSelectCondition(query));
|
|
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(" and ((record_data.is_warn = 0) OR (record_data.is_warn = 1 and record_data.is_audit = 1))");
|
|
- sqlBuilder.append(" order by record.id desc");
|
|
|
|
|
|
+ sqlBuilder.append(" order by record_data.id desc");
|
|
|
|
|
|
List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
|
|
List<ExamRecordDataEntity> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamRecordDataEntity>() {
|
|
@Override
|
|
@Override
|
|
@@ -608,13 +541,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
public List<ExamStudentEffectiveScoreInfo> getExamStudentEffectiveScoreList(String markingType, List<Long> examStudentIdList) {
|
|
public List<ExamStudentEffectiveScoreInfo> getExamStudentEffectiveScoreList(String markingType, List<Long> examStudentIdList) {
|
|
List<ExamStudentEffectiveScoreInfo> resultList = new ArrayList<>();
|
|
List<ExamStudentEffectiveScoreInfo> resultList = new ArrayList<>();
|
|
//考生所有的考试记录
|
|
//考生所有的考试记录
|
|
- List<ExamRecordEntity> allExamRecordList = examRecordRepo.findByExamStudentIdList(examStudentIdList);
|
|
|
|
- if (allExamRecordList==null || allExamRecordList.isEmpty()){
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- List<Long> examRecordIdList = allExamRecordList.stream().map(p -> p.getId()).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- List<ExamRecordDataEntity> allExamRecordDataList = examRecordDataRepo.findByExamRecordIdIn(examRecordIdList);
|
|
|
|
|
|
+ List<ExamRecordDataEntity> allExamRecordDataList = examRecordDataRepo.findByExamStudentIdList(examStudentIdList);
|
|
if (allExamRecordDataList==null || allExamRecordDataList.isEmpty()){
|
|
if (allExamRecordDataList==null || allExamRecordDataList.isEmpty()){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -624,14 +551,13 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
if (allExamScoreList==null || allExamScoreList.isEmpty()){
|
|
if (allExamScoreList==null || allExamScoreList.isEmpty()){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- Map<Long, List<ExamRecordEntity>> groupedByExamStudentExamRecordMap = allExamRecordList.stream().collect(Collectors.groupingBy(ExamRecordEntity::getExamStudentId));
|
|
|
|
|
|
+ Map<Long, List<ExamRecordDataEntity>> groupedByExamStudentExamRecordMap = allExamRecordDataList.stream().collect(Collectors.groupingBy(ExamRecordDataEntity::getExamStudentId));
|
|
for (Long examStudentId: groupedByExamStudentExamRecordMap.keySet()){
|
|
for (Long examStudentId: groupedByExamStudentExamRecordMap.keySet()){
|
|
//当前考生的所有考试记录集合
|
|
//当前考生的所有考试记录集合
|
|
- List<ExamRecordEntity> curExamRecordList=groupedByExamStudentExamRecordMap.get(examStudentId);
|
|
|
|
- List<Long> curExamRecordIdList=curExamRecordList.stream().map(p->p.getId()).collect(Collectors.toList());
|
|
|
|
- List<ExamRecordDataEntity> curExamRecordDataList=allExamRecordDataList.stream().
|
|
|
|
- filter(p-> curExamRecordIdList.contains(p.getExamRecordId())).collect(Collectors.toList());
|
|
|
|
- List<Long> curExamRecordDataIdList = curExamRecordDataList.stream().map(p->p.getId()).collect(Collectors.toList());
|
|
|
|
|
|
+ List<ExamRecordDataEntity> curExamRecordDataList=groupedByExamStudentExamRecordMap.get(examStudentId);
|
|
|
|
+ //当前考试记录id集合
|
|
|
|
+ List<Long> curExamRecordDataIdList=curExamRecordDataList.stream().map(p->p.getId()).collect(Collectors.toList());
|
|
|
|
+
|
|
//当前考生的所有考试成绩集合
|
|
//当前考生的所有考试成绩集合
|
|
List<ExamScoreEntity> curExamScoreList=allExamScoreList.stream().
|
|
List<ExamScoreEntity> curExamScoreList=allExamScoreList.stream().
|
|
filter(p->curExamRecordDataIdList.contains(p.getExamRecordDataId())).collect(Collectors.toList());
|
|
filter(p->curExamRecordDataIdList.contains(p.getExamRecordDataId())).collect(Collectors.toList());
|
|
@@ -641,14 +567,13 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
//最终生效的考试记录
|
|
//最终生效的考试记录
|
|
ExamRecordDataEntity effectiveExamRecordData=curExamRecordDataList.stream().
|
|
ExamRecordDataEntity effectiveExamRecordData=curExamRecordDataList.stream().
|
|
filter(p->p.getId().equals(effectiveScore.getExamRecordDataId())).collect(Collectors.toList()).get(0);
|
|
filter(p->p.getId().equals(effectiveScore.getExamRecordDataId())).collect(Collectors.toList()).get(0);
|
|
- ExamRecordEntity effectiveExamRecord = curExamRecordList.stream().
|
|
|
|
- filter(p->p.getId().equals(effectiveExamRecordData.getExamRecordId())).collect(Collectors.toList()).get(0);
|
|
|
|
|
|
+
|
|
ExamStudentEffectiveScoreInfo info = new ExamStudentEffectiveScoreInfo();
|
|
ExamStudentEffectiveScoreInfo info = new ExamStudentEffectiveScoreInfo();
|
|
info.setExamStudentId(examStudentId);
|
|
info.setExamStudentId(examStudentId);
|
|
- info.setRootOrgId(effectiveExamRecord.getRootOrgId());
|
|
|
|
- info.setOrgId(effectiveExamRecord.getOrgId());
|
|
|
|
- info.setBasePaperId(effectiveExamRecord.getBasePaperId());
|
|
|
|
- info.setCourseId(effectiveExamRecord.getCourseId());
|
|
|
|
|
|
+ info.setRootOrgId(effectiveExamRecordData.getRootOrgId());
|
|
|
|
+ info.setOrgId(effectiveExamRecordData.getOrgId());
|
|
|
|
+ info.setBasePaperId(effectiveExamRecordData.getBasePaperId());
|
|
|
|
+ info.setCourseId(effectiveExamRecordData.getCourseId());
|
|
info.setScore(effectiveScore.getTotalScore());
|
|
info.setScore(effectiveScore.getTotalScore());
|
|
info.setExamRecordDataId(effectiveExamRecordData.getId());
|
|
info.setExamRecordDataId(effectiveExamRecordData.getId());
|
|
resultList.add(info);
|
|
resultList.add(info);
|
|
@@ -712,7 +637,7 @@ public class ExamRecordServiceImpl implements ExamRecordService {
|
|
//查询条件
|
|
//查询条件
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
StringBuilder sqlBuilder = new StringBuilder();
|
|
sqlBuilder.append(EXAM_STUDENT_QUESTION_SCORE_SQL);
|
|
sqlBuilder.append(EXAM_STUDENT_QUESTION_SCORE_SQL);
|
|
- sqlBuilder.append(" and er.exam_id=" + examId);
|
|
|
|
|
|
+ sqlBuilder.append(" and erd.exam_id=" + examId);
|
|
sqlBuilder.append(" and co.`code`='" + courseCode + "'");
|
|
sqlBuilder.append(" and co.`code`='" + courseCode + "'");
|
|
List<ExamStudentQuestionScoreInfo> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamStudentQuestionScoreInfo>() {
|
|
List<ExamStudentQuestionScoreInfo> examRecordDataList = jdbcTemplate.query(sqlBuilder.toString(), new RowMapper<ExamStudentQuestionScoreInfo>() {
|
|
@Override
|
|
@Override
|