商家入驻,逻辑修改,改成 mchid 为主,执行进件和生成电子合同。

This commit is contained in:
Jack 2025-08-06 00:10:25 +08:00
parent 0dbe528ad4
commit 13c6df8126
5 changed files with 36 additions and 34 deletions

View File

@ -1378,6 +1378,9 @@ public class LakalaApiServiceImpl implements LakalaApiService {
// 2. 解析回调参数
JSONObject paramsJSON = JSONUtil.parseObj(checkResult.getSecond());
log.info("##### 商家绑定接收方回调参数:{} ####", paramsJSON);
if (paramsJSON == null || StrUtil.isBlank(paramsJSON.getStr("applyId"))) {
// https://o.lakala.com/#/home/document/detail?id=386 返回的数据结果有歧义需处理
paramsJSON = paramsJSON.getJSONObject("respData");

View File

@ -523,7 +523,7 @@ public class LklTkServiceImpl {
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), CommonConstant.MCH_APPR_STA_LKL_NOPASS, "进件失败:" + errMsg);
return Pair.of(false, "进件失败:" + errMsg);
return Pair.of(false, "提交进件失败:" + errMsg);
}
// 更改入驻记录的拉卡拉内部商户号和进件请求参数
@ -533,14 +533,14 @@ public class LklTkServiceImpl {
if (!success) {
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), CommonConstant.MCH_APPR_STA_LKL_NOPASS, "进件成功,但更新商户号失败!");
return Pair.of(false, "请求进件成功,但更新商户号失败!");
return Pair.of(false, "提交进件成功,但更新商户号失败!");
}
} catch (Exception e) {
logger.error("拉卡拉进件异常:{}", e.getMessage());
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), CommonConstant.MCH_APPR_STA_LKL_NOPASS, "进件失败:" + e.getMessage());
return Pair.of(false, "进件失败:" + e.getMessage());
return Pair.of(false, "提交进件失败:" + e.getMessage());
}
@ -646,15 +646,15 @@ public class LklTkServiceImpl {
// 新建一个正式的已审核通过的店铺不要抛异常使用补偿机制可以独立初始化店铺
ShopMchEntry shopEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo);
if (shopEntry != null && !CommonConstant.Enable.equals(shopEntry.getStore_status())) {
String mchMobile = shopEntry.getLogin_mobile();
Long mchId = shopEntry.getId();
// 包含了更改 merchEntryInfo 的状态
Pair<Integer, String> retPair = shopStoreBaseService.covMerchEntryInfo2StoreInfo(mchMobile, false);
// 重要包含了更改 merchEntryInfo 的状态 TODO 用法人小微个人的手机号注册商家账号作为店铺的管理员
Pair<Integer, String> retPair = shopStoreBaseService.covMerchEntryInfo2StoreInfo(mchId, false);
if (retPair.getFirst() <= 0) {
logger.error("初始化店铺失败: mchMobile={}, reason={}", mchMobile, retPair.getSecond());
logger.error("初始化店铺失败: mchId={}, reason={}", mchId, retPair.getSecond());
}
logger.info("初始化店铺成功mchMobile={}", mchMobile);
logger.info("初始化店铺成功mchId={}", mchId);
// boolean updateSuccess = shopMchEntryService.updateMulStatus(mchMobile, "", 0, 0, 1, 0, 0, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
// if (!updateSuccess) {

View File

@ -273,7 +273,7 @@ public class ShopStoreBaseController extends BaseControllerImpl {
@ApiOperation(value = "商家入驻资料转成店铺", notes = "商家入驻资料转成店铺")
@RequestMapping(value = "/mchinfo/to/storeinfo", method = RequestMethod.POST)
public CommonResult merchEntryInfo2StoreInfo(@RequestBody JSONObject jsonParam) {
Pair<Integer, String> result = shopStoreBaseService.merchEntryInfo2StoreInfo(jsonParam.getStr("mchMobile"), true);
Pair<Integer, String> result = shopStoreBaseService.merchEntryInfo2StoreInfo(jsonParam.getLong("mchId"), true);
if (result.getFirst().equals(0)) {
return CommonResult.failed(result.getSecond());
}

View File

@ -149,20 +149,20 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
/**
* 重要入驻审批通过并且合同盖章完结之后把商家入驻信息转换成店铺信息正式生成店铺所需的数据
*
* @param mchMobile
* @param mchId
* @param allowThrown 是否允许抛出异常
* @return 店铺Id
*/
Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown);
Pair<Integer, String> merchEntryInfo2StoreInfo(Long mchId, Boolean allowThrown);
/**
* (重要入驻审批通过并且合同盖章完结之后把商家入驻信息转换成店铺信息正式生成店铺所需的数据
*
* @param mchMobile
* @param mchId
* @param allowThrown 是否允许抛出异常
* @return
*/
Pair<Integer, String> covMerchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown);
Pair<Integer, String> covMerchEntryInfo2StoreInfo(Long mchId, Boolean allowThrown);
/**
* 根据店铺名称判断店铺是否存在

View File

@ -3024,43 +3024,46 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
* 重要入驻审批通过并且合同盖章完结之后把商家入驻信息转换成店铺信息正式生成店铺所需的数据
* 独立新的事务执行
*
* @param mchMobile
* @param mchId
* @param allowThrown 是否允许抛出异常
* @return 店铺Id
*/
@Transactional
@Override
public Pair<Integer, String> merchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown) {
return covMerchEntryInfo2StoreInfo(mchMobile, allowThrown);
public Pair<Integer, String> merchEntryInfo2StoreInfo(Long mchId, Boolean allowThrown) {
return covMerchEntryInfo2StoreInfo(mchId, allowThrown);
}
/**
* 重要入驻审批通过并且合同盖章完结之后把商家入驻信息转换成店铺信息正式生成店铺所需的数据
* 重要入驻审批通过并且合同盖章完结之后把商家入驻信息转换成店铺信息正式生成店铺所需的数据
*
* @param mchMobile
* @param mchId
* @param allowThrown 是否允许抛出异常
* @return
*/
@Override
public Pair<Integer, String> covMerchEntryInfo2StoreInfo(String mchMobile, Boolean allowThrown) {
if (StrUtil.isBlank(mchMobile)) {
logger.error("生成店铺:商家手机号不能为空");
return Pair.of(0, "商家手机不能为空");
public Pair<Integer, String> covMerchEntryInfo2StoreInfo(Long mchId, Boolean allowThrown) {
// TODO 用法人小微个人的手机号注册商家账号作为店铺的管理员
if (ObjectUtil.isEmpty(mchId)) {
logger.error("生成店铺入驻商家自增Id不能为空");
return Pair.of(0, "入驻商家自增Id不能为空");
}
// 从绑定关系中获取商家注册账号信息
Integer userId = accountService.getUserBindConnectUserIdByCondition(mchMobile, BindCode.MOBILE, CommonConstant.USER_TYPE_MCH);
if (userId == null) {
logger.error("生成店铺:绑定关系中获取不到该手机{}商家的账号", mchMobile);
return Pair.of(0, "该商家手机未注册账号!");
}
ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByCondition(mchMobile, "");
ShopMchEntry shopMchEntry = shopMchEntryService.shopMerchEntryById(mchId);
if (shopMchEntry == null) {
logger.error("生成店铺:入驻信息不能为空");
return Pair.of(0, "入驻信息不能为空");
}
// 从绑定关系中获取商家注册账号信息
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, "店铺名称已存在,请使用另一个名称");
@ -3094,10 +3097,6 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
shopStoreBase.setStore_logo(storeLogoImage); // 临时使用门面照片做logo
// 省市区记录有序列表
// List<ShopBaseDistrict> districtList = shopBaseDistrictService.getFullDistrictByDistrictCode(shopMchEntry.getCounty_id());
//shopStoreBase.setStore_district_id(shopBaseDistrictService.joinDistrict(districtList, 1, true, "/"));
// shopStoreBase.setStore_area(shopBaseDistrictService.joinDistrict(districtList, 2, true, "/"));
shopStoreBase.setStore_district_id(shopMchEntry.getStore_district());
shopStoreBase.setStore_area(shopMchEntry.getStore_area());
shopStoreBase.setStore_address(shopMchEntry.getStore_address());