lfx 1 hafta önce
ebeveyn
işleme
234cb1dc3b

+ 21 - 5
src/main/java/com/tyson/controller/YiDaController.java

@@ -20,6 +20,7 @@ import org.springframework.http.MediaType;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
+import org.springframework.util.NumberUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -1952,7 +1953,6 @@ public class YiDaController {
                                 createJson.put("textField_l6ymplal", has(invoicesJSONObject, "entrance").toString());//入口
                                 createJson.put("textField_l6ymplao", has(invoicesJSONObject, "insurance").toString());//保险费
 
-
                                 createJson.put("textField_l6ymplat", has(invoicesJSONObject, "international_flag").toString());//是否国际
                                 createJson.put("textField_l6ymplau", has(invoicesJSONObject, "user_name").toString());//乘机人姓名
 
@@ -1971,7 +1971,7 @@ public class YiDaController {
 
                                     if ("".equals(createJson.getString("textField_l6ukuz13"))) {
                                         createJson.remove("textField_l6ukuz13");
-                                        createJson.put("textField_l6ukuz13", has(flights, "issue_by").toString());
+                                        createJson.put("textField_l6ukuz13", has(invoicesJSONObject, "issue_by").toString());
                                     }
                                 }
                                 createJson.put("textField_l6ymplay", has(invoicesJSONObject, "time_geton").toString());//上车时间
@@ -1979,18 +1979,27 @@ public class YiDaController {
                                 createJson.put("textField_l6ymplb0", has(invoicesJSONObject, "mileage").toString());//里程(公里)
                                 createJson.put("textField_l6ymplb3", has(invoicesJSONObject, "tax_authorities").toString());//税务总局
 
+                                JSONObject obj=new JSONObject();
+                                obj.put("textField_mipgcip7",createJson.getString("textField_l6ukuz13"));
+                                JSONArray data = new JSONArray(dingUtil.yiDaSearch("FORM-DEE405950215455D8D07ABEBB01CE3FAFLFE", obj));
+                                if (data.length() > 0 && data.length() == 1) {
+                                    createJson.put("textField_miingkfc", data.getJSONObject(0).getJSONObject("formData").getString("textField_mipgcip8"));//保险费
+                                }else{
+                                    createJson.put("textField_miingkfc",createJson.getString("textField_l6ukuz13"));
+                                }
 
                                 JSONArray tableField_l6ujr47b = new JSONArray();
                                 if(type.equals("61")){
                                     JSONObject itemObject = new JSONObject();
                                     itemObject.put("numberField_l6ujr47g", has(invoicesJSONObject, "fare").toString());//单价
-                                    itemObject.put("numberField_mifoh2ng", has(invoicesJSONObject, "fuel_surcharge").toString());//燃油附加费
                                     itemObject.put("textField_l6vvuq3e", has(invoicesJSONObject, "tax_rate").toString());//税率
                                     itemObject.put("numberField_l6vu65fp", has(invoicesJSONObject, "in_tax").toString());//税额
-                                    itemObject.put("numberField_l6ujr47f", has(invoicesJSONObject, "total").toString());//金额
-                                    itemObject.put("numberField_mifoh2ng", has(invoicesJSONObject, "other_taxes").toString());//其他税费
+                                    itemObject.put("numberField_l6ujr47f", hasDouble(invoicesJSONObject, "total")-hasDouble(invoicesJSONObject, "in_tax"));//不含税金额
+                                    itemObject.put("numberField_mifoh2nh", has(invoicesJSONObject, "other_taxes").toString());//其他税费
+                                    itemObject.put("numberField_mifoh2ng", has(invoicesJSONObject, "fuel_surcharge").toString());//燃油附加费
                                     itemObject.put("numberField_mifoh2ni", has(invoicesJSONObject, "caac_development_fund").toString());//民航发展基金
                                     tableField_l6ujr47b.put(itemObject);
+                                    createJson.put("textField_l6vvuq3f", has(invoicesJSONObject, "tax_rate").toString());//税率
                                 }
 
                                 //验真参数
@@ -2317,6 +2326,13 @@ public class YiDaController {
         return "";
     }
 
+    Double hasDouble(JSONObject jo, String key) {
+        if (jo.has(key) && !String.valueOf(jo.get(key)).toLowerCase().equals("null") && !String.valueOf(jo.get(key)).equals("")) {
+            return Double.parseDouble(String.valueOf(jo.get(key)));
+        }
+        return 0.0;
+    }
+
     String ocrType(String type) {
         log.info("type:"+type);
         switch (type) {