|
@@ -22,6 +22,7 @@ import com.qmth.distributed.print.business.enums.*;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
|
import com.qmth.distributed.print.business.util.CreatePdfUtil;
|
|
|
+import com.qmth.distributed.print.business.util.pdf.CreatePdfNewUtil;
|
|
|
import com.qmth.teachcloud.common.annotation.ExcelDBFieldDesc;
|
|
|
import com.qmth.teachcloud.common.base.BaseEntity;
|
|
|
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
|
|
@@ -114,6 +115,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
@Resource
|
|
|
CreatePdfUtil createPdfUtil;
|
|
|
@Resource
|
|
|
+ CreatePdfNewUtil createPdfNewUtil;
|
|
|
+ @Resource
|
|
|
TBTaskPdfService tbTaskPdfService;
|
|
|
@Resource
|
|
|
BasicCardRuleService basicCardRuleService;
|
|
@@ -1811,7 +1814,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请选择下载文件");
|
|
|
}
|
|
|
PaperFileDownloadExposureStatusEnum paperFileDownloadExposureStatus = downloadPaperFileParam.getPaperFileDownloadExposureStatus();
|
|
|
- if (Objects.isNull(paperFileDownloadExposureStatus)) {
|
|
|
+ if ((PaperFileDownloadContentEnum.ONLY_PAPER.equals(paperFileDownloadContent) || PaperFileDownloadContentEnum.PAPER_AND_CARD.equals(paperFileDownloadContent)) && Objects.isNull(paperFileDownloadExposureStatus)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请选择试卷状态");
|
|
|
}
|
|
|
Boolean namedByCourseInfo = downloadPaperFileParam.getNamedByCourseInfo();
|
|
@@ -1853,7 +1856,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
for (ExamTaskDetailDto examTaskDetailDto : examTaskDetailDtoList) {
|
|
|
ExamTaskPaperExportDto examTaskPaperExportDto = new ExamTaskPaperExportDto(examTaskDetailDto);
|
|
|
examTaskPaperExportDtoList.add(examTaskPaperExportDto);
|
|
|
- List<PaperInfoVo> paperInfoVoList = new ArrayList<>();
|
|
|
+ List<PaperInfoVo> paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailDto.getPaperAttachmentIds());
|
|
|
// 选择曝光卷型
|
|
|
if (PaperFileDownloadExposureStatusEnum.EXPOSED_PAPER.equals(paperFileDownloadExposureStatus)) {
|
|
|
if (StringUtils.isBlank(examTaskDetailDto.getExposedPaperType())) {
|
|
@@ -1872,10 +1875,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailDto.getPaperAttachmentIds(), examTaskDetailDto.getUnexposedPaperType());
|
|
|
}
|
|
|
}
|
|
|
- // 选择全部卷型
|
|
|
- if (PaperFileDownloadExposureStatusEnum.ALL_PAPER.equals(paperFileDownloadExposureStatus)) {
|
|
|
- paperInfoVoList = ExamTaskUtil.parsePaperAttachmentPath(examTaskDetailDto.getPaperAttachmentIds());
|
|
|
- }
|
|
|
|
|
|
if (CollectionUtils.isEmpty(paperInfoVoList)) {
|
|
|
examTaskPaperExportDto.setResult("所选试卷状态未查询到上传的试卷信息,下载失败");
|
|
@@ -1895,10 +1894,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
// 目录规则(课程名称(课程代码)/试卷编号)
|
|
|
String secondPath = examTaskDetailDto.getCourseName() + SystemConstant.HYPHEN + examTaskDetailDto.getCourseCode() + File.separator + examTaskDetailDto.getPaperNumber();
|
|
|
for (PaperInfoVo paperInfoVo : paperInfoVoList) {
|
|
|
- // 不管什么命名规则,默认都加上卷型前缀
|
|
|
- fileNamePath = "试卷" + SystemConstant.HYPHEN + paperInfoVo.getName() + SystemConstant.HYPHEN + fileNamePath;
|
|
|
// 下载试卷
|
|
|
if (downloadPaper) {
|
|
|
+ // 不管什么命名规则,默认都加上卷型前缀
|
|
|
+ fileNamePath = "试卷" + SystemConstant.HYPHEN + paperInfoVo.getName() + SystemConstant.HYPHEN + fileNamePath;
|
|
|
// 原文件名
|
|
|
if (namedByOriginalFile) {
|
|
|
fileNamePath = fileNamePath + File.separator + paperInfoVo.getFilename();
|
|
@@ -1920,8 +1919,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
ExamCard examCard = examCardService.getById(cardId);
|
|
|
Optional.ofNullable(examCard).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("找不到答题卡"));
|
|
|
|
|
|
- MakeMethodEnum makeMethodEnum = examCard.getMakeMethod();
|
|
|
-
|
|
|
String cardHtmlPath = zipLocalRootPath + File.separator + secondPath + File.separator + "题卡" + SystemConstant.HYPHEN + paperInfoVo.getName() + SystemConstant.HYPHEN + fileNamePath;
|
|
|
String cardPdfPath = zipLocalRootPath + File.separator + secondPath + File.separator + "题卡" + SystemConstant.HYPHEN + paperInfoVo.getName() + SystemConstant.HYPHEN + fileNamePath;
|
|
|
// 原文件名
|
|
@@ -1933,20 +1930,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
cardPdfPath = StringUtils.deleteWhitespace(cardPdfPath + SystemConstant.PDF_PREFIX);
|
|
|
}
|
|
|
|
|
|
- // 通用题卡
|
|
|
- String htmlContent;
|
|
|
- if (MakeMethodEnum.SELECT.equals(makeMethodEnum)) {
|
|
|
- htmlContent = createPdfUtil.resetHtmlTemplateBar(examCard.getHtmlContent());
|
|
|
- } else {
|
|
|
- BasicCardRule basicCardRule = basicCardRuleService.getById(examTaskDetailDto.getCardRuleId());
|
|
|
- htmlContent = createPdfUtil.replaceHtmlCardAllParams(examCard, basicCardRule);
|
|
|
- }
|
|
|
// html
|
|
|
File localFile = new File(cardHtmlPath);
|
|
|
if (!localFile.exists()) {
|
|
|
localFile.getParentFile().mkdirs();
|
|
|
localFile.createNewFile();
|
|
|
}
|
|
|
+ // 通用题卡
|
|
|
+ String htmlContent = createPdfNewUtil.replaceBlankHtmlContent(examCard.getHtmlContent());
|
|
|
// 生成html文件
|
|
|
FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), localFile);
|
|
|
// 转pdf文件
|