|
@@ -16,6 +16,8 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
|
|
|
+import com.qmth.exam.reserve.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
import org.redisson.api.RLock;
|
|
@@ -59,19 +61,12 @@ import com.qmth.exam.reserve.entity.StudentEntity;
|
|
|
import com.qmth.exam.reserve.entity.TimePeriodEntity;
|
|
|
import com.qmth.exam.reserve.enums.CategoryLevel;
|
|
|
import com.qmth.exam.reserve.enums.EventType;
|
|
|
-import com.qmth.exam.reserve.service.ApplyTaskService;
|
|
|
-import com.qmth.exam.reserve.service.CategoryService;
|
|
|
-import com.qmth.exam.reserve.service.ExamRoomService;
|
|
|
-import com.qmth.exam.reserve.service.ExamSiteService;
|
|
|
-import com.qmth.exam.reserve.service.MaterialGenerateService;
|
|
|
-import com.qmth.exam.reserve.service.OperateLogService;
|
|
|
-import com.qmth.exam.reserve.service.StudentApplyService;
|
|
|
-import com.qmth.exam.reserve.service.StudentService;
|
|
|
-import com.qmth.exam.reserve.service.TimePeriodService;
|
|
|
import com.qmth.exam.reserve.util.DateUtil;
|
|
|
import com.qmth.exam.reserve.util.JsonHelper;
|
|
|
import com.qmth.exam.reserve.util.PageUtil;
|
|
|
|
|
|
+import static org.apache.commons.lang3.time.DateUtils.isSameDay;
|
|
|
+
|
|
|
@Service
|
|
|
public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, StudentApplyEntity>
|
|
|
implements StudentApplyService {
|
|
@@ -111,6 +106,9 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
@Autowired
|
|
|
private ApplyTaskCacheService cacheService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentAutoAssignService studentAutoAssignService;
|
|
|
+
|
|
|
@Override
|
|
|
public PageResult<StudentApplyVO> page(StudentApplyReq req) {
|
|
|
if (req.getTaskId() == null) {
|
|
@@ -192,8 +190,9 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> importPreExam(Long userId, Long teachingId, Integer level,
|
|
|
+ public List<Map<String, Object>> importPreExam(LoginUser user, Long teachingId, Integer level,
|
|
|
InputStream inputStream) {
|
|
|
+ checkOpenTime(user.getOrgId());
|
|
|
List<DataMap> lineList;
|
|
|
ExcelReader reader = ExcelReader.create(ExcelType.XLSX, inputStream, 0);
|
|
|
try {
|
|
@@ -395,7 +394,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
for (int i = 0; i < applyList.size(); i++) {
|
|
|
StudentImportVO vo = applyList.get(i);
|
|
|
try {
|
|
|
- saveStdApply(i, vo, userId, failRecords);
|
|
|
+ saveStdApply(i, vo, user.getId(), failRecords);
|
|
|
} catch (StatusException e) {
|
|
|
failRecords.add(newError(i + 1, " 系统异常"));
|
|
|
log.error("导入异常", e);
|
|
@@ -411,6 +410,16 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void checkOpenTime(Long orgId) {
|
|
|
+ CurrentApplyTaskVO task = cacheService.currentApplyTask(orgId);
|
|
|
+ Date startTime = new Date(task.getSelfApplyStartTime());
|
|
|
+ Date endTime = new Date(task.getOpenApplyEndTime());
|
|
|
+ Date now = new Date();
|
|
|
+ if(now.before(startTime) || now.after(endTime)) {
|
|
|
+ throw new StatusException("未到开放时间!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private Map<Long, Long> getExamSiteCategoryCache() {
|
|
|
Map<Long, Long> cache = new HashMap<>();
|
|
|
LambdaQueryWrapper<ExamSiteEntity> lm = new LambdaQueryWrapper<>();
|
|
@@ -644,145 +653,61 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
@Override
|
|
|
public void autoAssign(Long taskId, Long userId) {
|
|
|
checkAfterOpenTime();
|
|
|
- RLock lock = (RLock) concurrentService.getLock(CacheConstants.LOCK_AUTO_APPLY);
|
|
|
- try {
|
|
|
- if (!lock.tryLock()) {
|
|
|
- log.warn("获取锁失败,不允许同时执行自动分配!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
- throw new StatusException("其他老师正在执行自动分配,请不要重复执行!");
|
|
|
- }
|
|
|
-
|
|
|
- log.warn("获取锁成功!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
-
|
|
|
- // 1、未完成预约的考生
|
|
|
- List<StudentEntity> studentList = studentService.listNoFinishStudent(taskId, Boolean.FALSE);
|
|
|
- Map<Long, List<StudentEntity>> noFinishApplyMap = studentList.stream()
|
|
|
- .collect(Collectors.groupingBy(StudentEntity::getCategoryId));
|
|
|
- // 2、考位是否充足
|
|
|
- List<TimePeriodEntity> timeList = listTimePeriod(taskId);
|
|
|
- timeList = listNoCancelExamTimePeriod(timeList, taskId);
|
|
|
- checkTeachingCapacity(noFinishApplyMap, timeList, taskId);
|
|
|
- // 3、按照教学点安排考位。规则:不能和已预约的时间上有冲突
|
|
|
- for (Long key : noFinishApplyMap.keySet()) {
|
|
|
- List<ExamSiteEntity> siteList = listExamSite(key, null);
|
|
|
- List<StudentEntity> teachingStudentList = noFinishApplyMap.get(key);
|
|
|
- for (ExamSiteEntity site : siteList) {
|
|
|
- for (TimePeriodEntity time : timeList) {
|
|
|
- // 该时段已预约的考生
|
|
|
- Integer haveApplyNum = cacheService.getApplyFinishCount(site.getId(), time.getId());
|
|
|
- if (haveApplyNum == 0) {
|
|
|
- haveApplyNum = getHaveApplyNum(site.getId(), time.getId());
|
|
|
- }
|
|
|
- // 剩余的考位
|
|
|
- Integer remainNum = site.getCapacity() - haveApplyNum;
|
|
|
-
|
|
|
- assignStudentApply(userId, site.getId(), time.getId(), teachingStudentList, remainNum);
|
|
|
- }
|
|
|
- }
|
|
|
- // 4、判断是否还有剩余考生未完成预约,提醒考位不够
|
|
|
- if (!teachingStudentList.isEmpty())
|
|
|
- throw new StatusException("【" + categoryService.getById(key).getName() + "】教学点考位不足");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage());
|
|
|
- throw new StatusException(e.getMessage());
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- // 解锁前检查当前线程是否持有该锁
|
|
|
- if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
|
|
- lock.unlock();
|
|
|
- log.info("解锁成功!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.warn(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private List<TimePeriodEntity> listNoCancelExamTimePeriod(List<TimePeriodEntity> timeList, Long taskId) {
|
|
|
- ApplyTaskEntity task = applyTaskService.getById(taskId);
|
|
|
- Long longToday = DateUtil.getLongTimeByDate(DateUtil.formatShortSplitDateString(new Date()) + " 00:00:00");
|
|
|
- Date today = new Date(longToday);
|
|
|
- Date otherDay = DateUtil.addValues(today, Calendar.DAY_OF_MONTH, task.getAllowApplyCancelDays());
|
|
|
- Long longOtherDay = DateUtil.getLongTimeByDate(DateUtil.formatShortSplitDateString(otherDay) + " 23:59:59");
|
|
|
- return timeList.stream().filter(time -> time.getStartTime() > longOtherDay).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- private List<StudentApplyEntity> assignStudentApply(Long userId, Long siteId, Long timeId,
|
|
|
- List<StudentEntity> teachingStudentList, Integer remainNum) {
|
|
|
- List<StudentApplyEntity> insertApplyList = new ArrayList<>();
|
|
|
- int num = 0;
|
|
|
- String studentApplyLockKey = null;
|
|
|
- RLock studentApplyLock = null;
|
|
|
- for (Iterator<StudentEntity> iterator = teachingStudentList.iterator(); iterator.hasNext();) {
|
|
|
- StudentEntity student = iterator.next();
|
|
|
- if (num >= remainNum)
|
|
|
- break;
|
|
|
- studentApplyLockKey = String.format(CacheConstants.LOCK_STUDENT_APPLY, student.getId());
|
|
|
- studentApplyLock = (RLock) concurrentService.getLock(studentApplyLockKey);
|
|
|
- try {
|
|
|
- if (!studentApplyLock.tryLock()) {
|
|
|
- log.warn("获取锁失败,考生在同时操作预约!lockKey:{}", studentApplyLockKey);
|
|
|
- iterator.remove();
|
|
|
- } else {
|
|
|
- log.warn("获取锁成功!lockKey:{}", studentApplyLockKey);
|
|
|
-
|
|
|
- List<StudentApplyEntity> studentApplyList = listStudentApply(student.getId(), Boolean.FALSE);
|
|
|
- int toApplyNum = student.getApplyNumber() - studentApplyList.size();
|
|
|
- if (toApplyNum > 0 && !haveApplySameTimePeriod(siteId, timeId, student.getId())) {
|
|
|
- StudentApplyEntity studentApply = new StudentApplyEntity();
|
|
|
- studentApply.setStudentId(student.getId());
|
|
|
- studentApply.setExamSiteId(siteId);
|
|
|
- studentApply.setCancel(Boolean.FALSE);
|
|
|
- studentApply.setTimePeriodId(timeId);
|
|
|
- studentApply.setOperateId(userId);
|
|
|
-
|
|
|
- StudentApplyEntity existStudentApply = findStudentApply(studentApply);
|
|
|
- if (existStudentApply != null) {
|
|
|
- existStudentApply.setCancel(Boolean.FALSE);
|
|
|
- baseMapper.updateById(existStudentApply);
|
|
|
- } else {
|
|
|
- baseMapper.insert(studentApply);
|
|
|
- }
|
|
|
- insertApplyList.add(studentApply);
|
|
|
+ //异步执行
|
|
|
+ studentAutoAssignService.autoAssign(taskId, userId);
|
|
|
+// RLock lock = (RLock) concurrentService.getLock(CacheConstants.LOCK_AUTO_APPLY);
|
|
|
+// try {
|
|
|
+// if (!lock.tryLock()) {
|
|
|
+// log.warn("获取锁失败,不允许同时执行自动分配!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
+// throw new StatusException("其他老师正在执行自动分配,请不要重复执行!");
|
|
|
+// }
|
|
|
+//
|
|
|
+// log.warn("获取锁成功!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
+//
|
|
|
+// // 1、未完成预约的考生
|
|
|
+// List<StudentEntity> studentList = studentService.listNoFinishStudent(taskId, Boolean.FALSE);
|
|
|
+// Map<Long, List<StudentEntity>> noFinishApplyMap = studentList.stream()
|
|
|
+// .collect(Collectors.groupingBy(StudentEntity::getCategoryId));
|
|
|
+// // 2、考位是否充足
|
|
|
+// List<TimePeriodEntity> timeList = listTimePeriod(taskId);
|
|
|
+// timeList = listNoCancelExamTimePeriod(timeList, taskId);
|
|
|
+// checkTeachingCapacity(noFinishApplyMap, timeList, taskId);
|
|
|
+// // 3、按照教学点安排考位。规则:不能和已预约的时间上有冲突
|
|
|
+// for (Long key : noFinishApplyMap.keySet()) {
|
|
|
+// List<ExamSiteEntity> siteList = listExamSite(key, null);
|
|
|
+// List<StudentEntity> teachingStudentList = noFinishApplyMap.get(key);
|
|
|
+// for (ExamSiteEntity site : siteList) {
|
|
|
+// for (TimePeriodEntity time : timeList) {
|
|
|
+// // 该时段已预约的考生
|
|
|
+// Integer haveApplyNum = cacheService.getApplyFinishCount(site.getId(), time.getId());
|
|
|
+// if (haveApplyNum == 0) {
|
|
|
+// haveApplyNum = getHaveApplyNum(site.getId(), time.getId());
|
|
|
+// }
|
|
|
+// // 剩余的考位
|
|
|
+// Integer remainNum = site.getCapacity() - haveApplyNum;
|
|
|
+//
|
|
|
+// assignStudentApply(userId, site.getId(), time.getId(), teachingStudentList, remainNum);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 4、判断是否还有剩余考生未完成预约,提醒考位不够
|
|
|
+// if (!teachingStudentList.isEmpty())
|
|
|
+// throw new StatusException("【" + categoryService.getById(key).getName() + "】教学点考位不足");
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error(e.getMessage());
|
|
|
+// throw new StatusException(e.getMessage());
|
|
|
+// } finally {
|
|
|
+// try {
|
|
|
+// // 解锁前检查当前线程是否持有该锁
|
|
|
+// if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
|
|
+// lock.unlock();
|
|
|
+// log.info("解锁成功!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.warn(e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
- num++;
|
|
|
- if (student.getApplyNumber() - (studentApplyList.size() + 1) == 0) {
|
|
|
- iterator.remove();
|
|
|
- }
|
|
|
-
|
|
|
- ApplyRecordCacheBean bean = new ApplyRecordCacheBean();
|
|
|
- bean.setStudentId(studentApply.getStudentId());
|
|
|
- bean.setExamSiteId(studentApply.getExamSiteId());
|
|
|
- bean.setTimePeriodId(studentApply.getTimePeriodId());
|
|
|
- bean.setCancel(Boolean.FALSE);
|
|
|
- bean.setOperateId(userId);
|
|
|
- bean.setOperateTime(System.currentTimeMillis());
|
|
|
-
|
|
|
- // 先推送至预约队列
|
|
|
- cacheService.pushStudentApplyRecordQueue(bean);
|
|
|
- cacheService.saveStudentApplyRecord(bean);
|
|
|
- cacheService.increaseApplyFinishCount(studentApply.getExamSiteId(),
|
|
|
- studentApply.getTimePeriodId());
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("自动安排预约失败,错误信息:{}", e.getMessage());
|
|
|
- throw new StatusException("自动安排预约失败,请稍后再试!");
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- // 解锁前检查当前线程是否持有该锁
|
|
|
- if (studentApplyLock.isLocked() && studentApplyLock.isHeldByCurrentThread()) {
|
|
|
- studentApplyLock.unlock();
|
|
|
- log.info("解锁成功!lockKey:{}", studentApplyLockKey);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.warn(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- return insertApplyList;
|
|
|
}
|
|
|
|
|
|
private StudentApplyEntity findStudentApply(StudentApplyEntity studentApply) {
|
|
@@ -793,24 +718,6 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
return baseMapper.selectOne(lm);
|
|
|
}
|
|
|
|
|
|
- private boolean haveApplySameTimePeriod(Long siteId, Long timeId, Long studentId) {
|
|
|
- LambdaQueryWrapper<StudentApplyEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(StudentApplyEntity::getExamSiteId, siteId);
|
|
|
- wrapper.eq(StudentApplyEntity::getTimePeriodId, timeId);
|
|
|
- wrapper.eq(StudentApplyEntity::getStudentId, studentId);
|
|
|
- wrapper.eq(StudentApplyEntity::getCancel, Boolean.FALSE);
|
|
|
- StudentApplyEntity studentApply = baseMapper.selectOne(wrapper);
|
|
|
- return studentApply != null;
|
|
|
- }
|
|
|
-
|
|
|
- private Integer getHaveApplyNum(Long siteId, Long timeId) {
|
|
|
- LambdaQueryWrapper<StudentApplyEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(StudentApplyEntity::getExamSiteId, siteId);
|
|
|
- wrapper.eq(StudentApplyEntity::getTimePeriodId, timeId);
|
|
|
- wrapper.eq(StudentApplyEntity::getCancel, Boolean.FALSE);
|
|
|
- return baseMapper.selectCount(wrapper);
|
|
|
- }
|
|
|
-
|
|
|
private void checkAfterOpenTime() {
|
|
|
ApplyTaskEntity task = getApplyTask();
|
|
|
Date selfEndTime = new Date(task.getSelfApplyEndTime());
|
|
@@ -820,45 +727,6 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void checkTeachingCapacity(Map<Long, List<StudentEntity>> map, List<TimePeriodEntity> timeList,
|
|
|
- Long taskId) {
|
|
|
- for (Long key : map.keySet()) {
|
|
|
- List<ExamSiteEntity> siteList = listExamSite(key, null);
|
|
|
- // 总考位数量
|
|
|
- Integer total = siteList.stream().collect(Collectors.summingInt(ExamSiteEntity::getCapacity))
|
|
|
- * timeList.size();
|
|
|
- // 已经预约的数量
|
|
|
- Integer haveApplyNum = 0;
|
|
|
- for (ExamSiteEntity site : siteList) {
|
|
|
- haveApplyNum += cacheService.getApplyTotalCount(site.getId());
|
|
|
- }
|
|
|
- if (haveApplyNum == 0) {
|
|
|
- haveApplyNum = getBaseMapper().getHaveApplyCount(
|
|
|
- siteList.stream().map(site -> site.getId()).collect(Collectors.toList()), Boolean.FALSE);
|
|
|
- }
|
|
|
- // 未预约的数量
|
|
|
- Integer noApplyNum = getNoApplyNum(map.get(key));
|
|
|
- if (noApplyNum > total - haveApplyNum) {
|
|
|
- CategoryEntity category = categoryService.getById(key);
|
|
|
- throw new StatusException("【" + category.getName() + "】教学点考位不足!剩余的考位数量:【" + (total - haveApplyNum)
|
|
|
- + "】,实际需要的考位数量:【" + noApplyNum + "】");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private Integer getNoApplyNum(List<StudentEntity> list) {
|
|
|
- int noApplyNum = 0;
|
|
|
- for (StudentEntity student : list) {
|
|
|
- if (student.getApplyNumber() == 1) {
|
|
|
- noApplyNum++;
|
|
|
- } else if (student.getApplyNumber() > 1) {
|
|
|
- // listStudentApply(student.getId(), Boolean.FALSE).size()
|
|
|
- int haveApplyNum = cacheService.getStudentApplyFinishCount(student.getId());
|
|
|
- noApplyNum = noApplyNum + (student.getApplyNumber() - haveApplyNum);
|
|
|
- }
|
|
|
- }
|
|
|
- return noApplyNum;
|
|
|
- }
|
|
|
|
|
|
private List<StudentApplyEntity> listStudentApply(Long stdId, Boolean cancel) {
|
|
|
LambdaQueryWrapper<StudentApplyEntity> lm = new LambdaQueryWrapper<>();
|
|
@@ -990,7 +858,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
Date day = new Date(startTime);
|
|
|
List<TimePeriodEntity> resultList = new ArrayList<>();
|
|
|
for (TimePeriodEntity time : timeList) {
|
|
|
- if (DateUtils.isSameDay(day, new Date(time.getStartTime())))
|
|
|
+ if (isSameDay(day, new Date(time.getStartTime())))
|
|
|
resultList.add(time);
|
|
|
}
|
|
|
return resultList.stream().sorted(Comparator.comparing(TimePeriodEntity::getStartTime))
|
|
@@ -1014,7 +882,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
Date noCancelDate = getNoCancelApplyDate(allowApplyCancelDays);
|
|
|
List<TimePeriodEntity> noCancelTimePeroidList = new ArrayList<>();
|
|
|
for (TimePeriodEntity time : list) {
|
|
|
- if (DateUtils.isSameDay(noCancelDate, new Date(time.getStartTime())))
|
|
|
+ if (isSameDay(noCancelDate, new Date(time.getStartTime())))
|
|
|
noCancelTimePeroidList.add(time);
|
|
|
}
|
|
|
return noCancelTimePeroidList;
|
|
@@ -1114,13 +982,10 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
log.warn("未配置考试时段");
|
|
|
return signInList;
|
|
|
}
|
|
|
- Long startTime = timePeriodList.get(0).getStartTime();
|
|
|
- Long endTime = timePeriodList.get(timePeriodList.size() - 1).getEndTime();
|
|
|
-
|
|
|
String todayStr = DateUtil.formatShortSplitDateString(new Date());
|
|
|
Long longToday = DateUtil.getLongTimeByDate(todayStr + " 00:00:00");
|
|
|
Date today = new Date(longToday);
|
|
|
- if (longToday >= startTime && longToday <= endTime) {
|
|
|
+ if (isInTimePeriod(today,timePeriodList)) {
|
|
|
SignInVO vo = new SignInVO();
|
|
|
vo.setExamDate(longToday);
|
|
|
signInList.add(vo);
|
|
@@ -1129,7 +994,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
for (int i = 1; i <= task.getAllowApplyCancelDays(); i++) {
|
|
|
Date otherDay = DateUtil.addValues(today, Calendar.DAY_OF_MONTH, i);
|
|
|
Long longOtherDay = DateUtil.getLongTimeByDate(DateUtil.formatShortSplitDateString(otherDay) + " 00:00:00");
|
|
|
- if (longOtherDay >= startTime && longOtherDay <= endTime) {
|
|
|
+ if (isInTimePeriod(otherDay, timePeriodList)) {
|
|
|
SignInVO vo = new SignInVO();
|
|
|
vo.setExamDate(longOtherDay);
|
|
|
signInList.add(vo);
|
|
@@ -1139,4 +1004,14 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
return signInList;
|
|
|
}
|
|
|
|
|
|
+ private boolean isInTimePeriod(Date date, List<TimePeriodEntity> timePeriodList) {
|
|
|
+ for(TimePeriodEntity timePeriod : timePeriodList) {
|
|
|
+ Date day = new Date(timePeriod.getStartTime());
|
|
|
+ if(DateUtils.isSameDay(day, date)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|