|
@@ -15,6 +15,7 @@ import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
import java.sql.SQLException;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -341,6 +342,54 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
setPhone(examStudentInfoList, query.getRootOrgId());
|
|
setPhone(examStudentInfoList, query.getRootOrgId());
|
|
return examStudentInfoList;
|
|
return examStudentInfoList;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<OnHandExamInfo> queryOnlineExamEndList(Long studentId, ExamType examType) {
|
|
|
|
+ StudentCacheBean studentBean = CacheHelper.getStudent(studentId);
|
|
|
|
+
|
|
|
|
+ //获取可以考的和即将考的考试Id
|
|
|
|
+ GetOngoingExamListReq getOngoingExamListReq = new GetOngoingExamListReq();
|
|
|
|
+ getOngoingExamListReq.setExamType(examType.name());
|
|
|
|
+ getOngoingExamListReq.setRootOrgId(studentBean.getRootOrgId());
|
|
|
|
+ getOngoingExamListReq.setOrgId(studentBean.getOrgId());
|
|
|
|
+ getOngoingExamListReq.setStudentId(studentId);
|
|
|
|
+ GetOngoingExamListResp getOngoingExamListResp = examCloudService.getOngoingExamList(getOngoingExamListReq);
|
|
|
|
+
|
|
|
|
+ //获取学生所在组织机构的所有考试列表集合
|
|
|
|
+ List<ExamSpecialSettingsBean> examSpecialSettingsBeanList = getOngoingExamListResp.getExamSpecialSettingsList();
|
|
|
|
+ if (examSpecialSettingsBeanList == null || examSpecialSettingsBeanList.size() == 0) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ List<Long> examIds = examSpecialSettingsBeanList.stream().map(ExamSpecialSettingsBean::getExamId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ //只查没有禁用的考生
|
|
|
|
+ List<ExamStudentEntity> examStudents =
|
|
|
|
+ examStudentRepo.findByStudentIdAndEnableAndExamIdIn(studentId, true, examIds);
|
|
|
|
+
|
|
|
|
+ List<OnHandExamInfo> examStudentDtoList = new ArrayList<OnHandExamInfo>();
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ for (ExamStudentEntity examStudent : examStudents) {
|
|
|
|
+ assemblingExamStudentDto(examStudent, now, examStudentDtoList, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(OnHandExamInfo info:examStudentDtoList) {
|
|
|
|
+ ExamPropertyCacheBean examCycleEnabledCache = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.EXAM_CYCLE_ENABLED.name());
|
|
|
|
+ if(examCycleEnabledCache!=null&&StringUtil.isTrue(examCycleEnabledCache.getValue())) {
|
|
|
|
+ info.setExamCycleEnabled(true);
|
|
|
|
+
|
|
|
|
+ ExamPropertyCacheBean examCycleWeekCache = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.EXAM_CYCLE_WEEK.name());
|
|
|
|
+
|
|
|
|
+ info.setExamCycleWeek(JSONObject.parseArray(examCycleWeekCache.getValue()));
|
|
|
|
+ ExamPropertyCacheBean examCycleTimeRangeCache = CacheHelper.getExamProperty(info.getExamId(), ExamProperties.EXAM_CYCLE_TIME_RANGE.name());
|
|
|
|
+ info.setExamCycleTimeRange(JSONObject.parseArray(examCycleTimeRangeCache.getValue()));
|
|
|
|
+ }else {
|
|
|
|
+ info.setExamCycleEnabled(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return examStudentDtoList;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void setPhone(List<ExamStudentInfo> dataList,Long rootOrgId) {
|
|
private void setPhone(List<ExamStudentInfo> dataList,Long rootOrgId) {
|
|
GetStudentListByIdsReq req= new GetStudentListByIdsReq();
|
|
GetStudentListByIdsReq req= new GetStudentListByIdsReq();
|
|
BatchSetDataUtil<ExamStudentInfo> tool = new BatchSetDataUtil<ExamStudentInfo>() {
|
|
BatchSetDataUtil<ExamStudentInfo> tool = new BatchSetDataUtil<ExamStudentInfo>() {
|
|
@@ -1077,7 +1126,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
List<OnHandExamInfo> examStudentDtoList = new ArrayList<OnHandExamInfo>();
|
|
List<OnHandExamInfo> examStudentDtoList = new ArrayList<OnHandExamInfo>();
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
- assemblingExamStudentDto(examStudent, now, examStudentDtoList);
|
|
|
|
|
|
+ assemblingExamStudentDto(examStudent, now, examStudentDtoList, false);
|
|
}
|
|
}
|
|
|
|
|
|
for(OnHandExamInfo info:examStudentDtoList) {
|
|
for(OnHandExamInfo info:examStudentDtoList) {
|
|
@@ -1098,7 +1147,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
return examStudentDtoList;
|
|
return examStudentDtoList;
|
|
}
|
|
}
|
|
|
|
|
|
- private void assemblingExamStudentDto(ExamStudentEntity examStudent, Date now, final List<OnHandExamInfo> resultList) {
|
|
|
|
|
|
+ private void assemblingExamStudentDto(ExamStudentEntity examStudent, Date now, final List<OnHandExamInfo> resultList, boolean end) {
|
|
Long examId = examStudent.getExamId();
|
|
Long examId = examStudent.getExamId();
|
|
Long studentId = examStudent.getStudentId();
|
|
Long studentId = examStudent.getStudentId();
|
|
Long examStageId = examStudent.getExamStageId();
|
|
Long examStageId = examStudent.getExamStageId();
|
|
@@ -1113,9 +1162,19 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- //如果当前时间超过场次结束时间,不允许考试
|
|
|
|
- if (now.after(examBean.getEndTime())) {
|
|
|
|
- return;
|
|
|
|
|
|
+ if (end) {
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(examBean.getEndTime());
|
|
|
|
+ calendar.add(Calendar.DATE, 30);
|
|
|
|
+ Date leftTime = calendar.getTime();
|
|
|
|
+ //已结束且结束时间30天以内的
|
|
|
|
+ if(now.after(leftTime)||now.before(examBean.getEndTime())){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (now.after(examBean.getEndTime())) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|