|
@@ -13,10 +13,15 @@ import com.lop.open.api.sdk.domain.ECAP.CommonModifyCancelOrderApi.commonCancelO
|
|
|
import com.lop.open.api.sdk.domain.ECAP.CommonQueryOrderApi.commonGetActualFeeInfoV1.CommonActualFeeRequest;
|
|
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.domain.jdcloudprint.RenderService.render4Outer.OutputConfigDTO;
|
|
|
|
|
+import com.lop.open.api.sdk.domain.jdcloudprint.RenderService.render4Outer.PrintDataDTO;
|
|
|
|
|
+import com.lop.open.api.sdk.domain.jdcloudprint.RenderService.render4Outer.QueryRenderDTO;
|
|
|
import com.lop.open.api.sdk.plugin.LopPlugin;
|
|
import com.lop.open.api.sdk.plugin.LopPlugin;
|
|
|
import com.lop.open.api.sdk.plugin.factory.OAuth2PluginFactory;
|
|
import com.lop.open.api.sdk.plugin.factory.OAuth2PluginFactory;
|
|
|
import com.lop.open.api.sdk.request.ECAP.*;
|
|
import com.lop.open.api.sdk.request.ECAP.*;
|
|
|
|
|
+import com.lop.open.api.sdk.request.jdcloudprint.CloudPrintRenderLopRequest;
|
|
|
import com.lop.open.api.sdk.response.ECAP.*;
|
|
import com.lop.open.api.sdk.response.ECAP.*;
|
|
|
|
|
+import com.lop.open.api.sdk.response.jdcloudprint.CloudPrintRenderLopResponse;
|
|
|
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;
|
|
@@ -699,4 +704,67 @@ public class JDLogisticsService implements LogisticsService {
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public JSONObject queryWaybillPdf(BizWaybillOrder bizWaybillOrder) {
|
|
|
|
|
+ log.info("京东开放平台根据运单信息查询面单pdf接口,入参:{}", bizWaybillOrder);
|
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
|
+ try {
|
|
|
|
|
+ //设置接口域名(有的对接方案同时支持生产和沙箱环境,有的仅支持生产,具体以对接方案中的【API文档-请求地址】为准),生产域名:https://api.jdl.com 预发环境域名:https://uat-api.jdl.com
|
|
|
|
|
+ //DefaultDomainApiClient对象全局只需要创建一次
|
|
|
|
|
+ DefaultDomainApiClient client = new DefaultDomainApiClient(jdExpressConfig.getServerUrl(),500,15000);
|
|
|
|
|
+
|
|
|
|
|
+ //入参对象
|
|
|
|
|
+ CloudPrintRenderLopRequest request = new CloudPrintRenderLopRequest();
|
|
|
|
|
+
|
|
|
|
|
+ QueryRenderDTO queryRenderDTO = new QueryRenderDTO();
|
|
|
|
|
+ if (getOrderOrigin(bizWaybillOrder.getProductCode()) == 1) {
|
|
|
|
|
+ queryRenderDTO.setCustomerCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_CUSTOMERCODE));
|
|
|
|
|
+ queryRenderDTO.setTemplateCode("jdkd100x113");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ queryRenderDTO.setCustomerCode(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_BUSINESSUNITCODE));
|
|
|
|
|
+ queryRenderDTO.setTemplateCode("jdky100x113");
|
|
|
|
|
+ }
|
|
|
|
|
+// queryRenderDTO.setOperator(sysConfigService.selectConfigByKey(SysConfigConstants.JD_LOGISTICS_OPERATOR));
|
|
|
|
|
+ queryRenderDTO.setTaskId(bizWaybillOrder.getWaybillNo());
|
|
|
|
|
+
|
|
|
|
|
+ List<PrintDataDTO> printDataDTOList = new ArrayList<>();
|
|
|
|
|
+ PrintDataDTO printDataDTO = new PrintDataDTO();
|
|
|
|
|
+ printDataDTOList.add(printDataDTO);
|
|
|
|
|
+ queryRenderDTO.setPrintData(printDataDTOList);
|
|
|
|
|
+
|
|
|
|
|
+ List<OutputConfigDTO> outputConfigDTOList = new ArrayList<>();
|
|
|
|
|
+ OutputConfigDTO outputConfigDTO = new OutputConfigDTO();
|
|
|
|
|
+ outputConfigDTOList.add(outputConfigDTO);
|
|
|
|
|
+ queryRenderDTO.setOutputConfig(outputConfigDTOList);
|
|
|
|
|
+
|
|
|
|
|
+ request.setQueryRenderDTO(queryRenderDTO);
|
|
|
|
|
+
|
|
|
|
|
+ //设置插件,必须的操作,不同类型的应用入参不同,请看入参注释,公共参数按顺序分别为AppKey、AppSecret、AccessToken
|
|
|
|
|
+ //使用开放平台ISV/自研商家应用调用接口
|
|
|
|
|
+ LopPlugin lopPlugin = OAuth2PluginFactory.produceLopPlugin(jdExpressConfig.getAppKey(), jdExpressConfig.getAppSecret(), jdExpressConfig.getAccessToken());
|
|
|
|
|
+ request.addLopPlugin(lopPlugin);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("京东开放平台根据运单信息查询面单pdf接口,请求参数:{}", JSON.toJSONString(request));
|
|
|
|
|
+ CloudPrintRenderLopResponse response = client.execute(request);
|
|
|
|
|
+ log.info("京东开放平台根据运单信息查询面单pdf接口,响应结果:{}", JSON.toJSONString(response));
|
|
|
|
|
+
|
|
|
|
|
+ if (response.getCode().equals("0")) {
|
|
|
|
|
+ if (response.getPrintResultDTO().getCode() == 0) {
|
|
|
|
|
+ result.put("success", true);
|
|
|
|
|
+ result.put("msg", response.getPrintResultDTO().getResult());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("success", false);
|
|
|
|
|
+ result.put("msg", "京东开放平台根据运单信息查询面单pdf接口!失败原因:" + response.getPrintResultDTO().getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.put("success", false);
|
|
|
|
|
+ result.put("msg", "京东开放平台根据运单信息查询面单pdf接口!失败原因:" + response.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (LopException e) {
|
|
|
|
|
+ log.error("京东开放平台根据运单信息查询面单pdf接口异常:{}", e);
|
|
|
|
|
+ throw new ServiceException("京东开放平台根据运单信息查询面单pdf接口异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|