Parcourir la source

能辉发票识别sdk升级

lfx il y a 3 mois
Parent
commit
8b9d2244bf

+ 7 - 2
pom.xml

@@ -65,10 +65,15 @@
             <version>3.5.3.2</version>
         </dependency>
         <!-- 腾讯云 [go to https://search.maven.org/search?q=tencentcloud-sdk-java and getDefault the latest version.] -->
+<!--        <dependency>-->
+<!--            <groupId>com.tencentcloudapi</groupId>-->
+<!--            <artifactId>tencentcloud-sdk-java</artifactId>-->
+<!--            <version>3.1.778</version>-->
+<!--        </dependency>-->
         <dependency>
             <groupId>com.tencentcloudapi</groupId>
-            <artifactId>tencentcloud-sdk-java</artifactId>
-            <version>3.1.778</version>
+            <artifactId>tencentcloud-sdk-java-ocr</artifactId>
+            <version>3.1.1210</version>
         </dependency>
         <!-- 图片压缩 -->
         <dependency>

+ 6 - 2
src/main/java/com/malk/pro/guyuan/controller/NhIVController.java

@@ -151,7 +151,7 @@ public class NhIVController {
     McR invoice_iv2(@RequestBody Map<String, String> data) throws TencentCloudSDKException {
 
         McException.assertParamException_Null(data, "url");
-        String image = ydClient.convertTemporaryUrl(data.get("url"),6000,APP_TYPE,SYSTEM_TOKEN);
+        String image = ydClient.convertTemporaryUrl(data.get("url"),60000,APP_TYPE,SYSTEM_TOKEN);
         log.info("混票识别, 免登地址, {}", image);
         // 非PDF, 且内存大于3M, 压缩后上传
         if (UtilMap.getFloat(data, "size") > 3.0f && !UtilMap.getBoolean(data, "isPdf")) {
@@ -185,7 +185,7 @@ public class NhIVController {
                     .date(UtilString.replaceDateZH_cn(UtilMap.getString(prop, "Date")))
                     .checkCode(UtilMap.getString(prop, "CheckCode"))
                     // ppExt: 多明细行时, 优先取值合计 [全电票返回了subTotal字段, 但值为空]
-                    .amount(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "SubTotal", "Total")))
+                    .amount(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "SubTotal", "Total", "Fare")))
                     .tax(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "SubTax", "Tax")))
                     .excludingTax(UtilNumber.setBigDecimal(UtilMap.getString(prop, "PretaxAmount")))
                     .buyerName(StringUtils.isBlank(guyuanNameRepalce(UtilMap.getString(prop, "Buyer")))?"上海能辉科技股份有限公司":guyuanNameRepalce(UtilMap.getString(prop, "Buyer")))
@@ -292,6 +292,10 @@ public class NhIVController {
             if (kind.equals(McInvoiceKind.HC.getDesc())) {
                 invoiceDto.setDepartureTime(findValue(infos, "出发时间").replace("年", "-").replace("月", "-").replace("日", " "));
             }
+            // 火车票
+            if (kind.equals(McInvoiceKind.HCDZ.getDesc())) {
+                invoiceDto.setDepartureTime(findValue(infos, "出发时间").replace("年", "-").replace("月", "-").replace("日", " "));
+            }
             // 出租车
             if (kind.equals(McInvoiceKind.CZC.getDesc())) {
                 String date = findValue(infos, "日期").replace("年", "-").replace("月", "-").replace("日", " ");

+ 1 - 0
src/main/java/com/malk/pro/guyuan/server/model/McInvoiceKind.java

@@ -22,6 +22,7 @@ public enum McInvoiceKind {
     QZ("全电专用发票", 6),
 
     HC("火车票", 11),
+    HCDZ("火车票", 16),
     JP("机票行程单", 12),
     CZC("出租车发票", 13),
     DE("定额发票", 14),

+ 1 - 1
src/main/resources/static/guyuan/mjs/mjsnh.js

@@ -14721,7 +14721,7 @@ import { SS as storage } from "storage"; // import { SS } from "storage"; */
         init: function init() {
             {
                 mjs.conf.api = "https://mc.cloudpure.cn/api/guyuan/nh";
-                // mjs.conf.api = "http://127.0.0.1:9004/api/guyuan/nh";
+                // mjs.conf.api = "http://127.0.0.1:8200/pro/guyuan/nh";
             }
             return this; // this 指向当前项目本身
         },