42 Commits

Author SHA1 Message Date
37d92b9dea feat:
1. fix bugs
2026-02-15 11:44:03 +08:00
6d85686270 feat:
1. fix bugs
2026-02-15 11:38:22 +08:00
0656cabe4a feat:
1. fix bugs
2026-02-15 11:30:52 +08:00
d3e09b1cb9 feat:
1. fix bugs
2026-02-15 11:28:00 +08:00
lzqadmin
72a8a318cf 1 2026-02-15 00:42:32 +08:00
lzqadmin
943aa3842a 修改划拨福利包接口名 2026-02-15 00:39:34 +08:00
lzqadmin
25da381c4e 1 2026-02-15 00:29:50 +08:00
lzqadmin
0e06403528 后台excel批量划拨用户福利包优化提示 2026-02-15 00:25:15 +08:00
88a0a5616b feat:
1. add lottery
2026-02-15 00:05:34 +08:00
9a086b86cd feat:
1. add lottery
2026-02-14 22:51:10 +08:00
f5746394fa feat:
1. add lottery
2026-02-14 22:47:51 +08:00
lzqadmin
d4e2bed039 后台excel批量划拨用户福利包 2026-02-14 22:24:22 +08:00
16a9bcfbd8 feat:
1. add lottery
2026-02-14 22:00:02 +08:00
9674374fad feat:
1. add lottery
2026-02-14 21:42:38 +08:00
lzqadmin
8be8964eff 新增抽奖枚举 2026-02-14 20:13:07 +08:00
lzqadmin
2af46a38b1 获取省市区列表-修改提示文案 2026-02-14 19:32:49 +08:00
lzqadmin
e2e9b18503 福利积分 , 现金券 , 佣金流水接口 2026-02-14 17:19:58 +08:00
e1105dae89 feat:
1. add lottery
2026-02-14 16:31:51 +08:00
lzqadmin
f5a9d171e0 兑换福利包 2026-02-14 16:04:04 +08:00
a3752fe7b9 update:
1. update user-point
2026-02-14 14:17:20 +08:00
lzqadmin
5ef97c4da7 地址regionsInfoId 改 regionsId 2026-02-14 13:29:51 +08:00
lzqadmin
d82d91aec5 将积分流水中sourceType改成varchar(256), 新建线下业务模块枚举 2026-02-14 13:15:20 +08:00
lzqadmin
a123ea05e8 佣金账户 2026-02-14 12:24:36 +08:00
lzqadmin
7a429deb99 线上未执行sql , 用户消息 , 用户积分, 佣金账户 , 福利包每日结算 2026-02-14 11:25:58 +08:00
lzqadmin
8530f424c9 整理执行sql文件 2026-02-14 11:11:54 +08:00
lzqadmin
667dc58dc1 common_user_address 建表语句 2026-02-14 10:58:47 +08:00
lzqadmin
884075d3f2 兑换福利包接口更换名字 2026-02-13 23:51:53 +08:00
lzqadmin
5857fe4171 1 2026-02-13 23:47:34 +08:00
lzqadmin
9436ea8942 1 2026-02-13 23:29:54 +08:00
lzqadmin
bd58fd716a 1 2026-02-13 23:02:50 +08:00
lzqadmin
0a2d1a1f32 福利包每日产出, market用户兑换福利包 2026-02-13 23:00:26 +08:00
7fc365ce4c update:
1. update user-point
2026-02-13 21:13:24 +08:00
54a61ec5d5 update:
1. update user-point
2026-02-13 21:08:56 +08:00
c3e3139100 update:
1. update benefit-point
2026-02-13 20:57:25 +08:00
2536dc9528 update:
1. update benefit-point
2026-02-13 20:49:02 +08:00
81db304e16 update:
1. fix bugs
2026-02-13 20:35:12 +08:00
lzqadmin
4582db201a 1 2026-02-13 19:16:31 +08:00
lzqadmin
90928754d9 后台划拨福利积分: 用户到用户 2026-02-13 19:14:58 +08:00
lzqadmin
8ba9609276 将福利积分, 现金券, 福利包移动至 market 2026-02-13 18:45:34 +08:00
2bccdd7177 update:
1. fix bugs
2026-02-13 17:35:40 +08:00
eddfc26a45 feat:
1. 用户积分查询
2026-02-13 15:35:04 +08:00
lzqadmin
b2839ed1d5 积分流水-业务类型修订 2026-02-13 13:44:05 +08:00
202 changed files with 6718 additions and 3401 deletions

View File

@@ -0,0 +1,5 @@
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787265, 2019338015981219841, 'userNotice', '用户通知', 'menu', '/common/commonUserNotice', 'iconfont iconicon_voipphone', 1, 1, 0, 1, '', '', 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/common/commonUserNotice/add', 'plus', 1, 2, 1, 1, null, null, 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/common/commonUserNotice/edit', 'form', 2, 2, 2, 1, null, null, 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete', '/common/notice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/common/commonUserNotice/view', 'file-text', 4, 2, 2, 1, null, null, 0);

View File

@@ -3,7 +3,7 @@ CREATE TABLE user_notice
(
id int8 NOT NULL PRIMARY KEY, -- 主键
user_id int8 DEFAULT 0 NOT NULL, -- 用户id
notice_type int4 DEFAULT 0 NOT NULL, -- 通知类型 0-系统通知 1-app通知 2-market通知
notice_type int4 DEFAULT 0 NOT NULL, -- 通知类型 0-全局通知 1-APP系统通知 2-Market系统通知 3-APP用户通知 4-Market用户通知
module_type varchar(256) NULL, -- 业务模块
has_read int4 DEFAULT 0 NOT NULL, -- 是否已读 0-否 1-是
title VARCHAR(100) NULL, -- 标题
@@ -21,7 +21,7 @@ CREATE TABLE user_notice
COMMENT ON TABLE user_notice IS '用户通知';
COMMENT ON COLUMN user_notice.id IS '主键';
COMMENT ON COLUMN user_notice.user_id IS '用户id';
COMMENT ON COLUMN user_notice.notice_type IS '通知类型 0-系统通知 1-app通知 2-market通知';
COMMENT ON COLUMN user_notice.notice_type IS '通知类型 0-全局通知 1-APP系统通知 2-Market系统通知 3-APP用户通知 4-Market用户通知';
COMMENT ON COLUMN user_notice.module_type IS '业务模块类型';
COMMENT ON COLUMN user_notice.has_read IS '是否已读 0-否 1-是';
COMMENT ON COLUMN user_notice.title IS '标题';
@@ -77,3 +77,949 @@ VALUES (2020766604569534467, 2020766458167353346, 'notice_type', '3', 'APP用户
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766604569534468, 2020766458167353346, 'notice_type', '3', 'Market用户通知', 2, '', 0, 1, 0);
--- 福利积分 benefit_point
DROP TABLE IF EXISTS benefit_point;
create table benefit_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table benefit_point is '用户福利值表';
comment on column benefit_point.id is '主键(用户id)';
comment on column benefit_point.amount is '金额';
comment on column benefit_point.version is '版本号';
comment on column benefit_point.create_user is '创建人';
comment on column benefit_point.create_dept is '创建部门';
comment on column benefit_point.create_time is '创建时间';
comment on column benefit_point.update_user is '修改人';
comment on column benefit_point.update_time is '修改时间';
comment on column benefit_point.status is '状态';
comment on column benefit_point.is_deleted is '是否已删除';
DROP TABLE IF EXISTS benefit_point_log;
create table benefit_point_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
fee decimal(14, 2) default 0,
source_type varchar(256), -- 来源类型 0-福利包产出 1-福利包兑换 2-用户直推 3-otc交易
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_umbl_uid
on benefit_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table benefit_point_log is '用户福利值流水表';
comment on column benefit_point_log.id is '主键';
comment on column benefit_point_log.user_id is '用户id';
comment on column benefit_point_log.amount is '金额';
comment on column benefit_point_log.last_amount is '上一笔金额';
comment on column benefit_point_log.fee is '手续费';
comment on column benefit_point_log.source_type is '来源类型';
comment on column benefit_point_log.source_id is '来源id';
comment on column benefit_point_log.source_detail is '来源详情';
comment on column benefit_point_log.type is '消费类型 1-收入 2-支出';
comment on column benefit_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column benefit_point_log.statistical_date is '统计时间';
comment on column benefit_point_log.remark is '备注';
comment on column benefit_point_log.create_user is '创建人';
comment on column benefit_point_log.create_dept is '创建部门';
comment on column benefit_point_log.create_time is '创建时间';
comment on column benefit_point_log.update_user is '修改人';
comment on column benefit_point_log.update_time is '修改时间';
comment on column benefit_point_log.status is '状态';
comment on column benefit_point_log.is_deleted is '是否已删除';
--- 现金券 cash_coupon
DROP TABLE IF EXISTS cash_coupon;
create table cash_coupon
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table cash_coupon is '用户现金券表';
comment on column cash_coupon.id is '主键(用户id)';
comment on column cash_coupon.amount is '面额';
comment on column cash_coupon.version is '版本号';
comment on column cash_coupon.create_user is '创建人';
comment on column cash_coupon.create_dept is '创建部门';
comment on column cash_coupon.create_time is '创建时间';
comment on column cash_coupon.update_user is '修改人';
comment on column cash_coupon.update_time is '修改时间';
comment on column cash_coupon.status is '状态';
comment on column cash_coupon.is_deleted is '是否已删除';
DROP TABLE IF EXISTS cash_coupon_log;
create table cash_coupon_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_umcl_uid
on cash_coupon_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table cash_coupon_log is '用户现金券流水表';
comment on column cash_coupon_log.id is '主键';
comment on column cash_coupon_log.user_id is '用户id';
comment on column cash_coupon_log.amount is '金额';
comment on column cash_coupon_log.last_amount is '上一笔金额';
comment on column cash_coupon_log.source_type is '来源类型';
comment on column cash_coupon_log.source_id is '来源id';
comment on column cash_coupon_log.source_detail is '来源详情';
comment on column cash_coupon_log.type is '消费类型 1-收入 2-支出';
comment on column cash_coupon_log.statistical_date is '统计时间';
comment on column cash_coupon_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column cash_coupon_log.remark is '备注';
comment on column cash_coupon_log.create_user is '创建人';
comment on column cash_coupon_log.create_dept is '创建部门';
comment on column cash_coupon_log.create_time is '创建时间';
comment on column cash_coupon_log.update_user is '修改人';
comment on column cash_coupon_log.update_time is '修改时间';
comment on column cash_coupon_log.status is '状态';
comment on column cash_coupon_log.is_deleted is '是否已删除';
--- 用户积分 user_point
DROP TABLE IF EXISTS user_point;
create table user_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table user_point is '用户商城积分表';
comment on column user_point.id is '主键(用户id)';
comment on column user_point.amount is '面额';
comment on column user_point.version is '版本号';
comment on column user_point.create_user is '创建人';
comment on column user_point.create_dept is '创建部门';
comment on column user_point.create_time is '创建时间';
comment on column user_point.update_user is '修改人';
comment on column user_point.update_time is '修改时间';
comment on column user_point.is_deleted is '是否已删除';
DROP TABLE IF EXISTS user_point_log;
create table user_point_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_uapl_uid
on user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table user_point_log is '用户商城积分流水表';
comment on column user_point_log.id is '主键';
comment on column user_point_log.user_id is '用户id';
comment on column user_point_log.amount is '金额';
comment on column user_point_log.last_amount is '上一笔金额';
comment on column user_point_log.source_type is '来源类型';
comment on column user_point_log.source_id is '来源id';
comment on column user_point_log.source_detail is '来源详情';
comment on column user_point_log.type is '消费类型 1-收入 2-支出';
comment on column user_point_log.statistical_date is '统计时间';
comment on column user_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column user_point_log.remark is '备注';
comment on column user_point_log.create_user is '创建人';
comment on column user_point_log.create_dept is '创建部门';
comment on column user_point_log.create_time is '创建时间';
comment on column user_point_log.update_user is '修改人';
comment on column user_point_log.update_time is '修改时间';
comment on column user_point_log.status is '状态';
comment on column user_point_log.is_deleted is '是否已删除';
DROP TABLE IF EXISTS user_commission;
create table user_commission
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table user_commission is '用户佣金表';
comment on column user_commission.id is '主键';
comment on column user_commission.amount is '佣金金额';
comment on column user_commission.version is '版本号';
comment on column user_commission.create_user is '创建人';
comment on column user_commission.create_dept is '创建部门';
comment on column user_commission.create_time is '创建时间';
comment on column user_commission.update_user is '修改人';
comment on column user_commission.update_time is '修改时间';
comment on column user_commission.status is '状态';
comment on column user_commission.is_deleted is '是否已删除';
DROP TABLE IF EXISTS user_commission_log;
create table user_commission_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table user_commission_log is '用户佣金流水表';
comment on column user_commission_log.id is '主键';
comment on column user_commission_log.user_id is '用户id';
comment on column user_commission_log.amount is '金额';
comment on column user_commission_log.last_amount is '上一笔金额';
comment on column user_commission_log.source_type is '来源类型';
comment on column user_commission_log.source_id is '来源id';
comment on column user_commission_log.source_detail is '来源详情';
comment on column user_commission_log.type is '消费类型 1-收入 2-支出';
comment on column user_commission_log.statistical_date is '统计时间';
comment on column user_commission_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column user_commission_log.remark is '备注';
comment on column user_commission_log.create_user is '创建人';
comment on column user_commission_log.create_dept is '创建部门';
comment on column user_commission_log.create_time is '创建时间';
comment on column user_commission_log.update_user is '修改人';
comment on column user_commission_log.update_time is '修改时间';
comment on column user_commission_log.status is '状态';
comment on column user_commission_log.is_deleted is '是否已删除';
create index idx_ucl_uid
on user_commission_log (is_complete, user_id, type, statistical_date, create_time DESC);
-- 佣金账户表
DROP TABLE IF EXISTS market_commission_account;
create table market_commission_account
(
id int8 not null primary key,
account_name varchar(128), -- 账户名称
account_code varchar(64), -- 账户代码
account_type int4, -- 账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金
amount decimal(14, 2) default 0, -- 账户总余额
version int4 default 1,
remark varchar(200),
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mca_code
on market_commission_account (account_code);
create index idx_mca_type
on market_commission_account (account_type);
comment on table market_commission_account is '用户佣金账户表';
comment on column market_commission_account.id is '主键';
comment on column market_commission_account.account_name is '账户名称';
comment on column market_commission_account.account_code is '账户代码';
comment on column market_commission_account.account_type is '账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金';
comment on column market_commission_account.amount is '账户总余额';
comment on column market_commission_account.version is '版本号';
comment on column market_commission_account.remark is '备注';
comment on column market_commission_account.create_user is '创建人';
comment on column market_commission_account.create_dept is '创建部门';
comment on column market_commission_account.create_time is '创建时间';
comment on column market_commission_account.update_user is '修改人';
comment on column market_commission_account.update_time is '修改时间';
comment on column market_commission_account.status is '状态';
comment on column market_commission_account.is_deleted is '是否已删除';
---------------------------------------insert start
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017485441885196290, '商品成本账户', 'COMMISSION_GOODS_COST', '0', '0.0000', 1, '商品成本账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:29:47', 1123598821738675201, '2026-01-31 14:30:16.04',
1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017485893100032002, '分发商城积分账户', 'COMMISSION_USER_POINT_LOG', '1', '0.0000', 1, '分发商城积分账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:31:34.663', 1123598821738675201,
'2026-01-31 14:31:34.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486037128237058, '分发直推人佣金账户', 'COMMISSION_DIRECT_PUSH', '2', '0.0000', 1, '分发直推人佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:32:08.998', 1123598821738675201,
'2026-01-31 14:32:08.998', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486179294171138, '运营账户', 'COMMISSION_OPERATION', '3', '0.0000', 1, '运营账户', 1123598821738675201,
1123598813738675201, '2026-01-31 14:32:42.889', 1123598821738675201, '2026-01-31 14:32:42.889', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486299502923778, '分发广告补贴账户', 'COMMISSION_ADVERTISING', '4', '0.0000', 1, '分发广告补贴账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:33:11.552', 1123598821738675201,
'2026-01-31 14:33:11.552', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486437340336130, '分发服务商佣金账户', 'COMMISSION_SERVICE_PROVIDER', '5', '0.0000', 1,
'分发服务商佣金账户', 1123598821738675201, 1123598813738675201, '2026-01-31 14:33:44.407', 1123598821738675201,
'2026-01-31 14:33:44.407', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486568441696258, '分发极差代理佣金账户', 'COMMISSION_AGENCY', '6', '0.0000', 1, '分发极差代理佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:34:15.663', 1123598821738675201,
'2026-01-31 14:34:15.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486664117964802, '联创佣金账户', 'COMMISSION_CO_CREATOR', '7', '0.0000', 1, '联创佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:34:38.479', 1123598821738675201,
'2026-01-31 14:34:38.479', 1, 0);
---------------------------------------insert end
-- 25%商品成本佣金流水表
DROP TABLE IF EXISTS market_commission_goods_cost_log;
create table market_commission_goods_cost_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index inx_mcgcl_uid
on market_commission_goods_cost_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index inx_mcgcl_aid
on market_commission_goods_cost_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_goods_cost_log is '25%商品成本佣金流水表';
comment on column market_commission_goods_cost_log.id is '主键';
comment on column market_commission_goods_cost_log.account_id is '账户id';
comment on column market_commission_goods_cost_log.user_id is '用户id';
comment on column market_commission_goods_cost_log.amount is '金额';
comment on column market_commission_goods_cost_log.last_amount is '上笔金额';
comment on column market_commission_goods_cost_log.source_type is '来源类型';
comment on column market_commission_goods_cost_log.source_id is '来源id';
comment on column market_commission_goods_cost_log.source_detail is '来源详情';
comment on column market_commission_goods_cost_log.type is '类型 1-收入 2-支出';
comment on column market_commission_goods_cost_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_goods_cost_log.statistical_date is '统计时间';
comment on column market_commission_goods_cost_log.remark is '备注';
comment on column market_commission_goods_cost_log.create_user is '创建人';
comment on column market_commission_goods_cost_log.create_dept is '创建部门';
comment on column market_commission_goods_cost_log.create_time is '创建时间';
comment on column market_commission_goods_cost_log.update_user is '修改人';
comment on column market_commission_goods_cost_log.update_time is '修改时间';
comment on column market_commission_goods_cost_log.status is '状态';
comment on column market_commission_goods_cost_log.is_deleted is '是否已删除';
-- 30%购买人获取用户积分佣金流水表
DROP TABLE IF EXISTS market_commission_user_point_log;
create table market_commission_user_point_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcupl_uid
on market_commission_user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcupl_aid
on market_commission_user_point_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_user_point_log is '30%购买人获取用户积分佣金流水表';
comment on column market_commission_user_point_log.id is '主键';
comment on column market_commission_user_point_log.account_id is '账户id';
comment on column market_commission_user_point_log.user_id is '用户id';
comment on column market_commission_user_point_log.amount is '变动金额';
comment on column market_commission_user_point_log.last_amount is '上笔金额';
comment on column market_commission_user_point_log.source_type is '来源类型';
comment on column market_commission_user_point_log.source_id is '来源id';
comment on column market_commission_user_point_log.source_detail is '来源详情';
comment on column market_commission_user_point_log.type is '类型 1-收入 2-支出';
comment on column market_commission_user_point_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_user_point_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_user_point_log.statistical_date is '统计时间';
comment on column market_commission_user_point_log.remark is '备注';
comment on column market_commission_user_point_log.create_user is '创建人';
comment on column market_commission_user_point_log.create_dept is '创建部门';
comment on column market_commission_user_point_log.create_time is '创建时间';
comment on column market_commission_user_point_log.update_user is '修改人';
comment on column market_commission_user_point_log.update_time is '修改时间';
comment on column market_commission_user_point_log.status is '状态';
comment on column market_commission_user_point_log.is_deleted is '是否已删除';
-- 10%直推人佣金流水表
DROP TABLE IF EXISTS market_commission_direct_push_log;
create table market_commission_direct_push_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcdpl_uid
on market_commission_direct_push_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcdpl_aid
on market_commission_direct_push_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_direct_push_log is '10%直推人佣金流水表';
comment on column market_commission_direct_push_log.id is '主键';
comment on column market_commission_direct_push_log.account_id is '账户id';
comment on column market_commission_direct_push_log.user_id is '用户id';
comment on column market_commission_direct_push_log.amount is '变动金额';
comment on column market_commission_direct_push_log.last_amount is '上笔金额';
comment on column market_commission_direct_push_log.source_type is '来源类型';
comment on column market_commission_direct_push_log.source_id is '来源id';
comment on column market_commission_direct_push_log.source_detail is '来源详情';
comment on column market_commission_direct_push_log.type is '类型 1-收入 2-支出';
comment on column market_commission_direct_push_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_direct_push_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_direct_push_log.statistical_date is '统计时间';
comment on column market_commission_direct_push_log.remark is '备注';
comment on column market_commission_direct_push_log.create_user is '创建人';
comment on column market_commission_direct_push_log.create_dept is '创建部门';
comment on column market_commission_direct_push_log.create_time is '创建时间';
comment on column market_commission_direct_push_log.update_user is '修改人';
comment on column market_commission_direct_push_log.update_time is '修改时间';
comment on column market_commission_direct_push_log.status is '状态';
comment on column market_commission_direct_push_log.is_deleted is '是否已删除';
-- 5%运营佣金流水表
DROP TABLE IF EXISTS market_commission_operation_log;
create table market_commission_operation_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
cut_amount decimal(14, 2) default 0, -- 随机立减金额
cut_detail text, -- 随机立减说明
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcol_aid
on market_commission_operation_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_operation_log is '5%运营佣金流水表';
comment on column market_commission_operation_log.id is '主键';
comment on column market_commission_operation_log.account_id is '账户id';
comment on column market_commission_operation_log.amount is '变动金额';
comment on column market_commission_operation_log.last_amount is '上笔金额';
comment on column market_commission_operation_log.cut_amount is '随机立减金额';
comment on column market_commission_operation_log.cut_detail is '随机立减说明';
comment on column market_commission_operation_log.source_type is '来源类型';
comment on column market_commission_operation_log.source_id is '来源id';
comment on column market_commission_operation_log.source_detail is '来源详情';
comment on column market_commission_operation_log.type is '类型 1-收入 2-支出';
comment on column market_commission_operation_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_operation_log.statistical_date is '统计时间';
comment on column market_commission_operation_log.remark is '备注';
comment on column market_commission_operation_log.create_user is '创建人';
comment on column market_commission_operation_log.create_dept is '创建部门';
comment on column market_commission_operation_log.create_time is '创建时间';
comment on column market_commission_operation_log.update_user is '修改人';
comment on column market_commission_operation_log.update_time is '修改时间';
comment on column market_commission_operation_log.status is '状态';
comment on column market_commission_operation_log.is_deleted is '是否已删除';
-- 5%广告补贴佣金流水表
DROP TABLE IF EXISTS market_commission_advertising_log;
create table market_commission_advertising_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcal_aid
on market_commission_advertising_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_advertising_log is '5%广告补贴佣金流水表';
comment on column market_commission_advertising_log.id is '主键';
comment on column market_commission_advertising_log.account_id is '账户id';
comment on column market_commission_advertising_log.amount is '变动金额';
comment on column market_commission_advertising_log.last_amount is '上笔金额';
comment on column market_commission_advertising_log.source_type is '来源类型 0-商城订单 1-发放广告佣金';
comment on column market_commission_advertising_log.source_id is '来源id';
comment on column market_commission_advertising_log.source_detail is '来源详情';
comment on column market_commission_advertising_log.type is '类型 1-收入 2-支出';
comment on column market_commission_advertising_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_advertising_log.statistical_date is '统计时间';
comment on column market_commission_advertising_log.remark is '备注';
comment on column market_commission_advertising_log.create_user is '创建人';
comment on column market_commission_advertising_log.create_dept is '创建部门';
comment on column market_commission_advertising_log.create_time is '创建时间';
comment on column market_commission_advertising_log.update_user is '修改人';
comment on column market_commission_advertising_log.update_time is '修改时间';
comment on column market_commission_advertising_log.status is '状态';
comment on column market_commission_advertising_log.is_deleted is '是否已删除';
-- 5%服务商佣金流水表
DROP TABLE IF EXISTS market_commission_service_provider_log;
create table market_commission_service_provider_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
address_id int8, -- 收货地址id
region_id int4, -- 区域id
service_provider_id int8, -- 服务商id
service_type int4, -- 服务类型
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcspl_uid
on market_commission_service_provider_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcspl_aid
on market_commission_service_provider_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_service_provider_log is '5%服务商佣金流水表';
comment on column market_commission_service_provider_log.id is '主键';
comment on column market_commission_service_provider_log.account_id is '账户id';
comment on column market_commission_service_provider_log.user_id is '用户id';
comment on column market_commission_service_provider_log.amount is '变动金额';
comment on column market_commission_service_provider_log.last_amount is '上笔金额';
comment on column market_commission_service_provider_log.source_type is '来源类型';
comment on column market_commission_service_provider_log.source_id is '来源id';
comment on column market_commission_service_provider_log.source_detail is '来源详情';
comment on column market_commission_service_provider_log.type is '类型 1-收入 2-支出';
comment on column market_commission_service_provider_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_service_provider_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_service_provider_log.statistical_date is '统计时间';
comment on column market_commission_service_provider_log.address_id is '收货地址id';
comment on column market_commission_service_provider_log.region_id is '省市区id';
comment on column market_commission_service_provider_log.service_type is '服务类型';
comment on column market_commission_service_provider_log.service_provider_id is '服务商ID';
comment on column market_commission_service_provider_log.remark is '备注';
comment on column market_commission_service_provider_log.create_user is '创建人';
comment on column market_commission_service_provider_log.create_dept is '创建部门';
comment on column market_commission_service_provider_log.create_time is '创建时间';
comment on column market_commission_service_provider_log.update_user is '修改人';
comment on column market_commission_service_provider_log.update_time is '修改时间';
comment on column market_commission_service_provider_log.status is '状态';
comment on column market_commission_service_provider_log.is_deleted is '是否已删除';
-- 15%极差代理佣金流水表
DROP TABLE IF EXISTS market_commission_agency_log;
create table market_commission_agency_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mc_agency_uid
on market_commission_agency_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mc_agency_aid
on market_commission_agency_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_agency_log is '15%极差代理佣金流水表';
comment on column market_commission_agency_log.id is '主键';
comment on column market_commission_agency_log.id is '主键';
comment on column market_commission_agency_log.account_id is '账户id';
comment on column market_commission_agency_log.user_id is '用户id';
comment on column market_commission_agency_log.amount is '变动金额';
comment on column market_commission_agency_log.last_amount is '上笔金额';
comment on column market_commission_agency_log.source_type is '来源类型';
comment on column market_commission_agency_log.source_id is '来源id';
comment on column market_commission_agency_log.source_detail is '来源详情';
comment on column market_commission_agency_log.type is '类型 1-收入 2-支出';
comment on column market_commission_agency_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_agency_log.statistical_date is '统计时间';
comment on column market_commission_agency_log.remark is '备注';
comment on column market_commission_agency_log.create_user is '创建人';
comment on column market_commission_agency_log.create_dept is '创建部门';
comment on column market_commission_agency_log.create_time is '创建时间';
comment on column market_commission_agency_log.update_user is '修改人';
comment on column market_commission_agency_log.update_time is '修改时间';
comment on column market_commission_agency_log.status is '状态';
comment on column market_commission_agency_log.is_deleted is '是否已删除';
-- 5%联创佣金流水表
DROP TABLE IF EXISTS market_commission_co_creator_log;
create table market_commission_co_creator_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcccl_aid
on market_commission_co_creator_log (is_complete, account_id, statistical_date, type, create_time DESC);
comment on table market_commission_co_creator_log is '5%联创佣金流水表';
comment on column market_commission_co_creator_log.id is '主键';
comment on column market_commission_co_creator_log.account_id is '账户id';
comment on column market_commission_co_creator_log.amount is '变动金额';
comment on column market_commission_co_creator_log.last_amount is '上笔金额';
comment on column market_commission_co_creator_log.source_type is '来源类型';
comment on column market_commission_co_creator_log.source_id is '来源id';
comment on column market_commission_co_creator_log.source_detail is '来源详情';
comment on column market_commission_co_creator_log.type is '类型 1-收入 2-支出';
comment on column market_commission_co_creator_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_co_creator_log.statistical_date is '统计时间';
comment on column market_commission_co_creator_log.remark is '备注';
comment on column market_commission_co_creator_log.create_user is '创建人';
comment on column market_commission_co_creator_log.create_dept is '创建部门';
comment on column market_commission_co_creator_log.create_time is '创建时间';
comment on column market_commission_co_creator_log.update_user is '修改人';
comment on column market_commission_co_creator_log.update_time is '修改时间';
comment on column market_commission_co_creator_log.status is '状态';
comment on column market_commission_co_creator_log.is_deleted is '是否已删除';
DROP TABLE IF EXISTS user_market_package_daily_settlement;
create table user_market_package_daily_settlement --用户福利包每天结算记录
(
id int8 not null primary key,
statistical_date timestamp(6),
user_id int8,
account int8,
user_name varchar(128),
package_id bigint[], --用户兑换福利包id(数组), 记录已发的id
is_complete integer default 0, -- 是否完成 0未完成 1完成
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index inx_umpds_uid
on user_market_package_daily_settlement (statistical_date, is_complete, user_id);
COMMENT ON TABLE user_market_package_daily_settlement IS '用户福利包每天结算记录';
COMMENT ON COLUMN user_market_package_daily_settlement.id IS '主键';
COMMENT ON COLUMN user_market_package_daily_settlement.user_id IS '用户id';
COMMENT ON COLUMN user_market_package_daily_settlement.account IS '账户';
COMMENT ON COLUMN user_market_package_daily_settlement.user_name IS '用户名';
COMMENT ON COLUMN user_market_package_daily_settlement.package_id IS '用户兑换福利包id(数组), 记录已发的id';
COMMENT ON COLUMN user_market_package_daily_settlement.is_complete IS '是否完成 0-未完成 1-完成';
COMMENT ON COLUMN user_market_package_daily_settlement.remark IS '备注';
comment on column user_market_package_daily_settlement.create_user is '创建人';
comment on column user_market_package_daily_settlement.create_dept is '创建部门';
comment on column user_market_package_daily_settlement.create_time is '创建时间';
comment on column user_market_package_daily_settlement.update_user is '修改人';
comment on column user_market_package_daily_settlement.update_time is '修改时间';
comment on column user_market_package_daily_settlement.status is '状态';
comment on column user_market_package_daily_settlement.is_deleted is '是否已删除';
DROP TABLE IF EXISTS common_lottery_prize;
create table common_lottery_prize
(
id int8 not null primary key,
prize_name varchar(100),--奖品名称
prize_type int4, -- 类型:1=积分 2=优惠券 3=实物...
prize_value VARCHAR(255), -- 奖品内容(如积分数量、券码等)
probability DECIMAL(5, 4), -- 中奖概率(如 0.05 = 5%)
stock int4, -- 总库存(-1 表示无限)
daily_limit int4, -- 每日发放上限
sort_order int4, -- 排序(用于前端展示顺序)
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1, -- 状态:0=下架 1=上架,
is_deleted int4 default 0
);
COMMENT ON TABLE common_lottery_prize IS '奖品配置表';
COMMENT ON COLUMN common_lottery_prize.id IS '主键';
COMMENT ON COLUMN common_lottery_prize.prize_name IS '奖品名称';
COMMENT ON COLUMN common_lottery_prize.prize_type IS '奖品类型';
COMMENT ON COLUMN common_lottery_prize.prize_value IS '奖品内容';
COMMENT ON COLUMN common_lottery_prize.probability IS '中奖概率(如 0.05 = 5%)';
COMMENT ON COLUMN common_lottery_prize.stock IS '总库存(-1 表示无限)';
COMMENT ON COLUMN common_lottery_prize.daily_limit IS '每日发放上限';
COMMENT ON COLUMN common_lottery_prize.sort_order IS '排序(用于前端展示顺序)';
COMMENT ON COLUMN common_lottery_prize.remark IS '备注';
comment on column common_lottery_prize.create_user is '创建人';
comment on column common_lottery_prize.create_dept is '创建部门';
comment on column common_lottery_prize.create_time is '创建时间';
comment on column common_lottery_prize.update_user is '修改人';
comment on column common_lottery_prize.update_time is '修改时间';
comment on column common_lottery_prize.status is '状态:0=下架 1=上架';
comment on column common_lottery_prize.is_deleted is '是否已删除';
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2022583456075808770', '1123598815738675201', 'lotteryPrize', '奖品配置表', 'menu', '/common/lotteryPrize',
NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2022583456075808771', '2022583456075808770', 'lotteryPrize_add', '新增', 'add', '/common/lotteryPrize/add',
'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2022583456075808772', '2022583456075808770', 'lotteryPrize_edit', '修改', 'edit', '/common/lotteryPrize/edit',
'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2022583456075808773', '2022583456075808770', 'lotteryPrize_delete', '删除', 'delete',
'/api/blade-lotteryprize/lotteryPrize/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2022583456075808774', '2022583456075808770', 'lotteryPrize_view', '查看', 'view', '/common/lotteryPrize/view',
'file-text', 4, 2, 2, 1, NULL, 0);
DROP TABLE IF EXISTS common_lottery_record;
create table common_lottery_record
(
id int8 not null primary key,
user_id int8, -- 用户id
prize_id int8, -- 中奖奖品ID(null 表示未中奖/谢谢参与)
points_used decimal(14, 2) default 0, -- 消耗积分
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 0, --0=未发放 1=已发放 2=发放失败
is_deleted int4 default 0
);
COMMENT ON TABLE common_lottery_record IS '抽奖记录表';
COMMENT ON COLUMN common_lottery_record.id IS '主键';
COMMENT ON COLUMN common_lottery_record.user_id IS '用户id';
COMMENT ON COLUMN common_lottery_record.prize_id IS '中奖奖品ID(null 表示未中奖/谢谢参与)';
COMMENT ON COLUMN common_lottery_record.points_used IS '消耗积分';
COMMENT ON COLUMN common_lottery_record.remark IS '备注';
comment on column common_lottery_record.create_user is '创建人';
comment on column common_lottery_record.create_dept is '创建部门';
comment on column common_lottery_record.create_time is '创建时间';
comment on column common_lottery_record.update_user is '修改人';
comment on column common_lottery_record.update_time is '修改时间';
comment on column common_lottery_record.status is '0=未发放 1=已发放 2=发放失败';
comment on column common_lottery_record.is_deleted is '是否已删除';
create index idx_clr_duc on common_lottery_record (is_deleted, user_id, create_time desc);

View File

@@ -1,5 +0,0 @@
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2019341062694285314, 2019338015981219841, 'userAddress', '用户收货地址', 'menu', '/common/commonUserAddress', null, 1, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2019341062694285315, 2019341062694285314, 'userAddress_add', '新增', 'add', '/common/commonUserAddress/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2019341062694285316, 2019341062694285314, 'userAddress_edit', '修改', 'edit', '/common/commonUserAddress/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2019341062694285317, 2019341062694285314, 'userAddress_delete', '删除', 'delete', '/common/address/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2019341062694285318, 2019341062694285314, 'userAddress_view', '查看', 'view', '/common/commonUserAddress/view', 'file-text', 4, 2, 2, 1, null, null, 0);

View File

@@ -1,5 +0,0 @@
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787265, 2019338015981219841, 'userNotice', '用户通知', 'menu', '/common/commonUserNotice', 'iconfont iconicon_voipphone', 1, 1, 0, 1, '', '', 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/common/commonUserNotice/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/common/commonUserNotice/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete', '/common/notice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/common/commonUserNotice/view', 'file-text', 4, 2, 2, 1, null, null, 0);

View File

@@ -1,47 +0,0 @@
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022144366122496002, 0, 'point_spend_type', '-1', '积分消费类型', 29, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022144416953266178, 2022144366122496002, 'point_spend_type', '1', '收入', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022144450830659586, 2022144366122496002, 'point_spend_type', '2', '支出', 2, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022145522114621442, 0, 'benefit_point_source_type', '-1', '福利积分业务类型', 30, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022145600879456257, 2022145522114621442, 'benefit_point_source_type', '0', '福利包产出', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022145655191498754, 2022145522114621442, 'benefit_point_source_type', '1', '福利包兑换', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022145691790995458, 2022145522114621442, 'benefit_point_source_type', '2', '用户直推', 2, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022145736523247618, 2022145522114621442, 'benefit_point_source_type', '3', 'otc交易', 3, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022146929051836418, 0, 'cash_coupon_source_type', '-1', '现金券业务类型', 31, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022147076771028993, 2022146929051836418, 'cash_coupon_source_type', '0', '商城抽奖', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022147174259236865, 2022146929051836418, 'cash_coupon_source_type', '1', '福利包兑换', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022148656010371074, 0, 'user_point_source_type', '-1', '商城积分业务类型', 32, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022148779134164993, 2022148656010371074, 'user_point_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022148827624513537, 2022148656010371074, 'user_point_source_type', '1', '商城抽奖', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022160176320638977, 2022145522114621442, 'benefit_point_source_type', '4', '后台划拨', 4, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168620826193922, 0, 'commission_account_type', '-1', '佣金账户类型', 33, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168687205249026, 2022168620826193922, 'commission_account_type', '0', '商品成本', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168737859858433, 2022168620826193922, 'commission_account_type', '1', '购买人获取用户积分', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168786408927233, 2022168620826193922, 'commission_account_type', '2', '直推人佣金', 2, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168818386300929, 2022168620826193922, 'commission_account_type', '3', '运营佣金', 3, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168849080217602, 2022168620826193922, 'commission_account_type', '4', '广告补贴', 4, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168886443077634, 2022168620826193922, 'commission_account_type', '5', '服务商佣金', 5, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168918445617153, 2022168620826193922, 'commission_account_type', '6', '极差代理佣金', 6, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022168952474005505, 2022168620826193922, 'commission_account_type', '7', '联创佣金', 7, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022170571915751426, 0, 'commission_ads_source_type', '-1', '广告佣金业务类型', 34, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022170678547542017, 2022170571915751426, 'commission_ads_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022170724420644865, 2022170571915751426, 'commission_ads_source_type', '1', '发放广告佣金', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022171660174061569, 0, 'commission_agency_source_type', '-1', '极差代理佣金业务类型', 35, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022171729493323777, 2022171660174061569, 'commission_agency_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022171761542000641, 2022171660174061569, 'commission_agency_source_type', '1', '发放极差代理佣金', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022173005106999297, 0, 'commission_co_creator_source_type', '-1', '联创佣金业务类型', 36, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022173358410002434, 2022173005106999297, 'commission_co_creator_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022173389028421634, 2022173005106999297, 'commission_co_creator_source_type', '1', '发放联创佣金', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022174499617206273, 0, 'commission_direct_source_type', '-1', '直推佣金类型', 37, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022174589887016962, 2022174499617206273, 'commission_direct_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022174624280309762, 2022174499617206273, 'commission_direct_source_type', '1', '发放直推佣金', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022175491679154178, 0, 'commission_goods_source_type', '-1', '商品成本业务类型', 38, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022175561182965762, 2022175491679154178, 'commission_goods_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022176216815595522, 0, 'commission_operation_source_type', '-1', '运营佣金业务类型', 39, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022176263162654722, 2022176216815595522, 'commission_operation_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022176296293462018, 2022176216815595522, 'commission_operation_source_type', '1', '发放运营佣金', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022177524079489026, 0, 'commission_vendor_source_type', '-1', '服务商佣金业务类型', 40, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022177647001956354, 2022177524079489026, 'commission_vendor_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022177688496205826, 2022177524079489026, 'commission_vendor_source_type', '1', '发放服务商佣金', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022178898150256642, 0, 'commission_userPoint_source_type', '-1', '商城用户积分佣金账户业务类型', 41, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022178954244878337, 2022178898150256642, 'commission_userPoint_source_type', '0', '商城订单', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2022178994120126465, 2022178898150256642, 'commission_userPoint_source_type', '1', '发放积分', 1, '', 0, 1, 0);

