Browse Source

订单接口调整

zengtx 3 years ago
parent
commit
479a9220e3

+ 8 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/controller/MOMainController.java

@@ -10,6 +10,7 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import lombok.extern.log4j.Log4j2;
 
+import org.apache.commons.lang.StringEscapeUtils;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
 import org.jeecg.modules.openApi.service.IDxpDataPlanService;
 import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
@@ -91,7 +92,7 @@ public class MOMainController implements ApplicationContextAware {
                     String sql = "select mo.MOID as 'moId',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
                             "mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
                             "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'headerAttributeString10',hr.cPsn_Num as 'headerAttributeString9'," +
-                            "hr1.cPsn_Name as 'salerCode',mo.cVenPerson as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
+                            "hr1.cPsn_Name as 'salerCode',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
                             "'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
                             "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark'," +
                             "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',mo.dCreateTime  as 'publishDate',0 as 'tenantId'," +
@@ -117,7 +118,7 @@ public class MOMainController implements ApplicationContextAware {
                     String sql = "select mo.MOID as 'moId',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
                             "mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
                             "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'headerAttributeString10',hr.cPsn_Num as 'headerAttributeString9'," +
-                            "hr1.cPsn_Name as 'salerCode',mo.cVenPerson as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
+                            "hr1.cPsn_Name as 'salerCode',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
                             "'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
                             "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark'," +
                             "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',mo.dCreateTime  as 'publishDate',0 as 'tenantId'," +
@@ -139,7 +140,7 @@ public class MOMainController implements ApplicationContextAware {
                     String sql = "select mo.MOID as 'moId',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
                             "mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
                             "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'headerAttributeString10',hr.cPsn_Num as 'headerAttributeString9'," +
-                            "hr1.cPsn_Name as 'salerCode',mo.cVenPerson as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
+                            "hr1.cPsn_Name as 'salerCode',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
                             "'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
                             "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark'," +
                             "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',mo.dCreateTime  as 'publishDate',0 as 'tenantId'," +
@@ -175,9 +176,10 @@ public class MOMainController implements ApplicationContextAware {
                     //调用doPost
                     InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
                     //处理返回信息
-                    JSONObject informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "委外订单接口-");
-
-                    JSONArray jsonArray = informationJson.getJSONArray("payload");
+                    String  informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "委外订单接口-");
+                    String jsonString = StringEscapeUtils.unescapeJava(informationJson);
+                    JSONObject jsonArr = JSONObject.parseObject(jsonString);
+                    JSONArray jsonArray = jsonArr.getJSONArray("payload");
                     if (jsonArray.size() != 0) {
                         //获取4个账套值
                         String yi = "";

+ 12 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/controller/POPomainController.java

@@ -9,6 +9,7 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import lombok.extern.log4j.Log4j;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang.StringEscapeUtils;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
 import org.jeecg.modules.openApi.service.IDxpDataPlanService;
 import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
@@ -84,7 +85,7 @@ public class POPomainController implements ApplicationContextAware {
                     //cAuditTime>'"+lasttimeSf+"' and mo.iverifystateex = 2
                     String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
                             "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as headerAttributeString10,hr.cPsn_Num as 'headerAttributeString9'," +
-                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cVenPerson as 'customerContacts'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cMaker as 'customerContacts'," +
                             "mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTotalAmount'," +
                             "'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
                             "mo.dPODate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
@@ -105,7 +106,7 @@ public class POPomainController implements ApplicationContextAware {
                 }else if(pkorgValue[0].equals("two")){
                     String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
                             "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as headerAttributeString10,hr.cPsn_Num as 'headerAttributeString9'," +
-                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cVenPerson as 'customerContacts'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cMaker as 'customerContacts'," +
                             "mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTotalAmount'," +
                             "'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
                             "mo.dPODate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
@@ -126,7 +127,7 @@ public class POPomainController implements ApplicationContextAware {
                 }else if(pkorgValue[0].equals("three")){
                     String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
                             "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as headerAttributeString10,hr.cPsn_Num as 'headerAttributeString9'," +
-                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cVenPerson as 'customerContacts'," +
+                            "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cMaker as 'customerContacts'," +
                             "mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTotalAmount'," +
                             "'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
                             "mo.dPODate as 'customerDemandDate','' as 'supplierPromiseDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
@@ -150,6 +151,7 @@ public class POPomainController implements ApplicationContextAware {
             if(sumlist.size()==0){
                 log.info("未查询到的数据!");
             }else {
+                log.info("条数:"+sumlist.size());
                 //循环集合,一条一条传
                 for (Map<String, Object> map : sumlist) {
                     //转JSON且赋值
@@ -165,9 +167,14 @@ public class POPomainController implements ApplicationContextAware {
                     //调用doPost
                     InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
                     //处理返回信息
-                    JSONObject informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "采购订单接口-");
+                    String  informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "采购订单接口-");
+                    String jsonString = StringEscapeUtils.unescapeJava(informationJson);
+                    JSONObject jsonArr = JSONObject.parseObject(jsonString);
+                    JSONArray jsonArray = jsonArr.getJSONArray("payload");
+
+                    log.info("payload数据:" + jsonArray);
+
 
-                    JSONArray jsonArray = informationJson.getJSONArray("payload");
                     if (jsonArray.size() != 0) {
                         //获取4个账套值
                         String yi = "";

+ 5 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/controller/RdrecordController.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang.StringEscapeUtils;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
 import org.jeecg.modules.openApi.service.IDxpDataPlanService;
 import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
@@ -98,9 +99,11 @@ public class RdrecordController implements ApplicationContextAware {
             //调用doPost
             InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
             //处理返回信息
-            JSONObject informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "材料出库接口-");
+            String  informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "材料出库接口-");
+            String jsonString = StringEscapeUtils.unescapeJava(informationJson);
+            JSONObject jsonArr = JSONObject.parseObject(jsonString);
+            JSONArray jsonArray = jsonArr.getJSONArray("payload");
 
-            JSONArray jsonArray = informationJson.getJSONArray("head");
             if (jsonArray.size() != 0) {
                 //获取4个账套值
                 String yi = "";

+ 5 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/InterfaceConnUtils.java

@@ -64,9 +64,9 @@ public class InterfaceConnUtils {
      * post请求-推数据,Token认证:Bearer Token
      * @throws Exception
      */
-    public static JSONObject doPostToBearer(JSONObject json, String url,String tokenIp,String type) throws Exception {
+    public static String doPostToBearer(JSONObject json, String url,String tokenIp,String type) throws Exception {
         //定义返回JSON
-        JSONObject onejb = new JSONObject();
+        String jsonString = "";
         String token=null;
         HttpClient httpClient = new DefaultHttpClient();
         //获取token的Url
@@ -97,13 +97,12 @@ public class InterfaceConnUtils {
             HttpResponse response = httpClient.execute(httpPost);
             //返回信息
             String resultStr = EntityUtils.toString(response.getEntity());
-            System.out.println(type+"String返回信息:"+resultStr);
-            onejb=JSONObject.parseObject(resultStr);
-            System.out.println(type+"返回信息:"+onejb);
+            jsonString =resultStr;
+            System.out.println(type+"返回信息:"+jsonString);
 
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return onejb;
+        return jsonString;
     }
 }

+ 9 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/JsonChangeUtils.java

@@ -76,7 +76,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2'  as 'attributeCode2','cfree3'  as 'attributeCode3'," +
                         "'cfree4'  as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
                         "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
-                        "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
+                        "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
                         "mo.cDefine28 as 'lineAttributeString1',mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3'," +
                         "mo.cDefine30 as 'lineAttributeString4',mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8," +
                         "cFree1 as 'color','' as 'customerNumber'," +
@@ -96,7 +96,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2'  as 'attributeCode2','cfree3'  as 'attributeCode3'," +
                         "'cfree4'  as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
                         "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
-                        "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
+                        "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
                         "mo.cDefine28 as 'lineAttributeString1',mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3'," +
                         "mo.cDefine30 as 'lineAttributeString4',mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8," +
                         "cFree1 as 'color','' as 'customerNumber'," +
@@ -116,7 +116,7 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2'  as 'attributeCode2','cfree3'  as 'attributeCode3'," +
                         "'cfree4'  as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
                         "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
-                        "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
+                        "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount'," +
                         "mo.cDefine28 as 'lineAttributeString1',mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3'," +
                         "mo.cDefine30 as 'lineAttributeString4',mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8," +
                         "cFree1 as 'color','' as 'customerNumber'," +
@@ -176,8 +176,8 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree3 as 'attributeValue3',mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2'  as 'attributeCode2'," +
                         "'cfree3'  as 'attributeCode3','cfree4'  as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
                         "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
-                        "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount','' as 'lineAttributeString1'," +
-                        "'' as 'lineAttributeString2','' as 'lineAttributeString3','' as 'attributeString1','' as 'lineAttributeString4'," +
+                        "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount',mo.cDefine28 as 'lineAttributeString1'," +
+                        "mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3','' as 'attributeString1',mo.cDefine30 as 'lineAttributeString4'," +
                         "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
                         "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode"+
                         " where mo.POID = '"+map.get("moId")+"'";
@@ -192,8 +192,8 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree3 as 'attributeValue3',mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2'  as 'attributeCode2'," +
                         "'cfree3'  as 'attributeCode3','cfree4'  as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
                         "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
-                        "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount','' as 'lineAttributeString1'," +
-                        "'' as 'lineAttributeString2','' as 'lineAttributeString3','' as 'attributeString1','' as 'lineAttributeString4'," +
+                        "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount',mo.cDefine28 as 'lineAttributeString1'," +
+                        "mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3','' as 'attributeString1',mo.cDefine30 as 'lineAttributeString4'," +
                         "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
                         "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode"+
                         " where mo.POID = '"+map.get("moId")+"'";
@@ -209,8 +209,8 @@ public class JsonChangeUtils implements ApplicationContextAware{
                         "mo.cFree3 as 'attributeValue3',mo.cFree4 as 'attributeValue4','cfree1' as 'attributeCode1','cfree2'  as 'attributeCode2'," +
                         "'cfree3'  as 'attributeCode3','cfree4'  as 'attributeCode4',mo.iQuantity as 'customerDemandQty',mo.cUnitID as 'customerUomCode'," +
                         "'"+map.get("customerDemandDate")+"' as 'customerDemandDate',mo.dArriveDate as 'customerPromiseDate'," +
-                        "mo.iUnitPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount','' as 'lineAttributeString1'," +
-                        "'' as 'lineAttributeString2','' as 'lineAttributeString3','' as 'attributeString1','' as 'lineAttributeString4'," +
+                        "mo.iTaxPrice as 'customerPrice',(mo.iPerTaxRate/100) as 'lineTaxRate',mo.iMoney as 'amount',mo.cDefine28 as 'lineAttributeString1'," +
+                        "mo.cDefine32 as 'lineAttributeString2',mo.cDefine29 as 'lineAttributeString3','' as 'attributeString1',mo.cDefine30 as 'lineAttributeString4'," +
                         "mo.cbMemo as 'lineAttributeString5',mo.cDefine22 as lineAttributeString6,'' as lineAttributeString7,'' as lineAttributeString8,'' as 'color'," +
                         "'' as 'externalLineNum',0 as 'itemAttrId' from PO_Podetails mo left join Inventory inv on mo.cInvCode = inv.cInvCode"+
                         " where mo.POID = '"+map.get("moId")+"'";