|
@@ -171,8 +171,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
* @param paperTypeParam
|
|
* @param paperTypeParam
|
|
* @param basicAttachmentList
|
|
* @param basicAttachmentList
|
|
* @param attachmentIds
|
|
* @param attachmentIds
|
|
- * @param ftlList
|
|
|
|
- * @param basicSchool
|
|
|
|
* @param list
|
|
* @param list
|
|
* @return
|
|
* @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
@@ -186,25 +184,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
String paperTypeParam,
|
|
String paperTypeParam,
|
|
List<BasicAttachment> basicAttachmentList,
|
|
List<BasicAttachment> basicAttachmentList,
|
|
Set<Long> attachmentIds,
|
|
Set<Long> attachmentIds,
|
|
- Set<File> ftlList,
|
|
|
|
- BasicSchool basicSchool,
|
|
|
|
List<PdfDto>... list
|
|
List<PdfDto>... list
|
|
) throws IOException, DocumentException {
|
|
) throws IOException, DocumentException {
|
|
if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
|
|
if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
|
|
for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
- if (Objects.nonNull(examPrintPlan.getOrdinaryContent())) {
|
|
|
|
- //获取普通印品
|
|
|
|
- JSONArray jsonArrayOrdinary = JSONArray.parseArray(examPrintPlan.getOrdinaryContent());
|
|
|
|
- for (int i = 0; i < jsonArrayOrdinary.size(); i++) {
|
|
|
|
- JSONObject jsonObjectOrdinary = jsonArrayOrdinary.getJSONObject(i);
|
|
|
|
- if (Objects.nonNull(jsonObjectOrdinary.get("attachmentId")) && !Objects.equals("", jsonObjectOrdinary.get("attachmentId"))) {
|
|
|
|
- Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
|
|
|
|
- BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
|
- createPdfUtil.createCheckIn(examDetail, basicAttachment, list[0], (Integer) jsonObjectOrdinary.get("backupCount"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
|
|
List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
|
|
List<PdfDto> examStudentTempPdfList = new ArrayList<>();//所有题卡
|
|
List<PdfDto> examStudentTempPdfList = new ArrayList<>();//所有题卡
|
|
List<PdfDto> backupPaperTempPdfList = new ArrayList<>();//备份试卷
|
|
List<PdfDto> backupPaperTempPdfList = new ArrayList<>();//备份试卷
|
|
@@ -262,7 +245,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
//获取试卷pdf
|
|
//获取试卷pdf
|
|
PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
|
|
PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
|
|
examDetailCourse.setPaperPagesA3(Objects.nonNull(pdfDto) ? pdfDto.getPageCount() : examDetailCourse.getPaperPagesA3());
|
|
examDetailCourse.setPaperPagesA3(Objects.nonNull(pdfDto) ? pdfDto.getPageCount() : examDetailCourse.getPaperPagesA3());
|
|
- list[1].addAll(backupPaperTempPdfList);
|
|
|
|
|
|
+ list[0].addAll(backupPaperTempPdfList);
|
|
|
|
|
|
basicAttachmentList = Objects.isNull(basicAttachmentList) ? basicAttachmentList = new ArrayList<>() : basicAttachmentList;
|
|
basicAttachmentList = Objects.isNull(basicAttachmentList) ? basicAttachmentList = new ArrayList<>() : basicAttachmentList;
|
|
for (ExamCardDetail examCardDetail : examCardDetailList) {
|
|
for (ExamCardDetail examCardDetail : examCardDetailList) {
|
|
@@ -277,7 +260,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
examDetailCourse.setCardPagesA3(basicAttachment.getPages());
|
|
examDetailCourse.setCardPagesA3(basicAttachment.getPages());
|
|
basicAttachmentList.add(basicAttachment);
|
|
basicAttachmentList.add(basicAttachment);
|
|
}
|
|
}
|
|
- list[2].addAll(cardPdfTempList);
|
|
|
|
|
|
+ list[1].addAll(cardPdfTempList);
|
|
|
|
|
|
//查询考生
|
|
//查询考生
|
|
QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
|
|
@@ -285,42 +268,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
.eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
|
|
.eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
|
|
List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
|
|
List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
|
|
|
|
|
|
- if (Objects.nonNull(examPrintPlan.getVariableContent())) {
|
|
|
|
- //获取变量印品
|
|
|
|
- JSONArray jsonArrayVariable = JSONArray.parseArray(examPrintPlan.getVariableContent());
|
|
|
|
- for (int i = 0; i < jsonArrayVariable.size(); i++) {
|
|
|
|
- JSONObject jsonObjectVariable = jsonArrayVariable.getJSONObject(i);
|
|
|
|
- String type = (String) jsonObjectVariable.get("type");
|
|
|
|
- if (Objects.nonNull(jsonObjectVariable.get("attachmentId")) && !Objects.equals("", jsonObjectVariable.get("attachmentId"))) {
|
|
|
|
- Long attachmentId = Long.parseLong((String) jsonObjectVariable.get("attachmentId"));
|
|
|
|
- BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
|
- ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
|
|
|
|
- if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
|
|
|
|
- createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, list[3], (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
|
- } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
|
|
|
|
- if (Objects.nonNull(pdfDto)) {
|
|
|
|
- createPdfUtil.createPaperPackage(pdfDto.isTag(), basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, list[3], (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Collections.sort(list[3], new Comparator<PdfDto>() {
|
|
|
|
- @Override
|
|
|
|
- public int compare(PdfDto o1, PdfDto o2) {
|
|
|
|
- return o1.getSequence() > o2.getSequence() ? 1 : -1;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
for (ExamStudent t : examStudentList) {
|
|
for (ExamStudent t : examStudentList) {
|
|
if (Objects.nonNull(pdfDto)) {
|
|
if (Objects.nonNull(pdfDto)) {
|
|
createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
|
|
createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
|
|
}
|
|
}
|
|
basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
|
|
basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
|
|
}
|
|
}
|
|
- list[4].addAll(paperPdfTempList);
|
|
|
|
- list[5].addAll(examStudentTempPdfList);
|
|
|
|
|
|
+ list[2].addAll(paperPdfTempList);
|
|
|
|
+ list[3].addAll(examStudentTempPdfList);
|
|
examStudentService.saveOrUpdateBatch(examStudentList);
|
|
examStudentService.saveOrUpdateBatch(examStudentList);
|
|
jsonObject.put("card", jsonArray);
|
|
jsonObject.put("card", jsonArray);
|
|
examCardDetail.setAttachmentId(jsonObject.toJSONString());
|
|
examCardDetail.setAttachmentId(jsonObject.toJSONString());
|
|
@@ -334,6 +289,64 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
return basicAttachmentList;
|
|
return basicAttachmentList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建A4文件
|
|
|
|
+ *
|
|
|
|
+ * @param examPrintPlan
|
|
|
|
+ * @param examDetail
|
|
|
|
+ * @param basicSchool
|
|
|
|
+ * @param ftlList
|
|
|
|
+ * @param examDetailCourseListIds
|
|
|
|
+ * @param list
|
|
|
|
+ * @throws IOException
|
|
|
|
+ * @throws DocumentException
|
|
|
|
+ */
|
|
|
|
+ @Transactional
|
|
|
|
+ public void createA4File(ExamPrintPlan examPrintPlan, ExamDetail examDetail, BasicSchool basicSchool, Set<File> ftlList, List<Long> examDetailCourseListIds, List<PdfDto>... list) throws IOException, DocumentException {
|
|
|
|
+ if (Objects.nonNull(examPrintPlan.getOrdinaryContent())) {
|
|
|
|
+ //获取普通印品
|
|
|
|
+ JSONArray jsonArrayOrdinary = JSONArray.parseArray(examPrintPlan.getOrdinaryContent());
|
|
|
|
+ for (int i = 0; i < jsonArrayOrdinary.size(); i++) {
|
|
|
|
+ JSONObject jsonObjectOrdinary = jsonArrayOrdinary.getJSONObject(i);
|
|
|
|
+ if (Objects.nonNull(jsonObjectOrdinary.get("attachmentId")) && !Objects.equals("", jsonObjectOrdinary.get("attachmentId"))) {
|
|
|
|
+ Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
|
|
|
|
+ BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
|
+ createPdfUtil.createCheckIn(examDetail, basicAttachment, list[0], (Integer) jsonObjectOrdinary.get("backupCount"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (Objects.nonNull(examPrintPlan.getVariableContent())) {
|
|
|
|
+ List<ExamStudentCourseDto> examStudentCourseDtoList = examStudentService.queryBySchoolIdAndExamDetailCourseIds(basicSchool.getId(), examDetailCourseListIds);
|
|
|
|
+ int count = (int) examStudentCourseDtoList.stream().filter(s -> s.getPaperPageA3() > 2).count();
|
|
|
|
+ boolean tag = count > 0 ? true : false;
|
|
|
|
+
|
|
|
|
+ //获取变量印品
|
|
|
|
+ JSONArray jsonArrayVariable = JSONArray.parseArray(examPrintPlan.getVariableContent());
|
|
|
|
+ for (int i = 0; i < jsonArrayVariable.size(); i++) {
|
|
|
|
+ JSONObject jsonObjectVariable = jsonArrayVariable.getJSONObject(i);
|
|
|
|
+ String type = (String) jsonObjectVariable.get("type");
|
|
|
|
+ if (Objects.nonNull(jsonObjectVariable.get("attachmentId")) && !Objects.equals("", jsonObjectVariable.get("attachmentId"))) {
|
|
|
|
+ Long attachmentId = Long.parseLong((String) jsonObjectVariable.get("attachmentId"));
|
|
|
|
+ BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
|
|
+ ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
|
|
|
|
+ if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
|
|
|
|
+ createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examStudentCourseDtoList, list[1], (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
|
+ } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
|
|
|
|
+ createPdfUtil.createPaperPackage(tag, basicAttachment, basicSchool.getName(), examDetail, examStudentCourseDtoList, list[1], (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Collections.sort(list[1], new Comparator<PdfDto>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(PdfDto o1, PdfDto o2) {
|
|
|
|
+ return o1.getSequence() > o2.getSequence() ? 1 : -1;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 创建pdf逻辑
|
|
* 创建pdf逻辑
|
|
*
|
|
*
|
|
@@ -390,6 +403,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetail.getId());
|
|
examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetail.getId());
|
|
}
|
|
}
|
|
List<ExamDetailCourse> examDetailCourseList = detailCourseService.list(examDetailCourseQueryWrapper);
|
|
List<ExamDetailCourse> examDetailCourseList = detailCourseService.list(examDetailCourseQueryWrapper);
|
|
|
|
+ List<Long> examDetailCourseListIds = examDetailCourseList.stream().map(s -> s.getId()).collect(Collectors.toList());
|
|
|
|
+
|
|
List<PdfDto> variablePdfList = new ArrayList<>();//变量印品(签到表、卷袋贴)
|
|
List<PdfDto> variablePdfList = new ArrayList<>();//变量印品(签到表、卷袋贴)
|
|
List<PdfDto> ordinaryPdfList = new ArrayList<>();//普通印品(登记表)
|
|
List<PdfDto> ordinaryPdfList = new ArrayList<>();//普通印品(登记表)
|
|
List<PdfDto> paperPdfList = new ArrayList<>();//所有试卷
|
|
List<PdfDto> paperPdfList = new ArrayList<>();//所有试卷
|
|
@@ -405,16 +420,21 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
paperTypeParam,
|
|
paperTypeParam,
|
|
basicAttachmentList,
|
|
basicAttachmentList,
|
|
attachmentIds,
|
|
attachmentIds,
|
|
- ftlList,
|
|
|
|
- basicSchool,
|
|
|
|
- ordinaryPdfList,
|
|
|
|
backupPaperPdfList,
|
|
backupPaperPdfList,
|
|
cardPdfList,
|
|
cardPdfList,
|
|
- variablePdfList,
|
|
|
|
paperPdfList,
|
|
paperPdfList,
|
|
examStudentPdfList);
|
|
examStudentPdfList);
|
|
|
|
+
|
|
|
|
+ createA4File(examPrintPlan, examDetail, basicSchool, ftlList, examDetailCourseListIds, ordinaryPdfList, variablePdfList);
|
|
|
|
+
|
|
//合并pdf
|
|
//合并pdf
|
|
- basicAttachmentList.add(createPdfUtil.mergePdf(basicExamRule, tbTask, examDetail, sysUser.getId(), variablePdfList, ordinaryPdfList, paperPdfList, examStudentPdfList, backupPaperPdfList, cardPdfList));
|
|
|
|
|
|
+ String dirNameA3 = createPdfUtil.mergeA3Pdf(paperPdfList, examStudentPdfList, backupPaperPdfList, cardPdfList);
|
|
|
|
+ String dirNameA4 = createPdfUtil.mergeA4Pdf(variablePdfList, ordinaryPdfList);
|
|
|
|
+
|
|
|
|
+ List<PdfDto> mergePdfDeleteList = new ArrayList<>();
|
|
|
|
+ mergePdfDeleteList.addAll(examStudentPdfList);
|
|
|
|
+ mergePdfDeleteList.addAll(cardPdfList);
|
|
|
|
+ basicAttachmentList.add(createPdfUtil.mergePdfSaveDb(dirNameA4, dirNameA3, tbTask, sysUser.getId(), examDetail, basicExamRule, mergePdfDeleteList));
|
|
}
|
|
}
|
|
updateExamPrintPlan(basicExamRule, examPrintPlan);
|
|
updateExamPrintPlan(basicExamRule, examPrintPlan);
|
|
map.computeIfAbsent("size", v -> examDetailList.size());
|
|
map.computeIfAbsent("size", v -> examDetailList.size());
|