Commit b1329054 authored by yaobaizheng's avatar yaobaizheng

图片时间计算

parent 812889a5
......@@ -62,7 +62,7 @@ public class UploadServiceImpl implements UploadService {
}else{
String newFile = IdUtil.simpleUUID();
String newFilename = newFile + fileLastType;
TimeInterval timer = DateUtil.timer();
//将MultipartFile转为File,存储为本地临时文件
String localDir = tempFilePath + newFilename;
File file = new File(localDir);
......@@ -72,13 +72,16 @@ public class UploadServiceImpl implements UploadService {
String newFilename1 = IdUtil.simpleUUID() + ".jpg";
String localDir1 = tempFilePath + newFilename1;
File file1 = FileUtil.file(localDir1);
TimeInterval timer = DateUtil.timer();
System.out.println("图片存储与新建"+timer.interval());
TimeInterval timer1 = DateUtil.timer();
Img.from(file).setQuality(1).write(file1);
System.out.println(timer.interval());
System.out.println("图片压缩"+timer1.interval());
TimeInterval timer2 = DateUtil.timer();
InputStream inputStream1 = new FileInputStream(localDir1);
filePath = "/" + date + "/" + newFile + ".jpg" ;
obsUtils.ObsUpload(bucketName, rootPath + filePath, inputStream1);
System.out.println("图片上传"+timer2.interval());
//删除临时文件
CompletableFuture.runAsync(()-> {
......
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