|
@@ -685,10 +685,10 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
startTime, endTime, dpr, containsQuestionTeacher, sysUser.getId());
|
|
|
for (ExamTaskDetailDto record : examTaskDetailDtoIPage.getRecords()) {
|
|
|
List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(record.getId());
|
|
|
- record.setPaperType(examTaskDetailList.stream().map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
- record.setExposedPaperType(examTaskDetailList.stream().filter(ExamTaskDetail::getExposed).map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
+ record.setPaperType(examTaskDetailList.stream().map(m -> m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
+ record.setExposedPaperType(examTaskDetailList.stream().filter(ExamTaskDetail::getExposed).map(m -> m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
// record.setRelatePaperType(examTaskDetailList.stream().filter(m->m.getExposedExamId() != null).map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
- record.setUnexposedPaperType(examTaskDetailList.stream().filter(m->!m.getExposed()).map(m->m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
+ record.setUnexposedPaperType(examTaskDetailList.stream().filter(m -> !m.getExposed()).map(m -> m.getSerialNumber().toString()).collect(Collectors.joining(",")));
|
|
|
}
|
|
|
return examTaskDetailDtoIPage;
|
|
|
}
|
|
@@ -703,11 +703,10 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
relatePaperDto.setCourseId(examTask.getCourseId());
|
|
|
relatePaperDto.setPaperNumber(examTask.getPaperNumber());
|
|
|
|
|
|
- ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskIdNotValid(examTaskId);
|
|
|
- if (examTaskDetail != null) {
|
|
|
+ List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(examTaskId);
|
|
|
+ if (CollectionUtils.isNotEmpty(examTaskDetailList)) {
|
|
|
// 所有卷型
|
|
|
- String paperType = examTaskDetail.getPaperType();
|
|
|
- relatePaperDto.setPaperTypes(Arrays.asList(paperType.split(",")));
|
|
|
+ relatePaperDto.setPaperTypes(examTaskDetailList.stream().map(ExamTaskDetail::getSerialNumber).collect(Collectors.toList()));
|
|
|
}
|
|
|
list.add(relatePaperDto);
|
|
|
return list;
|
|
@@ -715,30 +714,29 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public Map<String, Object> saveExamTaskDetail(ExamTaskDetail examTaskDetail) {
|
|
|
+ public Map<String, Object> saveExamTaskDetail(ExamTaskApplyPram examTaskApplyPram) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- Optional.ofNullable(examTaskDetail.getExamTaskId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("命题任务ID不能为空"));
|
|
|
+ Optional.ofNullable(examTaskApplyPram.getExamTaskId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("命题任务ID不能为空"));
|
|
|
// 更新examTask状态status
|
|
|
- ExamTask examTask = this.getById(examTaskDetail.getExamTaskId());
|
|
|
+ ExamTask examTask = this.getById(examTaskApplyPram.getExamTaskId());
|
|
|
// 提交时,校验
|
|
|
BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamId(examTask.getExamId());
|
|
|
if (basicPrintConfig == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("印品配置未设置");
|
|
|
}
|
|
|
- validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent(), examTask.getOpenAb());
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
// if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType()) && examTask.getReview()) {
|
|
|
- // 审核一级
|
|
|
- Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
|
|
|
- if (Objects.nonNull(task)) {
|
|
|
- map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
|
|
|
- map.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
|
|
|
- map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> FlowApprovePassEnum.PASS);
|
|
|
- map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskDetail.getApproveUserIds());
|
|
|
- map = activitiService.taskApprove(map);
|
|
|
- map.put(SystemConstant.SEND_FLOW_MQ, true);
|
|
|
- }
|
|
|
+ // 审核一级
|
|
|
+ Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
|
|
|
+ if (Objects.nonNull(task)) {
|
|
|
+ map.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
|
|
|
+// map.computeIfAbsent(SystemConstant.PAPAER_ATTACHMENT_IDS, v -> examTaskDetail.getPaperAttachmentIds());
|
|
|
+ map.computeIfAbsent(SystemConstant.APPROVE_OPERATION, v -> FlowApprovePassEnum.PASS);
|
|
|
+// map.computeIfAbsent(SystemConstant.APPROVE_USER_IDS, v -> examTaskDetail.getApproveUserIds());
|
|
|
+ map = activitiService.taskApprove(map);
|
|
|
+ map.put(SystemConstant.SEND_FLOW_MQ, true);
|
|
|
+ }
|
|
|
// }
|
|
|
|
|
|
UpdateWrapper<ExamTask> updateWrapper = new UpdateWrapper<>();
|
|
@@ -746,56 +744,60 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
// .set(ExamTask::getStatus, examTaskDetail.getOperateType())
|
|
|
.set(ExamTask::getUpdateId, sysUser.getId())
|
|
|
.set(ExamTask::getUpdateTime, System.currentTimeMillis())
|
|
|
- .set(ExamTask::getReviewStatus, null)
|
|
|
- .set(ExamTask::getFlowId, examTask.getFlowId())
|
|
|
- .set(ExamTask::getExamTaskContent, examTaskDetail.getExamTaskContent())
|
|
|
+ .set(ExamTask::getExamTaskContent, examTaskApplyPram.getExamTaskContent())
|
|
|
.eq(ExamTask::getId, examTask.getId());
|
|
|
this.update(updateWrapper);
|
|
|
|
|
|
- ExamTaskDetail detail = examTaskDetailService.getByExamTaskIdNotValid(examTaskDetail.getExamTaskId());
|
|
|
- if (detail != null) {
|
|
|
- examTaskDetail.setId(detail.getId());
|
|
|
- // 已曝光试卷和未曝光试卷赋值
|
|
|
- examTaskDetail.setExposedPaperType(detail.getExposedPaperType());
|
|
|
- if (StringUtils.isNotBlank(detail.getExposedPaperType())) {
|
|
|
- List<String> paperTypeAll = new ArrayList<>(Arrays.asList(examTaskDetail.getPaperType().split(",")));
|
|
|
- List<String> exposePaperTypes = Arrays.asList(detail.getExposedPaperType().split(","));
|
|
|
- for (String exposePaperType : exposePaperTypes) {
|
|
|
- if (paperTypeAll.contains(exposePaperType)) {
|
|
|
- paperTypeAll.remove(exposePaperType);
|
|
|
- }
|
|
|
- }
|
|
|
- examTaskDetail.setUnexposedPaperType(String.join(",", paperTypeAll));
|
|
|
- } else {
|
|
|
- examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
|
|
|
- }
|
|
|
- } else {
|
|
|
+ examTaskDetailService.deleteByExamTaskId(examTaskApplyPram.getExamTaskId());
|
|
|
+ // 新建试卷
|
|
|
+ List<ExamTaskDetail> examTaskDetailList = examTaskApplyPram.getExamTaskDetailList();
|
|
|
+ for (ExamTaskDetail examTaskDetail : examTaskDetailList) {
|
|
|
+ validSubmitParam(examTaskDetail, basicPrintConfig.getPrintContent(), examTask.getOpenAb());
|
|
|
// 已曝光试卷和未曝光试卷赋值(新增时,已曝光试卷为null,未曝光试卷为paper_type)
|
|
|
+ examTaskDetail.setId(SystemConstant.getDbUuid());
|
|
|
examTaskDetail.setUnexposedPaperType(examTaskDetail.getPaperType());
|
|
|
- }
|
|
|
- examTaskDetail.setUpdateId(sysUser.getId());
|
|
|
- examTaskDetail.setUpdateTime(System.currentTimeMillis());
|
|
|
-
|
|
|
- List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList();
|
|
|
- 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.setExamTaskId(examTask.getId());
|
|
|
+ examTaskDetail.insertInfo(sysUser.getId());
|
|
|
+ List<PaperInfoVo> filePathVoList = examTaskDetail.getPaperInfoVoList();
|
|
|
+ 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);
|
|
|
+ examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(filePathVoList));
|
|
|
+ examTaskDetailService.save(examTaskDetail);
|
|
|
|
|
|
- // 将题卡更新为已绑定
|
|
|
- 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()));
|
|
|
-
|
|
|
- ExamTaskSubmitContent examTaskSubmitContent = JSON.parseObject(examTaskDetail.getExamTaskContent(), ExamTaskSubmitContent.class);
|
|
|
+ String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
|
|
|
+ List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(paperAttachmentIds);
|
|
|
+ // 将题卡更新为已绑定
|
|
|
+ examCardService.updateUsedById(paperInfoVoList.stream().filter(m -> StringUtils.isNotBlank(m.getCardId())).map(m -> Long.parseLong(m.getCardId())).collect(Collectors.toList()));
|
|
|
+ // 更新题库试卷表
|
|
|
+ for (PaperInfoVo paperInfoVo : paperInfoVoList) {
|
|
|
+ if (StringUtils.isNotBlank(paperInfoVo.getUuid())) {
|
|
|
+ UpdateWrapper<ExamTaskPaperData> updateWrapper1 = new UpdateWrapper<>();
|
|
|
+ updateWrapper1.lambda().set(ExamTaskPaperData::getPaperNumber, examTask.getPaperNumber())
|
|
|
+ .eq(ExamTaskPaperData::getExamId, examTask.getExamId())
|
|
|
+ .eq(ExamTaskPaperData::getPaperNumber, paperInfoVo.getUuid())
|
|
|
+ .eq(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId())
|
|
|
+ .eq(ExamTaskPaperData::getUuid, paperInfoVo.getUuid());
|
|
|
+ examTaskPaperDataService.update(updateWrapper1);
|
|
|
+
|
|
|
+ // 删除临时数据
|
|
|
+ QueryWrapper<ExamTaskPaperData> deleteWrapper = new QueryWrapper<>();
|
|
|
+ deleteWrapper.lambda().eq(ExamTaskPaperData::getExamId, examTask.getExamId())
|
|
|
+ .eq(ExamTaskPaperData::getPaperNumber, paperInfoVo.getUuid())
|
|
|
+ .ne(ExamTaskPaperData::getPaperId, paperInfoVo.getPaperId());
|
|
|
+ examTaskPaperDataService.remove(deleteWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExamTaskSubmitContent examTaskSubmitContent = JSON.parseObject(examTaskApplyPram.getExamTaskContent(), ExamTaskSubmitContent.class);
|
|
|
if (examTaskSubmitContent != null) {
|
|
|
List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.listByExamIdAndPaperNumber(examTask.getExamId(), examTask.getPaperNumber());
|
|
|
if (CollectionUtils.isNotEmpty(examDetailCourseList)) {
|
|
@@ -1044,8 +1046,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public void removeByExamTaskId(Long examTaskId) {
|
|
|
- ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskIdNotValid(examTaskId);
|
|
|
- if (examTaskDetail != null) {
|
|
|
+ List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamTaskId(examTaskId);
|
|
|
+ for (ExamTaskDetail examTaskDetail : examTaskDetailList) {
|
|
|
examTaskDetailService.removeById(examTaskDetail.getId());
|
|
|
|
|
|
// 题卡更新为未使用
|