推送邮政订单测试
parent
95c5a342fc
commit
e948c3b71b
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.cpxt.web.controller.biz;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.cpxt.biz.orderutil.CityDelivery_SM4Util;
|
||||||
|
import com.cpxt.common.annotation.Anonymous;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/test")
|
||||||
|
public class TestContrller {
|
||||||
|
private static final char[] specialChars = {'\n', '\r', '\t', '\f', '\b', ' '};
|
||||||
|
|
||||||
|
// test
|
||||||
|
String clientKey = "7480617400984563";//accessKey
|
||||||
|
String clientSecret = "91wCEvn82CeyMg3k";
|
||||||
|
String sm4Key = "MJy05dcI4mPbGB61";
|
||||||
|
String appType = "wxmp";
|
||||||
|
String client_type = "other";
|
||||||
|
String version = "1.0.0";
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
|
@GetMapping("/getOrder")
|
||||||
|
public void cityDelivery_signBody22() {
|
||||||
|
Long timeStamp = System.currentTimeMillis();
|
||||||
|
String nonce = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
System.out.println("nonce:" + nonce);
|
||||||
|
System.out.println("timeStamp:" + timeStamp);
|
||||||
|
//签名
|
||||||
|
Map<String, Object> sortedMap = new TreeMap<>();
|
||||||
|
//下单接口
|
||||||
|
String body = "{\n" +
|
||||||
|
" \"customerCode\": \"HFCP\",\n" +
|
||||||
|
" \"payTypeFirst\": \"02\",\n" +
|
||||||
|
" \"channelOrderNo\": \"Y202501221001-1\",\n" +
|
||||||
|
" \"platformOrderNo\": \"\",\n" +
|
||||||
|
" \"expressNbr\": \"\",\n" +
|
||||||
|
" \"coordinateTransformType\": \"02\",\n" +
|
||||||
|
" \"weight\": \"1000\",\n" +
|
||||||
|
" \"expectedTime\": \"2025-02-10,21:00:00\",\n" +
|
||||||
|
" \"postageFee\": \"800\",\n" +
|
||||||
|
" \"orderSource\": \"other\",\n" +
|
||||||
|
" \"orderSourcePlatform\": \"其他\",\n" +
|
||||||
|
" \"costFee\": \"0\",\n" +
|
||||||
|
" \"tipFee\": \"0\",\n" +
|
||||||
|
" \"insuredFee\": \"0\",\n" +
|
||||||
|
" \"otherFee1\": \"0\",\n" +
|
||||||
|
" \"otherFee2\": \"0\",\n" +
|
||||||
|
" \"packageDesc\": \"食品\",\n" +
|
||||||
|
" \"remark\": \"\",\n" +
|
||||||
|
" \"addressFirst\": {\n" +
|
||||||
|
" \"senderProviceCode\": \"340000\",\n" +
|
||||||
|
" \"senderProviceName\": \"安徽省\",\n" +
|
||||||
|
" \"senderCityCode\": \"340100\",\n" +
|
||||||
|
" \"senderCityName\": \"合肥市\",\n" +
|
||||||
|
" \"senderCountyCode\": \"340121\",\n" +
|
||||||
|
" \"senderCountyName\": \"长丰县\",\n" +
|
||||||
|
" \"senderContactName\": \"巴莉甜甜工厂\",\n" +
|
||||||
|
" \"senderContactPhone\": \"15856235263\",\n" +
|
||||||
|
" \"senderLongitude\": \"117.30488400\",\n" +
|
||||||
|
" \"senderLatitude\": \"31.87844600\",\n" +
|
||||||
|
" \"senderStreetCode\": \"340121400000\",\n" +
|
||||||
|
" \"senderStreetName\": \"双凤开发区\",\n" +
|
||||||
|
" \"senderAddr\": \"合肥市长丰县凤麟路10号\",\n" +
|
||||||
|
" \"receiverProviceCode\": \"340000\",\n" +
|
||||||
|
" \"receiverProviceName\": \"安徽省\",\n" +
|
||||||
|
" \"receiverCityCode\": \"340100\",\n" +
|
||||||
|
" \"receiverCityName\": \"合肥市\",\n" +
|
||||||
|
" \"receiverCountyCode\": \"340122\",\n" +
|
||||||
|
" \"receiverCountyName\": \"肥东县\",\n" +
|
||||||
|
" \"receiverContactName\": \"舒城港汇\",\n" +
|
||||||
|
" \"receiverContactPhone\": \"15856235263\",\n" +
|
||||||
|
" \"receiverAddr\": \"巴莉甜甜(舒城港汇店)\",\n" +
|
||||||
|
" \"receiverLongitude\": \"116.93721100\",\n" +
|
||||||
|
" \"receiverLatitude\": \"31.47053900\",\n" +
|
||||||
|
" \"receiverStreetCode\": \"340122402000\",\n" +
|
||||||
|
" \"receiverStreetName\": \"合肥循环经济示范园\"\n" +
|
||||||
|
" },\n" +
|
||||||
|
" \"businessJson\": {\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
String bodyjson = JSON.toJSONString(StrUtil.removeAll(body, specialChars));
|
||||||
|
System.out.println("bodyjson: " + bodyjson);
|
||||||
|
|
||||||
|
sortedMap.put("data", bodyjson);
|
||||||
|
sortedMap.put("access_id", clientKey);
|
||||||
|
sortedMap.put("nonce", nonce);
|
||||||
|
sortedMap.put("timestamp", timeStamp);
|
||||||
|
//排序
|
||||||
|
Map<String, Object> sortedParams = new TreeMap<>(sortedMap);
|
||||||
|
Set<Map.Entry<String, Object>> entrySet = sortedParams.entrySet();
|
||||||
|
// 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
|
||||||
|
StringBuilder stringToSign = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : entrySet) {
|
||||||
|
stringToSign.append(param.getKey()).append("=").append(param.getValue()).append(",");
|
||||||
|
}
|
||||||
|
stringToSign.append("accessSecret").append("=").append(clientSecret);
|
||||||
|
String genSign = CityDelivery_SM4Util.encryptCBC(stringToSign.toString(), clientSecret, sm4Key);
|
||||||
|
System.out.println("sign:" + genSign);
|
||||||
|
|
||||||
|
log.info("bodyjson:" + bodyjson);
|
||||||
|
log.info("nonce:" + nonce);
|
||||||
|
log.info("timestamp:" + timeStamp);
|
||||||
|
log.info("sign:" + genSign);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,8 @@ import com.cpxt.biz.domain.BizOrderSub;
|
||||||
import com.cpxt.biz.domain.SysArea;
|
import com.cpxt.biz.domain.SysArea;
|
||||||
import com.cpxt.biz.mapper.SysAreaMapper;
|
import com.cpxt.biz.mapper.SysAreaMapper;
|
||||||
import com.cpxt.common.annotation.Anonymous;
|
import com.cpxt.common.annotation.Anonymous;
|
||||||
|
import com.cpxt.common.utils.DateUtils;
|
||||||
|
import com.cpxt.common.utils.Helper;
|
||||||
import com.cpxt.system.mapper.SysDictDataMapper;
|
import com.cpxt.system.mapper.SysDictDataMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -52,100 +54,6 @@ public class CityDelivery {
|
||||||
String client_type = "other";
|
String client_type = "other";
|
||||||
String version = "1.0.0";
|
String version = "1.0.0";
|
||||||
|
|
||||||
/**
|
|
||||||
* 同城急送平台工具,post接口
|
|
||||||
*/
|
|
||||||
public void cityDelivery_signBody22() {
|
|
||||||
Long timeStamp = System.currentTimeMillis();
|
|
||||||
String nonce = UUID.randomUUID().toString().replace("-", "");
|
|
||||||
System.out.println("nonce:" + nonce);
|
|
||||||
System.out.println("timeStamp:" + timeStamp);
|
|
||||||
//签名
|
|
||||||
Map<String, Object> sortedMap = new TreeMap<>();
|
|
||||||
//下单接口
|
|
||||||
String body = "{\n" +
|
|
||||||
" \"customerCode\": \"HFCP\",\n" +
|
|
||||||
" \"payTypeFirst\": \"03\",\n" +
|
|
||||||
" \"channelOrderNo\": \"Y202501021005-1\",\n" +
|
|
||||||
" \"platformOrderNo\": \"\",\n" +
|
|
||||||
" \"expressNbr\": \"\",\n" +
|
|
||||||
" \"coordinateTransformType\": \"02\",\n" +
|
|
||||||
" \"weight\": \"501\",\n" +
|
|
||||||
" \"expectedTime\": \"2025-01-22,18:12:00\",\n" +
|
|
||||||
" \"postageFee\": \"2000\",\n" +
|
|
||||||
// " \"convertFlag\": false,\n" +
|
|
||||||
" \"orderSource\": \"other\",\n" +
|
|
||||||
" \"orderSourcePlatform\": \"其他\",\n" +
|
|
||||||
" \"costFee\": \"0\",\n" +
|
|
||||||
" \"tipFee\": \"0\",\n" +
|
|
||||||
" \"insuredFee\": \"0\",\n" +
|
|
||||||
" \"otherFee1\": \"0\",\n" +
|
|
||||||
" \"otherFee2\": \"0\",\n" +
|
|
||||||
" \"packageDesc\": \"药品\",\n" +
|
|
||||||
" \"remark\": \"手机尾号1234\",\n" +
|
|
||||||
" \"addressFirst\": {\n" +
|
|
||||||
" \"senderProviceCode\": \"340000\",\n" +
|
|
||||||
" \"senderProviceName\": \"安徽省\",\n" +
|
|
||||||
" \"senderCityCode\": \"340100\",\n" +
|
|
||||||
" \"senderCityName\": \"合肥市\",\n" +
|
|
||||||
" \"senderCountyCode\": \"340102\",\n" +
|
|
||||||
" \"senderCountyName\": \"瑶海区\",\n" +
|
|
||||||
" \"senderContactName\": \"中山三院\",\n" +
|
|
||||||
" \"senderContactPhone\": \"17523029470\",\n" +
|
|
||||||
" \"senderLongitude\": \"117.307179\",\n" +
|
|
||||||
" \"senderLatitude\": \"31.856484\",\n" +
|
|
||||||
" \"senderStreetCode\": \"001\",\n" +
|
|
||||||
" \"senderStreetName\": \"明光路街道\",\n" +
|
|
||||||
" \"senderAddr\": \"明光路188号\",\n" +
|
|
||||||
" \"receiverProviceCode\": \"340000\",\n" +
|
|
||||||
" \"receiverProviceName\": \"安徽省\",\n" +
|
|
||||||
" \"receiverCityCode\": \"340100\",\n" +
|
|
||||||
" \"receiverCityName\": \"合肥市\",\n" +
|
|
||||||
" \"receiverCountyCode\": \"340103\",\n" +
|
|
||||||
" \"receiverCountyName\": \"庐阳区\",\n" +
|
|
||||||
" \"receiverContactName\": \"陈先生\",\n" +
|
|
||||||
" \"receiverContactPhone\": \"13711511111\",\n" +
|
|
||||||
" \"receiverAddr\": \"信源大厦20楼2007\",\n" +
|
|
||||||
" \"receiverLongitude\": \"117.285075\",\n" +
|
|
||||||
" \"receiverLatitude\": \"31.882703\",\n" +
|
|
||||||
" \"receiverStreetCode\": \"002\",\n" +
|
|
||||||
" \"receiverStreetName\": \"双岗街道\"\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"businessJson\": {\n" +
|
|
||||||
// " \"a\": \"a\",\n" +
|
|
||||||
// " \"b\": \"b\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
"}";
|
|
||||||
//查询物流轨迹
|
|
||||||
// String body = "{\n" +
|
|
||||||
// " \"expressNbr\": \"1158114584567\",\n" +
|
|
||||||
// " \"channelOrderNo\": \"\"\n" +
|
|
||||||
// "}";
|
|
||||||
//get请求,组装成 k v类型
|
|
||||||
// sortedMap.put(paramName,request.getParameter(paramName));
|
|
||||||
/**
|
|
||||||
* post请求,需要放data
|
|
||||||
*/
|
|
||||||
String bodyjson = JSON.toJSONString(StrUtil.removeAll(body, specialChars));
|
|
||||||
System.out.println("bodyjson: " + bodyjson);
|
|
||||||
|
|
||||||
sortedMap.put("data", JSON.toJSONString(StrUtil.removeAll(body, specialChars)));
|
|
||||||
sortedMap.put("access_id", clientKey);
|
|
||||||
sortedMap.put("nonce", nonce);
|
|
||||||
sortedMap.put("timestamp", timeStamp);
|
|
||||||
//排序
|
|
||||||
Map<String, Object> sortedParams = new TreeMap<>(sortedMap);
|
|
||||||
Set<Map.Entry<String, Object>> entrySet = sortedParams.entrySet();
|
|
||||||
// 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
|
|
||||||
StringBuilder stringToSign = new StringBuilder();
|
|
||||||
for (Map.Entry<String, Object> param : entrySet) {
|
|
||||||
stringToSign.append(param.getKey()).append("=").append(param.getValue()).append(",");
|
|
||||||
}
|
|
||||||
stringToSign.append("accessSecret").append("=").append(clientSecret);
|
|
||||||
String genSign = CityDelivery_SM4Util.encryptCBC(stringToSign.toString(), clientSecret, sm4Key);
|
|
||||||
System.out.println("sign:" + genSign);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同城急送平台工具,post接口
|
* 同城急送平台工具,post接口
|
||||||
*/
|
*/
|
||||||
|
|
@ -159,9 +67,13 @@ public class CityDelivery {
|
||||||
String subOrderSn = bizOrderSub.getSubOrderSn();
|
String subOrderSn = bizOrderSub.getSubOrderSn();
|
||||||
if (subOrderSn == null) subOrderSn = "";
|
if (subOrderSn == null) subOrderSn = "";
|
||||||
BigDecimal weight = bizOrderSub.getWeight();
|
BigDecimal weight = bizOrderSub.getWeight();
|
||||||
|
int intweight = Helper.FInt(weight.multiply(new BigDecimal(1000)));
|
||||||
String remark = bizOrderSub.getRemark();
|
String remark = bizOrderSub.getRemark();
|
||||||
if (remark == null) remark = "";
|
if (remark == null) remark = "";
|
||||||
|
|
||||||
|
BigDecimal fee = bizOrderSub.getOrderFee();
|
||||||
|
int intfee = Helper.FInt(fee.multiply(new BigDecimal(100)));
|
||||||
|
|
||||||
// 寄件人信息
|
// 寄件人信息
|
||||||
String senderArea = bizOrder.getSenderArea(); // 寄件人街道代码
|
String senderArea = bizOrder.getSenderArea(); // 寄件人街道代码
|
||||||
if (senderArea == null) senderArea = "";
|
if (senderArea == null) senderArea = "";
|
||||||
|
|
@ -259,6 +171,11 @@ public class CityDelivery {
|
||||||
if (bizOrder.getReceiverLat() != null){
|
if (bizOrder.getReceiverLat() != null){
|
||||||
receiverLat = bizOrder.getReceiverLat().toString();
|
receiverLat = bizOrder.getReceiverLat().toString();
|
||||||
}
|
}
|
||||||
|
Date createtime = bizOrder.getCreateTime();
|
||||||
|
Date exptime = new Date();
|
||||||
|
if (createtime!=null)
|
||||||
|
exptime = DateUtils.addHours(createtime, 5);
|
||||||
|
String exptime_str = DateUtils.parseDateToStr("yyyy-MM-dd,HH:mm:ss", exptime);
|
||||||
|
|
||||||
Long timeStamp = System.currentTimeMillis();
|
Long timeStamp = System.currentTimeMillis();
|
||||||
String nonce = UUID.randomUUID().toString().replace("-", "");
|
String nonce = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
|
@ -274,17 +191,17 @@ public class CityDelivery {
|
||||||
" \"platformOrderNo\": \"\",\n" +
|
" \"platformOrderNo\": \"\",\n" +
|
||||||
" \"expressNbr\": \"\",\n" +
|
" \"expressNbr\": \"\",\n" +
|
||||||
" \"coordinateTransformType\": \"02\",\n" +
|
" \"coordinateTransformType\": \"02\",\n" +
|
||||||
" \"weight\": \"" + weight + "\",\n" +
|
" \"weight\": \"" + intweight + "\",\n" +
|
||||||
" \"expectedTime\": \"\",\n" +
|
" \"expectedTime\": \""+exptime_str+"\",\n" +
|
||||||
" \"postageFee\": \"\",\n" +
|
" \"postageFee\": \""+ intfee +"\",\n" +
|
||||||
// " \"convertFlag\": false,\n" +
|
// " \"convertFlag\": false,\n" +
|
||||||
" \"orderSource\": \"other\",\n" +
|
" \"orderSource\": \"other\",\n" +
|
||||||
" \"orderSourcePlatform\": \"其他\",\n" +
|
" \"orderSourcePlatform\": \"其他\",\n" +
|
||||||
" \"costFee\": \"\",\n" +
|
" \"costFee\": \"0\",\n" +
|
||||||
" \"tipFee\": \"\",\n" +
|
" \"tipFee\": \"0\",\n" +
|
||||||
" \"insuredFee\": \"\",\n" +
|
" \"insuredFee\": \"0\",\n" +
|
||||||
" \"otherFee1\": \"\",\n" +
|
" \"otherFee1\": \"0\",\n" +
|
||||||
" \"otherFee2\": \"\",\n" +
|
" \"otherFee2\": \"0\",\n" +
|
||||||
" \"packageDesc\": \"" + goodsTypeLabel + "\",\n" +
|
" \"packageDesc\": \"" + goodsTypeLabel + "\",\n" +
|
||||||
" \"remark\": \"" + remark + "\",\n" +
|
" \"remark\": \"" + remark + "\",\n" +
|
||||||
" \"addressFirst\": {\n" +
|
" \"addressFirst\": {\n" +
|
||||||
|
|
@ -315,6 +232,122 @@ public class CityDelivery {
|
||||||
" \"receiverStreetCode\": \"" + receiverArea + "\",\n" +
|
" \"receiverStreetCode\": \"" + receiverArea + "\",\n" +
|
||||||
" \"receiverStreetName\": \"" + receiverStreetName + "\"\n" +
|
" \"receiverStreetName\": \"" + receiverStreetName + "\"\n" +
|
||||||
" },\n" +
|
" },\n" +
|
||||||
|
" \"businessJson\": {}\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
// 获取最新token
|
||||||
|
String token = refreshToken();
|
||||||
|
log.info("========================================准备请求========================================");
|
||||||
|
log.info("body:" + body);
|
||||||
|
/**
|
||||||
|
* post请求,需要放data
|
||||||
|
*/
|
||||||
|
String bodyjson = JSON.toJSONString(StrUtil.removeAll(body, specialChars));
|
||||||
|
|
||||||
|
sortedMap.put("data", bodyjson);
|
||||||
|
sortedMap.put("access_id", clientKey);
|
||||||
|
sortedMap.put("nonce", nonce);
|
||||||
|
sortedMap.put("timestamp", timeStamp);
|
||||||
|
|
||||||
|
//排序
|
||||||
|
Map<String, Object> sortedParams = new TreeMap<>(sortedMap);
|
||||||
|
Set<Map.Entry<String, Object>> entrySet = sortedParams.entrySet();
|
||||||
|
// 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
|
||||||
|
StringBuilder stringToSign = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Object> param : entrySet) {
|
||||||
|
stringToSign.append(param.getKey()).append("=").append(param.getValue()).append(",");
|
||||||
|
}
|
||||||
|
stringToSign.append("accessSecret").append("=").append(clientSecret);
|
||||||
|
String genSign = CityDelivery_SM4Util.encryptCBC(stringToSign.toString(), clientSecret, sm4Key);
|
||||||
|
|
||||||
|
log.info("bodyjson:" + bodyjson);
|
||||||
|
System.out.println("bodyjson: " + bodyjson);
|
||||||
|
log.info("nonce:" + nonce);
|
||||||
|
System.out.println("nonce:" + nonce);
|
||||||
|
log.info("timestamp:" + timeStamp);
|
||||||
|
System.out.println("timestamp:" + timeStamp);
|
||||||
|
log.info("sign:" + genSign);
|
||||||
|
System.out.println("sign:" + genSign);
|
||||||
|
log.info("Authorization:" + token);
|
||||||
|
System.out.println("Authorization:" + token);
|
||||||
|
log.info("========================================开始请求========================================");
|
||||||
|
// .body(JSONObject.toJSONString(body))
|
||||||
|
HttpResponse response = HttpRequest.post(url)
|
||||||
|
.body(StrUtil.removeAll(body, specialChars))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.header("client_type", client_type)
|
||||||
|
.header("app_type", appType)
|
||||||
|
.header("access_id", clientKey)
|
||||||
|
.header("nonce", nonce)
|
||||||
|
.header("timestamp", timeStamp.toString())
|
||||||
|
.header("sign", genSign)
|
||||||
|
.header("Authorization", token)
|
||||||
|
.execute();
|
||||||
|
log.info("========================================请求结果========================================");
|
||||||
|
System.out.println("response:" + response);
|
||||||
|
log.info("response:" + response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同城急送平台工具,post接口
|
||||||
|
*/
|
||||||
|
public void cityDelivery_signBody22() {
|
||||||
|
Long timeStamp = System.currentTimeMillis();
|
||||||
|
String nonce = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
System.out.println("nonce:" + nonce);
|
||||||
|
System.out.println("timeStamp:" + timeStamp);
|
||||||
|
//签名
|
||||||
|
Map<String, Object> sortedMap = new TreeMap<>();
|
||||||
|
//下单接口
|
||||||
|
String body = "{\n" +
|
||||||
|
" \"customerCode\": \"HFCP\",\n" +
|
||||||
|
" \"payTypeFirst\": \"03\",\n" +
|
||||||
|
" \"channelOrderNo\": \"Y202501021005-1\",\n" +
|
||||||
|
" \"platformOrderNo\": \"\",\n" +
|
||||||
|
" \"expressNbr\": \"\",\n" +
|
||||||
|
" \"coordinateTransformType\": \"02\",\n" +
|
||||||
|
" \"weight\": \"501\",\n" +
|
||||||
|
" \"expectedTime\": \"2025-01-22,18:12:00\",\n" +
|
||||||
|
" \"postageFee\": \"2000\",\n" +
|
||||||
|
// " \"convertFlag\": false,\n" +
|
||||||
|
" \"orderSource\": \"other\",\n" +
|
||||||
|
" \"orderSourcePlatform\": \"其他\",\n" +
|
||||||
|
" \"costFee\": \"0\",\n" +
|
||||||
|
" \"tipFee\": \"0\",\n" +
|
||||||
|
" \"insuredFee\": \"0\",\n" +
|
||||||
|
" \"otherFee1\": \"0\",\n" +
|
||||||
|
" \"otherFee2\": \"0\",\n" +
|
||||||
|
" \"packageDesc\": \"药品\",\n" +
|
||||||
|
" \"remark\": \"手机尾号1234\",\n" +
|
||||||
|
" \"addressFirst\": {\n" +
|
||||||
|
" \"senderProviceCode\": \"340000\",\n" +
|
||||||
|
" \"senderProviceName\": \"安徽省\",\n" +
|
||||||
|
" \"senderCityCode\": \"340100\",\n" +
|
||||||
|
" \"senderCityName\": \"合肥市\",\n" +
|
||||||
|
" \"senderCountyCode\": \"340102\",\n" +
|
||||||
|
" \"senderCountyName\": \"瑶海区\",\n" +
|
||||||
|
" \"senderContactName\": \"中山三院\",\n" +
|
||||||
|
" \"senderContactPhone\": \"17523029470\",\n" +
|
||||||
|
" \"senderLongitude\": \"117.307179\",\n" +
|
||||||
|
" \"senderLatitude\": \"31.856484\",\n" +
|
||||||
|
" \"senderStreetCode\": \"001\",\n" +
|
||||||
|
" \"senderStreetName\": \"明光路街道\",\n" +
|
||||||
|
" \"senderAddr\": \"明光路188号\",\n" +
|
||||||
|
" \"receiverProviceCode\": \"340000\",\n" +
|
||||||
|
" \"receiverProviceName\": \"安徽省\",\n" +
|
||||||
|
" \"receiverCityCode\": \"340100\",\n" +
|
||||||
|
" \"receiverCityName\": \"合肥市\",\n" +
|
||||||
|
" \"receiverCountyCode\": \"340103\",\n" +
|
||||||
|
" \"receiverCountyName\": \"庐阳区\",\n" +
|
||||||
|
" \"receiverContactName\": \"陈先生\",\n" +
|
||||||
|
" \"receiverContactPhone\": \"13711511111\",\n" +
|
||||||
|
" \"receiverAddr\": \"信源大厦20楼2007\",\n" +
|
||||||
|
" \"receiverLongitude\": \"117.285075\",\n" +
|
||||||
|
" \"receiverLatitude\": \"31.882703\",\n" +
|
||||||
|
" \"receiverStreetCode\": \"002\",\n" +
|
||||||
|
" \"receiverStreetName\": \"双岗街道\"\n" +
|
||||||
|
" },\n" +
|
||||||
" \"businessJson\": {\n" +
|
" \"businessJson\": {\n" +
|
||||||
// " \"a\": \"a\",\n" +
|
// " \"a\": \"a\",\n" +
|
||||||
// " \"b\": \"b\"\n" +
|
// " \"b\": \"b\"\n" +
|
||||||
|
|
@ -327,9 +360,6 @@ public class CityDelivery {
|
||||||
// "}";
|
// "}";
|
||||||
//get请求,组装成 k v类型
|
//get请求,组装成 k v类型
|
||||||
// sortedMap.put(paramName,request.getParameter(paramName));
|
// sortedMap.put(paramName,request.getParameter(paramName));
|
||||||
String token = refreshToken();
|
|
||||||
log.info("========================================准备请求========================================");
|
|
||||||
log.info("body:" + body);
|
|
||||||
/**
|
/**
|
||||||
* post请求,需要放data
|
* post请求,需要放data
|
||||||
*/
|
*/
|
||||||
|
|
@ -350,37 +380,10 @@ public class CityDelivery {
|
||||||
}
|
}
|
||||||
stringToSign.append("accessSecret").append("=").append(clientSecret);
|
stringToSign.append("accessSecret").append("=").append(clientSecret);
|
||||||
String genSign = CityDelivery_SM4Util.encryptCBC(stringToSign.toString(), clientSecret, sm4Key);
|
String genSign = CityDelivery_SM4Util.encryptCBC(stringToSign.toString(), clientSecret, sm4Key);
|
||||||
log.info("client_type:" + client_type);
|
System.out.println("sign:" + genSign);
|
||||||
System.out.println("client_type:" + client_type);
|
|
||||||
log.info("app_type:" + appType);
|
|
||||||
System.out.println("app_type:" + appType);
|
|
||||||
log.info("access_id:" + clientKey);
|
|
||||||
System.out.println("access_id:" + clientKey);
|
|
||||||
log.info("nonce:" + nonce);
|
|
||||||
System.out.println("nonce:" + nonce);
|
|
||||||
log.info("timestamp:" + timeStamp);
|
|
||||||
System.out.println("timestamp:" + timeStamp);
|
|
||||||
log.info("sign:" + genSign);
|
|
||||||
System.out.println("sign:" + genSign);
|
|
||||||
log.info("Authorization:" + token);
|
|
||||||
System.out.println("Authorization:" + token);
|
|
||||||
log.info("========================================开始请求========================================");
|
|
||||||
HttpResponse response = HttpRequest.post(url)
|
|
||||||
.body(JSONObject.toJSONString(body))
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.header("client_type", client_type)
|
|
||||||
.header("app_type", appType)
|
|
||||||
.header("access_id", clientKey)
|
|
||||||
.header("nonce", nonce)
|
|
||||||
.header("timestamp", timeStamp.toString())
|
|
||||||
.header("sign", genSign)
|
|
||||||
.header("Authorization", token)
|
|
||||||
.execute();
|
|
||||||
log.info("========================================请求结果========================================");
|
|
||||||
System.out.println("response:" + response);
|
|
||||||
log.info("response:" + response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同城急送平台工具,获取token
|
* 同城急送平台工具,获取token
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<name>cpxt</name>
|
<name>cpxt</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>中国邮政合肥城配平台</description>
|
<description>合肥城配平台</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<cpxt.version>3.8.8</cpxt.version>
|
<cpxt.version>3.8.8</cpxt.version>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue