|
@@ -105,8 +105,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
@Resource
|
|
|
ExamDetailService examDetailService;
|
|
|
|
|
|
- @Resource
|
|
|
- OssUtil ossUtil;
|
|
|
+// @Resource
|
|
|
+// OssUtil ossUtil;
|
|
|
|
|
|
@Resource
|
|
|
CommonCacheService commonCacheService;
|
|
@@ -150,6 +150,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
@Resource
|
|
|
SysUserService sysUserService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ FileStoreUtil fileStoreUtil;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 创建pdf前置条件
|
|
@@ -218,7 +221,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
List<BasicAttachment> basicAttachmentList,
|
|
|
Set<Long> attachmentIds,
|
|
|
List<PdfDto>... list
|
|
|
- ) throws IOException {
|
|
|
+ ) throws Exception {
|
|
|
if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
|
|
|
String printContent = examPrintPlan.getPrintContent();
|
|
|
if (StringUtils.isBlank(printContent)) {
|
|
@@ -368,7 +371,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
* @throws DocumentException
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void createA4File(ExamPrintPlan examPrintPlan, ExamDetail examDetail, BasicSchool basicSchool, Set<File> ftlList, List<ExamDetailCourse> examDetailCourseList, List<PdfDto>... list) throws IOException, DocumentException {
|
|
|
+ public void createA4File(ExamPrintPlan examPrintPlan, ExamDetail examDetail, BasicSchool basicSchool, Set<File> ftlList, List<ExamDetailCourse> examDetailCourseList, List<PdfDto>... list) throws Exception {
|
|
|
List<Long> examDetailCourseListIds = examDetailCourseList.stream().map(s -> s.getId()).collect(Collectors.toList());
|
|
|
if (Objects.nonNull(examPrintPlan.getOrdinaryContent())) {
|
|
|
//获取普通印品
|
|
@@ -557,7 +560,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
|
|
|
String dirName = stringJoiner.toString().replaceAll("\\\\", "/");
|
|
|
|
|
|
- ossUtil.ossUpload(dirName, in, null);
|
|
|
+// ossUtil.ossUpload(dirName, in, null);
|
|
|
+ fileStoreUtil.ossUpload(dirName, in,DigestUtils.md5Hex(new ByteArrayInputStream(outputStream.toByteArray())), fileStoreUtil.getUploadEnumByPath(dirName).getFssType());
|
|
|
jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
|
jsonObject.put(SystemConstant.PATH, dirName);
|
|
|
jsonObject.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.FILE);
|
|
@@ -806,13 +810,17 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
List<File> sourceFiles = new ArrayList<>();
|
|
|
for (BasicAttachment basicAttachment : basicAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
|
+ UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
|
|
|
+
|
|
|
StringJoiner stringJoinerPdf = new StringJoiner("")
|
|
|
.add(SystemConstant.TEMP_FILES_DIR).add(File.separator)
|
|
|
.add((String) jsonObject.get(SystemConstant.PATH));
|
|
|
- sourceFiles.add(ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), stringJoinerPdf.toString()));
|
|
|
+// sourceFiles.add(ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), stringJoinerPdf.toString()));
|
|
|
+ sourceFiles.add(fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), stringJoinerPdf.toString(),uploadFileEnum.getFssType()));
|
|
|
}
|
|
|
FileUtil.doZip(zipFile, sourceFiles);
|
|
|
- ossUtil.ossUpload(dirName.toString(), zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
|
+// ossUtil.ossUpload(dirName.toString(), zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
|
+ fileStoreUtil.ossUpload(dirName.toString(), zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))),fileStoreUtil.getUploadEnumByPath(dirName.toString()).getFssType());
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put(SystemConstant.PATH, dirName.toString());
|
|
|
jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
@@ -838,7 +846,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String, Object> executeExportSampleLogic(Map<String, Object> map) throws IOException {
|
|
|
+ public Map<String, Object> executeExportSampleLogic(Map<String, Object> map) throws Exception {
|
|
|
int count = 0;
|
|
|
TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
LocalDateTime nowTime = LocalDateTime.now();
|
|
@@ -892,8 +900,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
List<BasicAttachment> paperAttachmentList = basicAttachmentService.listByIds(attPaperIds);
|
|
|
for (BasicAttachment paperAttachment : paperAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(paperAttachment.getPath());
|
|
|
+ UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
|
|
|
String paperPath = firstPath + File.separator + "试卷" + File.separator + paperAttachment.getName() + paperAttachment.getType();
|
|
|
- ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath);
|
|
|
+// ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath);
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath,uploadFileEnum.getFssType());
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
@@ -913,8 +923,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
List<BasicAttachment> confirmAttachmentList = basicAttachmentService.listByIds(attConfirmIds);
|
|
|
for (BasicAttachment confirmAttachment : confirmAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(confirmAttachment.getPath());
|
|
|
+ UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
|
|
|
String confirmPath = firstPath + File.separator + "审核样本" + File.separator + confirmAttachment.getName() + confirmAttachment.getType();
|
|
|
- ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), confirmPath);
|
|
|
+// ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), confirmPath);
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), confirmPath,uploadFileEnum.getFssType());
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
@@ -945,7 +957,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
|
- ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), cardPath);
|
|
|
+ UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
|
|
|
+// ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), cardPath);
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), cardPath,uploadFileEnum.getFssType());
|
|
|
} else {
|
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId, cardId));
|
|
|
if (examCardDetailList.size() != 1) {
|
|
@@ -964,7 +978,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
count++;
|
|
|
}
|
|
|
ZipUtil.zip(zipLocalRootPath, zipFile.getPath(), false);
|
|
|
- ossUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
|
+// ossUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
|
+ fileStoreUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))),fileStoreUtil.getUploadEnumByPath(dirNameTmp).getFssType());
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put(SystemConstant.PATH, dirNameTmp);
|
|
|
jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
@@ -977,7 +992,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) throws IOException {
|
|
|
+ public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) throws Exception {
|
|
|
TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
String yyyyMMddHH24mmss = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
|
|
BasicSchool basicSchool = commonCacheService.schoolCache(tbTask.getSchoolId());
|
|
@@ -1015,7 +1030,10 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
if (Objects.nonNull(attachment)) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(attachment.getPath());
|
|
|
String paperPath = zipLocalRootPath + File.separator + examTask.getPaperNumber() + File.separator + "试卷" + "_" + examTask.getPaperNumber() + "_" + name + attachment.getType();
|
|
|
- ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath);
|
|
|
+ UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
|
|
|
+
|
|
|
+// ossUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath);
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath,uploadFileEnum.getFssType());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1065,7 +1083,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
|
|
|
ZipUtil.zip(zipLocalRootPath, zipFile.getPath(), false);
|
|
|
- ossUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
|
+// ossUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));
|
|
|
+ fileStoreUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))),fileStoreUtil.getUploadEnumByPath(dirNameTmp).getFssType());
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put(SystemConstant.PATH, dirNameTmp);
|
|
|
jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
|