From 73734f096b25cb3c350ddceec46e47f4de004b7d Mon Sep 17 00:00:00 2001
From: dbs <email0099@163.com>
Date: 星期一, 23 十二月 2024 16:34:16 +0800
Subject: [PATCH] 新增MES接口的解析处理。

---
 src/main/java/com/itstyle/mdm/utils/MdmApiUtils.java |   40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/src/main/java/com/itstyle/mdm/utils/MdmApiUtils.java b/src/main/java/com/itstyle/mdm/utils/MdmApiUtils.java
index db3840e..b6949c1 100644
--- a/src/main/java/com/itstyle/mdm/utils/MdmApiUtils.java
+++ b/src/main/java/com/itstyle/mdm/utils/MdmApiUtils.java
@@ -2,7 +2,9 @@
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import com.itstyle.mdm.entity.HttpClientResult;
+import com.itstyle.mdm.utils.model.SoapEnvelopeProduct;
 import org.apache.http.HttpStatus;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.config.RequestConfig;
@@ -156,6 +158,9 @@
         }
     }
 
+    public static String getMesResponseJson(String xml){
+        return SoapEnvelopeProduct.getResJson(xml);
+    }
     public static String getMesJson(String json){
         JSONObject mesResJson=new JSONObject();
         JSONObject jsonobj=JSONObject.parseObject(json);
@@ -165,28 +170,21 @@
             JSONObject rowObject = jsonArray.getJSONObject(i);
             JSONObject tmp1=new JSONObject();
             tmp1.put("Tgcoriginalcode",rowObject.getString("tgctwoclasscode"));
-            JSONObject tmp2=new JSONObject();
-            tmp2.put("Code",rowObject.getString("code"));
-            JSONObject tmp3=new JSONObject();
-            tmp3.put("Name",rowObject.getString("name"));
-            JSONObject tmp4=new JSONObject();
-            tmp4.put("Specification",rowObject.getString("specification"));
-            JSONObject tmp5=new JSONObject();
-            tmp5.put("UnitName",rowObject.getString("unitName"));
-            JSONObject tmp6=new JSONObject();
-            tmp6.put("TypeCode",rowObject.getString("typeCode"));
-            JSONObject tmp7=new JSONObject();
-            tmp7.put("SpecificationDisplayName",rowObject.getString("specificationDisplayName"));
-            JSONObject tmp8=new JSONObject();
-            tmp8.put("SupplierName",rowObject.getString("supplierName"));
+
+            tmp1.put("Code",rowObject.getString("code"));
+
+            tmp1.put("Name",rowObject.getString("name"));
+
+            tmp1.put("Specification",rowObject.getString("specification"));
+
+            tmp1.put("UnitName",rowObject.getString("unitName"));
+
+            tmp1.put("TypeCode",rowObject.getString("typeCode"));
+
+            tmp1.put("SpecificationDisplayName",rowObject.getString("specificationDisplayName"));
+
+            tmp1.put("SupplierName",rowObject.getString("supplierName"));
             mesResDetail.add(tmp1);
-            mesResDetail.add(tmp2);
-            mesResDetail.add(tmp3);
-            mesResDetail.add(tmp4);
-            mesResDetail.add(tmp5);
-            mesResDetail.add(tmp6);
-            mesResDetail.add(tmp7);
-            mesResDetail.add(tmp8);
         }
         mesResJson.put("Records",mesResDetail);
         return mesResJson.toJSONString();

--
Gitblit v1.8.0