商家入驻,方法优化, fix bug
This commit is contained in:
parent
241022582c
commit
a030b8cd4c
@ -33,13 +33,13 @@ public class ShopMchEntry implements Serializable {
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家的登录手机号")
|
||||
@ApiModelProperty(value = "入驻商家的登录手机号", required = true)
|
||||
private String login_mobile;
|
||||
|
||||
@ApiModelProperty(value = "商家店铺的ID")
|
||||
private String store_id;
|
||||
|
||||
@ApiModelProperty(value = "商家店铺的名称")
|
||||
@ApiModelProperty(value = "商家店铺的名称", required = true)
|
||||
private String store_name;
|
||||
|
||||
@ApiModelProperty(value = "商家店铺LOGO图片")
|
||||
@ -51,7 +51,7 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "入驻商家的联系人姓名")
|
||||
private String contact_name;
|
||||
|
||||
@ApiModelProperty(value = "商家一级主营类目,用数字表示不同类目")
|
||||
@ApiModelProperty(value = "商家一级主营类目,用数字表示不同类目", required = true)
|
||||
private Integer biz_category;
|
||||
|
||||
@ApiModelProperty(value = "商家二级主营类目,用数字表示不同类目")
|
||||
@ -87,16 +87,16 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "店铺地区名称,省份/城市/区")
|
||||
private String store_area;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家店铺的详细地址")
|
||||
@ApiModelProperty(value = "入驻商家店铺的详细地址", required = true)
|
||||
private String store_address;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家店铺门面正面图片的存储路径")
|
||||
@ApiModelProperty(value = "入驻商家店铺门面正面图片的存储路径", required = true)
|
||||
private String front_facade_image;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家店铺门面环境图片的存储路径")
|
||||
@ApiModelProperty(value = "入驻商家店铺门面环境图片的存储路径", required = true)
|
||||
private String environment_image;
|
||||
|
||||
@ApiModelProperty(value = "入驻主体类型,企业或个人:1-企业;2-个人;")
|
||||
@ApiModelProperty(value = "入驻主体类型,企业或个人:1-企业;2-个人;", required = true)
|
||||
private Integer entity_type;
|
||||
|
||||
@ApiModelProperty(value = "企业入驻时的营业执照编号")
|
||||
@ -165,7 +165,7 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "个人身份证有效期结束时间")
|
||||
private String individual_id_period_end;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家的开户银行名称")
|
||||
@ApiModelProperty(value = "入驻商家的开户银行名称", required = true)
|
||||
private String bank_name;
|
||||
|
||||
@ApiModelProperty(value = "结算账户银行卡图片")
|
||||
@ -174,22 +174,22 @@ public class ShopMchEntry implements Serializable {
|
||||
@ApiModelProperty(value = "结算账号省市区编号 省code/市code/区code,必填项")
|
||||
private String bank_district;
|
||||
|
||||
@ApiModelProperty(value = "结算银行地区名称,格式: 省份/城市/区")
|
||||
@ApiModelProperty(value = "结算银行地区名称,格式: 省份/城市/区", required = true)
|
||||
private String bank_area;
|
||||
|
||||
@ApiModelProperty(value = "结算账号类型:57-对公 58-对私")
|
||||
@ApiModelProperty(value = "结算账号类型:57-对公 58-对私", required = true)
|
||||
private String account_type;
|
||||
|
||||
@ApiModelProperty(value = "结算账户⾏号")
|
||||
@ApiModelProperty(value = "结算账户⾏号", required = true)
|
||||
private String openning_bank_code;
|
||||
|
||||
@ApiModelProperty(value = "结算账户清算⾏号")
|
||||
private String clearing_bank_code;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家的收款账户号码")
|
||||
@ApiModelProperty(value = "入驻商家的收款账户号码", required = true)
|
||||
private String account_number;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家的收款账户姓名")
|
||||
@ApiModelProperty(value = "入驻商家的收款账户姓名", required = true)
|
||||
private String account_holder_name;
|
||||
|
||||
@ApiModelProperty(value = "入驻商家的审批状态:1-已通过;2-未通过;3-待审核;4-未申请过;5-已提交审核;")
|
||||
|
||||
@ -316,7 +316,7 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
|
||||
}
|
||||
|
||||
// 更新商家的hasEsigned状态=1
|
||||
shopMchEntryService.updateMulStatus(esignContract.getMch_mobile(), "", 1, 0, 0, 0, 0);
|
||||
shopMchEntryService.updateMulStatus(esignContract.getMch_mobile(), "", 1, 0, 0, 0, 0, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
|
||||
return new ResponseEntity<>(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ -1019,7 +1019,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
}
|
||||
|
||||
// 更新商家分账申请状态为已申请(hasApplySplit=1)
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 1, 0, 0, 0);
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 0, 1, 0, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
|
||||
log.debug("商户分账业务申请回调:处理成功,applyId={}", applyId);
|
||||
return JSONUtil.createObj().put("code", "SUCCESS").put("message", "操作成功!");
|
||||
@ -1160,7 +1160,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
}
|
||||
|
||||
// 更新商户分账状态
|
||||
shopMchEntryService.updateMulStatus(mchMobile, "", 0, 0, 1, 0, 0);
|
||||
shopMchEntryService.updateMulStatus(mchMobile, "", 0, 0, 0, 0, 1, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
return CommonResult.success(receiver, "创建接收方成功!");
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -1385,8 +1385,9 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
}
|
||||
|
||||
// 7. 成功后更新商户绑定状态为已绑定
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 0, 1, 0);
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 0, 0, 0, 1, CommonConstant.MCH_APPR_STA_PASS);
|
||||
|
||||
shopMchEntryService.checkMerchEntryFinished("", merCupNo);
|
||||
// 8. 日志记录并返回成功响应
|
||||
log.debug("商家绑定分账接收方异步通知处理完成,merCupNo:{}", merCupNo);
|
||||
return JSONUtil.createObj().put("code", "SUCCESS").put("message", "操作成功");
|
||||
|
||||
@ -243,7 +243,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
boolean success = successCnt > 0;
|
||||
if (success) {
|
||||
// 更新多个状态
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 1, 0, 0);
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 0, 0, 1, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
@ -536,7 +536,7 @@ public class LklTkServiceImpl {
|
||||
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(true, "提交进件成功,请等待审核!");
|
||||
@ -644,7 +644,8 @@ public class LklTkServiceImpl {
|
||||
Pair<Integer, String> retPair = shopStoreBaseService.merchEntryInfo2StoreInfo(mchMobile, false);
|
||||
|
||||
if (retPair.getFirst() > 0) {
|
||||
boolean updateSuccess = shopMchEntryService.updateMerchEntryStoreStatus(mchMobile, CommonConstant.Enable);
|
||||
boolean updateSuccess = shopMchEntryService.updateMulStatus(mchMobile, "", 0, 0, 1, 0, 0, 1, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
// boolean updateSuccess = shopMchEntryService.updateMerchEntryStoreStatus(mchMobile, CommonConstant.Enable);
|
||||
if (!updateSuccess) {
|
||||
logger.warn("更新店铺状态失败: mchMobile={}", mchMobile);
|
||||
} else {
|
||||
|
||||
@ -18,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -40,7 +39,6 @@ public class OrderPayedListener {
|
||||
// private ShopStorePrinterService shopStorePrinterService;
|
||||
// @Autowired
|
||||
// private MqMessageService mqMessageService;
|
||||
@Resource
|
||||
@Autowired
|
||||
private SFExpressApiService sfExpressApiService;
|
||||
|
||||
@ -114,7 +112,6 @@ public class OrderPayedListener {
|
||||
|
||||
logger.info("顺丰同城下单成功");
|
||||
|
||||
|
||||
// 个推推送消息
|
||||
sfExpressApiService.pushMessageToStoreEmployee(null, orderId, "你有一笔同城订单[" + orderId + "],请及时处理。", "");
|
||||
|
||||
|
||||
@ -2678,7 +2678,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
for (String order_id : order_ids) {
|
||||
logger.debug("设置付款状态的单个订单ID:{}", order_id);
|
||||
String prefix = order_id.substring(0, 2);
|
||||
if ("XX".equals(prefix)) {
|
||||
if ("XX".equalsIgnoreCase(prefix)) {
|
||||
// 线下消费,分佣处理
|
||||
// 分销功能。
|
||||
Map params = new HashMap();
|
||||
|
||||
@ -125,6 +125,15 @@ public interface ShopMchEntryService {
|
||||
*/
|
||||
ShopMchEntry getShopMerchEntryByMerInnerNo(String merInnerNo);
|
||||
|
||||
/**
|
||||
* 根据手机号或商户号获取商户入驻信息
|
||||
*
|
||||
* @param loginMobile 登录手机号
|
||||
* @param merchantCupNo 商户号
|
||||
* @return 商户入驻信息,如果不存在则返回 null
|
||||
*/
|
||||
ShopMchEntry getShopMerchEntryByMobileOrMerCupNo(String loginMobile, String merchantCupNo);
|
||||
|
||||
/**
|
||||
* 根据商家注册的手机号,更新合同签署状态和合同下载地址
|
||||
*
|
||||
@ -205,18 +214,21 @@ public interface ShopMchEntryService {
|
||||
Boolean updateMerchEntryApprovalByMchId(Long mchId, String mchMobile, Integer approvalStatus, String approvalRemark);
|
||||
|
||||
/**
|
||||
* 根据商户号或商家手机号修改商户分账多个状态
|
||||
* 根据商户号或商家手机号修改商户入驻信息多个状态
|
||||
*
|
||||
* @param mchMobile
|
||||
* @param merCupNo
|
||||
* @param hasEcSigned
|
||||
* @param hasApplySplit
|
||||
* @param hasApplyReceiver
|
||||
* @param hasBindReceiver
|
||||
* @param hasApplyMer
|
||||
* @return
|
||||
* @param merchantMobile 商家手机号
|
||||
* @param merchantCupNo 商户号
|
||||
* @param hasEcSigned 是否已签署电子合同
|
||||
* @param hasApplyMerchant 是否已申请商户进件
|
||||
* @param storeStatus 店铺状态
|
||||
* @param hasApplySplit 是否已申请分账
|
||||
* @param hasApplyReceiver 是否已申请收款方
|
||||
* @param hasBindReceiver 是否已绑定收款方
|
||||
* @param approvalStatus 审批状态
|
||||
* @return 更新结果,true为成功,false为失败
|
||||
*/
|
||||
Boolean updateMulStatus(String mchMobile, String merCupNo, Integer hasEcSigned, Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver, Integer hasApplyMer);
|
||||
Boolean updateMulStatus(String merchantMobile, String merchantCupNo, Integer hasEcSigned, Integer hasApplyMerchant, Integer storeStatus,
|
||||
Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver, Integer approvalStatus);
|
||||
|
||||
/**
|
||||
* 更新商家入网电子合同结果通知地址
|
||||
@ -226,4 +238,13 @@ public interface ShopMchEntryService {
|
||||
* @return
|
||||
*/
|
||||
Boolean updateMerchEntryEcResultUrlByMchId(Long mchId, String lklEcResultUrl);
|
||||
|
||||
/**
|
||||
* 根据商户手机号和商户号检查商家入驻整个流程是否全部完成
|
||||
*
|
||||
* @param merchantMobile 商家手机号
|
||||
* @param merchantCupNo 商户号
|
||||
* @return
|
||||
*/
|
||||
Boolean checkMerchEntryFinished(String merchantMobile, String merchantCupNo);
|
||||
}
|
||||
@ -869,6 +869,35 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
return recordList.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号或商户号获取商户入驻信息
|
||||
*
|
||||
* @param loginMobile 登录手机号
|
||||
* @param merchantCupNo 商户号
|
||||
* @return 商户入驻信息,如果不存在则返回 null
|
||||
*/
|
||||
@Override
|
||||
public ShopMchEntry getShopMerchEntryByMobileOrMerCupNo(String loginMobile, String merchantCupNo) {
|
||||
// 1. 校验:手机号和商户号不能同时为空
|
||||
if (StrUtil.isAllBlank(loginMobile, merchantCupNo)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 2. 构建查询条件
|
||||
QueryWrapper<ShopMchEntry> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", CommonConstant.Enable).orderByAsc("id");
|
||||
|
||||
// 3. 使用 OR 连接手机号和商户号的查询条件,只要满足一个条件即可
|
||||
queryWrapper.and(qw -> qw.eq(StrUtil.isNotBlank(loginMobile), "login_mobile", loginMobile)
|
||||
.or().eq(StrUtil.isNotBlank(merchantCupNo), "lkl_mer_cup_no", merchantCupNo));
|
||||
|
||||
// 4. 执行查询
|
||||
List<ShopMchEntry> recordList = list(queryWrapper);
|
||||
|
||||
// 5. 处理查询结果
|
||||
return CollectionUtil.isNotEmpty(recordList) ? recordList.get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商家注册的手机号,更新合同签署状态和合同下载地址
|
||||
*
|
||||
@ -1184,56 +1213,121 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据商户号或商家手机号修改商户分账多个状态
|
||||
* 检查商户入驻流程是否全部完成,并更新审批状态
|
||||
*
|
||||
* @param mchMobile
|
||||
* @param merCupNo
|
||||
* @param hasEcSigned
|
||||
* @param hasApplySplit
|
||||
* @param hasApplyReceiver
|
||||
* @param hasBindReceiver
|
||||
* @param hasApplyMer
|
||||
* @return
|
||||
* @param merchantMobile 商家手机号
|
||||
* @param merchantCupNo 商户号
|
||||
* @return 如果全部完成返回 true,否则返回 false
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateMulStatus(String mchMobile, String merCupNo, Integer hasEcSigned,
|
||||
Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver, Integer hasApplyMer) {
|
||||
// 参数校验
|
||||
if (StrUtil.isAllBlank(merCupNo, mchMobile)) {
|
||||
log.error("缺少merCupNo或mchMobile参数");
|
||||
public Boolean checkMerchEntryFinished(String merchantMobile, String merchantCupNo) {
|
||||
// 1. 参数校验:商户号和商家手机号不能同时为空
|
||||
if (StrUtil.isAllBlank(merchantCupNo, merchantMobile)) {
|
||||
log.error("检查商户入驻流程完成状态失败:商户号和商家手机号不能同时为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateWrapper<ShopMchEntry> updateWrapper = new UpdateWrapper<>();
|
||||
// 设置查询条件
|
||||
Optional.ofNullable(mchMobile)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.ifPresent(mobile -> updateWrapper.eq("login_mobile", mobile));
|
||||
Optional.ofNullable(merCupNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.ifPresent(cupNo -> updateWrapper.eq("lkl_mer_cup_no", cupNo));
|
||||
try {
|
||||
// 2. 根据手机号或商户号获取商户入驻信息
|
||||
ShopMchEntry merchantEntry = getShopMerchEntryByMobileOrMerCupNo(merchantMobile, merchantCupNo);
|
||||
if (merchantEntry == null) {
|
||||
log.error("检查商户入驻流程完成状态失败:商户不存在, merchantMobile={}, merchantCupNo={}", merchantMobile, merchantCupNo);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 流式构建更新字段
|
||||
Map<String, Integer> fieldMap = new LinkedHashMap<>();
|
||||
fieldMap.put("has_ec_signed", hasEcSigned);
|
||||
fieldMap.put("has_apply_split", hasApplySplit);
|
||||
fieldMap.put("has_apply_receiver", hasApplyReceiver);
|
||||
fieldMap.put("has_bind_receiver", hasBindReceiver);
|
||||
fieldMap.put("has_apply_mer", hasApplyMer);
|
||||
// 3. 检查各项状态是否已完成
|
||||
boolean isFinished = CommonConstant.Enable.equals(merchantEntry.getHas_ec_signed())
|
||||
&& CommonConstant.Enable.equals(merchantEntry.getHas_apply_mer())
|
||||
&& CommonConstant.Enable.equals(merchantEntry.getStore_status())
|
||||
&& CommonConstant.Enable.equals(merchantEntry.getHas_apply_split())
|
||||
&& CommonConstant.Enable.equals(merchantEntry.getHas_apply_receiver())
|
||||
&& CommonConstant.Enable.equals(merchantEntry.getHas_bind_receiver());
|
||||
|
||||
// 过滤有效字段并设置
|
||||
fieldMap.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() != null && entry.getValue() > 0)
|
||||
.forEach(entry -> updateWrapper.set(entry.getKey(), entry.getValue()));
|
||||
// 4. 如果所有状态都已完成,则更新商户入驻信息,简化if嵌套
|
||||
if (!isFinished) {
|
||||
return false; // 返回 false,表示入驻流程未全部完成
|
||||
}
|
||||
|
||||
ShopMchEntry merchantEntryUpd = new ShopMchEntry();
|
||||
merchantEntryUpd.setId(merchantEntry.getId());
|
||||
merchantEntryUpd.setApproval_status(CommonConstant.MCH_APPR_STA_PASS); // 设置审批状态为已通过
|
||||
merchantEntryUpd.setApproval_remark("入驻流程已全部完成!"); // 设置审批备注
|
||||
boolean updateResult = updateById(merchantEntry); // 更新商户入驻信息
|
||||
if (!updateResult) {
|
||||
log.error("更新商户入驻信息状态失败, merchantId={}", merchantEntry.getId());
|
||||
}
|
||||
return true; // 返回 true,表示入驻流程已全部完成
|
||||
|
||||
} catch (Exception e) {
|
||||
// 5. 捕获异常并记录错误日志
|
||||
log.error("检查商户入驻流程完成状态时发生异常, merchantMobile={}, merchantCupNo={}", merchantMobile, merchantCupNo, e);
|
||||
return false; // 发生异常时返回 false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据商户号或商家手机号修改商户入驻信息多个状态
|
||||
*
|
||||
* @param merchantMobile 商家手机号
|
||||
* @param merchantCupNo 商户号
|
||||
* @param hasEcSigned 是否已签署电子合同
|
||||
* @param hasApplyMerchant 是否已申请商户进件
|
||||
* @param storeStatus 店铺状态
|
||||
* @param hasApplySplit 是否已申请分账
|
||||
* @param hasApplyReceiver 是否已申请收款方
|
||||
* @param hasBindReceiver 是否已绑定收款方
|
||||
* @param approvalStatus 审批状态
|
||||
* @return 更新结果,true为成功,false为失败
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateMulStatus(String merchantMobile, String merchantCupNo, Integer hasEcSigned, Integer hasApplyMerchant, Integer storeStatus,
|
||||
Integer hasApplySplit, Integer hasApplyReceiver, Integer hasBindReceiver, Integer approvalStatus) {
|
||||
// 1. 参数校验:商户号和商家手机号不能同时为空
|
||||
if (StrUtil.isAllBlank(merchantCupNo, merchantMobile)) {
|
||||
log.error("更新商户多个状态失败:商户号和商家手机号不能同时为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// 2. 构建 UpdateWrapper 对象,用于构建更新条件
|
||||
UpdateWrapper<ShopMchEntry> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
// 3. 设置查询条件:优先使用商户手机号,如果为空则使用商户号
|
||||
Optional.ofNullable(merchantMobile)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.ifPresent(mobile -> updateWrapper.eq("login_mobile", mobile));
|
||||
|
||||
Optional.ofNullable(merchantCupNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.ifPresent(cupNo -> updateWrapper.eq("lkl_mer_cup_no", cupNo));
|
||||
|
||||
// 4. 构建需要更新的字段和值的映射关系
|
||||
Map<String, Integer> updateFieldMap = new LinkedHashMap<>();
|
||||
updateFieldMap.put("approval_status", approvalStatus); // 审批状态
|
||||
updateFieldMap.put("has_ec_signed", hasEcSigned); // 是否已签署电子合同
|
||||
updateFieldMap.put("has_apply_mer", hasApplyMerchant); // 是否已申请商户进件
|
||||
updateFieldMap.put("store_status", storeStatus); // 店铺状态
|
||||
updateFieldMap.put("has_apply_split", hasApplySplit); // 是否已申请分账
|
||||
updateFieldMap.put("has_apply_receiver", hasApplyReceiver); // 是否已申请收款方
|
||||
updateFieldMap.put("has_bind_receiver", hasBindReceiver); // 是否已绑定收款方
|
||||
|
||||
|
||||
// 5. 过滤掉值为 null 或小于等于 0 的字段,避免更新无效字段
|
||||
updateFieldMap.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() != null && entry.getValue() > 0)
|
||||
.forEach(entry -> updateWrapper.set(entry.getKey(), entry.getValue()));
|
||||
|
||||
// 6. 执行更新操作并返回结果
|
||||
return update(updateWrapper);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("更新商家分账业务多个状态失败", e);
|
||||
return false;
|
||||
// 7. 异常处理:记录异常信息,避免程序中断
|
||||
log.error("更新商户入驻信息多个状态失败", e);
|
||||
// 可以选择抛出异常,让 Spring 事务管理器进行回滚
|
||||
// throw new RuntimeException("更新商户多个状态失败", e);
|
||||
return false; // 发生异常时返回 false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3185,21 +3185,24 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
||||
return Pair.of(0, "新增店铺公司失败");
|
||||
}
|
||||
|
||||
// shop_store_employee 店铺员工,添加管理员
|
||||
ShopStoreEmployee shopStoreEmployee = new ShopStoreEmployee();
|
||||
shopStoreEmployee.setStore_id(storeId);
|
||||
shopStoreEmployee.setUser_id(userId);
|
||||
shopStoreEmployee.setRights_group_id(""); // 店铺管理员,店铺
|
||||
shopStoreEmployee.setEmployee_is_admin(CommonConstant.Enable);
|
||||
shopStoreEmployee.setEmployee_is_kefu(CommonConstant.Enable);
|
||||
shopStoreEmployeeService.save(shopStoreEmployee);
|
||||
if (!shopStoreEmployeeService.save(shopStoreEmployee)) {
|
||||
logger.error("生成店铺:新增店铺员工失败");
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺员工失败"));
|
||||
}
|
||||
|
||||
return Pair.of(0, "新增店铺员工失败");
|
||||
QueryWrapper<ShopStoreEmployee> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id", storeId).eq("user_id", userId);
|
||||
if (shopStoreEmployeeService.count(queryWrapper) <= 0) {
|
||||
// shop_store_employee 店铺员工,添加管理员
|
||||
ShopStoreEmployee shopStoreEmployee = new ShopStoreEmployee();
|
||||
shopStoreEmployee.setStore_id(storeId);
|
||||
shopStoreEmployee.setUser_id(userId);
|
||||
shopStoreEmployee.setRights_group_id(""); // 店铺管理员,店铺
|
||||
shopStoreEmployee.setEmployee_is_admin(CommonConstant.Enable);
|
||||
shopStoreEmployee.setEmployee_is_kefu(CommonConstant.Enable);
|
||||
if (!shopStoreEmployeeService.save(shopStoreEmployee)) {
|
||||
logger.error("生成店铺:新增店铺员工失败");
|
||||
if (allowThrown) {
|
||||
throw new ApiException(I18nUtil._("新增店铺员工失败"));
|
||||
}
|
||||
return Pair.of(0, "新增店铺员工失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 生成店铺的太阳码 2025-03-31
|
||||
|
||||
Loading…
Reference in New Issue
Block a user