From d86d6a6dca39eff9cbd9073c9e23e58308864e51 Mon Sep 17 00:00:00 2001
From: yyt <306727702@qq.com>
Date: 星期二, 23 一月 2024 08:25:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java |   66 +++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java b/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java
index af08e28..7bcd85e 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java
@@ -2,6 +2,9 @@
 
 
 import cn.hutool.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
 import com.google.gson.JsonObject;
 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
@@ -40,16 +43,28 @@
 //        test1();
 
 //        String serviceUrl = "http://podqapp.cfmoto.com.cn:50200/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_MES&receiverParty=&receiverService=&interface=SI_ZPP_CF_MES_005_SYN_OUT&interfaceNamespace=http://cfmoto.com/xi/MES";
-//
+//        String serviceUrl = "http://podqapp.cfmoto.com.cn:50200/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_MES&receiverParty=&receiverService=&interface=SI_ZPP_CF_BC_001_SYN_OUT&interfaceNamespace=http://cfmoto.com/xi/MES";
+////        String content = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">\n" +
+////                "   <soapenv:Header/>\n" +
+////                "   <soapenv:Body>\n" +
+////                "      <urn:ZPP_CF_MES_005>\n" +
+////                "         <!--Optional:-->\n" +
+////                "         <IV_WERKS>1000</IV_WERKS>\n" +
+////                "         <!--Optional:-->\n" +
+////                "         <IV_ZSCTZD>A0055577</IV_ZSCTZD>\n" +
+////                "      </urn:ZPP_CF_MES_005>\n" +
+////                "   </soapenv:Body>\n" +
+////                "</soapenv:Envelope>";
 //        String content = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">\n" +
 //                "   <soapenv:Header/>\n" +
 //                "   <soapenv:Body>\n" +
-//                "      <urn:ZPP_CF_MES_005>\n" +
-//                "         <!--Optional:-->\n" +
-//                "         <IV_WERKS>1000</IV_WERKS>\n" +
-//                "         <!--Optional:-->\n" +
-//                "         <IV_ZSCTZD>A0055577</IV_ZSCTZD>\n" +
-//                "      </urn:ZPP_CF_MES_005>\n" +
+//                "      <urn:ZPP_BC_001>\n" +
+//                "         <IV_AUFNR>000010569212</IV_AUFNR>\n" +
+//                "          <IV_VORNR>0010</IV_VORNR>\n" +
+//                "           <IV_LMNGA>1</IV_LMNGA>\n" +
+//                "           <IV_XMNGA>0</IV_XMNGA>   \n" +
+//                "         <IV_STATU>1</IV_STATU>  \n" +
+//                "      </urn:ZPP_BC_001>\n" +
 //                "   </soapenv:Body>\n" +
 //                "</soapenv:Envelope>";
 //        // HttpClient鍙戦�丼OAP璇锋眰
@@ -79,10 +94,10 @@
 //            InputStream is = postMethod.getResponseBodyAsStream();
 //            // 鑾峰彇璇锋眰缁撴灉瀛楃涓�
 //            String result = IOUtils.toString(is);
-//            String jsonStr = xmlToJSON2(result);
-//            Gson gson = new Gson();
-//            // 灏唈son瀛楃涓茶浆鎹㈡垚瀵硅薄
-//            ItemList itemList = gson.fromJson(jsonStr, ItemList.class);
+////            String jsonStr = xmlToJSON2(result);
+////            Gson gson = new Gson();
+////            // 灏唈son瀛楃涓茶浆鎹㈡垚瀵硅薄
+////            ItemList itemList = gson.fromJson(jsonStr, ItemList.class);
 //            System.out.println("杩斿洖缁撴灉:" + result);
 //        } else {
 //            System.out.println("閿欒浠g爜锛�" + status + ":" + postMethod.getResponseBodyAsString());
@@ -195,4 +210,33 @@
         return etData.toString();
     }
 
+    /**
+     * 鏂瑰紡--璐�
+     * 浣跨敤hutool宸ュ叿鍖呬腑鐨勫伐鍏疯浆鍖�
+     * @param xmlStr
+     * @return
+     */
+    public static String xmlToJSON3(String xmlStr){
+        String status = "";
+        if(xmlStr.contains("EV_STATUS")){
+            JSONObject jsonObject1 = cn.hutool.json.XML.toJSONObject(xmlStr, true);
+
+            ObjectMapper objectMapper = new ObjectMapper();
+            JsonNode rootNode = null;
+            try {
+                rootNode = objectMapper.readTree(String.valueOf(jsonObject1));
+            } catch (JsonProcessingException e) {
+                throw new RuntimeException(e);
+            }
+            String evStatus = rootNode
+                    .path("SOAP:Envelope")
+                    .path("SOAP:Body")
+                    .path("n0:ZPP_BC_001.Response")
+                    .path("EV_STATUS")
+                    .asText();
+            status = evStatus;
+        }
+        return status;
+    }
+
 }

--
Gitblit v1.9.3