|
|
@@ -1,12 +1,15 @@
|
|
|
package com.uas.eis.serviceImpl;
|
|
|
|
|
|
|
|
|
+import com.taobao.api.ApiException;
|
|
|
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.request.TradeFullinfoGetRequest;
|
|
|
import com.taobao.api.response.AlibabaAscpLogisticsConsignResendResponse;
|
|
|
import com.taobao.api.response.AlibabaAscpLogisticsOfflineSendResponse;
|
|
|
+import com.taobao.api.response.TradeFullinfoGetResponse;
|
|
|
import com.uas.eis.core.config.SpObserver;
|
|
|
import com.uas.eis.core.config.TaoBaoConfig;
|
|
|
import com.uas.eis.dao.BaseDao;
|
|
|
@@ -96,10 +99,10 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
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 " +
|
|
|
+ " SELECT sd_oid,sd_qty,nvl(sd_yqty,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) " +
|
|
|
+ " group by sd_oid,sd_qty,nvl(sd_yqty,0) " +
|
|
|
" order by min(pd_pdno) " +
|
|
|
") P ");
|
|
|
if (orderDetRowList.hasNext()) {
|
|
|
@@ -108,7 +111,7 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
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 + "'");
|
|
|
+ baseDao.execute("update PRODIODETAIL set pd_dockingstatus='对接成功',pd_dockingerror=NULL where pd_piid = " + id + " and pd_ordercode = '" + ordercode + "'");
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
@@ -212,6 +215,39 @@ public class SaleOutServiceImpl implements SaleOutService {
|
|
|
logger.info(String.format("modifyOrderLogistics-End:master %s id %s", master, id));
|
|
|
return retMap;
|
|
|
}
|
|
|
+/*
|
|
|
+* 订单详情
|
|
|
+* taobao.trade.fullinfo.get
|
|
|
+* https://open.taobao.com/api.htm?docId=54&docType=2
|
|
|
+* */
|
|
|
+ @Override
|
|
|
+ public String getOrderDEtail(String tid) {
|
|
|
+ String sessionKey = "";
|
|
|
+ SqlRowList sessionList = baseDao.queryForRowSet("select tb_code,tb_openuid from sale left join tbauthorization on tb_openuid = SA_TBOPENUID where validflag = 1 and sa_code = '"+tid+"'");
|
|
|
+ if (sessionList.next()) {
|
|
|
+ sessionKey = sessionList.getGeneralString("tb_code");
|
|
|
+ } else {
|
|
|
+ System.out.println("无有效session,请重新授权淘宝店铺");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String url = taoBaoConfig.getServerUrl();
|
|
|
+ String appkey = taoBaoConfig.getAppKey();
|
|
|
+ String secret = taoBaoConfig.getAppSecret();
|
|
|
+ TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
|
|
|
+ TradeFullinfoGetRequest req = new TradeFullinfoGetRequest();
|
|
|
+ req.setFields("tid,type,status,payment,orders");
|
|
|
+ //promotion_details 优惠详情
|
|
|
+ req.setTid(Long.valueOf(tid));
|
|
|
+ req.setIncludeOaid("include_oaid");
|
|
|
+ TradeFullinfoGetResponse rsp = null;
|
|
|
+ try {
|
|
|
+ rsp = client.execute(req, sessionKey);
|
|
|
+ } catch (ApiException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ System.out.println(rsp.getBody());
|
|
|
+ return rsp.getBody();
|
|
|
+ }
|
|
|
|
|
|
private Map<String, Object> sendToTB(Map<String, Object> order , List<Map<String, Object>> orderList) {
|
|
|
Map<String, Object> resMap = new HashMap<>();
|