1. fix
This commit is contained in:
2026-04-25 14:18:45 +08:00
parent 2ed1956fca
commit a695a43f20
22 changed files with 818 additions and 5 deletions

View File

@@ -24,6 +24,8 @@ create table merchant_application
user_account varchar(20) not null, user_account varchar(20) not null,
type int4 not null, type int4 not null,
store_name varchar(255) default '' not null, store_name varchar(255) default '' not null,
alipay_account text,
wechat_account text,
company_name varchar(100), company_name varchar(100),
business_license varchar(100), business_license varchar(100),
business_license_url TEXT, business_license_url TEXT,
@@ -47,6 +49,8 @@ comment on column merchant_application.user_id is '用户id';
comment on column merchant_application.user_account is '用户账号'; comment on column merchant_application.user_account is '用户账号';
comment on column merchant_application.type is '商家类型: 0-未审核, 1-个人商家, 2-企业商家'; comment on column merchant_application.type is '商家类型: 0-未审核, 1-个人商家, 2-企业商家';
comment on column merchant_application.store_name is '店铺名称'; comment on column merchant_application.store_name is '店铺名称';
comment on column merchant_application.alipay_account is '支付宝账号';
comment on column merchant_application.wechat_account is '微信账号';
comment on column merchant_application.company_name is '公司名称(企业商家时必填)'; comment on column merchant_application.company_name is '公司名称(企业商家时必填)';
comment on column merchant_application.business_license is '营业执照注册号'; comment on column merchant_application.business_license is '营业执照注册号';
comment on column merchant_application.business_license_url is '营业执照图片URL'; comment on column merchant_application.business_license_url is '营业执照图片URL';

View File

@@ -104,3 +104,70 @@ INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, cat
is_deleted) is_deleted)
VALUES ('2047553982355394566', '2047553982355394562', 'merchantproduct_view', '查看', 'view', VALUES ('2047553982355394566', '2047553982355394562', 'merchantproduct_view', '查看', 'view',
'/market/merchantProduct/view', 'file-text', 4, 2, 2, 1, NULL, 0); '/market/merchantProduct/view', 'file-text', 4, 2, 2, 1, NULL, 0);
drop table if exists merchant_store_favorite;
create table merchant_store_favorite
(
id int8 not null primary key,
user_id int8 not null default -1,
merchant_id int8 not null default -1,
store_name varchar(255) not null default '',
remark varchar(255) not null default '',
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4,
is_deleted int4 default 0
);
create index idx_merchant_store_favorite_user_id on merchant_store_favorite (user_id) where is_deleted = 0;
create index idx_merchant_store_favorite_merchant_id on merchant_store_favorite (merchant_id) where is_deleted = 0;
comment on table merchant_store_favorite is '自营商家店铺收藏表';
comment on column merchant_store_favorite.id is '主键';
comment on column merchant_store_favorite.user_id is '用户id';
comment on column merchant_store_favorite.merchant_id is '商家id';
comment on column merchant_store_favorite.store_name is '店铺名称';
comment on column merchant_store_favorite.remark is '备注';
comment on column merchant_product_inventory.create_user is '创建人';
comment on column merchant_product_inventory.create_dept is '创建部门';
comment on column merchant_product_inventory.create_time is '创建时间';
comment on column merchant_product_inventory.update_user is '修改人';
comment on column merchant_product_inventory.update_time is '修改时间';
comment on column merchant_product_inventory.status is '状态';
comment on column merchant_product_inventory.is_deleted is '是否已删除';
drop table if exists merchant_payout_account;
create table merchant_payout_account
(
id int8 not null primary key,
user_id int8 not null default -1,
account_type int4 not null default -1,
account_number varchar(255) not null default '',
account_url text not null default '',
remark varchar(255) not null default '',
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4,
is_deleted int4 default 0
);
comment on table merchant_payout_account is '商家收款资料表';
comment on column merchant_payout_account.id is '主键';
comment on column merchant_payout_account.user_id is '用户id';
comment on column merchant_payout_account.account_type is '账号类型 1:支付宝 2:微信';
comment on column merchant_payout_account.account_number is '银行卡号';
comment on column merchant_payout_account.account_url is '收款码图片';
comment on column merchant_store_favorite.remark is '备注';
comment on column merchant_product_inventory.create_user is '创建人';
comment on column merchant_product_inventory.create_dept is '创建部门';
comment on column merchant_product_inventory.create_time is '创建时间';
comment on column merchant_product_inventory.update_user is '修改人';
comment on column merchant_product_inventory.update_time is '修改时间';
comment on column merchant_product_inventory.status is '状态';
comment on column merchant_product_inventory.is_deleted is '是否已删除';