View File

@@ -1,76 +0,0 @@
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021905231566614529, 0, 'market', 'market', 'menu', '/market', 'iconfont iconicon_setting', 14, 1, null, 1, null, '', 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909592443203586, 2019338015981219841, 'commonCashCouponLog', '现金券流水', 'menu', '/common/commonCashCouponLog', null, 7, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909592443203587, 2021909592443203586, 'commonCashCouponLog_add', '新增', 'add', '/common/commonCashCouponLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909592443203588, 2021909592443203586, 'commonCashCouponLog_edit', '修改', 'edit', '/common/commonCashCouponLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909592443203589, 2021909592443203586, 'commonCashCouponLog_delete', '删除', 'delete', '/api/common/cash-coupon-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909592443203590, 2021909592443203586, 'commonCashCouponLog_view', '查看', 'view', '/common/commonCashCouponLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909593357561858, 2019338015981219841, 'commonUserPointLog', '商城积分流水', 'menu', '/common/commonUserPointLog', null, 8, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909593357561859, 2021909593357561858, 'commonUserPointLog_add', '新增', 'add', '/common/commonUserPointLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909593357561860, 2021909593357561858, 'commonUserPointLog_edit', '修改', 'edit', '/common/commonUserPointLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909593357561861, 2021909593357561858, 'commonUserPointLog_delete', '删除', 'delete', '/api/common/user-point-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909593357561862, 2021909593357561858, 'commonUserPointLog_view', '查看', 'view', '/common/commonUserPointLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594070593538, 2019338015981219841, 'commonUserPoint', '商城积分', 'menu', '/common/commonUserPoint', null, 5, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594070593539, 2021909594070593538, 'commonUserPoint_add', '新增', 'add', '/common/commonUserPoint/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594070593540, 2021909594070593538, 'commonUserPoint_edit', '修改', 'edit', '/common/commonUserPoint/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594070593541, 2021909594070593538, 'commonUserPoint_delete', '删除', 'delete', '/api/common/user-point/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594070593542, 2021909594070593538, 'commonUserPoint_view', '查看', 'view', '/common/commonUserPoint/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594792013825, 2019338015981219841, 'commonBenefitPoint', '福利值', 'menu', '/common/commonBenefitPoint', null, 3, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594792013826, 2021909594792013825, 'commonBenefitPoint_add', '新增', 'add', '/common/commonBenefitPoint/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594792013827, 2021909594792013825, 'commonBenefitPoint_edit', '修改', 'edit', '/common/commonBenefitPoint/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594792013828, 2021909594792013825, 'commonBenefitPoint_delete', '删除', 'delete', '/api/common/benefit-point/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909594792013829, 2021909594792013825, 'commonBenefitPoint_view', '查看', 'view', '/common/commonBenefitPoint/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595383410689, 2019338015981219841, 'commonBenefitPointLog', '福利值流水', 'menu', '/common/commonBenefitPointLog', null, 6, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595383410690, 2021909595383410689, 'commonBenefitPointLog_add', '新增', 'add', '/common/commonBenefitPointLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595383410691, 2021909595383410689, 'commonBenefitPointLog_edit', '修改', 'edit', '/common/commonBenefitPointLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595383410692, 2021909595383410689, 'commonBenefitPointLog_delete', '删除', 'delete', '/api/common/benefit-point-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595383410693, 2021909595383410689, 'commonBenefitPointLog_view', '查看', 'view', '/common/commonBenefitPointLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595903504386, 2019338015981219841, 'commonCashCoupon', '现金券', 'menu', '/common/commonCashCoupon', null, 4, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595903504387, 2021909595903504386, 'commonCashCoupon_add', '新增', 'add', '/common/commonCashCoupon/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595903504388, 2021909595903504386, 'commonCashCoupon_edit', '修改', 'edit', '/common/commonCashCoupon/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595903504389, 2021909595903504386, 'commonCashCoupon_delete', '删除', 'delete', '/api/common/cash-coupon/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909595903504390, 2021909595903504386, 'commonCashCoupon_view', '查看', 'view', '/common/commonCashCoupon/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909596490706945, 2021905231566614529, 'marketCommissionGoodsCostLog', '商品成本', 'menu', '/market/marketCommissionGoodsCostLog', null, 2, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909596490706946, 2021909596490706945, 'marketCommissionGoodsCostLog_add', '新增', 'add', '/market/marketCommissionGoodsCostLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909596490706947, 2021909596490706945, 'marketCommissionGoodsCostLog_edit', '修改', 'edit', '/market/marketCommissionGoodsCostLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909596490706948, 2021909596490706945, 'marketCommissionGoodsCostLog_delete', '删除', 'delete', '/api//market-commission/goods-cost-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909596490706949, 2021909596490706945, 'marketCommissionGoodsCostLog_view', '查看', 'view', '/market/marketCommissionGoodsCostLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597145018369, 2021905231566614529, 'marketCommissionAccount', '佣金账户', 'menu', '/market/marketCommissionAccount', null, 1, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597145018370, 2021909597145018369, 'marketCommissionAccount_add', '新增', 'add', '/market/marketCommissionAccount/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597145018371, 2021909597145018369, 'marketCommissionAccount_edit', '修改', 'edit', '/market/marketCommissionAccount/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597145018372, 2021909597145018369, 'marketCommissionAccount_delete', '删除', 'delete', '/api/market-commission/account/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597145018373, 2021909597145018369, 'marketCommissionAccount_view', '查看', 'view', '/market/marketCommissionAccount/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597740609537, 2021905231566614529, 'marketCommissionOperationLog', '运营佣金流水', 'menu', '/market/marketCommissionOperationLog', null, 9, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597740609538, 2021909597740609537, 'marketCommissionOperationLog_add', '新增', 'add', '/market/marketCommissionOperationLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597740609539, 2021909597740609537, 'marketCommissionOperationLog_edit', '修改', 'edit', '/market/marketCommissionOperationLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597740609540, 2021909597740609537, 'marketCommissionOperationLog_delete', '删除', 'delete', '/api/market-commission/operation-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909597740609541, 2021909597740609537, 'marketCommissionOperationLog_view', '查看', 'view', '/market/marketCommissionOperationLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598386532354, 2021905231566614529, 'marketCommissionServiceProviderLog', '服务商佣金流水', 'menu', '/market/marketCommissionServiceProviderLog', null, 6, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598386532355, 2021909598386532354, 'marketCommissionServiceProviderLog_add', '新增', 'add', '/market/marketCommissionServiceProviderLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598386532356, 2021909598386532354, 'marketCommissionServiceProviderLog_edit', '修改', 'edit', '/market/marketCommissionServiceProviderLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598386532357, 2021909598386532354, 'marketCommissionServiceProviderLog_delete', '删除', 'delete', '/api/market-commission/service-provider-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598386532358, 2021909598386532354, 'marketCommissionServiceProviderLog_view', '查看', 'view', '/market/marketCommissionServiceProviderLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598906626049, 2021905231566614529, 'marketCommissionUserPointLog', '用户积分佣金流水', 'menu', '/market/marketCommissionUserPointLog', null, 3, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598906626050, 2021909598906626049, 'marketCommissionUserPointLog_add', '新增', 'add', '/market/marketCommissionUserPointLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598906626051, 2021909598906626049, 'marketCommissionUserPointLog_edit', '修改', 'edit', '/market/marketCommissionUserPointLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598906626052, 2021909598906626049, 'marketCommissionUserPointLog_delete', '删除', 'delete', '/api/market-commission/user-point-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909598906626053, 2021909598906626049, 'marketCommissionUserPointLog_view', '查看', 'view', '/market/marketCommissionUserPointLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909599426719746, 2021905231566614529, 'marketCommissionAdvertisingLog', '广告补贴佣金流水', 'menu', '/market/marketCommissionAdvertisingLog', null, 4, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909599426719747, 2021909599426719746, 'marketCommissionAdvertisingLog_add', '新增', 'add', '/market/marketCommissionAdvertisingLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909599426719748, 2021909599426719746, 'marketCommissionAdvertisingLog_edit', '修改', 'edit', '/market/marketCommissionAdvertisingLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909599426719749, 2021909599426719746, 'marketCommissionAdvertisingLog_delete', '删除', 'delete', '/api/market-commission/advertising-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909599426719750, 2021909599426719746, 'marketCommissionAdvertisingLog_view', '查看', 'view', '/market/marketCommissionAdvertisingLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600009728001, 2021905231566614529, 'marketCommissionAgencyLog', '极差代理佣金流水', 'menu', '/market/marketCommissionAgencyLog', null, 5, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600009728002, 2021909600009728001, 'marketCommissionAgencyLog_add', '新增', 'add', '/market/marketCommissionAgencyLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600009728003, 2021909600009728001, 'marketCommissionAgencyLog_edit', '修改', 'edit', '/market/marketCommissionAgencyLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600009728004, 2021909600009728001, 'marketCommissionAgencyLog_delete', '删除', 'delete', '/api/market-commission/agency-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600009728005, 2021909600009728001, 'marketCommissionAgencyLog_view', '查看', 'view', '/market/marketCommissionAgencyLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600664039426, 2021905231566614529, 'marketCommissionCoCreatorLog', '联创佣金流水', 'menu', '/market/marketCommissionCoCreatorLog', null, 7, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600664039427, 2021909600664039426, 'marketCommissionCoCreatorLog_add', '新增', 'add', '/market/marketCommissionCoCreatorLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600664039428, 2021909600664039426, 'marketCommissionCoCreatorLog_edit', '修改', 'edit', '/market/marketCommissionCoCreatorLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600664039429, 2021909600664039426, 'marketCommissionCoCreatorLog_delete', '删除', 'delete', '/api/market-commission/cocreator-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909600664039430, 2021909600664039426, 'marketCommissionCoCreatorLog_view', '查看', 'view', '/market/marketCommissionCoCreatorLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909601184133122, 2021905231566614529, 'marketCommissionDirectPushLog', '直推佣金流水', 'menu', '/market/marketCommissionDirectPushLog', null, 8, 1, 0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909601184133123, 2021909601184133122, 'marketCommissionDirectPushLog_add', '新增', 'add', '/market/marketCommissionDirectPushLog/add', 'plus', 1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909601184133124, 2021909601184133122, 'marketCommissionDirectPushLog_edit', '修改', 'edit', '/market/marketCommissionDirectPushLog/edit', 'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909601184133125, 2021909601184133122, 'marketCommissionDirectPushLog_delete', '删除', 'delete', '/api/market-commission/direct-push-log/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2021909601184133126, 2021909601184133122, 'marketCommissionDirectPushLog_view', '查看', 'view', '/market/marketCommissionDirectPushLog/view', 'file-text', 4, 2, 2, 1, null, null, 0);

View File

