Преглед на файлове

1、后天修复sourcedata在文件为多个时,多录入的问题。

jessie преди 5 години
родител
ревизия
ea85f35912

+ 0 - 2
src/main/java/com/pavis/ai/app/fjsocrasy/common/utils/ocr/ParseUtils.java

@@ -564,8 +564,6 @@ public class ParseUtils {
         return new ResData<>();
     }
 
-
-
     /**
      * 14.贷款申请表-乐享贷合并版(虚拟信息)
      *

+ 28 - 3
src/main/java/com/pavis/ai/app/fjsocrasy/controller/BackController.java

@@ -306,9 +306,23 @@ public class BackController {
 
 
 
+    @ApiOperation("富士通图片识别同步接口 内部测试用")
+    @ApiOperationSupport(order = 2)
+    @PostMapping("/fjs/req")
+    public ResultBody req(String reqId, String fileType, String data, @RequestParam("files") MultipartFile[] files) throws Exception {
+        Map<String,Object> map = new HashMap<>();
+        map.put("reqId",reqId);
+        map.put("fileType",fileType);
+        map.put("data",JSON.parseObject(data));
+        List<String> fileList = new ArrayList<>();
+        for (MultipartFile file : files) {
+            fileList.add(file.getOriginalFilename());
+        }
+        map.put("files",fileList);
+        return ResultBody.ok().data(map);
+    }
 
-
-    @ApiOperation("历史版本获取接口")
+        @ApiOperation("历史版本获取接口")
     @ApiOperationSupport(order = 10)
     @GetMapping("/version")
     public ResultBody version() {
@@ -469,7 +483,17 @@ public class BackController {
                 .descriptionOne("1、针对日期手写字优化。")
                 .descriptionTwo("2020-08-03 生产环境")
                 .descriptionThree("V1.16")
-                .descriptionFour("1、针对日期手写字优化.2、多线程异常解决。")
+                // .2、多线程异常解决。
+                .descriptionFour("1、针对日期手写字优化")
+                .build();
+        ProVersion pv18 = ProVersion.builder()
+                .date("2020-08-07 测试环境")
+                .version("V3.9")
+                .descriptionOne("1、新增类型18:新版信用贷合同。")
+                .descriptionTwo("2020-08-03 生产环境")
+                .descriptionThree("V1.16")
+                // .2、多线程异常解决。
+                .descriptionFour("")
                 .build();
 
         ver.add(pv1);
@@ -489,6 +513,7 @@ public class BackController {
         ver.add(pv15);
         ver.add(pv16);
         ver.add(pv17);
+        ver.add(pv18);
         return ver;
     }
 

+ 3 - 3
src/main/java/com/pavis/ai/app/fjsocrasy/service/InternalSendService.java

@@ -15,15 +15,15 @@ import java.util.Map;
  * @desc 内部算法调用。
  **/
 // 本地测试
+
+// @FeignClient(value = "internalSendService",url = "http://180.76.146.227:8089")
 // @FeignClient(value = "internalSendService",url = "http://192.168.1.202:8089")
 // 本地单个字段置信度。
 // @FeignClient(value = "internalSendService",url = "http://192.168.1.202:8099")
 // @FeignClient(value = "internalSendService",url = "http://192.168.1.200:28011")
 // @FeignClient(value = "internalSendService",url = "http://127.0.0.1:28011")
 // 测试环境
-// @FeignClient(value = "internalSendService",url = "http://180.76.146.227:8099")
-
-@FeignClient(value = "internalSendService",url = "http://180.76.146.227:8089")
+@FeignClient(value = "internalSendService",url = "http://180.76.146.227:8099")
 // @FeignClient(value = "internalSendService",url = "http://180.76.146.227:18888")
 // 生产环境
 // @FeignClient(value = "internalSendService",url = "http://47.104.109.52:8089")

+ 20 - 11
src/main/java/com/pavis/ai/app/fjsocrasy/service/impl/UploadServiceImpl.java

