Commit eeb8873b1dc3b6dbe22426c1319e7d2bbffc25a5

Authored by YunaiV
1 parent 9e3564bd

trade:微调交易配置的注释

sql/mysql/brokerage.sql deleted
1   --- 增加配置表
2   -CREATE TABLE trade_config
3   -(
4   - id BIGINT AUTO_INCREMENT COMMENT '自增主键' PRIMARY KEY,
5   - brokerage_enabled BIT DEFAULT 1 NOT NULL COMMENT '是否启用分佣',
6   - brokerage_enabled_condition TINYINT DEFAULT 1 NOT NULL COMMENT '分佣模式:1-人人分销 2-指定分销',
7   - brokerage_bind_mode TINYINT DEFAULT 1 NOT NULL COMMENT '分销关系绑定模式: 1-没有推广人,2-新用户, 3-扫码覆盖',
8   - brokerage_poster_urls VARCHAR(2000) DEFAULT '' NULL COMMENT '分销海报图地址数组',
9   - brokerage_first_percent INT DEFAULT 0 NOT NULL COMMENT '一级返佣比例',
10   - brokerage_second_percent INT DEFAULT 0 NOT NULL COMMENT '二级返佣比例',
11   - brokerage_withdraw_min_price INT DEFAULT 0 NOT NULL COMMENT '用户提现最低金额',
12   - brokerage_withdraw_fee_percent INT DEFAULT 0 NOT NULL COMMENT '提现手续费百分比',
13   - brokerage_bank_names VARCHAR(200) DEFAULT '' NOT NULL COMMENT '提现银行(字典类型=brokerage_bank_name)',
14   - brokerage_frozen_days INT DEFAULT 7 NOT NULL COMMENT '佣金冻结时间(天)',
15   - brokerage_withdraw_types VARCHAR(32) DEFAULT '1,2,3,4' NOT NULL COMMENT '提现方式:1-钱包;2-银行卡;3-微信;4-支付宝',
16   - creator VARCHAR(64) DEFAULT '' NULL COMMENT '创建者',
17   - create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
18   - updater VARCHAR(64) DEFAULT '' NULL COMMENT '更新者',
19   - update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
20   - deleted BIT DEFAULT b'0' NOT NULL COMMENT '是否删除',
21   - tenant_id BIGINT DEFAULT 0 NOT NULL COMMENT '租户编号'
22   -) COMMENT '交易中心配置';
23   -
24   -# alter table trade_config
25   -# add brokerage_withdraw_fee_percent int default 0 not null comment '提现手续费百分比' after brokerage_withdraw_min_price;
26   -
27   -# alter table trade_brokerage_user
28   -# add level int not null default 1 comment '等级' after frozen_price;
29   -# alter table trade_brokerage_user
30   -# add path varchar(2000) null comment '路径' after level;
31   -
32   -
33   --- 增加分销用户扩展表
34   -create table trade_brokerage_user
35   -(
36   - id bigint auto_increment comment '用户编号' primary key,
37   - bind_user_id bigint null comment '推广员编号',
38   - bind_user_time datetime null comment '推广员绑定时间',
39   - brokerage_enabled bit default 1 not null comment '是否成为推广员',
40   - brokerage_time datetime null comment '成为分销员时间',
41   - price int default 0 not null comment '可用佣金',
42   - frozen_price int default 0 not null comment '冻结佣金',
43   - creator varchar(64) default '' null comment '创建者',
44   - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
45   - updater varchar(64) default '' null comment '更新者',
46   - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
47   - deleted bit default b'0' not null comment '是否删除',
48   - tenant_id bigint default 0 not null comment '租户编号'
49   -)
50   - comment '分销用户';
51   -
52   -create index idx_invite_user_id on trade_brokerage_user (bind_user_id) comment '推广员编号';
53   -create index idx_agent on trade_brokerage_user (brokerage_enabled) comment '是否成为推广员';
54   -
55   -
56   -create table trade_brokerage_record
57   -(
58   - id int auto_increment comment '编号'
59   - primary key,
60   - user_id bigint not null comment '用户编号',
61   - biz_id varchar(64) default '' not null comment '业务编号',
62   - biz_type tinyint default 0 not null comment '业务类型:1-订单,2-提现',
63   - title varchar(64) default '' not null comment '标题',
64   - price int default 0 not null comment '金额',
65   - total_price int default 0 not null comment '当前总佣金',
66   - description varchar(500) default '' not null comment '说明',
67   - status tinyint default 0 not null comment '状态:0-待结算,1-已结算,2-已取消',
68   - frozen_days int default 0 not null comment '冻结时间(天)',
69   - unfreeze_time datetime null comment '解冻时间',
70   - source_user_level int not null comment '来源用户等级',
71   - source_user_id bigint not null comment '来源用户编号',
72   - creator varchar(64) default '' null comment '创建者',
73   - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
74   - updater varchar(64) default '' null comment '更新者',
75   - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
76   - deleted bit default b'0' not null comment '是否删除',
77   - tenant_id bigint default 0 not null comment '租户编号'
78   -)
79   - comment '佣金记录';
80   -
81   -create index idx_user_id on trade_brokerage_record (user_id) comment '用户编号';
82   -create index idx_biz on trade_brokerage_record (biz_type, biz_id) comment '业务';
83   -create index idx_status on trade_brokerage_record (status) comment '状态';
84   -
85   -
86   -create table trade_brokerage_withdraw
87   -(
88   - id bigint auto_increment comment '编号'
89   - primary key,
90   - user_id bigint not null comment '用户编号',
91   - price int default 0 not null comment '提现金额',
92   - fee_price int default 0 not null comment '提现手续费',
93   - total_price int default 0 not null comment '当前总佣金',
94   - type tinyint default 0 not null comment '提现类型:1-钱包;2-银行卡;3-微信;4-支付宝',
95   - name varchar(64) null comment '真实姓名',
96   - account_no varchar(64) null comment '账号',
97   - bank_name varchar(100) null comment '银行名称',
98   - bank_address varchar(200) null comment '开户地址',
99   - account_qr_code_url varchar(512) null comment '收款码',
100   - status tinyint(2) default 0 not null comment '状态:0-审核中,10-审核通过 20-审核不通过;预留:11 - 提现成功;21-提现失败',
101   - audit_reason varchar(128) null comment '审核驳回原因',
102   - audit_time datetime null comment '审核时间',
103   - remark varchar(500) null comment '备注',
104   - creator varchar(64) default '' null comment '创建者',
105   - create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
106   - updater varchar(64) default '' null comment '更新者',
107   - update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
108   - deleted bit default b'0' not null comment '是否删除',
109   - tenant_id bigint default 0 not null comment '租户编号'
110   -)
111   - comment '佣金提现';
112   -
113   -create index idx_user_id on trade_brokerage_withdraw (user_id) comment '用户编号';
114   -create index idx_audit_status on trade_brokerage_withdraw (status) comment '状态';
115   -
116   --- 增加字典
117   -insert into system_dict_type(type, name)
118   -values ('brokerage_enabled_condition', '分佣模式');
119   -insert into system_dict_data(dict_type, label, value, sort, remark)
120   -values ('brokerage_enabled_condition', '人人分销', 1, 1, '所有用户都可以分销'),
121   - ('brokerage_enabled_condition', '指定分销', 2, 2, '仅可后台手动设置推广员');
122   -
123   -insert into system_dict_type(type, name)
124   -values ('brokerage_bind_mode', '分销关系绑定模式');
125   -insert into system_dict_data(dict_type, label, value, sort, remark)
126   -values ('brokerage_bind_mode', '没有推广人', 1, 1, '只要用户没有推广人,随时都可以绑定推广关系'),
127   - ('brokerage_bind_mode', '新用户', 2, 2, '仅新用户注册时才能绑定推广关系'),
128   - ('brokerage_bind_mode', '扫码覆盖', 3, 3, '如果用户已经有推广人,推广人会被变更');
129   -
130   -insert into system_dict_type(type, name)
131   -values ('brokerage_withdraw_type', '佣金提现类型');
132   -insert into system_dict_data(dict_type, label, value, sort)
133   -values ('brokerage_withdraw_type', '钱包', 1, 1),
134   - ('brokerage_withdraw_type', '银行卡', 2, 2),
135   - ('brokerage_withdraw_type', '微信', 3, 3),
136   - ('brokerage_withdraw_type', '支付宝', 4, 4);
137   -
138   -insert into system_dict_type(type, name)
139   -values ('brokerage_record_biz_type', '佣金记录业务类型');
140   -insert into system_dict_data(dict_type, label, value, sort)
141   -values ('brokerage_record_biz_type', '订单返佣', 1, 1),
142   - ('brokerage_record_biz_type', '申请提现', 2, 2),
143   - ('brokerage_record_biz_type', '申请提现驳回', 3, 3);
144   -
145   -insert into system_dict_type(type, name)
146   -values ('brokerage_record_status', '佣金记录状态');
147   -insert into system_dict_data(dict_type, label, value, sort)
148   -values ('brokerage_record_status', '待结算', 0, 0),
149   - ('brokerage_record_status', '已结算', 1, 1),
150   - ('brokerage_record_status', '已取消', 2, 2);
151   -
152   -insert into system_dict_type(type, name)
153   -values ('brokerage_withdraw_status', '佣金提现状态');
154   -insert into system_dict_data(dict_type, label, value, sort, color_type)
155   -values ('brokerage_withdraw_status', '审核中', 0, 0, ''),
156   - ('brokerage_withdraw_status', '审核通过', 10, 10, 'success'),
157   - ('brokerage_withdraw_status', '提现成功', 11, 11, 'success'),
158   - ('brokerage_withdraw_status', '审核不通过', 20, 20, 'danger'),
159   - ('brokerage_withdraw_status', '提现失败', 21, 21, 'danger');
160   -
161   -insert into system_dict_type(type, name)
162   -values ('brokerage_bank_name', '佣金提现银行');
163   -insert into system_dict_data(dict_type, label, value, sort)
164   -values ('brokerage_bank_name', '工商银行', 0, 0),
165   - ('brokerage_bank_name', '建设银行', 1, 1),
166   - ('brokerage_bank_name', '农业银行', 2, 2),
167   - ('brokerage_bank_name', '中国银行', 3, 3),
168   - ('brokerage_bank_name', '交通银行', 4, 4),
169   - ('brokerage_bank_name', '招商银行', 5, 5);
170   -
171   -
172   --- 交易中心配置:菜单 SQL
173   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
174   -VALUES ('交易中心配置', '', 2, 0, 2072, 'config', 'ep:setting', 'trade/config/index', 0, 'TradeConfig');
175   --- 按钮父菜单ID
176   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
177   -SELECT @parentId := LAST_INSERT_ID();
178   --- 按钮 SQL
179   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
180   -VALUES ('交易中心配置查询', 'trade:config:query', 3, 1, @parentId, '', '', '', 0);
181   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
182   -VALUES ('交易中心配置保存', 'trade:config:save', 3, 2, @parentId, '', '', '', 0);
183   -
184   -
185   --- 增加菜单:分销
186   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
187   -VALUES ('分销', '', 1, 5, 2072, 'brokerage', 'fa-solid:project-diagram', '', 0, '');
188   --- 按钮父菜单ID
189   -SELECT @brokerageMenuId := LAST_INSERT_ID();
190   -
191   --- 增加菜单:分销员
192   --- 菜单 SQL
193   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
194   -VALUES ('分销用户', '', 2, 0, @brokerageMenuId, 'brokerage-user', 'fa-solid:user-tie', 'trade/brokerage/user/index', 0,
195   - 'TradeBrokerageUser');
196   --- 按钮父菜单ID
197   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
198   -SELECT @parentId := LAST_INSERT_ID();
199   --- 按钮 SQL
200   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
201   -VALUES ('分销用户查询', 'trade:brokerage-user:query', 3, 1, @parentId, '', '', '', 0);
202   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
203   -VALUES ('分销用户推广人查询', 'trade:brokerage-user:user-query', 3, 2, @parentId, '', '', '', 0);
204   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
205   -VALUES ('分销用户推广订单查询', 'trade:brokerage-user:order-query', 3, 3, @parentId, '', '', '', 0);
206   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
207   -VALUES ('分销用户修改推广资格', 'trade:brokerage-user:update-brokerage-enable', 3, 4, @parentId, '', '', '', 0);
208   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
209   -VALUES ('分销用户修改推广员', 'trade:brokerage-user:update-bind-user', 3, 5, @parentId, '', '', '', 0);
210   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
211   -VALUES ('分销用户清除推广员', 'trade:brokerage-user:clear-bind-user', 3, 6, @parentId, '', '', '', 0);
212   -
213   --- 增加菜单:佣金记录
214   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
215   -VALUES ('佣金记录', '', 2, 1, @brokerageMenuId, 'brokerage-record', 'fa:money', 'trade/brokerage/record/index', 0,
216   - 'TradeBrokerageRecord');
217   --- 按钮父菜单ID
218   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
219   -SELECT @parentId := LAST_INSERT_ID();
220   --- 按钮 SQL
221   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
222   -VALUES ('佣金记录查询', 'trade:brokerage-record:query', 3, 1, @parentId, '', '', '', 0);
223   -
224   --- 增加菜单:佣金提现
225   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
226   -VALUES ('佣金提现', '', 2, 2, @brokerageMenuId, 'brokerage-withdraw', 'fa:credit-card',
227   - 'trade/brokerage/withdraw/index', 0, 'TradeBrokerageWithdraw');
228   --- 按钮父菜单ID
229   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
230   -SELECT @parentId := LAST_INSERT_ID();
231   --- 按钮 SQL
232   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
233   -VALUES ('佣金提现查询', 'trade:brokerage-withdraw:query', 3, 1, @parentId, '', '', '', 0);
234   -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
235   -VALUES ('佣金提现审核', 'trade:brokerage-withdraw:audit', 3, 2, @parentId, '', '', '', 0);
236   -
237   --- 站内信模板
238   -INSERT INTO `ruoyi-vue-pro`.system_notify_template (name, code, nickname, content, type, params, status)
239   -VALUES
240   - ('佣金提现(审核通过)', 'brokerage_withdraw_audit_approve', 'system', '您在{createTime}提现¥{price}元的申请已通过审核', 2, '["createTime","price"]', 0),
241   - ('佣金提现(审核不通过)', 'brokerage_withdraw_audit_reject', 'system', '您在{createTime}提现¥{price}元的申请未通过审核,原因:{reason}', 2, '["createTime","price","reason"]', 0);
sql/mysql/optional/mall_trade_log.sql deleted
1   -ALTER TABLE `ruoyi-vue-pro`.`trade_after_sale_log`
2   - ADD COLUMN `before_status` int NOT NULL COMMENT '售前状态' AFTER `id`,
3   - ADD COLUMN `after_status` int NOT NULL COMMENT '售后状态' AFTER `before_status`;
sql/mysql/point.sql deleted
1   -ALTER TABLE trade_order ADD COLUMN use_point int NOT NULL DEFAULT 0 COMMENT '使用的积分' AFTER point_price;
2   -ALTER TABLE trade_order ADD COLUMN refund_point int NOT NULL DEFAULT 0 COMMENT '退还的使用积分' AFTER use_point;
3   -ALTER TABLE trade_order ADD COLUMN give_point int NOT NULL DEFAULT 0 COMMENT '赠送的积分' AFTER refund_point;
4   -
5   -ALTER TABLE trade_order_item ADD COLUMN use_point int NOT NULL DEFAULT 0 COMMENT '使用的积分' AFTER point_price;
6   -ALTER TABLE trade_order_item ADD COLUMN give_point int NOT NULL DEFAULT 0 COMMENT '赠送的积分' AFTER use_point;
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/brokerage/BrokerageBindModeEnum.java
... ... @@ -18,15 +18,15 @@ public enum BrokerageBindModeEnum implements IntArrayValuable {
18 18 /**
19 19 * 只要用户没有推广人,随时都可以绑定分销关系
20 20 */
21   - ANYTIME(1, "没有推广人"),
  21 + ANYTIME(1, "首次绑定"),
22 22 /**
23 23 * 仅新用户注册时才能绑定推广关系
24 24 */
25   - REGISTER(2, "新用户"),
  25 + REGISTER(2, "注册绑定"),
26 26 /**
27 27 * 每次扫码都覆盖
28 28 */
29   - OVERRIDE(3, "扫码覆盖"),
  29 + OVERRIDE(3, "覆盖绑定"),
30 30 ;
31 31  
32 32 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BrokerageBindModeEnum::getMode).toArray();
... ...
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java
... ... @@ -80,7 +80,7 @@ public class TradeConfigBaseVO {
80 80 private Integer brokerageFrozenDays;
81 81  
82 82 @Schema(description = "提现方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "[0, 1]")
83   - @NotNull(message = "提现方式不能为空")
  83 + @NotEmpty(message = "提现方式不能为空")
84 84 @InEnum(value = BrokerageWithdrawTypeEnum.class, message = "提现方式必须是 {value}")
85 85 private List<Integer> brokerageWithdrawTypes;
86 86  
... ...