@@ -1,493 +0,0 @@
-- 佣金账户表
DROP TABLE IF EXISTS market_commission_account;
create table market_commission_account
(
id int8 not null primary key,
account_name varchar(128), -- 账户名称
account_code varchar(64), -- 账户代码
account_type int4, -- 账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金
amount decimal(14, 2) default 0, -- 账户总余额
version int4 default 1,
remark varchar(200),
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mca_code
on market_commission_account (account_code);
create index idx_mca_type
on market_commission_account (account_type);
comment on table market_commission_account is '用户佣金账户表';
comment on column market_commission_account.id is '主键';
comment on column market_commission_account.account_name is '账户名称';
comment on column market_commission_account.account_code is '账户代码';
comment on column market_commission_account.account_type is '账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金';
comment on column market_commission_account.amount is '账户总余额';
comment on column market_commission_account.version is '版本号';
comment on column market_commission_account.remark is '备注';
comment on column market_commission_account.create_user is '创建人';
comment on column market_commission_account.create_dept is '创建部门';
comment on column market_commission_account.create_time is '创建时间';
comment on column market_commission_account.update_user is '修改人';
comment on column market_commission_account.update_time is '修改时间';
comment on column market_commission_account.status is '状态';
comment on column market_commission_account.is_deleted is '是否已删除';
alter table market_commission_account
owner to yicha1lu;
---------------------------------------insert start
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017485441885196290, '商品成本账户', 'COMMISSION_GOODS_COST', '0','0.0000', 1, '商品成本账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:29:47', 1123598821738675201, '2026-01-31 14:30:16.04', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017485893100032002, '分发商城积分账户', 'COMMISSION_USER_POINT_LOG', '1', '0.0000', 1, '分发商城积分账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:31:34.663', 1123598821738675201, '2026-01-31 14:31:34.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486037128237058, '分发直推人佣金账户', 'COMMISSION_DIRECT_PUSH', '2', '0.0000', 1,'分发直推人佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:32:08.998', 1123598821738675201, '2026-01-31 14:32:08.998', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486179294171138, '运营账户', 'COMMISSION_OPERATION', '3','0.0000', 1, '运营账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:32:42.889', 1123598821738675201, '2026-01-31 14:32:42.889', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486299502923778, '分发广告补贴账户', 'COMMISSION_ADVERTISING', '4','0.0000', 1, '分发广告补贴账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:33:11.552', 1123598821738675201, '2026-01-31 14:33:11.552', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486437340336130, '分发服务商佣金账户', 'COMMISSION_SERVICE_PROVIDER','5', '0.0000', 1, '分发服务商佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:33:44.407', 1123598821738675201, '2026-01-31 14:33:44.407', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486568441696258, '分发极差代理佣金账户', 'COMMISSION_AGENCY', '6','0.0000', 1, '分发极差代理佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:34:15.663', 1123598821738675201, '2026-01-31 14:34:15.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486664117964802, '联创佣金账户', 'COMMISSION_CO_CREATOR', '7','0.0000', 1, '联创佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:34:38.479', 1123598821738675201, '2026-01-31 14:34:38.479', 1, 0);
---------------------------------------insert end
-- 25%商品成本佣金流水表
DROP TABLE IF EXISTS market_commission_goods_cost_log;
create table market_commission_goods_cost_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index inx_mcgcl_uid
on market_commission_goods_cost_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index inx_mcgcl_aid
on market_commission_goods_cost_log (is_complete, account_id , type, statistical_date, create_time DESC);
comment on table market_commission_goods_cost_log is '25%商品成本佣金流水表';
comment on column market_commission_goods_cost_log.id is '主键';
comment on column market_commission_goods_cost_log.account_id is '账户id';
comment on column market_commission_goods_cost_log.user_id is '用户id';
comment on column market_commission_goods_cost_log.amount is '金额';
comment on column market_commission_goods_cost_log.last_amount is '上笔金额';
comment on column market_commission_goods_cost_log.source_type is '来源模块 0-商城订单';
comment on column market_commission_goods_cost_log.source_id is '来源id';
comment on column market_commission_goods_cost_log.source_detail is '来源详情';
comment on column market_commission_goods_cost_log.type is '类型 1-收入 2-支出';
comment on column market_commission_goods_cost_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_goods_cost_log.statistical_date is '统计时间';
comment on column market_commission_goods_cost_log.remark is '备注';
comment on column market_commission_goods_cost_log.create_user is '创建人';
comment on column market_commission_goods_cost_log.create_dept is '创建部门';
comment on column market_commission_goods_cost_log.create_time is '创建时间';
comment on column market_commission_goods_cost_log.update_user is '修改人';
comment on column market_commission_goods_cost_log.update_time is '修改时间';
comment on column market_commission_goods_cost_log.status is '状态';
comment on column market_commission_goods_cost_log.is_deleted is '是否已删除';
alter table market_commission_goods_cost_log
owner to yicha1lu;
-- 30%购买人获取用户积分佣金流水表
DROP TABLE IF EXISTS market_commission_user_point_log;
create table market_commission_user_point_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-发放积分
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcupl_uid
on market_commission_user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcupl_aid
on market_commission_user_point_log (is_complete, account_id , type, statistical_date, create_time DESC);
comment on table market_commission_user_point_log is '30%购买人获取用户积分佣金流水表';
comment on column market_commission_user_point_log.id is '主键';
comment on column market_commission_user_point_log.account_id is '账户id';
comment on column market_commission_user_point_log.user_id is '用户id';
comment on column market_commission_user_point_log.amount is '变动金额';
comment on column market_commission_user_point_log.last_amount is '上笔金额';
comment on column market_commission_user_point_log.source_type is '来源类型 0-商城订单 1-发放积分';
comment on column market_commission_user_point_log.source_id is '来源id';
comment on column market_commission_user_point_log.source_detail is '来源详情';
comment on column market_commission_user_point_log.type is '类型 1-收入 2-支出';
comment on column market_commission_user_point_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_user_point_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_user_point_log.statistical_date is '统计时间';
comment on column market_commission_user_point_log.remark is '备注';
comment on column market_commission_user_point_log.create_user is '创建人';
comment on column market_commission_user_point_log.create_dept is '创建部门';
comment on column market_commission_user_point_log.create_time is '创建时间';
comment on column market_commission_user_point_log.update_user is '修改人';
comment on column market_commission_user_point_log.update_time is '修改时间';
comment on column market_commission_user_point_log.status is '状态';
comment on column market_commission_user_point_log.is_deleted is '是否已删除';
alter table market_commission_user_point_log
owner to yicha1lu;
-- 10%直推人佣金流水表
DROP TABLE IF EXISTS market_commission_direct_push_log;
create table market_commission_direct_push_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-发放直推佣金
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcdpl_uid
on market_commission_direct_push_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcdpl_aid
on market_commission_direct_push_log (is_complete, account_id , type, statistical_date, create_time DESC);
comment on table market_commission_direct_push_log is '10%直推人佣金流水表';
comment on column market_commission_direct_push_log.id is '主键';
comment on column market_commission_direct_push_log.account_id is '账户id';
comment on column market_commission_direct_push_log.user_id is '用户id';
comment on column market_commission_direct_push_log.amount is '变动金额';
comment on column market_commission_direct_push_log.last_amount is '上笔金额';
comment on column market_commission_direct_push_log.source_type is '来源类型 0-商城订单 1-发放直推佣金';
comment on column market_commission_direct_push_log.source_id is '来源id';
comment on column market_commission_direct_push_log.source_detail is '来源详情';
comment on column market_commission_direct_push_log.type is '类型 1-收入 2-支出';
comment on column market_commission_direct_push_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_direct_push_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_direct_push_log.statistical_date is '统计时间';
comment on column market_commission_direct_push_log.remark is '备注';
comment on column market_commission_direct_push_log.create_user is '创建人';
comment on column market_commission_direct_push_log.create_dept is '创建部门';
comment on column market_commission_direct_push_log.create_time is '创建时间';
comment on column market_commission_direct_push_log.update_user is '修改人';
comment on column market_commission_direct_push_log.update_time is '修改时间';
comment on column market_commission_direct_push_log.status is '状态';
comment on column market_commission_direct_push_log.is_deleted is '是否已删除';
alter table market_commission_direct_push_log
owner to yicha1lu;
-- 5%运营佣金流水表
DROP TABLE IF EXISTS market_commission_operation_log;
create table market_commission_operation_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
cut_amount decimal(14, 2) default 0, -- 随机立减金额
cut_detail text, -- 随机立减说明
source_type int4, -- 来源类型 0-商城订单 1-发放运营佣金
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcol_aid
on market_commission_operation_log (is_complete, account_id, type, statistical_date , create_time DESC);
comment on table market_commission_operation_log is '5%运营佣金流水表';
comment on column market_commission_operation_log.id is '主键';
comment on column market_commission_operation_log.account_id is '账户id';
comment on column market_commission_operation_log.amount is '变动金额';
comment on column market_commission_operation_log.last_amount is '上笔金额';
comment on column market_commission_operation_log.cut_amount is '随机立减金额';
comment on column market_commission_operation_log.cut_detail is '随机立减说明';
comment on column market_commission_operation_log.source_type is '来源类型 0-商城订单 1-发放运营佣金';
comment on column market_commission_operation_log.source_id is '来源id';
comment on column market_commission_operation_log.source_detail is '来源详情';
comment on column market_commission_operation_log.type is '类型 1-收入 2-支出';
comment on column market_commission_operation_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_operation_log.statistical_date is '统计时间';
comment on column market_commission_operation_log.remark is '备注';
comment on column market_commission_operation_log.create_user is '创建人';
comment on column market_commission_operation_log.create_dept is '创建部门';
comment on column market_commission_operation_log.create_time is '创建时间';
comment on column market_commission_operation_log.update_user is '修改人';
comment on column market_commission_operation_log.update_time is '修改时间';
comment on column market_commission_operation_log.status is '状态';
comment on column market_commission_operation_log.is_deleted is '是否已删除';
alter table market_commission_operation_log
owner to yicha1lu;
-- 5%广告补贴佣金流水表
DROP TABLE IF EXISTS market_commission_advertising_log;
create table market_commission_advertising_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-发放广告佣金
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcal_aid
on market_commission_advertising_log (is_complete, account_id, type, statistical_date , create_time DESC);
comment on table market_commission_advertising_log is '5%广告补贴佣金流水表';
comment on column market_commission_advertising_log.id is '主键';
comment on column market_commission_advertising_log.account_id is '账户id';
comment on column market_commission_advertising_log.amount is '变动金额';
comment on column market_commission_advertising_log.last_amount is '上笔金额';
comment on column market_commission_advertising_log.source_type is '来源类型 0-商城订单 1-发放广告佣金';
comment on column market_commission_advertising_log.source_id is '来源id';
comment on column market_commission_advertising_log.source_detail is '来源详情';
comment on column market_commission_advertising_log.type is '类型 1-收入 2-支出';
comment on column market_commission_advertising_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_advertising_log.statistical_date is '统计时间';
comment on column market_commission_advertising_log.remark is '备注';
comment on column market_commission_advertising_log.create_user is '创建人';
comment on column market_commission_advertising_log.create_dept is '创建部门';
comment on column market_commission_advertising_log.create_time is '创建时间';
comment on column market_commission_advertising_log.update_user is '修改人';
comment on column market_commission_advertising_log.update_time is '修改时间';
comment on column market_commission_advertising_log.status is '状态';
comment on column market_commission_advertising_log.is_deleted is '是否已删除';
alter table market_commission_advertising_log
owner to yicha1lu;
-- 5%服务商佣金流水表
DROP TABLE IF EXISTS market_commission_service_provider_log;
create table market_commission_service_provider_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-发放服务商佣金
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
address_id int8, -- 收货地址id
region_id int4, -- 区域id
service_provider_id int8, -- 服务商id
service_type int4, -- 服务类型
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcspl_uid
on market_commission_service_provider_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcspl_aid
on market_commission_service_provider_log (is_complete, account_id , type, statistical_date, create_time DESC);
comment on table market_commission_service_provider_log is '5%服务商佣金流水表';
comment on column market_commission_service_provider_log.id is '主键';
comment on column market_commission_service_provider_log.account_id is '账户id';
comment on column market_commission_service_provider_log.user_id is '用户id';
comment on column market_commission_service_provider_log.amount is '变动金额';
comment on column market_commission_service_provider_log.last_amount is '上笔金额';
comment on column market_commission_service_provider_log.source_type is '来源类型 0-商城订单 1-发放服务商佣金';
comment on column market_commission_service_provider_log.source_id is '来源id';
comment on column market_commission_service_provider_log.source_detail is '来源详情';
comment on column market_commission_service_provider_log.type is '类型 1-收入 2-支出';
comment on column market_commission_service_provider_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_service_provider_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_service_provider_log.statistical_date is '统计时间';
comment on column market_commission_service_provider_log.address_id is '收货地址id';
comment on column market_commission_service_provider_log.region_id is '省市区id';
comment on column market_commission_service_provider_log.service_type is '服务类型';
comment on column market_commission_service_provider_log.service_provider_id is '服务商ID';
comment on column market_commission_service_provider_log.remark is '备注';
comment on column market_commission_service_provider_log.create_user is '创建人';
comment on column market_commission_service_provider_log.create_dept is '创建部门';
comment on column market_commission_service_provider_log.create_time is '创建时间';
comment on column market_commission_service_provider_log.update_user is '修改人';
comment on column market_commission_service_provider_log.update_time is '修改时间';
comment on column market_commission_service_provider_log.status is '状态';
comment on column market_commission_service_provider_log.is_deleted is '是否已删除';
alter table market_commission_service_provider_log
owner to yicha1lu;
-- 15%极差代理佣金流水表
DROP TABLE IF EXISTS market_commission_agency_log;
create table market_commission_agency_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-发放极差代理佣金
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mc_agency_uid
on market_commission_agency_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mc_agency_aid
on market_commission_agency_log (is_complete, account_id , type, statistical_date, create_time DESC);
comment on table market_commission_agency_log is '15%极差代理佣金流水表';
comment on column market_commission_agency_log.id is '主键';
comment on column market_commission_agency_log.id is '主键';
comment on column market_commission_agency_log.account_id is '账户id';
comment on column market_commission_agency_log.user_id is '用户id';
comment on column market_commission_agency_log.amount is '变动金额';
comment on column market_commission_agency_log.last_amount is '上笔金额';
comment on column market_commission_agency_log.source_type is '来源类型 0-商城订单 1-发放极差代理佣金';
comment on column market_commission_agency_log.source_id is '来源id';
comment on column market_commission_agency_log.source_detail is '来源详情';
comment on column market_commission_agency_log.type is '类型 1-收入 2-支出';
comment on column market_commission_agency_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_agency_log.statistical_date is '统计时间';
comment on column market_commission_agency_log.remark is '备注';
comment on column market_commission_agency_log.create_user is '创建人';
comment on column market_commission_agency_log.create_dept is '创建部门';
comment on column market_commission_agency_log.create_time is '创建时间';
comment on column market_commission_agency_log.update_user is '修改人';
comment on column market_commission_agency_log.update_time is '修改时间';
comment on column market_commission_agency_log.status is '状态';
comment on column market_commission_agency_log.is_deleted is '是否已删除';
alter table market_commission_agency_log
owner to yicha1lu;
-- 5%联创佣金流水表
DROP TABLE IF EXISTS market_commission_co_creator_log;
create table market_commission_co_creator_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-发放联创佣金
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mcccl_aid
on market_commission_co_creator_log (is_complete, account_id, statistical_date, type , create_time DESC);
comment on table market_commission_co_creator_log is '5%联创佣金流水表';
comment on column market_commission_co_creator_log.id is '主键';
comment on column market_commission_co_creator_log.account_id is '账户id';
comment on column market_commission_co_creator_log.amount is '变动金额';
comment on column market_commission_co_creator_log.last_amount is '上笔金额';
comment on column market_commission_co_creator_log.source_type is '来源类型 0-商城订单 1-发放联创佣金';
comment on column market_commission_co_creator_log.source_id is '来源id';
comment on column market_commission_co_creator_log.source_detail is '来源详情';
comment on column market_commission_co_creator_log.type is '类型 1-收入 2-支出';
comment on column market_commission_co_creator_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_co_creator_log.statistical_date is '统计时间';
comment on column market_commission_co_creator_log.remark is '备注';
comment on column market_commission_co_creator_log.create_user is '创建人';
comment on column market_commission_co_creator_log.create_dept is '创建部门';
comment on column market_commission_co_creator_log.create_time is '创建时间';
comment on column market_commission_co_creator_log.update_user is '修改人';
comment on column market_commission_co_creator_log.update_time is '修改时间';
comment on column market_commission_co_creator_log.status is '状态';
comment on column market_commission_co_creator_log.is_deleted is '是否已删除';
alter table market_commission_co_creator_log
owner to yicha1lu;

View File

@@ -1,244 +0,0 @@
--- 福利积分 benefit_point
DROP TABLE IF EXISTS benefit_point;
create table benefit_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table benefit_point is '用户福利值表';
comment on column benefit_point.id is '主键(用户id)';
comment on column benefit_point.amount is '金额';
comment on column benefit_point.version is '版本号';
comment on column benefit_point.create_user is '创建人';
comment on column benefit_point.create_dept is '创建部门';
comment on column benefit_point.create_time is '创建时间';
comment on column benefit_point.update_user is '修改人';
comment on column benefit_point.update_time is '修改时间';
comment on column benefit_point.status is '状态';
comment on column benefit_point.is_deleted is '是否已删除';
alter table benefit_point
owner to yicha1lu;
DROP TABLE IF EXISTS benefit_point_log;
create table benefit_point_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
fee decimal(14, 2) default 0,
source_type int4, -- 来源类型 0-福利包产出 1-福利包兑换 2-用户直推 3-otc交易
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_umbl_uid
on benefit_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table benefit_point_log is '用户福利值流水表';
comment on column benefit_point_log.id is '主键';
comment on column benefit_point_log.user_id is '用户id';
comment on column benefit_point_log.amount is '金额';
comment on column benefit_point_log.last_amount is '上一笔金额';
comment on column benefit_point_log.fee is '手续费';
comment on column benefit_point_log.source_type is '来源类型 0-福利包产出 1-福利包兑换 2-用户直推 3-otc交易';
comment on column benefit_point_log.source_id is '来源id';
comment on column benefit_point_log.source_detail is '来源详情';
comment on column benefit_point_log.type is '消费类型 1-收入 2-支出';
comment on column benefit_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column benefit_point_log.statistical_date is '统计时间';
comment on column benefit_point_log.remark is '备注';
comment on column benefit_point_log.create_user is '创建人';
comment on column benefit_point_log.create_dept is '创建部门';
comment on column benefit_point_log.create_time is '创建时间';
comment on column benefit_point_log.update_user is '修改人';
comment on column benefit_point_log.update_time is '修改时间';
comment on column benefit_point_log.status is '状态';
comment on column benefit_point_log.is_deleted is '是否已删除';
alter table benefit_point_log
owner to yicha1lu;
--- 现金券 cash_coupon
DROP TABLE IF EXISTS cash_coupon;
create table cash_coupon
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table cash_coupon is '用户现金券表';
comment on column cash_coupon.id is '主键(用户id)';
comment on column cash_coupon.amount is '面额';
comment on column cash_coupon.version is '版本号';
comment on column cash_coupon.create_user is '创建人';
comment on column cash_coupon.create_dept is '创建部门';
comment on column cash_coupon.create_time is '创建时间';
comment on column cash_coupon.update_user is '修改人';
comment on column cash_coupon.update_time is '修改时间';
comment on column cash_coupon.status is '状态';
comment on column cash_coupon.is_deleted is '是否已删除';
alter table cash_coupon
owner to yicha1lu;
DROP TABLE IF EXISTS cash_coupon_log;
create table cash_coupon_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城抽奖 1-福利包兑换
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_umcl_uid
on cash_coupon_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table cash_coupon_log is '用户现金券流水表';
comment on column cash_coupon_log.id is '主键';
comment on column cash_coupon_log.user_id is '用户id';
comment on column cash_coupon_log.amount is '金额';
comment on column cash_coupon_log.last_amount is '上一笔金额';
comment on column cash_coupon_log.source_type is '来源类型 0-商城抽奖 1-福利包兑换';
comment on column cash_coupon_log.source_id is '来源id';
comment on column cash_coupon_log.source_detail is '来源详情';
comment on column cash_coupon_log.type is '消费类型 1-收入 2-支出';
comment on column cash_coupon_log.statistical_date is '统计时间';
comment on column cash_coupon_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column cash_coupon_log.remark is '备注';
comment on column cash_coupon_log.create_user is '创建人';
comment on column cash_coupon_log.create_dept is '创建部门';
comment on column cash_coupon_log.create_time is '创建时间';
comment on column cash_coupon_log.update_user is '修改人';
comment on column cash_coupon_log.update_time is '修改时间';
comment on column cash_coupon_log.status is '状态';
comment on column cash_coupon_log.is_deleted is '是否已删除';
alter table cash_coupon_log
owner to yicha1lu;
--- 用户积分 user_point
DROP TABLE IF EXISTS user_point;
create table user_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
comment on table user_point is '用户商城积分表';
comment on column user_point.id is '主键(用户id)';
comment on column user_point.amount is '面额';
comment on column user_point.version is '版本号';
comment on column user_point.create_user is '创建人';
comment on column user_point.create_dept is '创建部门';
comment on column user_point.create_time is '创建时间';
comment on column user_point.update_user is '修改人';
comment on column user_point.update_time is '修改时间';
comment on column user_point.is_deleted is '是否已删除';
alter table user_point
owner to yicha1lu;
DROP TABLE IF EXISTS user_point_log;
create table user_point_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type int4, -- 来源类型 0-商城订单 1-商城抽奖
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_uapl_uid
on user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table user_point_log is '用户商城积分流水表';
comment on column user_point_log.id is '主键';
comment on column user_point_log.user_id is '用户id';
comment on column user_point_log.amount is '金额';
comment on column user_point_log.last_amount is '上一笔金额';
comment on column user_point_log.source_type is '0-商城订单 1-商城抽奖';
comment on column user_point_log.source_id is '来源id';
comment on column user_point_log.source_detail is '来源详情';
comment on column user_point_log.type is '消费类型 1-收入 2-支出';
comment on column user_point_log.statistical_date is '统计时间';
comment on column user_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column user_point_log.remark is '备注';
comment on column user_point_log.create_user is '创建人';
comment on column user_point_log.create_dept is '创建部门';
comment on column user_point_log.create_time is '创建时间';
comment on column user_point_log.update_user is '修改人';
comment on column user_point_log.update_time is '修改时间';
comment on column user_point_log.status is '状态';
comment on column user_point_log.is_deleted is '是否已删除';
alter table user_point_log
owner to yicha1lu;

View File

@@ -28,6 +28,7 @@ package org.springblade;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
@@ -39,6 +40,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
@EnableScheduling
@EnableRedisHttpSession
@SpringBootApplication
@EnableRetry //重试机制
public class Application {
public static void main(String[] args) {

View File

@@ -0,0 +1,26 @@
package org.springblade.common.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
paginationInterceptor.setDbType(DbType.POSTGRE_SQL);
// 可选:设置最大单页限制(防止恶意请求)
paginationInterceptor.setMaxLimit(1000L);
interceptor.addInnerInterceptor(paginationInterceptor);
// 2. 乐观锁插件
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
}

View File

@@ -0,0 +1,7 @@
package org.springblade.common.exception;
public class OptimisticLockException extends RuntimeException{
public OptimisticLockException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,192 @@
package org.springblade.job.processor;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.market.eums.MarketBusinessModule;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import tech.powerjob.worker.log.OmsLogger;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 福利包每日发放福利积分到用户
*/
@Slf4j
@Component
@AllArgsConstructor
public class BenefitPackageSendPointProcessor implements BasicProcessor {
private final IMarketBenefitPackageService userBenefitPackageService;
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
private final IMarketBenefitPointService benefitPointService;
private final IMarketBenefitPointLogService benefitPointLogService;
@Override
public ProcessResult process(TaskContext context) {
OmsLogger omsLogger = context.getOmsLogger();
try {
omsLogger.info("开始执行定时任务-发放福利积分");
benefitPackageSendPoint();
omsLogger.info("结束执行定时任务-发放福利积分");
} catch (Exception e) {
log.error("任务执行异常", e);
omsLogger.error("任务执行异常: {}", e.getMessage());
return new ProcessResult(false, "系统异常: " + e.getMessage());
}
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
return new ProcessResult(true, "result is success");
}
public void benefitPackageSendPoint() {
// 1. 查询待处理的结算任务
List<MarketPackageDailySettlementEntity> settlementEntityList = userPackageDailySettlementService.list(
Wrappers.lambdaQuery(MarketPackageDailySettlementEntity.class)
.eq(MarketPackageDailySettlementEntity::getStatisticalDate, DateUtil.getToday())
.eq(MarketPackageDailySettlementEntity::getIsComplete, 0)
);
if (settlementEntityList.isEmpty()) {
return; // 提前退出,避免无谓查询
}
// 2. 查询所有状态为“进行中”的福利包
List<MarketBenefitPackageEntity> userBenefitPackageList = userBenefitPackageService.list(
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
.eq(MarketBenefitPackageEntity::getStatus, 2)
);
// 3. 按用户分组(注意:这里创建的是新 List,但后续仍需包装)
Map<Long, List<MarketBenefitPackageEntity>> benefitPackageMap = userBenefitPackageList.stream()
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
// 4. 处理每个结算任务
for (MarketPackageDailySettlementEntity settlementEntity : settlementEntityList) {
Long userId = settlementEntity.getUserId();
List<MarketBenefitPackageEntity> originalList = benefitPackageMap.get(userId);
if (originalList.isEmpty()) {
continue;
}
// 关键:创建可变副本,避免不可变列表问题
List<MarketBenefitPackageEntity> benefitPackageList = new ArrayList<>(originalList);
// 获取用户积分账户
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(userId);
if (benefitPoint == null) {
log.warn("用户积分账户不存在,userId: {}", userId);
continue;
}
BigDecimal lastAmount = benefitPoint.getAmount();
List<MarketBenefitPointLogEntity> pointLogList = new ArrayList<>();
// 处理每个福利包
for (MarketBenefitPackageEntity pkg : benefitPackageList) {
BigDecimal amountOut = pkg.getAmountOut();
BigDecimal amountTotal = pkg.getAmountTotal();
BigDecimal amountDay = pkg.getAmountDay();
// 修正:防止超额发放
BigDecimal newAmountOut = amountOut.add(amountDay);
if (newAmountOut.compareTo(amountTotal) > 0) {
amountDay = amountTotal.subtract(amountOut); // 只发剩余部分
newAmountOut = amountTotal;
pkg.setStatus(3); // 完成
}
// 处理天数
int outDay = pkg.getOutDay() + 1;
if (outDay >= pkg.getDayTotal()) {
outDay = pkg.getDayTotal();
pkg.setStatus(3); // 完成
}
// 记录日志
pointLogList.add(new MarketBenefitPointLogEntity()
.setUserId(userId)
.setAmount(amountDay)
.setLastAmount(lastAmount)
.setFee(BigDecimal.ZERO)
.setSourceType(MarketBusinessModule.BENEFIT_PACKAGE.getCode())
.setSourceId(pkg.getId())
.setSourceDetail(JSONObject.toJSONString(pkg))
.setIsComplete(0)
.setStatisticalDate(new Date())
.setRemark(pkg.getPackageName() + "每日福利积分产出")
);
lastAmount = lastAmount.add(amountDay);
// 更新福利包状态
pkg.setAmountOut(newAmountOut);
pkg.setOutDay(outDay);
}
// 批量保存日志
if (!pointLogList.isEmpty()) {
if (!benefitPointLogService.saveBatch(pointLogList)) {
log.error("福利积分记录失败-批量保存日志, userId: " + userId);
throw new RuntimeException("福利积分记录失败, userId: " + userId);
}
// 标记日志为完成
pointLogList.forEach(log -> log.setIsComplete(1));
benefitPointLogService.updateBatchById(pointLogList);
// 累加总发放积分
BigDecimal sendPoint = pointLogList.stream()
.map(MarketBenefitPointLogEntity::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 更新用户积分总额
benefitPoint.setAmount(benefitPoint.getAmount().add(sendPoint));
if (!benefitPointService.updateById(benefitPoint)) {
log.error("更新用户积分失败-更新福利积分, userId: " + userId);
throw new RuntimeException("更新用户积分失败, userId: " + userId);
}
// 更新福利包(使用可变列表)
if (!userBenefitPackageService.updateBatchById(benefitPackageList)) {
log.error("更新福利包失败-更新福利包, userId: " + userId);
throw new RuntimeException("更新福利包失败, userId: " + userId);
}
}
// 更新结算任务
List<Long> packageIds = benefitPackageList.stream()
.map(MarketBenefitPackageEntity::getId)
.collect(Collectors.toList());
settlementEntity.setIsComplete(1);
settlementEntity.setPackageId(packageIds);
userPackageDailySettlementService.updateById(settlementEntity);
}
}
}

View File

@@ -0,0 +1,94 @@
package org.springblade.job.processor;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import tech.powerjob.worker.log.OmsLogger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 福利包每日发放结算记录
*/
@Slf4j
@Component
@AllArgsConstructor
public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
private final IMarketBenefitPackageService userBenefitPackageService;
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
@Override
public ProcessResult process(TaskContext context) {
OmsLogger omsLogger = context.getOmsLogger(); // PowerJob 内置日志,控制台可查
try {
omsLogger.info("开始执行定时任务-初始化用户福利包每天结算记录...");
initUserPackageDailySettlement();
omsLogger.info("结束执行定时任务-初始化用户福利包每天结算记录");
} catch (Exception e) {
log.error("任务执行异常", e);
omsLogger.error("任务执行异常: {}", e.getMessage());
return new ProcessResult(false, "系统异常: " + e.getMessage());
}
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
return new ProcessResult(true, "result is success");
}
public void initUserPackageDailySettlement() {
//用户福利包列表
List<MarketBenefitPackageEntity> benefitPackageList = userBenefitPackageService.list(
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
.eq(MarketBenefitPackageEntity::getStatus, 2)
);
//用户福利包列表-map
Map<Long, List<MarketBenefitPackageEntity>> benefitPackageMap = benefitPackageList.stream().collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
//用户当天发放福利积分记录列表
List<MarketPackageDailySettlementEntity> settlementEntityList = userPackageDailySettlementService.list(
Wrappers.lambdaQuery(MarketPackageDailySettlementEntity.class)
.eq(MarketPackageDailySettlementEntity::getStatisticalDate, DateUtil.getToday())
);
//用户当天发放福利积分记录列表-map
Map<Long, List<MarketPackageDailySettlementEntity>> settlementEntityMap = settlementEntityList.stream().collect(Collectors.groupingBy(MarketPackageDailySettlementEntity::getUserId));
List<MarketPackageDailySettlementEntity> userPackageSettlementList = new ArrayList<>();
benefitPackageMap.forEach((userId, packageList) -> {
if (!settlementEntityMap.containsKey(userId)){
userPackageSettlementList.add(
new MarketPackageDailySettlementEntity()
.setUserId(userId)
.setUserName(packageList.get(0).getUserName())
.setAccount(packageList.get(0).getPhone())
.setStatisticalDate(DateUtil.getToday())
.setPackageId(List.of())
.setIsComplete(0)
);
}
});
userPackageDailySettlementService.saveBatch(userPackageSettlementList);
}
}

View File

@@ -0,0 +1,80 @@
package org.springblade.job.processor;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
import org.springblade.modules.market.pojo.entity.MarketUserCommissionEntity;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.modules.market.service.IMarketCashCouponService;
import org.springblade.modules.market.service.IMarketInfoService;
import org.springblade.modules.market.service.IMarketUserCommissionService;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import java.util.List;
@Component
@AllArgsConstructor
public class InitUserAssetsProcessor implements BasicProcessor {
private final IUserService userService;
private final IMarketInfoService marketInfoService;
private final ICommonUserPointService userPointService;
private final IMarketCashCouponService cashCouponService;
private final IMarketBenefitPointService benefitPointService;
private final IMarketUserCommissionService commissionService;
@Override
public ProcessResult process(TaskContext taskContext) throws Exception {
List<User> userList = userService.list(Wrappers.<User>lambdaQuery().eq(User::getUserType, 2).eq(User::getIsDeleted, 0));
userList.forEach(user -> {
MarketInfoEntity marketInfo = marketInfoService.getById(user.getId());
if (marketInfo == null) {
marketInfo = new MarketInfoEntity();
marketInfo.setId(user.getId());
marketInfoService.save(marketInfo);
}
CommonUserPointEntity userPoint = userPointService.getById(user.getId());
if (userPoint == null) {
userPoint = new CommonUserPointEntity();
userPoint.setId(user.getId());
userPointService.save(userPoint);
}
MarketCashCouponEntity cashCoupon = cashCouponService.getById(user.getId());
if (cashCoupon == null) {
cashCoupon = new MarketCashCouponEntity();
cashCoupon.setId(user.getId());
cashCouponService.save(cashCoupon);
}
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(user.getId());
if (benefitPoint == null) {
benefitPoint = new MarketBenefitPointEntity();
benefitPoint.setId(user.getId());
benefitPointService.save(benefitPoint);
}
MarketUserCommissionEntity commission = commissionService.getById(user.getId());
if (commission == null) {
commission = new MarketUserCommissionEntity();
commission.setId(user.getId());
commissionService.save(commission);
}
});
return new ProcessResult(true, "result is success");
}
}

View File

@@ -43,8 +43,8 @@ public class APPCommonController {
@GetMapping("/region-list")
@ApiOperationSupport(order = 2)
@Operation(summary = "获取省市区列表")
public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "父级id不能小于0") Long pid ,
@RequestParam @Min(value = 1 , message = "只能选到省") @Max(value = 4 , message = "只能选到街道") Integer level) {
public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "请选择有效地区") Long pid ,
@RequestParam @Min(value = 1 , message = "请选择省、市、区或街道") @Max(value = 4 , message = "请选择省、市、区或街道") Integer level) {
return R.data(commonRegionsInfoService.findRegionList(pid , level));
}

