细条异步通知回调的流程
This commit is contained in:
parent
56daec15ea
commit
60e4019900
@ -803,7 +803,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
log.debug("商户入网电子合同申请回调通知开始");
|
||||
|
||||
// 验签
|
||||
Pair<Boolean, String> checkResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath);
|
||||
Pair<Boolean, String> checkResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath, false);
|
||||
if (!checkResult.getFirst()) {
|
||||
return JSONUtil.createObj().set("code", "FAIL").set("retMsg", checkResult.getSecond());
|
||||
}
|
||||
@ -1043,7 +1043,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
log.debug("商户分账业务申请异步回调通知开始");
|
||||
|
||||
// 验签
|
||||
Pair<Boolean, String> checkResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath);
|
||||
Pair<Boolean, String> checkResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath, false);
|
||||
if (!checkResult.getFirst()) {
|
||||
return JSONUtil.createObj().set("code", "FAIL").set("retMsg", checkResult.getSecond());
|
||||
}
|
||||
@ -1427,7 +1427,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
|
||||
try {
|
||||
// 1. 验签操作:验证拉卡拉回调签名是否合法
|
||||
Pair<Boolean, String> checkResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath);
|
||||
Pair<Boolean, String> checkResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath, false);
|
||||
if (!checkResult.getFirst()) {
|
||||
log.warn("验签失败: {}", checkResult.getSecond());
|
||||
return JSONUtil.createObj().set("code", "FAIL").set("retMsg", checkResult.getSecond());
|
||||
@ -1968,7 +1968,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
log.debug("分账结果通知异步回调开始");
|
||||
|
||||
// 1. 验签处理
|
||||
Pair<Boolean, String> signCheckResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath);
|
||||
Pair<Boolean, String> signCheckResult = LakalaUtil.chkLklApiNotifySign(request, lklNotifyCerPath, false);
|
||||
if (!signCheckResult.getFirst()) {
|
||||
log.warn("分账通知验签失败: {}", signCheckResult.getSecond());
|
||||
return JSONUtil.createObj()
|
||||
|
||||
@ -627,25 +627,28 @@ public class LklTkServiceImpl {
|
||||
// TODO 新建一个正式的已审核通过的店铺, 新建之前判断是否已经新建过了?
|
||||
// 新建一个正式的已审核通过的店铺,不要抛异常,使用补偿机制,可以独立初始化店铺
|
||||
ShopMchEntry shopEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo);
|
||||
// if (shopEntry != null && !CommonConstant.Enable.equals(shopEntry.getStore_status())) {
|
||||
// String mchMobile = shopEntry.getLogin_mobile();
|
||||
// // 禁止往外抛异常,如果失败使用补偿机制,创建新店
|
||||
// Pair<Integer, String> retPair = shopStoreBaseService.merchEntryInfo2StoreInfo(mchMobile, false);
|
||||
//
|
||||
// if (retPair.getFirst() > 0) {
|
||||
// // 2025-05-17暂停e签宝电子合同生成流程
|
||||
// // 更改合同记录表的店铺id
|
||||
// // esignContractService.updateContractStoreId(mchMobile, retPair.getFirst());
|
||||
// // 填充合同模版表的店铺Id
|
||||
// // esignContractFillingFileService.updateContractFillingStoreId(mchMobile, retPair.getFirst());
|
||||
// // 店铺创建状态已完成
|
||||
// shopMchEntryService.updateMerchEntryStoreStatus(mchMobile, CommonConstant.Enable);
|
||||
// logger.info("商家进件:初始化店铺成功!");
|
||||
// } else {
|
||||
// logger.error("商家进件:初始化店铺失败!");
|
||||
// // throw new ApiException("商家进件:初始化店铺失败!");
|
||||
// }
|
||||
// }
|
||||
if (shopEntry != null && !CommonConstant.Enable.equals(shopEntry.getStore_status())) {
|
||||
String mchMobile = shopEntry.getLogin_mobile();
|
||||
|
||||
try {
|
||||
Pair<Integer, String> retPair = shopStoreBaseService.merchEntryInfo2StoreInfo(mchMobile, false);
|
||||
|
||||
if (retPair.getFirst() > 0) {
|
||||
boolean updateSuccess = shopMchEntryService.updateMerchEntryStoreStatus(mchMobile, CommonConstant.Enable);
|
||||
if (!updateSuccess) {
|
||||
logger.warn("更新店铺状态失败: mchMobile={}", mchMobile);
|
||||
} else {
|
||||
logger.info("商家进件:初始化店铺成功!mchMobile={}", mchMobile);
|
||||
}
|
||||
} else {
|
||||
logger.warn("初始化店铺失败: mchMobile={}, reason={}", mchMobile, retPair.getSecond());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 捕获所有异常,防止事务中断
|
||||
logger.error("初始化店铺时发生异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 1、(电子合同)给商家申请分账功能使用;务必检查是否申请过?申请过忽略
|
||||
// 下一步等待拉卡拉审核通过,再绑定接收方和商家的关系
|
||||
|
||||
@ -410,9 +410,17 @@ public class LakalaUtil {
|
||||
*
|
||||
* @param request
|
||||
* @param lklNotifyCerPath
|
||||
* @param passVerifySign 是否通过验签
|
||||
* @return 验签成功,返回解密后的json字符串,验签失败,返回错误信息
|
||||
*/
|
||||
public static Pair<Boolean, String> chkLklApiNotifySign(HttpServletRequest request, String lklNotifyCerPath) {
|
||||
public static Pair<Boolean, String> chkLklApiNotifySign(HttpServletRequest request, String lklNotifyCerPath, Boolean passVerifySign) {
|
||||
if (passVerifySign) {
|
||||
// 如果不需要验签,直接返回请求体内容
|
||||
String requestBody = getBody(request);
|
||||
log.debug("{} 回调通知 requestbody 参数:{}", request.getRequestURL(), requestBody);
|
||||
return Pair.of(true, requestBody);
|
||||
}
|
||||
|
||||
// 验签
|
||||
String authorization = request.getHeader("Authorization");
|
||||
String requestBody = getBody(request);
|
||||
|
||||
@ -73,6 +73,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
@ -2994,7 +2995,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
* @param allowThrown 是否允许抛出异常?
|
||||
* @return 店铺Id
|
||||
*/
|
||||
@Transactional
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
@Override
|
||||
public Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown) {
|
||||
if (StrUtil.isBlank(mchMobile)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user