|
@@ -10,6 +10,7 @@ import com.lop.open.api.sdk.domain.ECAP.CommonCreateOrderApi.commonCheckPreCreat
|
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonCreateOrderApi.commonCheckPreCreateOrderV1.Contact;
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonCreateOrderApi.commonCheckPreCreateOrderV1.Contact;
|
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonCreateOrderApi.commonCreateOrderV1.CommonCargoInfo;
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonCreateOrderApi.commonCreateOrderV1.CommonCargoInfo;
|
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonModifyCancelOrderApi.commonCancelOrderV1.CommonOrderCancelRequest;
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonModifyCancelOrderApi.commonCancelOrderV1.CommonOrderCancelRequest;
|
|
|
|
|
+import com.lop.open.api.sdk.domain.ECAP.CommonQueryOrderApi.commonGetActualFeeInfoV1.CommonActualFeeRequest;
|
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonQueryOrderApi.commonGetOrderByMonthSettleQRV1.CommonMonthSettleQRQueryRequest;
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonQueryOrderApi.commonGetOrderByMonthSettleQRV1.CommonMonthSettleQRQueryRequest;
|
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonQueryOrderApi.commonGetOrderInfoV1.CommonOrderInfoRequest;
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonQueryOrderApi.commonGetOrderInfoV1.CommonOrderInfoRequest;
|
|
|
import com.lop.open.api.sdk.plugin.LopPlugin;
|
|
import com.lop.open.api.sdk.plugin.LopPlugin;
|
|
@@ -19,10 +20,12 @@ import com.lop.open.api.sdk.response.ECAP.*;
|
|
|
import com.ruoyi.common.core.exception.ServiceException;
|
|
import com.ruoyi.common.core.exception.ServiceException;
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
|
+import com.ruoyi.common.core.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.logistics.config.JDExpressConfig;
|
|
import com.ruoyi.logistics.config.JDExpressConfig;
|
|
|
import com.ruoyi.logistics.constant.JDDictConstants;
|
|
import com.ruoyi.logistics.constant.JDDictConstants;
|
|
|
import com.ruoyi.logistics.constant.SysConfigConstants;
|
|
import com.ruoyi.logistics.constant.SysConfigConstants;
|
|
|
import com.ruoyi.logistics.domain.BizWaybillOrder;
|
|
import com.ruoyi.logistics.domain.BizWaybillOrder;
|
|
|
|
|
+import com.ruoyi.logistics.response.CommonOrderInfoResponse;
|
|
|
import com.ruoyi.logistics.service.LogisticsService;
|
|
import com.ruoyi.logistics.service.LogisticsService;
|
|
|
import com.ruoyi.system.service.ISysConfigService;
|
|
import com.ruoyi.system.service.ISysConfigService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -544,7 +547,7 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public JSONObject queryOrderByQRCode(String qrCode) {
|
|
public JSONObject queryOrderByQRCode(String qrCode) {
|
|
|
- log.info("京东开放平台根据二维码查询运单接口,入参:{}", qrCode);
|
|
|
|
|
|
|
+ log.info("京东开放平台根据二维码查询运单号接口,入参:{}", qrCode);
|
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
|
try {
|
|
try {
|
|
|
//设置接口域名(有的对接方案同时支持生产和沙箱环境,有的仅支持生产,具体以对接方案中的【API文档-请求地址】为准),生产域名:https://api.jdl.com 预发环境域名:https://uat-api.jdl.com
|
|
//设置接口域名(有的对接方案同时支持生产和沙箱环境,有的仅支持生产,具体以对接方案中的【API文档-请求地址】为准),生产域名:https://api.jdl.com 预发环境域名:https://uat-api.jdl.com
|
|
@@ -566,25 +569,25 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
LopPlugin lopPlugin = OAuth2PluginFactory.produceLopPlugin(jdExpressConfig.getAppKey(), jdExpressConfig.getAppSecret(), jdExpressConfig.getAccessToken());
|
|
LopPlugin lopPlugin = OAuth2PluginFactory.produceLopPlugin(jdExpressConfig.getAppKey(), jdExpressConfig.getAppSecret(), jdExpressConfig.getAccessToken());
|
|
|
request.addLopPlugin(lopPlugin);
|
|
request.addLopPlugin(lopPlugin);
|
|
|
|
|
|
|
|
- log.info("京东开放平台根据二维码查询运单接口,请求参数:{}", JSON.toJSONString(request));
|
|
|
|
|
|
|
+ log.info("京东开放平台根据二维码查询运单号接口,请求参数:{}", JSON.toJSONString(request));
|
|
|
CommonqueryorderapiCommongetorderbymonthsettleqrv1LopResponse response = client.execute(request);
|
|
CommonqueryorderapiCommongetorderbymonthsettleqrv1LopResponse response = client.execute(request);
|
|
|
- log.info("京东开放平台根据二维码查询运单接口,响应结果:{}", JSON.toJSONString(response));
|
|
|
|
|
|
|
+ log.info("京东开放平台根据二维码查询运单号接口,响应结果:{}", JSON.toJSONString(response));
|
|
|
|
|
|
|
|
if (response.getCode().equals("0")) {
|
|
if (response.getCode().equals("0")) {
|
|
|
if (response.getResponse().getCode() == 0) {
|
|
if (response.getResponse().getCode() == 0) {
|
|
|
result.put("success", true);
|
|
result.put("success", true);
|
|
|
- result.put("msg", response.getResponse().getData().getWaybillQRVerifyInfoList());
|
|
|
|
|
|
|
+ result.put("msg", response.getResponse().getData());
|
|
|
} else {
|
|
} else {
|
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
|
- result.put("msg", "京东开放平台根据二维码查询运单接口!失败原因:" + response.getResponse().getMsg());
|
|
|
|
|
|
|
+ result.put("msg", "京东开放平台根据二维码查询运单号接口!失败原因:" + response.getResponse().getMsg());
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
|
- result.put("msg", "京东开放平台根据二维码查询运单接口!失败原因:" + response.getMsg());
|
|
|
|
|
|
|
+ result.put("msg", "京东开放平台根据二维码查询运单号接口!失败原因:" + response.getMsg());
|
|
|
}
|
|
}
|
|
|
} catch (LopException e) {
|
|
} catch (LopException e) {
|
|
|
- log.error("京东开放平台根据二维码查询运单接口异常:{}", e);
|
|
|
|
|
- throw new ServiceException("京东开放平台根据二维码查询运单接口异常");
|
|
|
|
|
|
|
+ log.error("京东开放平台根据二维码查询运单号接口异常:{}", e);
|
|
|
|
|
+ throw new ServiceException("京东开放平台根据二维码查询运单号接口异常");
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -620,7 +623,11 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
if (response.getCode().equals("0")) {
|
|
if (response.getCode().equals("0")) {
|
|
|
if (response.getResult().getCode() == 0) {
|
|
if (response.getResult().getCode() == 0) {
|
|
|
result.put("success", true);
|
|
result.put("success", true);
|
|
|
- result.put("msg", response.getResult().getData());
|
|
|
|
|
|
|
+ JSONObject msgJson = JSON.parseObject(response.getMsg());
|
|
|
|
|
+ JSONObject responseJson = msgJson.getJSONObject("response");
|
|
|
|
|
+ JSONObject contentJson = responseJson.getJSONObject("content");
|
|
|
|
|
+ CommonOrderInfoResponse commonOrderInfoResponse = JSON.parseObject(contentJson.getString("data"), CommonOrderInfoResponse.class);
|
|
|
|
|
+ result.put("msg", commonOrderInfoResponse);
|
|
|
} else {
|
|
} else {
|
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
|
result.put("msg", "京东开放平台根据运单号查询运单详情接口!失败原因:" + response.getResult().getMsg());
|
|
result.put("msg", "京东开放平台根据运单号查询运单详情接口!失败原因:" + response.getResult().getMsg());
|
|
@@ -630,8 +637,55 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
result.put("msg", "京东开放平台根据运单号查询运单详情接口!失败原因:" + response.getMsg());
|
|
result.put("msg", "京东开放平台根据运单号查询运单详情接口!失败原因:" + response.getMsg());
|
|
|
}
|
|
}
|
|
|
} catch (LopException e) {
|
|
} catch (LopException e) {
|
|
|
- log.error("京东开放平台根据运单号查询运单详情接口:{}", e);
|
|
|
|
|
- throw new ServiceException("京东开放平台获取商家二维码接口异常");
|
|
|
|
|
|
|
+ log.error("京东开放平台根据运单号查询运单详情接口异常:{}", e);
|
|
|
|
|
+ throw new ServiceException("京东开放平台根据运单号查询运单详情接口异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public JSONObject queryOrderFeeInfo(String waybillCode) {
|
|
|
|
|
+ log.info("京东开放平台根据运单号查询运单费用接口,入参:{}", waybillCode);
|
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
|
+ try {
|
|
|
|
|
+ //设置接口域名(有的对接方案同时支持生产和沙箱环境,有的仅支持生产,具体以对接方案中的【API文档-请求地址】为准),生产域名:https://api.jdl.com 预发环境域名:https://uat-api.jdl.com
|
|
|
|
|
+ //DefaultDomainApiClient对象全局只需要创建一次
|
|
|
|
|
+ DefaultDomainApiClient client = new DefaultDomainApiClient(jdExpressConfig.getServerUrl(),500,15000);
|
|
|
|
|
+
|
|
|
|
|
+ //入参对象
|
|
|
|
|
+ EcapV1OrdersActualfeeQueryLopRequest request = new EcapV1OrdersActualfeeQueryLopRequest();
|
|
|
|
|
+
|
|
|
|
|
+ CommonActualFeeRequest requestDTO = new CommonActualFeeRequest();
|
|
|
|
|
+ requestDTO.setCustomerCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_CUSTOMERCODE));
|
|
|
|
|
+ requestDTO.setBusinessUnitCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_BUSINESSUNITCODE));
|
|
|
|
|
+ requestDTO.setWaybillCode(waybillCode);
|
|
|
|
|
+
|
|
|
|
|
+ request.setRequest(requestDTO);
|
|
|
|
|
+
|
|
|
|
|
+ //设置插件,必须的操作,不同类型的应用入参不同,请看入参注释,公共参数按顺序分别为AppKey、AppSecret、AccessToken
|
|
|
|
|
+ //使用开放平台ISV/自研商家应用调用接口
|
|
|
|
|
+ LopPlugin lopPlugin = OAuth2PluginFactory.produceLopPlugin(jdExpressConfig.getAppKey(), jdExpressConfig.getAppSecret(), jdExpressConfig.getAccessToken());
|
|
|
|
|
+ request.addLopPlugin(lopPlugin);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("京东开放平台根据运单号查询运单费用接口,请求参数:{}", JSON.toJSONString(request));
|
|
|
|
|
+ EcapV1OrdersActualfeeQueryLopResponse response = client.execute(request);
|
|
|
|
|
+ log.info("京东开放平台根据运单号查询运单费用接口,响应结果:{}", JSON.toJSONString(response));
|
|
|
|
|
+
|
|
|
|
|
+ if (response.getCode().equals("0")) {
|
|
|
|
|
+ if (response.getResult().getCode() == 0) {
|
|
|
|
|
+ result.put("success", true);
|
|
|
|
|
+ result.put("msg", response.getResult().getData());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("success", false);
|
|
|
|
|
+ result.put("msg", "京东开放平台根据运单号查询运单费用接口!失败原因:" + response.getResult().getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("success", false);
|
|
|
|
|
+ result.put("msg", "京东开放平台根据运单号查询运单费用接口!失败原因:" + response.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (LopException e) {
|
|
|
|
|
+ log.error("京东开放平台根据运单号查询运单费用接口异常:{}", e);
|
|
|
|
|
+ throw new ServiceException("京东开放平台根据运单号查询运单费用接口异常");
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|