|
@@ -7,37 +7,45 @@
|
|
|
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
|
|
|
|
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticFinishedColumns;
|
|
|
|
-import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticOrgColumns;
|
|
|
|
-
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
-import java.sql.ResultSet;
|
|
|
|
-import java.sql.SQLException;
|
|
|
|
-import java.text.DecimalFormat;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Optional;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-import java.util.stream.Stream;
|
|
|
|
-
|
|
|
|
-import javax.persistence.EntityManager;
|
|
|
|
-import javax.persistence.Query;
|
|
|
|
-
|
|
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.enums.ExamSpecialSettingsType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
-import cn.com.qmth.examcloud.commons.util.DateUtil;
|
|
|
|
-import cn.com.qmth.examcloud.commons.util.RegExpUtil;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SpecUtils;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SqlWrapper;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordFileAnswerRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordForMarkingRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamStudentRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordFileAnswerEntity;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordForMarkingEntity;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FinishStatus;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.*;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.*;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.OnHandExamInfo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordFileAnswerInfo;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.*;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.cache.ExamStudentCache;
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.cache.ExamStudentCache;
|
|
|
|
+import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
|
|
+import cn.com.qmth.examcloud.examwork.api.bean.ExamSpecialSettingsBean;
|
|
|
|
+import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
|
|
import cn.com.qmth.examcloud.examwork.api.request.GetExamStudentReq;
|
|
import cn.com.qmth.examcloud.examwork.api.request.GetExamStudentReq;
|
|
|
|
+import cn.com.qmth.examcloud.examwork.api.request.GetOngoingExamListReq;
|
|
import cn.com.qmth.examcloud.examwork.api.response.GetExamStudentResp;
|
|
import cn.com.qmth.examcloud.examwork.api.response.GetExamStudentResp;
|
|
-import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.examwork.api.response.GetOngoingExamListResp;
|
|
|
|
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
|
+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.examing.ExamBoss;
|
|
import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
|
|
import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
|
|
|
|
+import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
|
|
+import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
|
|
+import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
|
|
|
|
+import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.hibernate.query.NativeQuery;
|
|
import org.hibernate.query.NativeQuery;
|
|
import org.hibernate.transform.Transformers;
|
|
import org.hibernate.transform.Transformers;
|
|
@@ -53,38 +61,17 @@ import org.springframework.jdbc.core.RowMapper;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
|
-
|
|
|
|
-import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SpecUtils;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.base.jpa.SqlWrapper;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordForMarkingRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamStudentRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordForMarkingEntity;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExamRecordStatus;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FinishStatus;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.OnHandExamInfo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.others.ExamCacheTransferHelper;
|
|
|
|
-import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
|
|
|
|
-import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
|
|
-import cn.com.qmth.examcloud.examwork.api.bean.ExamSpecialSettingsBean;
|
|
|
|
-import cn.com.qmth.examcloud.examwork.api.request.GetOngoingExamListReq;
|
|
|
|
-import cn.com.qmth.examcloud.examwork.api.response.GetOngoingExamListResp;
|
|
|
|
-import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
|
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.OrgCacheBean;
|
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
|
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamBoss;
|
|
|
|
-import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
|
|
-import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
|
|
|
|
-import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
|
|
|
+import javax.persistence.EntityManager;
|
|
|
|
+import javax.persistence.Query;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.sql.ResultSet;
|
|
|
|
+import java.sql.SQLException;
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.examwork.api.bean.ExamStudentBean;
|
|
|
|
|
|
+import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticFinishedColumns;
|
|
|
|
+import static cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentMapper.statisticOrgColumns;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 考生信息接口
|
|
* 考生信息接口
|
|
@@ -122,6 +109,8 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
ExamStudentCloudService examStudentCloudService;
|
|
ExamStudentCloudService examStudentCloudService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamRecordFileAnswerRepo examRecordFileAnswerRepo;
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
@@ -164,6 +153,8 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
entity.setGrade(cur.getGrade());
|
|
entity.setGrade(cur.getGrade());
|
|
entity.setUpdateTime(new Date());
|
|
entity.setUpdateTime(new Date());
|
|
entity.setEnable(cur.getEnable());
|
|
entity.setEnable(cur.getEnable());
|
|
|
|
+ entity.setExamStageId(cur.getExamStageId());
|
|
|
|
+ entity.setExamStageOrder(cur.getExamStageOrder());
|
|
|
|
|
|
//保存考生
|
|
//保存考生
|
|
ExamStudentEntity examStudentEntity = examStudentRepo.save(entity);
|
|
ExamStudentEntity examStudentEntity = examStudentRepo.save(entity);
|
|
@@ -217,7 +208,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
public Page<ExamStudentInfo> getExamStudentListPage(ExamStudentQuery query) {
|
|
public Page<ExamStudentInfo> getExamStudentListPage(ExamStudentQuery query) {
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
|
|
|
|
- ExamBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
|
|
|
|
|
StringBuffer sql = new StringBuffer();
|
|
StringBuffer sql = new StringBuffer();
|
|
@@ -279,7 +270,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
@Override
|
|
@Override
|
|
public List<ExamStudentInfo> getExamStudentInfoList(ExamStudentQuery query) {
|
|
public List<ExamStudentInfo> getExamStudentInfoList(ExamStudentQuery query) {
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
- ExamBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
|
//查询条件
|
|
//查询条件
|
|
StringBuffer sql = new StringBuffer();
|
|
StringBuffer sql = new StringBuffer();
|
|
@@ -334,6 +325,9 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
if (query.getExamId() != null) {
|
|
if (query.getExamId() != null) {
|
|
sql.append(" and exam_id = " + query.getExamId());
|
|
sql.append(" and exam_id = " + query.getExamId());
|
|
}
|
|
}
|
|
|
|
+ if (query.getExamStageId() != null) {
|
|
|
|
+ sql.append(" and exam_stage_id = " + query.getExamStageId());
|
|
|
|
+ }
|
|
if (StringUtils.isNotBlank(query.getStudentCode())) {
|
|
if (StringUtils.isNotBlank(query.getStudentCode())) {
|
|
sql.append(" and student_code LIKE '%" + query.getStudentCode() + "%'");
|
|
sql.append(" and student_code LIKE '%" + query.getStudentCode() + "%'");
|
|
}
|
|
}
|
|
@@ -383,7 +377,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
private ExamStudentInfo buildExamStudentInfo(ExamStudentEntity examStudentEntity, Map<String, Object> cahcheMap, String examType) {
|
|
private ExamStudentInfo buildExamStudentInfo(ExamStudentEntity examStudentEntity, Map<String, Object> cahcheMap, String examType) {
|
|
ExamStudentInfo examStudentInfo = ExamStudentEntityConvert.of(examStudentEntity);
|
|
ExamStudentInfo examStudentInfo = ExamStudentEntityConvert.of(examStudentEntity);
|
|
examStudentInfo.setExamType(examType);
|
|
examStudentInfo.setExamType(examType);
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentInfo.getCourseId());
|
|
|
|
|
|
+ CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentInfo.getCourseId());
|
|
examStudentInfo.setCourseName(courseBean.getName());
|
|
examStudentInfo.setCourseName(courseBean.getName());
|
|
examStudentInfo.setCourseCode(courseBean.getCode());
|
|
examStudentInfo.setCourseCode(courseBean.getCode());
|
|
examStudentInfo.setCourseLevel(CourseLevel.getCourseLevel(courseBean.getLevel()).getTitle());
|
|
examStudentInfo.setCourseLevel(CourseLevel.getCourseLevel(courseBean.getLevel()).getTitle());
|
|
@@ -411,18 +405,39 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
if (!examStudentEntity.getFinished()) {
|
|
if (!examStudentEntity.getFinished()) {
|
|
examStudentInfo.setFinishedStatus(FinishStatus.未抽题.name());
|
|
examStudentInfo.setFinishedStatus(FinishStatus.未抽题.name());
|
|
} else {
|
|
} else {
|
|
|
|
+ examStudentInfo.setFinishedStatus(FinishStatus.已抽题.name());
|
|
|
|
+
|
|
ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo.findTopByExamStudentId(examStudentEntity.getExamStudentId());
|
|
ExamRecordForMarkingEntity examRecordForMarking = examRecordForMarkingRepo.findTopByExamStudentId(examStudentEntity.getExamStudentId());
|
|
- if (examRecordForMarking != null && StringUtils.isNotBlank(examRecordForMarking.getOfflineFileUrl())) {
|
|
|
|
- examStudentInfo.setFinishedStatus(FinishStatus.已上传.name());
|
|
|
|
- examStudentInfo.setOfflineFileUrl(FileStorageUtil.realPath(examRecordForMarking.getOfflineFileUrl()));
|
|
|
|
- } else {
|
|
|
|
- examStudentInfo.setFinishedStatus(FinishStatus.已抽题.name());
|
|
|
|
|
|
+ if (examRecordForMarking != null) {
|
|
|
|
+ List<ExamRecordFileAnswerEntity> fileAnswerList = examRecordFileAnswerRepo.findByExamRecordDataId(examRecordForMarking.getExamRecordDataId());
|
|
|
|
+ if (null != fileAnswerList && !fileAnswerList.isEmpty()) {
|
|
|
|
+ examStudentInfo.setFinishedStatus(FinishStatus.已上传.name());
|
|
|
|
+ examStudentInfo.setOfflineFiles(getOfflineFilesFrom(fileAnswerList));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return examStudentInfo;
|
|
return examStudentInfo;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<ExamRecordFileAnswerInfo> getOfflineFilesFrom(List<ExamRecordFileAnswerEntity> fileAnswerList) {
|
|
|
|
+ List<ExamRecordFileAnswerInfo> resultList = new ArrayList<>();
|
|
|
|
+ for (ExamRecordFileAnswerEntity entity : fileAnswerList) {
|
|
|
|
+ ExamRecordFileAnswerInfo info = new ExamRecordFileAnswerInfo();
|
|
|
|
+ info.setId(entity.getId());
|
|
|
|
+ info.setExamRecordDataId(entity.getExamRecordDataId());
|
|
|
|
+ info.setOfflineFileUrl(FileStorageUtil.realPath(entity.getFileUrl()));
|
|
|
|
+ info.setOfflineFileName(entity.getFileName());
|
|
|
|
+ info.setOriginalFileName(entity.getOriginalFileName());
|
|
|
|
+ info.setFileType(entity.getFileType());
|
|
|
|
+ info.setSuffix(entity.getSuffix());
|
|
|
|
+ info.setProperties(entity.getProperties());
|
|
|
|
+ resultList.add(info);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return resultList;
|
|
|
|
+ }
|
|
|
|
+
|
|
private ExamStudentEntity getExamStudentEntityByResultSet(ResultSet rs) throws SQLException {
|
|
private ExamStudentEntity getExamStudentEntityByResultSet(ResultSet rs) throws SQLException {
|
|
ExamStudentEntity examStudentEntity = new ExamStudentEntity();
|
|
ExamStudentEntity examStudentEntity = new ExamStudentEntity();
|
|
examStudentEntity.setId(rs.getLong("id"));
|
|
examStudentEntity.setId(rs.getLong("id"));
|
|
@@ -451,7 +466,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
@Override
|
|
@Override
|
|
public Page<ExamStudentInfo> getReExamineStudentList(ExamStudentQuery query) {
|
|
public Page<ExamStudentInfo> getReExamineStudentList(ExamStudentQuery query) {
|
|
//获取考试的默认次数
|
|
//获取考试的默认次数
|
|
- ExamBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
|
//封装查询条件
|
|
//封装查询条件
|
|
Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize());
|
|
Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize());
|
|
@@ -489,6 +504,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
if (query.getOrgId() != null) {
|
|
if (query.getOrgId() != null) {
|
|
sql.append(" and t.org_id = " + query.getOrgId());
|
|
sql.append(" and t.org_id = " + query.getOrgId());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (query.getExamStageId() != null) {
|
|
|
|
+ sql.append(" and t.exam_stage_id = " + query.getExamStageId());
|
|
|
|
+ }
|
|
|
|
+
|
|
if (StringUtils.isNotBlank(query.getStudentCode())) {
|
|
if (StringUtils.isNotBlank(query.getStudentCode())) {
|
|
sql.append(" and t.student_code LIKE '%" + query.getStudentCode() + "%'");
|
|
sql.append(" and t.student_code LIKE '%" + query.getStudentCode() + "%'");
|
|
}
|
|
}
|
|
@@ -539,14 +559,14 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
OrgCacheBean orgBean = gainBaseDataService.getOrgBean(examStudentInfo.getOrgId());
|
|
OrgCacheBean orgBean = gainBaseDataService.getOrgBean(examStudentInfo.getOrgId());
|
|
examStudentInfo.setOrgName(orgBean.getName());
|
|
examStudentInfo.setOrgName(orgBean.getName());
|
|
examStudentInfo.setOrgCode(orgBean.getCode());
|
|
examStudentInfo.setOrgCode(orgBean.getCode());
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentInfo.getCourseId());
|
|
|
|
|
|
+ CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudentInfo.getCourseId());
|
|
examStudentInfo.setCourseName(courseBean.getName());
|
|
examStudentInfo.setCourseName(courseBean.getName());
|
|
list.add(examStudentInfo);
|
|
list.add(examStudentInfo);
|
|
}
|
|
}
|
|
return new PageImpl<>(list, pageable, totalSize);
|
|
return new PageImpl<>(list, pageable, totalSize);
|
|
}
|
|
}
|
|
|
|
|
|
- private Long countReExamine(ExamStudentQuery query, ExamBean examBean) {
|
|
|
|
|
|
+ private Long countReExamine(ExamStudentQuery query, ExamSettingsCacheBean examBean) {
|
|
StringBuffer sql = new StringBuffer();
|
|
StringBuffer sql = new StringBuffer();
|
|
sql.append("SELECT count(*)" +
|
|
sql.append("SELECT count(*)" +
|
|
" FROM " +
|
|
" FROM " +
|
|
@@ -582,18 +602,25 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ExamStudentFinishedStatistic getExamStudentStatisticByFinished(Long examId) {
|
|
|
|
- ExamBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
- if (ExamType.ONLINE.name().equals(examBean.getExamType()) || ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
|
|
|
|
+ public ExamStudentFinishedStatistic getExamStudentStatisticByFinished(Long examId, Long examStageId) {
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
+ if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
|
|
|
|
+ ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
ExamStudentFinishedStatistic statistic = new ExamStudentFinishedStatistic();
|
|
ExamStudentFinishedStatistic statistic = new ExamStudentFinishedStatistic();
|
|
StringBuffer totalsql = new StringBuffer();
|
|
StringBuffer totalsql = new StringBuffer();
|
|
totalsql.append("select count(t1.id) from ec_oe_exam_student t1 where 1=1 ");
|
|
totalsql.append("select count(t1.id) from ec_oe_exam_student t1 where 1=1 ");
|
|
totalsql.append(" and exam_id = " + examId);
|
|
totalsql.append(" and exam_id = " + examId);
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ totalsql.append(" and exam_stage_id = " + examStageId);
|
|
|
|
+ }
|
|
Integer total = jdbcTemplate.queryForObject(totalsql.toString(), Integer.class);
|
|
Integer total = jdbcTemplate.queryForObject(totalsql.toString(), Integer.class);
|
|
|
|
|
|
StringBuffer finishsql = new StringBuffer();
|
|
StringBuffer finishsql = new StringBuffer();
|
|
finishsql.append("select count(t1.id) from ec_oe_exam_student t1 where 1=1 ");
|
|
finishsql.append("select count(t1.id) from ec_oe_exam_student t1 where 1=1 ");
|
|
finishsql.append(" and exam_id = " + examId);
|
|
finishsql.append(" and exam_id = " + examId);
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ finishsql.append(" and exam_stage_id = " + examStageId);
|
|
|
|
+ }
|
|
finishsql.append(" AND ( finished = 1 OR t1.exam_student_id in ( SELECT t2.exam_student_id FROM ec_oes_exam_record_data t2 WHERE t2.exam_id=" + examId + " ) )");
|
|
finishsql.append(" AND ( finished = 1 OR t1.exam_student_id in ( SELECT t2.exam_student_id FROM ec_oes_exam_record_data t2 WHERE t2.exam_id=" + examId + " ) )");
|
|
Integer finish = jdbcTemplate.queryForObject(finishsql.toString(), Integer.class);
|
|
Integer finish = jdbcTemplate.queryForObject(finishsql.toString(), Integer.class);
|
|
statistic.setFinished(finish);
|
|
statistic.setFinished(finish);
|
|
@@ -604,6 +631,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
.select(statisticFinishedColumns())
|
|
.select(statisticFinishedColumns())
|
|
.from("ec_oe_exam_student").as("student")
|
|
.from("ec_oe_exam_student").as("student")
|
|
.where().eq("student.exam_id", examId);
|
|
.where().eq("student.exam_id", examId);
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ wrapper.and().eq("student.exam_stage_id", examStageId);
|
|
|
|
+ }
|
|
|
|
+
|
|
Query dataQuery = entityManager.createNativeQuery(wrapper.build());
|
|
Query dataQuery = entityManager.createNativeQuery(wrapper.build());
|
|
dataQuery.unwrap(NativeQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
|
|
dataQuery.unwrap(NativeQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
|
|
Map<String, BigDecimal> map = (HashMap) dataQuery.getSingleResult();
|
|
Map<String, BigDecimal> map = (HashMap) dataQuery.getSingleResult();
|
|
@@ -625,12 +656,16 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(Long examId, Long orgId) {
|
|
|
|
- ExamBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
- if (ExamType.ONLINE.name().equals(examBean.getExamType()) || ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
|
|
|
|
+ public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(Long examId, Long examStageId, Long orgId) {
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
+ if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
|
|
|
|
+ ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
StringBuffer totalsql = new StringBuffer();
|
|
StringBuffer totalsql = new StringBuffer();
|
|
totalsql.append("select t1.org_id orgId,count(t1.id) totalCount from ec_oe_exam_student t1 where 1=1 ");
|
|
totalsql.append("select t1.org_id orgId,count(t1.id) totalCount from ec_oe_exam_student t1 where 1=1 ");
|
|
totalsql.append(" and exam_id = " + examId);
|
|
totalsql.append(" and exam_id = " + examId);
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ totalsql.append(" and exam_stage_id = " + examStageId);
|
|
|
|
+ }
|
|
if (orgId != null) {
|
|
if (orgId != null) {
|
|
totalsql.append(" and org_id = " + orgId);
|
|
totalsql.append(" and org_id = " + orgId);
|
|
}
|
|
}
|
|
@@ -640,6 +675,9 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
StringBuffer finishsql = new StringBuffer();
|
|
StringBuffer finishsql = new StringBuffer();
|
|
finishsql.append("select t1.org_id orgId,count(t1.id) finishedCount from ec_oe_exam_student t1 where 1=1 ");
|
|
finishsql.append("select t1.org_id orgId,count(t1.id) finishedCount from ec_oe_exam_student t1 where 1=1 ");
|
|
finishsql.append(" and exam_id = " + examId);
|
|
finishsql.append(" and exam_id = " + examId);
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ finishsql.append(" and exam_stage_id = " + examStageId);
|
|
|
|
+ }
|
|
if (orgId != null) {
|
|
if (orgId != null) {
|
|
finishsql.append(" and org_id = " + orgId);
|
|
finishsql.append(" and org_id = " + orgId);
|
|
}
|
|
}
|
|
@@ -669,6 +707,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
.select(statisticOrgColumns())
|
|
.select(statisticOrgColumns())
|
|
.from("ec_oe_exam_student").as("student")
|
|
.from("ec_oe_exam_student").as("student")
|
|
.where().eq("student.exam_id", examId);
|
|
.where().eq("student.exam_id", examId);
|
|
|
|
+
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ wrapper.and().eq("student.exam_stage_id", examStageId);
|
|
|
|
+ }
|
|
if (orgId != null) {
|
|
if (orgId != null) {
|
|
wrapper.and().eq("student.org_id", orgId);
|
|
wrapper.and().eq("student.org_id", orgId);
|
|
}
|
|
}
|
|
@@ -693,8 +735,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Long> findCoursesFromExamStudent(Long examId, Long orgId) {
|
|
|
|
|
|
+ public List<Long> findCoursesFromExamStudent(Long examId, Long examStageId, Long orgId) {
|
|
String sql = "select course_id from ec_oe_exam_student where exam_id = " + examId;
|
|
String sql = "select course_id from ec_oe_exam_student where exam_id = " + examId;
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ sql += " and exam_stage_id= " + examStageId;
|
|
|
|
+ }
|
|
if (orgId != null) {
|
|
if (orgId != null) {
|
|
sql += " and org_id = " + orgId;
|
|
sql += " and org_id = " + orgId;
|
|
}
|
|
}
|
|
@@ -743,15 +788,21 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<CourseProgressInfo> queryCourseProgressInfos(Long examId, Long courseId, String orderColumn) {
|
|
|
|
|
|
+ public List<CourseProgressInfo> queryCourseProgressInfos(Long examId, Long examStageId,
|
|
|
|
+ Long courseId, String orderColumn) {
|
|
if (examId == null) {
|
|
if (examId == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- ExamBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
- if (ExamType.ONLINE.name().equals(examBean.getExamType()) || ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
|
+ if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
|
|
|
|
+ ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
StringBuffer totalsql = new StringBuffer();
|
|
StringBuffer totalsql = new StringBuffer();
|
|
totalsql.append("select t1.course_id courseId,count(t1.id) allNum from ec_oe_exam_student t1 where 1=1 ");
|
|
totalsql.append("select t1.course_id courseId,count(t1.id) allNum from ec_oe_exam_student t1 where 1=1 ");
|
|
totalsql.append(" and exam_id = " + examId);
|
|
totalsql.append(" and exam_id = " + examId);
|
|
|
|
+
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ totalsql.append(" and exam_stage_id = " + examStageId);
|
|
|
|
+ }
|
|
if (courseId != null) {
|
|
if (courseId != null) {
|
|
totalsql.append(" and course_id = " + courseId);
|
|
totalsql.append(" and course_id = " + courseId);
|
|
}
|
|
}
|
|
@@ -761,6 +812,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
StringBuffer finishsql = new StringBuffer();
|
|
StringBuffer finishsql = new StringBuffer();
|
|
finishsql.append("select t1.course_id courseId,count(t1.id) completedNum from ec_oe_exam_student t1 where 1=1 ");
|
|
finishsql.append("select t1.course_id courseId,count(t1.id) completedNum from ec_oe_exam_student t1 where 1=1 ");
|
|
finishsql.append(" and exam_id = " + examId);
|
|
finishsql.append(" and exam_id = " + examId);
|
|
|
|
+
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ finishsql.append(" and exam_stage_id = " + examStageId);
|
|
|
|
+ }
|
|
if (courseId != null) {
|
|
if (courseId != null) {
|
|
finishsql.append(" and course_id = " + courseId);
|
|
finishsql.append(" and course_id = " + courseId);
|
|
}
|
|
}
|
|
@@ -796,6 +851,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
" count(course_id) all_num" +
|
|
" count(course_id) all_num" +
|
|
" from ec_oe_exam_student " +
|
|
" from ec_oe_exam_student " +
|
|
" where exam_id = " + examId;
|
|
" where exam_id = " + examId;
|
|
|
|
+
|
|
|
|
+ if (null != examStageId) {
|
|
|
|
+ sql += " and exam_stage_id = " + examStageId;
|
|
|
|
+ }
|
|
if (courseId != null) {
|
|
if (courseId != null) {
|
|
sql += " and course_id = " + courseId;
|
|
sql += " and course_id = " + courseId;
|
|
}
|
|
}
|
|
@@ -864,7 +923,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
getOngoingExamListReq.setStudentId(studentId);
|
|
getOngoingExamListReq.setStudentId(studentId);
|
|
GetOngoingExamListResp getOngoingExamListResp = examCloudService.getOngoingExamList(getOngoingExamListReq);
|
|
GetOngoingExamListResp getOngoingExamListResp = examCloudService.getOngoingExamList(getOngoingExamListReq);
|
|
|
|
|
|
- //获取学生所在组织机构的所有考试列表集合(虽然名字起的特殊考试设置,事实上取的就是实际的可考的考试列表,可能是考试中心特殊设置的考试时间,也可能不是)
|
|
|
|
|
|
+ //获取学生所在组织机构的所有考试列表集合
|
|
List<ExamSpecialSettingsBean> examSpecialSettingsBeanList = getOngoingExamListResp.getExamSpecialSettingsList();
|
|
List<ExamSpecialSettingsBean> examSpecialSettingsBeanList = getOngoingExamListResp.getExamSpecialSettingsList();
|
|
if (examSpecialSettingsBeanList == null || examSpecialSettingsBeanList.size() == 0) {
|
|
if (examSpecialSettingsBeanList == null || examSpecialSettingsBeanList.size() == 0) {
|
|
return null;
|
|
return null;
|
|
@@ -872,46 +931,43 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
List<Long> examIds = examSpecialSettingsBeanList.stream().map(ExamSpecialSettingsBean::getExamId).collect(Collectors.toList());
|
|
List<Long> examIds = examSpecialSettingsBeanList.stream().map(ExamSpecialSettingsBean::getExamId).collect(Collectors.toList());
|
|
|
|
|
|
//只查没有禁用的考生
|
|
//只查没有禁用的考生
|
|
- List<ExamStudentEntity> examStudents = examStudentRepo.findByStudentIdAndEnableAndExamIdIn(studentId, true, examIds);
|
|
|
|
|
|
+ List<ExamStudentEntity> examStudents =
|
|
|
|
+ examStudentRepo.findByStudentIdAndEnableAndExamIdIn(studentId, true, examIds);
|
|
|
|
+
|
|
List<OnHandExamInfo> examStudentDtoList = new ArrayList<OnHandExamInfo>();
|
|
List<OnHandExamInfo> examStudentDtoList = new ArrayList<OnHandExamInfo>();
|
|
|
|
+ Date now = new Date();
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
- Stream<ExamSpecialSettingsBean> examSpecialSettingsBeanStream = examSpecialSettingsBeanList.stream().filter(examSpecialSettingsBean -> {
|
|
|
|
- return examSpecialSettingsBean.getExamId().longValue() == examStudent.getExamId().longValue();
|
|
|
|
- });
|
|
|
|
- if (examSpecialSettingsBeanStream != null) {
|
|
|
|
- ExamSpecialSettingsBean examSpecialSettingsBean = examSpecialSettingsBeanStream.findFirst().get();
|
|
|
|
- examStudentDtoList.add(assemblingExamStudentDto(examStudent, examSpecialSettingsBean));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //针对指定机构进行学生特殊设置进行校验,FIXME 临时代码
|
|
|
|
- SysPropertyCacheBean specialStudentProperty = CacheHelper.getSysProperty("studentSpecialExamTime.enabledRootOrgIds");
|
|
|
|
- if (specialStudentProperty.getHasValue()) {
|
|
|
|
- List<String> orgIdList = RegExpUtil.findAll(specialStudentProperty.getValue().toString(), "\\d+");
|
|
|
|
- if (orgIdList.contains(String.valueOf(studentBean.getRootOrgId()))) {
|
|
|
|
- for (OnHandExamInfo info : examStudentDtoList) {
|
|
|
|
- //如果考生特殊设置过开考时间,需要判断考生是否在考试时间内
|
|
|
|
- ExamStudentBean remoteExamStudent = getRemoteExamStudent(studentBean.getRootOrgId(), info.getExamStudentId());
|
|
|
|
- String strStartTime = remoteExamStudent.getExt4();
|
|
|
|
- String strEndTime = remoteExamStudent.getExt5();
|
|
|
|
-
|
|
|
|
- Date specialStartTime = StringUtils.isBlank(strStartTime) ? null :
|
|
|
|
- DateUtil.parse(strStartTime, DateUtil.DatePatterns.CHINA_DEFAULT);
|
|
|
|
- Date specialEndTime = StringUtils.isBlank(strEndTime) ? null :
|
|
|
|
- DateUtil.parse(strEndTime, DateUtil.DatePatterns.CHINA_DEFAULT);
|
|
|
|
- if (null != specialStartTime && null != specialEndTime) {
|
|
|
|
- info.setStartTime(specialStartTime);
|
|
|
|
- info.setEndTime(specialEndTime);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ assemblingExamStudentDto(examStudent, now, examStudentDtoList);
|
|
}
|
|
}
|
|
|
|
|
|
return examStudentDtoList;
|
|
return examStudentDtoList;
|
|
}
|
|
}
|
|
|
|
|
|
- private OnHandExamInfo assemblingExamStudentDto(ExamStudentEntity examStudent, ExamSpecialSettingsBean examSpecialSettingsBean) {
|
|
|
|
|
|
+ private void assemblingExamStudentDto(ExamStudentEntity examStudent, Date now, final List<OnHandExamInfo> resultList) {
|
|
|
|
+ Long examId = examStudent.getExamId();
|
|
|
|
+ Long studentId = examStudent.getStudentId();
|
|
|
|
+ Long examStageId = examStudent.getExamStageId();
|
|
|
|
+
|
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getCachedExam(examId, studentId, examStageId);
|
|
|
|
+ if (examBean.getSpecialSettingsEnabled() && examStageId != null
|
|
|
|
+ && ExamSpecialSettingsType.STAGE_BASED == examBean.getSpecialSettingsType()) {
|
|
|
|
+ ExamStageCacheBean examStage = CacheHelper.getExamStage(examId, examStageId);
|
|
|
|
+
|
|
|
|
+ //场次如果禁用,该场次不允许考试
|
|
|
|
+ if (examStage.getHasValue() && !examStage.getEnable()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //如果当前时间超过场次结束时间,不允许考试
|
|
|
|
+ if (now.after(examBean.getEndTime())) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
OnHandExamInfo examStudentInfo = new OnHandExamInfo();
|
|
OnHandExamInfo examStudentInfo = new OnHandExamInfo();
|
|
|
|
+ resultList.add(examStudentInfo);
|
|
|
|
+
|
|
examStudentInfo.setExamStudentId(examStudent.getExamStudentId());
|
|
examStudentInfo.setExamStudentId(examStudent.getExamStudentId());
|
|
examStudentInfo.setStudentCode(examStudent.getStudentCode());
|
|
examStudentInfo.setStudentCode(examStudent.getStudentCode());
|
|
examStudentInfo.setStudentName(examStudent.getStudentName());
|
|
examStudentInfo.setStudentName(examStudent.getStudentName());
|
|
@@ -919,7 +975,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
examStudentInfo.setRootOrgId(rootOrgId);
|
|
examStudentInfo.setRootOrgId(rootOrgId);
|
|
examStudentInfo.setIdentityNumber(examStudent.getIdentityNumber());
|
|
examStudentInfo.setIdentityNumber(examStudent.getIdentityNumber());
|
|
|
|
|
|
- CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudent.getCourseId());
|
|
|
|
|
|
+ CourseCacheBean courseBean = ExamCacheTransferHelper.getCachedCourse(examStudent.getCourseId());
|
|
examStudentInfo.setCourseName(courseBean.getName());
|
|
examStudentInfo.setCourseName(courseBean.getName());
|
|
examStudentInfo.setCourseCode(courseBean.getCode());
|
|
examStudentInfo.setCourseCode(courseBean.getCode());
|
|
examStudentInfo.setCourseLevel(CourseLevel.getCourseLevel(courseBean.getLevel()).getTitle());
|
|
examStudentInfo.setCourseLevel(CourseLevel.getCourseLevel(courseBean.getLevel()).getTitle());
|
|
@@ -929,16 +985,12 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
examStudentInfo.setOrgId(orgId);
|
|
examStudentInfo.setOrgId(orgId);
|
|
|
|
|
|
OrgCacheBean orgBean = gainBaseDataService.getOrgBean(orgId);
|
|
OrgCacheBean orgBean = gainBaseDataService.getOrgBean(orgId);
|
|
- Long studentId = examStudent.getStudentId();
|
|
|
|
- ExamBean examBean = ExamCacheTransferHelper.getCachedExam(examStudent.getExamId(),
|
|
|
|
- studentId);
|
|
|
|
|
|
|
|
examStudentInfo.setOrgName(orgBean.getName());
|
|
examStudentInfo.setOrgName(orgBean.getName());
|
|
- Long examId = examBean.getId();
|
|
|
|
examStudentInfo.setExamId(examId);
|
|
examStudentInfo.setExamId(examId);
|
|
examStudentInfo.setExamName(examBean.getName());
|
|
examStudentInfo.setExamName(examBean.getName());
|
|
- examStudentInfo.setStartTime(examSpecialSettingsBean.getBeginTime());//考试开始时间设置
|
|
|
|
- examStudentInfo.setEndTime(examSpecialSettingsBean.getEndTime());//考试结束时间设置
|
|
|
|
|
|
+ examStudentInfo.setStartTime(examBean.getBeginTime());//考试开始时间设置
|
|
|
|
+ examStudentInfo.setEndTime(examBean.getEndTime());//考试结束时间设置
|
|
examStudentInfo.setAllowExamCount(countExamTimes(examStudent, examBean));
|
|
examStudentInfo.setAllowExamCount(countExamTimes(examStudent, examBean));
|
|
examStudentInfo.setPaperMins(examBean.getDuration());
|
|
examStudentInfo.setPaperMins(examBean.getDuration());
|
|
//是否启用人脸识别
|
|
//是否启用人脸识别
|
|
@@ -964,10 +1016,9 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
examStudentInfo.setAppExamEnabled(Boolean.valueOf(appExamEnabled));
|
|
examStudentInfo.setAppExamEnabled(Boolean.valueOf(appExamEnabled));
|
|
}
|
|
}
|
|
|
|
|
|
- return examStudentInfo;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private Integer countExamTimes(ExamStudentEntity examStudentInfo, ExamBean examBean) {
|
|
|
|
|
|
+ private Integer countExamTimes(ExamStudentEntity examStudentInfo, ExamSettingsCacheBean examBean) {
|
|
if (ExamType.OFFLINE.name().equals(examBean.getExamType())) {
|
|
if (ExamType.OFFLINE.name().equals(examBean.getExamType())) {
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|