From 7f0d3e98977d010107c0ef07fb7551beca17f580 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Sun, 28 Dec 2025 23:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=BA=97=E6=B3=A8=E5=86=8C=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B4=A6=E5=8F=B7=E5=AF=86=E7=A0=81=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/AccountUserBaseController.java | 6 +- .../service/AccountUserBaseService.java | 3 +- .../impl/AccountUserBaseServiceImpl.java | 37 +++- .../common/feignService/AccountService.java | 3 +- .../lakala/service/impl/LklTkServiceImpl.java | 48 ++--- .../store/service/ShopMchEntryService.java | 17 ++ .../impl/ShopMchEntryBranchServiceImpl.java | 193 ++++++++++++------ .../service/impl/ShopMchEntryServiceImpl.java | 35 +++- 8 files changed, 228 insertions(+), 114 deletions(-) diff --git a/mall-account/src/main/java/com/suisung/mall/account/controller/admin/AccountUserBaseController.java b/mall-account/src/main/java/com/suisung/mall/account/controller/admin/AccountUserBaseController.java index 81287903..4e11df41 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/controller/admin/AccountUserBaseController.java +++ b/mall-account/src/main/java/com/suisung/mall/account/controller/admin/AccountUserBaseController.java @@ -233,10 +233,10 @@ public class AccountUserBaseController extends BaseControllerImpl { return CommonResult.success(accountUserBaseService.logout()); } - @ApiOperation("服务间注册商家账号,项目之间远程调用") + @ApiOperation("注册商家账号,项目之间远程调用") @RequestMapping(value = "/merchant/inner-register", method = RequestMethod.POST) - public Pair merchantInnerRegister(@Param("mobile") String mobile) { - return accountUserBaseService.merchantInnerRegister(mobile); + public Pair merchantInnerRegister(@Param("mobile") String mobile, @Param("regPwd") String regPwd) { + return accountUserBaseService.merchantInnerRegister(mobile, regPwd); } } diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java index 3ce174c4..01c8be0b 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java @@ -302,9 +302,10 @@ public interface AccountUserBaseService extends IBaseService { * 商家内部注册(服务之间调用) * * @param mobile 商家手机号 + * @param regPwd 注册密码 * @return Pair 第一个元素表示是否成功,第二个元素表示提示信息 */ - Pair merchantInnerRegister(String mobile); + Pair merchantInnerRegister(String mobile, String regPwd); /** * 批量保存accountInfo diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java b/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java index ffd2ed34..517f83c6 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/impl/AccountUserBaseServiceImpl.java @@ -1715,8 +1715,6 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl smsArgs = new HashMap<>(); smsArgs.put("password", user_password_src); - sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_496910525", smsArgs); // SMS_496910525 + sendSmsMessage(PhoneNumberUtils.cleanPhoneNumber(user_mobile), "SMS_496910525", smsArgs); } //初次注册发送消息 @@ -3221,6 +3218,20 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl 第一个元素表示是否成功,第二个元素表示提示信息 */ @Override - public Pair merchantInnerRegister(String mobile) { + public Pair merchantInnerRegister(String mobile, String regPwd) { log.info("商家内部注册开始,手机号: {}", mobile); // 1. 参数校验 @@ -3305,7 +3320,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl merchantInnerRegister(@Param("mobile") String mobile); + Pair merchantInnerRegister(@Param("mobile") String mobile, @Param("regPwd") String regPwd); + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java index 7e946ef6..882dff3d 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/lakala/service/impl/LklTkServiceImpl.java @@ -789,22 +789,24 @@ public class LklTkServiceImpl { */ public JSONObject updateMerchantNotify(HttpServletRequest request) { try { - logger.info("开始处理拉卡拉商户增终异步通知"); // 解密请求参数 String requestBody = LakalaUtil.getBody(request); - logger.info("拉卡拉商户增终异步通知返回加密数据:{}", requestBody); + logger.info("拉卡拉商户增终异步通知 - 接收原始数据: {}", requestBody); if (StrUtil.isBlank(requestBody)) { + logger.warn("拉卡拉商户增终异步通知 - 请求参数为空"); return new JSONObject().set("code", "400").set("message", "返回参数为空"); } JSONObject reqBodyJSON = JSONUtil.parseObj(requestBody); if (reqBodyJSON.isEmpty() || reqBodyJSON.get("data") == null) { + logger.warn("拉卡拉商户增终异步通知 - 参数格式有误,无法解析: {}", requestBody); return new JSONObject().set("code", "400").set("message", "参数格式有误,无法解析"); } String srcData = reqBodyJSON.getStr("data"); if (StrUtil.isBlank(srcData)) { + logger.warn("拉卡拉商户增终异步通知 - 关键参数为空值"); return new JSONObject().set("code", "400").set("message", "关键参数为空值"); } @@ -812,64 +814,56 @@ public class LklTkServiceImpl { String notifyPubKey = LakalaUtil.getResourceFile(notifyPubKeyPath, false, false); String lklNotifyResp = LakalaUtil.decryptNotifyData(notifyPubKey, srcData); if (StrUtil.isBlank(lklNotifyResp)) { + logger.error("拉卡拉商户增终异步通知 - 数据解密失败,加密数据: {}", srcData); return new JSONObject().set("code", "400").set("message", "数据解密出错!"); } - logger.info("拉卡拉商户增终异步通知返回明文数据:{}", lklNotifyResp); + logger.info("拉卡拉商户增终异步通知 - 解密后数据: {}", lklNotifyResp); // 逻辑处理 JSONObject dataJSON = JSONUtil.parseObj(lklNotifyResp); String reviewPass = dataJSON.getStr("reviewPass"); String merCupNo = dataJSON.getStr("externalCustomerNo"); //拉卡拉外部商户号 - String merInnerNo = dataJSON.getStr("customerNo"); //拉卡拉内部商户号 String termNo = dataJSON.getStr("termNo"); //拉卡拉分配的业务终端号 String reviewRelatedId = dataJSON.getStr("reviewRelatedId"); //拉卡拉分配的业务终端号 + logger.info("拉卡拉商户增终异步通知 - 解析数据完成 - 审核状态: {}, 外部商户号: {}, 终端号: {}, 审核关联ID: {}", + reviewPass, merCupNo, termNo, reviewRelatedId); + // 合并参数校验 if (dataJSON.isEmpty() || StrUtil.isBlank(reviewPass) || - StrUtil.isBlank(merCupNo) || StrUtil.isBlank(reviewRelatedId) || StrUtil.isBlank(termNo)) { + logger.warn("拉卡拉商户增终异步通知 - 参数解析出错,解密数据: {}", lklNotifyResp); return new JSONObject().set("code", "500").set("message", "返回参数缺少关键数据"); } // 更新商户分店入驻表 // status 状态:1-已成功;2-审核未通过;3-未处理;4-待审核; - Integer status = 4; - switch (reviewPass) { - case "PASS": - status = CommonConstant.Enable; - break; - case "UNPASS": - status = CommonConstant.Disable2; - break; - case "PASSING": - status = 3; - break; - case "PREPARE": - status = 4; - break; - default: - status = 4; - - } + Integer status = "PASS".equals(reviewPass) ? CommonConstant.Enable : + "UNPASS".equals(reviewPass) ? CommonConstant.Disable2 : + "PASSING".equals(reviewPass) ? 3 : 4; + logger.info("拉卡拉商户增终异步通知 - 更新分店入驻表,审核关联ID: {}, 状态: {}, 通知响应: {}", reviewRelatedId, status, lklNotifyResp); shopMchEntryBranchService.updateByReviewRelatedId(reviewRelatedId, status, lklNotifyResp); // 给商家总店入驻表增加拉卡拉的商户号和拉卡拉返回的数据 - ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByMerInnerNo(merInnerNo); + ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo, 0L); if (shopMchEntry == null) { - return new JSONObject().put("code", "500").put("message", merInnerNo + "内部商户号入驻信息不存在"); + logger.error("拉卡拉商户增终异步通知 - 商户号入驻信息不存在: {}", merCupNo); + return new JSONObject().put("code", "500").put("message", merCupNo + "商户号入驻信息不存在"); } // 校验审核状态: PREPARE:待提交; PASS:通过; UNPASS:未通过; PASSING:审核中; if (!"PASS".equals(reviewPass)) { - String reviewResult = dataJSON.getStr("reviewResult"); - return new JSONObject().set("code", "FAIL").set("message", "审核未通过:" + reviewResult); + logger.info("拉卡拉商户增终异步通知 - 审核未通过,状态: {}, 结果: {}", reviewPass, dataJSON.getStr("reviewResult")); + return new JSONObject().set("code", "500").set("message", "忽略处理,因审核未通过:" + dataJSON.getStr("reviewResult")); } + logger.info("拉卡拉商户增终异步通知 - 审核通过,开始创建分店入驻记录,审核关联ID: {}, 终端号: {}", reviewRelatedId, termNo); // RMK 拉卡拉增终成功, 创建分店入驻记录,创建商家账号、创建店铺和周边信息 shopMchEntryBranchService.createMchEntryBranchStore(reviewRelatedId, termNo, lklNotifyResp); + logger.info("拉卡拉商户增终异步通知 - 处理完成,审核关联ID: {}", reviewRelatedId); return new JSONObject().set("code", "200").set("message", "处理成功"); } catch (Exception e) { diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java index 5f144589..02f3c29b 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMchEntryService.java @@ -138,6 +138,15 @@ public interface ShopMchEntryService { ShopMchEntry getShopMerchEntryByCondition(String loginMobile, String bizLicenseNumber, Integer... approvalStatusList); + /** + * 根据拉卡拉商户号获取有效的商家入驻申请记录 + * + * @param merCupNo + * @param parentId + * @return + */ + ShopMchEntry getShopMerchEntryByMerCupNo(String merCupNo, Long parentId); + /** * 根据拉卡拉外部商户号获取有效的商家入驻申请记录 * @@ -386,4 +395,12 @@ public interface ShopMchEntryService { ShopMchEntry getLklContractStatusUrl(Integer storeId); ShopMchEntry findOneByLambdaQueryWrapper(LambdaQueryWrapper query); + + /** + * 根据商户入驻Id删除商户入驻记录 + * + * @param mchId 商户入驻Id + * @return 删除结果,true为成功,false为失败 + */ + Boolean removeByMchId(Long mchId); } \ No newline at end of file diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryBranchServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryBranchServiceImpl.java index 5b5f80ea..6a605729 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryBranchServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryBranchServiceImpl.java @@ -191,13 +191,27 @@ public class ShopMchEntryBranchServiceImpl extends BaseServiceImpl entryQueryWrapper = new LambdaQueryWrapper<>(); entryQueryWrapper.eq(ShopMchEntry::getStore_id, mainStoreBranchReq.getParent_store_id()) .eq(ShopMchEntry::getApproval_status, CommonConstant.MCH_APPR_STA_PASS) @@ -205,79 +219,57 @@ public class ShopMchEntryBranchServiceImpl extends BaseServiceImpl nameQueryWrapper = new LambdaQueryWrapper<>(); nameQueryWrapper.eq(ShopStoreBase::getStore_name, mainStoreBranchReq.getStore_name()); - ShopStoreBase existingStore = shopStoreBaseService.getOne(nameQueryWrapper); - if (existingStore != null) { - log.warn("店铺名称已存在: {}", mainStoreBranchReq.getStore_name()); + if (shopStoreBaseService.getOne(nameQueryWrapper) != null) { return Pair.of(false, "店铺名称已存在"); } - log.debug("店铺名称检查通过"); // 4. 检查分店登录手机号是否已经注册过商户 - log.debug("检查手机号是否已注册商户: {}", mainStoreBranchReq.getLogin_mobile()); Integer status = accountService.isMerchantExists(mainStoreBranchReq.getLogin_mobile()); if (CheckUtil.isEmpty(status)) { - log.error("调用账户服务检查商户信息失败,手机号: {}", mainStoreBranchReq.getLogin_mobile()); return Pair.of(false, "检查商户信息失败!"); } if (CommonConstant.Enable.equals(status)) { - log.warn("手机号商户已被注册: {}", mainStoreBranchReq.getLogin_mobile()); - return Pair.of(false, "手机号商户已被注册"); + return Pair.of(false, "手机号已被其他商家注册"); } - log.debug("手机号检查通过"); // 5. 检查分店终端号是否已经申请或申请中 - log.debug("检查分店终端号是否已申请或申请中,拉卡拉内部商户号: {}", mchEntry.getLkl_mer_inner_no()); LambdaQueryWrapper branchQueryWrapper = new LambdaQueryWrapper<>(); branchQueryWrapper.eq(ShopMchEntryBranch::getLkl_mer_cup_no, mchEntry.getLkl_mer_inner_no()) .in(ShopMchEntryBranch::getStatus, Arrays.asList(1, 3)); // 1-申请中,3-可能的其他状态 - long existingBranchCount = count(branchQueryWrapper); - if (existingBranchCount > 0) { - log.info("分店终端号已申请或申请中,拉卡拉内部商户号: {},已存在申请数量: {}", - mchEntry.getLkl_mer_inner_no(), existingBranchCount); + if (count(branchQueryWrapper) > 0) { return Pair.of(false, "分店终端号已申请或申请中,请等待审核"); } - log.debug("终端号检查通过"); // 6. 调用拉卡拉接口创建商户终端 - log.info("调用拉卡拉接口创建商户终端,主店拉卡拉商户号: {}", mchEntry.getLkl_mer_cup_no()); JSONObject lklResp = lklTkService.openMerchantAddTerm(mchEntry.getLkl_mer_cup_no()); if (lklResp == null || StrUtil.isBlank(lklResp.getStr("reviewRelatedId"))) { log.error("调用拉卡拉接口创建商户终端失败,主店拉卡拉商户号: {}", mchEntry.getLkl_mer_cup_no()); return Pair.of(false, "分店提交申请失败"); } - String reviewRelatedId = lklResp.getStr("reviewRelatedId"); - log.info("拉卡拉接口调用成功,审核关联号: {}", reviewRelatedId); // 7. 保存商户入驻申请信息 - log.debug("开始保存商户入驻申请信息"); ShopMchEntryBranch shopMchEntryBranch = new ShopMchEntryBranch(); shopMchEntryBranch.setLkl_mer_cup_no(mchEntry.getLkl_mer_cup_no()); - shopMchEntryBranch.setReview_related_id(reviewRelatedId); + shopMchEntryBranch.setReview_related_id(lklResp.getStr("reviewRelatedId")); shopMchEntryBranch.setLkl_req(JSONUtil.toJsonStr(mainStoreBranchReq)); shopMchEntryBranch.setLkl_reps(JSONUtil.toJsonStr(lklResp)); - Boolean isSuccess = saveShopMchEntryBranch(shopMchEntryBranch); - if (!isSuccess) { - log.error("保存商户入驻申请信息失败,审核关联号: {}", reviewRelatedId); + if (!saveShopMchEntryBranch(shopMchEntryBranch)) { return Pair.of(false, "分店提交申请失败"); } - log.info("分店商户入驻申请创建成功,审核关联号: {}", lklResp.getStr("reviewRelatedId")); + log.info("分店商户入驻申请创建成功,审核关联号: {}", lklResp.getStr("reviewRelatedId")); return Pair.of(true, "分店提交申请成功"); } catch (Exception e) { @@ -301,7 +293,6 @@ public class ShopMchEntryBranchServiceImpl extends BaseServiceImpl registerResult = accountService.merchantInnerRegister(mainStoreBranchReq.getLogin_mobile()); + Pair registerResult = accountService.merchantInnerRegister(mainStoreBranchReq.getLogin_mobile(), mainStoreBranchReq.getPassword()); if (!registerResult.getFirst()) { - log.error("分店商户注册账号失败,手机号: {},错误信息: {}", mainStoreBranchReq.getLogin_mobile(), registerResult.getSecond()); throw new ApiException("分店商户注册账号失败:" + registerResult.getSecond()); } - log.debug("分店商户注册账号成功,手机号: {}", mainStoreBranchReq.getLogin_mobile()); - // 9. 创建分店店铺信息,创建分店店铺周边信息(公司、员工、权限等) - Pair storeResult = shopStoreBaseService.covMerchEntryInfo2StoreInfo(shopMchEntry.getId(), parentStoreId, true); + // 9. 创建分店店铺信息 + Pair storeResult = shopStoreBaseService.covMerchEntryInfo2StoreInfo(shopMchEntry.getId(), Convert.toInt(parentShopMchEntry.getStore_id(), 0), true); if (storeResult == null || storeResult.getFirst() <= 0) { - log.error("创建分店店铺信息失败,分店入驻ID: {},错误信息: {}", shopMchEntry.getId(), - storeResult != null ? storeResult.getSecond() : "返回结果为空"); throw new ApiException("创建分店店铺信息失败: " + (storeResult != null ? storeResult.getSecond() : "未知错误")); } - log.info("分店商户入驻处理成功,分店入驻ID: {}, 店铺ID: {}", shopMchEntry.getId(), storeResult.getFirst()); + log.info("分店商户入驻处理成功,分店入驻ID: {}, 店铺ID: {}", shopMchEntry.getId(), storeResult.getFirst()); return Pair.of(true, "分店商户入驻处理成功"); } catch (Exception e) { @@ -402,4 +374,97 @@ public class ShopMchEntryBranchServiceImpl extends BaseServiceImpl cleanMchEntryBranchStore(String lklMerCupNo, String lklTermNo) { + log.info("开始清理分店商户入驻信息,拉卡拉商户号: {}, 终端号: {}", lklMerCupNo, lklTermNo); + + // 1. 参数校验 + if (StrUtil.isBlank(lklMerCupNo) || StrUtil.isBlank(lklTermNo)) { + log.warn("清理分店商户入驻参数校验失败,lklMerCupNo: {}, lklTermNo: {}", lklMerCupNo, lklTermNo); + return Pair.of(false, "参数不能为空"); + } + + try { + log.debug("步骤1 - 查询分店入驻记录,拉卡拉商户号: {}, 终端号: {}", lklMerCupNo, lklTermNo); + // 2. 查询分店入驻记录 + LambdaQueryWrapper entryQueryWrapper = new LambdaQueryWrapper<>(); + entryQueryWrapper.eq(ShopMchEntry::getLkl_mer_cup_no, lklMerCupNo) + .eq(ShopMchEntry::getLkl_term_no, lklTermNo); + ShopMchEntry shopMchEntry = shopMchEntryService.findOneByLambdaQueryWrapper(entryQueryWrapper); + + if (shopMchEntry == null) { + log.warn("未找到对应的分店入驻记录,拉卡拉商户号: {}, 终端号: {}", lklMerCupNo, lklTermNo); + return Pair.of(false, "未找到对应的分店入驻记录"); + } + log.debug("步骤1 - 找到分店入驻记录,分店ID: {}, 店铺名称: {}", shopMchEntry.getId(), shopMchEntry.getStore_name()); + + log.debug("步骤2 - 查询分店店铺信息,分店入驻ID: {}", shopMchEntry.getId()); + // 3. 查询分店店铺信息 + LambdaQueryWrapper storeQueryWrapper = new LambdaQueryWrapper<>(); + storeQueryWrapper.eq(ShopStoreBase::getStore_id, shopMchEntry.getStore_id()); + ShopStoreBase shopStore = shopStoreBaseService.getOne(storeQueryWrapper); + + if (shopStore == null) { + log.warn("未找到对应的分店店铺信息,分店入驻ID: {}", shopMchEntry.getId()); + } else { + log.debug("步骤2 - 找到分店店铺信息,店铺ID: {}, 店铺名称: {}", shopStore.getStore_id(), shopStore.getStore_name()); + } + + log.debug("步骤3 - 删除分店店铺信息,店铺ID: {}", shopStore != null ? shopStore.getStore_id() : "null"); + // 4. 删除分店店铺信息 + if (shopStore != null) { + boolean deleteStoreResult = shopStoreBaseService.removeById(shopStore.getStore_id()); + if (!deleteStoreResult) { + log.error("删除分店店铺信息失败,店铺ID: {}", shopStore.getStore_id()); + throw new ApiException("删除分店店铺信息失败"); + } + log.debug("步骤3 - 删除分店店铺信息成功,店铺ID: {}", shopStore.getStore_id()); + } + + log.debug("步骤4 - 删除分店入驻记录,分店ID: {}", shopMchEntry.getId()); + // 5. 删除分店入驻记录 + boolean deleteEntryResult = shopMchEntryService.removeByMchId(shopMchEntry.getId()); + if (!deleteEntryResult) { + log.error("删除分店入驻记录失败,分店ID: {}", shopMchEntry.getId()); + throw new ApiException("删除分店入驻记录失败"); + } + log.debug("步骤4 - 删除分店入驻记录成功,分店ID: {}", shopMchEntry.getId()); + + log.debug("步骤5 - 查询分店入驻申请记录,拉卡拉商户号: {}, 终端号: {}", lklMerCupNo, lklTermNo); + // 6. 查询分店入驻申请记录 + LambdaQueryWrapper branchQueryWrapper = new LambdaQueryWrapper<>(); + branchQueryWrapper.eq(ShopMchEntryBranch::getLkl_mer_cup_no, lklMerCupNo) + .eq(ShopMchEntryBranch::getLkl_term_no, lklTermNo); + ShopMchEntryBranch shopMchEntryBranch = getOne(branchQueryWrapper); + + if (shopMchEntryBranch != null) { + log.debug("步骤5 - 找到分店入驻申请记录,审核关联ID: {}", shopMchEntryBranch.getReview_related_id()); + + log.debug("步骤6 - 删除分店入驻申请记录,审核关联ID: {}", shopMchEntryBranch.getReview_related_id()); + // 7. 删除分店入驻申请记录 + boolean deleteBranchResult = removeById(shopMchEntryBranch.getId()); + if (!deleteBranchResult) { + log.error("删除分店入驻申请记录失败,审核关联ID: {}", shopMchEntryBranch.getReview_related_id()); + throw new ApiException("删除分店入驻申请记录失败"); + } + log.debug("步骤6 - 删除分店入驻申请记录成功,审核关联ID: {}", shopMchEntryBranch.getReview_related_id()); + } + + log.info("分店商户入驻信息清理完成,拉卡拉商户号: {}, 终端号: {}", lklMerCupNo, lklTermNo); + return Pair.of(true, "分店商户入驻信息清理成功"); + + } catch (Exception e) { + log.error("清理分店商户入驻信息时发生异常,拉卡拉商户号: {}, 终端号: {}", lklMerCupNo, lklTermNo, e); + throw new ApiException("清理分店商户入驻信息时发生异常,拉卡拉商户号: " + lklMerCupNo + ", 终端号: " + lklTermNo); + } + } + + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java index 8b6bfee6..55e77112 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMchEntryServiceImpl.java @@ -1319,16 +1319,21 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ShopMchEntry::getLkl_mer_cup_no, merCupNo) - .eq(ShopMchEntry::getParent_id, 0L) // 总店 .eq(ShopMchEntry::getStatus, CommonConstant.Enable) .orderByAsc(ShopMchEntry::getId); + + if (parentId != null && parentId >= 0) { + queryWrapper.eq(ShopMchEntry::getParent_id, parentId); + } + ShopMchEntry record = findOne(queryWrapper); if (ObjectUtil.isEmpty(record)) { return null; @@ -1337,20 +1342,25 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("lkl_mer_inner_no", merInnerNo).eq("status", CommonConstant.Enable).orderByAsc("id"); - List recordList = list(queryWrapper); - if (CollectionUtil.isEmpty(recordList)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ShopMchEntry::getLkl_mer_inner_no, merInnerNo).eq(ShopMchEntry::getStatus, CommonConstant.Enable).orderByAsc(ShopMchEntry::getId); + ShopMchEntry record = findOne(queryWrapper); + if (ObjectUtil.isEmpty(record)) { return null; } - return recordList.get(0); + return record; } /** @@ -2656,6 +2666,17 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl