|
@@ -63,6 +63,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import javax.websocket.RemoteEndpoint;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -635,11 +636,11 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public IPage<ExamTaskDto> listTaskApply(Long semesterId, Long examId, String auditStatus,Long openCollegeId, Long courseId, String paperNumber, Long startTime, Long endTime, String userName, Integer pageNumber, Integer pageSize) {
|
|
|
|
|
|
+ public IPage<ExamTaskDto> listTaskApply(Long semesterId, Long examId, String auditStatus, Long openCollegeId, Long courseId, String paperNumber, Long startTime, Long endTime, String userName, Integer pageNumber, Integer pageSize) {
|
|
userName = SystemConstant.translateSpecificSign(userName);
|
|
userName = SystemConstant.translateSpecificSign(userName);
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
- IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskApply(new Page<>(pageNumber, pageSize), schoolId, semesterId, examId, auditStatus,openCollegeId, courseId, paperNumber, startTime, endTime, sysUser.getId(), userName);
|
|
|
|
|
|
+ IPage<ExamTaskDto> examTaskDtoIPage = this.baseMapper.listTaskApply(new Page<>(pageNumber, pageSize), schoolId, semesterId, examId, auditStatus, openCollegeId, courseId, paperNumber, startTime, endTime, sysUser.getId(), userName);
|
|
for (ExamTaskDto record : examTaskDtoIPage.getRecords()) {
|
|
for (ExamTaskDto record : examTaskDtoIPage.getRecords()) {
|
|
if ((Objects.nonNull(record.getReview()) && record.getReview() && FlowStatusEnum.FINISH.name().equals(record.getAuditStatus()) && !ExamModelEnum.MODEL3.equals(record.getExamModel()))) {
|
|
if ((Objects.nonNull(record.getReview()) && record.getReview() && FlowStatusEnum.FINISH.name().equals(record.getAuditStatus()) && !ExamModelEnum.MODEL3.equals(record.getExamModel()))) {
|
|
record.setApproveFormStatus(true);
|
|
record.setApproveFormStatus(true);
|
|
@@ -660,7 +661,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public IPage<ExamTaskDto> listTaskReviewAudited(Long semesterId, Long examId,Long openCollegeId, Long courseId, String
|
|
|
|
|
|
+ public IPage<ExamTaskDto> listTaskReviewAudited(Long semesterId, Long examId, Long openCollegeId, Long courseId, String
|
|
paperNumber, Long userId, Long startTime, Long endTime, Long startCreateTime, Long endCreateTime, Integer pageNumber, Integer pageSize) {
|
|
paperNumber, Long userId, Long startTime, Long endTime, Long startCreateTime, Long endCreateTime, Integer pageNumber, Integer pageSize) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
@@ -670,7 +671,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public IPage<ExamTaskDetailDto> listTaskPaper(Long semesterId, Long examId,Long openCollegeId, Long courseId, String paperNumber, Long startTime, Long endTime, Integer pageNumber, Integer pageSize) {
|
|
|
|
|
|
+ public IPage<ExamTaskDetailDto> listTaskPaper(Long semesterId, Long examId, Long openCollegeId, Long courseId, String paperNumber, Long startTime, Long endTime, Integer pageNumber, Integer pageSize) {
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
boolean containsQuestionTeacher = false;
|
|
boolean containsQuestionTeacher = false;
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
@@ -743,6 +744,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
.set(ExamTask::getUpdateTime, System.currentTimeMillis())
|
|
.set(ExamTask::getUpdateTime, System.currentTimeMillis())
|
|
.set(ExamTask::getReviewStatus, null)
|
|
.set(ExamTask::getReviewStatus, null)
|
|
.set(ExamTask::getFlowId, examTask.getFlowId())
|
|
.set(ExamTask::getFlowId, examTask.getFlowId())
|
|
|
|
+ .set(ExamTask::getExamTaskContent, examTaskDetail.getExamTaskContent())
|
|
.eq(ExamTask::getId, examTask.getId());
|
|
.eq(ExamTask::getId, examTask.getId());
|
|
this.update(updateWrapper);
|
|
this.update(updateWrapper);
|
|
|
|
|
|
@@ -769,11 +771,47 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
}
|
|
}
|
|
examTaskDetail.setUpdateId(sysUser.getId());
|
|
examTaskDetail.setUpdateId(sysUser.getId());
|
|
examTaskDetail.setUpdateTime(System.currentTimeMillis());
|
|
examTaskDetail.setUpdateTime(System.currentTimeMillis());
|
|
|
|
+
|
|
|
|
+ List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList(null);
|
|
|
|
+ for (PaperInfoVo paperInfoVo : filePathVoList) {
|
|
|
|
+ BasicAttachment basicAttachment = basicAttachmentService.getById(paperInfoVo.getAttachmentId());
|
|
|
|
+ FilePathVo filePathVo = JSON.parseObject(basicAttachment.getPath(), FilePathVo.class);
|
|
|
|
+ InputStream inputStream = fileUploadService.downloadFile(filePathVo.getPath(), filePathVo.getUploadType(), filePathVo.getType());
|
|
|
|
+ List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertPdfToJpg(Long.valueOf(paperInfoVo.getAttachmentId()), inputStream, sysUser.getId());
|
|
|
|
+ if (convertJpgStorageList.size() > 0) {
|
|
|
|
+ paperInfoVo.setJpgAttachmentId(JSON.toJSONString(convertJpgStorageList));
|
|
|
|
+ } else {
|
|
|
|
+ paperInfoVo.setJpgAttachmentId(null);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(filePathVoList));
|
|
examTaskDetailService.saveOrUpdate(examTaskDetail);
|
|
examTaskDetailService.saveOrUpdate(examTaskDetail);
|
|
|
|
|
|
// 将题卡更新为已绑定
|
|
// 将题卡更新为已绑定
|
|
List<PaperInfoVo> paperAttachmentList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
|
|
List<PaperInfoVo> paperAttachmentList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetail.getPaperAttachmentIds());
|
|
examCardService.updateUsedById(paperAttachmentList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
|
|
examCardService.updateUsedById(paperAttachmentList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
|
|
|
|
+
|
|
|
|
+ ExamTaskSubmitContent examTaskSubmitContent = JSON.parseObject(examTaskDetail.getExamTaskContent(), ExamTaskSubmitContent.class);
|
|
|
|
+ if (examTaskSubmitContent != null) {
|
|
|
|
+ List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.listExamDetailByExamIdAndPaperNumber(sysUser.getSchoolId(), examTask.getExamId(), examTask.getPaperNumber());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(examDetailCourseList)) {
|
|
|
|
+ Set<Long> examDetailIds = examDetailCourseList.stream().map(ExamDetailCourse::getExamDetailId).collect(Collectors.toSet());
|
|
|
|
+ List<ExamDetail> examDetailList = examDetailService.listByIds(examDetailIds);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(examDetailList)) {
|
|
|
|
+ // 删除原考场
|
|
|
|
+ examDetailService.removeByIds(examDetailIds);
|
|
|
|
+ }
|
|
|
|
+ examDetailCourseService.removeByIds(examDetailCourseList.stream().map(ExamDetailCourse::getId).collect(Collectors.toList()));
|
|
|
|
+ // 删除原考生
|
|
|
|
+ examDetailCourseList.forEach(m -> examStudentService.removeByExamDetailCourseId(m.getId()));
|
|
|
|
+
|
|
|
|
+ BasicExam basicExam = basicExamService.getById(examTask.getExamId());
|
|
|
|
+ ExamPrintPlan examPrintPlan = examPrintPlanService.getById(examDetailList.get(0).getPrintPlanId());
|
|
|
|
+ // 新增考场、考生
|
|
|
|
+ this.addExamDetailAndStudent(examTask, basicExam, examTaskSubmitContent.getExamDetail(), examPrintPlan, sysUser);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1077,7 +1115,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
examTask.setStatus(ExamStatusEnum.SUBMIT);
|
|
examTask.setStatus(ExamStatusEnum.SUBMIT);
|
|
examTask.setSource(ExamTaskSourceEnum.SELF);
|
|
examTask.setSource(ExamTaskSourceEnum.SELF);
|
|
examTask.insertInfo(sysUser.getId());
|
|
examTask.insertInfo(sysUser.getId());
|
|
- examTask.setExamTaskContent(JSON.toJSONString(examTaskSubmitPram));
|
|
|
|
|
|
+ examTask.setExamTaskContent(examTaskSubmitPram.getExamTaskContent());
|
|
|
|
|
|
if (Objects.isNull(examTask.getFlowId())) {
|
|
if (Objects.isNull(examTask.getFlowId())) {
|
|
if (Objects.nonNull(basicPrintConfig.getReview()) && basicPrintConfig.getReview()) {
|
|
if (Objects.nonNull(basicPrintConfig.getReview()) && basicPrintConfig.getReview()) {
|
|
@@ -1103,7 +1141,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList(null);
|
|
List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList(null);
|
|
for (PaperInfoVo paperInfoVo : filePathVoList) {
|
|
for (PaperInfoVo paperInfoVo : filePathVoList) {
|
|
BasicAttachment basicAttachment = basicAttachmentService.getById(paperInfoVo.getAttachmentId());
|
|
BasicAttachment basicAttachment = basicAttachmentService.getById(paperInfoVo.getAttachmentId());
|
|
- FilePathVo filePathVo = JSON.parseObject(basicAttachment.getPath(), FilePathVo.class);
|
|
|
|
|
|
+ FilePathVo filePathVo = JSON.parseObject(basicAttachment.getPath(), FilePathVo.class);
|
|
InputStream inputStream = fileUploadService.downloadFile(filePathVo.getPath(), filePathVo.getUploadType(), filePathVo.getType());
|
|
InputStream inputStream = fileUploadService.downloadFile(filePathVo.getPath(), filePathVo.getUploadType(), filePathVo.getType());
|
|
List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertPdfToJpg(Long.valueOf(paperInfoVo.getAttachmentId()), inputStream, sysUser.getId());
|
|
List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertPdfToJpg(Long.valueOf(paperInfoVo.getAttachmentId()), inputStream, sysUser.getId());
|
|
if (convertJpgStorageList.size() > 0) {
|
|
if (convertJpgStorageList.size() > 0) {
|
|
@@ -1142,7 +1180,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
BasicExam basicExam = basicExamService.getById(examTask.getExamId());
|
|
BasicExam basicExam = basicExamService.getById(examTask.getExamId());
|
|
if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel()) || ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
|
|
if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel()) || ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
|
|
// 创建印刷计划
|
|
// 创建印刷计划
|
|
- ExamDetailParams examDetailParams = examTaskSubmitContent.getExamDetail();
|
|
|
|
ExamPrintPlan examPrintPlan = new ExamPrintPlan();
|
|
ExamPrintPlan examPrintPlan = new ExamPrintPlan();
|
|
examPrintPlan.insertInfo(sysUser.getId());
|
|
examPrintPlan.insertInfo(sysUser.getId());
|
|
examPrintPlan.setSchoolId(schoolId);
|
|
examPrintPlan.setSchoolId(schoolId);
|
|
@@ -1172,171 +1209,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
examPrintPlan.setStatus(PrintPlanStatusEnum.READY);
|
|
examPrintPlan.setStatus(PrintPlanStatusEnum.READY);
|
|
examPrintPlanService.save(examPrintPlan);
|
|
examPrintPlanService.save(examPrintPlan);
|
|
|
|
|
|
- List<ExamDetailCourseDto> examDetailCourseList = examDetailService.listByExamIdAndCourseId(schoolId, examTask.getExamId(), examTask.getCourseId());
|
|
|
|
-
|
|
|
|
- // 查询考试+课程下已用过的班级
|
|
|
|
- Map<Long, String> basicStudentIdUserMap = new HashMap<>();
|
|
|
|
-
|
|
|
|
- String paperNumber = examTask.getPaperNumber();
|
|
|
|
- if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel())) {
|
|
|
|
- for (ExamDetailList examDetailList : examDetailParams.getList()) {
|
|
|
|
- int count = examDetailList.getStudentCount();
|
|
|
|
- String className = examDetailList.getClassName();
|
|
|
|
- if (count == 0) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("选择的考试对象[" + className + "]下没有考生");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!CollectionUtils.isEmpty(examDetailCourseList)) {
|
|
|
|
- examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).forEach(m -> {
|
|
|
|
- examStudentService.listStudentByExamDetailCourseId(m.getId()).stream().filter(t -> t.getBasicStudentId() != null).forEach(s -> basicStudentIdUserMap.put(s.getBasicStudentId(), String.format("%s(%s)", m.getRealName(), m.getLoginName())));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 校验班级或班级内考生是否已命题
|
|
|
|
- List<Long> examTaskStudentObjectParamList = examDetailList.getExamTaskStudentObjectParamListIds();
|
|
|
|
- if (MapUtils.isNotEmpty(basicStudentIdUserMap)) {
|
|
|
|
- examTaskStudentObjectParamList.forEach(i -> {
|
|
|
|
- if (basicStudentIdUserMap.containsKey(i)) {
|
|
|
|
- BasicExamStudent basicExamStudent = basicExamStudentService.getById(i);
|
|
|
|
- if (basicExamStudent != null) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("教学班[" + basicExamStudent.getTeachClassName() + "]内有考生已被[" + basicStudentIdUserMap.get(i) + "]选择");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ExamDetail examDetail = new ExamDetail();
|
|
|
|
- examDetail.setId(SystemConstant.getDbUuid());
|
|
|
|
- examDetail.setPackageCode("1" + redisCounterUtil.getCounter(schoolId, 6, "packageCode"));
|
|
|
|
- examDetail.setSchoolId(schoolId);
|
|
|
|
- examDetail.setOrgId(sysUser.getOrgId());
|
|
|
|
- examDetail.setPrintPlanId(examPrintPlan.getId());
|
|
|
|
- examDetail.setExamId(examPrintPlan.getExamId());
|
|
|
|
- examDetail.setPrintPlanName(examPrintPlan.getName());
|
|
|
|
- examDetail.setExamPlace(examDetailList.getExamPlace()); // 无默认值
|
|
|
|
- examDetail.setExamRoom(examDetailList.getExamRoom()); // 无默认值
|
|
|
|
- examDetail.setStatus(ExamDetailStatusEnum.NEW);
|
|
|
|
- if (!ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
|
|
|
|
- examDetail.setExamStartTime(examDetailList.getExamStartTime());
|
|
|
|
- examDetail.setExamEndTime(examDetailList.getExamEndTime());
|
|
|
|
- }
|
|
|
|
- examDetail.setTotalSubjects(count);
|
|
|
|
- examDetail.setExamDataSource(ExamDataSourceEnum.EXAM_TASK);
|
|
|
|
- examDetail.setNormal(true);
|
|
|
|
- examDetail.setPrintHouseId(examDetailList.getPrintHouseId());
|
|
|
|
- examDetail.setBackupCount(examDetailList.getBackupCount());
|
|
|
|
- examDetail.setCreateId(sysUser.getId());
|
|
|
|
- examDetail.setCreateTime(System.currentTimeMillis());
|
|
|
|
- examDetailService.save(examDetail);
|
|
|
|
-
|
|
|
|
- ExamDetailCourse examDetailCourse = new ExamDetailCourse();
|
|
|
|
- examDetailCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
- examDetailCourse.setSchoolId(schoolId);
|
|
|
|
- examDetailCourse.setExamDetailId(examDetail.getId());
|
|
|
|
- examDetailCourse.setCourseId(examTask.getCourseId());
|
|
|
|
- examDetailCourse.setPaperNumber(paperNumber);
|
|
|
|
- examDetailCourse.setCoursePaperId(String.valueOf(examTask.getId()));
|
|
|
|
- examDetailCourse.setClazzName(examDetailList.getClassName());
|
|
|
|
- examDetailCourse.setTotalSubjects(examDetailList.getStudentCount());
|
|
|
|
- examDetailCourse.setCreateId(sysUser.getId());
|
|
|
|
- examDetailCourseService.save(examDetailCourse);
|
|
|
|
-
|
|
|
|
- // 更新实际考生数量
|
|
|
|
- List<ExamStudent> examStudents = examStudentService.saveStudentForExamApply(examTask, examDetailList.getExtendFields(), examTaskStudentObjectParamList, examDetailCourse.getId(), sysUser);
|
|
|
|
-
|
|
|
|
- if (!CollectionUtils.isEmpty(examStudents)) {
|
|
|
|
- examStudentService.saveBatch(examStudents);
|
|
|
|
- }
|
|
|
|
- int studentCount = examStudents.size();
|
|
|
|
-
|
|
|
|
- if (studentCount - examDetail.getTotalSubjects() != 0) {
|
|
|
|
- UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
|
- updateWrapper.lambda().set(ExamDetail::getTotalSubjects, studentCount).eq(ExamDetail::getId, examDetail.getId());
|
|
|
|
- examDetailService.update(updateWrapper);
|
|
|
|
- }
|
|
|
|
- if (studentCount - examDetailCourse.getTotalSubjects() != 0) {
|
|
|
|
- UpdateWrapper<ExamDetailCourse> updateWrapper = new UpdateWrapper<>();
|
|
|
|
- updateWrapper.lambda().set(ExamDetailCourse::getTotalSubjects, studentCount).eq(ExamDetailCourse::getId, examDetailCourse.getId());
|
|
|
|
- examDetailCourseService.update(updateWrapper);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if (ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
|
|
|
|
- // 查询考试+课程下已用过的班级
|
|
|
|
- Map<String, String> usedClassNameMap = new HashMap<>();
|
|
|
|
- if (!CollectionUtils.isEmpty(examDetailCourseList)) {
|
|
|
|
- examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).forEach(m -> {
|
|
|
|
- for (String className : m.getClazzName().split(",")) {
|
|
|
|
- usedClassNameMap.put(className, String.format("%s(%s)", m.getRealName(), m.getLoginName()));
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<String> errorClassNames = new ArrayList<>();
|
|
|
|
- if (StringUtils.isNotBlank(examDetailParams.getClassName()) && MapUtils.isNotEmpty(usedClassNameMap)) {
|
|
|
|
- for (String s : examDetailParams.getClassName().split(",")) {
|
|
|
|
- if (usedClassNameMap.containsKey(s)) {
|
|
|
|
- errorClassNames.add(s);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 选择学生时,不校验
|
|
|
|
- boolean containsPrivilege = teachcloudCommonService.containsPrivilege(sysUser.getId(), "button", "SelectStudent");
|
|
|
|
- if (!containsPrivilege || ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
|
|
|
|
- Map<String, Set<String>> finalMap = new HashMap<>();
|
|
|
|
- StringJoiner stringJoiner = new StringJoiner(",");
|
|
|
|
- for (String errorClassName : errorClassNames) {
|
|
|
|
- String key = usedClassNameMap.get(errorClassName);
|
|
|
|
- Set<String> value;
|
|
|
|
- if (finalMap.containsKey(key)) {
|
|
|
|
- value = finalMap.get(key);
|
|
|
|
- } else {
|
|
|
|
- value = new HashSet<>();
|
|
|
|
- }
|
|
|
|
- value.add(errorClassName);
|
|
|
|
- finalMap.put(key, value);
|
|
|
|
- }
|
|
|
|
- for (Map.Entry<String, Set<String>> entry : finalMap.entrySet()) {
|
|
|
|
- stringJoiner.add("考试对象[" + String.join(",", entry.getValue()) + "]已被[" + entry.getKey() + "]选择");
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isNotBlank(stringJoiner.toString())) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception(stringJoiner.toString());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ExamDetail examDetail = new ExamDetail();
|
|
|
|
- examDetail.setId(SystemConstant.getDbUuid());
|
|
|
|
- examDetail.setPackageCode("1" + redisCounterUtil.getCounter(schoolId, 6, "packageCode"));
|
|
|
|
- examDetail.setSchoolId(schoolId);
|
|
|
|
- examDetail.setOrgId(sysUser.getOrgId());
|
|
|
|
- examDetail.setPrintPlanId(examPrintPlan.getId());
|
|
|
|
- examDetail.setPrintPlanName(examPrintPlan.getName());
|
|
|
|
- examDetail.setExamId(examPrintPlan.getExamId());
|
|
|
|
- examDetail.setStatus(ExamDetailStatusEnum.NEW);
|
|
|
|
- if (!ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
|
|
|
|
- examDetail.setExamStartTime(examDetailParams.getExamStartTime());
|
|
|
|
- examDetail.setExamEndTime(examDetailParams.getExamEndTime());
|
|
|
|
- }
|
|
|
|
- examDetail.setTotalSubjects(examDetailParams.getTotalSubjects());
|
|
|
|
- examDetail.setExamDataSource(ExamDataSourceEnum.EXAM_TASK);
|
|
|
|
- examDetail.setNormal(true);
|
|
|
|
- examDetail.setPrintHouseId(examDetailParams.getPrintHouseId());
|
|
|
|
- examDetail.setBackupCount(examDetailParams.getBackupCount());
|
|
|
|
- examDetail.setCreateId(sysUser.getId());
|
|
|
|
- examDetail.setCreateTime(System.currentTimeMillis());
|
|
|
|
- examDetailService.save(examDetail);
|
|
|
|
-
|
|
|
|
- ExamDetailCourse examDetailCourse = new ExamDetailCourse();
|
|
|
|
- examDetailCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
- examDetailCourse.setSchoolId(schoolId);
|
|
|
|
- examDetailCourse.setExamDetailId(examDetail.getId());
|
|
|
|
- examDetailCourse.setCourseId(examTask.getCourseId());
|
|
|
|
- examDetailCourse.setPaperNumber(paperNumber);
|
|
|
|
- examDetailCourse.setClazzName(examDetailParams.getClassName());
|
|
|
|
- examDetailCourse.setTotalSubjects(examDetailParams.getTotalSubjects());
|
|
|
|
- examDetailCourse.setCreateId(sysUser.getId());
|
|
|
|
- examDetailCourseService.save(examDetailCourse);
|
|
|
|
- }
|
|
|
|
|
|
+ // 保存考场、考生
|
|
|
|
+ this.addExamDetailAndStudent(examTask, basicExam, examTaskSubmitContent.getExamDetail(), examPrintPlan, sysUser);
|
|
}
|
|
}
|
|
|
|
|
|
if (Objects.nonNull(examTask.getFlowId())) {
|
|
if (Objects.nonNull(examTask.getFlowId())) {
|
|
@@ -1367,6 +1241,175 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void addExamDetailAndStudent(ExamTask examTask, BasicExam basicExam, ExamDetailParams examDetailParams, ExamPrintPlan examPrintPlan, SysUser sysUser) {
|
|
|
|
+ Long schoolId = sysUser.getSchoolId();
|
|
|
|
+ List<ExamDetailCourseDto> examDetailCourseList = examDetailService.listByExamIdAndCourseId(schoolId, examTask.getExamId(), examTask.getCourseId());
|
|
|
|
+
|
|
|
|
+ // 查询考试+课程下已用过的班级
|
|
|
|
+ Map<Long, String> basicStudentIdUserMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ String paperNumber = examTask.getPaperNumber();
|
|
|
|
+ if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel())) {
|
|
|
|
+ for (ExamDetailList examDetailList : examDetailParams.getList()) {
|
|
|
|
+ int count = examDetailList.getStudentCount();
|
|
|
|
+ String className = examDetailList.getClassName();
|
|
|
|
+ if (count == 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("选择的考试对象[" + className + "]下没有考生");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtils.isEmpty(examDetailCourseList)) {
|
|
|
|
+ examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).forEach(m -> {
|
|
|
|
+ examStudentService.listStudentByExamDetailCourseId(m.getId()).stream().filter(t -> t.getBasicStudentId() != null).forEach(s -> basicStudentIdUserMap.put(s.getBasicStudentId(), String.format("%s(%s)", m.getRealName(), m.getLoginName())));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 校验班级或班级内考生是否已命题
|
|
|
|
+ List<Long> examTaskStudentObjectParamList = examDetailList.getExamTaskStudentObjectParamListIds();
|
|
|
|
+ if (MapUtils.isNotEmpty(basicStudentIdUserMap)) {
|
|
|
|
+ examTaskStudentObjectParamList.forEach(i -> {
|
|
|
|
+ if (basicStudentIdUserMap.containsKey(i)) {
|
|
|
|
+ BasicExamStudent basicExamStudent = basicExamStudentService.getById(i);
|
|
|
|
+ if (basicExamStudent != null) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("教学班[" + basicExamStudent.getTeachClassName() + "]内有考生已被[" + basicStudentIdUserMap.get(i) + "]选择");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ExamDetail examDetail = new ExamDetail();
|
|
|
|
+ examDetail.setId(SystemConstant.getDbUuid());
|
|
|
|
+ examDetail.setPackageCode("1" + redisCounterUtil.getCounter(schoolId, 6, "packageCode"));
|
|
|
|
+ examDetail.setSchoolId(schoolId);
|
|
|
|
+ examDetail.setOrgId(sysUser.getOrgId());
|
|
|
|
+ examDetail.setPrintPlanId(examPrintPlan.getId());
|
|
|
|
+ examDetail.setExamId(examPrintPlan.getExamId());
|
|
|
|
+ examDetail.setPrintPlanName(examPrintPlan.getName());
|
|
|
|
+ examDetail.setExamPlace(examDetailList.getExamPlace()); // 无默认值
|
|
|
|
+ examDetail.setExamRoom(examDetailList.getExamRoom()); // 无默认值
|
|
|
|
+ examDetail.setStatus(ExamDetailStatusEnum.NEW);
|
|
|
|
+ if (!ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
|
|
|
|
+ examDetail.setExamStartTime(examDetailList.getExamStartTime());
|
|
|
|
+ examDetail.setExamEndTime(examDetailList.getExamEndTime());
|
|
|
|
+ }
|
|
|
|
+ examDetail.setTotalSubjects(count);
|
|
|
|
+ examDetail.setExamDataSource(ExamDataSourceEnum.EXAM_TASK);
|
|
|
|
+ examDetail.setNormal(true);
|
|
|
|
+ examDetail.setPrintHouseId(examDetailList.getPrintHouseId());
|
|
|
|
+ examDetail.setBackupCount(examDetailList.getBackupCount());
|
|
|
|
+ examDetail.setCreateId(sysUser.getId());
|
|
|
|
+ examDetail.setCreateTime(System.currentTimeMillis());
|
|
|
|
+ examDetailService.save(examDetail);
|
|
|
|
+
|
|
|
|
+ ExamDetailCourse examDetailCourse = new ExamDetailCourse();
|
|
|
|
+ examDetailCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
+ examDetailCourse.setSchoolId(schoolId);
|
|
|
|
+ examDetailCourse.setExamDetailId(examDetail.getId());
|
|
|
|
+ examDetailCourse.setCourseId(examTask.getCourseId());
|
|
|
|
+ examDetailCourse.setPaperNumber(paperNumber);
|
|
|
|
+ examDetailCourse.setCoursePaperId(String.valueOf(examTask.getId()));
|
|
|
|
+ examDetailCourse.setClazzName(examDetailList.getClassName());
|
|
|
|
+ examDetailCourse.setTotalSubjects(examDetailList.getStudentCount());
|
|
|
|
+ examDetailCourse.setCreateId(sysUser.getId());
|
|
|
|
+ examDetailCourseService.save(examDetailCourse);
|
|
|
|
+
|
|
|
|
+ // 更新实际考生数量
|
|
|
|
+ List<ExamStudent> examStudents = examStudentService.saveStudentForExamApply(examTask, examDetailList.getExtendFields(), examTaskStudentObjectParamList, examDetailCourse.getId(), sysUser);
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtils.isEmpty(examStudents)) {
|
|
|
|
+ examStudentService.saveBatch(examStudents);
|
|
|
|
+ }
|
|
|
|
+ int studentCount = examStudents.size();
|
|
|
|
+
|
|
|
|
+ if (studentCount - examDetail.getTotalSubjects() != 0) {
|
|
|
|
+ UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(ExamDetail::getTotalSubjects, studentCount).eq(ExamDetail::getId, examDetail.getId());
|
|
|
|
+ examDetailService.update(updateWrapper);
|
|
|
|
+ }
|
|
|
|
+ if (studentCount - examDetailCourse.getTotalSubjects() != 0) {
|
|
|
|
+ UpdateWrapper<ExamDetailCourse> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(ExamDetailCourse::getTotalSubjects, studentCount).eq(ExamDetailCourse::getId, examDetailCourse.getId());
|
|
|
|
+ examDetailCourseService.update(updateWrapper);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
|
|
|
|
+ // 查询考试+课程下已用过的班级
|
|
|
|
+ Map<String, String> usedClassNameMap = new HashMap<>();
|
|
|
|
+ if (!CollectionUtils.isEmpty(examDetailCourseList)) {
|
|
|
|
+ examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzName())).forEach(m -> {
|
|
|
|
+ for (String className : m.getClazzName().split(",")) {
|
|
|
|
+ usedClassNameMap.put(className, String.format("%s(%s)", m.getRealName(), m.getLoginName()));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> errorClassNames = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isNotBlank(examDetailParams.getClassName()) && MapUtils.isNotEmpty(usedClassNameMap)) {
|
|
|
|
+ for (String s : examDetailParams.getClassName().split(",")) {
|
|
|
|
+ if (usedClassNameMap.containsKey(s)) {
|
|
|
|
+ errorClassNames.add(s);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 选择学生时,不校验
|
|
|
|
+ boolean containsPrivilege = teachcloudCommonService.containsPrivilege(sysUser.getId(), "button", "SelectStudent");
|
|
|
|
+ if (!containsPrivilege || ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
|
|
|
|
+ Map<String, Set<String>> finalMap = new HashMap<>();
|
|
|
|
+ StringJoiner stringJoiner = new StringJoiner(",");
|
|
|
|
+ for (String errorClassName : errorClassNames) {
|
|
|
|
+ String key = usedClassNameMap.get(errorClassName);
|
|
|
|
+ Set<String> value;
|
|
|
|
+ if (finalMap.containsKey(key)) {
|
|
|
|
+ value = finalMap.get(key);
|
|
|
|
+ } else {
|
|
|
|
+ value = new HashSet<>();
|
|
|
|
+ }
|
|
|
|
+ value.add(errorClassName);
|
|
|
|
+ finalMap.put(key, value);
|
|
|
|
+ }
|
|
|
|
+ for (Map.Entry<String, Set<String>> entry : finalMap.entrySet()) {
|
|
|
|
+ stringJoiner.add("考试对象[" + String.join(",", entry.getValue()) + "]已被[" + entry.getKey() + "]选择");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(stringJoiner.toString())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(stringJoiner.toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ExamDetail examDetail = new ExamDetail();
|
|
|
|
+ examDetail.setId(SystemConstant.getDbUuid());
|
|
|
|
+ examDetail.setPackageCode("1" + redisCounterUtil.getCounter(schoolId, 6, "packageCode"));
|
|
|
|
+ examDetail.setSchoolId(schoolId);
|
|
|
|
+ examDetail.setOrgId(sysUser.getOrgId());
|
|
|
|
+ examDetail.setPrintPlanId(examPrintPlan.getId());
|
|
|
|
+ examDetail.setPrintPlanName(examPrintPlan.getName());
|
|
|
|
+ examDetail.setExamId(examPrintPlan.getExamId());
|
|
|
|
+ examDetail.setStatus(ExamDetailStatusEnum.NEW);
|
|
|
|
+ if (!ExamCategoryEnum.REBUILD.equals(basicExam.getCategory())) {
|
|
|
|
+ examDetail.setExamStartTime(examDetailParams.getExamStartTime());
|
|
|
|
+ examDetail.setExamEndTime(examDetailParams.getExamEndTime());
|
|
|
|
+ }
|
|
|
|
+ examDetail.setTotalSubjects(examDetailParams.getTotalSubjects());
|
|
|
|
+ examDetail.setExamDataSource(ExamDataSourceEnum.EXAM_TASK);
|
|
|
|
+ examDetail.setNormal(true);
|
|
|
|
+ examDetail.setPrintHouseId(examDetailParams.getPrintHouseId());
|
|
|
|
+ examDetail.setBackupCount(examDetailParams.getBackupCount());
|
|
|
|
+ examDetail.setCreateId(sysUser.getId());
|
|
|
|
+ examDetail.setCreateTime(System.currentTimeMillis());
|
|
|
|
+ examDetailService.save(examDetail);
|
|
|
|
+
|
|
|
|
+ ExamDetailCourse examDetailCourse = new ExamDetailCourse();
|
|
|
|
+ examDetailCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
+ examDetailCourse.setSchoolId(schoolId);
|
|
|
|
+ examDetailCourse.setExamDetailId(examDetail.getId());
|
|
|
|
+ examDetailCourse.setCourseId(examTask.getCourseId());
|
|
|
|
+ examDetailCourse.setPaperNumber(paperNumber);
|
|
|
|
+ examDetailCourse.setClazzName(examDetailParams.getClassName());
|
|
|
|
+ examDetailCourse.setTotalSubjects(examDetailParams.getTotalSubjects());
|
|
|
|
+ examDetailCourse.setCreateId(sysUser.getId());
|
|
|
|
+ examDetailCourseService.save(examDetailCourse);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public ExamTaskApprovalFormDto findExamTaskApprovalForm(Long examTaskId, Long examId, String paperNumber) {
|
|
public ExamTaskApprovalFormDto findExamTaskApprovalForm(Long examTaskId, Long examId, String paperNumber) {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
@@ -1685,10 +1728,10 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
list2 = ExamDetailCourses.stream().map(ExamDetailCourse::getPaperNumber).distinct().collect(Collectors.toList());
|
|
list2 = ExamDetailCourses.stream().map(ExamDetailCourse::getPaperNumber).distinct().collect(Collectors.toList());
|
|
}
|
|
}
|
|
list.addAll(list2);
|
|
list.addAll(list2);
|
|
- return list.stream().filter(m->!m.endsWith("作废")).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ return list.stream().filter(m -> !m.endsWith("作废")).distinct().collect(Collectors.toList());
|
|
} else {
|
|
} else {
|
|
List<String> paperNumberList = examDetailCourseService.listPaperNumberByPrintPlanId(param, printPlanIdList, orgIds);
|
|
List<String> paperNumberList = examDetailCourseService.listPaperNumberByPrintPlanId(param, printPlanIdList, orgIds);
|
|
- return paperNumberList.stream().filter(m->!m.endsWith("作废")).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ return paperNumberList.stream().filter(m -> !m.endsWith("作废")).distinct().collect(Collectors.toList());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|