|
@@ -37,9 +37,14 @@ import com.iamberry.rst.util.JingdongConfig;
|
|
|
import com.iamberry.rst.util.PageUtil;
|
|
|
import com.iamberry.rst.util.TaobaoConfig;
|
|
|
import com.iamberry.wechat.tools.DateTimeUtil;
|
|
|
+import com.iamberry.wechat.tools.HttpClient431Util;
|
|
|
+import com.iamberry.wechat.tools.payUtil.StringUtil;
|
|
|
import com.jd.open.api.sdk.DefaultJdClient;
|
|
|
import com.jd.open.api.sdk.JdClient;
|
|
|
import com.jd.open.api.sdk.JdException;
|
|
|
+import com.jd.open.api.sdk.domain.order.OrderQueryJsfService.response.enGet.OrderSearchInfo;
|
|
|
+import com.jd.open.api.sdk.domain.order.OrderShipmentService.response.shipment.OperatorResult;
|
|
|
+import com.jd.open.api.sdk.internal.util.HttpUtil;
|
|
|
import com.jd.open.api.sdk.request.order.PopOrderShipmentRequest;
|
|
|
import com.jd.open.api.sdk.response.order.PopOrderShipmentResponse;
|
|
|
import com.taobao.api.ApiException;
|
|
@@ -49,10 +54,12 @@ import com.taobao.api.request.AlibabaAscpLogisticsOfflineSendRequest;
|
|
|
import com.taobao.api.response.AlibabaAscpLogisticsOfflineSendResponse;
|
|
|
import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
+import org.apache.http.HttpEntity;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
@@ -110,6 +117,9 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
|
@Autowired
|
|
|
private SysConfigService sysConfigService;
|
|
|
|
|
|
+ @Value("${jingdong.order.domain}")
|
|
|
+ private String jdOrderDomain;
|
|
|
+
|
|
|
/**
|
|
|
* 缓存订单项的前缀
|
|
|
*/
|
|
@@ -2263,15 +2273,35 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
|
}
|
|
|
//京东订单发货
|
|
|
if (salesOrder.getSalesBatchId().startsWith("JT")) {
|
|
|
- SysConfig sysConfigAll = sysConfigService.getSysConfigAll(27);
|
|
|
- JdClient client = new DefaultJdClient(JingdongConfig.JINGDONG_API_URL, sysConfigAll.getConfigParameter(), JingdongConfig.jd_appkey, JingdongConfig.jd_secret);
|
|
|
- PopOrderShipmentRequest req = new PopOrderShipmentRequest();
|
|
|
- req.setOrderId(Long.parseLong(salesOrder.getSalesOrderId()));
|
|
|
- req.setLogiCoprId(salesOrder.getSalesPostFirm());
|
|
|
- req.setLogiNo(o.getSalesPostNum());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// SysConfig sysConfigAll = sysConfigService.getSysConfigAll(27);
|
|
|
+// JdClient client = new DefaultJdClient(JingdongConfig.JINGDONG_API_URL, sysConfigAll.getConfigParameter(), JingdongConfig.jd_appkey, JingdongConfig.jd_secret);
|
|
|
+// PopOrderShipmentRequest req = new PopOrderShipmentRequest();
|
|
|
+// req.setOrderId(Long.parseLong(salesOrder.getSalesOrderId()));
|
|
|
+// req.setLogiCoprId(salesOrder.getSalesPostFirm());
|
|
|
+// req.setLogiNo(o.getSalesPostNum());
|
|
|
try {
|
|
|
- PopOrderShipmentResponse rsp = client.execute(req);
|
|
|
- logger.info("京东订单发货回录:code:{}, msg:{}", rsp.getCode(), rsp.getMsg());
|
|
|
+// PopOrderShipmentResponse rsp = client.execute(req);
|
|
|
+// logger.info("京东订单发货回录:code:{}, msg:{}", rsp.getCode(), rsp.getMsg());
|
|
|
+
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("orderId", salesOrder.getSalesOrderId());
|
|
|
+ params.put("logiCoprId", salesOrder.getSalesPostFirm());
|
|
|
+ params.put("logiNo", o.getSalesPostNum());
|
|
|
+ String result = HttpClient431Util.doPost(params, jdOrderDomain + "/jingdong/orderShipment");
|
|
|
+ if (StringUtil.isNotEmpty(result)) {
|
|
|
+ OperatorResult operatorResult = com.alibaba.fastjson.JSONObject.parseObject(result, OperatorResult.class);
|
|
|
+ if (operatorResult.getSuccess()) {
|
|
|
+ logger.info("京东发货回传请求成功:result=SUCCESS:{}, MSG:{}", operatorResult.getSuccess(), operatorResult.getChineseErrCode());
|
|
|
+ } else {
|
|
|
+ logger.info("京东发货回传请求失败:result=SUCCESS:{}, MSG:{}", operatorResult.getSuccess(), operatorResult.getChineseErrCode());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ logger.info("京东发货回传请求错误:{}", result);
|
|
|
+ }
|
|
|
+
|
|
|
} catch (JdException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
} catch (Exception e) {
|
|
@@ -2288,6 +2318,9 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
|
return list.size();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<SalesOrder> testListSalesOrder() {
|
|
|
List<SalesOrder> orders = salesOrderMapper.testListSalesOrder();
|