View File

@@ -11,12 +11,15 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.modules.api.request.IncreaseInventoryRequest; import org.springblade.modules.api.request.IncreaseInventoryRequest;
import org.springblade.modules.api.request.SubmitMerchantProductRequest; import org.springblade.modules.api.request.SubmitMerchantProductRequest;
import org.springblade.modules.api.request.SubmitPayoutAccountRequest;
import org.springblade.modules.api.request.VerifyMerchantRequest; import org.springblade.modules.api.request.VerifyMerchantRequest;
import org.springblade.modules.api.response.MerchantStatusResponse; import org.springblade.modules.api.response.MerchantStatusResponse;
import org.springblade.modules.api.vo.MarketMerchantProductApiVO; import org.springblade.modules.api.vo.MarketMerchantProductApiVO;
import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO; import org.springblade.modules.api.vo.MarketMerchantInventoryApiVO;
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
import org.springblade.modules.market.service.IMarketMerchantApplicationService; import org.springblade.modules.market.service.IMarketMerchantApplicationService;
import org.springblade.modules.market.service.IMerchantInventoryService; import org.springblade.modules.market.service.IMerchantInventoryService;
import org.springblade.modules.market.service.IMerchantPayoutAccountService;
import org.springblade.modules.market.service.IMerchantProductService; import org.springblade.modules.market.service.IMerchantProductService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -36,11 +39,13 @@ public class MarketMerchantController {
private final IMerchantInventoryService inventoryService; private final IMerchantInventoryService inventoryService;
private final IMerchantPayoutAccountService payoutAccountService;
@PostMapping("/merchant-apply") @PostMapping("/merchant-apply")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@Operation(summary = "自营商家认证提交") @Operation(summary = "自营商家认证提交")
public R verifyMerchant(@RequestBody @Valid VerifyMerchantRequest request) { public R verifyMerchant(@RequestBody @Valid VerifyMerchantRequest request) {
return R.status(applicationService.applyMerchant(AuthUtil.getUserId(), request.getType(),request.getStoreName(), request.getCompanyName(), request.getBusinessLicense(), request.getBusinessLicenseUrl(), request.getLegalPerson())); return R.status(applicationService.applyMerchant(AuthUtil.getUserId(), request.getType(), request.getStoreName(), request.getAlipayAccount(), request.getWechatAccount(), request.getCompanyName(), request.getBusinessLicense(), request.getBusinessLicenseUrl(), request.getLegalPerson()));
} }
@GetMapping("/merchant-audit-status") @GetMapping("/merchant-audit-status")
@@ -92,5 +97,18 @@ public class MarketMerchantController {
return R.data(applicationService.checkAvailable(storeName)); return R.data(applicationService.checkAvailable(storeName));
} }
@PostMapping("/submit-payout-account")
@ApiOperationSupport(order = 9)
@Operation(summary = "新增收款资料")
public R addPayoutAccount(@RequestBody @Valid SubmitPayoutAccountRequest request) {
return R.status(payoutAccountService.submitPayoutAccount(AuthUtil.getUserId(), request.getType(), request.getUrl()));
}
@GetMapping("/payout-account-list")
@ApiOperationSupport(order = 10)
@Operation(summary = "收款资料列表")
public R<List<MerchantPayoutAccountApiVO>> payoutAccountList() {
return R.data(payoutAccountService.accountListByUserId(AuthUtil.getUserId()));
}
} }

View File

