推送邮政订单测试
parent
861890b642
commit
8de118b22e
|
|
@ -41,6 +41,98 @@ public class cityDelivery {
|
|||
* 同城急送平台工具,post接口
|
||||
*/
|
||||
@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\": \"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);
|
||||
}
|
||||
|
||||
public void cityDelivery_signBody2(){
|
||||
Long timeStamp = System.currentTimeMillis();
|
||||
String nonce = UUID.randomUUID().toString().replace("-","");
|
||||
|
|
@ -50,11 +142,11 @@ public class cityDelivery {
|
|||
Map<String,Object> sortedMap = new TreeMap<>();
|
||||
//下单接口
|
||||
String body = "{\n" +
|
||||
" \"customerCode\": \"GZHX\",\n" +
|
||||
" \"customerCode\": \"HFCP\",\n" +
|
||||
" \"payTypeFirst\": \"03\",\n" +
|
||||
" \"convertFlag\": false,\n" +
|
||||
" \"weight\": \"501\",\n" +
|
||||
" \"expectedTime\": \"2024-11-11 12:12:00\",\n" +
|
||||
" \"expectedTime\": \"2025-01-22 18:12:00\",\n" +
|
||||
" \"platformOrderNo\": \"\",\n" +
|
||||
" \"channelOrderNo\": \"\",\n" +
|
||||
" \"orderSource\": \"meituan\",\n" +
|
||||
|
|
@ -109,6 +201,8 @@ public class cityDelivery {
|
|||
/**
|
||||
* 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue