入驻新增店铺 优化

This commit is contained in:
Jack 2025-08-28 01:01:44 +08:00
parent 75e04de658
commit 5a2f5eff48
3 changed files with 72 additions and 35 deletions

View File

@ -621,6 +621,7 @@ public class LklTkServiceImpl {
// RMK 拉卡拉进价提交成功,边处理周边的数据边等待审核异步通知
// 更新已进件成功的商户号和设备号
Boolean success = shopMchEntryService.updateMerchEntryLklAuditStatusByLklMerCupNo(
merInnerNo, merCupNo, termNos, CommonConstant.Enable, null, data);

View File

@ -39,7 +39,7 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
Map contents();
Map getStoreList(Integer page, Integer rows,Map<String,Object> params);
Map getStoreList(Integer page, Integer rows, Map<String, Object> params);
Map listsStoreCategory();
@ -172,6 +172,14 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
*/
Boolean isExistsByStoreName(String storeName);
/**
* 根据店铺名称查询店铺信息
*
* @param storeName
* @return
*/
ShopStoreBase findOneByStoreName(String storeName);
/**
* 更新店铺微信二维码太阳码
*

View File

@ -3107,43 +3107,53 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
return Pair.of(0, "入驻商家自增Id不能为空");
}
ShopMchEntry shopMchEntry = shopMchEntryService.shopMerchEntryById(mchId);
if (shopMchEntry == null) {
logger.error("生成店铺:入驻信息不能为空");
return Pair.of(0, "入驻信息不能为空");
}
// TODO 判断要不要给入驻的企业法人手机小微联系人手机注册一个账号
// 从绑定关系中获取商家注册账号信息
Integer userId = accountService.getUserBindConnectUserIdByCondition(shopMchEntry.getLogin_mobile(), BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
if (userId == null) {
logger.error("生成店铺:该商家申请人手机{}未注册账号", shopMchEntry.getLogin_mobile());
return Pair.of(0, "该商家申请人手机未注册账号!");
}
// 入驻时已经检查过店铺名称了此处忽略
// if (isExistsByStoreName(shopMchEntry.getStore_name())) {
// logger.error("生成店铺:店铺名称已存在");
// return Pair.of(0, "店铺名称已存在,请使用另一名称");
// }
// 校验店铺状态
if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
return Pair.of(0, "操作失败,检查店铺是否已创建完成?");
}
if (!CommonConstant.Enable.equals(shopMchEntry.getStore_status())
&& !CommonConstant.Enable.equals(shopMchEntry.getHas_ec_signed())
&& !CommonConstant.Enable.equals(shopMchEntry.getHas_apply_mer())) {
return Pair.of(0, "前置条件未满足,请检查电子合同或申请进件状态");
}
try {
ShopMchEntry shopMchEntry = shopMchEntryService.shopMerchEntryById(mchId);
if (shopMchEntry == null) {
logger.error("生成店铺:入驻信息不能为空");
return Pair.of(0, "入驻信息不能为空");
}
// 校验店铺状态
if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
return Pair.of(0, "操作失败,检查店铺是否已创建完成?");
}
// 如果 还没有签署入网电子合同且没有进件成功则提示前置条件未满足
if (!CommonConstant.Enable.equals(shopMchEntry.getHas_ec_signed())
&& !CommonConstant.Enable.equals(shopMchEntry.getHas_apply_mer())) {
return Pair.of(0, "请先签署电子合同和商家进件,再创建店铺。");
}
// TODO 判断要不要给入驻的企业法人手机小微联系人手机注册一个账号
// 从绑定关系中获取入驻商家注册账号信息
Integer userId = accountService.getUserBindConnectUserIdByCondition(shopMchEntry.getLogin_mobile(), BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
if (userId == null) {
logger.error("生成店铺:{}手机未注册商家账号", shopMchEntry.getLogin_mobile());
return Pair.of(0, "手机未注册商家账号!");
}
// 入驻时已经检查过店铺名称了此处忽略
ShopStoreBase shopStoreBase = findOneByStoreName(shopMchEntry.getStore_name());
if (shopStoreBase != null
&& StrUtil.isNotBlank(shopStoreBase.getLkl_merchant_no())
&& !shopStoreBase.getStore_id().equals(shopMchEntry.getStore_id())) {
// 如果店铺名称已存在且店铺已经进件且不等于当前入驻商家的店铺Id提示店铺名称已存在
logger.error("生成店铺:店铺名称已存在");
return Pair.of(0, "店铺名称已存在,请使用另一名称");
}
// 新增 shop_store_baseshop_store_infoshop_store_company, shop_store_employee 待补充
// shop_store_base
ShopStoreBase shopStoreBase = new ShopStoreBase();
if (shopStoreBase == null) {
shopStoreBase = new ShopStoreBase();
}
shopStoreBase.setUser_id(userId); // 店铺管理员用户Id
shopStoreBase.setStore_name(shopMchEntry.getStore_name());
shopStoreBase.setStore_category_id(shopMchEntry.getBiz_category()); // 重要店铺分类id对应 shop_base_store_category 表的分类
@ -3573,7 +3583,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
@Override
public Boolean isExistsByStoreName(String storeName) {
if (StrUtil.isBlank(storeName)) {
return false;
return true;
}
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper<>();
@ -3582,6 +3592,24 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
return count(queryWrapper) > 0;
}
/**
* 根据店铺名称查询店铺信息
*
* @param storeName
* @return
*/
@Override
public ShopStoreBase findOneByStoreName(String storeName) {
if (StrUtil.isBlank(storeName)) {
return null;
}
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_name", storeName).orderByAsc("store_id");
return findOne(queryWrapper);
}
/**
* 更新店铺微信二维码太阳码
*