Commit f7ee6da8 authored by Allen Chen's avatar Allen Chen

commit

parent 1044b603
...@@ -51,8 +51,15 @@ public class PddLocalController { ...@@ -51,8 +51,15 @@ public class PddLocalController {
private static final String PROVIDER_CODE = "HAIJI_KR"; private static final String PROVIDER_CODE = "HAIJI_KR";
private static final String WAREHOUSE_CODE = "HJJY001"; private static final String WAREHOUSE_CODE = "HJJY001";
private static final String CLIENT_ID = "d0217707e1194c46b57e696ac7619a06"; // 测试
private static final String CLIENT_SECRET = "a5aba84483d8387030899f01276b06a194942470"; // private static final String CLIENT_ID = "d0217707e1194c46b57e696ac7619a06";
// private static final String CLIENT_SECRET = "a5aba84483d8387030899f01276b06a194942470";
// 正式
private static final String CLIENT_ID = "8f5f3f9c92e847b2894fc9c0afce3d61";
private static final String CLIENT_SECRET = "281d79ad5117d20a51efb9e7b0d5f7ee336399b0";
@Resource @Resource
private CollectReceiverDetailImpl collectReceiverDetailImpl; private CollectReceiverDetailImpl collectReceiverDetailImpl;
@Resource @Resource
...@@ -268,6 +275,8 @@ public class PddLocalController { ...@@ -268,6 +275,8 @@ public class PddLocalController {
if(mailNoResponse.getStatus() != StatusEnum.INBOUND.getCode()){ if(mailNoResponse.getStatus() != StatusEnum.INBOUND.getCode()){
//重复入库 //重复入库
notifyRequest.setPackageQuantity(num); // 已入库数量 notifyRequest.setPackageQuantity(num); // 已入库数量
mailNoResponse.setEnterTime(timeTool.getNowDate());
mailNoResponse.setStatus(StatusEnum.INBOUND.getCode());
}else { }else {
......
...@@ -102,7 +102,7 @@ public class PddOpenController { ...@@ -102,7 +102,7 @@ public class PddOpenController {
log.info("Request:\n{}", body); log.info("Request:\n{}", body);
try { try {
if (!PddSignTool.verifySignFromBody(body, "a5aba84483d8387030899f01276b06a194942470", pdd_sign)) { if (!PddSignTool.verifySignFromBody(body, "281d79ad5117d20a51efb9e7b0d5f7ee336399b0", pdd_sign)) {
log.error("验签失败"); log.error("验签失败");
} }
switch (requestParam.getType()) { switch (requestParam.getType()) {
......
...@@ -53,7 +53,6 @@ public class PddGDUtil { ...@@ -53,7 +53,6 @@ public class PddGDUtil {
request.setTimestamp(time); request.setTimestamp(time);
request.setSign(PddSignTool.generateSign(request, CLIENT_SECRET)); request.setSign(PddSignTool.generateSign(request, CLIENT_SECRET));
String resp = PddHttpTool.sendJsonPostGD(request); String resp = PddHttpTool.sendJsonPostGD(request);
log.info("resp = {}", resp);
return JSON.parseObject(resp); return JSON.parseObject(resp);
} }
} }
...@@ -43,16 +43,30 @@ public class PddHttpTool { ...@@ -43,16 +43,30 @@ public class PddHttpTool {
public static String sendJsonPost(Object requestObj) { public static String sendJsonPost(Object requestObj) {
log.info("REQ:{}", JSONObject.toJSONString(requestObj)); log.info("REQ:{}", JSONObject.toJSONString(requestObj));
// 自动序列化 requestObj 为 JSON,并设置 Content-Type: application/json // 自动序列化 requestObj 为 JSON,并设置 Content-Type: application/json
HttpHeaders headers = new HttpHeaders();
headers.set("X-Canary-Staging", "staging");
headers.add("Content-Type", "application/json;charset=UTF-8");
HttpEntity<String> requestEntity = new HttpEntity<>(JSONObject.toJSONString(requestObj), headers);
// 2. 封装请求实体(参数 + 头信息)
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> resp = restTemplate.postForEntity(URL, requestObj, String.class); ResponseEntity<String> resp = restTemplate.postForEntity(URL, requestEntity, String.class);
log.info("RESP:{}", resp.getBody());
return resp.getBody(); return resp.getBody();
} }
public static String sendJsonPostGD(Object requestObj) { public static String sendJsonPostGD(Object requestObj) {
log.info("REQ:{}", JSONObject.toJSONString(requestObj)); log.info("REQ:{}", JSONObject.toJSONString(requestObj));
// 自动序列化 requestObj 为 JSON,并设置 Content-Type: application/json // 自动序列化 requestObj 为 JSON,并设置 Content-Type: application/json
HttpHeaders headers = new HttpHeaders();
headers.set("X-Canary-Staging", "staging");
headers.add("Content-Type", "application/json;charset=UTF-8");
HttpEntity<String> requestEntity = new HttpEntity<>(JSONObject.toJSONString(requestObj), headers);
// 2. 封装请求实体(参数 + 头信息)
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> resp = restTemplate.postForEntity(URL_GD, requestObj, String.class); ResponseEntity<String> resp = restTemplate.postForEntity(URL_GD, requestEntity, String.class);
log.info("RESP:{}", resp.getBody());
return resp.getBody(); return resp.getBody();
} }
} }
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.2.222:3306/pdd_api?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT # url: jdbc:mysql://192.168.2.222:3306/pdd_api?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT
username: root # username: root
password: root # password: root
# url: jdbc:mysql://lyhj-mysql.mysql.rds.aliyuncs.com:3306/pdd_test?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT url: jdbc:mysql://lyhj-mysql.mysql.rds.aliyuncs.com:3306/pdd_prod?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT
# username: pdd username: pdd
# password: pdd123 password: pdd123
hikari: hikari:
minimum-idle: 5 # 最小空闲连接数 minimum-idle: 5 # 最小空闲连接数
maximum-pool-size: 10 # 最大活跃连接数 maximum-pool-size: 10 # 最大活跃连接数
......
...@@ -22,7 +22,7 @@ public class CommonTest { ...@@ -22,7 +22,7 @@ public class CommonTest {
private static final String CLIENT_ID = "8f5f3f9c92e847b2894fc9c0afce3d61"; private static final String CLIENT_ID = "8f5f3f9c92e847b2894fc9c0afce3d61";
private static final String CLIENT_SECRET = "281d79ad5117d20a51efb9e7b0d5f7ee336399b0"; private static final String CLIENT_SECRET = "281d79ad5117d20a51efb9e7b0d5f7ee336399b0";
private String firstLogisticsOrderCode = "PC25110416466837504037527"; private String firstLogisticsOrderCode = "PC25110715653142530023271";
private static String getNowString() { private static String getNowString() {
Date date = new Date(); Date date = new Date();
...@@ -92,8 +92,8 @@ public class CommonTest { ...@@ -92,8 +92,8 @@ public class CommonTest {
*/ */
@Test @Test
public void receive() { public void receive() {
String mailNo = "773846466954492"; String mailNo = "SF3270717746148";
String expressCode = "STO"; String expressCode = "SF";
String action = "warehouse_sign"; String action = "warehouse_sign";
PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest(); PddServiceConsoFirstBizActionNotifyRequest notifyRequest = new PddServiceConsoFirstBizActionNotifyRequest();
notifyRequest.setProviderCode(PROVIDER_CODE); notifyRequest.setProviderCode(PROVIDER_CODE);
...@@ -198,8 +198,8 @@ public class CommonTest { ...@@ -198,8 +198,8 @@ public class CommonTest {
@Test @Test
public void inBound() { public void inBound() {
String mailNo = "773846466954492"; String mailNo = "SF3270717746148";
String expressCode = "STO"; String expressCode = "SF";
PddServiceConsoInboundRequest notifyRequest = new PddServiceConsoInboundRequest(); PddServiceConsoInboundRequest notifyRequest = new PddServiceConsoInboundRequest();
...@@ -220,8 +220,8 @@ public class CommonTest { ...@@ -220,8 +220,8 @@ public class CommonTest {
notifyRequest.getPackageInfo().setLength(30L); notifyRequest.getPackageInfo().setLength(30L);
notifyRequest.getPackageInfo().setWidth(30L); notifyRequest.getPackageInfo().setWidth(30L);
notifyRequest.getPackageInfo().setHeight(30L); notifyRequest.getPackageInfo().setHeight(30L);
notifyRequest.getPackageInfo().setWeight(600L); notifyRequest.getPackageInfo().setWeight(1000L);
notifyRequest.getPackageInfo().setActualWeight(600L); notifyRequest.getPackageInfo().setActualWeight(1000L);
notifyRequest.getPackageInfo().setGoodsType("NORMAL"); notifyRequest.getPackageInfo().setGoodsType("NORMAL");
notifyRequest.setResult(new PddServiceConsoInboundRequest.Result()); notifyRequest.setResult(new PddServiceConsoInboundRequest.Result());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment