DINGYL 1 неделя назад
Родитель
Сommit
08366c98dd

+ 1 - 1
src/main/java/com/uas/eis/entity/GD/PosItem.java

@@ -14,7 +14,7 @@ public class PosItem {
     /**
      * 代理商编号 :固定值 待提供
      */
-    private String distId;
+    private String distiId;
 
     /**
      * 提货客户编号 :分销商系统中的客户CODE(在兆易创建客户时维护关联关系)	传优软ERP客户编码,(佳品通同事需要在兆易中维护对照关系),下单客户

+ 34 - 5
src/main/java/com/uas/eis/service/Impl/GDServiceImpl.java

@@ -7,6 +7,7 @@ import com.uas.eis.dao.BaseDao;
 import com.uas.eis.dao.SqlRowList;
 import com.uas.eis.entity.GD.*;
 import com.uas.eis.service.GDService;
+import com.uas.eis.utils.BaseUtil;
 import com.uas.eis.utils.FlexJsonUtil;
 import com.uas.eis.utils.HttpUtil;
 import com.uas.eis.utils.StringUtil;
@@ -32,17 +33,17 @@ public class GDServiceImpl implements GDService {
         SpObserver.putSp(master);
         String actionUrl=gdConfig.getPosUrl()+"/http/Portal/POSEDIInput";
         Map<String, Object> result = new HashMap<>();
-        String bearerToken= getToken();
+        String bearerToken =getToken();
         List<String> restSqls=new ArrayList<>();
         if(StringUtil.hasText(bearerToken)){
            PosEdiRequest posEdiRequest=new PosEdiRequest();
            SimpleDateFormat formatYMD = new SimpleDateFormat("yyyy-MM-dd");
            ArrayList<PosItem> posItems=new ArrayList<>();
-           SqlRowList rs = baseDao.queryForRowSet("select * from POSREPORT_GD_DET where PD_PSID ="+id+" order by Pd_itemid");
+           SqlRowList rs = baseDao.queryForRowSet("select * from POSREPORT_GD_DET where id_error is not null and PD_PSID ="+id+" order by Pd_itemid");
             while (rs.next()) {
                 PosItem posItem=new PosItem();
                 posItem.setItemId(rs.getInt("Pd_itemid"));
-                posItem.setDistId(gdConfig.getDistiCode());
+                posItem.setDistiId(gdConfig.getDistiCode());
                 posItem.setCustomerId(rs.getGeneralString("PD_CUSTOMERID"));
                 posItem.setCpn(rs.getGeneralString("PD_CPN"));
                 posItem.setResaleCustomerID(rs.getGeneralString("PD_RESALE_CUSTOMERID"));
@@ -50,7 +51,8 @@ public class GDServiceImpl implements GDService {
                 posItem.setQuantity(rs.getDouble("PD_QUANTITY"));
                 posItem.setResalePrice(rs.getDouble("PD_RESALEPRICE"));
                 posItem.setDeliveryMarket(rs.getString("PD_DELIVERYMARKET"));
-                posItem.setShippingDate(formatYMD.format(rs.getDate("PD_SHIPPINGDATE")));
+                //posItem.setShippingDate(formatYMD.format(rs.getDate("PD_SHIPPINGDATE")));
+                posItem.setShippingDate("2026-3-31");
                 posItem.setDelivery(rs.getGeneralString("PD_DELIVERY"));
                 posItem.setDeliveryItem(rs.getGeneralString("PD_DELIVERYITEM"));
                 posItem.setDistiResaleCustomerName(rs.getString("PD_DISTRICSRESCALECUSTOMERNAME"));
@@ -64,6 +66,7 @@ public class GDServiceImpl implements GDService {
            int errCount=0;
            if (response.getStatusCode()==200){
                String respText=response.getResponseText();
+               logger.info("responseText:{} ",respText);
                PosResponse posResponse=FlexJsonUtil.fromJson(respText, PosResponse.class);
                for(PosRespItem item : posResponse.getData()){
                    if("failed".equals(item.getSyncStatus())){
@@ -97,7 +100,8 @@ public class GDServiceImpl implements GDService {
         SpObserver.putSp(master);
         String actionUrl=gdConfig.getPosUrl()+"/http/Portal/IREDIInput";
         Map<String, Object> result = new HashMap<>();
-        String bearerToken= getToken();
+        String bearerToken //=getToken();
+        ="eyJhbGciOiJSUzI1NiIsIng1dSI6Imh0dHBzOi8vb2F1dGhhc3NlcnZpY2VzLmNuMS5wbGF0Zm9ybS5zYXBjbG91ZC5jbi9vYXV0aDIvYXBpL3YxL2p3dC9jZXJ0aWZpY2F0ZSIsInR5cCI6IkpXVCIsImtpZCI6IjIifQ.eyJpc3MiOiJodHRwczovL29hdXRoYXNzZXJ2aWNlcy5jbjEucGxhdGZvcm0uc2FwY2xvdWQuY24iLCJzdWIiOnsiY2xpZW50SWQiOiI2NmNlN2FhMi1mMmU5LTMxYzktYjM2My1jYTQxZDU1MmZkM2Ei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MGrHdI8xdKURXseX59B8jdTgZXURp3DyuQorVTm515pAu5TWsBt1+HkXYsccU2TLXygRZ6Bek/jhBsWQvrbmxLYqK8g3aa1/MOC6KubPkb0YxnkHwBrLRanA7HsvGQ9PNDAayNXSnNNJDdXmLYcY36ogvGBmo5esNOeshtqep3FT9GVPRj9NJA91qbJ4NpiWIYSXkFBVoFtAmkn0S+LhsM8pIcIEeLFL/l0SQrz9Xoza0hmnBwZ5KFq5L/kds/6D/94";
         if(StringUtil.hasText(bearerToken)) {
             SimpleDateFormat formatYMD = new SimpleDateFormat("yyyy-MM-dd");
             ArrayList<InventoryItem> inventoryItems = new ArrayList<>();
@@ -120,6 +124,31 @@ public class GDServiceImpl implements GDService {
             HttpUtil.Response response=HttpUtil.sendRequestWithBearerToken(actionUrl,bearerToken,body);
             if (response.getStatusCode()==200){
                 logger.info("ResponseText:{}",response.getResponseText());
+                String respText=response.getResponseText();
+                InventoryResponse invResp=FlexJsonUtil.fromJson(respText, InventoryResponse.class);
+                if(invResp!=null){
+                    if(invResp.getData()!=null){
+                        if("true".equals(invResp.getData().getSuccess())){
+                            baseDao.execute("update  INVRPT_GD  set IS_EDISENDSTATUS=-1 ,IS_ERR=''  where Is_ID ="+id);
+                        }else{
+                            baseDao.execute("update  INVRPT_GD  set  IS_ERR='"+(invResp.getData().getErrorMsg()==null?"发送失败":invResp.getData().getErrorMsg())+"'  where Is_ID ="+id);
+                        }
+                        System.out.println();
+                    }else{
+                        logger.info("ResponseText-invResp.getData失败:{}",response.getResponseText());
+                    }
+                }else{
+                    logger.info("ResponseText转换失败:{}",response.getResponseText());
+                }
+               /* Map<Object, Object> resStore = BaseUtil.parseFormStoreToMap(respText);
+                if(resStore!=null && resStore.get("data")!=null){
+                    Map<Object, Object> resData = BaseUtil.parseFormStoreToMap(resStore.get("data").toString());
+                    if("true".equals(resData.get("success").toString())){
+                        baseDao.execute("update  INVRPT_GD  set IS_EDISENDSTATUS=-1 ,IS_ERR=''  where Is_ID ="+id);
+                    }else{
+                        baseDao.execute("update  INVRPT_GD  set  IS_ERR='"+(resData.get("errorMsg")==null?"发送失败":resData.get("errorMsg").toString())+"'  where Is_ID ="+id);
+                    }
+                }*/
             }else{
                 logger.info("sendPosToGD-failed:code:{} ,text:{}",response.getStatusCode(),response.getResponseText());
                 result.put("success", false);

+ 3 - 3
src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ spring:
         driverClassName: oracle.jdbc.OracleDriver
         username: jpt_zs
         password: select!#%*(
-        url: jdbc:oracle:thin:@10.1.81.208:11660:orcl
+        url: jdbc:oracle:thin:@10.1.81.208:11736:orcl
         initialSize: 1
         maxActive: 3
         maxWait: 30000
@@ -33,8 +33,8 @@ gd:
     posUrl: https://e600036-iflmap.hcicnsbt.cn1.platform.sapcloud.cn
     username: 66ce7aa2-f2e9-31c9-b363-ca41d552fd3a
     password: ZAQ1xsw2cde3
-    distiCode : testdisticode
-    distiName : testdistiname
+    distiCode : 1000119359
+    distiName : 佳品通
 
 
 

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

@@ -34,5 +34,5 @@ gd:
     posUrl: https://e600036-iflmap.hcicnsbt.cn1.platform.sapcloud.cn
     username: 66ce7aa2-f2e9-31c9-b363-ca41d552fd3a
     password: ZAQ1xsw2cde3
-    distiCode: testdisticode
-    distiName: testdistin
+    distiCode : 1000119359
+    distiName : 佳品通

+ 14 - 14
src/test/java/com/uas/eis/UasEisApplicationTests.java

@@ -27,26 +27,26 @@ public class UasEisApplicationTests {
 	@Test
 	public void TestPOS() throws Exception {
 		System.out.println(123);
-		gdService.sendPosToGD("",1);
+		//gdService.sendPosToGD("",3021);//正向测试
+		gdService.sendPosToGD("",3027);
+		//gdService.sendPosToGD("",3026);
+
 	}
 	@Test
 	public void TestInv() throws Exception {
 		System.out.println(123);
-		gdService.sendInvToGD("",3000);
+		gdService.sendInvToGD("",3025);
 	}
 	@Test
 	public void Test1() throws Exception {
-		//String resp="{\"access_token\":\"eyJhbGciOiJSUzI1NiIsIng1dSI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BL1bYDrNjmjg7jKIuCF6aXdM6L9PiJiLPcOUQjFOveMK9p3/FwEqXkerNAm7K52+ASlvvUQRsMuiRgPA5hGY8Nar1KQcR7BEGjQohFFHpf5dkpkPq56rAcXx+kJaZOMflBbz2t2LLjQLc+BxV+yllwn1WsYYuv4Ldbi4aaWki/3izhH5diYBxvKy31NtE79VBfaPIhO3SMMiOhMrYymCyLIHoJSZeplo0YebSydU8HvBcqsRJda7ytrMeHVvxrN3KO+V4TBFO95g91Nl8bgcn9wurg9uJgBfFBpZ0j0Ac1QzE06Pz7cgrheDjizl8hvxxxAC8cHvme5bJcR5R3OwsWZl6QB3HYEGvAKB83s9Jy6W6Oy0V30w09L4JtRyp87RCc5fj24l9SQIPhC5yD/tclX+ti2NRx7Ac77cG5ZDHtmN8soqtTDApmSxE4ufMurWg0CnWs+STxRGkwL2nmoBm0kvPrKEjFHTrJMhsAHZbxd6121jSBnmk+dEpiSctN2l1fq6ulVFVTyW7Y/B+bg86ui5V458jcdmVb6pcfqbirZgVqRlNX+VVg+JLienT+g\",\"token_type\":\"Bearer\",\"expires_in\":14400,\"scope\":\"\"}\n";
-		//String resp="{\"count\":null,\"code\":\"0000\",\"msg\":\"success\",\"data\":[{\"syncStatus\":\"failed\",\"errorMessage\":\"未能根据CPN编号查询到有效CPN\",\"errorCode\":\"error_006\",\"itemId\":1}],\"success\":true}\n";
-		//String resp="{\"count\":null,\"code\":\"0000\",\"msg\":\"success\",\"data\":{\"sid\":null,\"success\":\"false\",\"msg\":\"执行失败\",\"errorCode\":\"1006\",\"errorMsg\":\"代理商编码不存在\",\"distiCode\":\"testdisticode\",\"productCode\":\"GD32F303RET6\",\"dateCode\":null,\"deadlineDate\":\"2026-11-10\",\"endCustomerCode\":\"\",\"lot\":null,\"quantity\":15000},\"success\":true}";
-		/*PosResponse posResponse=FlexJsonUtil.fromJson(resp, PosResponse.class);
-		for(PosRespItem item : posResponse.getData()){
-			System.out.println(item.getSyncStatus());
-			System.out.println(item.getErrorMessage());
-		}*/
-		String resp="{\"code\": 200,\"data\": {\"success\": \"true\",\"msg\": \"执行成功\"\n" +"}\n" +"}";
-		/*InventoryResponse response=FlexJsonUtil.fromJson(resp, InventoryResponse.class);*/
-		Map<Object, Object> store = BaseUtil.parseFormStoreToMap(resp);
-		System.out.println(store.get("code"));
+		String  //respText="{\"count\":null,\"code\":\"0000\",\"msg\":\"success\",\"data\":{\"sid\":null,\"success\":\"true\",\"msg\":\"执行成功\",\"errorCode\":null,\"errorMsg\":null,\"distiCode\":null,\"productCode\":null,\"dateCode\":null,\"deadlineDate\":null,\"endCustomerCode\":null,\"lot\":null,\"quantity\":null},\"success\":true}";
+		respText="{\"count\":null,\"code\":\"0000\",\"msg\":\"success\",\"data\":{\"sid\":null,\"success\":\"false\",\"msg\":\"执行失败\",\"errorCode\":\"1005\",\"errorMsg\":\"库存盘点接口日期必须晚于上次上传库存盘点截止日期\",\"distiCode\":\"1000119359\",\"productCode\":\"GD32F470ZKT6\",\"dateCode\":\"PY2443\",\"deadlineDate\":\"2026-11-01\",\"endCustomerCode\":\"\",\"lot\":\"C111741\",\"quantity\":500},\"success\":true}";
+
+		InventoryResponse response=FlexJsonUtil.fromJson(respText, InventoryResponse.class);
+		if(response!=null){
+			if(response.getData()!=null){
+				System.out.println(response.getData().getSuccess());
+			}
+		}
 	}
 }