|
@@ -1,26 +1,103 @@
|
|
|
-// 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.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.pavis.ai.app.fjsocrasy.common.utils.DateUtils;
|
|
|
+import com.pavis.ai.app.fjsocrasy.form.FileDetails;
|
|
|
+import com.pavis.ai.app.fjsocrasy.form.eighteen.Eighteen;
|
|
|
+import com.pavis.ai.app.fjsocrasy.form.res.ResData;
|
|
|
+import com.pavis.ai.app.fjsocrasy.mapper.ContractEighteenMapper;
|
|
|
+import com.pavis.ai.app.fjsocrasy.model.ContractEighteen;
|
|
|
+import com.pavis.ai.app.fjsocrasy.service.BackService;
|
|
|
+import com.pavis.ai.app.fjsocrasy.service.OcrService;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest
|
|
|
+public class FjsOcrAsyApplicationTests {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BackService backService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void contextLoads() {
|
|
|
+ String data = "{ \"lender\":\"王俞\", \"address\":\"上海市上海市管辖区浦东新区祝桥镇千汇路750弄60号401室\", \"mobile\":\"18501631918\", \"postCode\":\"200000\", \"idCode\":\"310225198803253034\", \"lower\":\"200000\", \"account\":\"王俞\", \"accountCode\":\"6217900800003831631\", \"deadline\":\"36\" , \"compareDate\":\"2020.04.15\" }";
|
|
|
+
|
|
|
+ System.err.println(changeSourceDataBy18(data));
|
|
|
+ // ResData resData = new ResData();
|
|
|
+ // resData.setMidConfidence("2");
|
|
|
+ // resData.setOverallConfidence("2");
|
|
|
+ // backService.backToFjs(resData,"10",System.currentTimeMillis(),"1");
|
|
|
+ }
|
|
|
+
|
|
|
+ public String changeSourceDataBy18(String data){
|
|
|
+ JSONObject js = JSON.parseObject(data);
|
|
|
+ if (js.containsKey("postCode")){
|
|
|
+ js.remove("postCode");
|
|
|
+ }
|
|
|
+ if (js.containsKey("deadline")){
|
|
|
+ js.remove("deadline");
|
|
|
+ }
|
|
|
+ System.err.println(js.toJSONString());
|
|
|
+ if (js.containsKey("address")){
|
|
|
+ js.put("addressSign",js.get("address").toString());
|
|
|
+ }
|
|
|
+ return js.toJSONString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OcrService ocrService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void test() throws IOException {
|
|
|
+ String data = "{ \"lender\":\"占小琴\", \"idCode\":\"420281198501257247\", \"mobile\":\"13872114908\", \"address\":\"湖北省黄石市下陆区半山骊园6栋1单元304室\", \"lower\":\"150000\", \"postCode\":\"200000\", \"deadline\":\"36\", \"period\":\"36\", \"account\":\"占小琴\", \"accountCode\":\"6217907600006022664\", \"loanType\":\"装修\", \"sendAddress\":\"湖北省黄石市下陆区半山骊园6栋1单元304室\" , \"compareDate\":\"2020.07.30\" }";
|
|
|
+ String reqId = "BO202008210002";
|
|
|
+ String fileType = "5";
|
|
|
+ String url = "";
|
|
|
+ String fileName = "";
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
+ // ocrService.toOcr(reqId, fileType, url, fileName, data, startTime);
|
|
|
+ ocrService.toOcr(reqId, fileType, url, fileName, data, startTime);
|
|
|
+ // ocrService.singleFileOcrSyn( reqId, fileType, FileDetails parsedFilePath, List<FileDetails> paths, sourceData, startTime);
|
|
|
+
|
|
|
+ System.err.println(changeSourceDataBy18(data));
|
|
|
+ // ResData resData = new ResData();
|
|
|
+ // resData.setMidConfidence("2");
|
|
|
+ // resData.setOverallConfidence("2");
|
|
|
+ // backService.backToFjs(resData,"10",System.currentTimeMillis(),"1");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ContractEighteenMapper contractEighteenMapper;
|
|
|
+ @Test
|
|
|
+ public void test18(){
|
|
|
+ String data = "{\"account\":\"占小琴\",\"accountCode\":\"6217907600006022664\",\"address\":\"湖北省黄石市下陆区半山骊园6栋1单元304室\",\"compareDate\":\"2020.07.30\",\"deadline\":\"\",\"idCode\":\"420281198501257247\",\"lender\":\"占小琴\",\"loanType\":\"装修\",\"lower\":\"150000\",\"mobile\":\"13872114908\",\"operateIp\":\"\",\"operateTime\":\"2020-08-21 15:37:16\",\"operator\":\"\",\"operatorId\":\"\",\"period\":\"36\",\"postCode\":\"\",\"remarks\":\"1301.0ms\",\"reqId\":\"BO202008210005\",\"sendAddress\":\"湖北省黄石市下陆区半山骊园6栋1单元304室\"}\n";
|
|
|
+ ContractEighteen contractEighteen;
|
|
|
+ if (null != data) {
|
|
|
+ Eighteen eighteen = JSONObject.parseObject(JSON.parseObject(data).toJSONString(), Eighteen.class);
|
|
|
+ contractEighteen = new ContractEighteen();
|
|
|
+ BeanUtils.copyProperties(eighteen, contractEighteen);
|
|
|
+ contractEighteen.setReqId("1111111111111111111111");
|
|
|
+ contractEighteen.setPostCode("");
|
|
|
+ contractEighteen.setDeadline("");
|
|
|
+ contractEighteen.setOperator("");
|
|
|
+ contractEighteen.setOperatorId("");
|
|
|
+ contractEighteen.setOperateIp("");
|
|
|
+ contractEighteen.setOperateTime(DateUtils.now());
|
|
|
+ contractEighteen.setRemarks(String.valueOf(System.currentTimeMillis()));
|
|
|
+ } else {
|
|
|
+ contractEighteen = new ContractEighteen();
|
|
|
+ }
|
|
|
+ System.err.println(contractEighteenMapper.insert(contractEighteen));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|