|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
|
|
|
|
+import com.ruoyi.common.core.utils.StringUtils;
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
import com.ruoyi.common.redis.service.RedisIdGenerator;
|
|
import com.ruoyi.common.redis.service.RedisIdGenerator;
|
|
|
import com.ruoyi.logistics.config.SFExpressConfig;
|
|
import com.ruoyi.logistics.config.SFExpressConfig;
|
|
@@ -277,11 +278,6 @@ public class SFLogisticsService implements LogisticsService {
|
|
|
orderData.put("language","zh_CN");
|
|
orderData.put("language","zh_CN");
|
|
|
orderData.put("orderId",bizWaybillOrder.getWaybillNo());
|
|
orderData.put("orderId",bizWaybillOrder.getWaybillNo());
|
|
|
orderData.put("dealType",1);
|
|
orderData.put("dealType",1);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
String msgData =tools.packageMsgData(standardService);
|
|
String msgData =tools.packageMsgData(standardService);
|
|
|
msgData= JSON.toJSONString(orderData);
|
|
msgData= JSON.toJSONString(orderData);
|
|
|
try {
|
|
try {
|
|
@@ -360,8 +356,59 @@ public class SFLogisticsService implements LogisticsService {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /*获取面单pdf下载地址*/
|
|
|
@Override
|
|
@Override
|
|
|
public JSONObject queryWaybillPdf(BizWaybillOrder bizWaybillOrder) {
|
|
public JSONObject queryWaybillPdf(BizWaybillOrder bizWaybillOrder) {
|
|
|
- return null;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ IServiceCodeStandard standardService = ExpressServiceCodeEnum.COM_RECE_CLOUD_PRINT_WAYBILLS;
|
|
|
|
|
+ CallExpressServiceTools tools=CallExpressServiceTools.getInstance();
|
|
|
|
|
+ Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
+ String timeStamp = String.valueOf(System.currentTimeMillis());
|
|
|
|
|
+ Map<String,Object> orderData= new HashMap<>();
|
|
|
|
|
+ orderData.put("templateCode","fm_210_standard_{{clientcode}}");
|
|
|
|
|
+ orderData.put("version","2.0");
|
|
|
|
|
+ orderData.put("fileType","pdf");
|
|
|
|
|
+ orderData.put("sync",true);
|
|
|
|
|
+ List<Map<String, Object>> documents = new ArrayList<>();
|
|
|
|
|
+ Map<String, Object> doc = new HashMap<>();
|
|
|
|
|
+ doc.put("masterWaybillNo",bizWaybillOrder.getWaybillNo() );
|
|
|
|
|
+ documents.add(doc);
|
|
|
|
|
+ orderData.put("documents",documents);
|
|
|
|
|
+ String msgData =tools.packageMsgData(standardService);
|
|
|
|
|
+ msgData= JSON.toJSONString(orderData);
|
|
|
|
|
+ try {
|
|
|
|
|
+ params.put("partnerID", sfExpressConfig.getClientCode()); // 顾客编码 ,对应丰桥上获取的clientCode
|
|
|
|
|
+ params.put("requestID", UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
+ params.put("serviceCode",standardService.getCode());// 接口服务码
|
|
|
|
|
+ params.put("timestamp", timeStamp);
|
|
|
|
|
+ params.put("msgData", msgData);
|
|
|
|
|
+ params.put("msgDigest", tools.getMsgDigest(msgData,timeStamp,sfExpressConfig.getCheckWord()));
|
|
|
|
|
+ String result = HttpClientUtil.post(sfExpressConfig.getCurrentApiUrl(), params);
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(result).getJSONObject("apiResultData");
|
|
|
|
|
+ JSONObject resultInfo = new JSONObject();
|
|
|
|
|
+ if (jsonObject != null && jsonObject.containsKey("apiErrorMsg") && StringUtils.isBlank("apiErrorMsg")) {
|
|
|
|
|
+ resultInfo.put("success", true);
|
|
|
|
|
+ JSONObject obj = jsonObject.getJSONObject("obj");
|
|
|
|
|
+ // 4. 取出 files 数组,取第一个
|
|
|
|
|
+ JSONObject file = obj.getJSONArray("files").getJSONObject(0);
|
|
|
|
|
+ // 5. 拿到最终的 URL
|
|
|
|
|
+ String url = file.getString("url");
|
|
|
|
|
+ String token = file.getString("token");
|
|
|
|
|
+ resultInfo.put("msg",url);
|
|
|
|
|
+ resultInfo.put("token",token);
|
|
|
|
|
+ return resultInfo;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resultInfo.put("success", false);
|
|
|
|
|
+ resultInfo.put("msg", "获取面单失败!失败原因:"+jsonObject.get("apiErrorMsg"));
|
|
|
|
|
+ return resultInfo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ catch(Exception e){
|
|
|
|
|
+ throw new RuntimeException();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|