@@ -0,0 +1,22 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class SubmitPayoutAccountRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@NotNull(message = "请选择类型")
private Integer type;
@NotEmpty(message = "无效地址")
private String url;
}

View File

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

View File

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

View File

@@ -0,0 +1,18 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class MerchantPayoutAccountApiVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Integer accountType;
private String accountUrl;
}

View File

@@ -0,0 +1,135 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MerchantPayoutAccountVO;
import org.springblade.modules.market.wrapper.MerchantPayoutAccountWrapper;
import org.springblade.modules.market.service.IMerchantPayoutAccountService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 商家收款资料表 控制器
*
* @author BladeX
* @since 2026-04-25
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/payout-account")
@Tag(name = "商家收款资料表", description = "商家收款资料表接口")
public class MerchantPayoutAccountController extends BladeController {
private final IMerchantPayoutAccountService payoutAccountService;
/**
* 商家收款资料表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入payoutAccount")
public R<MerchantPayoutAccountVO> detail(MerchantPayoutAccountEntity payoutAccount) {
MerchantPayoutAccountEntity detail = payoutAccountService.getOne(Condition.getQueryWrapper(payoutAccount));
return R.data(MerchantPayoutAccountWrapper.build().entityVO(detail));
}
/**
* 商家收款资料表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入payoutAccount")
public R<IPage<MerchantPayoutAccountVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> payoutAccount, Query query) {
IPage<MerchantPayoutAccountEntity> pages = payoutAccountService.page(Condition.getPage(query), Condition.getQueryWrapper(payoutAccount, MerchantPayoutAccountEntity.class));
return R.data(MerchantPayoutAccountWrapper.build().pageVO(pages));
}
/**
* 商家收款资料表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入payoutAccount")
public R<IPage<MerchantPayoutAccountVO>> page(MerchantPayoutAccountVO payoutAccount, Query query) {
IPage<MerchantPayoutAccountVO> pages = payoutAccountService.selectPayoutAccountPage(Condition.getPage(query), payoutAccount);
return R.data(pages);
}
/**
* 商家收款资料表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入payoutAccount")
public R save(@Valid @RequestBody MerchantPayoutAccountEntity payoutAccount) {
return R.status(payoutAccountService.save(payoutAccount));
}
/**
* 商家收款资料表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入payoutAccount")
public R update(@Valid @RequestBody MerchantPayoutAccountEntity payoutAccount) {
return R.status(payoutAccountService.updateById(payoutAccount));
}
/**
* 商家收款资料表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入payoutAccount")
public R submit(@Valid @RequestBody MerchantPayoutAccountEntity payoutAccount) {
return R.status(payoutAccountService.saveOrUpdate(payoutAccount));
}
/**
* 商家收款资料表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(payoutAccountService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -2,6 +2,8 @@ package org.springblade.modules.market.convert;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.springblade.modules.api.vo.MarketMerchantProductApiVO; import org.springblade.modules.api.vo.MarketMerchantProductApiVO;
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.entity.MerchantProductEntity; import org.springblade.modules.market.pojo.entity.MerchantProductEntity;
import java.util.List; import java.util.List;
@@ -15,5 +17,9 @@ public interface MarketMerchantConvert {
List<MarketMerchantProductApiVO> convertMerchantProductEntityToApiVOList(List<MerchantProductEntity> marketMerchantProductEntityList); List<MarketMerchantProductApiVO> convertMerchantProductEntityToApiVOList(List<MerchantProductEntity> marketMerchantProductEntityList);
MerchantPayoutAccountApiVO convertMerchantPayoutAccountEntityToApiVO(MerchantPayoutAccountEntity merchantPayoutAccountEntity);
List<MerchantPayoutAccountApiVO> convertMerchantPayoutAccountEntityToApiVOList(List<MerchantPayoutAccountEntity> merchantPayoutAccountEntityList);
} }

View File

@@ -0,0 +1,31 @@
package org.springblade.modules.market.eums;
import lombok.Getter;
@Getter
public enum PayoutAccountType {
ALI(1, "支付宝"),
WECHAT(2, "微信");
private final int code;
private final String name;
PayoutAccountType(int code, String name) {
this.code = code;
this.name = name;
}
// 根据 code 获取对应的枚举值
public static PayoutAccountType fromCode(int code) {
for (PayoutAccountType type : PayoutAccountType.values()) {
if (type.getCode() == code) {
return type;
}
}
throw new IllegalArgumentException("Invalid merchant payout account type code: " + code);
}
}

View File

@@ -3,12 +3,15 @@
<mapper namespace="org.springblade.modules.market.mapper.MarketMerchantApplicationMapper"> <mapper namespace="org.springblade.modules.market.mapper.MarketMerchantApplicationMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="applicationResultMap" type="org.springblade.modules.market.pojo.entity.MarketMerchantApplicationEntity"> <resultMap id="applicationResultMap"
type="org.springblade.modules.market.pojo.entity.MarketMerchantApplicationEntity">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="user_id" property="userId"/> <result column="user_id" property="userId"/>
<result column="user_account" property="userAccount"/> <result column="user_account" property="userAccount"/>
<result column="type" property="type"/> <result column="type" property="type"/>
<result column="store_name" property="storeName"/> <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="company_name" property="companyName"/>
<result column="business_license" property="businessLicense"/> <result column="business_license" property="businessLicense"/>
<result column="business_license_url" property="businessLicenseUrl"/> <result column="business_license_url" property="businessLicenseUrl"/>

View File

@@ -0,0 +1,52 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.mapper;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MerchantPayoutAccountVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 商家收款资料表 Mapper 接口
*
* @author BladeX
* @since 2026-04-25
*/
public interface MerchantPayoutAccountMapper extends BaseMapper<MerchantPayoutAccountEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param payoutAccount 查询参数
* @return List<PayoutAccountVO>
*/
List<MerchantPayoutAccountVO> selectPayoutAccountPage(IPage page, MerchantPayoutAccountVO payoutAccount);
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.market.mapper.MerchantPayoutAccountMapper">
<!-- 通用查询映射结果 -->
<resultMap id="payoutAccountResultMap" type="org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity">
<result column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="account_type" property="accountType"/>
<result column="account_number" property="accountNumber"/>
<result column="account_url" property="accountUrl"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
<select id="selectPayoutAccountPage" resultMap="payoutAccountResultMap">
select * from merchant_payout_account where is_deleted = 0
</select>
</mapper>

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.pojo.dto;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 商家收款资料表 数据传输对象实体类
*
* @author BladeX
* @since 2026-04-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MerchantPayoutAccountDTO extends MerchantPayoutAccountEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

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

View File

@@ -0,0 +1,78 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serial;
/**
* 商家收款资料表 实体类
*
* @author BladeX
* @since 2026-04-25
*/
@Data
@TableName("merchant_payout_account")
@Schema(description = "PayoutAccount对象")
@EqualsAndHashCode(callSuper = true)
public class MerchantPayoutAccountEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
@Schema(description = "用户id")
private Long userId;
/**
* 账号类型 1:支付宝 2:微信
*/
@Schema(description = "账号类型 1:支付宝 2:微信")
private Integer accountType;
/**
* 银行卡号
*/
@Schema(description = "银行卡号")
private String accountNumber;
/**
* 收款码图片
*/
@Schema(description = "收款码图片")
private String accountUrl;
/**
*
*/
@Schema(description = "")
private String remark;
}