View File

@@ -10,19 +10,15 @@ import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.modules.api.request.AddressRemoveRequest;
import org.springblade.modules.api.request.AddressSubmitRequest;
import org.springblade.modules.api.request.CreateOrderRequest;
import org.springblade.modules.api.request.PaymentRequest;
import org.springblade.modules.api.request.*;
import org.springblade.modules.api.response.CreateOrderResponse;
import org.springblade.modules.api.response.PaymentResponse;
import org.springblade.modules.api.vo.*;
import org.springblade.modules.common.service.ICommonUserAddressService;
import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springblade.modules.common.service.*;
import org.springblade.modules.system.service.IUserService;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
@Hidden
@@ -40,6 +36,12 @@ public class APPUserController {
private final ICommonUserAddressService addressService;
private final ICommonUserPointService pointService;
private final ICommonLotteryRecordService lotteryRecordService;
private final ICommonLotteryPrizeService lotteryPrizeService;
/**
* 是否修改过密码
@@ -158,7 +160,7 @@ public class APPUserController {
@ApiOperationSupport(order = 12)
@Operation(summary = "提交用户收货地址", description = "传入AddressSubmitRequest")
public R<Boolean> submitAddress(@Valid @RequestBody AddressSubmitRequest request) {
return R.status( addressService.submitAddress(request));
return R.status(addressService.submitAddress(request));
}
@@ -166,9 +168,50 @@ public class APPUserController {
@ApiOperationSupport(order = 13)
@Operation(summary = "删除用户收货地址", description = "传入id")
public R<Boolean> removeAddress(@Valid @RequestBody AddressRemoveRequest request) {
return R.status( addressService.removeAddress(request.getIds()));
return R.status(addressService.removeAddress(request.getIds()));
}
@GetMapping("/user-points")
@ApiOperationSupport(order = 14)
@Operation(summary = "用户积分查询")
public R<BigDecimal> userPoints() {
return R.data(pointService.queryPoint());
}
@GetMapping("/lottery-prizes")
@ApiOperationSupport(order = 15)
@Operation(summary = "奖品列表")
public R<List<CommonLotteryPrizeApiVO>> lotteryPrizes() {
return R.data(lotteryPrizeService.staticList());
}
@GetMapping("/lottery-records")
@ApiOperationSupport(order = 16)
@Operation(summary = "抽奖记录")
public R<IPage<CommonLotteryRecordApiVO>> lotteryRecords(Query query) {
return R.data(lotteryRecordService.selectLotteryRecordApiPage(Condition.getPage(query), new CommonLotteryRecordApiVO()));
}
@PostMapping("/lottery-draw")
@ApiOperationSupport(order = 17)
@Operation(summary = "用户抽奖", description = "传入LotteriesDrawRequest")
public R<CommonLotteryPrizeApiVO> draw(@Valid @RequestBody LotteryDrawRequest request) {
return R.data(lotteryPrizeService.draw(request));
}
@GetMapping("/lottery-rules")
@ApiOperationSupport(order = 18)
@Operation(summary = "抽奖规则")
public R<String> lotteryRules() {
return R.data(lotteryPrizeService.rules());
}
@GetMapping("/lottery-winners")
@ApiOperationSupport(order = 19)
@Operation(summary = "获奖名单")
public R<List<CommonLotteryWinnerApiVO>> lotteryWinners() {
return R.data(lotteryRecordService.lotteryWinners());
}
}

View File

@@ -11,13 +11,12 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.modules.api.vo.CommonUserNoticeApiVO;
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
import org.springblade.modules.api.request.AcquireBenefitPackageRequest;
import org.springblade.modules.api.vo.*;
import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springblade.modules.market.manager.MarketUserManager;
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
import org.springblade.modules.userPackage.service.IUserMarketBenefitPackageService;
import org.springblade.modules.market.manager.MarketUserPointManager;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -29,12 +28,14 @@ import java.util.List;
@Tag(name = "APP福利包接口", description = "APP福利包接口")
public class MarketUserController {
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
private final IMarketBenefitPackageService userMarketBenefitPackageService;
private final MarketUserManager marketUserManager;
private final ICommonUserNoticeService userNoticeService;
private final MarketUserPointManager marketUserPointManager;
@GetMapping("/package-list")
@ApiOperationSupport(order = 1)
@@ -85,8 +86,9 @@ public class MarketUserController {
return R.data(userNoticeService.userNoticeDetail(id));
}
@GetMapping("/unread-num")
@ApiOperationSupport(order = 6)
@GetMapping("/unread")
@ApiOperationSupport(order = 7)
@Operation(summary = "Market用户未读消息数量")
public R<Long> unreadNum() {
return R.data(userNoticeService.marketUnreadNoticeNum());
@@ -94,5 +96,47 @@ public class MarketUserController {
@GetMapping("/benefit-package")
@ApiOperationSupport(order = 8)
@Operation(summary = "福利包列表")
public R<List<MarketPackageTemplateVO>> benefitPackageList() {
return R.data(marketUserManager.benefitPackageList());
}
@PostMapping("/acquire-benefit-package")
@ApiOperationSupport(order = 9)
@Operation(summary = "兑换福利包", description = "传入acquireBenefitPackageRequest")
public R<Boolean> acquireBenefitPackage(@RequestBody AcquireBenefitPackageRequest request) {
return R.status(marketUserManager.acquireBenefitPackage(request));
}
@GetMapping("/user-assets")
@ApiOperationSupport(order = 10)
@Operation(summary = "用户资产查询")
public R<UserAssetsApiVO> userAssets() {
return R.data(marketUserManager.userAssets());
}
@GetMapping("/benefit-point-log")
@ApiOperationSupport(order = 11)
@Operation(summary = "福利积分流水")
public R<IPage<MarketUserBenefitPointLogVO>> benefitPointLogList(Query query , MarketUserBenefitPointLogVO benefitPointLogVO) {
return R.data(marketUserPointManager.benefitPointLogList(Condition.getPage(query) , benefitPointLogVO));
}
@GetMapping("/cash-coupon-log")
@ApiOperationSupport(order = 12)
@Operation(summary = "现金券流水")
public R<IPage<MarketUserCashCouponLogVO>> cashCouponLogList(Query query , MarketUserCashCouponLogVO cashCouponLogVO) {
return R.data(marketUserPointManager.cashCouponLogList(Condition.getPage(query) , cashCouponLogVO));
}
@GetMapping("/user-commission-log")
@ApiOperationSupport(order = 13)
@Operation(summary = "用户佣金流水")
public R<IPage<MarketUserCommissionLogVO>> userCommissionLogList(Query query , MarketUserCommissionLogVO userCommissionLogVO) {
return R.data(marketUserPointManager.userCommissionLogList(Condition.getPage(query) , userCommissionLogVO));
}
}

View File

@@ -0,0 +1,15 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class AcquireBenefitPackageRequest implements Serializable {
@NotNull(message = "请选择要兑换的福利包")
private Long packId;
}

View File

@@ -12,7 +12,7 @@ public class AddressSubmitRequest implements Serializable {
private Long id;
@NotNull(message = "请选择地区")
private Integer regionsInfoId;
private Integer regionsId;
@NotEmpty(message = "详细地址必填")
private String detail;

View File

@@ -0,0 +1,15 @@
package org.springblade.modules.api.request;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class LotteryDrawRequest implements Serializable {
@NotNull(message = "无效积分")
private BigDecimal amount;
}

View File

@@ -0,0 +1,16 @@
package org.springblade.modules.api.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
@Data
@AllArgsConstructor
public class CommonLotteryPrizeApiVO implements Serializable {
private Long id;
private String prizeName;
}

View File

@@ -0,0 +1,20 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CommonLotteryRecordApiVO implements Serializable {
private Long id;
private String prizeName;
private BigDecimal pointsUsed;
private Date createTime;
}

View File

@@ -0,0 +1,16 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CommonLotteryWinnerApiVO implements Serializable {
private String prizeName;
private String account;
private String username;
}

View File

@@ -38,7 +38,7 @@ public class CommonUserNoticeApiVO implements Serializable {
private Long id;
private Integer moduleType;
private String moduleType;
/**
* 是否已读 0-否 1-是
*/

View File

@@ -13,7 +13,7 @@ public class CommonUserNoticeDetailApiVO implements Serializable {
private Long id;
private Integer moduleType;
private String moduleType;
private String title;

View File

@@ -0,0 +1,54 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 用户积分包信息表 视图实体类
*
* @author BladeX
* @since 2026-02-05
*/
@Data
public class MarketPackageTemplateVO implements Serializable {
private Long id;
private String packageName;
/**
* 最大购买数量
*/
private Integer userLimit;
/**
* 全网最大兑换数量
*/
private Integer maxLimit;
/**
* 产出总天数
*/
private Integer dayLimit;
/**
* 总产出福利积分
*/
private BigDecimal benefitPointAmount;
/**
* 购买赠与福利值
*/
private BigDecimal benefitValueAmount;
/**
* 兑换包需要的福利积分
*/
private BigDecimal benefitPointPrice;
/**
* 兑换包需要的现金券
*/
private BigDecimal cashCouponPrice;
/**
* 已兑换数量
*/
private Integer exchangedQuantity;
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@Accessors(chain = true)
public class MarketUserBenefitPointLogVO implements Serializable {
/**
* 金额
*/
private BigDecimal amount;
/**
* 上一笔金额
*/
private BigDecimal lastAmount;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 消费类型 1-收入 2-支出
*/
private Integer type;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statisticalDate;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@Accessors(chain = true)
public class MarketUserCashCouponLogVO implements Serializable {
/**
* 金额
*/
private BigDecimal amount;
/**
* 上一笔金额
*/
private BigDecimal lastAmount;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 消费类型 1-收入 2-支出
*/
private Integer type;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statisticalDate;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值流水表 实体类
*
* @author BladeX
* @since 2026-02-12
*/
@Data
@Accessors(chain = true)
public class MarketUserCommissionLogVO implements Serializable {
/**
* 金额
*/
private BigDecimal amount;
/**
* 上一笔金额
*/
private BigDecimal lastAmount;
/**
* 手续费
*/
private BigDecimal fee;
/**
* 消费类型 1-收入 2-支出
*/
private Integer type;
/**
* 统计时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date statisticalDate;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,17 @@
package org.springblade.modules.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class UserAssetsApiVO implements Serializable {
private BigDecimal withdrawableBalance; // 可提现余额
private BigDecimal benefitPoints; // 福利积分
private BigDecimal cashCouponAmount; // 现金券数量(或 List<CashCoupon>)
}

View File

@@ -0,0 +1,136 @@
/**
* 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.common.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.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import org.springblade.modules.common.wrapper.CommonLotteryPrizeWrapper;
import org.springblade.modules.common.service.ICommonLotteryPrizeService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 奖品配置表 控制器
*
* @author RayLiu
* @since 2026-02-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("blade-lotteryprize/lotteryPrize")
@Tag(name = "奖品配置表", description = "奖品配置表接口")
public class CommonLotteryPrizeController extends BladeController {
private final ICommonLotteryPrizeService lotteryPrizeService;
/**
* 奖品配置表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入lotteryPrize")
public R<CommonLotteryPrizeVO> detail(CommonLotteryPrizeEntity lotteryPrize) {
CommonLotteryPrizeEntity detail = lotteryPrizeService.getOne(Condition.getQueryWrapper(lotteryPrize));
return R.data(CommonLotteryPrizeWrapper.build().entityVO(detail));
}
/**
* 奖品配置表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入lotteryPrize")
public R<IPage<CommonLotteryPrizeVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> lotteryPrize, Query query) {
IPage<CommonLotteryPrizeEntity> pages = lotteryPrizeService.page(Condition.getPage(query), Condition.getQueryWrapper(lotteryPrize, CommonLotteryPrizeEntity.class));
return R.data(CommonLotteryPrizeWrapper.build().pageVO(pages));
}
/**
* 奖品配置表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入lotteryPrize")
public R<IPage<CommonLotteryPrizeVO>> page(CommonLotteryPrizeVO lotteryPrize, Query query) {
IPage<CommonLotteryPrizeVO> pages = lotteryPrizeService.selectLotteryPrizePage(Condition.getPage(query), lotteryPrize);
return R.data(pages);
}
/**
* 奖品配置表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入lotteryPrize")
public R save(@Valid @RequestBody CommonLotteryPrizeEntity lotteryPrize) {
return R.status(lotteryPrizeService.save(lotteryPrize));
}
/**
* 奖品配置表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入lotteryPrize")
public R update(@Valid @RequestBody CommonLotteryPrizeEntity lotteryPrize) {
return R.status(lotteryPrizeService.updateById(lotteryPrize));
}
/**
* 奖品配置表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入lotteryPrize")
public R submit(@Valid @RequestBody CommonLotteryPrizeEntity lotteryPrize) {
return R.status(lotteryPrizeService.saveOrUpdate(lotteryPrize));
}
/**
* 奖品配置表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(lotteryPrizeService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,161 @@
/**
* 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.common.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.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import org.springblade.modules.common.wrapper.CommonLotteryRecordWrapper;
import org.springblade.modules.common.service.ICommonLotteryRecordService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 抽奖记录表 控制器
*
* @author RayLiu
* @since 2026-02-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("blade-lotteryprize/lotteryRecord")
@Tag(name = "抽奖记录表", description = "抽奖记录表接口")
public class CommonLotteryRecordController extends BladeController {
private final ICommonLotteryRecordService lotteryRecordService;
/**
* 抽奖记录表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入lotteryRecord")
public R<CommonLotteryRecordVO> detail(CommonLotteryRecordEntity lotteryRecord) {
CommonLotteryRecordEntity detail = lotteryRecordService.getOne(Condition.getQueryWrapper(lotteryRecord));
return R.data(CommonLotteryRecordWrapper.build().entityVO(detail));
}
/**
* 抽奖记录表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入lotteryRecord")
public R<IPage<CommonLotteryRecordVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> lotteryRecord, Query query) {
IPage<CommonLotteryRecordEntity> pages = lotteryRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(lotteryRecord, CommonLotteryRecordEntity.class));
return R.data(CommonLotteryRecordWrapper.build().pageVO(pages));
}
/**
* 抽奖记录表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入lotteryRecord")
public R<IPage<CommonLotteryRecordVO>> page(CommonLotteryRecordVO lotteryRecord, Query query) {
IPage<CommonLotteryRecordVO> pages = lotteryRecordService.selectLotteryRecordPage(Condition.getPage(query), lotteryRecord);
return R.data(pages);
}
/**
* 抽奖记录表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入lotteryRecord")
public R save(@Valid @RequestBody CommonLotteryRecordEntity lotteryRecord) {
return R.status(lotteryRecordService.save(lotteryRecord));
}
/**
* 抽奖记录表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入lotteryRecord")
public R update(@Valid @RequestBody CommonLotteryRecordEntity lotteryRecord) {
return R.status(lotteryRecordService.updateById(lotteryRecord));
}
/**
* 抽奖记录表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入lotteryRecord")
public R submit(@Valid @RequestBody CommonLotteryRecordEntity lotteryRecord) {
return R.status(lotteryRecordService.saveOrUpdate(lotteryRecord));
}
/**
* 抽奖记录表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(lotteryRecordService.deleteLogic(Func.toLongList(ids)));
}
/**
* 导出数据
*/
@IsAdmin
@GetMapping("/export-lotteryRecord")
@ApiOperationSupport(order = 9)
@Operation(summary = "导出数据", description = "传入lotteryRecord")
public void exportLotteryRecord(@Parameter(hidden = true) @RequestParam Map<String, Object> lotteryRecord, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<CommonLotteryRecordEntity> queryWrapper = Condition.getQueryWrapper(lotteryRecord, CommonLotteryRecordEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(LotteryRecord::getTenantId, bladeUser.getTenantId());
//}
//queryWrapper.lambda().eq(LotteryRecordEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<CommonLotteryRecordExcel> list = lotteryRecordService.exportLotteryRecord(queryWrapper);
ExcelUtil.export(response, "抽奖记录表数据" + DateUtil.time(), "抽奖记录表数据表", list, CommonLotteryRecordExcel.class);
}
}

View File

@@ -6,9 +6,6 @@ import org.mapstruct.factory.Mappers;
import org.springblade.modules.api.request.AddressSubmitRequest;
import org.springblade.modules.api.request.CreateOrderRequest;
import org.springblade.modules.api.vo.*;
import org.springblade.modules.common.pojo.dto.CommonBenefitPointApiDTO;
import org.springblade.modules.common.pojo.dto.CommonCashCouponApiDTO;
import org.springblade.modules.common.pojo.dto.CommonUserPointApiDTO;
import org.springblade.modules.common.pojo.entity.*;
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
@@ -65,9 +62,4 @@ public interface AppCommonConvert {
CommonUserAddressEntity convertRequestToPo(AddressSubmitRequest request);
CommonBenefitPointLogEntity convertBenefitPointDTOToEntity(CommonBenefitPointApiDTO dto);
CommonCashCouponLogEntity convertCashCouponDTOToEntity(CommonCashCouponApiDTO dto);
CommonUserPointLogEntity convertUserPointDTOToEntity(CommonUserPointApiDTO dto);
}

View File

@@ -1,56 +0,0 @@
package org.springblade.modules.common.eums;
import lombok.Getter;
@Getter
public enum BenefitPointSourceType {
/**
* 福利包产出
*/
BENEFIT_PACK_OUTPUT(0),
/**
* 福利包兑换
*/
BENEFIT_PACK_EXCHANGE(1),
/**
* 用户直推
*/
USERS_PUSH_DIRECTLY(2),
/**
* otc交易
*/
OTC_TRADING(3),
/**
* 后台划拨
*/
BACKEND_TRANSFER(4)
;
private final int code;
BenefitPointSourceType(int code) {
this.code = code;
}
/**
* 根据 code 值获取对应的枚举项
*
* @param code 福利积分来源类型
* @return 对应的 BenefitPointSourceType 枚举
* @throws IllegalArgumentException 如果 code 无效
*/
public static BenefitPointSourceType fromCode(int code) {
for (BenefitPointSourceType type : BenefitPointSourceType.values()) {
if (type.code == code) {
return type;
}
}
throw new IllegalArgumentException("Invalid notification type code: " + code);
}
}

View File

@@ -8,7 +8,8 @@ public enum BusinessModule {
SELF_OPERATED_MALL("自营商城", "self_mall"),
ECOSYSTEM_PRODUCT("生态商品", "eco_product"),
TRAVEL_GROUP("旅游团", "travel_group");
TRAVEL_GROUP("旅游团", "travel_group"),
LOTTERY("幸运抽奖", "lottery");
@Getter
private final String displayName;

View File

@@ -1,40 +0,0 @@
package org.springblade.modules.common.eums;
import lombok.Getter;
@Getter
public enum CashCouponSourceType {
/**
* 商城抽奖
*/
MALL_LOTTERY(0),
/**
* 福利包兑换
*/
BENEFIT_PACK_EXCHANGE(1);
private final int code;
CashCouponSourceType(int code) {
this.code = code;
}
/**
* 根据 code 值获取对应的枚举项
*
* @param code 现金券来源类型
* @return 对应的 CashCouponSourceType 枚举
* @throws IllegalArgumentException 如果 code 无效
*/
public static CashCouponSourceType fromCode(int code) {
for (CashCouponSourceType type : CashCouponSourceType.values()) {
if (type.code == code) {
return type;
}
}
throw new IllegalArgumentException("Invalid notification type code: " + code);
}
}

View File

@@ -0,0 +1,52 @@
package org.springblade.modules.common.eums;
import lombok.Getter;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Getter
public enum UserPointFlowType {
GRANT(1, "🎉 恭喜!您通过【订单 %s】成功获得 %s 积分,已存入您的账户,快去兑换好礼吧!") {
@Override
public String formatUserMessage(String orderId, String points) {
return String.format(this.getUserMessageTemplate(), orderId, points);
}
},
SPEND(2, "🎰 您已使用 %s 积分 参与幸运大抽奖,祝您好运连连,大奖抱回家!") {
@Override
public String formatUserMessage(String orderId, String points) {
// 注意:SPEND 不使用 orderId,但为了统一接口保留参数
return String.format(this.getUserMessageTemplate(), points);
}
};
private final int code;
private final String userMessageTemplate;
private UserPointFlowType(int code, String userMessageTemplate) {
this.code = code;
this.userMessageTemplate = userMessageTemplate;
}
public abstract String formatUserMessage(String orderId, String points);
private static final Map<Integer, UserPointFlowType> BY_CODE = Stream.of(values())
.collect(Collectors.toUnmodifiableMap(UserPointFlowType::getCode, Function.identity()));
public static UserPointFlowType fromCode(int code) {
UserPointFlowType status = BY_CODE.get(code);
if (status == null) {
throw new IllegalArgumentException("无效的订单状态码: " + code);
}
return status;
}
public static UserPointFlowType fromCodeOrNull(int code) {
return BY_CODE.get(code);
}
}

View File

@@ -1,40 +0,0 @@
package org.springblade.modules.common.eums;
import lombok.Getter;
@Getter
public enum UserPointSourceType {
/**
* 商城订单
*/
MALL_ORDERS(0),
/**
* 商城抽奖
*/
MALL_LOTTERY(1);
private final int code;
UserPointSourceType(int code) {
this.code = code;
}
/**
* 根据 code 值获取对应的枚举项
*
* @param code 商城积分来源类型
* @return 对应的 UserPointSourceType 枚举
* @throws IllegalArgumentException 如果 code 无效
*/
public static UserPointSourceType fromCode(int code) {
for (UserPointSourceType type : UserPointSourceType.values()) {
if (type.code == code) {
return type;
}
}
throw new IllegalArgumentException("Invalid notification type code: " + code);
}
}

View File

@@ -0,0 +1,21 @@
package org.springblade.modules.common.event;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springblade.modules.common.eums.BusinessModule;
import java.math.BigDecimal;
@AllArgsConstructor
@Getter
public class GrantUserPointEvent {
private final Long orderId;
private final Long userId;
private final BigDecimal point;
private final BusinessModule businessModule;
}

View File

@@ -0,0 +1,19 @@
package org.springblade.modules.common.event;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springblade.modules.common.eums.BusinessModule;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
public class SpendUserPointEvent {
private Long userId;
private BigDecimal point;
private BusinessModule businessModule;
}

View File

@@ -23,12 +23,13 @@
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.userPackage.excel;
package org.springblade.modules.common.excel;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
@@ -38,16 +39,16 @@ import java.io.Serial;
/**
* 划拨积分记录 Excel实体类
* 抽奖记录表 Excel实体类
*
* @author BladeX
* @since 2026-02-05
* @author RayLiu
* @since 2026-02-14
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class UserMarketBenefitPackageLogExcel implements Serializable {
public class CommonLotteryRecordExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -58,12 +59,6 @@ public class UserMarketBenefitPackageLogExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("主键")
private Long id;
/**
* 统计日期
*/
@ColumnWidth(20)
@ExcelProperty("统计日期")
private Date statisticalDate;
/**
* 用户id
*/
@@ -71,47 +66,17 @@ public class UserMarketBenefitPackageLogExcel implements Serializable {
@ExcelProperty("用户id")
private Long userId;
/**
* 用户手机号
* 中奖奖品ID(null 表示未中奖/谢谢参与)
*/
@ColumnWidth(20)
@ExcelProperty("用户手机号")
private Long phone;
@ExcelProperty("中奖奖品ID(null 表示未中奖/谢谢参与)")
private Long prizeId;
/**
* 用户名
* 消耗积分
*/
@ColumnWidth(20)
@ExcelProperty("用户名")
private String userName;
/**
* 1-积分兑换 2-后台划拨
*/
@ColumnWidth(20)
@ExcelProperty("1-积分兑换 2-后台划拨")
private Integer type;
/**
* 积分包id
*/
@ColumnWidth(20)
@ExcelProperty("积分包id")
private Long userPackageId;
/**
* 积分包名称
*/
@ColumnWidth(20)
@ExcelProperty("积分包名称")
private String packageName;
/**
* 积分包信息快照
*/
@ColumnWidth(20)
@ExcelProperty("积分包信息快照")
private String packageDetail;
/**
* 赠送数量
*/
@ColumnWidth(20)
@ExcelProperty("赠送数量")
private Integer giveNumber;
@ExcelProperty("消耗积分")
private BigDecimal pointsUsed;
/**
* 备注
*/

View File

@@ -4,7 +4,10 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.modules.common.eums.NoticeType;
import org.springblade.modules.common.eums.OrderStatus;
import org.springblade.modules.common.eums.UserPointFlowType;
import org.springblade.modules.common.event.GrantUserPointEvent;
import org.springblade.modules.common.event.PaymentSuccessEvent;
import org.springblade.modules.common.event.SpendUserPointEvent;
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
import org.springblade.modules.common.service.ICommonUserNoticeService;
import org.springframework.scheduling.annotation.Async;
@@ -36,4 +39,39 @@ public class NoticeListener {
log.warn("支付事务回滚,orderId={}", event.getOrderId());
}
@Async
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onGrantUserPoint(GrantUserPointEvent event) {
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
notice.setUserId(event.getUserId());
notice.setNoticeType(NoticeType.APP_USER.getCode());
notice.setModuleType(event.getBusinessModule().getCode());
notice.setTitle(event.getBusinessModule().getDisplayName());
notice.setContent(UserPointFlowType.GRANT.formatUserMessage(String.valueOf(event.getOrderId()), String.valueOf(event.getPoint())));
noticeService.save(notice);
}
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void onGrantUserPointFailure(GrantUserPointEvent event) {
log.warn("用户获取积分事务回滚,orderId={}", event.getOrderId());
}
@Async
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onSpendUserPoint(SpendUserPointEvent event) {
CommonUserNoticeEntity notice = new CommonUserNoticeEntity();
notice.setUserId(event.getUserId());
notice.setNoticeType(NoticeType.APP_USER.getCode());
notice.setModuleType(event.getBusinessModule().getCode());
notice.setTitle(event.getBusinessModule().getDisplayName());
notice.setContent(UserPointFlowType.SPEND.formatUserMessage(null, String.valueOf(event.getPoint())));
noticeService.save(notice);
}
@TransactionalEventListener(phase = TransactionPhase.AFTER_ROLLBACK)
public void onSpendUserPointFailure(SpendUserPointEvent event) {
log.warn("用户获取积分事务回滚,userId={}", event.getUserId());
}
}

View File

@@ -1,37 +0,0 @@
package org.springblade.modules.common.manager;
import lombok.AllArgsConstructor;
import org.springblade.modules.common.eums.BenefitPointSourceType;
import org.springblade.modules.common.pojo.dto.CommonBenefitPointApiDTO;
import org.springblade.modules.common.request.GiveBenefitPointRequest;
import org.springblade.modules.common.service.ICommonBenefitPointService;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.math.BigDecimal;
@Component
@AllArgsConstructor
public class CommonUserPointManager {
private final ICommonBenefitPointService commonBenefitPointService;
private final IUserService userService;
public boolean giveBenefitPoint(GiveBenefitPointRequest request) {
User user = userService.getById(request.getId());
Assert.notNull(user , "用户不存在或已注销");
Assert.isTrue(request.getAmount().compareTo(BigDecimal.ZERO) > 0, "划拨积分必须大于0");
CommonBenefitPointApiDTO dto = new CommonBenefitPointApiDTO();
dto.setUserId(user.getId())
.setAmount(request.getAmount())
.setFee(BigDecimal.ZERO)
.setSourceType(BenefitPointSourceType.BACKEND_TRANSFER.getCode())
.setSourceId(request.getId())
.setSourceDetail("后台划拨福利积分")
.setRemark(request.getRemark());
return commonBenefitPointService.addBenefitPoint(dto);
}
}

View File

@@ -0,0 +1,53 @@
/**
* 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.common.mapper;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 奖品配置表 Mapper 接口
*
* @author RayLiu
* @since 2026-02-14
*/
public interface CommonLotteryPrizeMapper extends BaseMapper<CommonLotteryPrizeEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param lotteryPrize 查询参数
* @return List<LotteryPrizeVO>
*/
List<CommonLotteryPrizeVO> selectLotteryPrizePage(IPage page, CommonLotteryPrizeVO lotteryPrize);
}

View File

@@ -0,0 +1,31 @@
<?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.common.mapper.CommonLotteryPrizeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="lotteryPrizeResultMap" type="org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity">
<result column="id" property="id"/>
<result column="prize_name" property="prizeName"/>
<result column="prize_type" property="prizeType"/>
<result column="prize_value" property="prizeValue"/>
<result column="probability" property="probability"/>
<result column="stock" property="stock"/>
<result column="daily_limit" property="dailyLimit"/>
<result column="sort_order" property="sortOrder"/>
<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="selectLotteryPrizePage" resultMap="lotteryPrizeResultMap">
select * from common_lottery_prize where is_deleted = 0
</select>
</mapper>

View File

@@ -23,11 +23,12 @@
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.userPackage.mapper;
package org.springblade.modules.common.mapper;
import org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageEntity;
import org.springblade.modules.userPackage.pojo.vo.UserMarketBenefitPackageVO;
import org.springblade.modules.userPackage.excel.UserMarketBenefitPackageExcel;
import org.springblade.modules.api.vo.CommonLotteryRecordApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -35,29 +36,30 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户积分包信息表 Mapper 接口
* 抽奖记录表 Mapper 接口
*
* @author BladeX
* @since 2026-02-05
* @author RayLiu
* @since 2026-02-14
*/
public interface UserMarketBenefitPackageMapper extends BaseMapper<UserMarketBenefitPackageEntity> {
public interface CommonLotteryRecordMapper extends BaseMapper<CommonLotteryRecordEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param userMarketBenefitPackage 查询参数
* @return List<UserMarketBenefitPackageVO>
* @param vo 查询参数
* @return List<LotteryRecordVO>
*/
List<UserMarketBenefitPackageVO> selectUserMarketBenefitPackagePage(IPage page, UserMarketBenefitPackageVO userMarketBenefitPackage);
List<CommonLotteryRecordVO> selectLotteryRecordPage(IPage page, CommonLotteryRecordVO vo);
/**
* 获取导出数据
*
* @param queryWrapper 查询条件
* @return List<UserMarketBenefitPackageExcel>
* @return List<LotteryRecordExcel>
*/
List<UserMarketBenefitPackageExcel> exportUserMarketBenefitPackage(@Param("ew") Wrapper<UserMarketBenefitPackageEntity> queryWrapper);
List<CommonLotteryRecordExcel> exportLotteryRecord(@Param("ew") Wrapper<CommonLotteryRecordEntity> queryWrapper);
}

View File

@@ -0,0 +1,35 @@
<?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.common.mapper.CommonLotteryRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="lotteryRecordResultMap" type="org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity">
<result column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="prize_id" property="prizeId"/>
<result column="points_used" property="pointsUsed"/>
<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="selectLotteryRecordPage" resultType="org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO">
select * from common_lottery_record where is_deleted = 0
<if test="vo.userId!=null">
and user_id = #{vo.userId}
</if>
order by create_time desc
</select>
<select id="exportLotteryRecord" resultType="org.springblade.modules.common.excel.CommonLotteryRecordExcel">
SELECT * FROM common_lottery_record ${ew.customSqlSegment}
</select>
</mapper>

View File

@@ -6,7 +6,7 @@
<resultMap id="userAddressResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserAddressEntity">
<result column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="regions_info_id" property="regionsInfoId"/>
<result column="regions_id" property="regionsId"/>
<result column="province" property="province"/>
<result column="city" property="city"/>
<result column="district" property="district"/>
@@ -27,15 +27,15 @@
<select id="selectUserAddressPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserAddressVO">
select
ua.*,
cua.*,
bu.account
from blade_user bu
left join user_address ua on ua.user_id = bu.id
where bu .is_deleted = 0 and ua.is_deleted = 0
left join common_user_address cua on cua.user_id = bu.id
where bu.is_deleted = 0 and bu.user_type = 2 and cua.is_deleted = 0
<if test="userAddress.account != null">
and bu.account = #{userAddress.account}
</if>
order by ua.create_time desc
order by cua.create_time desc
</select>
</mapper>

View File

@@ -41,6 +41,15 @@
<if test="order.id != null">
and uo.id = #{order.id}
</if>
<if test="order.account != null">
and bu.account = #{order.account}
</if>
<if test="order.paymentStatus !=null">
and uo.payment_status = #{order.paymentStatus}
</if>
<if test="order.paymentType !=null">
and uo.payment_type = #{order.paymentType}
</if>
<if test="order.orderStatus != null">
and uo.order_status = #{order.orderStatus}
</if>

View File

@@ -24,7 +24,7 @@
bu.account
from blade_user bu
left join user_point up on bu.id = up.id
where bu.is_deleted = 0 and up.is_deleted = 0
where bu.is_deleted = 0 and bu.user_type = 2 and up.is_deleted = 0
<if test="userPoint.account != null">
and bu.account = #{userPoint.account}
</if>
@@ -37,11 +37,12 @@
set amount = amount + #{amount} , version = version + 1
where id = #{userId} and version = #{version}
</update>
<update id="deductUserPoint">
update
user_point
set amount = amount - #{amount} , version = version + 1
where id = #{userId} and version = #{version} and (amount - #{amount}) >= 0
where id = #{userId} and version = #{version} and amount >= #{amount}
</update>

View File

@@ -1,40 +0,0 @@
package org.springblade.modules.common.pojo.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
@Data
@Accessors(chain = true)
public class CommonCashCouponApiDTO {
/**
* 用户id
*/
private Long userId;
/**
* 金额
*/
private BigDecimal amount;
/**
* 来源类型 0-福利包产出 1-福利包兑换 2-用户直推 3-otc交易
*/
private Integer sourceType;
/**
* 来源id
*/
private Long sourceId;
/**
* 来源详情
*/
private String sourceDetail;
/**
* 备注
*/
private String remark;
}

View File

@@ -25,20 +25,20 @@
*/
package org.springblade.modules.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointLogEntity;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 用户福利值流水表 数据传输对象实体类
* 奖品配置表 数据传输对象实体类
*
* @author BladeX
* @since 2026-02-12
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonBenefitPointLogDTO extends CommonBenefitPointLogEntity {
public class CommonLotteryPrizeDTO extends CommonLotteryPrizeEntity {
@Serial
private static final long serialVersionUID = 1L;

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.common.pojo.dto;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 抽奖记录表 数据传输对象实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryRecordDTO extends CommonLotteryRecordEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -1,40 +0,0 @@
package org.springblade.modules.common.pojo.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
@Data
@Accessors(chain = true)
public class CommonUserPointApiDTO {
/**
* 用户id
*/
private Long userId;
/**
* 金额
*/
private BigDecimal amount;
/**
* 来源类型 0-商城订单 1-商城抽奖
*/
private Integer sourceType;
/**
* 来源id
*/
private Long sourceId;
/**
* 来源详情
*/
private String sourceDetail;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,93 @@
/**
* 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.common.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 奖品配置表 实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@TableName("common_lottery_prize")
@Schema(description = "LotteryPrize对象")
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryPrizeEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 奖品名称
*/
@Schema(description = "奖品名称")
private String prizeName;
/**
* 奖品类型
*/
@Schema(description = "奖品类型")
private Integer prizeType;
/**
* 奖品内容
*/
@Schema(description = "奖品内容")
private String prizeValue;
/**
* 中奖概率(如 0.05 = 5%)
*/
@Schema(description = "中奖概率(如 0.05 = 5%)")
private BigDecimal probability;
/**
* 总库存(-1 表示无限)
*/
@Schema(description = "总库存(-1 表示无限)")
private Integer stock;
/**
* 每日发放上限
*/
@Schema(description = "每日发放上限")
private Integer dailyLimit;
/**
* 排序(用于前端展示顺序)
*/
@Schema(description = "排序(用于前端展示顺序)")
private Integer sortOrder;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,73 @@
/**
* 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.common.pojo.entity;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 抽奖记录表 实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@TableName("common_lottery_record")
@Schema(description = "LotteryRecord对象")
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryRecordEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
@Schema(description = "用户id")
private Long userId;
/**
* 中奖奖品ID(null 表示未中奖/谢谢参与)
*/
@Schema(description = "中奖奖品ID(null 表示未中奖/谢谢参与)")
private Long prizeId;
/**
* 消耗积分
*/
@Schema(description = "消耗积分")
private BigDecimal pointsUsed;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

View File

@@ -40,7 +40,7 @@ import java.io.Serial;
* @since 2026-02-05
*/
@Data
@TableName("user_address")
@TableName("common_user_address")
@Schema(description = "UserAddress对象")
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@@ -58,7 +58,7 @@ public class CommonUserAddressEntity extends BaseEntity {
* 地区信息id
*/
@Schema(description = "地区信息id")
private Long regionsInfoId;
private Long regionsId;
/**
* 省份
*/

View File

@@ -34,6 +34,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serializable;
import java.io.Serial;
@@ -46,18 +49,12 @@ import java.io.Serial;
@Data
@TableName("user_order")
@Schema(description = "Order对象")
public class CommonUserOrderEntity implements Serializable {
@EqualsAndHashCode(callSuper = true)
public class CommonUserOrderEntity extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 用户id
@@ -149,40 +146,5 @@ public class CommonUserOrderEntity implements Serializable {
*/
@Schema(description = "支付凭证编号")
private String paymentTrack;
/**
* 创建人
*/
@Schema(description = "创建人")
private Long createUser;
/**
* 创建部门
*/
@Schema(description = "创建部门")
private Long createDept;
/**
* 创建时间
*/
@Schema(description = "创建时间")
private Date createTime;
/**
* 修改人
*/
@Schema(description = "修改人")
private Long updateUser;
/**
* 修改时间
*/
@Schema(description = "修改时间")
private Date updateTime;
/**
* 状态
*/
@Schema(description = "状态")
private Integer status;
/**
*
*/
@Schema(description = "")
private Integer isDeleted;
}

View File

@@ -45,10 +45,11 @@ public class CommonUserPointLogEntity extends BaseEntity {
@Schema(description = "上一笔金额")
private BigDecimal lastAmount;
/**
* 0-商城订单 1-商城抽奖
*
* 来源类型
*/
@Schema(description = "0-商城订单 1-商城抽奖")
private Integer sourceType;
@Schema(description = "来源类型")
private String sourceType;
/**
* 来源id
*/

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.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 奖品配置表 视图实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryPrizeVO extends CommonLotteryPrizeEntity {
@Serial
private static final long serialVersionUID = 1L;
}

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.common.pojo.vo;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 抽奖记录表 视图实体类
*
* @author RayLiu
* @since 2026-02-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonLotteryRecordVO extends CommonLotteryRecordEntity {
@Serial
private static final long serialVersionUID = 1L;
}

View File

@@ -1,14 +0,0 @@
package org.springblade.modules.common.request;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class GiveBenefitPointRequest implements Serializable {
private Long id;
private BigDecimal amount;
private String remark;
}

View File

@@ -1,26 +0,0 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonBenefitPointLogVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
/**
* 用户福利值流水表 服务类
*
* @author BladeX
* @since 2026-02-12
*/
public interface ICommonBenefitPointLogService extends BaseService<CommonBenefitPointLogEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonBenefitPointLog 查询参数
* @return IPage<CommonBenefitPointLogVO>
*/
IPage<CommonBenefitPointLogVO> selectCommonBenefitPointLogPage(IPage<CommonBenefitPointLogVO> page, CommonBenefitPointLogVO commonBenefitPointLog);
}

View File

@@ -1,48 +0,0 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.dto.CommonBenefitPointApiDTO;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointEntity;
import org.springblade.modules.common.pojo.vo.CommonBenefitPointVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.common.request.GiveBenefitPointRequest;
import java.math.BigDecimal;
import java.util.List;
/**
* 用户福利值表 服务类
*
* @author BladeX
* @since 2026-02-12
*/
public interface ICommonBenefitPointService extends BaseService<CommonBenefitPointEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonBenefitPoint 查询参数
* @return IPage<CommonBenefitPointVO>
*/
IPage<CommonBenefitPointVO> selectCommonBenefitPointPage(IPage<CommonBenefitPointVO> page, CommonBenefitPointVO commonBenefitPoint);
/**
* 添加福利积分
*
* @param dto 添加参数
* @return 操作结果
*/
Boolean addBenefitPoint(CommonBenefitPointApiDTO dto);
/**`
* 扣减福利积分
*
* @param dto 扣减参数
* @return 操作结果
*/
Boolean deductBenefitPoint(CommonBenefitPointApiDTO dto);
}

View File

@@ -1,26 +0,0 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.entity.CommonCashCouponLogEntity;
import org.springblade.modules.common.pojo.vo.CommonCashCouponLogVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
/**
* 用户现金券流水表 服务类
*
* @author BladeX
* @since 2026-02-12
*/
public interface ICommonCashCouponLogService extends BaseService<CommonCashCouponLogEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonCashCouponLog 查询参数
* @return IPage<CommonCashCouponLogVO>
*/
IPage<CommonCashCouponLogVO> selectCommonCashCouponLogPage(IPage<CommonCashCouponLogVO> page, CommonCashCouponLogVO commonCashCouponLog);
}

View File

@@ -1,43 +0,0 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.dto.CommonCashCouponApiDTO;
import org.springblade.modules.common.pojo.entity.CommonCashCouponEntity;
import org.springblade.modules.common.pojo.vo.CommonCashCouponVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
/**
* 用户现金券表 服务类
*
* @author BladeX
* @since 2026-02-12
*/
public interface ICommonCashCouponService extends BaseService<CommonCashCouponEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param commonCashCoupon 查询参数
* @return IPage<CommonCashCouponVO>
*/
IPage<CommonCashCouponVO> selectCommonCashCouponPage(IPage<CommonCashCouponVO> page, CommonCashCouponVO commonCashCoupon);
/**
* 添加现金券
*
* @param dto 添加参数
* @return 操作结果
*/
Boolean addCashCoupon(CommonCashCouponApiDTO dto);
/**`
* 扣减现金券
*
* @param dto 扣减参数
* @return 操作结果
*/
Boolean deductCashCoupon(CommonCashCouponApiDTO dto);
}

View File

@@ -23,39 +23,36 @@
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.userPackage.service;
package org.springblade.modules.common.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageLogEntity;
import org.springblade.modules.userPackage.pojo.vo.UserMarketBenefitPackageLogVO;
import org.springblade.modules.userPackage.excel.UserMarketBenefitPackageLogExcel;
import org.springblade.modules.api.request.LotteryDrawRequest;
import org.springblade.modules.api.vo.CommonLotteryPrizeApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
/**
* 划拨积分记录 服务类
* 奖品配置表 服务类
*
* @author BladeX
* @since 2026-02-05
* @author RayLiu
* @since 2026-02-14
*/
public interface IUserMarketBenefitPackageLogService extends BaseService<UserMarketBenefitPackageLogEntity> {
public interface ICommonLotteryPrizeService extends BaseService<CommonLotteryPrizeEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param userMarketBenefitPackageLog 查询参数
* @return IPage<UserMarketBenefitPackageLogVO>
* @param lotteryPrize 查询参数
* @return IPage<LotteryPrizeVO>
*/
IPage<UserMarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage<UserMarketBenefitPackageLogVO> page, UserMarketBenefitPackageLogVO userMarketBenefitPackageLog);
IPage<CommonLotteryPrizeVO> selectLotteryPrizePage(IPage<CommonLotteryPrizeVO> page, CommonLotteryPrizeVO lotteryPrize);
CommonLotteryPrizeApiVO draw(LotteryDrawRequest request);
/**
* 导出数据
*
* @param queryWrapper 查询条件
* @return List<UserMarketBenefitPackageLogExcel>
*/
List<UserMarketBenefitPackageLogExcel> exportUserMarketBenefitPackageLog(Wrapper<UserMarketBenefitPackageLogEntity> queryWrapper);
List<CommonLotteryPrizeApiVO> staticList();
String rules();
}

View File

@@ -23,41 +23,49 @@
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.modules.userPackage.service;
package org.springblade.modules.common.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
import org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageEntity;
import org.springblade.modules.userPackage.pojo.vo.UserMarketBenefitPackageVO;
import org.springblade.modules.userPackage.excel.UserMarketBenefitPackageExcel;
import org.springblade.modules.api.vo.CommonLotteryRecordApiVO;
import org.springblade.modules.api.vo.CommonLotteryWinnerApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
import java.util.List;
/**
* 用户积分包信息表 服务类
* 抽奖记录表 服务类
*
* @author BladeX
* @since 2026-02-05
* @author RayLiu
* @since 2026-02-14
*/
public interface IUserMarketBenefitPackageService extends BaseService<UserMarketBenefitPackageEntity> {
public interface ICommonLotteryRecordService extends BaseService<CommonLotteryRecordEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param userMarketBenefitPackage 查询参数
* @return IPage<UserMarketBenefitPackageVO>
* @param lotteryRecord 查询参数
* @return IPage<LotteryRecordVO>
*/
IPage<UserMarketBenefitPackageVO> selectUserMarketBenefitPackagePage(IPage<UserMarketBenefitPackageVO> page, UserMarketBenefitPackageVO userMarketBenefitPackage);
IPage<CommonLotteryRecordVO> selectLotteryRecordPage(IPage<CommonLotteryRecordVO> page, CommonLotteryRecordVO lotteryRecord);
/**
* 导出数据
*
* @param queryWrapper 查询条件
* @return List<UserMarketBenefitPackageExcel>
* @return List<LotteryRecordExcel>
*/
List<UserMarketBenefitPackageExcel> exportUserMarketBenefitPackage(Wrapper<UserMarketBenefitPackageEntity> queryWrapper);
List<CommonLotteryRecordExcel> exportLotteryRecord(Wrapper<CommonLotteryRecordEntity> queryWrapper);
IPage<CommonLotteryRecordApiVO> selectLotteryRecordApiPage(IPage<CommonLotteryRecordApiVO> page, CommonLotteryRecordApiVO vo);
Boolean addRecord(Long userId, BigDecimal amount);
List<CommonLotteryWinnerApiVO> lotteryWinners();
IPage<MarketBenefitPackageVO> findUserPackList(IPage<UserMarketBenefitPackageEntity> page, MarketBenefitPackageVO userMarketBenefitPackage , Long userId);
}

View File

@@ -25,11 +25,14 @@
*/
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
/**
* 用户商城积分流水表 服务类
*
@@ -46,5 +49,6 @@ public interface ICommonUserPointLogService extends BaseService<CommonUserPointL
*/
IPage<CommonUserPointLogVO> selectCommonUserPointLogPage(IPage<CommonUserPointLogVO> page, CommonUserPointLogVO commonUserPointLog);
Boolean recordPointChangeLog(CommonUserPointEntity commonUserPoint, BigDecimal lastAmount, String sourceType, BigDecimal amount, Integer type, Long sourceId, String sourceDetail);
}

View File

@@ -1,12 +1,14 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.dto.CommonUserPointApiDTO;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import java.math.BigDecimal;
/**
* 用户商城积分表 服务类
*
@@ -23,20 +25,9 @@ public interface ICommonUserPointService extends BaseService<CommonUserPointEnti
*/
IPage<CommonUserPointVO> selectCommonUserPointPage(IPage<CommonUserPointVO> page, CommonUserPointVO commonUserPoint);
/**
* 添加商城积分
*
* @param dto 添加参数
* @return 操作结果
*/
Boolean addUserPoint(CommonUserPointApiDTO dto);
BigDecimal queryPoint();
void grantPointsByUserOrder(CommonUserOrderEntity order);
/**`
* 扣减商城积分
*
* @param dto 扣减参数
* @return 操作结果
*/
Boolean deductUserPoint(CommonUserPointApiDTO dto);
void spendPointsForLottery(BigDecimal amount, Long userId);
}

View File

@@ -1,25 +0,0 @@
package org.springblade.modules.common.service.impl;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonBenefitPointLogVO;
import org.springblade.modules.common.mapper.CommonBenefitPointLogMapper;
import org.springblade.modules.common.service.ICommonBenefitPointLogService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
/**
* 用户福利值流水表 服务实现类
*
* @author BladeX
* @since 2026-02-12
*/
@Service
public class CommonBenefitPointLogServiceImpl extends BaseServiceImpl<CommonBenefitPointLogMapper, CommonBenefitPointLogEntity> implements ICommonBenefitPointLogService {
@Override
public IPage<CommonBenefitPointLogVO> selectCommonBenefitPointLogPage(IPage<CommonBenefitPointLogVO> page, CommonBenefitPointLogVO commonBenefitPointLog) {
return page.setRecords(baseMapper.selectCommonBenefitPointLogPage(page, commonBenefitPointLog));
}
}

View File

@@ -1,103 +0,0 @@
package org.springblade.modules.common.service.impl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.common.convert.AppCommonConvert;
import org.springblade.modules.common.pojo.dto.CommonBenefitPointApiDTO;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointEntity;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonBenefitPointVO;
import org.springblade.modules.common.mapper.CommonBenefitPointMapper;
import org.springblade.modules.common.request.GiveBenefitPointRequest;
import org.springblade.modules.common.service.ICommonBenefitPointLogService;
import org.springblade.modules.common.service.ICommonBenefitPointService;
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.math.BigDecimal;
import java.util.Date;
/**
* 用户福利值表 服务实现类
*
* @author BladeX
* @since 2026-02-12
*/
@Slf4j
@Service
@AllArgsConstructor
public class CommonBenefitPointServiceImpl extends BaseServiceImpl<CommonBenefitPointMapper, CommonBenefitPointEntity> implements ICommonBenefitPointService {
private final ICommonBenefitPointLogService benefitPointLogService;
@Override
public IPage<CommonBenefitPointVO> selectCommonBenefitPointPage(IPage<CommonBenefitPointVO> page, CommonBenefitPointVO commonBenefitPoint) {
return page.setRecords(baseMapper.selectCommonBenefitPointPage(page, commonBenefitPoint));
}
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Boolean addBenefitPoint(CommonBenefitPointApiDTO dto) {
CommonBenefitPointLogEntity benefitPointLog = saveBenefitPointLog(dto, 1);
CommonBenefitPointEntity benefitPoint = getById(dto.getUserId());
if (benefitPoint == null) {
benefitPoint = new CommonBenefitPointEntity();
benefitPoint.setId(dto.getUserId());
benefitPoint.setAmount(BigDecimal.ZERO);
benefitPoint.setVersion(1);
benefitPoint.setCreateTime(new Date());
save(benefitPoint);
}
if (baseMapper.addBenefitPoint(dto.getUserId(), dto.getAmount() ,benefitPoint.getVersion()) <= 0
|| !benefitPointLogService.updateById(benefitPointLog.setIsComplete(1).setLastAmount(benefitPoint.getAmount()))
){
log.error("增加福利积分失败, dto: [{}]" , dto);
throw new RuntimeException("增加福利积分失败");
}
return Boolean.TRUE;
}
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Boolean deductBenefitPoint(CommonBenefitPointApiDTO dto) {
CommonBenefitPointLogEntity benefitPointLog = saveBenefitPointLog(dto, 2);
CommonBenefitPointEntity benefitPoint = getById(dto.getUserId());
if (benefitPoint == null) {
benefitPoint = new CommonBenefitPointEntity();
benefitPoint.setId(dto.getUserId());
benefitPoint.setAmount(BigDecimal.ZERO);
benefitPoint.setVersion(1);
benefitPoint.setCreateTime(new Date());
save(benefitPoint);
}
if (baseMapper.deductBenefitPoint(dto.getUserId(), dto.getAmount() ,benefitPoint.getVersion()) <= 0
|| !benefitPointLogService.updateById(benefitPointLog.setIsComplete(1).setLastAmount(benefitPoint.getAmount()))){
log.error("扣除福利积分失败, dto: [{}]" , dto);
throw new RuntimeException("扣除福利积分失败");
}
return null;
}
private CommonBenefitPointLogEntity saveBenefitPointLog(CommonBenefitPointApiDTO dto , Integer type){
CommonBenefitPointLogEntity benefitPointLog = AppCommonConvert.INSTANCE.convertBenefitPointDTOToEntity(dto);
benefitPointLog.setType(type);
benefitPointLog.setStatisticalDate(DateUtil.getToday());
if (type == 2){
benefitPointLog.setAmount(dto.getAmount().negate());
benefitPointLog.setFee(dto.getFee().negate());
}
if (!benefitPointLogService.save(benefitPointLog)){
throw new RuntimeException("福利积分流水记录失败");
}
return benefitPointLog;
}
}

View File

@@ -0,0 +1,149 @@
/**
* 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.common.service.impl;
import io.jsonwebtoken.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.redis.debounce.DebounceClient;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.request.LotteryDrawRequest;
import org.springblade.modules.api.vo.CommonLotteryPrizeApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import org.springblade.modules.common.mapper.CommonLotteryPrizeMapper;
import org.springblade.modules.common.service.ICommonLotteryPrizeService;
import org.springblade.modules.common.service.ICommonLotteryRecordService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.market.eums.MarketBusinessModule;
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
import org.springblade.modules.market.service.IMarketCashCouponService;
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.math.BigDecimal;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 奖品配置表 服务实现类
*
* @author RayLiu
* @since 2026-02-14
*/
@Slf4j
@Service
@AllArgsConstructor
public class CommonLotteryPrizeServiceImpl extends BaseServiceImpl<CommonLotteryPrizeMapper, CommonLotteryPrizeEntity> implements ICommonLotteryPrizeService {
private final DebounceClient debounceClient;
private final ICommonUserPointService userPointService;
private final IMarketCashCouponService cashCouponService;
private final ICommonLotteryRecordService lotteryRecordService;
private static final List<CommonLotteryPrizeApiVO> STATIC_PRIZE_LIST = List.of(
new CommonLotteryPrizeApiVO(0L, "谢谢参与"),
new CommonLotteryPrizeApiVO(1L, "100积分"),
new CommonLotteryPrizeApiVO(2L, "1000积分"),
new CommonLotteryPrizeApiVO(3L, "生态礼包"),
new CommonLotteryPrizeApiVO(4L, "黑茶礼盒"),
new CommonLotteryPrizeApiVO(5L, "幸运锦鲤")
);
private static final CommonLotteryPrizeApiVO PRIZE = new CommonLotteryPrizeApiVO(0L, "谢谢参与");
private static final String RULES = """
活动名称:幸运大抽奖
活动时间:即日起至2026年8月31日 23:59(北京时间)
参与方式:
- 消耗 100 积分 即可参与一次抽奖;
奖品说明:
• 谢谢参与:未中奖,感谢支持;
• 100积分:中奖后立即到账;
• 1000积分:中奖后立即到账;
• 生态礼包:内含精选生态商品组合,包邮到家;
• 黑茶礼盒:高品质黑茶礼盒一份,典雅包装,适合馈赠;
• 幸运锦鲤:超级大奖!包含实物礼包+专属权益,详情请留意中奖通知。
发放规则:
- 积分类奖品:即时到账;
- 实物奖品(生态礼包、黑茶礼盒、幸运锦鲤):中奖后3个工作日内联系您,请保持手机畅通并及时填写收货信息,逾期视为放弃。
温馨提示:
1. 抽奖结果由系统随机生成,公平公正;
2. 禁止使用外挂、脚本等作弊行为,一经发现将取消资格;
3. 本活动最终解释权归平台所有。
""";
@Override
public IPage<CommonLotteryPrizeVO> selectLotteryPrizePage(IPage<CommonLotteryPrizeVO> page, CommonLotteryPrizeVO lotteryPrize) {
return page.setRecords(baseMapper.selectLotteryPrizePage(page, lotteryPrize));
}
@Override
@Transactional(rollbackFor = Exception.class)
public CommonLotteryPrizeApiVO draw(LotteryDrawRequest request) {
Long userId = AuthUtil.getUserId();
String key = "lottery:" + userId;
if (debounceClient.tryDebounce(key, 3, TimeUnit.SECONDS)) {
Assert.isTrue(request.getAmount().compareTo(BigDecimal.valueOf(100)) == 0 || request.getAmount().compareTo(BigDecimal.valueOf(1000)) == 0, "无效积分");
userPointService.spendPointsForLottery(request.getAmount(), userId);
Boolean addCashCoupon = cashCouponService.addCashCoupon(new MarketCashCouponApiDTO().setAmount(request.getAmount()).setUserId(userId).setSourceType(MarketBusinessModule.LOTTERY));
if (!addCashCoupon) {
log.error("新增现金券失败");
throw new RuntimeException("操作失败");
}
Boolean addedRecord = lotteryRecordService.addRecord(userId, request.getAmount());
if (!addedRecord) {
log.error("新增抽奖记录失败");
throw new RuntimeException("操作失败");
}
} else {
long remaining = debounceClient.getRemainingTime(key, TimeUnit.SECONDS);
throw new RuntimeException("操作过于频繁,请" + remaining + "秒后重试");
}
return PRIZE;
}
@Override
public List<CommonLotteryPrizeApiVO> staticList() {
return STATIC_PRIZE_LIST;
}
@Override
public String rules() {
return RULES;
}
}

View File

@@ -0,0 +1,97 @@
/**
* 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.common.service.impl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.vo.CommonLotteryRecordApiVO;
import org.springblade.modules.api.vo.CommonLotteryWinnerApiVO;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import org.springblade.modules.common.excel.CommonLotteryRecordExcel;
import org.springblade.modules.common.mapper.CommonLotteryRecordMapper;
import org.springblade.modules.common.service.ICommonLotteryRecordService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.math.BigDecimal;
import java.util.List;
/**
* 抽奖记录表 服务实现类
*
* @author RayLiu
* @since 2026-02-14
*/
@Service
public class CommonLotteryRecordServiceImpl extends BaseServiceImpl<CommonLotteryRecordMapper, CommonLotteryRecordEntity> implements ICommonLotteryRecordService {
@Override
public IPage<CommonLotteryRecordVO> selectLotteryRecordPage(IPage<CommonLotteryRecordVO> page, CommonLotteryRecordVO lotteryRecord) {
return page.setRecords(baseMapper.selectLotteryRecordPage(page, lotteryRecord));
}
@Override
public List<CommonLotteryRecordExcel> exportLotteryRecord(Wrapper<CommonLotteryRecordEntity> queryWrapper) {
List<CommonLotteryRecordExcel> lotteryRecordList = baseMapper.exportLotteryRecord(queryWrapper);
//lotteryRecordList.forEach(lotteryRecord -> {
// lotteryRecord.setTypeName(DictCache.getValue(DictEnum.YES_NO, LotteryRecord.getType()));
//});
return lotteryRecordList;
}
@Override
public IPage<CommonLotteryRecordApiVO> selectLotteryRecordApiPage(IPage<CommonLotteryRecordApiVO> page, CommonLotteryRecordApiVO vo) {
CommonLotteryRecordVO lotteryRecord = new CommonLotteryRecordVO();
lotteryRecord.setUserId(AuthUtil.getUserId());
List<CommonLotteryRecordVO> voList = baseMapper.selectLotteryRecordPage(page, lotteryRecord);
List<CommonLotteryRecordApiVO> list = voList.stream().map(record -> {
CommonLotteryRecordApiVO apiVO = new CommonLotteryRecordApiVO();
apiVO.setId(record.getId());
apiVO.setPrizeName(record.getPrizeId() == null ? "谢谢参与。" : "中奖了!");
apiVO.setPointsUsed(record.getPointsUsed());
apiVO.setCreateTime(record.getCreateTime());
return apiVO;
}).toList();
return page.setRecords(list);
}
@Override
public Boolean addRecord(Long userId, BigDecimal amount) {
CommonLotteryRecordEntity lotteryRecord = new CommonLotteryRecordEntity();
lotteryRecord.setUserId(userId);
lotteryRecord.setPointsUsed(amount);
return save(lotteryRecord);
}
@Override
public List<CommonLotteryWinnerApiVO> lotteryWinners() {
return List.of();
}
}

View File

@@ -74,7 +74,7 @@ public class CommonUserAddressServiceImpl extends BaseServiceImpl<CommonUserAddr
@Override
public boolean submitAddress(AddressSubmitRequest request) {
FullRegionInfoVO regionInfo = regionInfoService.queryFullInfo(Long.valueOf(request.getRegionsInfoId()));
FullRegionInfoVO regionInfo = regionInfoService.queryFullInfo(Long.valueOf(request.getRegionsId()));
Assert.isTrue(regionInfo.getCurrentLevel() == 4, "请选择所属街道");
Assert.isTrue(isMobile(request.getPhone()), "手机号码格式不正确");
Assert.isTrue(request.getConsignee().length() < 100 , "名字不能超过100个字");

View File

@@ -47,6 +47,7 @@ import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
import org.springblade.modules.common.excel.CommonUserOrderExcel;
import org.springblade.modules.common.mapper.CommonUserOrderMapper;
import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springblade.modules.mall.pojo.entity.MallProductEntity;
import org.springblade.modules.mall.service.IMallProductService;
import org.springframework.context.ApplicationEventPublisher;
@@ -77,6 +78,8 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
private final ApplicationEventPublisher eventPublisher;
private final ICommonUserPointService userPointService;
@Override
public IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order) {
@@ -113,7 +116,8 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
order.setActualAmount(actualAmount);
order.setOrderType(orderType);
order.setPaymentType(request.getIsOfflinePayment() ? request.getPaymentType() : null);
save(order);
order.setCreateTime(new Date());
this.save(order);
yield new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
}
case TRAVEL_GROUP -> {
@@ -125,10 +129,10 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
@Override
public PaymentResponse pay(PaymentRequest request) {
//todo先判断是否为线下支付,如果是线下支付则立即返回
CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId()));
Assert.notNull(order, "无效订单");
Assert.isTrue(order.getPaymentType() != 99, "线下订单不能重复支付");
//todo: 继续支付逻辑
return null;
}
@@ -152,12 +156,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
@Transactional(rollbackFor = Exception.class)
@RedisDebounce(key = "order:confirm", param = "#id", interval = 20, includeRemainingTime = true, message = "操作过于频繁")
public boolean confirmPayment(Long id) {
CommonUserOrderEntity order = getById(id);
if (order == null || order.getIsDeleted() == 1) {
return false;
}
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
.set(CommonUserOrderEntity::getOrderStatus, OrderStatus.PAID.getCode())
.set(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.PAID.getCode())
@@ -169,10 +167,18 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
.eq(CommonUserOrderEntity::getIsDeleted, 0)
);
if (!updated) {
return false;
// 可能已被处理过,或状态不符 → 幂等返回 true(避免报错)
log.warn("订单 {} 无需处理或已处理", id);
return true; // ⭐ 幂等:已成功过就不要再失败
}
//todo:增加用户积分
CommonUserOrderEntity order = getById(id);
if (order == null) {
throw new IllegalStateException("订单更新成功但查询不到,id=" + id);
}
userPointService.grantPointsByUserOrder(order);
eventPublisher.publishEvent(new PaymentSuccessEvent(id, order.getUserId(), BusinessModule.SELF_OPERATED_MALL));
return true;
}

View File

@@ -1,5 +1,7 @@
package org.springblade.modules.common.service.impl;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
import org.springblade.modules.common.mapper.CommonUserPointLogMapper;
@@ -8,6 +10,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import java.math.BigDecimal;
/**
* 用户商城积分流水表 服务实现类
*
@@ -22,6 +26,20 @@ public class CommonUserPointLogServiceImpl extends BaseServiceImpl<CommonUserPoi
return page.setRecords(baseMapper.selectCommonUserPointLogPage(page, commonUserPointLog));
}
@Override
public Boolean recordPointChangeLog(CommonUserPointEntity commonUserPoint, BigDecimal lastAmount, String sourceType, BigDecimal amount, Integer type, Long sourceId, String sourceDetail) {
CommonUserPointLogEntity userPointLog = new CommonUserPointLogEntity();
userPointLog.setType(type);
userPointLog.setUserId(commonUserPoint.getId());
userPointLog.setAmount(amount);
userPointLog.setSourceType(sourceType);
userPointLog.setSourceId(sourceId);
userPointLog.setSourceDetail(sourceDetail);
userPointLog.setIsComplete(1);
userPointLog.setStatisticalDate(DateUtil.getToday());
userPointLog.setLastAmount(lastAmount);
return save(userPointLog);
}
}

View File

@@ -1,27 +1,33 @@
package org.springblade.modules.common.service.impl;
import com.alibaba.fastjson2.JSON;
import io.jsonwebtoken.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.common.convert.AppCommonConvert;
import org.springblade.modules.common.pojo.dto.CommonUserPointApiDTO;
import org.springblade.modules.common.pojo.entity.CommonCashCouponEntity;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.common.eums.BusinessModule;
import org.springblade.modules.common.eums.UserPointFlowType;
import org.springblade.modules.common.event.GrantUserPointEvent;
import org.springblade.modules.common.event.SpendUserPointEvent;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
import org.springblade.modules.common.mapper.CommonUserPointMapper;
import org.springblade.modules.common.service.ICommonUserPointLogService;
import org.springblade.modules.common.service.ICommonUserPointService;
import org.springframework.context.ApplicationEventPublisher;
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.math.BigDecimal;
import java.util.Date;
import static org.springblade.modules.common.eums.BusinessModule.LOTTERY;
import static org.springblade.modules.common.eums.BusinessModule.SELF_OPERATED_MALL;
/**
* 用户商城积分表 服务实现类
* 用户积分表 服务实现类
*
* @author BladeX
* @since 2026-02-12
@@ -33,71 +39,61 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
private final ICommonUserPointLogService userPointLogService;
private final ApplicationEventPublisher eventPublisher;
@Override
public IPage<CommonUserPointVO> selectCommonUserPointPage(IPage<CommonUserPointVO> page, CommonUserPointVO commonUserPoint) {
return page.setRecords(baseMapper.selectCommonUserPointPage(page, commonUserPoint));
}
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Boolean addUserPoint(CommonUserPointApiDTO dto) {
CommonUserPointLogEntity userPointLog = saveBenefitPointLog(dto, 1);
CommonUserPointEntity userPoint = getById(dto.getUserId());
if (userPoint == null){
userPoint = new CommonUserPointEntity();
userPoint.setId(dto.getUserId());
userPoint.setAmount(BigDecimal.ZERO);
userPoint.setVersion(1);
userPoint.setCreateTime(new Date());
save(userPoint);
public BigDecimal queryPoint() {
CommonUserPointEntity userPoint = getById(AuthUtil.getUserId());
return userPoint.getAmount();
}
if (baseMapper.addUserPoint(dto.getUserId(), dto.getAmount() ,userPoint.getVersion()) <= 0
|| !userPointLogService.updateById(userPointLog.setIsComplete(1).setLastAmount(userPoint.getAmount()))
){
log.error("增加商城积分失败, dto: [{}]" , dto);
throw new RuntimeException("增加商城积分失败");
}
return Boolean.TRUE;
}
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Boolean deductUserPoint(CommonUserPointApiDTO dto) {
CommonUserPointLogEntity userPointLog = saveBenefitPointLog(dto, 2);
CommonUserPointEntity userPoint = getById(dto.getUserId());
if (userPoint == null){
userPoint = new CommonUserPointEntity();
userPoint.setId(dto.getUserId());
userPoint.setAmount(BigDecimal.ZERO);
userPoint.setVersion(1);
userPoint.setCreateTime(new Date());
save(userPoint);
@Transactional(rollbackFor = Exception.class)
public void grantPointsByUserOrder(CommonUserOrderEntity order) {
Assert.notNull(order, "无效订单");
Assert.isTrue(order.getId() != null && order.getUserId() != null && order.getActualAmount() != null && order.getActualAmount().compareTo(BigDecimal.ZERO) > 0, "无效订单");
BigDecimal pointsAmount;
String sourceType;
switch (BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType())) {
case SELF_OPERATED_MALL -> {
pointsAmount = order.getActualAmount().multiply(BigDecimal.valueOf(0.3));
sourceType = SELF_OPERATED_MALL.getCode();
}
if (baseMapper.deductUserPoint(dto.getUserId(), dto.getAmount() ,userPoint.getVersion()) <= 0
|| !userPointLogService.updateById(userPointLog.setIsComplete(1).setLastAmount(userPoint.getAmount()))
){
log.error("扣除商城积分失败, dto: [{}]" , dto);
throw new RuntimeException("扣除商城积分失败");
default -> throw new RuntimeException("无效订单类型");
}
return Boolean.TRUE;
CommonUserPointEntity userPoint = getById(order.getUserId());
BigDecimal lastAmount = userPoint.getAmount();
int i = baseMapper.addUserPoint(order.getUserId(), pointsAmount, userPoint.getVersion());
if (i > 0) {
if (userPointLogService.recordPointChangeLog(userPoint, lastAmount, sourceType.toUpperCase(), pointsAmount, UserPointFlowType.GRANT.getCode(), order.getId(), JSON.toJSONString(order))) {
eventPublisher.publishEvent(new GrantUserPointEvent(order.getId(), order.getUserId(), pointsAmount, BusinessModule.fromCodeIgnoreCaseOrNull(sourceType)));
return;
}
}
throw new RuntimeException("奖励用户积分失败");
}
private CommonUserPointLogEntity saveBenefitPointLog(CommonUserPointApiDTO dto , Integer type){
CommonUserPointLogEntity userPointLog = AppCommonConvert.INSTANCE.convertUserPointDTOToEntity(dto);
userPointLog.setType(type);
userPointLog.setStatisticalDate(DateUtil.getToday());
if (type == 2){
userPointLog.setAmount(dto.getAmount().negate());
@Override
@Transactional(rollbackFor = Exception.class)
public void spendPointsForLottery(BigDecimal amount, Long userId) {
Assert.isTrue(amount.compareTo(BigDecimal.valueOf(100)) == 0 || amount.compareTo(BigDecimal.valueOf(1000)) == 0, "无效积分");
Assert.notNull(userId, "无效用户");
CommonUserPointEntity userPoint = getById(userId);
Assert.isTrue(userPoint.getAmount().compareTo(amount) >= 0, "积分不足");
BigDecimal lastAmount = userPoint.getAmount();
int i = baseMapper.deductUserPoint(userId, amount, userPoint.getVersion());
if (i > 0) {
if (userPointLogService.recordPointChangeLog(userPoint, lastAmount, LOTTERY.getCode().toUpperCase(), amount.negate(), UserPointFlowType.SPEND.getCode(), null, null)) {
eventPublisher.publishEvent(new SpendUserPointEvent(userId, amount, LOTTERY));
return;
}
if (!userPointLogService.save(userPointLog)){
throw new RuntimeException("商城积分流水记录失败");
}
return userPointLog;
throw new RuntimeException("消费用户积分失败");
}

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.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonLotteryPrizeEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryPrizeVO;
import java.util.Objects;
/**
* 奖品配置表 包装类,返回视图层所需的字段
*
* @author RayLiu
* @since 2026-02-14
*/
public class CommonLotteryPrizeWrapper extends BaseEntityWrapper<CommonLotteryPrizeEntity, CommonLotteryPrizeVO> {
public static CommonLotteryPrizeWrapper build() {
return new CommonLotteryPrizeWrapper();
}
@Override
public CommonLotteryPrizeVO entityVO(CommonLotteryPrizeEntity lotteryPrize) {
CommonLotteryPrizeVO lotteryPrizeVO = Objects.requireNonNull(BeanUtil.copyProperties(lotteryPrize, CommonLotteryPrizeVO.class));
//User createUser = UserCache.getUser(lotteryPrize.getCreateUser());
//User updateUser = UserCache.getUser(lotteryPrize.getUpdateUser());
//lotteryPrizeVO.setCreateUserName(createUser.getName());
//lotteryPrizeVO.setUpdateUserName(updateUser.getName());
return lotteryPrizeVO;
}
}

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.common.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.common.pojo.entity.CommonLotteryRecordEntity;
import org.springblade.modules.common.pojo.vo.CommonLotteryRecordVO;
import java.util.Objects;
/**
* 抽奖记录表 包装类,返回视图层所需的字段
*
* @author RayLiu
* @since 2026-02-14
*/
public class CommonLotteryRecordWrapper extends BaseEntityWrapper<CommonLotteryRecordEntity, CommonLotteryRecordVO> {
public static CommonLotteryRecordWrapper build() {
return new CommonLotteryRecordWrapper();
}
@Override
public CommonLotteryRecordVO entityVO(CommonLotteryRecordEntity lotteryRecord) {
CommonLotteryRecordVO lotteryRecordVO = Objects.requireNonNull(BeanUtil.copyProperties(lotteryRecord, CommonLotteryRecordVO.class));
//User createUser = UserCache.getUser(lotteryRecord.getCreateUser());
//User updateUser = UserCache.getUser(lotteryRecord.getUpdateUser());
//lotteryRecordVO.setCreateUserName(createUser.getName());
//lotteryRecordVO.setUpdateUserName(updateUser.getName());
return lotteryRecordVO;
}
}

View File

@@ -0,0 +1,114 @@
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.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageVO;
import org.springblade.modules.market.wrapper.MarketBenefitPackageWrapper;
import org.springblade.modules.market.service.IMarketBenefitPackageService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户积分包信息表 控制器
*
* @author BladeX
* @since 2026-02-05
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package/")
@Tag(name = "用户积分包信息表", description = "用户积分包信息表接口")
public class MarketBenefitPackageController extends BladeController {
private final IMarketBenefitPackageService userMarketBenefitPackageService;
/**
* 用户积分包信息表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketBenefitPackage")
public R<MarketBenefitPackageVO> detail(MarketBenefitPackageEntity userMarketBenefitPackage) {
MarketBenefitPackageEntity detail = userMarketBenefitPackageService.getOne(Condition.getQueryWrapper(userMarketBenefitPackage));
return R.data(MarketBenefitPackageWrapper.build().entityVO(detail));
}
/**
* 用户积分包信息表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
public R<IPage<MarketBenefitPackageVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackage, Query query) {
IPage<MarketBenefitPackageEntity> pages = userMarketBenefitPackageService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackage, MarketBenefitPackageEntity.class).orderByDesc("id"));
return R.data(MarketBenefitPackageWrapper.build().pageVO(pages));
}
/**
* 用户积分包信息表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
public R<IPage<MarketBenefitPackageVO>> page(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
IPage<MarketBenefitPackageVO> pages = userMarketBenefitPackageService.selectUserMarketBenefitPackagePage(Condition.getPage(query), userMarketBenefitPackage);
return R.data(pages);
}
/**
* 用户积分包信息表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketBenefitPackage")
public R save(@Valid @RequestBody MarketBenefitPackageEntity userMarketBenefitPackage) {
return R.status(userMarketBenefitPackageService.save(userMarketBenefitPackage));
}
/**
* 用户积分包信息表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketBenefitPackage")
public R update(@Valid @RequestBody MarketBenefitPackageEntity userMarketBenefitPackage) {
return R.status(userMarketBenefitPackageService.updateById(userMarketBenefitPackage));
}
/**
* 用户积分包信息表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketBenefitPackage")
public R submit(@Valid @RequestBody MarketBenefitPackageEntity userMarketBenefitPackage) {
return R.status(userMarketBenefitPackageService.saveOrUpdate(userMarketBenefitPackage));
}
/**
* 用户积分包信息表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketBenefitPackageService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,114 @@
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.MarketBenefitPackageLogEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageLogVO;
import org.springblade.modules.market.wrapper.MarketBenefitPackageLogWrapper;
import org.springblade.modules.market.service.IMarketBenefitPackageLogService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 划拨积分记录 控制器
*
* @author BladeX
* @since 2026-02-05
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package-log")
@Tag(name = "划拨积分记录", description = "划拨积分记录接口")
public class MarketBenefitPackageLogController extends BladeController {
private final IMarketBenefitPackageLogService userMarketBenefitPackageLogService;
/**
* 划拨积分记录 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketBenefitPackageLog")
public R<MarketBenefitPackageLogVO> detail(MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
MarketBenefitPackageLogEntity detail = userMarketBenefitPackageLogService.getOne(Condition.getQueryWrapper(userMarketBenefitPackageLog));
return R.data(MarketBenefitPackageLogWrapper.build().entityVO(detail));
}
/**
* 划拨积分记录 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageLog")
public R<IPage<MarketBenefitPackageLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackageLog, Query query) {
IPage<MarketBenefitPackageLogEntity> pages = userMarketBenefitPackageLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackageLog, MarketBenefitPackageLogEntity.class).orderByDesc("id"));
return R.data(MarketBenefitPackageLogWrapper.build().pageVO(pages));
}
/**
* 划拨积分记录 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageLog")
public R<IPage<MarketBenefitPackageLogVO>> page(MarketBenefitPackageLogVO userMarketBenefitPackageLog, Query query) {
IPage<MarketBenefitPackageLogVO> pages = userMarketBenefitPackageLogService.selectUserMarketBenefitPackageLogPage(Condition.getPage(query), userMarketBenefitPackageLog);
return R.data(pages);
}
/**
* 划拨积分记录 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketBenefitPackageLog")
public R save(@Valid @RequestBody MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
return R.status(userMarketBenefitPackageLogService.save(userMarketBenefitPackageLog));
}
/**
* 划拨积分记录 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketBenefitPackageLog")
public R update(@Valid @RequestBody MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
return R.status(userMarketBenefitPackageLogService.updateById(userMarketBenefitPackageLog));
}
/**
* 划拨积分记录 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketBenefitPackageLog")
public R submit(@Valid @RequestBody MarketBenefitPackageLogEntity userMarketBenefitPackageLog) {
return R.status(userMarketBenefitPackageLogService.saveOrUpdate(userMarketBenefitPackageLog));
}
/**
* 划拨积分记录 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketBenefitPackageLogService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,133 @@
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.springblade.modules.market.pojo.vo.MarketImportBenefitPackageError;
import org.springblade.modules.market.request.AllocatePackRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageTemplateEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageTemplateVO;
import org.springblade.modules.market.wrapper.MarketBenefitPackageTemplateWrapper;
import org.springblade.modules.market.service.IMarketBenefitPackageTemplateService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 积分包信息表 控制器
*
* @author BladeX
* @since 2026-02-05
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package-template")
@Tag(name = "积分包信息表", description = "积分包信息表接口")
public class MarketBenefitPackageTemplateController extends BladeController {
private final IMarketBenefitPackageTemplateService userMarketBenefitPackageTemplateService;
/**
* 积分包信息表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketBenefitPackageTemplate")
public R<MarketBenefitPackageTemplateVO> detail(MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
MarketBenefitPackageTemplateEntity detail = userMarketBenefitPackageTemplateService.getOne(Condition.getQueryWrapper(userMarketBenefitPackageTemplate));
return R.data(MarketBenefitPackageTemplateWrapper.build().entityVO(detail));
}
/**
* 积分包信息表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageTemplate")
public R<IPage<MarketBenefitPackageTemplateVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketBenefitPackageTemplate, Query query) {
IPage<MarketBenefitPackageTemplateEntity> pages = userMarketBenefitPackageTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketBenefitPackageTemplate, MarketBenefitPackageTemplateEntity.class).orderByDesc("id"));
return R.data(MarketBenefitPackageTemplateWrapper.build().pageVO(pages));
}
/**
* 积分包信息表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketBenefitPackageTemplate")
public R<IPage<MarketBenefitPackageTemplateVO>> page(MarketBenefitPackageTemplateVO userMarketBenefitPackageTemplate, Query query) {
IPage<MarketBenefitPackageTemplateVO> pages = userMarketBenefitPackageTemplateService.selectUserMarketBenefitPackageTemplatePage(Condition.getPage(query), userMarketBenefitPackageTemplate);
return R.data(pages);
}
/**
* 积分包信息表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketBenefitPackageTemplate")
public R save(@Valid @RequestBody MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
return R.status(userMarketBenefitPackageTemplateService.save(userMarketBenefitPackageTemplate));
}
/**
* 积分包信息表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketBenefitPackageTemplate")
public R update(@Valid @RequestBody MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
return R.status(userMarketBenefitPackageTemplateService.updateById(userMarketBenefitPackageTemplate));
}
/**
* 积分包信息表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketBenefitPackageTemplate")
public R submit(@Valid @RequestBody MarketBenefitPackageTemplateEntity userMarketBenefitPackageTemplate) {
return R.status(userMarketBenefitPackageTemplateService.saveOrUpdate(userMarketBenefitPackageTemplate));
}
/**
* 积分包信息表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketBenefitPackageTemplateService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/allocate-benefit-package")
@ApiOperationSupport(order = 5)
@Operation(summary = "划拨福利包")
public R allocatePackToUser(@Valid @RequestBody AllocatePackRequest request) {
return R.status(userMarketBenefitPackageTemplateService.allocatePackToUser(request));
}
@PostMapping("import-benefit-package")
@ApiOperationSupport(order = 6)
@Operation(summary = "导入福利包", description = "传入excel")
public R<List<MarketImportBenefitPackageError>> importBenefitPackage(MultipartFile file) {
return R.data(userMarketBenefitPackageTemplateService.importBenefitPackage(file));
}
}

View File

@@ -1,4 +1,4 @@
package org.springblade.modules.common.controller;
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
@@ -11,14 +11,14 @@ 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.springblade.modules.common.manager.CommonUserPointManager;
import org.springblade.modules.common.request.GiveBenefitPointRequest;
import org.springblade.modules.market.manager.MarketUserPointManager;
import org.springblade.modules.market.request.BenefitPointTransferRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointEntity;
import org.springblade.modules.common.pojo.vo.CommonBenefitPointVO;
import org.springblade.modules.common.wrapper.CommonBenefitPointWrapper;
import org.springblade.modules.common.service.ICommonBenefitPointService;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPointVO;
import org.springblade.modules.market.wrapper.MarketBenefitPointWrapper;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.core.boot.ctrl.BladeController;
@@ -32,12 +32,12 @@ import java.util.Map;
*/
@RestController
@AllArgsConstructor
@RequestMapping("/common/benefit-point")
@RequestMapping("/market/benefit-point")
@Tag(name = "用户福利值表", description = "用户福利值表接口")
public class CommonBenefitPointController extends BladeController {
public class MarketBenefitPointController extends BladeController {
private final ICommonBenefitPointService commonBenefitPointService;
private final CommonUserPointManager commonUserPointManager;
private final IMarketBenefitPointService marketBenefitPointService;
private final MarketUserPointManager marketUserPointManager;
/**
* 用户福利值表 详情
@@ -45,9 +45,9 @@ public class CommonBenefitPointController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonBenefitPoint")
public R<CommonBenefitPointVO> detail(CommonBenefitPointEntity commonBenefitPoint) {
CommonBenefitPointEntity detail = commonBenefitPointService.getOne(Condition.getQueryWrapper(commonBenefitPoint));
return R.data(CommonBenefitPointWrapper.build().entityVO(detail));
public R<MarketBenefitPointVO> detail(MarketBenefitPointEntity commonBenefitPoint) {
MarketBenefitPointEntity detail = marketBenefitPointService.getOne(Condition.getQueryWrapper(commonBenefitPoint));
return R.data(MarketBenefitPointWrapper.build().entityVO(detail));
}
/**
* 用户福利值表 分页
@@ -55,9 +55,9 @@ public class CommonBenefitPointController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonBenefitPoint")
public R<IPage<CommonBenefitPointVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonBenefitPoint, Query query) {
IPage<CommonBenefitPointEntity> pages = commonBenefitPointService.page(Condition.getPage(query), Condition.getQueryWrapper(commonBenefitPoint, CommonBenefitPointEntity.class));
return R.data(CommonBenefitPointWrapper.build().pageVO(pages));
public R<IPage<MarketBenefitPointVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonBenefitPoint, Query query) {
IPage<MarketBenefitPointEntity> pages = marketBenefitPointService.page(Condition.getPage(query), Condition.getQueryWrapper(commonBenefitPoint, MarketBenefitPointEntity.class));
return R.data(MarketBenefitPointWrapper.build().pageVO(pages));
}
/**
@@ -66,8 +66,8 @@ public class CommonBenefitPointController extends BladeController {
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonBenefitPoint")
public R<IPage<CommonBenefitPointVO>> page(CommonBenefitPointVO commonBenefitPoint, Query query) {
IPage<CommonBenefitPointVO> pages = commonBenefitPointService.selectCommonBenefitPointPage(Condition.getPage(query), commonBenefitPoint);
public R<IPage<MarketBenefitPointVO>> page(MarketBenefitPointVO commonBenefitPoint, Query query) {
IPage<MarketBenefitPointVO> pages = marketBenefitPointService.selectCommonBenefitPointPage(Condition.getPage(query), commonBenefitPoint);
return R.data(pages);
}
@@ -77,8 +77,8 @@ public class CommonBenefitPointController extends BladeController {
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonBenefitPoint")
public R save(@Valid @RequestBody CommonBenefitPointEntity commonBenefitPoint) {
return R.status(commonBenefitPointService.save(commonBenefitPoint));
public R save(@Valid @RequestBody MarketBenefitPointEntity commonBenefitPoint) {
return R.status(marketBenefitPointService.save(commonBenefitPoint));
}
/**
@@ -87,8 +87,8 @@ public class CommonBenefitPointController extends BladeController {
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonBenefitPoint")
public R update(@Valid @RequestBody CommonBenefitPointEntity commonBenefitPoint) {
return R.status(commonBenefitPointService.updateById(commonBenefitPoint));
public R update(@Valid @RequestBody MarketBenefitPointEntity commonBenefitPoint) {
return R.status(marketBenefitPointService.updateById(commonBenefitPoint));
}
/**
@@ -97,8 +97,8 @@ public class CommonBenefitPointController extends BladeController {
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonBenefitPoint")
public R submit(@Valid @RequestBody CommonBenefitPointEntity commonBenefitPoint) {
return R.status(commonBenefitPointService.saveOrUpdate(commonBenefitPoint));
public R submit(@Valid @RequestBody MarketBenefitPointEntity commonBenefitPoint) {
return R.status(marketBenefitPointService.saveOrUpdate(commonBenefitPoint));
}
/**
@@ -108,15 +108,15 @@ public class CommonBenefitPointController extends BladeController {
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonBenefitPointService.deleteLogic(Func.toLongList(ids)));
return R.status(marketBenefitPointService.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/giveBenefitPoint")
@PostMapping("/transfer")
@ApiOperationSupport(order = 8)
@Operation(summary = "划拨福利积分", description = "传入request")
public R giveBenefitPoint(@RequestBody GiveBenefitPointRequest request) {
return R.status(commonUserPointManager.giveBenefitPoint(request));
public R transfer(@RequestBody BenefitPointTransferRequest request) {
return R.status(marketUserPointManager.transfer(request));
}

View File

@@ -1,4 +1,4 @@
package org.springblade.modules.common.controller;
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
@@ -7,26 +7,19 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
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.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonBenefitPointLogEntity;
import org.springblade.modules.common.pojo.vo.CommonBenefitPointLogVO;
import org.springblade.modules.common.wrapper.CommonBenefitPointLogWrapper;
import org.springblade.modules.common.service.ICommonBenefitPointLogService;
import org.springblade.modules.market.pojo.vo.MarketBenefitPointLogVO;
import org.springblade.modules.market.wrapper.MarketBenefitPointLogWrapper;
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 用户福利值流水表 控制器
@@ -36,11 +29,11 @@ import jakarta.servlet.http.HttpServletResponse;
*/
@RestController
@AllArgsConstructor
@RequestMapping("/common/benefit-point-log")
@RequestMapping("/market/benefit-point-log")
@Tag(name = "用户福利值流水表", description = "用户福利值流水表接口")
public class CommonBenefitPointLogController extends BladeController {
public class MarketBenefitPointLogController extends BladeController {
private final ICommonBenefitPointLogService commonBenefitPointLogService;
private final IMarketBenefitPointLogService marketBenefitPointLogService;
/**
* 用户福利值流水表 详情
@@ -48,9 +41,9 @@ public class CommonBenefitPointLogController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonBenefitPointLog")
public R<CommonBenefitPointLogVO> detail(CommonBenefitPointLogEntity commonBenefitPointLog) {
CommonBenefitPointLogEntity detail = commonBenefitPointLogService.getOne(Condition.getQueryWrapper(commonBenefitPointLog));
return R.data(CommonBenefitPointLogWrapper.build().entityVO(detail));
public R<MarketBenefitPointLogVO> detail(MarketBenefitPointLogEntity commonBenefitPointLog) {
MarketBenefitPointLogEntity detail = marketBenefitPointLogService.getOne(Condition.getQueryWrapper(commonBenefitPointLog));
return R.data(MarketBenefitPointLogWrapper.build().entityVO(detail));
}
/**
* 用户福利值流水表 分页
@@ -58,9 +51,9 @@ public class CommonBenefitPointLogController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonBenefitPointLog")
public R<IPage<CommonBenefitPointLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonBenefitPointLog, Query query) {
IPage<CommonBenefitPointLogEntity> pages = commonBenefitPointLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonBenefitPointLog, CommonBenefitPointLogEntity.class));
return R.data(CommonBenefitPointLogWrapper.build().pageVO(pages));
public R<IPage<MarketBenefitPointLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonBenefitPointLog, Query query) {
IPage<MarketBenefitPointLogEntity> pages = marketBenefitPointLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonBenefitPointLog, MarketBenefitPointLogEntity.class));
return R.data(MarketBenefitPointLogWrapper.build().pageVO(pages));
}
/**
@@ -69,8 +62,8 @@ public class CommonBenefitPointLogController extends BladeController {
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonBenefitPointLog")
public R<IPage<CommonBenefitPointLogVO>> page(CommonBenefitPointLogVO commonBenefitPointLog, Query query) {
IPage<CommonBenefitPointLogVO> pages = commonBenefitPointLogService.selectCommonBenefitPointLogPage(Condition.getPage(query), commonBenefitPointLog);
public R<IPage<MarketBenefitPointLogVO>> page(MarketBenefitPointLogVO commonBenefitPointLog, Query query) {
IPage<MarketBenefitPointLogVO> pages = marketBenefitPointLogService.selectCommonBenefitPointLogPage(Condition.getPage(query), commonBenefitPointLog);
return R.data(pages);
}
@@ -80,8 +73,8 @@ public class CommonBenefitPointLogController extends BladeController {
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonBenefitPointLog")
public R save(@Valid @RequestBody CommonBenefitPointLogEntity commonBenefitPointLog) {
return R.status(commonBenefitPointLogService.save(commonBenefitPointLog));
public R save(@Valid @RequestBody MarketBenefitPointLogEntity commonBenefitPointLog) {
return R.status(marketBenefitPointLogService.save(commonBenefitPointLog));
}
/**
@@ -90,8 +83,8 @@ public class CommonBenefitPointLogController extends BladeController {
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonBenefitPointLog")
public R update(@Valid @RequestBody CommonBenefitPointLogEntity commonBenefitPointLog) {
return R.status(commonBenefitPointLogService.updateById(commonBenefitPointLog));
public R update(@Valid @RequestBody MarketBenefitPointLogEntity commonBenefitPointLog) {
return R.status(marketBenefitPointLogService.updateById(commonBenefitPointLog));
}
/**
@@ -100,8 +93,8 @@ public class CommonBenefitPointLogController extends BladeController {
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonBenefitPointLog")
public R submit(@Valid @RequestBody CommonBenefitPointLogEntity commonBenefitPointLog) {
return R.status(commonBenefitPointLogService.saveOrUpdate(commonBenefitPointLog));
public R submit(@Valid @RequestBody MarketBenefitPointLogEntity commonBenefitPointLog) {
return R.status(marketBenefitPointLogService.saveOrUpdate(commonBenefitPointLog));
}
/**
@@ -111,7 +104,7 @@ public class CommonBenefitPointLogController extends BladeController {
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonBenefitPointLogService.deleteLogic(Func.toLongList(ids)));
return R.status(marketBenefitPointLogService.deleteLogic(Func.toLongList(ids)));
}

View File

@@ -1,4 +1,4 @@
package org.springblade.modules.common.controller;
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
@@ -7,26 +7,19 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonCashCouponEntity;
import org.springblade.modules.common.pojo.vo.CommonCashCouponVO;
import org.springblade.modules.common.wrapper.CommonCashCouponWrapper;
import org.springblade.modules.common.service.ICommonCashCouponService;
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
import org.springblade.modules.market.pojo.vo.MarketCashCouponVO;
import org.springblade.modules.market.wrapper.MarketCashCouponWrapper;
import org.springblade.modules.market.service.IMarketCashCouponService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 用户现金券表 控制器
@@ -36,11 +29,11 @@ import jakarta.servlet.http.HttpServletResponse;
*/
@RestController
@AllArgsConstructor
@RequestMapping("/common/cash-coupon")
@RequestMapping("/market/cash-coupon")
@Tag(name = "用户现金券表", description = "用户现金券表接口")
public class CommonCashCouponController extends BladeController {
public class MarketCashCouponController extends BladeController {
private final ICommonCashCouponService commonCashCouponService;
private final IMarketCashCouponService marketCashCouponService;
/**
* 用户现金券表 详情
@@ -48,9 +41,9 @@ public class CommonCashCouponController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonCashCoupon")
public R<CommonCashCouponVO> detail(CommonCashCouponEntity commonCashCoupon) {
CommonCashCouponEntity detail = commonCashCouponService.getOne(Condition.getQueryWrapper(commonCashCoupon));
return R.data(CommonCashCouponWrapper.build().entityVO(detail));
public R<MarketCashCouponVO> detail(MarketCashCouponEntity commonCashCoupon) {
MarketCashCouponEntity detail = marketCashCouponService.getOne(Condition.getQueryWrapper(commonCashCoupon));
return R.data(MarketCashCouponWrapper.build().entityVO(detail));
}
/**
* 用户现金券表 分页
@@ -58,9 +51,9 @@ public class CommonCashCouponController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonCashCoupon")
public R<IPage<CommonCashCouponVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonCashCoupon, Query query) {
IPage<CommonCashCouponEntity> pages = commonCashCouponService.page(Condition.getPage(query), Condition.getQueryWrapper(commonCashCoupon, CommonCashCouponEntity.class));
return R.data(CommonCashCouponWrapper.build().pageVO(pages));
public R<IPage<MarketCashCouponVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonCashCoupon, Query query) {
IPage<MarketCashCouponEntity> pages = marketCashCouponService.page(Condition.getPage(query), Condition.getQueryWrapper(commonCashCoupon, MarketCashCouponEntity.class));
return R.data(MarketCashCouponWrapper.build().pageVO(pages));
}
/**
@@ -69,8 +62,8 @@ public class CommonCashCouponController extends BladeController {
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonCashCoupon")
public R<IPage<CommonCashCouponVO>> page(CommonCashCouponVO commonCashCoupon, Query query) {
IPage<CommonCashCouponVO> pages = commonCashCouponService.selectCommonCashCouponPage(Condition.getPage(query), commonCashCoupon);
public R<IPage<MarketCashCouponVO>> page(MarketCashCouponVO commonCashCoupon, Query query) {
IPage<MarketCashCouponVO> pages = marketCashCouponService.selectCommonCashCouponPage(Condition.getPage(query), commonCashCoupon);
return R.data(pages);
}
@@ -80,8 +73,8 @@ public class CommonCashCouponController extends BladeController {
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonCashCoupon")
public R save(@Valid @RequestBody CommonCashCouponEntity commonCashCoupon) {
return R.status(commonCashCouponService.save(commonCashCoupon));
public R save(@Valid @RequestBody MarketCashCouponEntity commonCashCoupon) {
return R.status(marketCashCouponService.save(commonCashCoupon));
}
/**
@@ -90,8 +83,8 @@ public class CommonCashCouponController extends BladeController {
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonCashCoupon")
public R update(@Valid @RequestBody CommonCashCouponEntity commonCashCoupon) {
return R.status(commonCashCouponService.updateById(commonCashCoupon));
public R update(@Valid @RequestBody MarketCashCouponEntity commonCashCoupon) {
return R.status(marketCashCouponService.updateById(commonCashCoupon));
}
/**
@@ -100,8 +93,8 @@ public class CommonCashCouponController extends BladeController {
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonCashCoupon")
public R submit(@Valid @RequestBody CommonCashCouponEntity commonCashCoupon) {
return R.status(commonCashCouponService.saveOrUpdate(commonCashCoupon));
public R submit(@Valid @RequestBody MarketCashCouponEntity commonCashCoupon) {
return R.status(marketCashCouponService.saveOrUpdate(commonCashCoupon));
}
/**
@@ -111,7 +104,7 @@ public class CommonCashCouponController extends BladeController {
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonCashCouponService.deleteLogic(Func.toLongList(ids)));
return R.status(marketCashCouponService.deleteLogic(Func.toLongList(ids)));
}

View File

@@ -1,4 +1,4 @@
package org.springblade.modules.common.controller;
package org.springblade.modules.market.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
@@ -7,26 +7,19 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
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.springblade.modules.market.pojo.entity.MarketCashCouponLogEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.common.pojo.entity.CommonCashCouponLogEntity;
import org.springblade.modules.common.pojo.vo.CommonCashCouponLogVO;
import org.springblade.modules.common.wrapper.CommonCashCouponLogWrapper;
import org.springblade.modules.common.service.ICommonCashCouponLogService;
import org.springblade.modules.market.pojo.vo.MarketCashCouponLogVO;
import org.springblade.modules.market.wrapper.MarketCashCouponLogWrapper;
import org.springblade.modules.market.service.IMarketCashCouponLogService;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* 用户现金券流水表 控制器
@@ -36,11 +29,11 @@ import jakarta.servlet.http.HttpServletResponse;
*/
@RestController
@AllArgsConstructor
@RequestMapping("/common/cash-coupon-log")
@RequestMapping("/market/cash-coupon-log")
@Tag(name = "用户现金券流水表", description = "用户现金券流水表接口")
public class CommonCashCouponLogController extends BladeController {
public class MarketCashCouponLogController extends BladeController {
private final ICommonCashCouponLogService commonCashCouponLogService;
private final IMarketCashCouponLogService marketCashCouponLogService;
/**
* 用户现金券流水表 详情
@@ -48,9 +41,9 @@ public class CommonCashCouponLogController extends BladeController {
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入commonCashCouponLog")
public R<CommonCashCouponLogVO> detail(CommonCashCouponLogEntity commonCashCouponLog) {
CommonCashCouponLogEntity detail = commonCashCouponLogService.getOne(Condition.getQueryWrapper(commonCashCouponLog));
return R.data(CommonCashCouponLogWrapper.build().entityVO(detail));
public R<MarketCashCouponLogVO> detail(MarketCashCouponLogEntity commonCashCouponLog) {
MarketCashCouponLogEntity detail = marketCashCouponLogService.getOne(Condition.getQueryWrapper(commonCashCouponLog));
return R.data(MarketCashCouponLogWrapper.build().entityVO(detail));
}
/**
* 用户现金券流水表 分页
@@ -58,9 +51,9 @@ public class CommonCashCouponLogController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入commonCashCouponLog")
public R<IPage<CommonCashCouponLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonCashCouponLog, Query query) {
IPage<CommonCashCouponLogEntity> pages = commonCashCouponLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonCashCouponLog, CommonCashCouponLogEntity.class));
return R.data(CommonCashCouponLogWrapper.build().pageVO(pages));
public R<IPage<MarketCashCouponLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonCashCouponLog, Query query) {
IPage<MarketCashCouponLogEntity> pages = marketCashCouponLogService.page(Condition.getPage(query), Condition.getQueryWrapper(commonCashCouponLog, MarketCashCouponLogEntity.class));
return R.data(MarketCashCouponLogWrapper.build().pageVO(pages));
}
/**
@@ -69,8 +62,8 @@ public class CommonCashCouponLogController extends BladeController {
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入commonCashCouponLog")
public R<IPage<CommonCashCouponLogVO>> page(CommonCashCouponLogVO commonCashCouponLog, Query query) {
IPage<CommonCashCouponLogVO> pages = commonCashCouponLogService.selectCommonCashCouponLogPage(Condition.getPage(query), commonCashCouponLog);
public R<IPage<MarketCashCouponLogVO>> page(MarketCashCouponLogVO commonCashCouponLog, Query query) {
IPage<MarketCashCouponLogVO> pages = marketCashCouponLogService.selectCommonCashCouponLogPage(Condition.getPage(query), commonCashCouponLog);
return R.data(pages);
}
@@ -80,8 +73,8 @@ public class CommonCashCouponLogController extends BladeController {
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入commonCashCouponLog")
public R save(@Valid @RequestBody CommonCashCouponLogEntity commonCashCouponLog) {
return R.status(commonCashCouponLogService.save(commonCashCouponLog));
public R save(@Valid @RequestBody MarketCashCouponLogEntity commonCashCouponLog) {
return R.status(marketCashCouponLogService.save(commonCashCouponLog));
}
/**
@@ -90,8 +83,8 @@ public class CommonCashCouponLogController extends BladeController {
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入commonCashCouponLog")
public R update(@Valid @RequestBody CommonCashCouponLogEntity commonCashCouponLog) {
return R.status(commonCashCouponLogService.updateById(commonCashCouponLog));
public R update(@Valid @RequestBody MarketCashCouponLogEntity commonCashCouponLog) {
return R.status(marketCashCouponLogService.updateById(commonCashCouponLog));
}
/**
@@ -100,8 +93,8 @@ public class CommonCashCouponLogController extends BladeController {
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入commonCashCouponLog")
public R submit(@Valid @RequestBody CommonCashCouponLogEntity commonCashCouponLog) {
return R.status(commonCashCouponLogService.saveOrUpdate(commonCashCouponLog));
public R submit(@Valid @RequestBody MarketCashCouponLogEntity commonCashCouponLog) {
return R.status(marketCashCouponLogService.saveOrUpdate(commonCashCouponLog));
}
/**
@@ -111,7 +104,7 @@ public class CommonCashCouponLogController extends BladeController {
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(commonCashCouponLogService.deleteLogic(Func.toLongList(ids)));
return R.status(marketCashCouponLogService.deleteLogic(Func.toLongList(ids)));
}

View File

@@ -0,0 +1,112 @@
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.MarketPackageDailySettlementEntity;
import org.springblade.modules.market.pojo.vo.MarketPackageDailySettlementVO;
import org.springblade.modules.market.wrapper.MarketPackageDailySettlementWrapper;
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户福利包每天结算记录 控制器
*
* @author BladeX
* @since 2026-02-13
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-package-settlement")
@Tag(name = "用户福利包每天结算记录", description = "用户福利包每天结算记录接口")
public class MarketPackageDailySettlementController extends BladeController {
private final IMarketPackageDailySettlementService userMarketPackageDailySettlementService;
/**
* 用户福利包每天结算记录 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userMarketPackageDailySettlement")
public R<MarketPackageDailySettlementVO> detail(MarketPackageDailySettlementEntity userMarketPackageDailySettlement) {
MarketPackageDailySettlementEntity detail = userMarketPackageDailySettlementService.getOne(Condition.getQueryWrapper(userMarketPackageDailySettlement));
return R.data(MarketPackageDailySettlementWrapper.build().entityVO(detail));
}
/**
* 用户福利包每天结算记录 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userMarketPackageDailySettlement")
public R<IPage<MarketPackageDailySettlementVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userMarketPackageDailySettlement, Query query) {
IPage<MarketPackageDailySettlementEntity> pages = userMarketPackageDailySettlementService.page(Condition.getPage(query), Condition.getQueryWrapper(userMarketPackageDailySettlement, MarketPackageDailySettlementEntity.class));
return R.data(MarketPackageDailySettlementWrapper.build().pageVO(pages));
}
/**
* 用户福利包每天结算记录 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userMarketPackageDailySettlement")
public R<IPage<MarketPackageDailySettlementVO>> page(MarketPackageDailySettlementVO userMarketPackageDailySettlement, Query query) {
IPage<MarketPackageDailySettlementVO> pages = userMarketPackageDailySettlementService.selectUserMarketPackageDailySettlementPage(Condition.getPage(query), userMarketPackageDailySettlement);
return R.data(pages);
}
/**
* 用户福利包每天结算记录 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userMarketPackageDailySettlement")
public R save(@Valid @RequestBody MarketPackageDailySettlementEntity userMarketPackageDailySettlement) {
return R.status(userMarketPackageDailySettlementService.save(userMarketPackageDailySettlement));
}
/**
* 用户福利包每天结算记录 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userMarketPackageDailySettlement")
public R update(@Valid @RequestBody MarketPackageDailySettlementEntity userMarketPackageDailySettlement) {
return R.status(userMarketPackageDailySettlementService.updateById(userMarketPackageDailySettlement));
}
/**
* 用户福利包每天结算记录 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userMarketPackageDailySettlement")
public R submit(@Valid @RequestBody MarketPackageDailySettlementEntity userMarketPackageDailySettlement) {
return R.status(userMarketPackageDailySettlementService.saveOrUpdate(userMarketPackageDailySettlement));
}
/**
* 用户福利包每天结算记录 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userMarketPackageDailySettlementService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,114 @@
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.MarketUserCommissionEntity;
import org.springblade.modules.market.pojo.vo.MarketUserCommissionVO;
import org.springblade.modules.market.wrapper.MarketUserCommissionWrapper;
import org.springblade.modules.market.service.IMarketUserCommissionService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户佣金表 控制器
*
* @author BladeX
* @since 2026-02-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-commission")
@Tag(name = "用户佣金表", description = "用户佣金表接口")
public class MarketUserCommissionController extends BladeController {
private final IMarketUserCommissionService userCommissionService;
/**
* 用户佣金表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userCommission")
public R<MarketUserCommissionVO> detail(MarketUserCommissionEntity userCommission) {
MarketUserCommissionEntity detail = userCommissionService.getOne(Condition.getQueryWrapper(userCommission));
return R.data(MarketUserCommissionWrapper.build().entityVO(detail));
}
/**
* 用户佣金表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userCommission")
public R<IPage<MarketUserCommissionVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userCommission, Query query) {
IPage<MarketUserCommissionEntity> pages = userCommissionService.page(Condition.getPage(query), Condition.getQueryWrapper(userCommission, MarketUserCommissionEntity.class));
return R.data(MarketUserCommissionWrapper.build().pageVO(pages));
}
/**
* 用户佣金表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userCommission")
public R<IPage<MarketUserCommissionVO>> page(MarketUserCommissionVO userCommission, Query query) {
IPage<MarketUserCommissionVO> pages = userCommissionService.selectUserCommissionPage(Condition.getPage(query), userCommission);
return R.data(pages);
}
/**
* 用户佣金表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userCommission")
public R save(@Valid @RequestBody MarketUserCommissionEntity userCommission) {
return R.status(userCommissionService.save(userCommission));
}
/**
* 用户佣金表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userCommission")
public R update(@Valid @RequestBody MarketUserCommissionEntity userCommission) {
return R.status(userCommissionService.updateById(userCommission));
}
/**
* 用户佣金表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userCommission")
public R submit(@Valid @RequestBody MarketUserCommissionEntity userCommission) {
return R.status(userCommissionService.saveOrUpdate(userCommission));
}
/**
* 用户佣金表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userCommissionService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,113 @@
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.MarketUserCommissionLogEntity;
import org.springblade.modules.market.pojo.vo.MarketUserCommissionLogVO;
import org.springblade.modules.market.wrapper.MarketUserCommissionLogWrapper;
import org.springblade.modules.market.service.IMarketUserCommissionLogService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.Map;
/**
* 用户佣金流水表 控制器
*
* @author BladeX
* @since 2026-02-14
*/
@RestController
@AllArgsConstructor
@RequestMapping("/market/benefit-commission-log")
@Tag(name = "用户佣金流水表", description = "用户佣金流水表接口")
public class MarketUserCommissionLogController extends BladeController {
private final IMarketUserCommissionLogService userCommissionLogService;
/**
* 用户佣金流水表 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入userCommissionLog")
public R<MarketUserCommissionLogVO> detail(MarketUserCommissionLogEntity userCommissionLog) {
MarketUserCommissionLogEntity detail = userCommissionLogService.getOne(Condition.getQueryWrapper(userCommissionLog));
return R.data(MarketUserCommissionLogWrapper.build().entityVO(detail));
}
/**
* 用户佣金流水表 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入userCommissionLog")
public R<IPage<MarketUserCommissionLogVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> userCommissionLog, Query query) {
IPage<MarketUserCommissionLogEntity> pages = userCommissionLogService.page(Condition.getPage(query), Condition.getQueryWrapper(userCommissionLog, MarketUserCommissionLogEntity.class));
return R.data(MarketUserCommissionLogWrapper.build().pageVO(pages));
}
/**
* 用户佣金流水表 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入userCommissionLog")
public R<IPage<MarketUserCommissionLogVO>> page(MarketUserCommissionLogVO userCommissionLog, Query query) {
IPage<MarketUserCommissionLogVO> pages = userCommissionLogService.selectUserCommissionLogPage(Condition.getPage(query), userCommissionLog);
return R.data(pages);
}
/**
* 用户佣金流水表 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入userCommissionLog")
public R save(@Valid @RequestBody MarketUserCommissionLogEntity userCommissionLog) {
return R.status(userCommissionLogService.save(userCommissionLog));
}
/**
* 用户佣金流水表 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入userCommissionLog")
public R update(@Valid @RequestBody MarketUserCommissionLogEntity userCommissionLog) {
return R.status(userCommissionLogService.updateById(userCommissionLog));
}
/**
* 用户佣金流水表 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入userCommissionLog")
public R submit(@Valid @RequestBody MarketUserCommissionLogEntity userCommissionLog) {
return R.status(userCommissionLogService.saveOrUpdate(userCommissionLog));
}
/**
* 用户佣金流水表 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(userCommissionLogService.deleteLogic(Func.toLongList(ids)));
}
}

View File

@@ -0,0 +1,24 @@
package org.springblade.modules.market.convert;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
import org.springblade.modules.api.vo.MarketPackageTemplateVO;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageTemplateEntity;
import java.util.List;
@Mapper
public interface MarketUserMarketBenefitPackageConvert {
MarketUserMarketBenefitPackageConvert INSTANCE = Mappers.getMapper(MarketUserMarketBenefitPackageConvert.class);
MarketBenefitPackageVO convertMarketBenefitPackageVO(MarketBenefitPackageEntity userMarketBenefitPackageEntity);
MarketPackageTemplateVO convertMarketPackageTemplateToVO(MarketBenefitPackageTemplateEntity entity);
List<MarketPackageTemplateVO> convertMarketPackageTemplateListToVO(List<MarketBenefitPackageTemplateEntity> list);
}

View File

@@ -4,6 +4,14 @@ import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
import org.springblade.modules.api.vo.MarketUserBenefitPointLogVO;
import org.springblade.modules.api.vo.MarketUserCashCouponLogVO;
import org.springblade.modules.api.vo.MarketUserCommissionLogVO;
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
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;
@@ -19,4 +27,14 @@ public interface MarketUserMarketInfoConvert {
MarketDirectInfoApiVO convertMarketUserMarketInfoVO(User entity);
List<MarketDirectInfoApiVO> convertMarketUserMarketInfoVOList(List<User> list);
MarketBenefitPointLogEntity convertBenefitPointDTOToEntity(MarketBenefitPointApiDTO dto);
MarketCashCouponLogEntity convertCashCouponDTOToEntity(MarketCashCouponApiDTO dto);
MarketUserBenefitPointLogVO convertMarketBenefitPointLogVO(MarketBenefitPointLogEntity marketBenefitPointLogEntity);
MarketUserCashCouponLogVO convertMarketCashCouponLogVO(MarketCashCouponLogEntity marketCashCouponLogEntity);
MarketUserCommissionLogVO convertMarketUserCommissionLogVO(MarketUserCommissionLogEntity marketUserCommissionLogEntity);
}

View File

@@ -0,0 +1,45 @@
package org.springblade.modules.market.eums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public enum MarketBusinessModule {
BENEFIT_PACKAGE("福利包", "benefit_package"),
TRANSFER("转账", "transfer"),
LOTTERY("抽奖", "lottery")
;
@Getter
private final String displayName;
@Getter
private final String code;
// ========================
// 根据 code 查找(忽略大小写)
// ========================
public static MarketBusinessModule fromCodeIgnoreCase(String code) {
MarketBusinessModule module = fromCodeIgnoreCaseOrNull(code);
if (module == null) {
throw new IllegalArgumentException("未知的业务模块 code: " + code);
}
return module;
}
public static MarketBusinessModule fromCodeIgnoreCaseOrNull(String code) {
if (code == null || code.trim().isEmpty()) {
return null;
}
String normalized = code.trim().toLowerCase();
for (MarketBusinessModule module : values()) {
if (module.code.equals(normalized)) {
return module;
}
}
return null;
}
}

View File

@@ -0,0 +1,22 @@
package org.springblade.modules.market.excel;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
@Data
@ColumnWidth(16)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class BenefitPackageExcel {
@ExcelProperty("账号")
private String account;
@ExcelProperty("福利包")
private String benefitPackage;
}

View File

@@ -1,21 +1,32 @@
package org.springblade.modules.market.manager;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.sensitive.SensitiveUtil;
import org.springblade.modules.api.request.AcquireBenefitPackageRequest;
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
import org.springblade.modules.market.service.IMarketInfoService;
import org.springblade.modules.api.vo.MarketPackageTemplateVO;
import org.springblade.modules.api.vo.UserAssetsApiVO;
import org.springblade.modules.market.convert.MarketUserMarketBenefitPackageConvert;
import org.springblade.modules.market.eums.MarketBusinessModule;
import org.springblade.modules.market.pojo.dto.MarketBenefitPointApiDTO;
import org.springblade.modules.market.pojo.dto.MarketCashCouponApiDTO;
import org.springblade.modules.market.pojo.entity.*;
import org.springblade.modules.market.service.*;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
@Component
@@ -25,6 +36,13 @@ public class MarketUserManager {
private final IMarketInfoService marketInfoService;
private final IUserService userService;
private final IMarketBenefitPackageTemplateService benefitPackageTemplateService;
private final IMarketBenefitPackageService benefitPackageService;
private final IMarketBenefitPackageLogService benefitPackageLogService;
private final IMarketBenefitPointService marketBenefitPointService;
private final IMarketCashCouponService marketCashCouponService;
private final IMarketUserCommissionService commissionService;
public List<MarketDirectInfoApiVO> findUserPackList() {
Long userId = AuthUtil.getUserId();
@@ -61,14 +79,14 @@ public class MarketUserManager {
marketDirectInfoApiVOList.add(
new MarketDirectInfoApiVO()
.setPhone(SensitiveUtil.process(user.getAccount()))
.setName(desensitizationByPhone(marketInfo.getRealName()))
.setName(desensitizationByName(marketInfo.getRealName()))
.setRegisterTime(user.getCreateTime())
);
}else {
marketDirectInfoApiVOList.add(
new MarketDirectInfoApiVO()
.setPhone(SensitiveUtil.process(user.getAccount()))
.setName(desensitizationByPhone(user.getName()))
.setName(desensitizationByName(user.getName()))
.setRegisterTime(user.getCreateTime())
);
}
@@ -95,14 +113,14 @@ public class MarketUserManager {
MarketDirectInfoApiVO marketDirectInfoApiVO = new MarketDirectInfoApiVO()
.setPhone(SensitiveUtil.process(user.getAccount()))
.setName(desensitizationByPhone(user.getName()))
.setName(desensitizationByName(user.getName()))
.setRegisterTime(user.getCreateTime());
MarketInfoEntity parentMarketInfoEntity = marketInfoService.getById(marketInfoEntity.getPid());
if(parentMarketInfoEntity != null && parentMarketInfoEntity.getVerified() == 1){
marketDirectInfoApiVO.setName(desensitizationByPhone(parentMarketInfoEntity.getRealName()));
marketDirectInfoApiVO.setName(desensitizationByName(parentMarketInfoEntity.getRealName()));
}
@@ -111,7 +129,143 @@ public class MarketUserManager {
}
private String desensitizationByPhone (String name){
@Transactional(rollbackFor = RuntimeException.class)
public boolean acquireBenefitPackage(AcquireBenefitPackageRequest request) {
Long userId = AuthUtil.getUserId();
User user = userService.getById(userId);
Assert.notNull(user, "用户未注册或已注销");
MarketBenefitPackageTemplateEntity template = benefitPackageTemplateService.getById(request.getPackId());
Assert.notNull(template, "请选择正确的福利包");
MarketBenefitPointEntity benefitPoint = marketBenefitPointService.getById(userId);
Assert.isTrue(benefitPoint != null && benefitPoint.getAmount().compareTo(template.getBenefitPointPrice()) >= 0, "福利积分不足");
MarketCashCouponEntity cashCoupon = marketCashCouponService.getById(userId);
Assert.isTrue(cashCoupon != null && cashCoupon.getAmount().compareTo(template.getCashCouponPrice()) >= 0, "现金券不足");
long userPackCount = benefitPackageService.count(
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
.eq(MarketBenefitPackageEntity::getUserId, userId)
.eq(MarketBenefitPackageEntity::getType, 1)
.eq(MarketBenefitPackageEntity::getPackageId, request.getPackId())
.le(MarketBenefitPackageEntity::getStatus, 2)
);
Assert.isTrue(userPackCount < template.getUserLimit(), template.getPackageName() +"已达到最大兑换数量:" + userPackCount + "个");
int exchangedQuantity = template.getExchangedQuantity() + 1;
Assert.isTrue(exchangedQuantity <= template.getMaxLimit(), template.getPackageName() +"已兑换完毕");
String remake = DateUtil.convertFromDate(new Date(), "yyyy-MM-dd HH:mm:ss") + " 兑换" + template.getPackageName();
MarketBenefitPackageEntity userPackageInfo = new MarketBenefitPackageEntity();
userPackageInfo.setStatisticalDate(DateUtil.getToday());
userPackageInfo.setUserId(user.getId());
userPackageInfo.setPhone(Long.valueOf(user.getAccount()));
userPackageInfo.setUserName(user.getName());
userPackageInfo.setPackageId(template.getId());
userPackageInfo.setPackageName(template.getPackageName());
userPackageInfo.setUserBenefit(template.getBenefitPointPrice());
userPackageInfo.setUserCash(template.getCashCouponPrice());
userPackageInfo.setGiveAmount(template.getBenefitValueAmount());
userPackageInfo.setDayTotal(template.getDayLimit());
userPackageInfo.setAmountTotal(template.getBenefitPointAmount());
BigDecimal amountDay = template.getBenefitPointAmount().divide(new BigDecimal(template.getDayLimit()), 2, RoundingMode.HALF_UP);
userPackageInfo.setAmountDay(amountDay);
userPackageInfo.setAmountOut(BigDecimal.ZERO);
userPackageInfo.setOutDay(0);
userPackageInfo.setStatus(2);
userPackageInfo.setActiveTime(new Date());
Integer dayLimit = template.getDayLimit();
if (dayLimit == null || dayLimit <= 0) {
throw new IllegalArgumentException("福利包天数配置错误");
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.getToday());
calendar.add(Calendar.DAY_OF_MONTH, dayLimit);
userPackageInfo.setExpiredDate(calendar.getTime());
userPackageInfo.setType(1);
userPackageInfo.setRemark(remake);
MarketBenefitPackageLogEntity givePackLog = new MarketBenefitPackageLogEntity();
givePackLog.setStatisticalDate(DateUtil.getToday());
givePackLog.setUserId(user.getId());
givePackLog.setUserName(user.getName());
givePackLog.setPhone(Long.valueOf(user.getAccount()));
givePackLog.setType(userPackageInfo.getType());
givePackLog.setPackageName(userPackageInfo.getPackageName());
givePackLog.setPackageDetail(JSONObject.toJSONString(template));
givePackLog.setGiveNumber(1);
givePackLog.setRemark(userPackageInfo.getRemark());
MarketBenefitPointApiDTO deductBenefitPointDto = new MarketBenefitPointApiDTO()
.setUserId(userId)
.setAmount(template.getBenefitPointPrice())
.setFee(BigDecimal.ZERO)
.setSourceType(MarketBusinessModule.BENEFIT_PACKAGE)
.setSourceId(template.getId())
.setSourceDetail(JSONObject.toJSONString(template))
.setRemark(remake);
MarketCashCouponApiDTO deductCashCouponDto = new MarketCashCouponApiDTO()
.setUserId(userId)
.setAmount(template.getCashCouponPrice())
.setSourceType(MarketBusinessModule.BENEFIT_PACKAGE)
.setSourceId(template.getId())
.setSourceDetail(JSONObject.toJSONString(template))
.setRemark(remake);
if (!marketBenefitPointService.deductBenefitPoint(deductBenefitPointDto) ||
!marketCashCouponService.deductCashCoupon(deductCashCouponDto)) {
throw new RuntimeException("扣除积分或现金券失败");
}
// 9. 保存福利包(此时会生成 ID)
if (!benefitPackageService.save(userPackageInfo)) {
throw new RuntimeException("创建福利包失败");
}
// 10. 更新日志中的关联 ID
givePackLog.setUserPackageId(userPackageInfo.getId());
// 11. 保存日志
if (!benefitPackageLogService.save(givePackLog)) {
throw new RuntimeException("记录福利包日志失败");
}
return Boolean.TRUE;
}
public List<MarketPackageTemplateVO> benefitPackageList() {
List<MarketBenefitPackageTemplateEntity> templateList = benefitPackageTemplateService.list(
Wrappers.lambdaQuery(MarketBenefitPackageTemplateEntity.class)
.orderByAsc(MarketBenefitPackageTemplateEntity::getId)
);
return MarketUserMarketBenefitPackageConvert.INSTANCE.convertMarketPackageTemplateListToVO(templateList);
}
private String desensitizationByName (String name){
return name.replaceAll("^(.).*$", "$1" + "*".repeat(name.length() - 1));
}
public UserAssetsApiVO userAssets() {
Long userId = AuthUtil.getUserId();
UserAssetsApiVO result= new UserAssetsApiVO();
result.setBenefitPoints(marketBenefitPointService.getById(userId).getAmount());
result.setCashCouponAmount(marketCashCouponService.getById(userId).getAmount());
result.setWithdrawableBalance(commissionService.getById(userId).getAmount());
return result;
}
}

View File

@@ -0,0 +1,109 @@
package org.springblade.modules.market.manager;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.api.vo.MarketUserBenefitPointLogVO;
import org.springblade.modules.api.vo.MarketUserCashCouponLogVO;
import org.springblade.modules.api.vo.MarketUserCommissionLogVO;
import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
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.market.request.BenefitPointTransferRequest;
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
import org.springblade.modules.market.service.IMarketBenefitPointService;
import org.springblade.modules.market.service.IMarketCashCouponLogService;
import org.springblade.modules.market.service.IMarketUserCommissionLogService;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.math.BigDecimal;
import java.util.Objects;
@Slf4j
@Component
@AllArgsConstructor
public class MarketUserPointManager {
private final IMarketBenefitPointService marketBenefitPointService;
private final IMarketBenefitPointLogService marketBenefitPointLogService;
private final IMarketCashCouponLogService marketCashCouponLogService;
private final IMarketUserCommissionLogService marketUserCommissionLogService;
private final IUserService userService;
public boolean transfer(BenefitPointTransferRequest request) {
User user = userService.getById(request.getId());
Assert.notNull(user , "用户不存在或已注销");
User creditUser = userService.getOne(
Wrappers.lambdaQuery(User.class)
.eq(User::getAccount, request.getAccount())
.eq(User::getUserType, 2)
);
Assert.notNull(creditUser, "划拨用户不存在或已注销");
Assert.isTrue(!creditUser.getId().equals(user.getId()), "不能给自己划拨福利积分");
Assert.isTrue(request.getAmount().compareTo(BigDecimal.ZERO) > 0, "划拨福利积分必须大于0");
MarketBenefitPointEntity benefitPoint = marketBenefitPointService.getById(user.getId());
Assert.isTrue(benefitPoint != null && benefitPoint.getAmount().compareTo(request.getAmount()) >= 0, "福利积分不足");
if(!marketBenefitPointService.transfer(user.getId(), creditUser.getId(), request.getAmount())){
throw new RuntimeException("福利积分转让失败");
}
return Boolean.TRUE;
}
public IPage<MarketUserBenefitPointLogVO> benefitPointLogList(IPage<MarketBenefitPointLogEntity> page, MarketUserBenefitPointLogVO benefitPointLogVO) {
IPage<MarketBenefitPointLogEntity> pageResult = marketBenefitPointLogService.page(
page,
Wrappers.lambdaQuery(MarketBenefitPointLogEntity.class)
.eq(MarketBenefitPointLogEntity::getIsComplete, 1)
.eq(MarketBenefitPointLogEntity::getUserId, AuthUtil.getUserId())
.eq(Objects.nonNull(benefitPointLogVO.getType()), MarketBenefitPointLogEntity::getType, (benefitPointLogVO.getType()))
.eq(Objects.nonNull(benefitPointLogVO.getStatisticalDate()), MarketBenefitPointLogEntity::getStatisticalDate, (benefitPointLogVO.getStatisticalDate()))
.orderByDesc(MarketBenefitPointLogEntity::getCreateTime)
);
return pageResult.convert(MarketUserMarketInfoConvert.INSTANCE::convertMarketBenefitPointLogVO);
}
public IPage<MarketUserCashCouponLogVO> cashCouponLogList(IPage<MarketCashCouponLogEntity> page, MarketUserCashCouponLogVO cashCouponLogVO) {
IPage<MarketCashCouponLogEntity> pageResult = marketCashCouponLogService.page(
page,
Wrappers.lambdaQuery(MarketCashCouponLogEntity.class)
.eq(MarketCashCouponLogEntity::getIsComplete, 1)
.eq(MarketCashCouponLogEntity::getUserId, AuthUtil.getUserId())
.eq(Objects.nonNull(cashCouponLogVO.getType()), MarketCashCouponLogEntity::getType, (cashCouponLogVO.getType()))
.eq(Objects.nonNull(cashCouponLogVO.getStatisticalDate()), MarketCashCouponLogEntity::getStatisticalDate, (cashCouponLogVO.getStatisticalDate()))
.orderByDesc(MarketCashCouponLogEntity::getCreateTime)
);
return pageResult.convert(MarketUserMarketInfoConvert.INSTANCE::convertMarketCashCouponLogVO);
}
public IPage<MarketUserCommissionLogVO> userCommissionLogList(IPage<MarketUserCommissionLogEntity> page, MarketUserCommissionLogVO userCommissionLogVO) {
IPage<MarketUserCommissionLogEntity> pageResult = marketUserCommissionLogService.page(
page,
Wrappers.lambdaQuery(MarketUserCommissionLogEntity.class)
.eq(MarketUserCommissionLogEntity::getIsComplete, 1)
.eq(MarketUserCommissionLogEntity::getUserId, AuthUtil.getUserId())
.eq(Objects.nonNull(userCommissionLogVO.getType()), MarketUserCommissionLogEntity::getType, (userCommissionLogVO.getType()))
.eq(Objects.nonNull(userCommissionLogVO.getStatisticalDate()), MarketUserCommissionLogEntity::getStatisticalDate, (userCommissionLogVO.getStatisticalDate()))
.orderByDesc(MarketUserCommissionLogEntity::getCreateTime)
);
return pageResult.convert(MarketUserMarketInfoConvert.INSTANCE::convertMarketUserCommissionLogVO);
}
}

View File

@@ -0,0 +1,27 @@
package org.springblade.modules.market.mapper;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageLogVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 划拨积分记录 Mapper 接口
*
* @author BladeX
* @since 2026-02-05
*/
public interface MarketBenefitPackageLogMapper extends BaseMapper<MarketBenefitPackageLogEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param userMarketBenefitPackageLog 查询参数
* @return List<UserMarketBenefitPackageLogVO>
*/
List<MarketBenefitPackageLogVO> selectUserMarketBenefitPackageLogPage(IPage page, MarketBenefitPackageLogVO userMarketBenefitPackageLog);
}

View File

@@ -1,9 +1,9 @@
<?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.userPackage.mapper.UserMarketBenefitPackageLogMapper">
<mapper namespace="org.springblade.modules.market.mapper.MarketBenefitPackageLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="userMarketBenefitPackageLogResultMap" type="org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageLogEntity">
<resultMap id="userMarketBenefitPackageLogResultMap" type="org.springblade.modules.market.pojo.entity.MarketBenefitPackageLogEntity">
<result column="id" property="id"/>
<result column="statistical_date" property="statisticalDate"/>
<result column="user_id" property="userId"/>
@@ -30,8 +30,4 @@
</select>
<select id="exportUserMarketBenefitPackageLog" resultType="org.springblade.modules.userPackage.excel.UserMarketBenefitPackageLogExcel">
SELECT * FROM user_market_benefit_package_log ${ew.customSqlSegment}
</select>
</mapper>

View File

@@ -0,0 +1,27 @@
package org.springblade.modules.market.mapper;
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
import org.springblade.modules.market.pojo.vo.MarketBenefitPackageVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* 用户积分包信息表 Mapper 接口
*
* @author BladeX
* @since 2026-02-05
*/
public interface MarketBenefitPackageMapper extends BaseMapper<MarketBenefitPackageEntity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param userMarketBenefitPackage 查询参数
* @return List<UserMarketBenefitPackageVO>
*/
List<MarketBenefitPackageVO> selectUserMarketBenefitPackagePage(IPage page, MarketBenefitPackageVO userMarketBenefitPackage);
}

View File

@@ -1,9 +1,9 @@
<?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.userPackage.mapper.UserMarketBenefitPackageMapper">
<mapper namespace="org.springblade.modules.market.mapper.MarketBenefitPackageMapper">
<!-- 通用查询映射结果 -->
<resultMap id="userMarketBenefitPackageResultMap" type="org.springblade.modules.userPackage.pojo.entity.UserMarketBenefitPackageEntity">
<resultMap id="userMarketBenefitPackageResultMap" type="org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity">
<result column="id" property="id"/>
<result column="statistical_date" property="statisticalDate"/>
<result column="user_id" property="userId"/>
@@ -20,9 +20,7 @@
<result column="amount_day" property="amountDay"/>
<result column="amount_out" property="amountOut"/>
<result column="out_day" property="outDay"/>
<result column="is_complete" property="isComplete"/>
<result column="expired_date" property="expiredDate"/>
<result column="is_expired" property="isExpired"/>
<result column="remark" property="remark"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
@@ -39,8 +37,5 @@
</select>
<select id="exportUserMarketBenefitPackage" resultType="org.springblade.modules.userPackage.excel.UserMarketBenefitPackageExcel">
SELECT * FROM user_market_benefit_package ${ew.customSqlSegment}
</select>
</mapper>

Some files were not shown because too many files have changed in this diff Show More