|
|
@@ -23,9 +23,7 @@ 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;
|
|
|
+import com.uas.eis.entity.dop.*;
|
|
|
import com.uas.eis.entity.ky.KYApiResp;
|
|
|
import com.uas.eis.entity.ky.KYPirceData;
|
|
|
import com.uas.eis.entity.ky.KYPriceQueryReq;
|
|
|
@@ -484,7 +482,6 @@ public class ERPServiceImpl implements ERPService {
|
|
|
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>();
|
|
|
@@ -731,14 +728,158 @@ public class ERPServiceImpl implements ERPService {
|
|
|
return retMap;
|
|
|
}
|
|
|
private Map<String, Object> creatOrder_DoP(LogisticsPrice logisticsPrice){
|
|
|
- Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> retMap = new HashMap<String, Object>();
|
|
|
logger.info("creatDOPOrder-Begin");
|
|
|
- return modelMap;
|
|
|
+ try {
|
|
|
+ Object[] obs = baseDao.getFieldsDataByCondition("SZSI_P.DOCK_LOGISTICS_CONFIG A "
|
|
|
+ , new String[]{"CALL_URL","CLIENT_CODE","CHECK_WORD","ENABLE_"}, "LOGISTICS_='DOPTEST' and type_='CREATEORDER' AND A.ENABLE_ = 1");
|
|
|
+ String CALL_URL = obs[0].toString();
|
|
|
+ String CLIENT_CODE = obs[1].toString();
|
|
|
+ String sendMobile = baseDao.getFieldValue("employee","max(em_mobile)","em_name='"+ logisticsPrice.getLp_Recorder()+"'",String.class);
|
|
|
+ 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";
|
|
|
+ }
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
+ DoPCreateOrderReq doPCreateOrderReq = new DoPCreateOrderReq();
|
|
|
+ doPCreateOrderReq.setLogisticID("VYOL"+orderCode);
|
|
|
+ doPCreateOrderReq.setCustOrderNo(orderCode);
|
|
|
+ doPCreateOrderReq.setCompanyCode(CLIENT_CODE);
|
|
|
+ doPCreateOrderReq.setOrderType("2");
|
|
|
+ String businessType="";
|
|
|
+ if("特快".equals(logisticsPrice.getLp_Type())){
|
|
|
+ businessType="TZKJC";
|
|
|
+ }else if("普快".equals(logisticsPrice.getLp_Type())){
|
|
|
+ businessType="RCP";//RCP
|
|
|
+ }else if("物流".equals(logisticsPrice.getLp_Type())){
|
|
|
+ businessType="NFLF";//新精准卡航:NFLF
|
|
|
+ }
|
|
|
+ doPCreateOrderReq.setTransportType(businessType);
|
|
|
+ doPCreateOrderReq.setCustomerCode("219401");//测试219401
|
|
|
+ DoPSender sender=new DoPSender();
|
|
|
+ sender.setCompanyName("深爱半导体");
|
|
|
+ sender.setName(logisticsPrice.getLp_Recorder());
|
|
|
+ sender.setMobile(sendMobile);
|
|
|
+ sender.setProvince(logisticsPrice.getLp_Province());
|
|
|
+ sender.setCity(logisticsPrice.getLp_Route());
|
|
|
+ sender.setCounty(logisticsPrice.getLp_District());
|
|
|
+ sender.setAddress(logisticsPrice.getLp_Add());
|
|
|
+ doPCreateOrderReq.setSender(sender);
|
|
|
+
|
|
|
+ DoPReceiver receiver=new DoPReceiver();
|
|
|
+ receiver.setName(logisticsPrice.getLp_Recipient());
|
|
|
+ receiver.setMobile(logisticsPrice.getLp_Tel());
|
|
|
+ receiver.setProvince(logisticsPrice.getLp_Province());
|
|
|
+ receiver.setCity(logisticsPrice.getLp_Route());
|
|
|
+ receiver.setCounty(logisticsPrice.getLp_District());
|
|
|
+ receiver.setAddress(logisticsPrice.getLp_Add());
|
|
|
+ doPCreateOrderReq.setReceiver(receiver);
|
|
|
+ DoPPackageInfo packageInfo=new DoPPackageInfo();
|
|
|
+ packageInfo.setCargoName(logisticsPrice.getLp_goodsType());
|
|
|
+ packageInfo.setTotalNumber(1);
|
|
|
+ packageInfo.setTotalWeight(logisticsPrice.getLp_Weight());
|
|
|
+ double volume=logisticsPrice.getLp_Volume();
|
|
|
+ if(volume==0){
|
|
|
+ volume=0.001;
|
|
|
+ }else{
|
|
|
+ volume=volume*0.000001;//ERP单位立方厘米 DOP接口单为立方米
|
|
|
+ }
|
|
|
+ packageInfo.setTotalVolume(volume);
|
|
|
+ packageInfo.setDeliveryType("2");
|
|
|
+ doPCreateOrderReq.setPackageInfo(packageInfo);
|
|
|
+ doPCreateOrderReq.setGmtCommit(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ doPCreateOrderReq.setPayType("2");
|
|
|
+ String msgData = FastJsonUtil.toJSONString(doPCreateOrderReq);
|
|
|
+ String timeStamp = SecurityUtil.getTimestamp();
|
|
|
+ String appkey="8626840f067f147f983c499e03e1a873";
|
|
|
+ String digest= SecurityUtil.getDigest(msgData+appkey+timeStamp);
|
|
|
+ params.put("params", msgData);
|
|
|
+ params.put("digest", digest);
|
|
|
+ params.put("timestamp", timeStamp);
|
|
|
+ params.put("companyCode", CLIENT_CODE);
|
|
|
+ System.out.println(msgData);
|
|
|
+ System.out.println("CALL_URL:"+CALL_URL);
|
|
|
+ System.out.println("timeStamp:"+timeStamp);
|
|
|
+ String result = HttpClientUtil.post(CALL_URL, params);
|
|
|
+ System.out.println(result);
|
|
|
+ Map<Object, Object> res = BaseUtil.parseFormStoreToMap(result);
|
|
|
+ /*CreateOrderNotifyResult[logisticID=VYOL2025040020-3,result=true,mailNo=DPK6552872821749,arrivedOrgSimpleName=广东省珠海市,arrivedOutFieldName=,stationNo=,resultCode=1000,reason=成功,exceptionCode=,message=,muchHigherDelivery=,parentMailNo=DPK6552872821749]*/
|
|
|
+ if("true".equals(res.get("result"))){
|
|
|
+ if(StringUtil.hasText(res.get("mailNo"))){
|
|
|
+ retMap.put("success",true);
|
|
|
+ retMap.put("logisticscode",res.get("mailNo"));
|
|
|
+ retMap.put("dockingcode",orderCode);
|
|
|
+ logger.info("creatDOPOrder-S:id {} logisticscode {}",logisticsPrice.getLp_Id(),retMap.get("logisticscode"));
|
|
|
+ return retMap;
|
|
|
+ }else{
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("logisticscode",res.get("mailNo"));
|
|
|
+ retMap.put("dockingcode",orderCode);
|
|
|
+ logger.info("creatDOPOrder-F:id {} result {}",logisticsPrice.getLp_Id(),result);
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("creatDOPOrder-F:id {} result {}",logisticsPrice.getLp_Id(),result);
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","创建失败"+(StringUtil.nvl(e.getMessage(),"")));
|
|
|
+ logger.info("creatDOPOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
}
|
|
|
private Map<String, Object> cancelOrder_DoP(LogisticsPrice logisticsPrice){
|
|
|
- Map<String, Object> modelMap = new HashMap<String, Object>();
|
|
|
+ Map<String, Object> retMap = new HashMap<String, Object>();
|
|
|
logger.info("cancelDOPOrder-Begin");
|
|
|
- return modelMap;
|
|
|
+ try {
|
|
|
+ Object[] obs = baseDao.getFieldsDataByCondition("SZSI_P.DOCK_LOGISTICS_CONFIG A "
|
|
|
+ , new String[]{"CALL_URL","CLIENT_CODE","CHECK_WORD","ENABLE_"}, "LOGISTICS_='DOPTEST' and type_='CANCELORDER' AND A.ENABLE_ = 1");
|
|
|
+ String CALL_URL = obs[0].toString();
|
|
|
+ String CLIENT_CODE = obs[1].toString();
|
|
|
+ String orderCode = logisticsPrice.getLp_DockingCode();
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
+ DoPCancelOrderReq doPCancelOrderReq = new DoPCancelOrderReq();
|
|
|
+ doPCancelOrderReq.setLogisticID("VYOL"+orderCode);
|
|
|
+ doPCancelOrderReq.setMailNo(logisticsPrice.getLp_TrackingNumber());
|
|
|
+ doPCancelOrderReq.setCancelTime(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ doPCancelOrderReq.setRemark("信息有误,撤销订单");
|
|
|
+
|
|
|
+ String msgData = FastJsonUtil.toJSONString(doPCancelOrderReq);
|
|
|
+ String timeStamp = SecurityUtil.getTimestamp();
|
|
|
+ String appkey="8626840f067f147f983c499e03e1a873";
|
|
|
+ String digest= SecurityUtil.getDigest(msgData+appkey+timeStamp);
|
|
|
+ params.put("params", msgData);
|
|
|
+ params.put("digest", digest);
|
|
|
+ params.put("timestamp", timeStamp);
|
|
|
+ params.put("companyCode", CLIENT_CODE);
|
|
|
+ System.out.println(msgData);
|
|
|
+ System.out.println("CALL_URL:"+CALL_URL);
|
|
|
+ System.out.println("timeStamp:"+timeStamp);
|
|
|
+ String result = HttpClientUtil.post(CALL_URL, params);
|
|
|
+ System.out.println(result);
|
|
|
+ Map<Object, Object> res = BaseUtil.parseFormStoreToMap(result);
|
|
|
+ if("true".equals(res.get("result"))){
|
|
|
+ retMap.put("success",true);
|
|
|
+ logger.info("cancelDOPOrder-S:id {} logisticscode {}",logisticsPrice.getLp_Id(),retMap.get("logisticscode"));
|
|
|
+ return retMap;
|
|
|
+ }else{
|
|
|
+ retMap.put("success",false);
|
|
|
+ logger.info("cancelDOPOrder-F:id {} result {}",logisticsPrice.getLp_Id(),result);
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ retMap.put("success",false);
|
|
|
+ retMap.put("message","创建失败"+(StringUtil.nvl(e.getMessage(),"")));
|
|
|
+ logger.info("creatDOPOrder-F:id {} err {}",logisticsPrice.getLp_Id(),retMap.get("message"));
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
}
|
|
|
private Map<String, Object> creatOrder_KY(LogisticsPrice logisticsPrice) throws IOException {
|
|
|
Map<String, Object> modelMap = new HashMap<String, Object>();
|