View File

@@ -0,0 +1,45 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.pojo.vo;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 商家收款资料表 视图实体类
*
* @author BladeX
* @since 2026-04-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MerchantPayoutAccountVO extends MerchantPayoutAccountEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

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

View File

@@ -0,0 +1,56 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.service;
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MerchantPayoutAccountVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* 商家收款资料表 服务类
*
* @author BladeX
* @since 2026-04-25
*/
public interface IMerchantPayoutAccountService extends BaseService<MerchantPayoutAccountEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param payoutAccount 查询参数
* @return IPage<PayoutAccountVO>
*/
IPage<MerchantPayoutAccountVO> selectPayoutAccountPage(IPage<MerchantPayoutAccountVO> page, MerchantPayoutAccountVO payoutAccount);
boolean submitPayoutAccount(Long userId, Integer type, String url);
List<MerchantPayoutAccountApiVO> accountListByUserId(Long userId);
}

View File

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

View File

@@ -0,0 +1,95 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.common.cache.MarketInfoCache;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.api.vo.MerchantPayoutAccountApiVO;
import org.springblade.modules.market.convert.MarketMerchantConvert;
import org.springblade.modules.market.eums.MerchantType;
import org.springblade.modules.market.eums.PayoutAccountType;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MerchantPayoutAccountVO;
import org.springblade.modules.market.mapper.MerchantPayoutAccountMapper;
import org.springblade.modules.market.service.IMerchantPayoutAccountService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
/**
* 商家收款资料表 服务实现类
*
* @author BladeX
* @since 2026-04-25
*/
@Service
public class MerchantPayoutAccountServiceImpl extends BaseServiceImpl<MerchantPayoutAccountMapper, MerchantPayoutAccountEntity> implements IMerchantPayoutAccountService {
@Override
public IPage<MerchantPayoutAccountVO> selectPayoutAccountPage(IPage<MerchantPayoutAccountVO> page, MerchantPayoutAccountVO payoutAccount) {
return page.setRecords(baseMapper.selectPayoutAccountPage(page, payoutAccount));
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submitPayoutAccount(Long userId, Integer type, String url) {
if (Objects.isNull(url) || Objects.isNull(type) || StringUtil.isBlank(url)) {
throw new ServiceException("无效参数");
}
Integer merchantType = MarketInfoCache.checkMerchantType(userId);
MerchantType cuurentMerchantType = MerchantType.fromCode(merchantType);
if (cuurentMerchantType == MerchantType.UNREVIEWED) {
throw new ServiceException("无效商家");
}
PayoutAccountType currentType = PayoutAccountType.fromCode(type);
boolean updated = update(Wrappers.lambdaUpdate(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getAccountType, currentType.getCode()).set(MerchantPayoutAccountEntity::getIsDeleted, 1));
MerchantPayoutAccountEntity account = new MerchantPayoutAccountEntity();
account.setUserId(userId);
account.setAccountType(currentType.getCode());
account.setAccountUrl(url);
boolean saved = save(account);
if (!updated || !saved) {
throw new ServiceException("操作失败");
}
return true;
}
@Override
public List<MerchantPayoutAccountApiVO> accountListByUserId(Long userId) {
if (Objects.isNull(userId)){
throw new ServiceException("无效用户");
}
List<MerchantPayoutAccountEntity> list = list(Wrappers.lambdaQuery(MerchantPayoutAccountEntity.class).eq(MerchantPayoutAccountEntity::getUserId, userId).eq(MerchantPayoutAccountEntity::getIsDeleted, 0));
return MarketMerchantConvert.INSTANCE.convertMerchantPayoutAccountEntityToApiVOList(list);
}
}

View File

@@ -0,0 +1,59 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.market.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.market.pojo.entity.MerchantPayoutAccountEntity;
import org.springblade.modules.market.pojo.vo.MerchantPayoutAccountVO;
import java.util.Objects;
/**
* 商家收款资料表 包装类,返回视图层所需的字段
*
* @author BladeX
* @since 2026-04-25
*/
public class MerchantPayoutAccountWrapper extends BaseEntityWrapper<MerchantPayoutAccountEntity, MerchantPayoutAccountVO> {
public static MerchantPayoutAccountWrapper build() {
return new MerchantPayoutAccountWrapper();
}
@Override
public MerchantPayoutAccountVO entityVO(MerchantPayoutAccountEntity payoutAccount) {
MerchantPayoutAccountVO payoutAccountVO = Objects.requireNonNull(BeanUtil.copyProperties(payoutAccount, MerchantPayoutAccountVO.class));
//User createUser = UserCache.getUser(payoutAccount.getCreateUser());
//User updateUser = UserCache.getUser(payoutAccount.getUpdateUser());
//payoutAccountVO.setCreateUserName(createUser.getName());
//payoutAccountVO.setUpdateUserName(updateUser.getName());
return payoutAccountVO;
}
}