|
@@ -943,10 +943,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
zipLocalRootPath = dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + time;
|
|
|
sourceFileList = new ArrayList<>(examDetailList.size() * 5);
|
|
|
for (ExamDetailPdfDownloadDto e : examDetailList) {
|
|
|
+ String dirPath = time + File.separator + e.getSemesterName() + File.separator + e.getExamName() + File.separator + e.getCourseNameCode() + File.separator + e.getPackageCode() + File.separator + e.getCourseNameCode() + "-" + e.getPaperNumber() + "-";
|
|
|
//试卷合并文件
|
|
|
if (Objects.nonNull(e.getAttachmentId())) {
|
|
|
BasicAttachment attachment = basicAttachmentService.getById(e.getAttachmentId());
|
|
|
- File paperFile = getAttachmentFile(attachment, time + File.separator + e.getSemesterName() + File.separator + e.getExamName() + File.separator + e.getCourseNameCode() + File.separator + e.getPackageCode() + File.separator + e.getCourseNameCode() + "-" + e.getPaperNumber() + "-" + PdfTypeEnum.PAPER.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
+ File paperFile = getAttachmentFile(attachment, dirPath + PdfTypeEnum.PAPER.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
if (Objects.nonNull(paperFile)) {
|
|
|
sourceFileList.add(paperFile);
|
|
|
}
|
|
@@ -955,7 +956,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
//题卡合并文件
|
|
|
if (Objects.nonNull(e.getCardAttachmentId())) {
|
|
|
BasicAttachment cardAttachment = basicAttachmentService.getById(e.getCardAttachmentId());
|
|
|
- File cardFile = getAttachmentFile(cardAttachment, time + File.separator + e.getSemesterName() + File.separator + e.getExamName() + File.separator + e.getCourseNameCode() + File.separator + e.getPackageCode() + File.separator + e.getCourseNameCode() + "-" + e.getPaperNumber() + "-" + PdfTypeEnum.CARD_A3.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
+ File cardFile = getAttachmentFile(cardAttachment, dirPath + PdfTypeEnum.CARD_A3.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
if (Objects.nonNull(cardFile)) {
|
|
|
sourceFileList.add(cardFile);
|
|
|
}
|
|
@@ -968,19 +969,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
for (int i = 0; i < jsonArrayTemp.size(); i++) {
|
|
|
JSONObject object = jsonArrayTemp.getJSONObject(i);
|
|
|
PdfTypeEnum pdfTypeEnum = PdfTypeEnum.valueOf((String) object.get("printType"));
|
|
|
- File file = null;
|
|
|
switch (pdfTypeEnum) {
|
|
|
case PACKAGE:
|
|
|
- file = getJsonFile(object, time + File.separator + e.getSemesterName() + File.separator + e.getExamName() + File.separator + e.getCourseNameCode() + File.separator + e.getPackageCode() + File.separator + e.getCourseNameCode() + "-" + e.getPaperNumber() + "-" + pdfTypeEnum.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
- sourceFileList.add(file);
|
|
|
- break;
|
|
|
case SIGN:
|
|
|
- file = getJsonFile(object, time + File.separator + e.getSemesterName() + File.separator + e.getExamName() + File.separator + e.getCourseNameCode() + File.separator + e.getPackageCode() + File.separator + e.getCourseNameCode() + "-" + e.getPaperNumber() + "-" + pdfTypeEnum.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
- sourceFileList.add(file);
|
|
|
- break;
|
|
|
case CHECK_IN:
|
|
|
- file = getJsonFile(object, time + File.separator + e.getSemesterName() + File.separator + e.getExamName() + File.separator + e.getCourseNameCode() + File.separator + e.getPackageCode() + File.separator + e.getCourseNameCode() + "-" + e.getPaperNumber() + "-" + pdfTypeEnum.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
- sourceFileList.add(file);
|
|
|
+ File file = getJsonFile(object, dirPath + pdfTypeEnum.getTitle() + SystemConstant.PDF_PREFIX);
|
|
|
+ if (Objects.nonNull(file)) {
|
|
|
+ sourceFileList.add(file);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -1014,17 +1010,13 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
ResultUtil.error(e.getMessage());
|
|
|
}
|
|
|
} finally {
|
|
|
- if (!CollectionUtils.isEmpty(sourceFileList) && Objects.nonNull(dictionaryConfig.sysDomain()) && dictionaryConfig.sysDomain().isOss()) {
|
|
|
+ if (!CollectionUtils.isEmpty(sourceFileList)) {
|
|
|
for (File file : sourceFileList) {
|
|
|
file.delete();
|
|
|
}
|
|
|
- if (Objects.nonNull(zipFile)) {
|
|
|
- zipFile.delete();
|
|
|
- }
|
|
|
- if (Objects.nonNull(zipLocalRootPath)) {
|
|
|
- File file = new File(zipLocalRootPath);
|
|
|
- file.delete();
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(dictionaryConfig.sysDomain()) && dictionaryConfig.sysDomain().isOss() && Objects.nonNull(zipFile)) {
|
|
|
+ zipFile.delete();
|
|
|
}
|
|
|
}
|
|
|
return map;
|