|
@@ -909,6 +909,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
zipFile.getParentFile().mkdirs();
|
|
|
zipFile.createNewFile();
|
|
|
}
|
|
|
+
|
|
|
+ boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
+
|
|
|
List<File> sourceFiles = new ArrayList<>();
|
|
|
for (BasicAttachment basicAttachment : basicAttachmentList) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
@@ -917,8 +920,13 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
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(fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), stringJoinerPdf.toString(), uploadFileEnum.getFssType()));
|
|
|
+ File htmlFile = null;
|
|
|
+ if (oss) {
|
|
|
+ htmlFile = fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), stringJoinerPdf.toString(), uploadFileEnum.getFssType());
|
|
|
+ } else {
|
|
|
+ htmlFile = new File((String) jsonObject.get(SystemConstant.PATH));
|
|
|
+ }
|
|
|
+ sourceFiles.add(htmlFile);
|
|
|
}
|
|
|
FileUtil.doZip(zipFile, sourceFiles);
|
|
|
String ossDirName = dirName.toString().replaceAll("\\\\", "/");
|
|
@@ -969,6 +977,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
zipFile.createNewFile();
|
|
|
}
|
|
|
|
|
|
+ boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
+
|
|
|
// 跟文件路径
|
|
|
String zipLocalRootPath = SystemConstant.TEMP_FILES_DIR + File.separator + System.currentTimeMillis();
|
|
|
Long[] ids = (Long[]) map.get("ids");
|
|
@@ -1005,8 +1015,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
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);
|
|
|
- fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath, uploadFileEnum.getFssType());
|
|
|
+ if (oss) {
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath, uploadFileEnum.getFssType());
|
|
|
+ } else {
|
|
|
+ FileUtil.copyFile(jsonObject.getString(SystemConstant.PATH), paperPath);
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
@@ -1027,8 +1040,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
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);
|
|
|
- fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), confirmPath, uploadFileEnum.getFssType());
|
|
|
+ if (oss) {
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), confirmPath, uploadFileEnum.getFssType());
|
|
|
+ } else {
|
|
|
+ FileUtil.copyFile(jsonObject.getString(SystemConstant.PATH), confirmPath);
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
@@ -1052,8 +1068,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(cardAttachment.getPath());
|
|
|
String cardPath = firstPath + File.separator + "题卡" + File.separator + cardAttachment.getName() + cardAttachment.getType();
|
|
|
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());
|
|
|
+
|
|
|
+ if (oss) {
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), cardPath, uploadFileEnum.getFssType());
|
|
|
+ } else {
|
|
|
+ FileUtil.copyFile(jsonObject.getString(SystemConstant.PATH), cardPath);
|
|
|
+ }
|
|
|
} else {
|
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(new QueryWrapper<ExamCardDetail>().lambda().eq(ExamCardDetail::getCardId, cardId));
|
|
|
if (examCardDetailList.size() != 1) {
|
|
@@ -1105,6 +1125,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
// 根文件路径
|
|
|
String zipLocalRootPath = SystemConstant.TEMP_FILES_DIR + File.separator + System.currentTimeMillis();
|
|
|
|
|
|
+ boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
+
|
|
|
List<ExamTaskDetailDto> examTasks = (List<ExamTaskDetailDto>) map.get("examTasks");
|
|
|
for (ExamTaskDetailDto examTask : examTasks) {
|
|
|
ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(Long.valueOf(examTask.getId()));
|
|
@@ -1126,8 +1148,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String paperPath = zipLocalRootPath + File.separator + examTask.getPaperNumber() + File.separator + "试卷" + "_" + examTask.getPaperNumber() + "_" + name + attachment.getType();
|
|
|
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());
|
|
|
+ if (oss) {
|
|
|
+ fileStoreUtil.ossDownload((String) jsonObject.get(SystemConstant.PATH), paperPath, uploadFileEnum.getFssType());
|
|
|
+ } else {
|
|
|
+ FileUtil.copyFile(jsonObject.getString(SystemConstant.PATH), paperPath);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1177,7 +1202,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
|
|
|
ZipUtil.zip(zipLocalRootPath, zipFile.getPath(), false);
|
|
|
-// 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);
|
|
@@ -1788,6 +1812,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
+
|
|
|
if (Objects.isNull(paperFileDownloadContent)) {
|
|
|
continue;
|
|
|
}
|
|
@@ -1822,7 +1848,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
paperName = paperName + "-" + examTaskPaperFileDto.getPaperType();
|
|
|
String paperLocalPath = filePath + paperName + examTaskPaperFileDto.getPaperSuffix();
|
|
|
String paperPath = examTaskPaperFileDto.getPaperPath();
|
|
|
- fileStoreUtil.ossDownload(paperPath, paperLocalPath, fileStoreUtil.getUploadEnumByPath(paperPath).getFssType());
|
|
|
+ if (oss) {
|
|
|
+ fileStoreUtil.ossDownload(paperPath, paperLocalPath, fileStoreUtil.getUploadEnumByPath(paperPath).getFssType());
|
|
|
+ } else {
|
|
|
+ FileUtil.copyFile(paperPath, paperLocalPath);
|
|
|
+ }
|
|
|
courseCount = 1;
|
|
|
}
|
|
|
break;
|
|
@@ -1854,7 +1884,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
paperName = paperName + "-" + examTaskPaperFileDto.getPaperType();
|
|
|
String paperLocalPath = filePath + paperName + examTaskPaperFileDto.getPaperSuffix();
|
|
|
String paperPath = examTaskPaperFileDto.getPaperPath();
|
|
|
- fileStoreUtil.ossDownload(paperPath, paperLocalPath, fileStoreUtil.getUploadEnumByPath(paperPath).getFssType());
|
|
|
+
|
|
|
+ if (oss) {
|
|
|
+ fileStoreUtil.ossDownload(paperPath, paperLocalPath, fileStoreUtil.getUploadEnumByPath(paperPath).getFssType());
|
|
|
+ } else {
|
|
|
+ FileUtil.copyFile(paperPath, paperLocalPath);
|
|
|
+ }
|
|
|
courseCount = 1;
|
|
|
}
|
|
|
break;
|