@@ -276,15 +276,16 @@ public class UploadServiceImpl implements UploadService {
                 .remarks("")
                 .build();
         int savedId = uploadMapper.insert(upload);
-        if (savedId > 0) {
-            JSONObject dataJson = JSON.parseObject(data);
-            // 原始数据入库。
-            int insertId = savedSourceData(reqId, type, dataJson, excTime);
-            log.info("insert result:{}", insertId);
-            return insertId;
-        } else {
-            return 0;
-        }
+        // if (savedId > 0) {
+        //     JSONObject dataJson = JSON.parseObject(data);
+        //     // 原始数据入库。
+        //     int insertId = savedSourceData(reqId, type, dataJson, excTime);
+        //     log.info("insert result:{}", insertId);
+        //     return insertId;
+        // } else {
+        //     return 0;
+        // }
+        return savedId;
     }
 
     @Override
@@ -959,6 +960,7 @@ public class UploadServiceImpl implements UploadService {
     @Override
     public List<FileDetails> writeToDisk(MultipartFile[] files, String reqId, String fileType, String data, Long startTime) throws Exception {
         List<FileDetails> paths = new ArrayList<>();
+        int savedId = 0;
         for (MultipartFile file : files) {
             String dynamicPath = GeneralUtils.checkedFileIsExisted(commonProperties.getDir().getUpload(),
                     fileType);
@@ -979,7 +981,7 @@ public class UploadServiceImpl implements UploadService {
                     e.printStackTrace();
                 }
                 // 上传数据信息入库。
-                save(reqId, fileType, fileName, file.getSize(), data, startTime);
+                savedId = save(reqId, fileType, fileName, file.getSize(), data, startTime);
                 // 获取可用的图片路径
                 paths = (GeneralUtils.pdfToImg(fileType, commonProperties.getDir().getUpload(),
                         path, StringUtils.substringBeforeLast(fileName, ".")));
@@ -989,7 +991,7 @@ public class UploadServiceImpl implements UploadService {
                     // 无需旋转
                     file.transferTo(new File(path));
                     // 上传数据信息入库。
-                    save(reqId, fileType,
+                    savedId = save(reqId, fileType,
                             commonProperties.getUrl().getPath() + fileType + "/" + DateUtils.createFilesByDate() + "/" + fileName,
                             file.getSize(), data, startTime);
                     // 构造返回path信息,todo 此处需要检查存入的文件是否是所需要的文件,多张路径时是否符合。
@@ -1004,6 +1006,13 @@ public class UploadServiceImpl implements UploadService {
                 }
             }
         }
+        // 将sourcedata 入库。
+        JSONObject dataJson = JSON.parseObject(data);
+        long endTime = System.currentTimeMillis();
+        String excTime = DateUtils.getExcTime(startTime, endTime);
+        // 原始数据入库。
+        int insertId = savedSourceData(reqId, fileType, dataJson, excTime);
+        log.info("insert result:{}", insertId);
         return paths;
     }
 

+ 26 - 26
src/test/java/com/pavis/ai/app/fjsocrasy/FjsOcrAsyApplicationTests.java

@@ -1,26 +1,26 @@
-package com.pavis.ai.app.fjsocrasy;
-
-import com.pavis.ai.app.fjsocrasy.form.res.ResData;
-import com.pavis.ai.app.fjsocrasy.service.BackService;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class FjsOcrAsyApplicationTests {
-
-    @Autowired
-    private BackService backService;
-
-    @Test
-    public void contextLoads() {
-        ResData resData = new ResData();
-        resData.setMidConfidence("2");
-        resData.setOverallConfidence("2");
-        backService.backToFjs(resData,"10",System.currentTimeMillis(),"1");
-    }
-
-}
+// package com.pavis.ai.app.fjsocrasy;
+//
+// import com.pavis.ai.app.fjsocrasy.form.res.ResData;
+// import com.pavis.ai.app.fjsocrasy.service.BackService;
+// import org.junit.Test;
+// import org.junit.runner.RunWith;
+// import org.springframework.beans.factory.annotation.Autowired;
+// import org.springframework.boot.test.context.SpringBootTest;
+// import org.springframework.test.context.junit4.SpringRunner;
+//
+// @RunWith(SpringRunner.class)
+// @SpringBootTest
+// public class FjsOcrAsyApplicationTests {
+//
+//     @Autowired
+//     private BackService backService;
+//
+//     @Test
+//     public void contextLoads() {
+//         ResData resData = new ResData();
+//         resData.setMidConfidence("2");
+//         resData.setOverallConfidence("2");
+//         backService.backToFjs(resData,"10",System.currentTimeMillis(),"1");
+//     }
+//
+// }