Commit 8eab34eb by guoxuejian

Merge branch 'prod' of http://git.raytue.com/GeoFly/GeoFlyApi into prod

parents 50829767 fa711dee
...@@ -196,7 +196,12 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ ...@@ -196,7 +196,12 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ
file.setPath(path); file.setPath(path);
file.setObjectKey(moveFilePath + "/" + callback.getFile().getName()); file.setObjectKey(moveFilePath + "/" + callback.getFile().getName());
moveFile(orgFilePath, moveFilePath, callback.getFile().getName()); try {
moveFile(orgFilePath, moveFilePath, callback.getFile().getName());
} catch (Exception e) {
log.error("Failed to move file for temporary task: {}", e.getMessage());
// 继续执行,不中断流程
}
} else { } else {
// 查询 任务的orgId // 查询 任务的orgId
String orgId = ""; String orgId = "";
...@@ -227,7 +232,12 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ ...@@ -227,7 +232,12 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ
file.setPath(path); file.setPath(path);
file.setObjectKey(moveFilePath + "/" + callback.getFile().getName()); file.setObjectKey(moveFilePath + "/" + callback.getFile().getName());
moveFile(orgFilePath, moveFilePath, callback.getFile().getName()); try {
moveFile(orgFilePath, moveFilePath, callback.getFile().getName());
} catch (Exception e) {
log.error("Failed to move file for wayline job: {}", e.getMessage());
// 继续执行,不中断流程
}
} else { } else {
file.setPath(path); file.setPath(path);
} }
...@@ -243,12 +253,17 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ ...@@ -243,12 +253,17 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ
boolean created = directory.mkdirs(); boolean created = directory.mkdirs();
} }
Path source = Paths.get(basePath, OssConfiguration.bucket, sourceFilePath, fileName); Path source = Paths.get(basePath, OssConfiguration.bucket, sourceFilePath, fileName);
// 检查源文件是否存在
if (!Files.exists(source)) {
log.warn("Source file does not exist: {}", source);
return; // 源文件不存在时直接返回,不抛出异常
}
Path targetDir = Paths.get(basePath, OssConfiguration.bucket, targetFilePath); Path targetDir = Paths.get(basePath, OssConfiguration.bucket, targetFilePath);
if (!Files.exists(targetDir)) { if (!Files.exists(targetDir)) {
Files.createDirectories(targetDir); Files.createDirectories(targetDir);
} }
Path target = targetDir.resolve(fileName); Path target = targetDir.resolve(fileName);
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
} }
private void notifyUploadedCount(MediaFileCountDTO mediaFileCount, TopicEventsRequest<FileUploadCallback> request, String jobId, DeviceDTO dock) { private void notifyUploadedCount(MediaFileCountDTO mediaFileCount, TopicEventsRequest<FileUploadCallback> request, String jobId, DeviceDTO dock) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment