修改异常处理+代码清理
This commit is contained in:
@@ -145,26 +145,26 @@ public class PythonService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<String> upload(MultipartFile[] files, String operateType) {
|
||||
List<String> paths = new ArrayList<>();
|
||||
//用户信息
|
||||
PythonToJavaApiOperationTypeEnum operationType = PythonToJavaApiOperationTypeEnum.uploadOf(operateType);
|
||||
Assert.notNull(operationType, "unknown operateType " + operateType + "!");
|
||||
String path = calculateFileUrl(operationType);
|
||||
for (MultipartFile file : files) {
|
||||
File generateFile = FileUtil.upload2(file, path);
|
||||
Assert.notNull(generateFile, "An error occurred while processing the file, please try again later");
|
||||
|
||||
String linuxDomain = fileProperties.getLinuxDomain();
|
||||
if (!StringUtils.isEmpty(linuxDomain)) {
|
||||
//linux 系统
|
||||
String oldPath = fileProperties.getSys().getPath();
|
||||
paths.add(generateFile.getAbsolutePath().replace(oldPath, linuxDomain));
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
// @Transactional
|
||||
// public List<String> upload(MultipartFile[] files, String operateType) {
|
||||
// List<String> paths = new ArrayList<>();
|
||||
// //用户信息
|
||||
// PythonToJavaApiOperationTypeEnum operationType = PythonToJavaApiOperationTypeEnum.uploadOf(operateType);
|
||||
// Assert.notNull(operationType, "unknown operateType " + operateType + "!");
|
||||
// String path = calculateFileUrl(operationType);
|
||||
// for (MultipartFile file : files) {
|
||||
// File generateFile = FileUtil.upload2(file, path);
|
||||
// Assert.notNull(generateFile, "An error occurred while processing the file!");
|
||||
//
|
||||
// String linuxDomain = fileProperties.getLinuxDomain();
|
||||
// if (!StringUtils.isEmpty(linuxDomain)) {
|
||||
// //linux 系统
|
||||
// String oldPath = fileProperties.getSys().getPath();
|
||||
// paths.add(generateFile.getAbsolutePath().replace(oldPath, linuxDomain));
|
||||
// }
|
||||
// }
|
||||
// return paths;
|
||||
// }
|
||||
|
||||
|
||||
private String calculateFileUrl(PythonToJavaApiOperationTypeEnum operationType) {
|
||||
|
||||
Reference in New Issue
Block a user