|
@@ -189,9 +189,11 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
|
|
|
String resultPath = StringUtils.substringAfter(algConfig.getOutUrl(), Constants.RESOURCE_PREFIX);
|
|
|
// 复制输出
|
|
|
// 复制csv
|
|
|
- String targetCsvPath = StringUtils.format("{}/{}/{}_{}_{}.csv", PadaphmConfig.getUploadPath(), DateUtils.datePath(), getOriginaFileName(data.getDataPath()), bizAlgType, Seq.getId(Seq.uploadSeqType));
|
|
|
- copyFile(algConfig.getOutUrl() + Constants.ALG_OUTPUT_CSV, targetCsvPath);
|
|
|
- returnMap.put("resultPath", targetCsvPath);
|
|
|
+ if (checkFileExist(algConfig.getOutUrl() + Constants.ALG_OUTPUT_CSV)) {
|
|
|
+ String targetCsvPath = StringUtils.format("{}/{}/{}_{}_{}.csv", PadaphmConfig.getUploadPath(), DateUtils.datePath(), getOriginaFileName(data.getDataPath()), bizAlgType, Seq.getId(Seq.uploadSeqType));
|
|
|
+ copyFile(algConfig.getOutUrl() + Constants.ALG_OUTPUT_CSV, targetCsvPath);
|
|
|
+ returnMap.put("resultPath", targetCsvPath);
|
|
|
+ }
|
|
|
// 复制jpg
|
|
|
if (checkFileExist(algConfig.getOutUrl() + Constants.ALG_OUTPUT_JPG)) {
|
|
|
String targetJpgPath = StringUtils.format("{}/{}/{}_{}_{}.jpg", PadaphmConfig.getUploadPath(), DateUtils.datePath(), getOriginaFileName(data.getDataPath()), bizAlgType, Seq.getId(Seq.uploadSeqType));
|
|
@@ -226,7 +228,7 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
|
|
|
return content.toString();
|
|
|
}
|
|
|
|
|
|
- private static void copyFile(String realDataPath, String inputUrl) {
|
|
|
+ private void copyFile(String realDataPath, String inputUrl) {
|
|
|
Path sourcePath = Paths.get(realDataPath); // 源文件路径
|
|
|
Path targetPath = Paths.get(inputUrl); // 目标文件路径
|
|
|
try {
|
|
@@ -237,6 +239,7 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
|
|
|
}
|
|
|
// 使用Files.copy()复制文件
|
|
|
Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
+ logger.info("文件已成功复制!source:{},target:{}",sourcePath, targetPath);
|
|
|
System.out.println("文件已成功复制!");
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
@@ -256,7 +259,9 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
|
|
|
Data newData = new Data();
|
|
|
String resultPath = resultMap.get("resultPath");
|
|
|
String resultImagePath = resultMap.get("resultImagePath");
|
|
|
- newData.setDataPath(resultPath.replaceFirst(PadaphmConfig.getProfile(),"/profile"));
|
|
|
+ if (checkFileExist(resultPath)) {
|
|
|
+ newData.setDataPath(resultPath.replaceFirst(PadaphmConfig.getProfile(), "/profile"));
|
|
|
+ }
|
|
|
if (checkFileExist(resultImagePath)) {
|
|
|
newData.setImagePath(resultImagePath.replaceFirst(PadaphmConfig.getProfile(),"/profile"));
|
|
|
}
|