新增generate like功能,及新增一次上传多张图片功能
This commit is contained in:
@@ -145,6 +145,28 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
private String calculateFileUrl(PythonToJavaApiOperationTypeEnum operationType) {
|
||||
String rootPath = fileProperties.getSys().getPath();
|
||||
String day = DateUtil.dateToStr(new Date(), DateUtil.YYYYMM);
|
||||
|
||||
Reference in New Issue
Block a user