Browse Source

处理日志新增时日期双引号问题,处理电签签名修改保存中调用压缩图片接口

DengLinLang 1 month ago
parent
commit
9510e4211f

+ 0 - 16
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -21,9 +21,6 @@ import lombok.SneakyThrows;
 import org.apache.commons.codec.Charsets;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -4165,19 +4162,6 @@ public class ExcelTabController extends BladeController {
         }
     }
 
-    public static void main(String[] args) {
-        String Html1 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/privateUrl/1790283758071447552.html";
-        String local183 = "/home/www/wwwroot/Users/hongchuangyanfa/Desktop/";
-        String url183= "http://183.247.216.148:22776/";
-
-        String s = Html1.replaceAll(local183, url183);
-
-        System.out.println(s);
-    }
-
-
-
-
   //  @Scheduled(cron = "0/20 * * * * ?")
     public void SignInfo() {
         //执行代码

+ 14 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/SignPfxFileController.java

@@ -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();
+    }
 
 
 }

+ 2 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1194,10 +1194,10 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     try {
                         //添加被张表的操作日志
                         StringBuffer sb = new StringBuffer();
-
+                        String sqlInfoNew = sqlInfo.replace("\"", "'");
                         sb.append("insert into blade_tab_sql(p_key_id,user_id,create_time,sql_info) VALUES(");
                         sb.append(tableInfo.getPkeyId());sb.append(",");sb.append(user.getUserId());
-                        sb.append(","); sb.append("SYSDATE()");sb.append(",\"");sb.append(sqlInfo);
+                        sb.append(","); sb.append("SYSDATE()");sb.append(",\"");sb.append(sqlInfoNew);
                         sb.append("\")");
                         jdbcTemplate.execute(delSql);
                         jdbcTemplate.execute(sqlInfo);
@@ -1210,7 +1210,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         return R.fail(reason(e.getMessage()));
                     }
                 }
-
                 //获取节点
                 WbsTreeContract wbsTreeContract = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, tableInfoList.get(0).getPkeyId()));