|
@@ -25,6 +25,7 @@ import com.gree.mall.miniapp.utils.IpUtil;
|
|
|
import com.gree.mall.miniapp.utils.StringUtil;
|
|
|
import com.gree.mall.miniapp.utils.ocr.OCRUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.coobird.thumbnailator.Thumbnails;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -32,10 +33,7 @@ import org.springframework.util.FileCopyUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.io.ByteArrayInputStream;
|
|
|
-import java.io.ByteArrayOutputStream;
|
|
|
-import java.io.File;
|
|
|
-import java.io.InputStream;
|
|
|
+import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -633,13 +631,17 @@ public class WorkerLogic {
|
|
|
}
|
|
|
|
|
|
// 创建文件
|
|
|
- File uploadFile = new File(mkdir + signFile.getOriginalFilename());
|
|
|
+ final String signFilePath = mkdir + signFile.getOriginalFilename();
|
|
|
+ File outputFile = new File(mkdir + "r" +signFile.getOriginalFilename());
|
|
|
+ File uploadFile = new File(signFilePath);
|
|
|
uploadFile.createNewFile();
|
|
|
|
|
|
// 将文件写入磁盘
|
|
|
FileCopyUtils.copy(signFile.getBytes(), uploadFile);
|
|
|
|
|
|
- final InputStream inputStream = signFile.getInputStream();
|
|
|
+ Thumbnails.of(uploadFile).scale(1).rotate(-90).toFile(outputFile);
|
|
|
+
|
|
|
+ final InputStream inputStream = new FileInputStream(outputFile);
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
byte[] buffer = new byte[1024];
|
|
|
int length = 0;
|