|
@@ -501,10 +501,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
public Map<String, Object> executeCreatePdfLogic(Map<String, Object> map) {
|
|
|
List<BasicAttachment> basicAttachmentList = null;
|
|
|
List<File> fileTempList = new ArrayList<>();
|
|
|
+ TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
+ SysUser sysUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
+ Long examDetailId = tbTask.getEntityId();
|
|
|
try {
|
|
|
- TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
- SysUser sysUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
- Long examDetailId = tbTask.getEntityId();
|
|
|
String paperTypeParam = Objects.nonNull(map.get("paperType")) ? (String) map.get("paperType") : null;
|
|
|
|
|
|
//查询printPlan
|
|
@@ -526,58 +526,56 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
throw ExceptionResultEnum.EXAM_DETAIL_IS_NULL.exception();
|
|
|
}
|
|
|
Set<Long> attachmentIds = new HashSet<>();
|
|
|
- for (ExamDetail examDetail : examDetailList) {
|
|
|
- tbTask.setObjName(examDetail.getExamRoom() + SystemConstant.HYPHEN + examDetail.getExamPlace());
|
|
|
- //查询examDetailCourse
|
|
|
- QueryWrapper<ExamDetailCourse> examDetailCourseQueryWrapper = new QueryWrapper<>();
|
|
|
- examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetail.getId());
|
|
|
- List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.list(examDetailCourseQueryWrapper);
|
|
|
-
|
|
|
- // 考场内没有任务课程数据,直接跳过
|
|
|
- if (CollectionUtils.isEmpty(examDetailCourseList)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- List<PdfDto> variablePdfList = new ArrayList<>();//变量印品(签到表、卷袋贴)
|
|
|
- List<PdfDto> ordinaryPdfList = new ArrayList<>();//普通印品(登记表)
|
|
|
- List<PdfDto> paperPdfList = new ArrayList<>();//所有试卷
|
|
|
- List<PdfDto> examStudentPdfList = new ArrayList<>();//所有题卡
|
|
|
- List<PdfDto> backupPaperPdfList = new ArrayList<>();//备份试卷
|
|
|
- List<PdfDto> backupCardPdfList = new ArrayList<>();//备份题卡
|
|
|
-
|
|
|
- //创建pdf核心逻辑
|
|
|
- basicAttachmentList = createPdfCoreLogic(examDetailCourseList,
|
|
|
- examPrintPlan,
|
|
|
- examDetail,
|
|
|
- sysUser,
|
|
|
- paperTypeParam,
|
|
|
- basicAttachmentList,
|
|
|
- attachmentIds,
|
|
|
- fileTempList,
|
|
|
- backupPaperPdfList,
|
|
|
- backupCardPdfList,
|
|
|
- paperPdfList,
|
|
|
- examStudentPdfList);
|
|
|
-
|
|
|
- createA4File(examPrintPlan, examDetail, basicSchool, examDetailCourseList, fileTempList, ordinaryPdfList, variablePdfList);
|
|
|
-
|
|
|
- //合并A3(试卷+题卡+备用试卷+备用题卡)
|
|
|
+ ExamDetail examDetail = examDetailList.get(0);
|
|
|
+
|
|
|
+ tbTask.setObjName(examDetail.getExamRoom() + SystemConstant.HYPHEN + examDetail.getExamPlace());
|
|
|
+ //查询examDetailCourse
|
|
|
+ QueryWrapper<ExamDetailCourse> examDetailCourseQueryWrapper = new QueryWrapper<>();
|
|
|
+ examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetail.getId());
|
|
|
+ List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.list(examDetailCourseQueryWrapper);
|
|
|
+
|
|
|
+
|
|
|
+ List<PdfDto> variablePdfList = new ArrayList<>();//变量印品(签到表、卷袋贴)
|
|
|
+ List<PdfDto> ordinaryPdfList = new ArrayList<>();//普通印品(登记表)
|
|
|
+ List<PdfDto> paperPdfList = new ArrayList<>();//所有试卷
|
|
|
+ List<PdfDto> examStudentPdfList = new ArrayList<>();//所有题卡
|
|
|
+ List<PdfDto> backupPaperPdfList = new ArrayList<>();//备份试卷
|
|
|
+ List<PdfDto> backupCardPdfList = new ArrayList<>();//备份题卡
|
|
|
+
|
|
|
+ //创建pdf核心逻辑
|
|
|
+ basicAttachmentList = createPdfCoreLogic(examDetailCourseList,
|
|
|
+ examPrintPlan,
|
|
|
+ examDetail,
|
|
|
+ sysUser,
|
|
|
+ paperTypeParam,
|
|
|
+ basicAttachmentList,
|
|
|
+ attachmentIds,
|
|
|
+ fileTempList,
|
|
|
+ backupPaperPdfList,
|
|
|
+ backupCardPdfList,
|
|
|
+ paperPdfList,
|
|
|
+ examStudentPdfList);
|
|
|
+
|
|
|
+ createA4File(examPrintPlan, examDetail, basicSchool, examDetailCourseList, fileTempList, ordinaryPdfList, variablePdfList);
|
|
|
+
|
|
|
+ //合并A3(试卷+题卡+备用试卷+备用题卡)
|
|
|
// String dirNameA3 = createPdfUtil.mergeA3Pdf(paperPdfList, examStudentPdfList, backupPaperPdfList, backupCardPdfList);
|
|
|
- //合并(试卷+备用试卷)
|
|
|
- String dirNamePaper = createPdfUtil.mergeA3Pdf(fileTempList, paperPdfList, backupPaperPdfList);
|
|
|
- //合并A4(签到表+卷袋贴+登记表)
|
|
|
- String dirNameA4 = createPdfUtil.mergeA4Pdf(fileTempList, variablePdfList, ordinaryPdfList);
|
|
|
- //合并A3(题卡+备用题卡)
|
|
|
- String dirNameCardA3 = createPdfUtil.mergeA3Pdf(fileTempList, examStudentPdfList, backupCardPdfList);
|
|
|
-
|
|
|
- BasicAttachment attachment = createPdfUtil.mergePdfSaveDb(dirNamePaper, dirNameCardA3, tbTask, sysUser.getId(), examDetail, basicPrintConfig, fileTempList);
|
|
|
- if (basicAttachmentList != null) {
|
|
|
- basicAttachmentList.add(attachment);
|
|
|
- }
|
|
|
+ //合并(试卷+备用试卷)
|
|
|
+ String dirNamePaper = createPdfUtil.mergeA3Pdf(fileTempList, paperPdfList, backupPaperPdfList);
|
|
|
+ //合并A4(签到表+卷袋贴+登记表)
|
|
|
+ String dirNameA4 = createPdfUtil.mergeA4Pdf(fileTempList, variablePdfList, ordinaryPdfList);
|
|
|
+ //合并A3(题卡+备用题卡)
|
|
|
+ String dirNameCardA3 = createPdfUtil.mergeA3Pdf(fileTempList, examStudentPdfList, backupCardPdfList);
|
|
|
|
|
|
- // 保存任务ID,方便后面重新生成
|
|
|
- examDetail.setTaskId(tbTask.getId());
|
|
|
- examDetailService.updateById(examDetail);
|
|
|
+ BasicAttachment attachment = createPdfUtil.mergePdfSaveDb(dirNamePaper, dirNameCardA3, tbTask, sysUser.getId(), examDetail, basicPrintConfig, fileTempList);
|
|
|
+ if (basicAttachmentList != null) {
|
|
|
+ basicAttachmentList.add(attachment);
|
|
|
}
|
|
|
+
|
|
|
+ // 保存任务ID,方便后面重新生成
|
|
|
+ examDetail.setTaskId(tbTask.getId());
|
|
|
+ examDetailService.updateById(examDetail);
|
|
|
+
|
|
|
updateExamPrintPlan(basicPrintConfig, examPrintPlan);
|
|
|
map.computeIfAbsent("size", v -> examDetailList.size());
|
|
|
} catch (Exception e) {
|
|
@@ -585,6 +583,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
if (Objects.nonNull(dictionaryConfig.sysDomain()) && dictionaryConfig.sysDomain().isOss()) {
|
|
|
basicAttachmentService.batchDeleteAttachment(basicAttachmentList);
|
|
|
}
|
|
|
+ // 生成失败,状态改为新建
|
|
|
+ UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.NEW)
|
|
|
+ .eq(ExamDetail::getId, examDetailId);
|
|
|
+ examDetailService.update(updateWrapper);
|
|
|
if (e instanceof ApiException) {
|
|
|
ResultUtil.error((ApiException) e, e.getMessage());
|
|
|
} else {
|
|
@@ -894,6 +897,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
if (!CollectionUtils.isEmpty(errorList)) {
|
|
|
// 优先处理excel每个独立行的数据异常
|
|
|
map.put(SystemConstant.ERROR_DATA_LIST, examinationImportDtoList);
|
|
|
+ map.put("errorList", errorList);
|
|
|
map.put("fieldsDtoList", fieldsDtoList);
|
|
|
return map;
|
|
|
}
|
|
@@ -1469,7 +1473,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
map.put(SystemConstant.SUCCESS_DATA_COUNT, successInteger.get());
|
|
|
map.put(SystemConstant.ERROR_DATA_COUNT, errorDataList.size());
|
|
|
return finalExcelList;
|
|
|
- },2);
|
|
|
+ }, 2);
|
|
|
return basicStudentService.executeBasicStudentImportLogic(finalList, map);
|
|
|
}
|
|
|
|
|
@@ -1603,7 +1607,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(excelErrorTemp));
|
|
|
}
|
|
|
return finalExcelList;
|
|
|
- },2);
|
|
|
+ }, 2);
|
|
|
return basicClazzService.executeBasicClazzImportLogic(finalList, map);
|
|
|
}
|
|
|
|
|
@@ -1680,7 +1684,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
tcStatisticsService.importJoinData(tcStatisticsImportTempList);
|
|
|
tcStatisticsTempService.removeByIds(tcStatisticsImportTempList.stream().map(BaseEntity::getId).collect(Collectors.toSet()));
|
|
|
return finalExcelList;
|
|
|
- },2);
|
|
|
+ }, 2);
|
|
|
return map;
|
|
|
}
|
|
|
|