|
@@ -1335,23 +1335,29 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
ExamTask examTask = examTaskApplyParam.getExamTask();
|
|
|
ExamTaskDetail examTaskDetail = examTaskApplyParam.getExamTaskDetail();
|
|
|
try {
|
|
|
- if (StringUtils.isNotBlank(examTask.getPaperNumber())) {
|
|
|
- QueryWrapper<ExamTask> taskQueryWrapper = new QueryWrapper<>();
|
|
|
- taskQueryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getPaperNumber, examTask.getPaperNumber());
|
|
|
- ExamTask task = this.getOne(taskQueryWrapper);
|
|
|
- if (task != null && Objects.nonNull(examTask.getId()) && examTask.getId().longValue() != task.getId().longValue()) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("试卷编号已存在");
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 试卷编号生成规则:年月日(例如:20100419)+0000(例如:0001)顺序编号
|
|
|
- String paperNumber = printCommonService.createPaperNumber(schoolId);
|
|
|
- examTask.setPaperNumber(paperNumber);
|
|
|
- }
|
|
|
-
|
|
|
BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId();
|
|
|
if (basicExamRule == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("通用规则未设置");
|
|
|
}
|
|
|
+
|
|
|
+ if(Objects.isNull(examTask.getId())) {
|
|
|
+ if (StringUtils.isNotBlank(examTask.getPaperNumber())) {
|
|
|
+ QueryWrapper<ExamTask> taskQueryWrapper = new QueryWrapper<>();
|
|
|
+ taskQueryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getPaperNumber, examTask.getPaperNumber());
|
|
|
+ ExamTask task = this.getOne(taskQueryWrapper);
|
|
|
+ if (task != null && Objects.nonNull(examTask.getId()) && examTask.getId().longValue() != task.getId().longValue()) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷编号已存在");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 试卷编号生成规则:年月日(例如:20100419)+0000(例如:0001)顺序编号
|
|
|
+ String paperNumber = printCommonService.createPaperNumber(schoolId);
|
|
|
+ examTask.setPaperNumber(paperNumber);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ExamTask task = this.getById(examTask.getId());
|
|
|
+ examTask.setFlowId(task.getFlowId());
|
|
|
+ }
|
|
|
+
|
|
|
examTask.setId(Objects.isNull(examTask.getId()) ? SystemConstant.getDbUuid() : examTask.getId());
|
|
|
examTask.setSchoolId(schoolId);
|
|
|
examTask.setOrgId(sysUser.getOrgId());
|
|
@@ -1375,7 +1381,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
// 提交时,校验
|
|
|
if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType())) {
|
|
|
-
|
|
|
if (Objects.nonNull(examTask.getFlowId())) {
|
|
|
// 审核一级
|
|
|
Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
|
|
@@ -1439,6 +1444,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
|
|
|
} else {
|
|
|
// 已曝光试卷和未曝光试卷赋值(新增时,已曝光试卷为null,未曝光试卷为paper_type)
|
|
|
+ examTaskDetail.setId(SystemConstant.getDbUuid());
|
|
|
examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
|
|
|
}
|
|
|
examTaskDetail.setExamTaskId(examTask.getId());
|