|
@@ -56,6 +56,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.File;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -489,17 +490,7 @@ public class SignPfxFileController extends BladeController {
|
|
|
FileUtils.compressImage(localImgPath, compressImgPath, wide, high);
|
|
|
return R.data(newIOSSClient.uploadFile(id+".png", compressImgPath));
|
|
|
}
|
|
|
- /*弃用 预览电签图片之前的一个新增
|
|
|
- @PostMapping("/picPresave")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiOperation(value = "预览图片新增准备", notes = "传入signPfxFile")
|
|
|
- public R picPresave( @RequestParam MultipartFile file, @RequestParam double wide,@RequestParam double high) throws IOException {
|
|
|
- SignPfxFilePreVo signPfxFilePreVo = new SignPfxFilePreVo();
|
|
|
- signPfxFilePreVo.setFile(file);
|
|
|
- signPfxFilePreVo.setWide(wide);
|
|
|
- signPfxFilePreVo.setHigh(high);
|
|
|
- return pfxFilePreService.picPresave(signPfxFilePreVo);
|
|
|
- }*/
|
|
|
+
|
|
|
@PostMapping ("/prePicture")
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "预览电签后的图片", notes = "传入signPfxFile")
|
|
@@ -524,7 +515,7 @@ public class SignPfxFileController extends BladeController {
|
|
|
@PostMapping("/update")
|
|
|
@ApiOperationSupport(order = 5)
|
|
|
@ApiOperation(value = "修改", notes = "传入signPfxFile")
|
|
|
- public R<Boolean> update(@Valid @RequestBody SignPfxFileVO vo) {
|
|
|
+ public R<Boolean> update(@Valid @RequestBody SignPfxFileVO vo) throws Exception {
|
|
|
if (new Integer("2").equals(vo.getCertificateType())||new Integer("3").equals(vo.getCertificateType())) {
|
|
|
//查询旧数据
|
|
|
SignPfxFile oldData = this.signPfxFileService.getById(vo.getId());
|
|
@@ -536,6 +527,7 @@ public class SignPfxFileController extends BladeController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ vo.setSignatureFileUrl(compressionAndUpload(vo.getSignatureFileUrl(), vo.getWide(), vo.getHigh()));
|
|
|
return R.status(this.signPfxFileService.updateById(vo));
|
|
|
}
|
|
|
|
|
@@ -581,6 +573,16 @@ public class SignPfxFileController extends BladeController {
|
|
|
public R<Boolean> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
return R.status(this.signPfxFileService.deleteLogic(Func.toLongList(ids)));
|
|
|
}
|
|
|
+ public String compressionAndUpload(String fileStr, double wide, double high) throws Exception {
|
|
|
+ String file_path = FileUtils.getSysLocalFileUrl();
|
|
|
+ InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(fileStr);
|
|
|
+ //图片压缩后的地址
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
+ String compressImgPath = file_path + "/print//" + id + ".png";
|
|
|
+ FileUtils.compressImage(inputStreamByUrl, compressImgPath, wide, high);
|
|
|
+ BladeFile bladeFile = newIOSSClient.uploadFile(id + ".png", compressImgPath);
|
|
|
+ return bladeFile.getLink();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|