|
@@ -1731,15 +1731,32 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examPrintPlan.setStatus(PrintPlanStatusEnum.READY);
|
|
|
examPrintPlanService.save(examPrintPlan);
|
|
|
|
|
|
+ // 查询考试+课程下已用过的班级
|
|
|
+ List<String> usedClassIds = new ArrayList<>();
|
|
|
+ List<ExamDetailCourse> examDetailCourseList = examDetailService.listByExamIdAndCourseCode(schoolId, examTask.getExamId(), examTask.getCourseCode());
|
|
|
+ if (!CollectionUtils.isEmpty(examDetailCourseList)) {
|
|
|
+ examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzId())).forEach(m -> {
|
|
|
+ usedClassIds.addAll(Arrays.asList(m.getClazzId().split(",")));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 已使用过的班级集合(报错用)
|
|
|
+ List<String> errorClassIds = new ArrayList<>();
|
|
|
+
|
|
|
String paperNumber = examTask.getPaperNumber();
|
|
|
if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel())) {
|
|
|
List<ExamDetailList> examDetailLists = JSONObject.parseArray(JSONObject.toJSONString(examDetailParams.getList()), ExamDetailList.class);
|
|
|
- int i = 1;
|
|
|
for (ExamDetailList examDetailList : examDetailLists) {
|
|
|
int count = examDetailList.getStudentCount();
|
|
|
String clazzName = examDetailList.getClassName();
|
|
|
if (count == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("选择的考试班级【" + clazzName + "】下无学生,请确认该班级学生信息。");
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("选择的考试班级【" + clazzName + "】下无学生,请确认该班级学生信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String s : examDetailList.getClassId().split(",")) {
|
|
|
+ if (usedClassIds.contains(s)) {
|
|
|
+ errorClassIds.add(s);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
SerialNumberParams serialNumberParams = new SerialNumberParams("packageCode-" + schoolId, "1", 6);
|
|
@@ -1796,9 +1813,15 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
updateWrapper.lambda().set(ExamDetailCourse::getTotalSubjects, studentCount).eq(ExamDetailCourse::getId, examDetailCourse.getId());
|
|
|
examDetailCourseService.update(updateWrapper);
|
|
|
}
|
|
|
- i++;
|
|
|
}
|
|
|
} else if (ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
|
|
|
+ if (StringUtils.isNotBlank(examDetailParams.getClassId())) {
|
|
|
+ for (String s : examDetailParams.getClassId().split(",")) {
|
|
|
+ if (usedClassIds.contains(s)) {
|
|
|
+ errorClassIds.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
SerialNumberParams serialNumberParams = new SerialNumberParams("packageCode-" + schoolId, "1", 6);
|
|
|
ExamDetail examDetail = new ExamDetail();
|
|
|
examDetail.setId(SystemConstant.getDbUuid());
|
|
@@ -1830,10 +1853,17 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examDetailCourse.setCourseCode(examTask.getCourseCode());
|
|
|
examDetailCourse.setCourseName(examTask.getCourseName());
|
|
|
examDetailCourse.setPaperNumber(paperNumber);
|
|
|
+ examDetailCourse.setClazzId(examDetailParams.getClassId());
|
|
|
examDetailCourse.setTotalSubjects(examDetailParams.getTotalSubjects());
|
|
|
examDetailCourse.setCreateId(sysUser.getId());
|
|
|
examDetailCourseService.save(examDetailCourse);
|
|
|
}
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(errorClassIds)) {
|
|
|
+ List<BasicClazz> basicClazzList = basicClazzService.listByIds(errorClassIds);
|
|
|
+ String clazzNames = basicClazzList.stream().map(m -> m.getClazzName()).collect(Collectors.joining(","));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考试对象[" + clazzNames + "]已被其它人占用");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (Objects.nonNull(examTask.getFlowId())) {
|