|
|
@@ -10,6 +10,7 @@ import com.sf.csim.express.service.IServiceCodeStandard;
|
|
|
import com.sf.csim.express.service.code.ExpressServiceCodeEnum;
|
|
|
import com.uas.eis.core.config.SpObserver;
|
|
|
import com.uas.eis.dao.*;
|
|
|
+import com.uas.eis.entity.LogisticsPrice;
|
|
|
import com.uas.eis.entity.dop.DoPApiResp;
|
|
|
import com.uas.eis.entity.dop.DoPPriceQueryReq;
|
|
|
import com.uas.eis.entity.dop.DoPResponseParam;
|
|
|
@@ -23,6 +24,7 @@ import com.uas.eis.utils.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
@@ -41,7 +43,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
public Map<String, Object> creatSFOrder(String master, Integer id,String emCode) {
|
|
|
Map<String,Object> retMap = new HashMap<>();
|
|
|
retMap.put("success",true);
|
|
|
- logger.info("creatSFOrder-Begin:master {} id {}",master,id);
|
|
|
+ logger.info("creatSFOrder-Begin: id {}",master,id);
|
|
|
SpObserver.putSp(master);
|
|
|
SqlRowList outMsg = baseDao.queryForRowSet(" select pi_inoutno,pi_dockingstatus,pi_title,pi_address,pi_purposename,pi_expresscode,pi_dockingcode " +
|
|
|
" from prodinout where pi_id = ? ",id);
|
|
|
@@ -49,7 +51,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
if(outMsg.getGeneralString("pi_dockingstatus").equals("已创建")){
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","出货单已创建顺发订单.");
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
Object[] obs = baseDao.getFieldsDataByCondition("JYX_ZS.DOCK_SF_CONFIG A "
|
|
|
@@ -57,19 +59,19 @@ public class ERPServiceImpl implements ERPService {
|
|
|
if(!StringUtil.hasText(obs[0])){
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","请联系管理员配置创建URL.");
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
if(!StringUtil.hasText(obs[1])){
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","请联系管理员配置丰桥平台顾客编码.");
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
if(!StringUtil.hasText(obs[2])){
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","请联系管理员配置丰桥平台校验码.");
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
boolean prodFlag = (Integer.valueOf(obs[3].toString())!=0);
|
|
|
@@ -208,7 +210,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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+"')");
|
|
|
retMap.put("success",false);
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}else {
|
|
|
@@ -216,7 +218,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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+"')");
|
|
|
retMap.put("success",false);
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}else {
|
|
|
@@ -225,7 +227,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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+"')");
|
|
|
retMap.put("success",false);
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}
|
|
|
@@ -235,16 +237,16 @@ public class ERPServiceImpl implements ERPService {
|
|
|
"values( MESSAGELOG_SEQ.nextval,SYSDATE,'"+emName+"','创建顺发订单','创建失败:"+(StringUtil.nvl(e.getMessage(),""))+"','ProdInOut!Sale|pi_id="+id+"','"+inoutNo+"')");
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","创建失败"+(StringUtil.nvl(e.getMessage(),"")));
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}else {
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","没有需要创建的出货单.");
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
- logger.info("creatSFOrder-End:master {} id {}",master,id);
|
|
|
+ logger.info("creatSFOrder-End: id {}",master,id);
|
|
|
retMap.put("message","创建成功。");
|
|
|
return retMap;
|
|
|
}
|
|
|
@@ -253,14 +255,14 @@ public class ERPServiceImpl implements ERPService {
|
|
|
public Map<String, Object> cancelSFOrder(String master, Integer id, String emCode) {
|
|
|
Map<String,Object> retMap = new HashMap<>();
|
|
|
retMap.put("success",true);
|
|
|
- logger.info("cancelSFOrder-Begin:master {} id {}",master,id);
|
|
|
+ logger.info("cancelSFOrder-Begin: id {}",master,id);
|
|
|
SpObserver.putSp(master);
|
|
|
SqlRowList outMsg = baseDao.queryForRowSet(" select pi_inoutno,pi_dockingstatus,pi_dockingcode from prodinout where pi_id = ? ",id);
|
|
|
if(outMsg.next()) {
|
|
|
if (!outMsg.getGeneralString("pi_dockingstatus").equals("已创建")) {
|
|
|
retMap.put("success", false);
|
|
|
retMap.put("message", "出货单尚未创建顺发订单.");
|
|
|
- logger.info("cancelSFOrder-F:master {} id {} err {}", master, id, retMap.get("message"));
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", master, id, retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
Object[] obs = baseDao.getFieldsDataByCondition("JYX_ZS.DOCK_SF_CONFIG A "
|
|
|
@@ -268,19 +270,19 @@ public class ERPServiceImpl implements ERPService {
|
|
|
if (!StringUtil.hasText(obs[0])) {
|
|
|
retMap.put("success", false);
|
|
|
retMap.put("message", "请联系管理员配置创建URL.");
|
|
|
- logger.info("cancelSFOrder-F:master {} id {} err {}", master, id, retMap.get("message"));
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", master, id, retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
if (!StringUtil.hasText(obs[1])) {
|
|
|
retMap.put("success", false);
|
|
|
retMap.put("message", "请联系管理员配置丰桥平台顾客编码.");
|
|
|
- logger.info("cancelSFOrder-F:master {} id {} err {}", master, id, retMap.get("message"));
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", master, id, retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
if (!StringUtil.hasText(obs[2])) {
|
|
|
retMap.put("success", false);
|
|
|
retMap.put("message", "请联系管理员配置丰桥平台校验码.");
|
|
|
- logger.info("cancelSFOrder-F:master {} id {} err {}", master, id, retMap.get("message"));
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", master, id, retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
Object emName = baseDao.getFieldDataByCondition("employee" , "em_name", "em_code='"+emCode+"'");
|
|
|
@@ -348,7 +350,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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+"')");
|
|
|
retMap.put("success",false);
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}else {
|
|
|
@@ -356,7 +358,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
"values( MESSAGELOG_SEQ.nextval,SYSDATE,'"+emName+"','取消顺发订单','取消失败:["+sfApiRespData.getErrorCode()+"]"+sfApiRespData.getErrorMsg()+"','ProdInOut!Sale|pi_id="+id+"','"+inoutNo+"')");
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","取消失败:["+sfApiRespData.getErrorCode()+"]"+sfApiRespData.getErrorMsg());
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}else {
|
|
|
@@ -364,7 +366,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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+"')");
|
|
|
retMap.put("success",false);
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}
|
|
|
@@ -374,16 +376,16 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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+"')");
|
|
|
retMap.put("success",false);
|
|
|
- logger.info("creatSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
}else {
|
|
|
retMap.put("success",false);
|
|
|
retMap.put("message","没有需要操作的出货单.");
|
|
|
- logger.info("cancelSFOrder-F:master {} id {} err {}",master,id,retMap.get("message"));
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}",master,id,retMap.get("message"));
|
|
|
return retMap;
|
|
|
}
|
|
|
- logger.info("cancelSFOrder-End:master {} id {}",master,id);
|
|
|
+ logger.info("cancelSFOrder-End: id {}",master,id);
|
|
|
retMap.put("message","取消成功。");
|
|
|
return retMap;
|
|
|
}
|
|
|
@@ -423,27 +425,348 @@ public class ERPServiceImpl implements ERPService {
|
|
|
|
|
|
return modelMap;
|
|
|
}
|
|
|
- private String creatOrder_SF(Integer id){
|
|
|
- return "";
|
|
|
+ private Map<String, Object> creatOrder_SF(LogisticsPrice logisticsPrice){
|
|
|
+ Map<String, Object> retMap = new HashMap<String, Object>();
|
|
|
+ logger.info("creatSFOrder-Begin");
|
|
|
+ String emCode=logisticsPrice.getLp_Recorder();
|
|
|
+ Object[] obs = baseDao.getFieldsDataByCondition("SZSI_P.DOCK_LOGISTICS_CONFIG A "
|
|
|
+ , new String[]{"CALL_URL","CLIENT_CODE","CHECK_WORD","ENABLE_"}, "LOGISTICS_='SFTEST' and type_='CREATEORDER' AND A.ENABLE_ = 1");
|
|
|
+ if(!StringUtil.hasText(obs[0])){
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","请联系管理员配置创建URL.");
|
|
|
+ logger.info("creatSFOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if(!StringUtil.hasText(obs[1])){
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","请联系管理员配置丰桥平台顾客编码.");
|
|
|
+ logger.info("creatSFOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if(!StringUtil.hasText(obs[2])){
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","请联系管理员配置丰桥平台校验码.");
|
|
|
+ logger.info("creatSFOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ boolean prodFlag = (Integer.valueOf(obs[3].toString())!=0);
|
|
|
+ Object emName = baseDao.getFieldDataByCondition("employee" , "em_name", "em_code='"+emCode+"'");
|
|
|
+ if(emName == null){
|
|
|
+ emName = "管理员("+emCode+")";
|
|
|
+ }
|
|
|
+ String inoutNo = logisticsPrice.getLp_Code();
|
|
|
+ String orderCode = logisticsPrice.getLp_DockingCode();
|
|
|
+ if(orderCode!=null && orderCode.length()>0){
|
|
|
+ orderCode=inoutNo+"-"+(Integer.valueOf(orderCode.split("-")[1])+1);
|
|
|
+ }else {
|
|
|
+ orderCode=inoutNo+"-1";
|
|
|
+ }
|
|
|
+ String CLIENT_CODE = obs[1].toString(); //此处替换为您在丰桥平台获取的顾客编码
|
|
|
+ String CALL_URL = obs[0].toString();
|
|
|
+ String CHECK_WORD = obs[2].toString();
|
|
|
+ String monthlyCard = "7551234567";//7550911545";//后续看是否区分市场部和其他部门 先用市场部门的 测试 7551234567
|
|
|
+ //寄件人
|
|
|
+ Object[] en = baseDao.getFieldsDataByCondition("enterprise" , new String[]{"EN_NAME","EN_DELIVERADDR"}, "1=1");
|
|
|
+ String sendCop = en[0].toString().trim();
|
|
|
+ String sendAddr = en[1].toString();
|
|
|
+ String sendMan = logisticsPrice.getLp_Recorder();
|
|
|
+ String sendMobile = baseDao.getFieldValue("employee","max(em_mobile)","em_name='"+ logisticsPrice.getLp_Recorder()+"'",String.class);
|
|
|
+
|
|
|
+ IServiceCodeStandard standardService = ExpressServiceCodeEnum.EXP_RECE_CREATE_ORDER; //下订单
|
|
|
+ CallExpressServiceTools tools=CallExpressServiceTools.getInstance();
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
+ String timeStamp = String.valueOf(System.currentTimeMillis());
|
|
|
+ String msgData = "";
|
|
|
+ SFCreatOrderReq sfOrder = new SFCreatOrderReq();
|
|
|
+ sfOrder.setOrderId(orderCode);
|
|
|
+ sfOrder.setMonthlyCard(monthlyCard);
|
|
|
+ sfOrder.setTotalWeight(logisticsPrice.getLp_Weight());
|
|
|
+ int expressTypeId=0;
|
|
|
+ if("特快".equals(logisticsPrice.getLp_Type())){
|
|
|
+ expressTypeId=1;
|
|
|
+ }else if("普快".equals(logisticsPrice.getLp_Type())){
|
|
|
+ expressTypeId=2;
|
|
|
+ }else if("物流".equals(logisticsPrice.getLp_Type())){
|
|
|
+ expressTypeId=255;//卡航
|
|
|
+ }
|
|
|
+ sfOrder.setExpressTypeId(expressTypeId);
|
|
|
+ //sfOrder.setIsSignBack(1);//回签
|
|
|
+ //寄件方信息
|
|
|
+ List<SFContactInfo> contactInfoList = new ArrayList<>();
|
|
|
+ SFContactInfo sendInfo = new SFContactInfo();
|
|
|
+ sendInfo.setContactType(1);
|
|
|
+ sendInfo.setCompany(sendCop);
|
|
|
+ sendInfo.setContact(sendMan);
|
|
|
+ sendInfo.setMobile(sendMobile);
|
|
|
+ sendInfo.setAddress(sendAddr);
|
|
|
+ contactInfoList.add(sendInfo);
|
|
|
+ //到件方信息
|
|
|
+ SFContactInfo receiveInfo = new SFContactInfo();
|
|
|
+ receiveInfo.setContactType(2);
|
|
|
+ receiveInfo.setCompany(logisticsPrice.getLp_ReceiveCompany());
|
|
|
+ receiveInfo.setContact(logisticsPrice.getLp_Recipient());
|
|
|
+ receiveInfo.setMobile(logisticsPrice.getLp_Tel());
|
|
|
+ receiveInfo.setAddress(logisticsPrice.getLp_Add());
|
|
|
+ contactInfoList.add(receiveInfo);
|
|
|
+ sfOrder.setContactInfoList(contactInfoList);
|
|
|
+ List<SFCargoDetail> cargoDetails = new ArrayList<>();
|
|
|
+
|
|
|
+ sfOrder.setCargoDetails(cargoDetails);
|
|
|
+ msgData = FlexJsonUtil.toJsonDeep(sfOrder);
|
|
|
+ System.out.println("====请求msgData:" + msgData);
|
|
|
+ try {
|
|
|
+ params.put("partnerID", CLIENT_CODE); // 顾客编码 ,对应丰桥上获取的clientCode
|
|
|
+ params.put("requestID", UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ params.put("serviceCode",standardService.getCode());// 接口服务码
|
|
|
+ params.put("timestamp", timeStamp);
|
|
|
+ params.put("msgData", msgData);
|
|
|
+ params.put("msgDigest", tools.getMsgDigest(msgData,timeStamp,CHECK_WORD));
|
|
|
+ System.out.println("====调用实际请求:" + params);
|
|
|
+ String result = HttpClientUtil.post(CALL_URL, params);
|
|
|
+ SFApiResp sfApiResp = FlexJsonUtil.fromJson(result, SFApiResp.class);
|
|
|
+ System.out.println("result:"+result);
|
|
|
+ if(sfApiResp!=null){
|
|
|
+ if("A1000".equals(sfApiResp.getApiResultCode())){
|
|
|
+ String apiResultData = sfApiResp.getApiResultData();
|
|
|
+ SFCreatOrderResp sfApiRespData = FlexJsonUtil.fromJson(apiResultData, SFCreatOrderResp.class);
|
|
|
+ if(sfApiRespData.isSuccess()){
|
|
|
+ SFCreateOrder sfOrderResp = sfApiRespData.getMsgData();
|
|
|
+ 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()){
|
|
|
+ String waybillNo = sfWaybillNoInfoResp.getWaybillNo();
|
|
|
+ if(sfWaybillNoInfoResp.getWaybillType() == 1||sfWaybillNoInfoResp.getWaybillType() == 2){//运单号类型1:母单 2 :子单 3 : 签回单
|
|
|
+ System.out.println("顺丰物流单号: ====="+sfWaybillNoInfoResp.getWaybillNo());
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(waybillNoList.length()>0){
|
|
|
+ retMap.put("success",true);
|
|
|
+ retMap.put("logisticscode",waybillNoList.toString());
|
|
|
+ retMap.put("dockingcode",orderCode);
|
|
|
+ } else {
|
|
|
+ retMap.put("message","创建失败:["+sfApiRespData.getErrorCode()+"]"+sfApiRespData.getErrorMsg());
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("creatSFOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ retMap.put("message","创建失败:["+sfApiRespData.getErrorCode()+"]"+sfApiRespData.getErrorMsg());
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+// System.out.println("code:"+sfApiResp.getApiResultCode()+"===apiResponseID:"+sfApiResp.getApiResponseID()+"===apiErrorMsg:"+sfApiResp.getApiErrorMsg());
|
|
|
+ retMap.put("message","创建失败:["+sfApiResp.getApiResultCode()+"]"+sfApiResp.getApiErrorMsg());
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("creatSFOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","创建失败"+(StringUtil.nvl(e.getMessage(),"")));
|
|
|
+ logger.info("creatSFOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ private Map<String, Object> cancelOrder_SF(LogisticsPrice logisticsPrice){
|
|
|
+ Map<String,Object> retMap = new HashMap<>();
|
|
|
+ retMap.put("success",true);
|
|
|
+ logger.info("cancelSFOrder-Begin: id {}",logisticsPrice.getLp_Id());
|
|
|
+ if(logisticsPrice!=null) {
|
|
|
+ String emCode=logisticsPrice.getLp_Recorder();
|
|
|
+ if (!"已创建".equals(logisticsPrice.getLp_dockingstatus())) {
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", "尚未创建快递订单.");
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", logisticsPrice.getLp_Id(), retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ Object[] obs = baseDao.getFieldsDataByCondition("SZSI_P.DOCK_LOGISTICS_CONFIG A "
|
|
|
+ , new String[]{"CALL_URL","CLIENT_CODE","CHECK_WORD","ENABLE_"}, "LOGISTICS_='SFTEST' and type_='CANCELORDER' AND A.ENABLE_ = 1");
|
|
|
+ if (!StringUtil.hasText(obs[0])) {
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", "请联系管理员配置创建URL.");
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", logisticsPrice.getLp_Id(), retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if (!StringUtil.hasText(obs[1])) {
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", "请联系管理员配置丰桥平台顾客编码.");
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", logisticsPrice.getLp_Id(), retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if (!StringUtil.hasText(obs[2])) {
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", "请联系管理员配置丰桥平台校验码.");
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}", logisticsPrice.getLp_Id(), retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ Object emName = baseDao.getFieldDataByCondition("employee" , "em_name", "em_code='"+emCode+"'");
|
|
|
+ if(emName == null){
|
|
|
+ emName = "管理员("+emCode+")";
|
|
|
+ }
|
|
|
+ String inoutNo = logisticsPrice.getLp_Code();
|
|
|
+ String orderCode = logisticsPrice.getLp_DockingCode();
|
|
|
+ String CLIENT_CODE = obs[1].toString(); //丰桥平台获取的顾客编码
|
|
|
+ String CALL_URL = obs[0].toString(); //沙箱环境的地址 -PRO https://sfapi-sbox.sf-express.com/std/service 生产环境的地址 -PRO https://sfapi.sf-express.com/std/service
|
|
|
+ String CHECK_WORD = obs[2].toString(); //丰桥平台获取的校验码 生产环境 "GgO0UoyQ5FssNLItii3olo63bQ80ErAE" 沙箱环境 "rMBhSYRa9OtUPkfX5mow01NlxDWtI411"
|
|
|
+
|
|
|
+ IServiceCodeStandard standardService = ExpressServiceCodeEnum.EXP_RECE_UPDATE_ORDER;//订单取消
|
|
|
+ CallExpressServiceTools tools=CallExpressServiceTools.getInstance();
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
+ String timeStamp = String.valueOf(System.currentTimeMillis());
|
|
|
+ String msgData = "";
|
|
|
+ Map<String,Object> msgDataMap = new HashMap<>();
|
|
|
+ msgDataMap.put("orderId",orderCode);
|
|
|
+ msgDataMap.put("dealType",2);
|
|
|
+ msgData = FlexJsonUtil.toJsonDeep(msgDataMap);
|
|
|
+ try {
|
|
|
+ params.put("partnerID", CLIENT_CODE); // 顾客编码 ,对应丰桥上获取的clientCode
|
|
|
+ params.put("requestID", UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ params.put("serviceCode",standardService.getCode());// 接口服务码
|
|
|
+ params.put("timestamp", timeStamp);
|
|
|
+ params.put("msgData", msgData);
|
|
|
+ params.put("msgDigest", tools.getMsgDigest(msgData,timeStamp,CHECK_WORD));
|
|
|
+ System.out.println("====调用请求:" + params.get("msgData"));
|
|
|
+ String result = HttpClientUtil.post(CALL_URL, params);
|
|
|
+ System.out.println("===返回结果:" +result);
|
|
|
+ SFApiResp sfApiResp = FlexJsonUtil.fromJson(result, SFApiResp.class);
|
|
|
+ if(sfApiResp!=null){
|
|
|
+ if("A1000".equals(sfApiResp.getApiResultCode())){
|
|
|
+ String apiResultData = sfApiResp.getApiResultData();
|
|
|
+ SFCancelOrderResp sfApiRespData = FlexJsonUtil.fromJson(apiResultData, SFCancelOrderResp.class);
|
|
|
+ if(sfApiRespData.isSuccess()){
|
|
|
+ SFCancelOrder sfOrderResp = sfApiRespData.getMsgData();
|
|
|
+ StringBuffer waybillNo = new StringBuffer();
|
|
|
+ if(!CollectionUtil.isEmpty(sfOrderResp.getWaybillNoInfoList())){
|
|
|
+ for (SFWaybillNoInfo sfWaybillNoInfoResp:sfOrderResp.getWaybillNoInfoList()){
|
|
|
+ if(waybillNo.length()>0){
|
|
|
+ waybillNo.append(",");
|
|
|
+ }
|
|
|
+ waybillNo.append(sfWaybillNoInfoResp.getWaybillNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(sfOrderResp.getResStatus()==2){
|
|
|
+ retMap.put("success",true);
|
|
|
+ retMap.put("logisticscode",waybillNo.length()>0?waybillNo.toString():"");
|
|
|
+ }else {
|
|
|
+ if(sfOrderResp.getResStatus()==1){
|
|
|
+ retMap.put("message","取消失败:客户订单号与顺丰运单不匹配");
|
|
|
+ }else {
|
|
|
+ retMap.put("message","取消失败:["+sfOrderResp.getResStatus()+"]");
|
|
|
+ }
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","取消失败:["+sfApiRespData.getErrorCode()+"]"+sfApiRespData.getErrorMsg());
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ retMap.put("message","取消失败:["+sfApiResp.getApiResultCode()+"]"+sfApiResp.getApiErrorMsg());
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ retMap.put("message","取消失败"+(StringUtil.nvl(e.getMessage(),""))); retMap.put("success",false);
|
|
|
+ logger.info("creatSFOrder-F: id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","没有需要操作的单据.");
|
|
|
+ logger.info("cancelSFOrder-F: id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ logger.info("cancelSFOrder-End: id {}",logisticsPrice.getLp_Id());
|
|
|
+ retMap.put("message","取消成功。");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ private Map<String, Object> creatOrder_DoP(LogisticsPrice logisticsPrice){
|
|
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ logger.info("creatDOPOrder-Begin");
|
|
|
+ return modelMap;
|
|
|
}
|
|
|
- private String creatOrder_DoP(Integer id){
|
|
|
- return "";
|
|
|
+ private Map<String, Object> cancelOrder_DoP(LogisticsPrice logisticsPrice){
|
|
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ logger.info("cancelDOPOrder-Begin");
|
|
|
+ return modelMap;
|
|
|
}
|
|
|
- private String creatOrder_KY(Integer id){
|
|
|
- return "";
|
|
|
+ private Map<String, Object> creatOrder_KY(LogisticsPrice logisticsPrice){
|
|
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ logger.info("creatKYOrder-Begin");
|
|
|
+ return modelMap;
|
|
|
+ }
|
|
|
+ private Map<String, Object> cancelOrder_KY(LogisticsPrice logisticsPrice){
|
|
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ logger.info("cancelKYOrder-Begin");
|
|
|
+ return modelMap;
|
|
|
}
|
|
|
@Override
|
|
|
public Map<String, Object> creatOrder(String master, Integer id) {
|
|
|
SpObserver.putSp(master);
|
|
|
Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
- SqlRowList rs = baseDao.queryForRowSet("select lp_finalcompany from LogisticsPrice where lp_id="+id);
|
|
|
- if(rs.next()){
|
|
|
- if("顺丰".equals(rs.getGeneralString("lp_finalcompany"))){
|
|
|
- creatOrder_SF(id);
|
|
|
- }else if("德邦".equals(rs.getGeneralString("lp_finalcompany"))){
|
|
|
- creatOrder_DoP(id);
|
|
|
- }else if("跨越".equals(rs.getGeneralString("lp_finalcompany"))){
|
|
|
- creatOrder_KY(id);
|
|
|
+ LogisticsPrice logisticsPrice=baseDao.getJdbcTemplate().queryForObject("select * from LogisticsPrice where lp_id="+id, new BeanPropertyRowMapper<LogisticsPrice>(LogisticsPrice.class));
|
|
|
+ if(logisticsPrice != null){
|
|
|
+ if("顺丰".equals(logisticsPrice.getLp_FinalCompany())){
|
|
|
+ creatOrder_SF(logisticsPrice);
|
|
|
+ }else if("德邦".equals(logisticsPrice.getLp_FinalCompany())){
|
|
|
+ creatOrder_DoP(logisticsPrice);
|
|
|
+ }else if("跨越".equals(logisticsPrice.getLp_FinalCompany())){
|
|
|
+ creatOrder_KY(logisticsPrice);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ modelMap.put("message", "单据不存在!");
|
|
|
+ modelMap.put("success", false);
|
|
|
+ }
|
|
|
+ return modelMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> cancelOrder(String master, Integer id) {
|
|
|
+ SpObserver.putSp(master);
|
|
|
+ Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ LogisticsPrice logisticsPrice=baseDao.getJdbcTemplate().queryForObject("select * from LogisticsPrice where lp_id="+id, new BeanPropertyRowMapper<LogisticsPrice>(LogisticsPrice.class));
|
|
|
+ if(logisticsPrice != null){
|
|
|
+ if("顺丰".equals(logisticsPrice.getLp_FinalCompany())){
|
|
|
+ cancelOrder_SF(logisticsPrice);
|
|
|
+ }else if("德邦".equals(logisticsPrice.getLp_FinalCompany())){
|
|
|
+ cancelOrder_DoP(logisticsPrice);
|
|
|
+ }else if("跨越".equals(logisticsPrice.getLp_FinalCompany())){
|
|
|
+ cancelOrder_KY(logisticsPrice);
|
|
|
}
|
|
|
}else{
|
|
|
modelMap.put("message", "单据不存在!");
|
|
|
@@ -474,7 +797,9 @@ public class ERPServiceImpl implements ERPService {
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select LP_ID, LP_CODE, LP_INDATE, LP_CALDATE, LP_TYPE, LP_ROUTE, LP_WEIGHT, LP_VOLUME, LP_RECIPIENT, LP_TEL, LP_ADD, LP_RECORDER, LP_COMPANY1, LP_PROVINCE, LP_DISTRICT, LP_SENDDATETIME,to_char(LP_SENDDATETIME,'yyyy-mm-dd hh24:mi:ss') SENDDATETIME" +
|
|
|
" from LogisticsPrice where lp_id="+id);
|
|
|
if(rs.next()){
|
|
|
- getPrice_KY(id,rs.getGeneralString("LP_TYPE"),rs.getGeneralDouble("LP_WEIGHT"),rs.getGeneralString("lp_province"),rs.getGeneralString("lp_route"),
|
|
|
+ getPrice_KY(id,rs.getGeneralString("LP_TYPE"),rs.getGeneralDouble("LP_WEIGHT"),
|
|
|
+ rs.getGeneralString("lp_province"),
|
|
|
+ rs.getGeneralString("lp_route"),
|
|
|
rs.getDate("LP_SENDDATETIME"));
|
|
|
}
|
|
|
}
|
|
|
@@ -612,6 +937,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
businessType="160";
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println("businessType:"+businessType);
|
|
|
params.put("format","json");
|
|
|
params.put("timestamp",timeStamp);
|
|
|
String method="open.api.openCommon.queryFreightCharge";
|