|
@@ -8,7 +8,6 @@ import java.time.ZoneId;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
-import java.util.Collections;
|
|
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -17,7 +16,6 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import com.qmth.exam.reserve.entity.base.BaseEntity;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
import org.redisson.api.RLock;
|
|
import org.redisson.api.RLock;
|
|
@@ -210,10 +208,13 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
throw new StatusException("Excel无内容");
|
|
throw new StatusException("Excel无内容");
|
|
}
|
|
}
|
|
ApplyTaskEntity task = getApplyTask();
|
|
ApplyTaskEntity task = getApplyTask();
|
|
|
|
+ Date openStartTime = new Date(task.getOpenApplyStartTime());
|
|
|
|
+ Date now = new Date();
|
|
List<Map<String, Object>> failRecords = new ArrayList<Map<String, Object>>();
|
|
List<Map<String, Object>> failRecords = new ArrayList<Map<String, Object>>();
|
|
Map<String, Long> teachingCache = getTeachingCache(level);
|
|
Map<String, Long> teachingCache = getTeachingCache(level);
|
|
Map<String, Long> agentCache = getAgentCache();
|
|
Map<String, Long> agentCache = getAgentCache();
|
|
Map<String, TimePeriodEntity> timeCache = getTimePeriodCache();
|
|
Map<String, TimePeriodEntity> timeCache = getTimePeriodCache();
|
|
|
|
+ Map<Long, Long> examSiteCategroyCache = getExamSiteCategroyCache();
|
|
List<StudentImportVO> applyList = new ArrayList<>();
|
|
List<StudentImportVO> applyList = new ArrayList<>();
|
|
AgentAndTimeVO agentTime = new AgentAndTimeVO();
|
|
AgentAndTimeVO agentTime = new AgentAndTimeVO();
|
|
for (int i = 0; i < lineList.size(); i++) {
|
|
for (int i = 0; i < lineList.size(); i++) {
|
|
@@ -257,18 +258,20 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
if (categoryId != null && !student.getCategoryId().equals(categoryId)) {
|
|
if (categoryId != null && !student.getCategoryId().equals(categoryId)) {
|
|
msg.append(" 导入的考生所属教学点和系统中的考生教学点不匹配");
|
|
msg.append(" 导入的考生所属教学点和系统中的考生教学点不匹配");
|
|
}
|
|
}
|
|
- // if (categoryId != null && !categoryId.equals(teachingId)) {
|
|
|
|
- // msg.append(" 不是本教学点的考生");
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
String agentName1 = trimAndNullIfBlank(line.get(EXCEL_HEADER[4]));
|
|
String agentName1 = trimAndNullIfBlank(line.get(EXCEL_HEADER[4]));
|
|
if (StringUtils.isBlank(agentName1)) {
|
|
if (StringUtils.isBlank(agentName1)) {
|
|
msg.append(" 预约考点1不能为空");
|
|
msg.append(" 预约考点1不能为空");
|
|
}
|
|
}
|
|
agentTime = new AgentAndTimeVO();
|
|
agentTime = new AgentAndTimeVO();
|
|
Long agentId = agentCache.get(agentName1);
|
|
Long agentId = agentCache.get(agentName1);
|
|
|
|
+ Long applyCategoryId = null;
|
|
if (agentId == null) {
|
|
if (agentId == null) {
|
|
msg.append(" 预约考点1不存在");
|
|
msg.append(" 预约考点1不存在");
|
|
|
|
+ } else {
|
|
|
|
+ applyCategoryId = examSiteCategroyCache.get(agentId);
|
|
|
|
+ if (now.before(openStartTime) && categoryId != null && !applyCategoryId.equals(categoryId)) {
|
|
|
|
+ msg.append(" 未到自由预约时间,不允许预约其他教学点的考点");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
String timePeriod1 = trimAndNullIfBlank(line.get(EXCEL_HEADER[5]));
|
|
String timePeriod1 = trimAndNullIfBlank(line.get(EXCEL_HEADER[5]));
|
|
@@ -296,8 +299,14 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
continue;
|
|
continue;
|
|
} else {
|
|
} else {
|
|
agentId = agentCache.get(agentName2);
|
|
agentId = agentCache.get(agentName2);
|
|
- if (agentId == null)
|
|
|
|
|
|
+ if (agentId == null) {
|
|
msg.append(" 预约考点2不存在");
|
|
msg.append(" 预约考点2不存在");
|
|
|
|
+ } else {
|
|
|
|
+ applyCategoryId = examSiteCategroyCache.get(agentId);
|
|
|
|
+ if (now.before(openStartTime) && categoryId != null && !applyCategoryId.equals(categoryId)) {
|
|
|
|
+ msg.append(" 未到自由预约时间,不允许预约其他教学点的考点");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
timePeriod = checkTimePeriod(timePeriod2, timeCache);
|
|
timePeriod = checkTimePeriod(timePeriod2, timeCache);
|
|
agentTime = new AgentAndTimeVO();
|
|
agentTime = new AgentAndTimeVO();
|
|
@@ -320,8 +329,14 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
continue;
|
|
continue;
|
|
} else {
|
|
} else {
|
|
agentId = agentCache.get(agentName3);
|
|
agentId = agentCache.get(agentName3);
|
|
- if (agentId == null)
|
|
|
|
|
|
+ if (agentId == null) {
|
|
msg.append(" 预约考点3不存在");
|
|
msg.append(" 预约考点3不存在");
|
|
|
|
+ } else {
|
|
|
|
+ applyCategoryId = examSiteCategroyCache.get(agentId);
|
|
|
|
+ if (now.before(openStartTime) && categoryId != null && !applyCategoryId.equals(categoryId)) {
|
|
|
|
+ msg.append(" 未到自由预约时间,不允许预约其他教学点的考点");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
timePeriod = checkTimePeriod(timePeriod3, timeCache);
|
|
timePeriod = checkTimePeriod(timePeriod3, timeCache);
|
|
agentTime = new AgentAndTimeVO();
|
|
agentTime = new AgentAndTimeVO();
|
|
@@ -344,8 +359,14 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
continue;
|
|
continue;
|
|
} else {
|
|
} else {
|
|
agentId = agentCache.get(agentName4);
|
|
agentId = agentCache.get(agentName4);
|
|
- if (agentId == null)
|
|
|
|
|
|
+ if (agentId == null) {
|
|
msg.append(" 预约考点4不存在");
|
|
msg.append(" 预约考点4不存在");
|
|
|
|
+ } else {
|
|
|
|
+ applyCategoryId = examSiteCategroyCache.get(agentId);
|
|
|
|
+ if (now.before(openStartTime) && categoryId != null && !applyCategoryId.equals(categoryId)) {
|
|
|
|
+ msg.append(" 未到自由预约时间,不允许预约其他教学点的考点");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
timePeriod = checkTimePeriod(timePeriod4, timeCache);
|
|
timePeriod = checkTimePeriod(timePeriod4, timeCache);
|
|
agentTime = new AgentAndTimeVO();
|
|
agentTime = new AgentAndTimeVO();
|
|
@@ -387,6 +408,17 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private Map<Long, Long> getExamSiteCategroyCache() {
|
|
|
|
+ Map<Long, Long> cache = new HashMap<>();
|
|
|
|
+ LambdaQueryWrapper<ExamSiteEntity> lm = new LambdaQueryWrapper<>();
|
|
|
|
+ lm.eq(ExamSiteEntity::getEnable, Boolean.TRUE);
|
|
|
|
+ List<ExamSiteEntity> examSiteList = examSiteService.list(lm);
|
|
|
|
+ examSiteList.stream().forEach(site -> {
|
|
|
|
+ cache.put(site.getId(), site.getCategoryId());
|
|
|
|
+ });
|
|
|
|
+ return cache;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void checkAvailableTimePeriod(List<StudentImportVO> applyList) {
|
|
private void checkAvailableTimePeriod(List<StudentImportVO> applyList) {
|
|
for (StudentImportVO vo : applyList) {
|
|
for (StudentImportVO vo : applyList) {
|
|
List<AgentAndTimeVO> agentTimeList = vo.getAgentTimeList();
|
|
List<AgentAndTimeVO> agentTimeList = vo.getAgentTimeList();
|
|
@@ -606,7 +638,6 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
return s.trim();
|
|
return s.trim();
|
|
}
|
|
}
|
|
|
|
|
|
- @Transactional
|
|
|
|
@Override
|
|
@Override
|
|
public void autoAssign(Long taskId, Long userId) {
|
|
public void autoAssign(Long taskId, Long userId) {
|
|
checkAfterOpenTime();
|
|
checkAfterOpenTime();
|
|
@@ -701,6 +732,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
studentApply.setExamSiteId(siteId);
|
|
studentApply.setExamSiteId(siteId);
|
|
studentApply.setCancel(Boolean.FALSE);
|
|
studentApply.setCancel(Boolean.FALSE);
|
|
studentApply.setTimePeriodId(timeId);
|
|
studentApply.setTimePeriodId(timeId);
|
|
|
|
+ studentApply.setOperateId(userId);
|
|
|
|
|
|
StudentApplyEntity existStudentApply = findStudentApply(studentApply);
|
|
StudentApplyEntity existStudentApply = findStudentApply(studentApply);
|
|
if (existStudentApply != null) {
|
|
if (existStudentApply != null) {
|
|
@@ -714,8 +746,6 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
num++;
|
|
num++;
|
|
if (student.getApplyNumber() - (studentApplyList.size() + 1) == 0) {
|
|
if (student.getApplyNumber() - (studentApplyList.size() + 1) == 0) {
|
|
iterator.remove();
|
|
iterator.remove();
|
|
- student.setApplyFinished(true);
|
|
|
|
- this.studentService.updateById(student);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
ApplyRecordCacheBean bean = new ApplyRecordCacheBean();
|
|
ApplyRecordCacheBean bean = new ApplyRecordCacheBean();
|