分店异步通知增加关键日志2
This commit is contained in:
parent
3e3a8a32a3
commit
d9d9efd233
@ -879,10 +879,22 @@ public class LklTkServiceImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向拉卡拉申请增加终端
|
||||||
|
*
|
||||||
|
* @param externalCustomerNo 拉卡拉外部商户号
|
||||||
|
* @return 拉卡拉响应数据
|
||||||
|
*/
|
||||||
public JSONObject openMerchantAddTerm(String externalCustomerNo) {
|
public JSONObject openMerchantAddTerm(String externalCustomerNo) {
|
||||||
logger.debug("开始获取拉卡拉商户信息,externalCustomerNo={}", externalCustomerNo);
|
logger.debug("开始向拉卡拉申请增加终端,externalCustomerNo={}", externalCustomerNo);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 参数校验
|
||||||
|
if (StrUtil.isBlank(externalCustomerNo)) {
|
||||||
|
logger.warn("拉卡拉外部商户号不能为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 构造请求参数并加密
|
// 构造请求参数并加密
|
||||||
JSONObject requestParams = new JSONObject();
|
JSONObject requestParams = new JSONObject();
|
||||||
requestParams.set("externalCustomerNo", externalCustomerNo);
|
requestParams.set("externalCustomerNo", externalCustomerNo);
|
||||||
@ -910,7 +922,7 @@ public class LklTkServiceImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String encryptedParams = LakalaUtil.encryptByPrivateKey(requestParams.toString(), privateKey);
|
String encryptedParams = LakalaUtil.encryptByPrivateKey(requestParams.toString(), privateKey);
|
||||||
logger.warn("请求参数加密完成");
|
logger.debug("请求参数加密完成");
|
||||||
|
|
||||||
// 获取认证信息
|
// 获取认证信息
|
||||||
String authorization = getLklTkAuthorization();
|
String authorization = getLklTkAuthorization();
|
||||||
@ -930,28 +942,29 @@ public class LklTkServiceImpl {
|
|||||||
|
|
||||||
// 检查响应结果
|
// 检查响应结果
|
||||||
if (response == null || !"000000".equals(response.getStr("code")) || response.get("data") == null) {
|
if (response == null || !"000000".equals(response.getStr("code")) || response.get("data") == null) {
|
||||||
logger.error("拉卡拉商户信息获取失败,response={}", response);
|
logger.error("向拉卡拉申请增加终端失败,response={}", response);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解密响应数据
|
// 解密响应数据
|
||||||
String publicKey = LakalaUtil.getResourceFile(apiPubKeyPath, false, false);
|
String publicKey = LakalaUtil.getResourceFile(apiPubKeyPath, false, false);
|
||||||
if (StrUtil.isBlank(publicKey)) {
|
if (StrUtil.isBlank(publicKey)) {
|
||||||
logger.error("获取拉卡拉公钥失败,apiPubKeyPath={}", apiPubKeyPath);
|
logger.error("向拉卡拉申请增加终端获取公钥失败,apiPubKeyPath={}", apiPubKeyPath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String responseData = LakalaUtil.decryptByPublicKey(response.getStr("data"), publicKey);
|
String responseData = LakalaUtil.decryptByPublicKey(response.getStr("data"), publicKey);
|
||||||
logger.warn("响应数据解密完成");
|
logger.debug("响应数据解密完成");
|
||||||
|
|
||||||
return JSONUtil.parseObj(responseData);
|
return JSONUtil.parseObj(responseData);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("获取拉卡拉商户信息异常,externalCustomerNo={}", externalCustomerNo, e);
|
logger.error("向拉卡拉申请增加终端异常,externalCustomerNo={}", externalCustomerNo, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商家进件成功,拉卡拉商户号获取商户信息(需加密)
|
* 商家进件成功,拉卡拉商户号获取商户信息(需加密)
|
||||||
*
|
*
|
||||||
@ -960,8 +973,6 @@ public class LklTkServiceImpl {
|
|||||||
* @return 商户信息JSONObject,获取失败返回null
|
* @return 商户信息JSONObject,获取失败返回null
|
||||||
*/
|
*/
|
||||||
public JSONObject openMerchantInfo(String externalCustomerNo, String customerNo) {
|
public JSONObject openMerchantInfo(String externalCustomerNo, String customerNo) {
|
||||||
logger.debug("开始获取拉卡拉商户信息,externalCustomerNo={}, customerNo={}", externalCustomerNo, customerNo);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 构造请求参数并加密(至少需要一个参数)
|
// 构造请求参数并加密(至少需要一个参数)
|
||||||
JSONObject requestParams = new JSONObject();
|
JSONObject requestParams = new JSONObject();
|
||||||
@ -983,12 +994,8 @@ public class LklTkServiceImpl {
|
|||||||
logger.error("获取拉卡拉私钥失败,apiPriKeyPath={}", apiPriKeyPath);
|
logger.error("获取拉卡拉私钥失败,apiPriKeyPath={}", apiPriKeyPath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// logger.info("api 私钥:{}", privateKey);
|
|
||||||
|
|
||||||
logger.info("请求明文参数:{}", requestParams);
|
|
||||||
|
|
||||||
String encryptedParams = LakalaUtil.encryptByPrivateKey(requestParams.toString(), privateKey);
|
String encryptedParams = LakalaUtil.encryptByPrivateKey(requestParams.toString(), privateKey);
|
||||||
// logger.debug("请求参数加密完成");
|
|
||||||
|
|
||||||
// 获取认证信息
|
// 获取认证信息
|
||||||
String authorization = getLklTkAuthorization();
|
String authorization = getLklTkAuthorization();
|
||||||
@ -1001,15 +1008,9 @@ public class LklTkServiceImpl {
|
|||||||
String urlPath = buildLklTkUrl("/htkmerchants/open/merchant/info");
|
String urlPath = buildLklTkUrl("/htkmerchants/open/merchant/info");
|
||||||
JSONObject header = new JSONObject().set("Authorization", authorization);
|
JSONObject header = new JSONObject().set("Authorization", authorization);
|
||||||
JSONObject requestBody = new JSONObject().set("data", encryptedParams);
|
JSONObject requestBody = new JSONObject().set("data", encryptedParams);
|
||||||
logger.info("请求地址:{}", urlPath);
|
|
||||||
logger.info("请求头:{}", header);
|
|
||||||
|
|
||||||
logger.info("请求加密参数:{}", requestBody);
|
|
||||||
|
|
||||||
|
|
||||||
// 发送请求
|
// 发送请求
|
||||||
JSONObject response = RestTemplateHttpUtil.sendLklPostSrc(
|
JSONObject response = RestTemplateHttpUtil.sendLklPostSrc(urlPath, header, requestBody, JSONObject.class);
|
||||||
urlPath, header, requestBody, JSONObject.class);
|
|
||||||
|
|
||||||
// 检查响应结果
|
// 检查响应结果
|
||||||
if (response == null || !"000000".equals(response.getStr("code")) || response.get("data") == null) {
|
if (response == null || !"000000".equals(response.getStr("code")) || response.get("data") == null) {
|
||||||
@ -1025,7 +1026,6 @@ public class LklTkServiceImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String responseData = LakalaUtil.decryptByPublicKey(response.getStr("data"), publicKey);
|
String responseData = LakalaUtil.decryptByPublicKey(response.getStr("data"), publicKey);
|
||||||
logger.info("响应数据解密完成: {}", responseData);
|
|
||||||
|
|
||||||
return JSONUtil.parseObj(responseData);
|
return JSONUtil.parseObj(responseData);
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class ShopMchEntryBranchAdminController extends BaseControllerImpl {
|
|||||||
private ShopMchEntryBranchService shopMchEntryBranchService;
|
private ShopMchEntryBranchService shopMchEntryBranchService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商家申请入驻商城平台
|
* 申请总店的分店
|
||||||
*
|
*
|
||||||
* @param mainStoreBranchReqJSON
|
* @param mainStoreBranchReqJSON
|
||||||
* @return
|
* @return
|
||||||
@ -43,13 +43,24 @@ public class ShopMchEntryBranchAdminController extends BaseControllerImpl {
|
|||||||
@ApiOperation(value = "后台-申请总店的分店", notes = "向拉卡拉申请总店的分店")
|
@ApiOperation(value = "后台-申请总店的分店", notes = "向拉卡拉申请总店的分店")
|
||||||
@RequestMapping(value = "/apply/store", method = RequestMethod.POST)
|
@RequestMapping(value = "/apply/store", method = RequestMethod.POST)
|
||||||
public CommonResult shopMerchEntryList(@RequestBody JSONObject mainStoreBranchReqJSON) {
|
public CommonResult shopMerchEntryList(@RequestBody JSONObject mainStoreBranchReqJSON) {
|
||||||
MainStoreBranchReqDTO mainStoreBranchReq = mainStoreBranchReqJSON.toBean(MainStoreBranchReqDTO.class);
|
try {
|
||||||
Pair<Boolean, String> result = shopMchEntryBranchService.applyMchEntryBranchStore(mainStoreBranchReq);
|
// 参数校验
|
||||||
if (result.getFirst()) {
|
if (mainStoreBranchReqJSON == null) {
|
||||||
return CommonResult.success();
|
return CommonResult.failed("请求参数不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommonResult.failed(result.getSecond());
|
MainStoreBranchReqDTO mainStoreBranchReq = mainStoreBranchReqJSON.toBean(MainStoreBranchReqDTO.class);
|
||||||
|
Pair<Boolean, String> result = shopMchEntryBranchService.applyMchEntryBranchStore(mainStoreBranchReq);
|
||||||
|
|
||||||
|
if (result.getFirst()) {
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CommonResult.failed(result.getSecond());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("申请总店分店异常", e);
|
||||||
|
return CommonResult.failed("系统异常,请稍后重试");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user