Эх сурвалжийг харах

【佳毅兴】【顺丰对接】【新增回签单号】

wuyx 1 жил өмнө
parent
commit
04e980d75e

+ 1 - 0
src/main/java/com/uas/eis/dao/BaseDao.java

@@ -117,6 +117,7 @@ public class BaseDao{
 			jdbcTemplate.update(sql, objs);
 			return true;
 		} catch (Exception e) {
+			e.printStackTrace();
 			return false;
 		}
 	}

+ 1 - 0
src/main/java/com/uas/eis/entity/sf/SFCreatOrderReq.java

@@ -34,6 +34,7 @@ public class SFCreatOrderReq {
     //20	sendStartTm	Date	否	接收 到报 文的 时间	要求上门取件开始时间, 格式: YYYY-MM-DD HH24:MM:SS, 示例: 2012-7-30 09:30:00 (预约单传预约截止时间,不赋值默认按当前时间下发,1小时内取件)
     //21	isDocall	Number(1)	否	0	是否通过手持终端 通知顺丰收派 员上门收件,支持以下值: 1:要求 0:不要求
     //22	isSignBack	Number(1)	否	0	是否返回签回单 (签单返还)的运单号, 支持以下值: 1:要求 0:不要求
+    Integer isSignBack = 0;
     //23	custReferenceNo	String(100)	否		客户参考编码:如客户原始订单号
     //24	temperatureRange	Number(2)	条件		温度范围类型,当 express_type为12 医药温控件 时必填,支持以下值: 1:冷藏 3:冷冻
     //25	orderSource	String(50)	否		订单平台类型 (对于平台类客户, 如果需要在订单中 区分订单来源, 则可使用此字段) 天猫:tmall, 拼多多:pinduoduo, 京东 : jd 等平台类型编码

+ 38 - 9
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -98,6 +98,7 @@ public class ERPServiceImpl implements ERPService {
             SFCreatOrderReq sfOrder = new SFCreatOrderReq();
             sfOrder.setOrderId(orderCode);
             sfOrder.setMonthlyCard(monthlyCard);
+            sfOrder.setIsSignBack(1);
             //寄件方信息
             List<SFContactInfo> contactInfoList = new ArrayList<>();
             SFContactInfo sendInfo = new SFContactInfo();
@@ -149,21 +150,49 @@ public class ERPServiceImpl implements ERPService {
                         SFCreatOrderResp sfApiRespData =  FlexJsonUtil.fromJson(apiResultData, SFCreatOrderResp.class);
                         if(sfApiRespData.isSuccess()){
                             SFCreateOrder sfOrderResp =  sfApiRespData.getMsgData();
-                            StringBuffer waybillNo = new StringBuffer();
+                            StringBuffer waybillNoList = new StringBuffer();
+                            StringBuffer waybillNoP = new StringBuffer();
+                            StringBuffer waybillSon = new StringBuffer();
+                            StringBuffer waybillBack = new StringBuffer();
                             if(!CollectionUtil.isEmpty(sfOrderResp.getWaybillNoInfoList())){
                                 for (SFWaybillNoInfo sfWaybillNoInfoResp:sfOrderResp.getWaybillNoInfoList()){
 //                                    System.out.println("顺丰物流单号: ====="+sfWaybillNoInfoResp.getWaybillNo());
-                                    if(waybillNo.length()>0){
-                                        waybillNo.append(",");
+                                    String waybillNo = sfWaybillNoInfoResp.getWaybillNo();
+                                    if(sfWaybillNoInfoResp.getWaybillType() == 1||sfWaybillNoInfoResp.getWaybillType() == 2){//运单号类型1:母单 2 :子单 3 : 签回单
+                                        if(waybillNoList.length()>0){
+                                            waybillNoList.append(",");
+                                        }
+                                        waybillNoList.append(waybillNo);
+                                        if(sfWaybillNoInfoResp.getWaybillType() == 1) {
+                                            if (waybillNoP.length() > 0) {
+                                                waybillNoP.append(",");
+                                            }
+                                            waybillNoP.append(waybillNo);
+                                        }else{
+                                            if (waybillSon.length() > 0) {
+                                                waybillSon.append(",");
+                                            }
+                                            waybillSon.append(waybillNo);
+                                        }
+                                    }else {
+                                        if(waybillBack.length()>0){
+                                            waybillBack.append(",");
+                                        }
+                                        waybillBack.append(waybillNo);
                                     }
-                                    waybillNo.append(sfWaybillNoInfoResp.getWaybillNo());
                                 }
                             }
-                            if(waybillNo.length()>0){
-                                baseDao.execute("update prodinout set pi_dockingcode=?,pi_logisticscode = ?,pi_dockingstatus='已创建' where pi_id = ?",orderCode,waybillNo.toString(),id);
+                            if(waybillNoList.length()>0){
+                                baseDao.execute("update prodinout set pi_dockingcode=?,pi_logisticscode = ?,pi_dockingstatus='已创建'" +
+                                                ",pi_sfParentCode=?,pi_sfSonCode=?,pi_sfBackCode=?" +
+                                                ",pi_sf_filterresult=?,pi_sf_remark=? where pi_id = ?"
+                                        ,orderCode,waybillNoList.toString(),waybillNoP.toString(),waybillSon.toString(),waybillBack.toString()
+                                        ,sfOrderResp.getFilterResult(),sfOrderResp.getRemark()
+                                        ,id);
                                 baseDao.execute("INSERT INTO MESSAGELOG(ML_ID, ML_DATE, ML_MAN, ML_CONTENT, ML_RESULT, ML_SEARCH, CODE) " +
-                                        "values( MESSAGELOG_SEQ.nextval,SYSDATE,'"+emName+"','创建顺发订单','创建成功,顺发单号:"+orderCode+",物流单号:"+waybillNo.toString()+"','ProdInOut!Sale|pi_id="+id+"','"+inoutNo+"')");
-                            }else {
+                                        "values( MESSAGELOG_SEQ.nextval,SYSDATE,'"+emName+"','创建顺发订单'" +
+                                        ",'创建成功,顺发单号:"+orderCode+",物流单号:"+waybillNoList.toString()+"','ProdInOut!Sale|pi_id="+id+"','"+inoutNo+"')");
+                            } else {
                                 retMap.put("message","创建失败:["+sfApiRespData.getErrorCode()+"]"+sfApiRespData.getErrorMsg());
                                 baseDao.execute("INSERT INTO MESSAGELOG(ML_ID, ML_DATE, ML_MAN, ML_CONTENT, ML_RESULT, ML_SEARCH, CODE) " +
                                         "values( MESSAGELOG_SEQ.nextval,SYSDATE,'"+emName+"','创建顺发订单','"+retMap.get("message")+"','ProdInOut!Sale|pi_id="+id+"','"+inoutNo+"')");
@@ -296,7 +325,7 @@ public class ERPServiceImpl implements ERPService {
                                 }
                             }
                             if(sfOrderResp.getResStatus()==2){
-                                baseDao.execute("update prodinout set pi_logisticscode = null,pi_dockingstatus=null where pi_id = ?",id);
+                                baseDao.execute("update prodinout set pi_logisticscode = null,pi_dockingstatus=null,pi_sfParentCode=null,pi_sfSonCode=null,pi_sfBackCode=null,pi_sf_filterresult=null,pi_sf_remark=null where pi_id = ?",id);
                                 baseDao.execute("INSERT INTO MESSAGELOG(ML_ID, ML_DATE, ML_MAN, ML_CONTENT, ML_RESULT, ML_SEARCH, CODE) " +
                                         "values( MESSAGELOG_SEQ.nextval,SYSDATE,'"+emName+"','取消顺发订单','取消成功"+(waybillNo.length()>0?",物流单号: "+waybillNo.toString():"")+"','ProdInOut!Sale|pi_id="+id+"','"+inoutNo+"')");
                             }else {

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

@@ -140,13 +140,13 @@ public class UasEisApplicationTests {
 
 	@Test
 	public void TestCreatSFOrder(){
-		Map<String, Object> res = erpService.creatSFOrder("JYX_TEST", 50734919,"ADMIN");
+		Map<String, Object> res = erpService.creatSFOrder("JYX_TEST", 50734879,"ADMIN");
 		System.out.println("res==="+res.get("success")+":"+res.get("message"));
 	}
 
 	@Test
 	public void TestCancelSFOrder(){
-		Map<String, Object> res = erpService.cancelSFOrder("JYX_TEST", 50734919,"ADMIN");
+		Map<String, Object> res = erpService.cancelSFOrder("JYX_TEST", 50734879,"ADMIN");
 		System.out.println("res==="+res.get("success")+":"+res.get("message"));
 	}
 	@Test