1. change payout account
This commit is contained in:
2026-04-29 13:24:01 +08:00
parent a5f2c9bac8
commit d90467ed84
18 changed files with 84 additions and 69 deletions

View File

@@ -42,7 +42,7 @@ public class MarketMerchantController {
@ApiOperationSupport(order = 1)
@Operation(summary = "自营商家认证提交")
public R verifyMerchant(@RequestBody @Valid VerifyMerchantRequest request) {
return R.status(applicationService.applyMerchant(AuthUtil.getUserId(), request.getType(), request.getStoreName(), request.getAlipayAccount(), request.getWechatAccount(), request.getCompanyName(), request.getBusinessLicense(), request.getBusinessLicenseUrl(), request.getLegalPerson()));
return R.status(applicationService.applyMerchant(AuthUtil.getUserId(), request.getType(), request.getStoreName(), request.getCompanyName(), request.getBusinessLicense(), request.getBusinessLicenseUrl(), request.getLegalPerson()));
}
@GetMapping("/merchant-audit-status")
@@ -98,7 +98,7 @@ public class MarketMerchantController {
@ApiOperationSupport(order = 9)
@Operation(summary = "新增收款资料")
public R addPayoutAccount(@RequestBody @Valid SubmitPayoutAccountRequest request) {
return R.status(payoutAccountService.submitPayoutAccount(AuthUtil.getUserId(), request.getType(), request.getUrl()));
return R.status(payoutAccountService.submitPayoutAccount(AuthUtil.getUserId(), request.getType(), request.getUrl(), request.getNumber(), request.getHolder()));
}
@GetMapping("/payout-account-list")

View File

@@ -16,7 +16,11 @@ public class SubmitPayoutAccountRequest implements Serializable {
@NotNull(message = "请选择类型")
private Integer type;
@NotEmpty(message = "无效地址")
private String url;
private String number;
@NotEmpty(message = "请填写所有人")
private String holder;
}

View File

@@ -15,10 +15,6 @@ public class VerifyMerchantRequest implements Serializable {
@NotEmpty(message = "无效参数")
private String storeName;
private String alipayAccount;
private String wechatAccount;
private String companyName;
private String businessLicense;

View File

@@ -15,10 +15,6 @@ public class MerchantStatusResponse implements Serializable {
private String storeName;
private String alipayAccount;
private String wechatAccount;
private String companyName;
private String businessLicense;

View File

@@ -15,4 +15,6 @@ public class MerchantPayoutAccountApiVO implements Serializable {
private String accountUrl;
private String holderName;
}

View File

@@ -8,13 +8,7 @@ import org.mapstruct.factory.Mappers;
import org.springblade.core.tool.sensitive.SensitiveUtil;
import org.springblade.modules.api.response.remote.BankCardInfoData;
import org.springblade.modules.api.vo.*;
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
import org.springblade.modules.market.pojo.entity.MarketBankCardEntity;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
import org.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
import org.springblade.modules.market.pojo.entity.MarketUserCommissionLogEntity;
import org.springblade.modules.system.pojo.entity.User;
import java.util.List;

View File

@@ -22,5 +22,4 @@ public interface MarketMerchantConvert {
List<MerchantPayoutAccountApiVO> convertMerchantPayoutAccountEntityToApiVOList(List<MerchantPayoutAccountEntity> merchantPayoutAccountEntityList);
}

View File

@@ -6,7 +6,9 @@ import lombok.Getter;
public enum PayoutAccountType {
ALI(1, "支付宝"),
WECHAT(2, "微信");
WECHAT(2, "微信"),
BANK_ACCOUNT(3, "银行账号")
;
private final int code;

View File

@@ -10,8 +10,6 @@
<result column="user_account" property="userAccount"/>
<result column="type" property="type"/>
<result column="store_name" property="storeName"/>
<result column="alipay_account" property="alipayAccount"/>
<result column="wechat_account" property="wechatAccount"/>
<result column="company_name" property="companyName"/>
<result column="business_license" property="businessLicense"/>
<result column="business_license_url" property="businessLicenseUrl"/>

View File

@@ -8,6 +8,7 @@
<result column="user_id" property="userId"/>
<result column="account_type" property="accountType"/>
<result column="account_number" property="accountNumber"/>
<result column="holder_name" property="holderNumber"/>
<result column="account_url" property="accountUrl"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>

View File

@@ -68,16 +68,6 @@ public class MarketMerchantApplicationEntity extends BaseEntity {
*/
@Schema(description = "店铺名称")
private String storeName;
/**
* 支付宝账号
*/
@Schema(description = "支付宝账号")
private String alipayAccount;
/**
* 微信账号
*/
@Schema(description = "微信账号")
private String wechatAccount;
/**
* 公司名称(企业商家时必填)
*/

View File

@@ -64,6 +64,11 @@ public class MerchantPayoutAccountEntity extends BaseEntity {
*/
@Schema(description = "银行卡号")
private String accountNumber;
/**
* 账号所有人
*/
@Schema(description = "账号所有人")
private String holderName;
/**
* 收款码图片
*/

View File

@@ -53,7 +53,7 @@ public interface IMarketMerchantApplicationService extends BaseService<MarketMer
boolean reject(Long id, String reason);
boolean applyMerchant(Long userId, Integer type, String storeName, String alipayAccount, String wechatAccount, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson);
boolean applyMerchant(Long userId, Integer type, String storeName, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson);
int checkMerchantType(Long userId);

View File

@@ -49,7 +49,7 @@ public interface IMerchantPayoutAccountService extends BaseService<MerchantPayou
*/
IPage<MerchantPayoutAccountVO> selectPayoutAccountPage(IPage<MerchantPayoutAccountVO> page, MerchantPayoutAccountVO payoutAccount);
boolean submitPayoutAccount(Long userId, Integer type, String url);
boolean submitPayoutAccount(Long userId, Integer type, String url, String number, String holder);
List<MerchantPayoutAccountApiVO> accountListByUserId(Long userId);

View File

@@ -34,16 +34,13 @@ import org.springblade.core.tool.utils.StringPool;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.api.response.MerchantStatusResponse;
import org.springblade.modules.market.eums.MerchantAuditStatus;
import org.springblade.modules.market.eums.PayoutAccountType;
import org.springblade.modules.market.eums.MerchantType;
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
import org.springblade.modules.market.pojo.entity.MarketMerchantApplicationEntity;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MarketMerchantApplicationVO;
import org.springblade.modules.market.mapper.MarketMerchantApplicationMapper;
import org.springblade.modules.market.service.IMarketInfoService;
import org.springblade.modules.market.service.IMarketMerchantApplicationService;
import org.springblade.modules.market.service.IMerchantPayoutAccountService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -69,8 +66,6 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
private final IMarketInfoService marketInfoService;
private final IMerchantPayoutAccountService payoutAccountService;
@Override
public IPage<MarketMerchantApplicationVO> selectApplicationPage(IPage<MarketMerchantApplicationVO> page, MarketMerchantApplicationVO application) {
return page.setRecords(baseMapper.selectApplicationPage(page, application));
@@ -112,26 +107,6 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
throw new ServiceException("商户类型更新失败");
}
if (StringUtil.isNotBlank(application.getAlipayAccount())) {
MerchantPayoutAccountEntity alipayAccount = new MerchantPayoutAccountEntity();
alipayAccount.setUserId(application.getUserId());
alipayAccount.setAccountType(PayoutAccountType.ALI.getCode());
alipayAccount.setAccountUrl(application.getAlipayAccount());
if (!payoutAccountService.save(alipayAccount)){
throw new ServiceException("保存支付宝收款码失败");
}
}
if (StringUtil.isNotBlank(application.getWechatAccount())){
MerchantPayoutAccountEntity wechatAccount = new MerchantPayoutAccountEntity();
wechatAccount.setUserId(application.getUserId());
wechatAccount.setAccountType(PayoutAccountType.WECHAT.getCode());
wechatAccount.setAccountUrl(application.getAlipayAccount());
if (!payoutAccountService.save(wechatAccount)){
throw new ServiceException("保存支付宝收款码失败");
}
}
CacheUtil.evict(MARKET_INFO_CONFIG_CACHE, MERCHANT, application.getUserId());
@@ -149,7 +124,7 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
}
@Override
public boolean applyMerchant(Long userId, Integer type, String storeName, String alipayAccount, String wechatAccount, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson) {
public boolean applyMerchant(Long userId, Integer type, String storeName, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson) {
if (Objects.isNull(userId) || Objects.isNull(type)) {
throw new ServiceException("无效参数");
}
@@ -165,12 +140,6 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
MarketMerchantApplicationEntity application = new MarketMerchantApplicationEntity();
MarketMerchantApplicationEntity userApplication = getByUserId(userId);
application.setStoreName(storeName);
if (StringUtil.isNotBlank(alipayAccount)) {
application.setAlipayAccount(alipayAccount);
}
if (StringUtil.isNotBlank(wechatAccount)) {
application.setWechatAccount(wechatAccount);
}
if (userApplication != null) {
if (userApplication.getStatus() != MerchantAuditStatus.REJECTED.getCode()) {
throw new ServiceException("请勿重复提交申请");
@@ -224,8 +193,6 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
if (Objects.nonNull(application)) {
response.setType(application.getType());
response.setStoreName(application.getStoreName());
response.setAlipayAccount(application.getAlipayAccount());
response.setWechatAccount(application.getWechatAccount());
response.setCompanyName(application.getCompanyName());
response.setBusinessLicense(application.getBusinessLicense());
response.setBusinessLicenseUrl(application.getBusinessLicenseUrl());

View File

@@ -40,6 +40,7 @@ import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
import org.springblade.modules.market.pojo.entity.MerchantInventoryEntity;
import org.springblade.modules.market.pojo.entity.MerchantCatalogEntity;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MerchantInventoryVO;
import org.springblade.modules.market.service.*;
import org.springblade.modules.system.pojo.entity.User;
@@ -73,6 +74,8 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
private final IMarketBenefitPointService benefitPointService;
private final IMerchantPayoutAccountService payoutAccountService;
@Override
public IPage<MerchantInventoryVO> selectProductInventoryPage(IPage<MerchantInventoryVO> page, MerchantInventoryVO inventory) {
return page.setRecords(baseMapper.selectProductInventoryPage(page, inventory));
@@ -223,6 +226,11 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
throw new ServiceException("用户没有该操作权限");
}
boolean exists = payoutAccountService.exists(Wrappers.lambdaQuery(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getIsDeleted, 0));
if (!exists){
throw new ServiceException("请先绑定收款方式");
}
MerchantProductType currentType = MerchantProductType.fromCode(catalog.getType());
switch (currentType) {
case PLATFORM -> {

View File

@@ -62,8 +62,8 @@ public class MerchantPayoutAccountServiceImpl extends BaseServiceImpl<MerchantPa
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submitPayoutAccount(Long userId, Integer type, String url) {
if (Objects.isNull(url) || Objects.isNull(type) || StringUtil.isBlank(url)) {
public boolean submitPayoutAccount(Long userId, Integer type, String url, String number, String holder) {
if (Objects.isNull(url) || Objects.isNull(type) || StringUtil.isBlank(holder)) {
throw new ServiceException("无效参数");
}
Integer merchantType = MarketInfoCache.checkMerchantType(userId);
@@ -72,6 +72,15 @@ public class MerchantPayoutAccountServiceImpl extends BaseServiceImpl<MerchantPa
throw new ServiceException("无效商家");
}
PayoutAccountType currentType = PayoutAccountType.fromCode(type);
if (currentType == PayoutAccountType.BANK_ACCOUNT){
if (StringUtil.isBlank(number)){
throw new ServiceException("请填写卡号");
}
}else {
if (StringUtil.isBlank(url)){
throw new ServiceException("请上传收款码");
}
}
LambdaUpdateWrapper<MerchantPayoutAccountEntity> wrapper = Wrappers.lambdaUpdate(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getAccountType, currentType.getCode());
if (exists(wrapper)) {
boolean updated = update(wrapper.set(MerchantPayoutAccountEntity::getIsDeleted, 1));
@@ -83,6 +92,8 @@ public class MerchantPayoutAccountServiceImpl extends BaseServiceImpl<MerchantPa
account.setUserId(userId);
account.setAccountType(currentType.getCode());
account.setAccountUrl(url);
account.setAccountNumber(number);
account.setHolderName(holder);
boolean saved = save(account);
if (!saved) {
throw new ServiceException("操作失败");