|
@@ -28,6 +28,7 @@ import com.qmth.distributed.print.common.util.FileUtil;
|
|
import com.qmth.distributed.print.common.util.HexUtils;
|
|
import com.qmth.distributed.print.common.util.HexUtils;
|
|
import com.qmth.distributed.print.common.util.ResultUtil;
|
|
import com.qmth.distributed.print.common.util.ResultUtil;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
@@ -191,6 +192,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
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) {
|
|
|
|
+ String printContent = examPrintPlan.getPrintContent();
|
|
|
|
+ if (StringUtils.isBlank(printContent)) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
Map<Long, BasicCardRule> basicCardRuleMap = new HashMap<>();
|
|
Map<Long, BasicCardRule> basicCardRuleMap = new HashMap<>();
|
|
for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
|
|
List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
|
|
@@ -260,7 +266,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
examTaskDetail.setRelatePaperType(paperType);
|
|
examTaskDetail.setRelatePaperType(paperType);
|
|
examDetailCourse.setPaperType(paperType);
|
|
examDetailCourse.setPaperType(paperType);
|
|
|
|
|
|
- PaperPdfDto paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
|
|
|
|
|
|
+ PaperPdfDto paperPdfDto = null;
|
|
|
|
+ if (printContent.contains("PAPER")) {
|
|
|
|
+ paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);
|
|
|
|
+ }
|
|
|
|
|
|
//获取试卷pdf
|
|
//获取试卷pdf
|
|
PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
|
|
PdfDto pdfDto = createPdfUtil.getPaperPdf(paperPdfDto, examPrintPlan.getBackupCount(), backupPaperTempPdfList);
|
|
@@ -268,39 +277,41 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
list[0].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) {
|
|
|
|
- createPdfUtil.getCardAttachmentId(examCardDetail, attachmentIds);
|
|
|
|
-
|
|
|
|
- //把模板页面上的 ${} 替换成实际内容
|
|
|
|
- String cardContent = createPdfUtil.replaceHtmlTemplete(examCardDetail);
|
|
|
|
- String studentContent = cardContent;
|
|
|
|
-
|
|
|
|
- for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
|
|
|
|
- BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList, basicCardRule);
|
|
|
|
- examDetailCourse.setCardPagesA3(basicAttachment.getPages());
|
|
|
|
- basicAttachmentList.add(basicAttachment);
|
|
|
|
- }
|
|
|
|
- list[1].addAll(cardPdfTempList);
|
|
|
|
-
|
|
|
|
- //查询考生
|
|
|
|
- QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
|
|
|
|
- examStudentQueryWrapper.lambda().eq(ExamStudent::getSchoolId, sysUser.getSchoolId())
|
|
|
|
- .eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
|
|
|
|
- List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
|
|
|
|
-
|
|
|
|
- for (ExamStudent t : examStudentList) {
|
|
|
|
- if (Objects.nonNull(pdfDto)) {
|
|
|
|
- createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
|
|
|
|
|
|
+ if (printContent.contains("CARD")) {
|
|
|
|
+ for (ExamCardDetail examCardDetail : examCardDetailList) {
|
|
|
|
+ createPdfUtil.getCardAttachmentId(examCardDetail, attachmentIds);
|
|
|
|
+
|
|
|
|
+ //把模板页面上的 ${} 替换成实际内容
|
|
|
|
+ String cardContent = createPdfUtil.replaceHtmlTemplete(examCardDetail);
|
|
|
|
+ String studentContent = examCardDetail.getHtmlContent();
|
|
|
|
+
|
|
|
|
+ for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
|
|
|
|
+ BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList, basicCardRule);
|
|
|
|
+ examDetailCourse.setCardPagesA3(basicAttachment.getPages());
|
|
|
|
+ basicAttachmentList.add(basicAttachment);
|
|
|
|
+ }
|
|
|
|
+ list[1].addAll(cardPdfTempList);
|
|
|
|
+
|
|
|
|
+ //查询考生
|
|
|
|
+ QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examStudentQueryWrapper.lambda().eq(ExamStudent::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
|
|
|
|
+ List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
|
|
|
|
+
|
|
|
|
+ for (ExamStudent t : examStudentList) {
|
|
|
|
+ if (Objects.nonNull(pdfDto)) {
|
|
|
|
+ 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[2].addAll(paperPdfTempList);
|
|
|
|
+ list[3].addAll(examStudentTempPdfList);
|
|
|
|
+ examStudentService.saveOrUpdateBatch(examStudentList);
|
|
|
|
+ jsonObject.put("card", jsonArray);
|
|
|
|
+ examDetailCourse.setAttachmentId(jsonObject.toJSONString());
|
|
}
|
|
}
|
|
- list[2].addAll(paperPdfTempList);
|
|
|
|
- list[3].addAll(examStudentTempPdfList);
|
|
|
|
- examStudentService.saveOrUpdateBatch(examStudentList);
|
|
|
|
- jsonObject.put("card", jsonArray);
|
|
|
|
- examDetailCourse.setAttachmentId(jsonObject.toJSONString());
|
|
|
|
|
|
+// examCardDetailService.saveOrUpdateBatch(examCardDetailList);
|
|
}
|
|
}
|
|
- examCardDetailService.saveOrUpdateBatch(examCardDetailList);
|
|
|
|
}
|
|
}
|
|
examDetailCourse.setAttachmentId(jsonObject.toJSONString());
|
|
examDetailCourse.setAttachmentId(jsonObject.toJSONString());
|
|
examTaskDetailService.saveOrUpdateBatch(examTaskDetailList);
|
|
examTaskDetailService.saveOrUpdateBatch(examTaskDetailList);
|
|
@@ -339,7 +350,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
|
|
|
if (Objects.nonNull(examPrintPlan.getVariableContent())) {
|
|
if (Objects.nonNull(examPrintPlan.getVariableContent())) {
|
|
List<ExamStudentCourseDto> examStudentCourseDtoList = examStudentService.queryBySchoolIdAndExamDetailCourseIds(basicSchool.getId(), examDetailCourseListIds);
|
|
List<ExamStudentCourseDto> examStudentCourseDtoList = examStudentService.queryBySchoolIdAndExamDetailCourseIds(basicSchool.getId(), examDetailCourseListIds);
|
|
- int count = (int) examStudentCourseDtoList.stream().filter(s -> s.getPaperPageA3() > 2).count();
|
|
|
|
|
|
+ int count = (int) examStudentCourseDtoList.stream().filter(s -> s.getPaperPageA3() != null && s.getPaperPageA3() > 2).count();
|
|
boolean tag = count > 0 ? true : false;
|
|
boolean tag = count > 0 ? true : false;
|
|
|
|
|
|
//获取变量印品
|
|
//获取变量印品
|