|
@@ -17,7 +17,6 @@ import com.qmth.distributed.print.business.service.CommonService;
|
|
|
import com.qmth.distributed.print.business.service.ExamDetailService;
|
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
|
import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
|
-import com.qmth.distributed.print.common.util.JacksonUtil;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -28,7 +27,6 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -112,9 +110,9 @@ public class CreatePdfUtil {
|
|
|
htmlMap.put("examRoom", examDetail.getExamRoom());
|
|
|
htmlMap.put("startTime", DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.DEFAULT_DATE_PATTERN));
|
|
|
htmlMap.put("endTime", DateUtil.format(new Date(examDetail.getExamEndTime()), SystemConstant.DEFAULT_DATE_PATTERN));
|
|
|
- htmlMap.put("paperCode", examDetailCourse.getPaperNumber());
|
|
|
+ htmlMap.put("paperCode", examDetail.getPackageCode());
|
|
|
if (Objects.nonNull(examDetailCourse.getPaperNumber())) {
|
|
|
- htmlMap.put("paperCodeImg", GoogleBarCodeUtil.createBarCode(examDetailCourse.getPaperNumber(), false));
|
|
|
+ htmlMap.put("paperCodeImg", GoogleBarCodeUtil.createBarCode(examDetail.getPackageCode(), false));
|
|
|
}
|
|
|
|
|
|
List<String> extendColumnList = examStudentList.stream().map(m -> m.getExtendFields()).distinct().collect(Collectors.toList());
|
|
@@ -207,9 +205,9 @@ public class CreatePdfUtil {
|
|
|
htmlMap.put("classTeacher", String.join(",", classTeacher));
|
|
|
htmlMap.put("startTime", DateUtil.format(new Date(examDetail.getExamStartTime()), SystemConstant.DEFAULT_DATE_PATTERN));
|
|
|
htmlMap.put("endTime", DateUtil.format(new Date(examDetail.getExamEndTime()), SystemConstant.DEFAULT_DATE_PATTERN));
|
|
|
- htmlMap.put("paperCode", examDetailCourse.getPaperNumber());
|
|
|
+ htmlMap.put("paperCode", examDetail.getPackageCode());
|
|
|
if (Objects.nonNull(examDetailCourse.getPaperNumber())) {
|
|
|
- htmlMap.put("paperCodeImg", GoogleBarCodeUtil.createBarCode(examDetailCourse.getPaperNumber(), false));
|
|
|
+ htmlMap.put("paperCodeImg", GoogleBarCodeUtil.createBarCode(examDetail.getPackageCode(), false));
|
|
|
}
|
|
|
|
|
|
int totalCount = examStudentList.size();
|
|
@@ -477,14 +475,20 @@ public class CreatePdfUtil {
|
|
|
String dirNameA4 = PdfUtil.mergePdf(pathA4List.toArray(new String[mergePdfA4List.size()]), null);
|
|
|
String dirNameA3 = PdfUtil.mergePdf(pathA3List.toArray(new String[mergePdfA3List.size()]), null);
|
|
|
// oss上只认"/",windows生成的路径分隔符全部替换为"/"
|
|
|
- dirNameA4 = dirNameA4.replaceAll("\\\\", "/");
|
|
|
- dirNameA3 = dirNameA3.replaceAll("\\\\", "/");
|
|
|
- File localA4PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA4);
|
|
|
- File localA3PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA3);
|
|
|
- BasicAttachment basicAttachment = basicAttachmentService.saveAttachmentPdf(dirNameA3, userId);
|
|
|
- tbTask.setImportFileName(basicAttachment.getName());
|
|
|
- tbTask.setImportFilePath(basicAttachment.getPath());
|
|
|
- examDetail.setAttachmentId(basicAttachment.getId());
|
|
|
+ File localA4PdfFile = null, localA3PdfFile = null;
|
|
|
+ BasicAttachment basicAttachment = null;
|
|
|
+ if (Objects.nonNull(dirNameA4)) {
|
|
|
+ dirNameA4 = dirNameA4.replaceAll("\\\\", "/");
|
|
|
+ localA4PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA4);
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(dirNameA3)) {
|
|
|
+ dirNameA3 = dirNameA3.replaceAll("\\\\", "/");
|
|
|
+ localA3PdfFile = new File(stringJoiner.toString() + File.separator + dirNameA3);
|
|
|
+ basicAttachment = basicAttachmentService.saveAttachmentPdf(dirNameA3, userId);
|
|
|
+ tbTask.setImportFileName(basicAttachment.getName());
|
|
|
+ tbTask.setImportFilePath(basicAttachment.getPath());
|
|
|
+ examDetail.setAttachmentId(basicAttachment.getId());
|
|
|
+ }
|
|
|
examDetail.setPagesA3(PdfUtil.getPdfPages(localA3PdfFile));
|
|
|
examDetail.setPagesA4(PdfUtil.getPdfPages(localA4PdfFile));
|
|
|
// log.info("pageA3Count:{},examDetail:{}", pageA3Count.get(), JacksonUtil.parseJson(examDetail));
|