|
|
@@ -3,13 +3,16 @@ package com.uas.eis.serviceImpl;
|
|
|
|
|
|
import com.taobao.api.DefaultTaobaoClient;
|
|
|
import com.taobao.api.TaobaoClient;
|
|
|
+import com.taobao.api.request.AlibabaAscpLogisticsConsignResendRequest;
|
|
|
import com.taobao.api.request.AlibabaAscpLogisticsOfflineSendRequest;
|
|
|
+import com.taobao.api.response.AlibabaAscpLogisticsConsignResendResponse;
|
|
|
import com.taobao.api.response.AlibabaAscpLogisticsOfflineSendResponse;
|
|
|
import com.uas.eis.core.config.SpObserver;
|
|
|
import com.uas.eis.core.config.TaoBaoConfig;
|
|
|
import com.uas.eis.dao.BaseDao;
|
|
|
import com.uas.eis.dao.SqlRowList;
|
|
|
import com.uas.eis.service.SaleOutService;
|
|
|
+import com.uas.eis.utils.NumberUtil;
|
|
|
import com.uas.eis.utils.StringUtil;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -31,7 +34,7 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
* https://open.taobao.com/api.htm?docId=54934&docType=2&scopeId=23401
|
|
|
* */
|
|
|
@Override
|
|
|
- public Map<String, Object> orderSend(String master, Integer id) {
|
|
|
+ public Map<String, Object> orderSend(String master, Integer id,String emCode) {
|
|
|
Map<String, Object> retMap = new HashMap<String, Object>();
|
|
|
retMap.put("success", true);
|
|
|
logger.info(String.format("orderSend-Begin:master %s id %s", master, id));
|
|
|
@@ -77,25 +80,50 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
retMap.put("message", "无有效session,请重新授权淘宝店铺");
|
|
|
return retMap;
|
|
|
}
|
|
|
- SqlRowList orderRowList = baseDao.queryForRowSet("SELECT p.* FROM ( " +
|
|
|
- " SELECT pd_dockingstatus,pd_ordercode,pd_orderdetno,sd_oid,sa_tbopenuid " +
|
|
|
- " ,sum(pd_outqty) pd_outqty " +
|
|
|
+ StringBuffer errorMsg = new StringBuffer();
|
|
|
+ SqlRowList orderRowList = baseDao.queryForRowSet(" SELECT pd_ordercode,sa_tbopenuid " +
|
|
|
" FROM PRODIODETAIL LEFT JOIN SALE ON SA_CODE = PD_ORDERCODE left join saledetail on sd_code = pd_ordercode and sd_detno = pd_orderdetno " +
|
|
|
" WHERE pd_piid = " + id + " AND SA_REMARK = '淘宝自动抓取' and SA_TBOPENUID is not null and SD_OID>0 and nvl(pd_dockingstatus,' ') <> '对接成功' " +
|
|
|
- " group by pd_dockingstatus,pd_ordercode,pd_orderdetno,sd_oid,sa_tbopenuid " +
|
|
|
- " order by min(pd_pdno) " +
|
|
|
- ") P ");
|
|
|
- if (orderRowList.hasNext()) {
|
|
|
- List<Map<String, Object>> orderList = orderRowList.getResultList();
|
|
|
- for (Map<String, Object> orderMap : orderList) {
|
|
|
- //TODO 发起对接
|
|
|
- baseDao.execute("update PRODIODETAIL set pd_dockingstatus='对接成功' where pd_piid = " + id + " and pd_ordercode = '" + orderMap.get("pd_ordercode") + "' and pd_orderdetno = " + orderMap.get("pd_orderdetno"));
|
|
|
+ " group by pd_ordercode,sa_tbopenuid " +
|
|
|
+ " order by min(pd_pdno) ");
|
|
|
+ if(orderRowList.hasNext()){
|
|
|
+ for (int i = 0; i < orderRowList.getResultList().size(); i++) {
|
|
|
+ Map<String, Object> order = orderRowList.getResultList().get(i);
|
|
|
+ String ordercode = order.get("pd_ordercode").toString();
|
|
|
+ String tbopenuid = order.get("sa_tbopenuid").toString();
|
|
|
+ order.put("pi_logisticscode",piMsg.getGeneralString("pi_logisticscode"));
|
|
|
+ order.put("cop_code",StringUtil.nvl(piMsg.getGeneralString("cop_code"),"OTHER"));
|
|
|
+ order.put("piid",id);
|
|
|
+ order.put("sessionKey",sessionMap.get(tbopenuid));
|
|
|
+ SqlRowList orderDetRowList = baseDao.queryForRowSet("SELECT p.* FROM ( " +
|
|
|
+ " SELECT sd_oid,sd_qty,nvl(sd_sendqty,0) sendqty,sum(pd_outqty) pd_outqty " +
|
|
|
+ " FROM PRODIODETAIL left join saledetail on sd_code = pd_ordercode and sd_detno = pd_orderdetno " +
|
|
|
+ " WHERE pd_piid = " + id + " and pd_ordercode ='"+ordercode+"' and SD_OID>0 and nvl(pd_dockingstatus,' ') <> '对接成功' " +
|
|
|
+ " group by sd_oid,sd_qty,nvl(sd_sendqty,0) " +
|
|
|
+ " order by min(pd_pdno) " +
|
|
|
+ ") P ");
|
|
|
+ if (orderDetRowList.hasNext()) {
|
|
|
+ Map<String, Object> sendRes = sendToTB(order, orderDetRowList.getResultList());
|
|
|
+ if(!(Boolean) sendRes.get("success")){
|
|
|
+ errorMsg.append("订单号:").append(ordercode).append(",失败原因: ").append(sendRes.get("message"));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ baseDao.execute("update PRODIODETAIL set pd_dockingstatus='对接成功' where pd_piid = " + id + " and pd_ordercode = '" + ordercode + "'");
|
|
|
+ }
|
|
|
}
|
|
|
+ }else {
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", "无可对接订单。");
|
|
|
+ return retMap;
|
|
|
}
|
|
|
baseDao.execute("update PRODINOUT set pi_dockingstatus='对接失败' where pi_id = " + id + " and exists (select 1 from PRODIODETAIL where pd_piid = pi_id and nvl(pd_dockingstatus,' ')='对接失败') ");
|
|
|
baseDao.execute("update PRODINOUT set pi_dockingstatus='已对接' where pi_id = " + id +
|
|
|
" and exists (select 1 from PRODIODETAIL LEFT JOIN SALE ON sa_code = pd_ordercode left join saledetail on sd_code = pd_ordercode and sd_detno = pd_orderdetno where pd_piid = pi_id AND SA_REMARK = '淘宝自动抓取' and SA_TBOPENUID is not null and SD_OID>0 ) " +
|
|
|
" and not exists (select 1 from PRODIODETAIL LEFT JOIN SALE ON sa_code = pd_ordercode left join saledetail on sd_code = pd_ordercode and sd_detno = pd_orderdetno where pd_piid = pi_id AND SA_REMARK = '淘宝自动抓取' and SA_TBOPENUID is not null and SD_OID>0 and nvl(pd_dockingstatus,' ') <> '对接成功' )");
|
|
|
+ if(errorMsg.length()>0){
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", errorMsg.toString());
|
|
|
+ }
|
|
|
logger.info(String.format("orderSend-End:master %s id %s", master, id));
|
|
|
return retMap;
|
|
|
}
|
|
|
@@ -106,12 +134,12 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
* https://open.taobao.com/api.htm?docId=65697&docType=2&scopeId=23401
|
|
|
* */
|
|
|
@Override
|
|
|
- public Map<String, Object> modifyOrderLogistics(String master, Integer id) {
|
|
|
+ public Map<String, Object> modifyOrderLogistics(String master, Integer id,String emCode) {
|
|
|
Map<String, Object> retMap = new HashMap<String, Object>();
|
|
|
retMap.put("success", true);
|
|
|
logger.info(String.format("modifyOrderLogistics-Begin:master %s id %s", master, id));
|
|
|
SpObserver.putSp(master);
|
|
|
- SqlRowList piMsg = baseDao.queryForRowSet("select pi_id,pi_inoutno,pi_logisticscompany,pi_logisticscode,pi_dockingstatus from PRODINOUT where pi_id = " + id + " and PI_CLASS = '出货单' ");
|
|
|
+ SqlRowList piMsg = baseDao.queryForRowSet("select pi_id,pi_inoutno,pi_logisticscompany,pi_logisticscode,pi_dockingstatus,cop_code, cop_name from PRODINOUT LEFT JOIN tb_logistics ON COP_NAME = pi_logisticscompany where pi_id = " + id + " and PI_CLASS = '出货单'");
|
|
|
if (!piMsg.next()) {
|
|
|
retMap.put("success", false);
|
|
|
retMap.put("message", "单据不存在");
|
|
|
@@ -129,7 +157,7 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
}
|
|
|
SqlRowList checkOrder = baseDao.queryForRowSet("select wm_concat(pd_ordercode) ordercode from (" +
|
|
|
" select PD_ORDERCODE from PRODIODETAIL LEFT JOIN SALE ON SA_CODE = PD_ORDERCODE left join saledetail on sd_code = pd_ordercode and sd_detno = pd_orderdetno " +
|
|
|
- " where pd_piid = " + id + " AND SA_REMARK = '淘宝自动抓取' and SA_TBOPENUID is not null and SD_OID>0 and nvl(pd_dockingstatus,' ') <> '对接成功' and not exists (select 1 from tbauthorization where tb_openuid = SA_TBOPENUID and validflag = 1 " +
|
|
|
+ " where pd_piid = " + id + " AND SA_REMARK = '淘宝自动抓取' and SA_TBOPENUID is not null and SD_OID>0 and nvl(pd_dockingstatus,' ') = '对接成功' and not exists (select 1 from tbauthorization where tb_openuid = SA_TBOPENUID and validflag = 1 " +
|
|
|
" group by PD_ORDERCODE))");
|
|
|
if (checkOrder.next() && StringUtil.hasText(checkOrder.getGeneralString("ordercode"))) {
|
|
|
retMap.put("success", false);
|
|
|
@@ -147,48 +175,163 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
retMap.put("message", "无有效session,请重新授权淘宝店铺");
|
|
|
return retMap;
|
|
|
}
|
|
|
+ StringBuffer errorMsg = new StringBuffer();
|
|
|
+ SqlRowList orderRowList = baseDao.queryForRowSet(" SELECT pd_ordercode,sa_tbopenuid,wm_concat(sd_oid) oids " +
|
|
|
+ " FROM PRODIODETAIL LEFT JOIN SALE ON SA_CODE = PD_ORDERCODE left join saledetail on sd_code = pd_ordercode and sd_detno = pd_orderdetno " +
|
|
|
+ " WHERE pd_piid = " + id + " AND SA_REMARK = '淘宝自动抓取' and SA_TBOPENUID is not null and SD_OID>0 and nvl(pd_dockingstatus,' ') = '对接成功' " +
|
|
|
+ " group by pd_ordercode,sa_tbopenuid " +
|
|
|
+ " order by min(pd_pdno) ");
|
|
|
+ if(orderRowList.hasNext()){
|
|
|
+ for (int i = 0; i < orderRowList.getResultList().size(); i++) {
|
|
|
+ Map<String, Object> order = orderRowList.getResultList().get(i);
|
|
|
+ String ordercode = order.get("pd_ordercode").toString();
|
|
|
+ String tbopenuid = order.get("sa_tbopenuid").toString();
|
|
|
+ order.put("pi_logisticscode",piMsg.getGeneralString("pi_logisticscode"));
|
|
|
+ order.put("cop_code",StringUtil.nvl(piMsg.getGeneralString("cop_code"),"OTHER"));
|
|
|
+ order.put("pi_logisticscompany",piMsg.getGeneralString("pi_logisticscompany"));
|
|
|
+ order.put("piid",id);
|
|
|
+ order.put("piinoutno",piMsg.getGeneralString("pi_inoutno"));
|
|
|
+ order.put("sessionKey",sessionMap.get(tbopenuid));
|
|
|
+ order.put("oids",order.get("oids").toString());
|
|
|
+ order.put("emCode",emCode);
|
|
|
+ Map<String, Object> sendRes = consign_resend(order);
|
|
|
+ if(!(Boolean) sendRes.get("success")){
|
|
|
+ errorMsg.append("订单号:").append(ordercode).append(",失败原因: ").append(sendRes.get("message"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", "无可对接订单。");
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ if(errorMsg.length()>0){
|
|
|
+ retMap.put("success", false);
|
|
|
+ retMap.put("message", errorMsg.toString());
|
|
|
+ }
|
|
|
logger.info(String.format("modifyOrderLogistics-End:master %s id %s", master, id));
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
|
- private void sendToTB() {
|
|
|
- String sessionKey = "";
|
|
|
+ private Map<String, Object> sendToTB(Map<String, Object> order , List<Map<String, Object>> orderList) {
|
|
|
+ Map<String, Object> resMap = new HashMap<>();
|
|
|
+ resMap.put("success", true);
|
|
|
+ String ordercode = order.get("pd_ordercode").toString();
|
|
|
+ Integer piid=Integer.valueOf(order.get("piid").toString());
|
|
|
+ String sessionKey = order.get("sessionKey").toString();
|
|
|
+ String cop_code = order.get("cop_code").toString();
|
|
|
+ String outSid = order.get("pi_logisticscode").toString();
|
|
|
+
|
|
|
TaobaoClient client = new DefaultTaobaoClient(taoBaoConfig.getServerUrl(), taoBaoConfig.getAppKey(), taoBaoConfig.getAppSecret());
|
|
|
AlibabaAscpLogisticsOfflineSendRequest req = new AlibabaAscpLogisticsOfflineSendRequest();
|
|
|
- req.setSenderId(123456L);
|
|
|
- req.setFeature("identCode=tid:aaa,bbb;machineCode=tid2:aaa;retailStoreId=12345;retailStoreType=STORE;instantMobilePhoneNumber=12345678910");
|
|
|
- req.setTid("123");
|
|
|
- req.setSubTid("1,2,3");
|
|
|
- List<AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest> list2 = new ArrayList<AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest>();
|
|
|
- AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest obj3 = new AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest();
|
|
|
- list2.add(obj3);
|
|
|
- obj3.setOutSid("123455");
|
|
|
- obj3.setCompanyCode("POST");
|
|
|
- List<AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest> list6 = new ArrayList<AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest>();
|
|
|
- AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest obj7 = new AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest();
|
|
|
- list6.add(obj7);
|
|
|
- obj7.setSubTid("11111");
|
|
|
- obj7.setCompItemId("100001");
|
|
|
- obj7.setCompSkuId("100002");
|
|
|
- obj7.setItemType(0L);
|
|
|
- obj7.setNum(1L);
|
|
|
-// list4.setGoods(list6);
|
|
|
- obj3.setSubOutSid("11112");
|
|
|
- req.setConsignPkgs(list2);
|
|
|
- req.setCancelId(123456L);
|
|
|
- AlibabaAscpLogisticsOfflineSendRequest.ConsignStatusRequest obj8 = new AlibabaAscpLogisticsOfflineSendRequest.ConsignStatusRequest();
|
|
|
- obj8.setSubTid("12345678");
|
|
|
- obj8.setIsPartConsign(true);
|
|
|
- List<AlibabaAscpLogisticsOfflineSendRequest.ConsignStatusRequest> consignStatus = new ArrayList<>();
|
|
|
- consignStatus.add(obj8);
|
|
|
- req.setConsignStatus(consignStatus);
|
|
|
- req.setConsignType(1L);
|
|
|
+// req.setSenderId(123456L);
|
|
|
+// req.setFeature("identCode=tid:aaa,bbb;machineCode=tid2:aaa;retailStoreId=12345;retailStoreType=STORE;instantMobilePhoneNumber=12345678910");
|
|
|
+ req.setTid(ordercode);
|
|
|
+// req.setSubTid("1,2,3");//发货的子订单id列表(consign_type = 1、2、3 时不再使用次字段,使用新字段goods代替需要发货的子订单信息)
|
|
|
+ req.setConsignType(1L);// 发货类型 0:普通发货(老链路) 1: 普通发货(新链路,支持子订单部分发货、成分品发货以及ERP线下赠品发货) 2: 将发货状态从"部分发"修改为"全部发" 3:补发;默认为0
|
|
|
+ //包裹信息
|
|
|
+ List<AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest> consign_pkgs = new ArrayList<AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest>();
|
|
|
+ AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest consign_pkg = new AlibabaAscpLogisticsOfflineSendRequest.TopConsignPkgRequest();
|
|
|
+ consign_pkg.setOutSid(outSid);//运单号.具体一个物流公司的真实运单号码。淘宝官方物流会校验,请谨慎传入
|
|
|
+ consign_pkg.setCompanyCode(cop_code);//物流公司代码.如"POST"就代表中国邮政,"ZJS"就代表宅急送.调用 taobao.logistics.companies.get 获取
|
|
|
+ /*goods 包裹中商品信息*/
|
|
|
+ List<AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest> goods = new ArrayList<AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest>();
|
|
|
+ for (int i = 0; i < orderList.size(); i++) {
|
|
|
+ Map<String, Object> orderSub = orderList.get(i);
|
|
|
+ AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest good = new AlibabaAscpLogisticsOfflineSendRequest.TopConsignGoodsRequest();
|
|
|
+ good.setSubTid(orderSub.get("sd_oid").toString());//子订单id
|
|
|
+// good.setCompItemId("100001");//成分品itemId
|
|
|
+// good.setCompSkuId("100002");//成分品skuId
|
|
|
+ good.setItemType(0L);//品类型 0:标品/平台赠品,1:ERP线下赠品、2:成分品,默认为0
|
|
|
+ good.setNum(Long.valueOf(orderSub.get("pd_outqty").toString()));//商品数量,不传默认为子单上的商品数量;支持不传,但不能传0或负值
|
|
|
+ goods.add(good);
|
|
|
+ }
|
|
|
+ consign_pkg.setGoods(goods);
|
|
|
+// consign_pkg.setSubOutSid("11112");//快递子单运单号
|
|
|
+ consign_pkgs.add(consign_pkg);
|
|
|
+ req.setConsignPkgs(consign_pkgs);
|
|
|
+// req.setCancelId(123456L);//卖家联系人地址库ID,可以通过taobao.logistics.address.search接口查询到地址库ID。 如果为空,取的卖家的默认退货地址
|
|
|
+ /* 子订单发货状态 */
|
|
|
+ List<AlibabaAscpLogisticsOfflineSendRequest.ConsignStatusRequest> consign_status_List = new ArrayList<>();
|
|
|
+ for (int i = 0; i < orderList.size(); i++) {
|
|
|
+ Map<String, Object> orderSub = orderList.get(i);
|
|
|
+ AlibabaAscpLogisticsOfflineSendRequest.ConsignStatusRequest consignStatus = new AlibabaAscpLogisticsOfflineSendRequest.ConsignStatusRequest();
|
|
|
+ consignStatus.setSubTid(orderSub.get("sd_oid").toString());
|
|
|
+ boolean IsPartConsign = true;
|
|
|
+ if(NumberUtil.compare(Double.valueOf(orderSub.get("sendqty").toString()),Double.valueOf(orderSub.get("sd_qty").toString())) >= 0){
|
|
|
+ IsPartConsign = false;
|
|
|
+ }
|
|
|
+ consignStatus.setIsPartConsign(IsPartConsign);//子订单是否部分发货,true:部分发货;false:全部发货;周期购、分销订单不支持部分发货
|
|
|
+ consign_status_List.add(consignStatus);
|
|
|
+ }
|
|
|
+ req.setConsignStatus(consign_status_List);
|
|
|
AlibabaAscpLogisticsOfflineSendResponse rsp = null;
|
|
|
try {
|
|
|
rsp = client.execute(req, sessionKey);
|
|
|
+ System.out.println(rsp.getBody());
|
|
|
+ if(rsp.getResult()!=null&&rsp.getResult().getSuccess()){
|
|
|
+ baseDao.execute("update PRODIODETAIL set pd_dockingstatus='对接成功' where pd_piid = " + piid + " and pd_ordercode = '" + ordercode + "' ");
|
|
|
+ }else {
|
|
|
+ String errMsg = StringUtil.nvl(rsp.getSubCode(),rsp.getErrorCode())+":"+StringUtil.nvl(rsp.getSubMsg(),rsp.getMsg());
|
|
|
+ baseDao.execute("update PRODIODETAIL set pd_dockingstatus='对接失败',pd_dockingerror='"+errMsg+"' where pd_piid = " + piid + " and pd_ordercode = '" + ordercode + "' ");
|
|
|
+ logger.info("淘宝订单发送失败," + errMsg);
|
|
|
+ resMap.put("success", false);
|
|
|
+ resMap.put("message",errMsg);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.info("淘宝订单发送失败," + e.getMessage());
|
|
|
+ resMap.put("success", false);
|
|
|
+ resMap.put("message","淘宝订单发送失败,"+e.getMessage());
|
|
|
+ }
|
|
|
+ return resMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * alibaba.ascp.logistics.consign.resend( 修改物流公司和运单号 )
|
|
|
+ * https://open.taobao.com/api.htm?docId=54935&docType=2&scopeId=23401
|
|
|
+ */
|
|
|
+ private Map<String,Object>consign_resend(Map<String, Object> order) {
|
|
|
+ Map<String, Object> resMap = new HashMap<>();
|
|
|
+ resMap.put("success", true);
|
|
|
+ String ordercode = order.get("pd_ordercode").toString();
|
|
|
+ Integer piid=Integer.valueOf(order.get("piid").toString());
|
|
|
+ String piinoutno = order.get("piinoutno").toString();
|
|
|
+ String sessionKey = order.get("sessionKey").toString();
|
|
|
+ String cop_code = order.get("cop_code").toString();
|
|
|
+ String pi_logisticscompany = order.get("pi_logisticscompany").toString();
|
|
|
+ String outSid = order.get("pi_logisticscode").toString();
|
|
|
+ String emCode = order.get("emCode").toString();
|
|
|
+
|
|
|
+ TaobaoClient client = new DefaultTaobaoClient(taoBaoConfig.getServerUrl(), taoBaoConfig.getAppKey(), taoBaoConfig.getAppSecret());
|
|
|
+ AlibabaAscpLogisticsConsignResendRequest req = new AlibabaAscpLogisticsConsignResendRequest();
|
|
|
+ req.setTid(ordercode);
|
|
|
+ req.setSubTids(order.get("oids").toString());
|
|
|
+ List<AlibabaAscpLogisticsConsignResendRequest.TopConsignPkgRequest> consign_pkgs = new ArrayList<AlibabaAscpLogisticsConsignResendRequest.TopConsignPkgRequest>();
|
|
|
+ AlibabaAscpLogisticsConsignResendRequest.TopConsignPkgRequest consign_pkg = new AlibabaAscpLogisticsConsignResendRequest.TopConsignPkgRequest();
|
|
|
+ consign_pkg.setCompanyCode(cop_code);//物流公司代码.如"POST"代表中国邮政,"ZJS"代表宅急送。调用 taobao.logistics.companies.get 获取
|
|
|
+ consign_pkg.setOutSid(outSid);//运单号.具体一个物流公司的真实运单号码。淘宝官方物流会校验,请谨慎传入
|
|
|
+ consign_pkgs.add(consign_pkg);
|
|
|
+ req.setConsignPkgs(consign_pkgs);
|
|
|
+// req.setFeature("instantMobilePhoneNumber=12345678910");
|
|
|
+ try {
|
|
|
+ AlibabaAscpLogisticsConsignResendResponse rsp = client.execute(req, sessionKey);
|
|
|
+ System.out.println(rsp.getBody());
|
|
|
+ if(rsp.getResult()!=null&&rsp.getResult().getSuccess()){
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ " SELECT MESSAGELOG_seq.nextval,sysdate,nVL(EM_NAME,'管理员')||'('||EMCODE||')','变更淘宝物流单号','变更成功,订单号:"+ordercode+",物流公司:"+pi_logisticscompany+",物流单号:"+outSid+"','ProdInOut!Sale|pi_id="+piid+"','"+piinoutno+"'" +
|
|
|
+ " from (SELECT '"+emCode+"' EMCODE FROM DUAL) LEFT JOIN EMPLOYEE ON EM_CODE = EMCODE ");
|
|
|
+ }else {
|
|
|
+ String errMsg = StringUtil.nvl(rsp.getSubCode(),rsp.getErrorCode())+":"+StringUtil.nvl(rsp.getSubMsg(),rsp.getMsg());
|
|
|
+ logger.info("变更淘宝物流单号失败," + errMsg);
|
|
|
+ resMap.put("success", false);
|
|
|
+ resMap.put("message",errMsg);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
- logger.info("淘宝返回敏感信息失败," + e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.info("变更淘宝物流单号失败," + e.getMessage());
|
|
|
+ resMap.put("success", false);
|
|
|
+ resMap.put("message","变更淘宝物流单号失败,"+e.getMessage());
|
|
|
}
|
|
|
- System.out.println(rsp.getBody());
|
|
|
+ return resMap;
|
|
|
}
|
|
|
}
|