feat:退换各自食堂明细
This commit is contained in:
1 parent
ab1397897f
commit
8b0df2572e
10 files changed
+139
-15
No files matched your search
+34
-12
@@ -30,7 +30,8 @@ import java.util.Map;
|
||||
public class PayTest {
|
||||
|
||||
// private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
private final String baseUrl = "http://127.0.0.1:9999";
|
||||
// private final String baseUrl = "http://127.0.0.1:9999";
|
||||
private final String baseUrl = "https://stgl.pj.gov.cn/api";
|
||||
|
||||
private final String walletInfoUrl = "/third/third-pay-api/user-wallet";
|
||||
|
||||
@@ -42,6 +43,8 @@ public class PayTest {
|
||||
|
||||
private final String detailUrl = "/third/third-pay-api/detail";
|
||||
|
||||
private final String appM4KeyProd = "4RSYZNr9bBmEeWPE";
|
||||
|
||||
@Resource
|
||||
private ThirdKeyManageService keyManageService;
|
||||
|
||||
@@ -62,12 +65,12 @@ public class PayTest {
|
||||
public void walletInfo() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843141", config.getFieldKey()));
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843144", appM4KeyProd));
|
||||
// paramsMap.put("signPhone", "8KKubCKESDN5TlUl3i0HaQ==");
|
||||
paramsMap.put("userId", 1875049673022279681L);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
PayBaseVo baseVo = JSONUtil.toBean(res, PayBaseVo.class);
|
||||
if (ObjectUtil.isNotEmpty(baseVo)) {
|
||||
PayWalletInfoVo walletInfo = JSONUtil.toBean(String.valueOf(baseVo.getData()), PayWalletInfoVo.class);
|
||||
@@ -86,7 +89,7 @@ public class PayTest {
|
||||
paramsMap.put("products", null);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -112,7 +115,7 @@ public class PayTest {
|
||||
paramsMap.put("products", carList);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersignDev(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -121,12 +124,12 @@ public class PayTest {
|
||||
public void walletRefund() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("platformOrderId", "1928337501121765377");
|
||||
paramsMap.put("platformOrderId", "1935235239046193154");
|
||||
paramsMap.put("thirdRefundId", System.currentTimeMillis());
|
||||
paramsMap.put("price", "300");
|
||||
paramsMap.put("price", "100");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletRefundUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletRefundUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -145,7 +148,7 @@ public class PayTest {
|
||||
paramsMap.put("orderStatus", "10");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + waterUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + waterUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -154,11 +157,11 @@ public class PayTest {
|
||||
public void detail() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("thirdOrderId", "1748586470745");
|
||||
paramsMap.put("thirdOrderId", "1750231010188");
|
||||
paramsMap.put("thirdRefundId", "");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + detailUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + detailUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -173,7 +176,26 @@ public class PayTest {
|
||||
return keyManageService.get(ThirdKeyTypeEnum.LB);
|
||||
}
|
||||
|
||||
private Map<String, List<String>> apiCountersign(String body) {
|
||||
private Map<String, List<String>> apiCountersignProd(String body) {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
|
||||
String appKey = "CRLAacqYWSpKMHqO";
|
||||
String appSecret = "kwziFRmR5vnxpLpn4JhzLtoKyzsThCLi";
|
||||
|
||||
String timestamp = String.valueOf(Instant.now().getEpochSecond());
|
||||
|
||||
Map<String, List<String>> headers = new HashMap<>();
|
||||
headers.put("timestamp", List.of(timestamp));
|
||||
headers.put("app-key", List.of(appKey));
|
||||
headers.put("biz-type", List.of(config.getBizType()));
|
||||
headers.put("sign", List.of());
|
||||
String signStr = String.format("%s%s%s%s%s", appKey, appSecret, config.getBizType(), timestamp, body);
|
||||
String successSignMd5 = DigestUtils.md5Hex(signStr);
|
||||
headers.put("sign", List.of(successSignMd5));
|
||||
return headers;
|
||||
}
|
||||
|
||||
private Map<String, List<String>> apiCountersignDev(String body) {
|
||||
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
|
||||
|
||||
Reference in new issue
Block a user