|
|
@@ -32,16 +32,15 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
|
|
|
@Override
|
|
|
public ResultData uploadFile(MultipartFile file) throws IOException {
|
|
|
-
|
|
|
+ String uuid = UUID.randomUUID().toString();
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
String extName = originalFilename.substring(originalFilename.lastIndexOf("."));
|
|
|
String ossPath = String.format(UploadFilePath.MANAGE_FILE_PATH, DateUtil.format(Calendar.getInstance()
|
|
|
- .getTime(), DateExtUtil.dateStyle6), UUID.randomUUID() + extName);
|
|
|
-
|
|
|
-// uploadToOssUtil.upload(file.getInputStream().);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ .getTime(), DateExtUtil.dateStyle6), uuid + extName);
|
|
|
+ File tempFile = File.createTempFile(uuid ,extName);
|
|
|
+ file.transferTo(tempFile);
|
|
|
+ uploadToOssUtil.upload(tempFile.getPath(), ossPath);
|
|
|
+ tempFile.deleteOnExit();
|
|
|
return ResultData.ok(ossPath);
|
|
|
|
|
|
}
|