|
@@ -7,44 +7,6 @@
|
|
|
|
|
|
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.Calendar;
|
|
|
-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 javax.persistence.EntityManager;
|
|
|
-import javax.persistence.Query;
|
|
|
-
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.hibernate.query.NativeQuery;
|
|
|
-import org.hibernate.transform.Transformers;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageImpl;
|
|
|
-import org.springframework.data.domain.Pageable;
|
|
|
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
-import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
-import org.springframework.jdbc.core.RowMapper;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.google.common.collect.Lists;
|
|
|
-
|
|
|
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.security.bean.UserDataRule;
|
|
@@ -69,21 +31,11 @@ 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.ExamRecordService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentFinalScoreService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.GainBaseDataService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.LocalCacheService;
|
|
|
+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.UserDataRules;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examrecord.ExamRecordFileAnswerInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.CourseProgressInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentEntityConvert;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentFinishedStatistic;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentOrgStatistic;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentPartInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentQuery;
|
|
|
+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.examwork.api.ExamCloudService;
|
|
|
import cn.com.qmth.examcloud.examwork.api.ExamStudentCloudService;
|
|
@@ -91,12 +43,7 @@ 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.CourseCacheBean;
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
|
|
|
-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.examing.ExamBoss;
|
|
|
import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
|
|
@@ -104,6 +51,35 @@ 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.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.hibernate.query.NativeQuery;
|
|
|
+import org.hibernate.transform.Transformers;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.*;
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.core.RowMapper;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import javax.persistence.EntityManager;
|
|
|
+import javax.persistence.Query;
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
|
+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 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;
|
|
|
|
|
|
/**
|
|
|
* 考生信息接口
|
|
@@ -254,10 +230,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<ExamStudentInfo> getExamStudentListPage(UserDataRules uds,ExamStudentQuery query) {
|
|
|
- if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
- return Page.empty();
|
|
|
- }
|
|
|
+ public Page<ExamStudentInfo> getExamStudentListPage(UserDataRules uds, ExamStudentQuery query) {
|
|
|
+ if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
+ return Page.empty();
|
|
|
+ }
|
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
|
|
|
|
ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
@@ -274,7 +250,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
sql.append(",student_id,student_code,student_name,identity_number"
|
|
|
+ ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
|
|
|
+ ",specialty_code,specialty_name,grade,t1.exam_stage_id from ec_oe_exam_student t1 where 1=1 ");
|
|
|
- sql.append(selectExamStudentConfitionSql(uds,query, examBean.getExamType()));
|
|
|
+ sql.append(selectExamStudentConfitionSql(uds, query, examBean.getExamType()));
|
|
|
sql.append(" order by id desc");
|
|
|
int currentNum = (query.getPageNo() - 1) * query.getPageSize();
|
|
|
sql.append(" limit " + currentNum + "," + query.getPageSize());
|
|
@@ -307,35 +283,35 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
cahcheMap.clear();
|
|
|
Pageable pageable = SpecUtils.buildPageable(query.getPageNo(), query.getPageSize());
|
|
|
- long totalSize = countExamStudent(uds,query, examBean.getExamType());
|
|
|
+ long totalSize = countExamStudent(uds, query, examBean.getExamType());
|
|
|
fillStage(examStudentInfoList);
|
|
|
return new PageImpl<>(examStudentInfoList, pageable, totalSize);
|
|
|
}
|
|
|
|
|
|
private void fillStage(List<ExamStudentInfo> list) {
|
|
|
- if(CollectionUtils.isEmpty(list)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- for(ExamStudentInfo info:list) {
|
|
|
- if(info.getExamStageId()!=null) {
|
|
|
- ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
|
|
|
- info.setExamStageOrder(stage.getStageOrder());
|
|
|
- info.setStartTime(stage.getStartTime());
|
|
|
- info.setEndTime(stage.getEndTime());
|
|
|
- }
|
|
|
- }
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (ExamStudentInfo info : list) {
|
|
|
+ if (info.getExamStageId() != null) {
|
|
|
+ ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
|
|
|
+ info.setExamStageOrder(stage.getStageOrder());
|
|
|
+ info.setStartTime(stage.getStartTime());
|
|
|
+ info.setEndTime(stage.getEndTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private long countExamStudent(UserDataRules uds,ExamStudentQuery query, String examType) {
|
|
|
+ private long countExamStudent(UserDataRules uds, ExamStudentQuery query, String examType) {
|
|
|
//查询条件
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append("select count(t1.id) from ec_oe_exam_student t1 where 1=1 ");
|
|
|
- sql.append(selectExamStudentConfitionSql(uds,query, examType));
|
|
|
+ sql.append(selectExamStudentConfitionSql(uds, query, examType));
|
|
|
return jdbcTemplate.queryForObject(sql.toString(), Long.class);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ExamStudentInfo> getExamStudentInfoListForAsync(UserDataRules uds,ExamStudentQuery query) {
|
|
|
+ public List<ExamStudentInfo> getExamStudentInfoListForAsync(UserDataRules uds, ExamStudentQuery query) {
|
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
|
ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
@@ -343,7 +319,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
int pageNo = 1;
|
|
|
int pageSize = 200;
|
|
|
for (; ; ) {
|
|
|
- List<ExamStudentEntity> tem = getExamStudentInfoListByPage(uds,query, examBean, pageNo, pageSize);
|
|
|
+ List<ExamStudentEntity> tem = getExamStudentInfoListByPage(uds, query, examBean, pageNo, pageSize);
|
|
|
if (tem == null || tem.size() == 0) {
|
|
|
break;
|
|
|
} else {
|
|
@@ -430,7 +406,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
tool.setDataForBatch(dataList, 100);
|
|
|
}
|
|
|
|
|
|
- private List<ExamStudentEntity> getExamStudentInfoListByPage(UserDataRules uds,ExamStudentQuery query, ExamSettingsCacheBean examBean, int pageNo, int pageSize) {
|
|
|
+ private List<ExamStudentEntity> getExamStudentInfoListByPage(UserDataRules uds, ExamStudentQuery query, ExamSettingsCacheBean examBean, int pageNo, int pageSize) {
|
|
|
//查询条件
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append("select id,exam_student_id,exam_id,course_id,course_code,course_level");
|
|
@@ -443,7 +419,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
sql.append(",student_id,student_code,student_name,identity_number"
|
|
|
+ ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
|
|
|
+ ",specialty_code,specialty_name,grade,exam_stage_id from ec_oe_exam_student t1 where 1=1 ");
|
|
|
- sql.append(selectExamStudentConfitionSql(uds,query, examBean.getExamType()));
|
|
|
+ sql.append(selectExamStudentConfitionSql(uds, query, examBean.getExamType()));
|
|
|
int currentNum = (pageNo - 1) * pageSize;
|
|
|
sql.append(" order by id limit " + currentNum + "," + pageSize);
|
|
|
|
|
@@ -458,10 +434,10 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<ExamStudentInfo> getExamStudentInfoList(UserDataRules uds,ExamStudentQuery query) {
|
|
|
- if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
- return Lists.newArrayList();
|
|
|
- }
|
|
|
+ public List<ExamStudentInfo> getExamStudentInfoList(UserDataRules uds, ExamStudentQuery query) {
|
|
|
+ if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
Check.isNull(query, "查询参数不能为空!");
|
|
|
ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
@@ -477,7 +453,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
sql.append(",student_id,student_code,student_name,identity_number"
|
|
|
+ ",info_collector,root_org_id,org_id,paper_type,used_num,extra_num"
|
|
|
+ ",specialty_code,specialty_name,grade,t1.exam_stage_id from ec_oe_exam_student t1 where 1=1 ");
|
|
|
- sql.append(selectExamStudentConfitionSql(uds,query, examBean.getExamType()));
|
|
|
+ sql.append(selectExamStudentConfitionSql(uds, query, examBean.getExamType()));
|
|
|
sql.append(" order by id desc");
|
|
|
|
|
|
List<ExamStudentEntity> examStudentList = jdbcTemplate.query(sql.toString(), new RowMapper<ExamStudentEntity>() {
|
|
@@ -511,7 +487,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
return examStudentInfoList;
|
|
|
}
|
|
|
|
|
|
- private StringBuffer selectExamStudentConfitionSql(UserDataRules uds,ExamStudentQuery query, String examType) {
|
|
|
+ private StringBuffer selectExamStudentConfitionSql(UserDataRules uds, ExamStudentQuery query, String examType) {
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
if (query.getOrgId() != null) {
|
|
|
sql.append(" and org_id=" + query.getOrgId());
|
|
@@ -565,11 +541,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if(uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
- sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
|
|
|
+ if (uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
+ sql.append(" and org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
|
|
|
}
|
|
|
- if(uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
- sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
|
|
|
+ if (uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
+ sql.append(" and course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
|
|
|
}
|
|
|
return sql;
|
|
|
}
|
|
@@ -672,18 +648,18 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
examStudentEntity.setSpecialtyCode(rs.getString("specialty_code"));
|
|
|
examStudentEntity.setSpecialtyName(rs.getString("specialty_name"));
|
|
|
examStudentEntity.setGrade(rs.getString("grade"));
|
|
|
- if(rs.getString("exam_stage_id")!=null) {
|
|
|
- examStudentEntity.setExamStageId(rs.getLong("exam_stage_id"));
|
|
|
+ if (rs.getString("exam_stage_id") != null) {
|
|
|
+ examStudentEntity.setExamStageId(rs.getLong("exam_stage_id"));
|
|
|
}
|
|
|
|
|
|
return examStudentEntity;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<ExamStudentInfo> getReExamineStudentList(UserDataRules uds,ExamStudentQuery query) {
|
|
|
- if(uds.getCourseRule().assertEmptyQueryResult()||uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
- return Page.empty();
|
|
|
- }
|
|
|
+ public Page<ExamStudentInfo> getReExamineStudentList(UserDataRules uds, ExamStudentQuery query) {
|
|
|
+ if (uds.getCourseRule().assertEmptyQueryResult() || uds.getOrgRule().assertEmptyQueryResult()) {
|
|
|
+ return Page.empty();
|
|
|
+ }
|
|
|
//获取考试的默认次数
|
|
|
ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(query.getExamId());
|
|
|
|
|
@@ -743,11 +719,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
if (StringUtils.isNotBlank(query.getCourseLevel())) {
|
|
|
sql.append(" and t.course_level= '" + query.getCourseLevel() + "'");
|
|
|
}
|
|
|
- if(uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
- sql.append(" and t.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
|
|
|
+ if (uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
+ sql.append(" and t.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
|
|
|
}
|
|
|
- if(uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
- sql.append(" and t.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
|
|
|
+ if (uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
+ sql.append(" and t.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
|
|
|
}
|
|
|
int currentNum = (query.getPageNo() - 1) * query.getPageSize();
|
|
|
sql.append(" limit " + currentNum + "," + query.getPageSize());
|
|
@@ -776,7 +752,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
return examStudentEntity;
|
|
|
}
|
|
|
});
|
|
|
- long totalSize = countReExamine(uds,query, examBean);
|
|
|
+ long totalSize = countReExamine(uds, query, examBean);
|
|
|
List<ExamStudentInfo> list = new ArrayList<ExamStudentInfo>();
|
|
|
for (ExamStudentEntity examStudentEntity : examStudentList) {
|
|
|
ExamStudentInfo examStudentInfo = ExamStudentEntityConvert.of(examStudentEntity);
|
|
@@ -790,7 +766,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
return new PageImpl<>(list, pageable, totalSize);
|
|
|
}
|
|
|
|
|
|
- private Long countReExamine(UserDataRules uds,ExamStudentQuery query, ExamSettingsCacheBean examBean) {
|
|
|
+ private Long countReExamine(UserDataRules uds, ExamStudentQuery query, ExamSettingsCacheBean examBean) {
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
sql.append("SELECT count(*)" +
|
|
|
" FROM " +
|
|
@@ -822,17 +798,17 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
if (StringUtils.isNotBlank(query.getCourseLevel())) {
|
|
|
sql.append(" and student.course_level= '" + query.getCourseLevel() + "'");
|
|
|
}
|
|
|
- if(uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
- sql.append(" and student.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",")+") ");
|
|
|
+ if (uds.getOrgRule().assertNeedQueryRefIds()) {
|
|
|
+ sql.append(" and student.org_id in (" + StringUtils.join(uds.getOrgRule().getRefIds(), ",") + ") ");
|
|
|
}
|
|
|
- if(uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
- sql.append(" and student.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",")+") ");
|
|
|
+ if (uds.getCourseRule().assertNeedQueryRefIds()) {
|
|
|
+ sql.append(" and student.course_id in (" + StringUtils.join(uds.getCourseRule().getRefIds(), ",") + ") ");
|
|
|
}
|
|
|
return jdbcTemplate.queryForObject(sql.toString(), Long.class);
|
|
|
}
|
|
|
|
|
|
- @SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
|
|
|
- @Override
|
|
|
+ @SuppressWarnings({"deprecation", "unchecked", "rawtypes"})
|
|
|
+ @Override
|
|
|
public ExamStudentFinishedStatistic getExamStudentStatisticByFinished(Long examId, Long examStageId) {
|
|
|
ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
|
|
@@ -886,13 +862,13 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @SuppressWarnings({ "deprecation", "unchecked", "unused" })
|
|
|
- @Override
|
|
|
- public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(UserDataRule ud,Long examId, Long examStageId, Long orgId) {
|
|
|
- if(ud.assertEmptyQueryResult()) {
|
|
|
- return Lists.newArrayList();
|
|
|
- }
|
|
|
- ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
+ @SuppressWarnings({"deprecation", "unchecked", "unused"})
|
|
|
+ @Override
|
|
|
+ public List<ExamStudentOrgStatistic> getExamStudentStatisticByOrg(UserDataRule ud, Long examId, Long examStageId, Long orgId) {
|
|
|
+ if (ud.assertEmptyQueryResult()) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+ ExamSettingsCacheBean examBean = ExamCacheTransferHelper.getDefaultCachedExam(examId);
|
|
|
if (ExamType.ONLINE.name().equals(examBean.getExamType()) ||
|
|
|
ExamType.ONLINE_HOMEWORK.name().equals(examBean.getExamType())) {
|
|
|
StringBuffer totalsql = new StringBuffer();
|
|
@@ -936,11 +912,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
statistic.setFinishedPercent(new DecimalFormat("#.00").format(percent * 100));
|
|
|
}
|
|
|
}
|
|
|
- List<ExamStudentOrgStatistic> ret=Lists.newArrayList();
|
|
|
+ List<ExamStudentOrgStatistic> ret = Lists.newArrayList();
|
|
|
for (ExamStudentOrgStatistic statistic : totalList) {
|
|
|
- if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getOrgId())) {
|
|
|
- ret.add(statistic);
|
|
|
- }
|
|
|
+ if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getOrgId())) {
|
|
|
+ ret.add(statistic);
|
|
|
+ }
|
|
|
}
|
|
|
return ret;
|
|
|
} else {
|
|
@@ -965,11 +941,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
statistic.setOrgCode(orgBean.getCode());
|
|
|
statistic.setOrgName(orgBean.getName());
|
|
|
}
|
|
|
- List<ExamStudentOrgStatistic> ret=Lists.newArrayList();
|
|
|
+ List<ExamStudentOrgStatistic> ret = Lists.newArrayList();
|
|
|
for (ExamStudentOrgStatistic statistic : examStudentOrgStatisticList) {
|
|
|
- if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getOrgId())) {
|
|
|
- ret.add(statistic);
|
|
|
- }
|
|
|
+ if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getOrgId())) {
|
|
|
+ ret.add(statistic);
|
|
|
+ }
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
@@ -1046,11 +1022,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<CourseProgressInfo> queryCourseProgressInfos(UserDataRule ud,Long examId, Long examStageId,
|
|
|
+ public List<CourseProgressInfo> queryCourseProgressInfos(UserDataRule ud, Long examId, Long examStageId,
|
|
|
Long courseId, String orderColumn) {
|
|
|
- if(ud.assertEmptyQueryResult()) {
|
|
|
- return Lists.newArrayList();
|
|
|
- }
|
|
|
+ if (ud.assertEmptyQueryResult()) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
if (examId == null) {
|
|
|
return null;
|
|
|
}
|
|
@@ -1099,11 +1075,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
statistic.setCompletedProportion(Double.valueOf(new DecimalFormat("#.00").format(percent * 100)));
|
|
|
}
|
|
|
}
|
|
|
- List<CourseProgressInfo> ret=Lists.newArrayList();
|
|
|
+ List<CourseProgressInfo> ret = Lists.newArrayList();
|
|
|
for (CourseProgressInfo statistic : totalList) {
|
|
|
- if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getCourseId())) {
|
|
|
- ret.add(statistic);
|
|
|
- }
|
|
|
+ if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getCourseId())) {
|
|
|
+ ret.add(statistic);
|
|
|
+ }
|
|
|
}
|
|
|
return ret;
|
|
|
} else {
|
|
@@ -1127,7 +1103,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
sql += " group by course_id ) tb ORDER BY " + orderColumn + " desc";
|
|
|
|
|
|
- List<CourseProgressInfo> totalList= jdbcTemplate.query(sql, new RowMapper<CourseProgressInfo>() {
|
|
|
+ List<CourseProgressInfo> totalList = jdbcTemplate.query(sql, new RowMapper<CourseProgressInfo>() {
|
|
|
@Override
|
|
|
public CourseProgressInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
|
|
|
CourseProgressInfo courseProgressInfo = new CourseProgressInfo();
|
|
@@ -1139,11 +1115,11 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
return courseProgressInfo;
|
|
|
}
|
|
|
});
|
|
|
- List<CourseProgressInfo> ret=Lists.newArrayList();
|
|
|
+ List<CourseProgressInfo> ret = Lists.newArrayList();
|
|
|
for (CourseProgressInfo statistic : totalList) {
|
|
|
- if(!ud.assertNeedQueryRefIds()||ud.getRefIds().contains(statistic.getCourseId())) {
|
|
|
- ret.add(statistic);
|
|
|
- }
|
|
|
+ if (!ud.assertNeedQueryRefIds() || ud.getRefIds().contains(statistic.getCourseId())) {
|
|
|
+ ret.add(statistic);
|
|
|
+ }
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
@@ -1229,13 +1205,13 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
}
|
|
|
ExamPropertyCacheBean showUndertaking = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.SHOW_UNDERTAKING.name());
|
|
|
if (showUndertaking != null && StringUtil.isTrue(showUndertaking.getValue())) {
|
|
|
- info.setShowUndertaking(true);
|
|
|
- ExamPropertyCacheBean undertaking = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.UNDERTAKING.name());
|
|
|
- if (undertaking != null) {
|
|
|
- info.setUndertaking(undertaking.getValue());
|
|
|
- }
|
|
|
- }else {
|
|
|
- info.setShowUndertaking(false);
|
|
|
+ info.setShowUndertaking(true);
|
|
|
+ ExamPropertyCacheBean undertaking = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.UNDERTAKING.name());
|
|
|
+ if (undertaking != null) {
|
|
|
+ info.setUndertaking(undertaking.getValue());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ info.setShowUndertaking(false);
|
|
|
}
|
|
|
|
|
|
info.setExamType(examType.name());
|
|
@@ -1388,13 +1364,43 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
examStudentInfo.setUsedNum(ret);
|
|
|
}
|
|
|
|
|
|
-// //获取考试的考生信息
|
|
|
-// private ExamStudentBean getRemoteExamStudent(Long rootOrgId, Long examStudentId) {
|
|
|
-// GetExamStudentReq req = new GetExamStudentReq();
|
|
|
-// req.setExamStudentId(examStudentId);
|
|
|
-// req.setRootOrgId(rootOrgId);
|
|
|
-// GetExamStudentResp resp = examStudentCloudService.getExamStudent(req);
|
|
|
-// return resp.getExamStudentBean();
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public Page<ExamStudentEntity> getExamStudentSimpleList(ExamStudentQuery req) {
|
|
|
+ if (req.getPageNo() == null || req.getPageNo() < 1) {
|
|
|
+ req.setPageNo(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.getPageSize() == null || req.getPageSize() < 1) {
|
|
|
+ req.setPageSize(10);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (req.getExamId() == null) {
|
|
|
+ throw new StatusException("考试ID不能为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Specification<ExamStudentEntity> spec = (root, query, cb) -> {
|
|
|
+ List<Predicate> predicates = new ArrayList<>();
|
|
|
+ predicates.add(cb.equal(root.get("examId"), req.getExamId()));
|
|
|
+
|
|
|
+ if (req.getCourseId() != null) {
|
|
|
+ predicates.add(cb.equal(root.get("courseId"), req.getCourseId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return cb.and(predicates.toArray(new Predicate[predicates.size()]));
|
|
|
+ };
|
|
|
+
|
|
|
+ Sort sort = Sort.by(Sort.Order.desc("id"));
|
|
|
+ Pageable pageable = PageRequest.of(req.getPageNo() - 1, req.getPageSize(), sort);
|
|
|
+ return examStudentRepo.findAll(spec, pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+ // //获取考试的考生信息
|
|
|
+ // private ExamStudentBean getRemoteExamStudent(Long rootOrgId, Long examStudentId) {
|
|
|
+ // GetExamStudentReq req = new GetExamStudentReq();
|
|
|
+ // req.setExamStudentId(examStudentId);
|
|
|
+ // req.setRootOrgId(rootOrgId);
|
|
|
+ // GetExamStudentResp resp = examStudentCloudService.getExamStudent(req);
|
|
|
+ // return resp.getExamStudentBean();
|
|
|
+ // }
|
|
|
|
|
|
}
|