|
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
-import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
|
|
|
|
-import com.qmth.distributed.print.business.bean.dto.ExamTaskPaperDto;
|
|
|
|
-import com.qmth.distributed.print.business.bean.dto.ExamTaskPaperExportDto;
|
|
|
|
-import com.qmth.distributed.print.business.bean.dto.ExamTaskPaperFileDto;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.bean.dto.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.enums.MakeMethodEnum;
|
|
import com.qmth.distributed.print.business.enums.MakeMethodEnum;
|
|
import com.qmth.distributed.print.business.mapper.ExamCardMapper;
|
|
import com.qmth.distributed.print.business.mapper.ExamCardMapper;
|
|
@@ -110,41 +107,46 @@ public class DownloadServiceImpl implements DownloadService {
|
|
}
|
|
}
|
|
String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
|
|
String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
|
|
List<JSONObject> jsonObjectList = JSONObject.parseArray(paperAttachmentIds, JSONObject.class);
|
|
List<JSONObject> jsonObjectList = JSONObject.parseArray(paperAttachmentIds, JSONObject.class);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 收集处理试卷和题卡
|
|
// 本地存储目录
|
|
// 本地存储目录
|
|
String rootPath = dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + System.currentTimeMillis();
|
|
String rootPath = dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + System.currentTimeMillis();
|
|
List<File> fileList = new ArrayList<>();
|
|
List<File> fileList = new ArrayList<>();
|
|
- // 试卷
|
|
|
|
|
|
+
|
|
List<String> unexposedPaperTypes = Arrays.asList(unexposedPaperType.split(","));
|
|
List<String> unexposedPaperTypes = Arrays.asList(unexposedPaperType.split(","));
|
|
- for (JSONObject jsonObject : jsonObjectList) {
|
|
|
|
- String attachmentId = jsonObject.get("attachmentId").toString();
|
|
|
|
- String name = jsonObject.get("name").toString();
|
|
|
|
- if (!unexposedPaperTypes.contains(name)) {
|
|
|
|
|
|
+ List<ExamPaperInfoDto> paperInfoDtoList = JSONObject.parseArray(paperAttachmentIds, ExamPaperInfoDto.class);
|
|
|
|
+ if (Objects.isNull(paperInfoDtoList)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
|
|
|
|
+ }
|
|
|
|
+ for (ExamPaperInfoDto paperInfo : paperInfoDtoList) {
|
|
|
|
+ String paperType = paperInfo.getName();
|
|
|
|
+ if (!unexposedPaperTypes.contains(paperType)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 试卷附件id
|
|
|
|
+ Long attachmentId = paperInfo.getAttachmentId();
|
|
|
|
+ // 题卡id
|
|
|
|
+ Long cardId = paperInfo.getCardId();
|
|
|
|
+
|
|
|
|
+ // 试卷
|
|
BasicAttachment attachment = basicAttachmentMapper.selectById(attachmentId);
|
|
BasicAttachment attachment = basicAttachmentMapper.selectById(attachmentId);
|
|
if (attachment == null) {
|
|
if (attachment == null) {
|
|
throw ExceptionResultEnum.ERROR.exception("附件数据异常");
|
|
throw ExceptionResultEnum.ERROR.exception("附件数据异常");
|
|
}
|
|
}
|
|
String paperPath = rootPath + File.separator + examTask.getCourseName() + "-" + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
|
|
String paperPath = rootPath + File.separator + examTask.getCourseName() + "-" + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
|
|
- String fileName = "试卷" + "_" + attachment.getName() + "_" + name + attachment.getType();
|
|
|
|
|
|
+ String fileName = "试卷" + "_" + attachment.getName() + "_" + paperType + attachment.getType();
|
|
fileList.add(attachmentCommonService.downloadFile(paperPath, fileName, attachment));
|
|
fileList.add(attachmentCommonService.downloadFile(paperPath, fileName, attachment));
|
|
- }
|
|
|
|
|
|
|
|
- // 题卡
|
|
|
|
-// Long cardId = examTaskDetail.getCardId();
|
|
|
|
- if (Objects.nonNull(examTaskDetail.getPaperAttachmentIds())) {
|
|
|
|
- JSONArray jsonArrayPaper = JSONArray.parseArray(examTaskDetail.getPaperAttachmentIds());
|
|
|
|
- String cardId = null;
|
|
|
|
- for (int i = 0; i < jsonArrayPaper.size(); i++) {
|
|
|
|
- JSONObject object = jsonArrayPaper.getJSONObject(i);
|
|
|
|
- cardId = (String) object.get("cardId");
|
|
|
|
- }
|
|
|
|
- if (cardId != null) {
|
|
|
|
|
|
+ // 题卡
|
|
|
|
+ if (cardId != null){
|
|
ExamCard examCard = examCardMapper.selectById(cardId);
|
|
ExamCard examCard = examCardMapper.selectById(cardId);
|
|
|
|
|
|
String cardPath = rootPath + File.separator + examTask.getCourseName() + "-" + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
|
|
String cardPath = rootPath + File.separator + examTask.getCourseName() + "-" + examTask.getCourseCode() + File.separator + examTask.getPaperNumber();
|
|
- String cardHtmlPath = cardPath + File.separator + "题卡" + "_" + examTask.getCourseName() + SystemConstant.HTML_PREFIX;
|
|
|
|
- String cardPdfPath = cardPath + File.separator + "题卡" + "_" + examTask.getCourseName() + SystemConstant.PDF_PREFIX;
|
|
|
|
|
|
+ String cardHtmlPath = cardPath + File.separator + "题卡" + "_" + examTask.getCourseName() + "_" + paperType + SystemConstant.HTML_PREFIX;
|
|
|
|
+ String cardPdfPath = cardPath + File.separator + "题卡" + "_" + examTask.getCourseName() + "_" + paperType + SystemConstant.PDF_PREFIX;
|
|
|
|
|
|
ExamCardDetail examCardDetail = examCardDetailService.getByCardId(examCard.getId());
|
|
ExamCardDetail examCardDetail = examCardDetailService.getByCardId(examCard.getId());
|
|
String htmlContent;
|
|
String htmlContent;
|
|
@@ -210,7 +212,6 @@ public class DownloadServiceImpl implements DownloadService {
|
|
String courseCode = examTaskDetailDto.getCourseCode();
|
|
String courseCode = examTaskDetailDto.getCourseCode();
|
|
String courseName = examTaskDetailDto.getCourseName();
|
|
String courseName = examTaskDetailDto.getCourseName();
|
|
String paperNumber = examTaskDetailDto.getPaperNumber();
|
|
String paperNumber = examTaskDetailDto.getPaperNumber();
|
|
- Long examCardId = examTaskDetailDto.getExamCardId();
|
|
|
|
Long cardRuleId = SystemConstant.convertIdToLong(examTaskDetailDto.getCardRuleId());
|
|
Long cardRuleId = SystemConstant.convertIdToLong(examTaskDetailDto.getCardRuleId());
|
|
|
|
|
|
// 生成导出对象
|
|
// 生成导出对象
|
|
@@ -231,15 +232,16 @@ public class DownloadServiceImpl implements DownloadService {
|
|
List<String> exposedPaperTypeList = Arrays.asList(examTaskDetailDto.getExposedPaperType().split(","));
|
|
List<String> exposedPaperTypeList = Arrays.asList(examTaskDetailDto.getExposedPaperType().split(","));
|
|
List<String> unexposedPaperTypeList = Arrays.asList(examTaskDetailDto.getUnexposedPaperType().split(","));
|
|
List<String> unexposedPaperTypeList = Arrays.asList(examTaskDetailDto.getUnexposedPaperType().split(","));
|
|
|
|
|
|
- List<Map> paperInfo = JSONObject.parseArray(examTaskDetailDto.getPaperAttachmentIds(), Map.class);
|
|
|
|
|
|
+ List<ExamPaperInfoDto> paperInfo = JSONObject.parseArray(examTaskDetailDto.getPaperAttachmentIds(), ExamPaperInfoDto.class);
|
|
if (Objects.isNull(paperInfo)) {
|
|
if (Objects.isNull(paperInfo)) {
|
|
throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
|
|
throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
|
|
}
|
|
}
|
|
// 试卷信息
|
|
// 试卷信息
|
|
- for (Map paper : paperInfo) {
|
|
|
|
- Long attachmentId = SystemConstant.convertIdToLong(String.valueOf(paper.get("attachmentId")));
|
|
|
|
|
|
+ for (ExamPaperInfoDto paper : paperInfo) {
|
|
|
|
+ Long cardId = paper.getCardId();
|
|
|
|
+ Long attachmentId = paper.getAttachmentId();
|
|
BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
|
|
- String paperType = String.valueOf(paper.get("name"));
|
|
|
|
|
|
+ String paperType = paper.getName();
|
|
String paperName = basicAttachment.getName();
|
|
String paperName = basicAttachment.getName();
|
|
String paperSuffix = basicAttachment.getType();
|
|
String paperSuffix = basicAttachment.getType();
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
@@ -267,7 +269,7 @@ public class DownloadServiceImpl implements DownloadService {
|
|
cell.setCourseName(courseName);
|
|
cell.setCourseName(courseName);
|
|
cell.setPaperNumber(paperNumber);
|
|
cell.setPaperNumber(paperNumber);
|
|
// 题卡
|
|
// 题卡
|
|
- cell.setExamCardId(examCardId);
|
|
|
|
|
|
+ cell.setExamCardId(cardId);
|
|
cell.setCardRuleId(cardRuleId);
|
|
cell.setCardRuleId(cardRuleId);
|
|
// 试卷
|
|
// 试卷
|
|
cell.setPaperType(paperType);
|
|
cell.setPaperType(paperType);
|