|
|
@@ -19,6 +19,7 @@ import com.lop.open.api.sdk.response.ECAP.EcapV1OrdersCancelLopResponse;
|
|
|
import com.lop.open.api.sdk.response.ECAP.EcapV1OrdersCreateLopResponse;
|
|
|
import com.lop.open.api.sdk.response.ECAP.EcapV1OrdersModifyLopResponse;
|
|
|
import com.lop.open.api.sdk.response.ECAP.EcapV1OrdersPrecheckLopResponse;
|
|
|
+import com.ruoyi.common.core.exception.ServiceException;
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
import com.ruoyi.logistics.config.JDExpressConfig;
|
|
|
@@ -90,10 +91,17 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
log.info("京东开放平台订单预校验接口,请求参数:{}", request);
|
|
|
EcapV1OrdersPrecheckLopResponse response = client.execute(request);
|
|
|
log.info("京东开放平台订单预校验接口,响应结果:{}", response);
|
|
|
+
|
|
|
+ if (response.getCode().equals("0")) {
|
|
|
+ result.put("success", true);
|
|
|
+ result.put("msg", "");
|
|
|
+ } else {
|
|
|
+ result.put("success", false);
|
|
|
+ result.put("msg", "京东开放平台订单预校验!失败原因:" + response.getMsg());
|
|
|
+ }
|
|
|
} catch (LopException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error("京东开放平台订单预校验接口异常:{}", e);
|
|
|
+ throw new ServiceException("京东开放平台订单预校验接口异常");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -157,10 +165,17 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
log.info("京东开放平台下单接口,请求参数:{}", request);
|
|
|
EcapV1OrdersCreateLopResponse response = client.execute(request);
|
|
|
log.info("京东开放平台下单接口,响应结果:{}", response);
|
|
|
+
|
|
|
+ if (response.getCode().equals("0")) {
|
|
|
+ result.put("success", true);
|
|
|
+ result.put("msg", "");
|
|
|
+ } else {
|
|
|
+ result.put("success", false);
|
|
|
+ result.put("msg", "京东开放平台下单!失败原因:" + response.getMsg());
|
|
|
+ }
|
|
|
} catch (LopException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error("京东开放平台下单接口异常:{}", e);
|
|
|
+ throw new ServiceException("京东开放平台下单接口异常");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -197,10 +212,17 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
log.info("京东开放平台取消订单接口,请求参数:{}", request);
|
|
|
EcapV1OrdersCancelLopResponse response = client.execute(request);
|
|
|
log.info("京东开放平台取消订单接口,响应结果:{}", response);
|
|
|
+
|
|
|
+ if (response.getCode().equals("0")) {
|
|
|
+ result.put("success", true);
|
|
|
+ result.put("msg", "");
|
|
|
+ } else {
|
|
|
+ result.put("success", false);
|
|
|
+ result.put("msg", "京东开放平台取消订单!失败原因:" + response.getMsg());
|
|
|
+ }
|
|
|
} catch (LopException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error("京东开放平台取消订单接口异常:{}", e);
|
|
|
+ throw new ServiceException("京东开放平台取消订单接口异常");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -247,6 +269,12 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
cargoInfo.setVolume(bizWaybillOrder.getGoodsVolume());
|
|
|
cargoes.add(cargoInfo);
|
|
|
|
|
|
+ //扩展信息
|
|
|
+ Map<String, String> extendProps = new HashMap<>();
|
|
|
+ extendProps.put("autoSubscribe", "1");
|
|
|
+ extendProps.put("universalFeePush", "1");
|
|
|
+
|
|
|
+ requestDTO.setExtendProps(extendProps);
|
|
|
requestDTO.setCargoes(cargoes);
|
|
|
requestDTO.setProductsReq(productInfo);
|
|
|
requestDTO.setReceiverContact(receiverContact);
|
|
|
@@ -261,10 +289,17 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
log.info("京东开放平台修改订单接口,请求参数:{}", request);
|
|
|
EcapV1OrdersModifyLopResponse response = client.execute(request);
|
|
|
log.info("京东开放平台修改订单接口,响应结果:{}", response);
|
|
|
+
|
|
|
+ if (response.getCode().equals("0")) {
|
|
|
+ result.put("success", true);
|
|
|
+ result.put("msg", "");
|
|
|
+ } else {
|
|
|
+ result.put("success", false);
|
|
|
+ result.put("msg", "京东开放平台修改订单!失败原因:" + response.getMsg());
|
|
|
+ }
|
|
|
} catch (LopException e) {
|
|
|
- e.printStackTrace();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ log.error("京东开放平台修改订单接口异常:{}", e);
|
|
|
+ throw new ServiceException("京东开放平台修改订单接口异常");
|
|
|
}
|
|
|
return result;
|
|
|
}
|