|
@@ -8,6 +8,7 @@ import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.ExamStudentImportDto;
|
|
|
import com.qmth.themis.business.dto.RoomCodeImportDto;
|
|
|
import com.qmth.themis.business.entity.*;
|
|
|
+import com.qmth.themis.business.enums.ExamModeEnum;
|
|
|
import com.qmth.themis.business.enums.RoleEnum;
|
|
|
import com.qmth.themis.business.enums.TaskStatusEnum;
|
|
|
import com.qmth.themis.business.service.*;
|
|
@@ -87,6 +88,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
Set<String> courseCodeSet = courseCodeMap.keySet().stream().collect(Collectors.toSet());
|
|
|
teExamCourseQueryWrapper.lambda().in(TEExamCourse::getCourseCode, courseCodeSet);
|
|
|
List<TEExamCourse> teExamCourseList = teExamCourseService.list(teExamCourseQueryWrapper);
|
|
|
+ Integer examCount = Integer.parseInt(String.valueOf(map.get("examCount")));
|
|
|
if (Objects.nonNull(teExamCourseList) && teExamCourseList.size() > 0) {
|
|
|
teExamCourseList.forEach(s -> {
|
|
|
courseCodeMap.remove(s.getCourseCode());
|
|
@@ -100,7 +102,16 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
if (teExamCourses.size() > 0) {
|
|
|
teExamCourseService.saveBatch(teExamCourses);
|
|
|
}
|
|
|
-
|
|
|
+ TEExamActivity teExamActivity = null;
|
|
|
+ ExamModeEnum modeEnum = ExamModeEnum.valueOf(String.valueOf(map.get("mode")));
|
|
|
+ if (Objects.equals(modeEnum, ExamModeEnum.ANYTIME)) {
|
|
|
+ Iterator iterator = teExamActivityMap.entrySet().iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ Map m = (Map) iterator.next();
|
|
|
+ m = SystemConstant.timeTransform(m);
|
|
|
+ teExamActivity = gson.fromJson(gson.toJson(m), TEExamActivity.class);
|
|
|
+ }
|
|
|
+ }
|
|
|
//保存用户
|
|
|
for (int i = 0; i < finalList.size(); i++) {
|
|
|
LinkedMultiValueMap<Integer, Object> finalMap = finalList.get(i);
|
|
@@ -115,9 +126,11 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
List subList = examStudentImportDtoList.subList(min, max);
|
|
|
for (; y < subList.size(); y++) {
|
|
|
ExamStudentImportDto examStudentImportDto = (ExamStudentImportDto) subList.get(y);
|
|
|
- Map m = (Map) teExamActivityMap.get(examStudentImportDto.getExamActivityCode());
|
|
|
- m = SystemConstant.timeTransform(m);
|
|
|
- TEExamActivity teExamActivity = gson.fromJson(gson.toJson(m), TEExamActivity.class);
|
|
|
+ if (Objects.equals(modeEnum, ExamModeEnum.TOGETHER)) {
|
|
|
+ Map m = (Map) teExamActivityMap.get(examStudentImportDto.getExamActivityCode());
|
|
|
+ m = SystemConstant.timeTransform(m);
|
|
|
+ teExamActivity = gson.fromJson(gson.toJson(m), TEExamActivity.class);
|
|
|
+ }
|
|
|
//先根据证件号+科目代码查询考生是否存在,存在则更新,不存在则插入
|
|
|
QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
teExamStudentQueryWrapper.lambda().eq(TEExamStudent::getIdentity, examStudentImportDto.getIdentity()).eq(TEExamStudent::getCourseCode, examStudentImportDto.getCourseCode());
|
|
@@ -135,13 +148,12 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
}
|
|
|
teExamStudent = gson.fromJson(gson.toJson(examStudentImportDto), TEExamStudent.class);
|
|
|
teExamStudent.setExamId(examId);
|
|
|
- if (Objects.nonNull(teExamActivity)) {
|
|
|
- teExamStudent.setExamActivityId(teExamActivity.getId());
|
|
|
- }
|
|
|
+ teExamStudent.setExamActivityId(teExamActivity.getId());
|
|
|
teExamStudent.setStudentId(teStudent.getId());
|
|
|
teExamStudent.setCreateId(createId);
|
|
|
teExamStudent.setCourseCode(examStudentImportDto.getCourseCode());
|
|
|
teExamStudent.setCourseName(examStudentImportDto.getCourseName());
|
|
|
+ teExamStudent.setLeftExamCount(examCount);
|
|
|
} else {
|
|
|
teExamStudent.setUpdateId(createId);
|
|
|
teExamStudent.setName(examStudentImportDto.getName());
|
|
@@ -152,9 +164,8 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
teExamStudent.setRoomName(examStudentImportDto.getRoomName());
|
|
|
teExamStudent.setCourseCode(examStudentImportDto.getCourseCode());
|
|
|
teExamStudent.setCourseName(examStudentImportDto.getCourseName());
|
|
|
- if (Objects.nonNull(teExamActivity)) {
|
|
|
- teExamStudent.setExamActivityId(teExamActivity.getId());
|
|
|
- }
|
|
|
+ teExamStudent.setExamActivityId(teExamActivity.getId());
|
|
|
+ teExamStudent.setLeftExamCount(examCount);
|
|
|
}
|
|
|
teExamStudentService.saveOrUpdate(teExamStudent);
|
|
|
roomCodeAndNameSet.add(teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());
|