|
@@ -186,7 +186,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
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"))) {
|
|
|
+ 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, ordinaryPdfList, (Integer) jsonObjectOrdinary.get("backupCount"));
|
|
@@ -233,6 +233,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
//抽取卷型
|
|
|
String paperType = Objects.nonNull(paperTypeParam) ? paperTypeParam : createPdfUtil.getPaperType(examPrintPlan, examTaskDetail, examDetail, examDetailCourse);
|
|
|
examTaskDetail.setRelatePaperType(paperType);
|
|
|
+ examDetailCourse.setPaperType(paperType);
|
|
|
|
|
|
PaperPdfDto paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
|
|
|
|
|
@@ -250,7 +251,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String studentContent = cardContent;
|
|
|
|
|
|
for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
|
|
|
- BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, paperType, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList);
|
|
|
+ BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList);
|
|
|
examDetailCourse.setCardPagesA3(basicAttachment.getPages());
|
|
|
basicAttachmentList.add(basicAttachment);
|
|
|
}
|
|
@@ -268,14 +269,16 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
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"))) {
|
|
|
+ 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, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
} else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
|
|
|
- createPdfUtil.createPaperPackage(pdfDto.isTag(), basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
+ if (Objects.nonNull(pdfDto)) {
|
|
|
+ createPdfUtil.createPaperPackage(pdfDto.isTag(), basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -289,7 +292,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
});
|
|
|
|
|
|
for (ExamStudent t : examStudentList) {
|
|
|
- createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
|
|
|
+ if (Objects.nonNull(pdfDto)) {
|
|
|
+ createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
|
|
|
+ }
|
|
|
basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, paperType, examCard, sysUser.getId(), examStudentTempPdfList));
|
|
|
}
|
|
|
paperPdfList.addAll(paperPdfTempList);
|
|
@@ -662,17 +667,19 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
|
|
|
// 处理试卷样品
|
|
|
List<Map> paperInfo = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
|
|
|
+ if (Objects.isNull(paperInfo)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
|
|
|
+ }
|
|
|
System.out.println("paperInfo = " + JSON.toJSONString(paperInfo));
|
|
|
Set<Long> attPaperIds = new HashSet<>();
|
|
|
for (Map paperMap : paperInfo) {
|
|
|
- if (Objects.isNull(paperMap.get("attachmentId"))) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未找到附件id");
|
|
|
+ if (Objects.nonNull(paperMap.get("attachmentId")) && String.valueOf(paperMap.get("attachmentId")).length() > 0 && !String.valueOf(paperMap.get("attachmentId")).equals("null")) {
|
|
|
+ Long attachmentId = Long.valueOf(String.valueOf(paperMap.get("attachmentId")));
|
|
|
+ attPaperIds.add(attachmentId);
|
|
|
}
|
|
|
- Long attachmentId = Long.valueOf(String.valueOf(paperMap.get("attachmentId")));
|
|
|
- attPaperIds.add(attachmentId);
|
|
|
}
|
|
|
- List<BasicAttachment> paperAttachmentList = basicAttachmentService.listByIds(attPaperIds);
|
|
|
- if (Objects.nonNull(paperAttachmentList)) {
|
|
|
+ if (attPaperIds.size() > 0) {
|
|
|
+ List<BasicAttachment> paperAttachmentList = basicAttachmentService.listByIds(attPaperIds);
|
|
|
for (BasicAttachment paperAttachment : paperAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
|
|
|
String paperPath = firstPath + File.separator + "试卷" + File.separator + paperAttachment.getName() + paperAttachment.getType();
|
|
@@ -692,8 +699,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
Long attachmentId = Long.valueOf(String.valueOf(confirmMap.get("attachmentId")));
|
|
|
attConfirmIds.add(attachmentId);
|
|
|
}
|
|
|
- List<BasicAttachment> confirmAttachmentList = basicAttachmentService.listByIds(attConfirmIds);
|
|
|
- if (Objects.nonNull(confirmAttachmentList)) {
|
|
|
+ if (attConfirmIds.size() > 0) {
|
|
|
+ List<BasicAttachment> confirmAttachmentList = basicAttachmentService.listByIds(attConfirmIds);
|
|
|
for (BasicAttachment confirmAttachment : confirmAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(confirmAttachment.getPath());
|
|
|
String confirmPath = firstPath + File.separator + "审核样本" + File.separator + confirmAttachment.getName() + confirmAttachment.getType();
|
|
@@ -729,7 +736,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
|
ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), cardPath);
|
|
|
- count++;
|
|
|
} else {
|
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId, cardId));
|
|
|
if (examCardDetailList.size() != 1) {
|
|
@@ -744,8 +750,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
localFile.getParentFile().mkdirs();
|
|
|
}
|
|
|
FileCopyUtils.copy(bytes, localFile);
|
|
|
- count++;
|
|
|
}
|
|
|
+ count++;
|
|
|
}
|
|
|
ZipUtil.zip(zipLocalRootPath, zipFile.getPath(), true);
|
|
|
ossUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|