|
@@ -2,7 +2,6 @@ package com.qmth.themis.business.templete.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
@@ -128,20 +127,13 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
.eq(TEExamStudent::getExamActivityId, teExamActivity.getId());
|
|
|
TEExamStudent teExamStudent = teExamStudentService.getOne(teExamStudentQueryWrapper);
|
|
|
//如果为空则插入考生数据,插入考生前先插入学生档案数据
|
|
|
+ QueryWrapper<TEStudent> teStudentQueryWrapper = new QueryWrapper<>();
|
|
|
+ teStudentQueryWrapper.lambda().eq(TEStudent::getIdentity, examStudentImportDto.getIdentity()).eq(TEStudent::getOrgId, orgId);
|
|
|
+ TEStudent teStudent = teStudentService.getOne(teStudentQueryWrapper);
|
|
|
if (Objects.isNull(teExamStudent)) {
|
|
|
- QueryWrapper<TEStudent> teStudentQueryWrapper = new QueryWrapper<>();
|
|
|
- teStudentQueryWrapper.lambda().eq(TEStudent::getIdentity, examStudentImportDto.getIdentity()).eq(TEStudent::getOrgId, orgId);
|
|
|
- TEStudent teStudent = teStudentService.getOne(teStudentQueryWrapper);
|
|
|
if (Objects.isNull(teStudent)) {//如果学生数据为空则插入学生数据
|
|
|
//先插入学生档案数据
|
|
|
teStudent = new TEStudent(orgId, examStudentImportDto.getIdentity(), examStudentImportDto.getName(), createId);
|
|
|
- teStudentService.save(teStudent);
|
|
|
- teStudentList.add(teStudent);
|
|
|
- } else {
|
|
|
- UpdateWrapper<TEStudent> teStudentUpdateWrapper = new UpdateWrapper<>();
|
|
|
- teStudentUpdateWrapper.lambda().set(TEStudent::getName, examStudentImportDto.getName())
|
|
|
- .eq(TEStudent::getIdentity, examStudentImportDto.getIdentity());
|
|
|
- teStudentService.update(teStudentUpdateWrapper);
|
|
|
}
|
|
|
teExamStudent = gson.fromJson(gson.toJson(examStudentImportDto), TEExamStudent.class);
|
|
|
teExamStudent.setExamId(examId);
|
|
@@ -162,16 +154,9 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
teExamStudent.setCourseName(examStudentImportDto.getCourseName());
|
|
|
teExamStudent.setExamActivityId(teExamActivity.getId());
|
|
|
teExamStudent.setAlreadyExamCount(0);
|
|
|
-
|
|
|
- UpdateWrapper<TEStudent> teStudentUpdateWrapper = new UpdateWrapper<>();
|
|
|
- teStudentUpdateWrapper.lambda().set(TEStudent::getName, examStudentImportDto.getName())
|
|
|
- .eq(TEStudent::getIdentity, examStudentImportDto.getIdentity());
|
|
|
- teStudentService.update(teStudentUpdateWrapper);
|
|
|
}
|
|
|
- UpdateWrapper<TEExamStudent> teExamStudentUpdateWrapper = new UpdateWrapper<>();
|
|
|
- teExamStudentUpdateWrapper.lambda().set(TEExamStudent::getName, examStudentImportDto.getName())
|
|
|
- .eq(TEExamStudent::getIdentity, examStudentImportDto.getIdentity());
|
|
|
- teExamStudentService.update(teExamStudentUpdateWrapper);
|
|
|
+ teStudent.setName(examStudentImportDto.getName());
|
|
|
+ teStudentList.add(teStudent);
|
|
|
|
|
|
ExamCourseCacheBean examCourseCacheBean = teExamCourseService.getExamCourseCacheBean(teExamStudent.getExamId(), teExamStudent.getCourseCode());
|
|
|
if (Objects.nonNull(examCourseCacheBean)) {
|
|
@@ -180,7 +165,6 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
if (teExamStudent.getAlreadyExamCount() == null) {
|
|
|
teExamStudent.setAlreadyExamCount(0);
|
|
|
}
|
|
|
- teExamStudentService.saveOrUpdate(teExamStudent);
|
|
|
roomCodeAndNameSet.add(examId + ":" + teExamStudent.getRoomCode() + ":" + teExamStudent.getRoomName());
|
|
|
teExamStudentList.add(teExamStudent);
|
|
|
}
|
|
@@ -196,6 +180,8 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ teStudentService.saveOrUpdateBatch(teStudentList);
|
|
|
+ teExamStudentService.saveOrUpdateBatch(teExamStudentList);
|
|
|
//考场创建
|
|
|
if (Objects.nonNull(roomCodeAndNameSet) && roomCodeAndNameSet.size() > 0) {
|
|
|
Map<String, TBExamInvigilateUser> tbExamInvigilateUserMap = (Map<String, TBExamInvigilateUser>) map.get("tbExamInvigilateUserMap");
|
|
@@ -204,11 +190,12 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
if (Objects.isNull(tbExamInvigilateUserMap) || (Objects.nonNull(tbExamInvigilateUserMap) && Objects.isNull(tbExamInvigilateUserMap.get(s)))) {
|
|
|
String[] strs = s.split(":");
|
|
|
TBExamInvigilateUser tbExamInvigilateUser = new TBExamInvigilateUser(Long.parseLong(strs[0]), orgId, strs[1], strs[2]);
|
|
|
- tbExamInvigilateUserService.save(tbExamInvigilateUser);
|
|
|
+// tbExamInvigilateUserService.save(tbExamInvigilateUser);
|
|
|
tbExamInvigilateUserList.add(tbExamInvigilateUser);
|
|
|
count.getAndIncrement();
|
|
|
}
|
|
|
});
|
|
|
+ tbExamInvigilateUserService.saveOrUpdateBatch(tbExamInvigilateUserList);
|
|
|
if (count.get() > 0) {
|
|
|
txtList.add(DateUtil.format(new Date(), timeFormat) + "->创建了" + count + "条考场数据");
|
|
|
}
|
|
@@ -233,6 +220,9 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
Long examId = Long.parseLong(String.valueOf(map.get("examId")));
|
|
|
Long createId = Long.parseLong(String.valueOf(map.get("createId")));
|
|
|
List<String> txtList = (List<String>) map.get("txtList");
|
|
|
+ List<TBUser> tbUserList = new ArrayList<>();
|
|
|
+ List<TBUserRole> tbUserRoleList = new ArrayList<>();
|
|
|
+ List<TBExamInvigilateUser> tbExamInvigilateUserList = new ArrayList<>();
|
|
|
TBTaskHistory tbTaskHistory = (TBTaskHistory) map.get("tbTaskHistory");
|
|
|
String timeFormat = String.valueOf(map.get("timeFormat"));
|
|
|
//保存用户
|
|
@@ -248,9 +238,9 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
List subList = examStudentDtoImportList.subList(min, max);
|
|
|
for (int y = 0; y < subList.size(); y++) {
|
|
|
RoomCodeImportDto roomCodeImportDto = (RoomCodeImportDto) subList.get(y);
|
|
|
- dataVerify(examId, roomCodeImportDto.getTeacher1(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
|
|
|
- dataVerify(examId, roomCodeImportDto.getTeacher2(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
|
|
|
- dataVerify(examId, roomCodeImportDto.getTeacher3(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId);
|
|
|
+ dataVerify(examId, roomCodeImportDto.getTeacher1(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId, tbUserList, tbUserRoleList, tbExamInvigilateUserList);
|
|
|
+ dataVerify(examId, roomCodeImportDto.getTeacher2(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId, tbUserList, tbUserRoleList, tbExamInvigilateUserList);
|
|
|
+ dataVerify(examId, roomCodeImportDto.getTeacher3(), roomCodeImportDto.getRoomCode(), roomCodeImportDto.getRoomName(), orgId, createId, tbUserList, tbUserRoleList, tbExamInvigilateUserList);
|
|
|
}
|
|
|
txtList = this.importProgress(max, min, size, txtList, tbTaskHistory, timeFormat);
|
|
|
if (max == size) {
|
|
@@ -262,6 +252,9 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
max = size;
|
|
|
}
|
|
|
}
|
|
|
+ tbUserService.saveOrUpdateBatch(tbUserList);
|
|
|
+ tbUserRoleService.saveOrUpdateBatch(tbUserRoleList);
|
|
|
+ tbExamInvigilateUserService.saveOrUpdateBatch(tbExamInvigilateUserList);
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
@@ -300,7 +293,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
* @param orgId
|
|
|
* @param createId
|
|
|
*/
|
|
|
- public void dataVerify(Long examId, String userName, String roomCode, String roomName, Long orgId, Long createId) {
|
|
|
+ public void dataVerify(Long examId, String userName, String roomCode, String roomName, Long orgId, Long createId, List<TBUser> tbUserList, List<TBUserRole> tbUserRoleList, List<TBExamInvigilateUser> tbExamInvigilateUserList) {
|
|
|
if (!checkRoomCodeExist(examId, roomCode, orgId)) {
|
|
|
throw new BusinessException("考场代码 " + roomCode + " 不存在");
|
|
|
}
|
|
@@ -312,10 +305,12 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
if (Objects.isNull(tbUser)) {
|
|
|
//新增用户
|
|
|
tbUser = new TBUser(orgId, userName, userName, createId);
|
|
|
- tbUserService.save(tbUser);
|
|
|
+ tbUserList.add(tbUser);
|
|
|
+// tbUserService.save(tbUser);
|
|
|
|
|
|
TBUserRole tbUserRole = new TBUserRole(tbUser.getId(), RoleEnum.INVIGILATE.name());
|
|
|
- tbUserRoleService.save(tbUserRole);
|
|
|
+ tbUserRoleList.add(tbUserRole);
|
|
|
+// tbUserRoleService.save(tbUserRole);
|
|
|
}
|
|
|
QueryWrapper<TBExamInvigilateUser> tbExamInvigilateUserQueryWrapper = new QueryWrapper<>();
|
|
|
tbExamInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getOrgId, orgId)
|
|
@@ -337,7 +332,8 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
|
|
|
} else {
|
|
|
tbExamInvigilateUser.setUserId(tbUser.getId());
|
|
|
}
|
|
|
- tbExamInvigilateUserService.saveOrUpdate(tbExamInvigilateUser);
|
|
|
+// tbExamInvigilateUserService.saveOrUpdate(tbExamInvigilateUser);
|
|
|
+ tbExamInvigilateUserList.add(tbExamInvigilateUser);
|
|
|
}
|
|
|
}
|
|
|
}
|