2 커밋 4900f4ce16 ... a45cc74e3d

작성자 SHA1 메시지 날짜
  lfx a45cc74e3d Changes 2 주 전
  lfx f67546faaa Changes 2 주 전

+ 0 - 9
src/main/java/com/tyson/consts/dingConst.java

@@ -20,15 +20,6 @@ public class dingConst {
     private String systemToken;
     private String userId;
     private String url;
-    private String hanxingUrl;
-
-    public String getHanxingUrl() {
-        return hanxingUrl;
-    }
-
-    public void setHanxingUrl(String hanxingUrl) {
-        this.hanxingUrl = hanxingUrl;
-    }
 
     public String getUrl() {
         return url;

+ 4 - 1
src/main/java/com/tyson/controller/AsyncController.java

@@ -13,6 +13,7 @@ import org.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -50,7 +51,9 @@ public class AsyncController {
     private com.tyson.consts.dingConst dingConst;
     //测试 //
     //String QA_sapUrl = "https://etl-nonprod-tasks.cloud.tyson.com:443/api/1/rest/feed/run/task/TysonNonProd/Ultra_PoC/20-PREPROD-team-fssc/tk_oa_to_sap_p2p?bearer_token=bBiGTA7PS0JJ6wKhQU8Vm0vLsIDNjLaN&interface_id=";
-    String QA_sapUrl = "https://etl-nonprod-tasks.tysondt.com:443/api/1/rest/feed/run/task/TysonNonProd/Ultra_PoC/10-QA-team-fssc/tk_oa_to_sap_p2p?bearer_token=bBiGTA7PS0JJ6wKhQU8Vm0vLsIDNjLaN&interface_id=";
+//    String QA_sapUrl = "https://etl-nonprod-tasks.tysondt.com:443/api/1/rest/feed/run/task/TysonNonProd/Ultra_PoC/10-QA-team-fssc/tk_oa_to_sap_p2p?bearer_token=bBiGTA7PS0JJ6wKhQU8Vm0vLsIDNjLaN&interface_id=";
+    @Value("${qa.sapurl}")
+    private String QA_sapUrl;
 
     //预生产  //String sapUrl = "https://etl-nonprod-tasks.cloud.tyson.com:bookeepflag443/api/1/rest/feed/run/task/TysonNonProd/Ultra_PoC/20-PREPROD-team-fssc/tk_sap_to_oa_p2p?bearer_token=C6h3CFJqgxT3KNTmX4JIcSdPx2Cfxz1J";
     //生产0403

+ 34 - 15
src/main/java/com/tyson/controller/YiDaController.java

@@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
 import org.json.JSONArray;
 import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.util.LinkedMultiValueMap;
@@ -54,6 +55,13 @@ public class YiDaController {
     @Autowired
     private dingConst dingConst;
 
+    @Value("${hxapi.bookkeeping}")
+    private String HXAPI_BOOKKEEPING;
+    @Value("${hxapi.commoncheckinvoice}")
+    private String HXAPI_COMMONCHECKINVOICE;
+    @Value("${hxapi.imgocr}")
+    private String HXAPI_IMGOCR;
+
     @ApiOperation("测试")
     @GetMapping("testdemo")
     public String demo(String id) {
@@ -1498,7 +1506,7 @@ public class YiDaController {
             System.out.println(bookkeepingJArray);
             logger.info("{}", bookkeepingJArray);
 
-            String post = HttpUtil.post("http://106.15.251.153:8091/stms/openapi/income/bookkeeping", null, bookkeepingJArray.toString(), null);
+            String post = HttpUtil.post(HXAPI_BOOKKEEPING, null, bookkeepingJArray.toString(), null);
             if (!"".equals(post)) {
                 System.out.println(CusutUtil.unicodeDecode(post));
                 logger.info("发票勾选实现 post:" + CusutUtil.unicodeDecode(post));
@@ -1638,7 +1646,7 @@ public class YiDaController {
 
             System.out.println(bookkeepingJArray);
 
-            String post = HttpUtil.post("http://106.15.251.153:8091/stms/openapi/income/bookkeeping", null, bookkeepingJArray.toString(), null);
+            String post = HttpUtil.post(HXAPI_BOOKKEEPING, null, bookkeepingJArray.toString(), null);
             if (!"".equals(post)) {
                 System.out.println(CusutUtil.unicodeDecode(post));
                 logger.info("post:" + CusutUtil.unicodeDecode(post));
@@ -1809,7 +1817,7 @@ public class YiDaController {
                 try {
                     MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
                     param.add("account", "admin");
-                    value = HttpUtil.doPostFile2(dingConst.getHanxingUrl() + "imgocr", param, file);
+                    value = HttpUtil.doPostFile2(HXAPI_IMGOCR, param, file);
 
                 } catch (Exception ex) {
                     err_file++;
@@ -1973,7 +1981,6 @@ public class YiDaController {
 
                                 JSONArray tableField_l6ujr47b = new JSONArray();
 
-
                                 //验真参数
                                 try {
                                     JSONObject yanzObj = new JSONObject();
@@ -2029,8 +2036,8 @@ public class YiDaController {
                                     }
                                     if (type.equals("01") || type.equals("02") || type.equals("03") || type.equals("04")
                                             || type.equals("15") || type.equals("14") || type.equals("11") || type.equals("10")
-                                            || type.equals("08") || type.equals("16") || type.equals("21") || type.equals("22") || type.equals("08xdp") || type.equals("08xdpp")) {
-                                        String post = HttpUtil.post("http://106.15.251.153:8095/stms_xocr/pxocr/commoncheckinvoice", null, yanzObj.toString(), null);
+                                            || type.equals("08") || type.equals("16") || type.equals("21") || type.equals("22") || type.equals("08xdp") || type.equals("08xdpp") || type.equals("61")) {
+                                        String post = HttpUtil.post(HXAPI_COMMONCHECKINVOICE, null, yanzObj.toString(), null);
                                         if (!post.equals("")) {
 //                                            System.out.println(post);
                                             JSONObject yanz = new JSONObject(post);
@@ -2048,13 +2055,23 @@ public class YiDaController {
                                                     for (int k = 0; k < items.length(); k++) {
                                                         JSONObject itemObject = new JSONObject();
                                                         JSONObject item = items.getJSONObject(k);
-                                                        itemObject.put("textField_l6ujr47c", has(item, "goodsName").toString());//名称
-                                                        itemObject.put("numberField_l6ujr47e", has(item, "num").toString());//数量
-                                                        itemObject.put("textField_lam8efux", has(item, "unit").toString());//单位
-                                                        itemObject.put("numberField_l6ujr47g", has(item, "taxUnitPrice").toString());//单价
-                                                        itemObject.put("textField_l6vvuq3e", has(item, "taxRate").toString());//税率
-                                                        itemObject.put("numberField_l6vu65fp", has(item, "taxAmount").toString());//税额
-                                                        itemObject.put("numberField_l6ujr47f", has(item, "detailAmount").toString());//金额
+                                                        if(type.equals("61")){
+                                                            itemObject.put("numberField_l6ujr47g", has(item, "fare").toString());//单价
+                                                            itemObject.put("numberField_mifoh2ng", has(item, "fuel_surcharge").toString());//燃油附加费
+                                                            itemObject.put("textField_l6vvuq3e", has(item, "tax_rate").toString());//税率
+                                                            itemObject.put("numberField_l6vu65fp", has(item, "in_tax").toString());//税额
+                                                            itemObject.put("numberField_l6ujr47f", has(item, "total").toString());//金额
+                                                            itemObject.put("numberField_mifoh2ng", has(item, "other_taxes").toString());//其他税费
+                                                            itemObject.put("numberField_mifoh2ni", has(item, "caac_development_fund").toString());//民航发展基金
+                                                        }else{
+                                                            itemObject.put("textField_l6ujr47c", has(item, "goodsName").toString());//名称
+                                                            itemObject.put("numberField_l6ujr47e", has(item, "num").toString());//数量
+                                                            itemObject.put("textField_lam8efux", has(item, "unit").toString());//单位
+                                                            itemObject.put("numberField_l6ujr47g", has(item, "taxUnitPrice").toString());//单价
+                                                            itemObject.put("textField_l6vvuq3e", has(item, "taxRate").toString());//税率
+                                                            itemObject.put("numberField_l6vu65fp", has(item, "taxAmount").toString());//税额
+                                                            itemObject.put("numberField_l6ujr47f", has(item, "detailAmount").toString());//金额
+                                                        }
                                                         tableField_l6ujr47b.put(itemObject);
                                                         if (k == 0) {
                                                             if ("".equals(createJson.getString("textField_l6vvuq3f"))) {
@@ -2082,7 +2099,7 @@ public class YiDaController {
                                 //开发参数
                                 createJson.put("textField_l7efm5ay", "否");
                                 //过路费发票 ??
-                                if (type.equals("10505") || type.equals("10203") || type.equals("10506") || type.equals("10507") || type.equals("10503") || type.equals("10500") || type.equals("10200") || type.equals("10400") || has(invoicesJSONObject, "block_chain").equals("1")) {
+                                if (type.equals("14") || type.equals("10505") || type.equals("10203") || type.equals("10506") || type.equals("10507") || type.equals("10503") || type.equals("10500") || type.equals("10200") || type.equals("10400") || has(invoicesJSONObject, "block_chain").equals("1")) {
 //                                    if (!createJson.has("textField_l6u55vdt")) {
                                     createJson.put("textField_l6u55vdt", "查验成功发票一致");
                                     createJson.put("textField_l6u55vds", "0001");
@@ -2217,7 +2234,7 @@ public class YiDaController {
 
 //            System.out.println(yanzObj);
 //            String post = "";
-            String post = HttpUtil.post("http://106.15.251.153:8095/stms_xocr/pxocr/commoncheckinvoice", null, yanzObj.toString(), null);
+            String post = HttpUtil.post(HXAPI_COMMONCHECKINVOICE, null, yanzObj.toString(), null);
             if (!post.equals("")) {
 //                System.out.println(post);
                 JSONObject yanz = new JSONObject(post);
@@ -2357,6 +2374,8 @@ public class YiDaController {
                 return "全电普票";
             case "51":
                 return "电子火车票";
+            case "61":
+                return "电子发票(航空运输电子行程单)";
             default:
                 return "联系管理员增加类型," + type;
         }

+ 18 - 0
src/main/resources/application-dev.yml

@@ -0,0 +1,18 @@
+ding:
+  agentId: '1782962089'
+  appKey: 'dingfnrpklgoaoynrbsw'
+  appSecret: '6FxZudtXjdYeHNQN7-Os_A-zXGF7slS7UX9d3alu9uIsK56w4gXiZN0yXPp67FDh'
+  appType: "APP_N9NPHVTQLPBPO8MR6WFG"
+  systemToken: "UM6660D1PGF2O34KAVVKG8XZ756E3O06MZX5LW"
+  userId: "0128190612251172008042"
+  url: "https://www.aliwork.com"
+
+server:
+  port: 8020
+
+hxapi:
+  bookkeeping: http://139.224.3.140:8091/stms/openapi/income/bookkeeping
+  commoncheckinvoice: http://139.224.3.140:8095/stms_xocr/pxocr/commoncheckinvoice
+  imgocr: http://139.224.3.140:8095/stms_xocr/pxocr/imgocr
+qa:
+  sapurl: https://etl-nonprod-tasks.tysondt.com:443/api/1/rest/feed/run/task/TysonNonProd/Ultra_PoC/10-QA-team-fssc/tk_oa_to_sap_p2p?bearer_token=bBiGTA7PS0JJ6wKhQU8Vm0vLsIDNjLaN&interface_id=

+ 18 - 0
src/main/resources/application-prod.yml

@@ -0,0 +1,18 @@
+ding:
+  agentId: '1782962089'
+  appKey: 'dingfnrpklgoaoynrbsw'
+  appSecret: '6FxZudtXjdYeHNQN7-Os_A-zXGF7slS7UX9d3alu9uIsK56w4gXiZN0yXPp67FDh'
+  appType: "APP_N9NPHVTQLPBPO8MR6WFG"
+  systemToken: "UM6660D1PGF2O34KAVVKG8XZ756E3O06MZX5LW"
+  userId: "0128190612251172008042"
+  url: "https://www.aliwork.com"
+
+server:
+  port: 8020
+
+hxapi:
+  bookkeeping: http://106.15.251.153:8091/stms/openapi/income/bookkeeping
+  commoncheckinvoice: http://106.15.251.153:8095/stms_xocr/pxocr/commoncheckinvoice
+  imgocr: http://106.15.251.153:8095/stms_xocr/pxocr/imgocr
+qa:
+  sapurl: https://etl-nonprod-tasks.cloud.tyson.com:443/api/1/rest/feed/run/task/TysonNonProd/Ultra_PoC/20-PREPROD-team-fssc/tk_oa_to_sap_p2p?bearer_token=bBiGTA7PS0JJ6wKhQU8Vm0vLsIDNjLaN&interface_id=

+ 2 - 13
src/main/resources/application.yml

@@ -1,22 +1,11 @@
-ding:
-  agentId: '1782962089'
-  appKey: 'dingfnrpklgoaoynrbsw'
-  appSecret: '6FxZudtXjdYeHNQN7-Os_A-zXGF7slS7UX9d3alu9uIsK56w4gXiZN0yXPp67FDh'
-  appType: "APP_N9NPHVTQLPBPO8MR6WFG"
-  systemToken: "UM6660D1PGF2O34KAVVKG8XZ756E3O06MZX5LW"
-  userId: "0128190612251172008042"
-  url: "https://www.aliwork.com"
-  hanxingUrl: 'http://106.15.251.153:8095/stms_xocr/pxocr/'
-
-server:
-  port: 8020
-
 spring:
   main:
     allow-circular-references: true
   mvc:
     pathmatch:
       matching-strategy: ant_path_matcher
+  profiles:
+    active: dev
 
 #允许访问 接口开发文档
 swagger: