Compare commits
204 Commits
c4bd46747a
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
| c9683a324a | |||
| ed17be846c | |||
|
|
8d4dfdc8be | ||
|
|
fa2bac7f31 | ||
|
|
eb6f106f4d | ||
| 0464ff6fe8 | |||
| 57e2771d5d | |||
| fe5dc8151e | |||
| 0129ee0c01 | |||
| f4b9559233 | |||
| 8a99c769b3 | |||
| 05993583ec | |||
| db8406a2d8 | |||
| 6af9ee01ea | |||
| efdad14a78 | |||
| 579d2d65f7 | |||
| 9548a00289 | |||
| eddfcefa1d | |||
| 49b6afc4e9 | |||
| 0aa61bc6c0 | |||
| 47da3a6f86 | |||
| 31fe71dd17 | |||
| 40d8d00038 | |||
| 88e3317b68 | |||
| 0470a27418 | |||
| dc83cbece7 | |||
| 233bb596a9 | |||
| c612d69699 | |||
| f99715ecfe | |||
| 1d396e92b7 | |||
|
|
f11d80f8f0 | ||
|
|
732b3c31be | ||
|
|
5713660aaf | ||
| 6b052f0c10 | |||
|
|
4f02e78db1 | ||
|
|
16fcb1c714 | ||
| a929e49db7 | |||
| 40e1a3070f | |||
|
|
bc6f3d47d8 | ||
|
|
b15c8e82d0 | ||
|
|
f3e626050b | ||
|
|
fbad45da65 | ||
|
|
ad0beed1c5 | ||
| c07e7ec5fd | |||
| 53ab15a5ca | |||
|
|
afca9b2998 | ||
| 66f6967b09 | |||
| ea4d7a450c | |||
| dbccf57ce9 | |||
| cf517c2b39 | |||
| 924ee879ce | |||
| 967da9e95e | |||
|
|
c27371c640 | ||
| 35354ae4b4 | |||
|
|
b2665809b9 | ||
|
|
774b4eb2d8 | ||
| 37cf579539 | |||
| 1c18d8b082 | |||
|
|
de77da7779 | ||
|
|
34cf179254 | ||
|
|
b355f0364c | ||
| 1c593d1dfb | |||
| 65dfe51f96 | |||
| a57e208e7a | |||
| 6a8a8fc519 | |||
| 0ad70b63e9 | |||
| 2795deedcb | |||
|
|
1a8e0d07bb | ||
|
|
8bb7fa49d5 | ||
|
|
e2496d4bfd | ||
| 539e28762c | |||
| 7e1a58eb66 | |||
|
|
2cf3aa552a | ||
|
|
e8573b90db | ||
| e04672fbeb | |||
| 2d89f30925 | |||
|
|
a9824fe6c3 | ||
|
|
a51369ad85 | ||
|
|
fca67baccb | ||
| 3712034b1d | |||
| 92ee5438d8 | |||
| 1fb4082744 | |||
| 70993a163b | |||
|
|
b8146181c7 | ||
| 3c5f3c4c5e | |||
| e9c5b2a95b | |||
| 1ca7528c45 | |||
| 8f50f02b92 | |||
|
|
75e737ada8 | ||
| 59782c4ba7 | |||
|
|
16533f3e44 | ||
|
|
f98e178a20 | ||
|
|
8b0521a69d | ||
|
|
f4b994e6d9 | ||
| ee02df1a8c | |||
| f9d7ae75e9 | |||
|
|
f955917cc5 | ||
| f528e4f07c | |||
| 8cbabac829 | |||
|
|
4146d4cf03 | ||
|
|
041259e92c | ||
| b769ff9f71 | |||
| db4a1c587b | |||
|
|
a49ed00e37 | ||
| b4d8384150 | |||
| 6e41399631 | |||
| 37d92b9dea | |||
| 6d85686270 | |||
| 0656cabe4a | |||
| d3e09b1cb9 | |||
|
|
72a8a318cf | ||
|
|
943aa3842a | ||
|
|
25da381c4e | ||
|
|
0e06403528 | ||
| 88a0a5616b | |||
| 9a086b86cd | |||
| f5746394fa | |||
|
|
d4e2bed039 | ||
| 16a9bcfbd8 | |||
| 9674374fad | |||
|
|
8be8964eff | ||
|
|
2af46a38b1 | ||
|
|
e2e9b18503 | ||
| e1105dae89 | |||
|
|
f5a9d171e0 | ||
| a3752fe7b9 | |||
|
|
5ef97c4da7 | ||
|
|
d82d91aec5 | ||
|
|
a123ea05e8 | ||
|
|
7a429deb99 | ||
|
|
8530f424c9 | ||
|
|
667dc58dc1 | ||
|
|
884075d3f2 | ||
|
|
5857fe4171 | ||
|
|
9436ea8942 | ||
|
|
bd58fd716a | ||
|
|
0a2d1a1f32 | ||
| 7fc365ce4c | |||
| 54a61ec5d5 | |||
| c3e3139100 | |||
| 2536dc9528 | |||
| 81db304e16 | |||
|
|
4582db201a | ||
|
|
90928754d9 | ||
|
|
8ba9609276 | ||
| 2bccdd7177 | |||
| eddfc26a45 | |||
|
|
b2839ed1d5 | ||
|
|
a1ebf5b065 | ||
|
|
df88450bab | ||
| a8693e77cc | |||
| 0b6e90acb7 | |||
| c3bbf9073a | |||
|
|
64ad185fc4 | ||
| 28f13a5db3 | |||
| a6782b4fa1 | |||
|
|
5344c76cac | ||
| b92b1eaf2c | |||
|
|
7f941fab86 | ||
| bb7ddf9779 | |||
| 64f73ae06b | |||
| 213da81bc8 | |||
|
|
3cf4edd7a9 | ||
|
|
e4c72ce901 | ||
| 7bbb0c1026 | |||
| 5145ba52cb | |||
| 3c7331ffa0 | |||
| 5bc82c1f5c | |||
| 094b8774e3 | |||
| cd4d535d74 | |||
| add23214ac | |||
| 3e4256ada0 | |||
|
|
b31ed69e15 | ||
|
|
85a1032c55 | ||
|
|
3bf191ed3f | ||
| 6ad8d9730e | |||
| f03c5a9cf8 | |||
| 86ee8461b5 | |||
| 40b8931ee2 | |||
| 63fed8b70b | |||
| bd6dcedc0f | |||
|
|
08ca5c48f0 | ||
| 2b6da03ab6 | |||
|
|
9d9054a75d | ||
| e8b8ce0e9a | |||
| 04437369c1 | |||
| 3c2f46b008 | |||
|
|
f392e43ae7 | ||
| deefdeba9d | |||
| 87c7c8b0d2 | |||
|
|
93935285cf | ||
|
|
3ead9b1806 | ||
|
|
d25f9e29aa | ||
|
|
68546551e0 | ||
|
|
6d6654fa93 | ||
|
|
afe7b1fa6b | ||
|
|
d5d108db26 | ||
| d29ca3f02a | |||
| 233ca2115b | |||
| cc812cf1d3 | |||
| 4d18d698df | |||
| ddf504fa25 | |||
| efce3f5efb | |||
| d3211af9ae |
@@ -1,22 +1,24 @@
|
||||
CREATE TABLE user_order
|
||||
(
|
||||
id int8 DEFAULT 0 NOT NULL PRIMARY KEY,
|
||||
user_id int8 DEFAULT 0 NOT NULL,
|
||||
user_phone int8,
|
||||
user_name varchar(128),
|
||||
order_type int4 DEFAULT 0 NOT NULL,
|
||||
order_id int8 DEFAULT 0 NOT NULL,
|
||||
title VARCHAR(256) DEFAULT '' NOT NULL,
|
||||
images VARCHAR(512) NULL,
|
||||
quantity int4 NULL,
|
||||
description VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
consignee_phone varchar(128) NOT NULL,
|
||||
consignee varchar(128) NOT NULL,
|
||||
order_type varchar(128) NOT NULL,
|
||||
item_code varchar(128) NOT NULL,
|
||||
item_name varchar(128) NOT NULL,
|
||||
image_url VARCHAR(512) NULL,
|
||||
quantity int4 DEFAULT 1 NOT NULL,
|
||||
delivery_address text NULL,
|
||||
express_company VARCHAR(100) NULL,
|
||||
express_no VARCHAR(100) NULL,
|
||||
order_status int4 DEFAULT 0 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
payment_type int4 DEFAULT 0 NOT NULL,
|
||||
payment_time TIMESTAMP NULL,
|
||||
payment_status int4 DEFAULT 0 NOT NULL,
|
||||
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
payment_status int4 DEFAULT 1 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
@@ -29,21 +31,23 @@ CREATE TABLE user_order
|
||||
COMMENT ON TABLE user_order IS '用户订单';
|
||||
COMMENT ON COLUMN user_order.id IS '主键';
|
||||
COMMENT ON COLUMN user_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_order.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_order.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
|
||||
COMMENT ON COLUMN user_order.consignee IS '收件人';
|
||||
COMMENT ON COLUMN user_order.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN user_order.order_id IS '订单id';
|
||||
COMMENT ON COLUMN user_order.title IS '订单名称';
|
||||
COMMENT ON COLUMN user_order.images IS '图片';
|
||||
COMMENT ON COLUMN user_order.item_code IS '商品编号';
|
||||
COMMENT ON COLUMN user_order.item_name IS '商品名称';
|
||||
COMMENT ON COLUMN user_order.image_url IS '图片';
|
||||
COMMENT ON COLUMN user_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_order.description IS '订单描述';
|
||||
COMMENT ON COLUMN user_order.order_status IS '订单状态';
|
||||
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
|
||||
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
|
||||
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
|
||||
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
|
||||
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
|
||||
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
|
||||
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
|
||||
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
|
||||
COMMENT ON COLUMN user_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_order.create_time IS '创建时间';
|
||||
@@ -51,7 +55,9 @@ COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
|
||||
CREATE INDEX user_order_index ON user_order (user_id, order_type);
|
||||
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
|
||||
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);
|
||||
|
||||
alter table user_order
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
626
doc/sql/executed/20260205_increase.sql
Normal file
626
doc/sql/executed/20260205_increase.sql
Normal file
@@ -0,0 +1,626 @@
|
||||
------------------user_market_info common_user_address common_regions_info mall_product mall_category-------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS user_market_info;
|
||||
create table user_market_info
|
||||
(
|
||||
id int8 not null primary key, --user_id
|
||||
pid int8,
|
||||
has_synchronized int4 default 0, --是否同步
|
||||
vendor int4 default 0, -- 是否成为服务商 0-否 1-是
|
||||
e_signed int4 default 0, -- 是否已经签署电子合同 0-否 1-是
|
||||
e_signed_url text, -- 电子合同地址
|
||||
verified int4 default 0, -- 是否实名用户 0-否 1-是
|
||||
verified_date timestamp(6), -- 实名时间
|
||||
real_name varchar(128), -- 实名姓名
|
||||
id_card varchar(128), -- 实名身份证
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_user_market_pid ON user_market_info (pid) WHERE status = 1;
|
||||
|
||||
|
||||
comment on table user_market_info is '用户拓展信息表';
|
||||
comment on column user_market_info.id is '主键';
|
||||
comment on column user_market_info.pid is '邀请人';
|
||||
comment on column user_market_info.has_synchronized is '是否同步族谱 0-否 1-是';
|
||||
comment on column user_market_info.vendor is '是否成为服务商 0-否 1-是';
|
||||
comment on column user_market_info.e_signed is '是否签署法大大协议 0-否 1-是';
|
||||
comment on column user_market_info.e_signed_url is '电子合同地址';
|
||||
comment on column user_market_info.verified is '是否实名用户 0-否 1-是';
|
||||
comment on column user_market_info.verified_date is '实名时间';
|
||||
comment on column user_market_info.real_name is '实名姓名';
|
||||
comment on column user_market_info.id_card is '实名身份证';
|
||||
comment on column user_market_info.create_user is '创建人';
|
||||
comment on column user_market_info.create_dept is '创建部门';
|
||||
comment on column user_market_info.create_time is '创建时间';
|
||||
comment on column user_market_info.update_user is '修改人';
|
||||
comment on column user_market_info.update_time is '修改时间';
|
||||
comment on column user_market_info.status is '状态';
|
||||
comment on column user_market_info.is_deleted is '是否已删除';
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976193', '1123598815738675201', 'marketInfo', '用户拓展信息表', 'menu', '/market/marketInfo',
|
||||
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 ('2019319816467976194', '2019319816467976193', 'marketInfo_add', '新增', 'add', '/market/marketInfo/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 ('2019319816467976195', '2019319816467976193', 'marketInfo_edit', '修改', 'edit', '/market/marketInfo/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 ('2019319816467976196', '2019319816467976193', 'marketInfo_delete', '删除', 'delete',
|
||||
'/api/blade-marketinfo/marketInfo/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 ('2019319816467976197', '2019319816467976193', 'marketInfo_view', '查看', 'view', '/market/marketInfo/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS common_user_address;
|
||||
CREATE TABLE common_user_address
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
regions_id int8 NOT NULL,
|
||||
province VARCHAR(200) NULL,
|
||||
city VARCHAR(200) NULL,
|
||||
district VARCHAR(200) NULL,
|
||||
street VARCHAR(200) NULL,
|
||||
detail VARCHAR(500) NULL,
|
||||
consignee VARCHAR(200) NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
is_default int4 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_user_address IS '用户地址表';
|
||||
COMMENT ON COLUMN common_user_address.id IS '主键';
|
||||
COMMENT ON COLUMN common_user_address.user_id IS '用户id';
|
||||
COMMENT ON COLUMN common_user_address.regions_id IS '地区信息id';
|
||||
COMMENT ON COLUMN common_user_address.province IS '省份';
|
||||
COMMENT ON COLUMN common_user_address.city IS '城市';
|
||||
COMMENT ON COLUMN common_user_address.district IS '区县';
|
||||
COMMENT ON COLUMN common_user_address.street IS '街道';
|
||||
COMMENT ON COLUMN common_user_address.detail IS '详细地址';
|
||||
COMMENT ON COLUMN common_user_address.consignee IS '收货人';
|
||||
COMMENT ON COLUMN common_user_address.phone IS '联系电话';
|
||||
COMMENT ON COLUMN common_user_address.is_default IS '是否默认地址(0=否,1=是)';
|
||||
COMMENT ON COLUMN common_user_address.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_user_address.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_user_address.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_user_address.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_user_address.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_user_address.status IS '状态';
|
||||
COMMENT ON COLUMN common_user_address.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_user_address_user_id ON common_user_address (user_id);
|
||||
CREATE INDEX idx_user_address_regions_id ON common_user_address (regions_id);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS common_regions_info;
|
||||
CREATE TABLE common_regions_info
|
||||
(
|
||||
id int4 PRIMARY KEY,
|
||||
name VARCHAR(50) NULL,
|
||||
level int4 NULL,
|
||||
pid int4 DEFAULT 0 NULL,
|
||||
coordinates point,
|
||||
region_code VARCHAR(128) NULL,
|
||||
full_name VARCHAR(500) NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_regions_info IS '地区详情表';
|
||||
COMMENT ON COLUMN common_regions_info.id IS '主键';
|
||||
COMMENT ON COLUMN common_regions_info.name IS '名称';
|
||||
COMMENT ON COLUMN common_regions_info.level IS '层级';
|
||||
COMMENT ON COLUMN common_regions_info.pid IS '父主键';
|
||||
COMMENT ON COLUMN common_regions_info.coordinates IS '坐标';
|
||||
COMMENT ON COLUMN common_regions_info.region_code IS '地区编码';
|
||||
COMMENT ON COLUMN common_regions_info.full_name IS '全称';
|
||||
COMMENT ON COLUMN common_regions_info.is_deleted IS '是否删除';
|
||||
COMMENT ON COLUMN common_regions_info.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_regions_info.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_regions_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_regions_info.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_regions_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_regions_info.status IS '状态';
|
||||
|
||||
CREATE INDEX idx_regions_pid ON common_regions_info (pid);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS mall_product;
|
||||
CREATE TABLE mall_product
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
serial_number VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
product_name VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
main_image_urls text[] DEFAULT '{}' NOT NULL,
|
||||
detail_image_urls text[] DEFAULT '{}' NULL,
|
||||
thumb_image_url text NULL,
|
||||
specs JSONB DEFAULT '[]',
|
||||
unit VARCHAR(12),
|
||||
category_id int8 DEFAULT 0 NOT NULL,
|
||||
category_path int8[] DEFAULT '{}' NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
retail_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
freight DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
sales int4 DEFAULT 0 NOT NULL,
|
||||
stock int4 DEFAULT 0 NOT NULL,
|
||||
tags JSONB DEFAULT '[]' NOT NULL,
|
||||
status int4 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_product IS '商城商品';
|
||||
COMMENT ON COLUMN mall_product.id IS '主键';
|
||||
COMMENT ON COLUMN mall_product.serial_number IS '商品编码';
|
||||
COMMENT ON COLUMN mall_product.product_name IS '商品名称';
|
||||
COMMENT ON COLUMN mall_product.main_image_urls IS '主图';
|
||||
COMMENT ON COLUMN mall_product.detail_image_urls IS '详情图';
|
||||
COMMENT ON COLUMN mall_product.thumb_image_url IS '缩略图';
|
||||
COMMENT ON COLUMN mall_product.specs IS '规格详情,JSONB数组 [{"attr":"颜色","value":"红"}]';
|
||||
COMMENT ON COLUMN mall_product.unit IS '单位';
|
||||
COMMENT ON COLUMN mall_product.category_id IS '分类';
|
||||
COMMENT ON COLUMN mall_product.category_path IS '分类路径ID数组,如 [1,5,23]';
|
||||
COMMENT ON COLUMN mall_product.original_price IS '原价';
|
||||
COMMENT ON COLUMN mall_product.retail_price IS '销售价';
|
||||
COMMENT ON COLUMN mall_product.freight IS '运费';
|
||||
COMMENT ON COLUMN mall_product.sales IS '销量';
|
||||
COMMENT ON COLUMN mall_product.stock IS '库存';
|
||||
COMMENT ON COLUMN mall_product.tags IS '标签列表,JSONB数组格式,如 ["热销","包邮"]';
|
||||
COMMENT ON COLUMN mall_product.status IS '状态(0=下架,1=上架)';
|
||||
COMMENT ON COLUMN mall_product.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_product.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN mall_product.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_product.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_product.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_product.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_product_category ON mall_product (category_id);
|
||||
CREATE INDEX idx_product_status ON mall_product (status) WHERE is_deleted = 0;
|
||||
CREATE INDEX idx_product_tags ON mall_product USING GIN (tags);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061775732737', '2016445919294554113', 'mallProduct', '商城商品', 'menu', '/mall/mallProduct', 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 ('2019341061775732738', '2019341061775732737', 'mallProduct_add', '新增', 'add', '/mall/mallProduct/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 ('2019341061775732739', '2019341061775732737', 'mallProduct_edit', '修改', 'edit', '/mall/mallProduct/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 ('2019341061775732740', '2019341061775732737', 'mallProduct_delete', '删除', 'delete',
|
||||
'/api/blade-mallproduct/mallProduct/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 ('2019341061775732741', '2019341061775732737', 'mallProduct_view', '查看', 'view', '/mall/mallProduct/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS mall_category;
|
||||
CREATE TABLE mall_category
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
category_name VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
image_url VARCHAR(200) NULL,
|
||||
pid int8 NULL,
|
||||
level int4 DEFAULT 0 NOT NULL,
|
||||
sort INT4 DEFAULT 0 NOT NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 DEFAULT 1 NOT NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE mall_category IS '商品分类(支持三级树形结构)';
|
||||
COMMENT ON COLUMN mall_category.id IS '主键';
|
||||
COMMENT ON COLUMN mall_category.category_name IS '分类名称';
|
||||
COMMENT ON COLUMN mall_category.image_url IS '图片';
|
||||
COMMENT ON COLUMN mall_category.pid IS '父分类ID,NULL 表示顶级分类';
|
||||
COMMENT ON COLUMN mall_category.level IS '层级:1-一级分类,2-二级分类,3-三级分类';
|
||||
COMMENT ON COLUMN mall_category.sort IS '排序值,越小越靠前';
|
||||
COMMENT ON COLUMN mall_category.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_category.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_category.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_category.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_category.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_category.status IS '状态:1-启用,2-禁用';
|
||||
COMMENT ON COLUMN mall_category.create_dept IS '创建部门';
|
||||
|
||||
CREATE INDEX idx_category_pid ON mall_category (pid);
|
||||
CREATE INDEX idx_category_sort ON mall_category (sort);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061003980801', '2016445919294554113', 'mallCategory', '商品分类', 'menu', '/mall/mallCategory', 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 ('2019341061003980802', '2019341061003980801', 'mallCategory_add', '新增', 'add', '/mall/mallCategory/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 ('2019341061003980803', '2019341061003980801', 'mallCategory_edit', '修改', 'edit', '/mall/mallCategory/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 ('2019341061003980804', '2019341061003980801', 'mallCategory_delete', '删除', 'delete',
|
||||
'/api/blade-mallcategory/mallCategory/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 ('2019341061003980805', '2019341061003980801', 'mallCategory_view', '查看', 'view', '/mall/mallCategory/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS user_order;
|
||||
CREATE TABLE user_order
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
consignee_phone varchar(128) NOT NULL,
|
||||
consignee varchar(128) NOT NULL,
|
||||
order_type varchar(128) NOT NULL,
|
||||
item_code varchar(128) NOT NULL,
|
||||
item_name varchar(128) NOT NULL,
|
||||
image_url VARCHAR(512) NULL,
|
||||
quantity int4 DEFAULT 1 NOT NULL,
|
||||
delivery_address text NULL,
|
||||
express_company VARCHAR(100) NULL,
|
||||
express_no VARCHAR(100) NULL,
|
||||
order_status int4 DEFAULT 0 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
payment_type int4 DEFAULT 0 NOT NULL,
|
||||
payment_time TIMESTAMP NULL,
|
||||
payment_status int4 DEFAULT 0 NOT NULL,
|
||||
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_order IS '用户订单';
|
||||
COMMENT ON COLUMN user_order.id IS '主键';
|
||||
COMMENT ON COLUMN user_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
|
||||
COMMENT ON COLUMN user_order.consignee IS '收件人';
|
||||
COMMENT ON COLUMN user_order.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN user_order.item_code IS '商品编号';
|
||||
COMMENT ON COLUMN user_order.item_name IS '商品名称';
|
||||
COMMENT ON COLUMN user_order.image_url IS '图片';
|
||||
COMMENT ON COLUMN user_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
|
||||
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
|
||||
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
|
||||
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
|
||||
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
|
||||
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
|
||||
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
|
||||
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
|
||||
COMMENT ON COLUMN user_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
|
||||
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
|
||||
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781314', '1123598815738675201', 'order', '用户订单', 'menu', '/common/order', 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 ('2019446499472781315', '2019446499472781314', 'order_add', '新增', 'add', '/common/order/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 ('2019446499472781316', '2019446499472781314', 'order_edit', '修改', 'edit', '/common/order/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 ('2019446499472781317', '2019446499472781314', 'order_delete', '删除', 'delete', '/api/user-order/order/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 ('2019446499472781318', '2019446499472781314', 'order_view', '查看', 'view', '/common/order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS user_market_benefit_package_template;
|
||||
CREATE TABLE user_market_benefit_package_template --积分包信息模板表
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
package_name VARCHAR(128) NULL,
|
||||
user_limit int4 default 0, -- 最大购买数量
|
||||
max_limit int4 default 0, -- 全网最大兑换数量
|
||||
day_limit int4 default 0, -- 产出总天数
|
||||
benefit_point_amount decimal(14, 2) default 0, -- 总产出福利积分
|
||||
benefit_value_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
||||
benefit_point_price decimal(14, 2) default 0, --兑换包需要的福利积分
|
||||
cash_coupon_price decimal(14, 2) default 0, --兑换包需要的现金券
|
||||
exchanged_quantity int4 default 0, -- 已兑换数量
|
||||
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_market_benefit_package_template IS '积分包信息表';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.user_limit IS '最大购买数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.day_limit IS '产出总天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_point_amount IS '总产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_value_amount IS '购买赠与福利值';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_point_price IS '兑换包需要的福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.cash_coupon_price IS '兑换包需要的现金券';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.max_limit IS '全网最大兑换数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.exchanged_quantity IS '已兑换数量';
|
||||
comment on column user_market_benefit_package_template.create_user is '创建人';
|
||||
comment on column user_market_benefit_package_template.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package_template.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package_template.update_user is '修改人';
|
||||
comment on column user_market_benefit_package_template.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package_template.status is '状态';
|
||||
comment on column user_market_benefit_package_template.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package_template
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440113307066370, '100福利包', 10, 2000000, 360, 300.00, 100.00, 100.00, 20.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:56:57.000000', 1123598821738675201, '2026-02-05 23:57:40.162000', 1, 0);
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440172115402754, '1000福利包', 4, 1000000, 360, 3000.00, 1000.00, 1000.00, 300.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:57:11.072000', 1123598821738675201, '2026-02-05 23:57:11.072000', 1, 0);
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440222086340610, '5000福利包', 2, 50000, 360, 15000.00, 5000.00, 5000.00, 1500.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:57:23.001000', 1123598821738675201, '2026-02-05 23:57:23.001000', 1, 0);
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440263022747650, '10000福利包', 1, 20000, 360, 40000.00, 10000.00, 10000.00, 4000.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:57:32.752000', 1123598821738675201, '2026-02-05 23:57:32.752000', 1, 0);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS user_market_benefit_package;
|
||||
create table user_market_benefit_package --用户福利积分包表
|
||||
(
|
||||
id int8 not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id int8,
|
||||
phone int8,
|
||||
user_name varchar(128),
|
||||
package_id int8,
|
||||
package_name varchar(128),
|
||||
type int4 default 1, -- 1-积分兑换 2-后台划拨
|
||||
user_benefit decimal(14, 2) default 0, --兑换包需要的福利积分
|
||||
user_cash decimal(14, 2) default 0, --兑换包需要的现金券
|
||||
give_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
||||
day_total int4 default 0, -- 产出总天数
|
||||
amount_total decimal(14, 2) default 0, -- 总产出福利积分
|
||||
amount_day decimal(14, 2) default 0, -- 每日产出福利积分 = 总产出 / 总产出
|
||||
amount_out decimal(16, 4) default 0, -- 已产出福利积分
|
||||
out_day int4 default 0, -- 已产出天数
|
||||
active_time timestamp(6), -- 激活时间
|
||||
expired_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, -- 1-未激活 2-已激活 3-已完成 4-已过期,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
|
||||
create index upi_status_index
|
||||
on user_market_benefit_package (is_deleted, status);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package IS '用户积分包信息表';
|
||||
COMMENT ON COLUMN user_market_benefit_package.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_market_benefit_package.phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_name IS '用户名';
|
||||
COMMENT ON COLUMN user_market_benefit_package.package_id IS '积分包id';
|
||||
COMMENT ON COLUMN user_market_benefit_package.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package.type IS '1-积分兑换 2-后台划拨';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_benefit IS '兑换包需要的福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_cash IS '兑换包需要的现金券';
|
||||
COMMENT ON COLUMN user_market_benefit_package.give_amount IS '购买赠与福利值';
|
||||
COMMENT ON COLUMN user_market_benefit_package.day_total IS '产出总天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_total IS '总产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_day IS '每日产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_out IS '已产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.out_day IS '已产出天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package.expired_date IS '过期时间';
|
||||
COMMENT ON COLUMN user_market_benefit_package.active_time IS '激活时间';
|
||||
COMMENT ON COLUMN user_market_benefit_package.remark IS '备注';
|
||||
comment on column user_market_benefit_package.create_user is '创建人';
|
||||
comment on column user_market_benefit_package.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package.update_user is '修改人';
|
||||
comment on column user_market_benefit_package.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package.status is '状态 1-未激活 2-已激活 3-已完成 4-已过期';
|
||||
comment on column user_market_benefit_package.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS user_market_benefit_package_log;
|
||||
create table user_market_benefit_package_log
|
||||
(
|
||||
id int8 not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id int8,
|
||||
phone int8,
|
||||
user_name varchar(128),
|
||||
type int4 default 1, -- 1-积分兑换 2-后台划拨
|
||||
user_package_id int8,
|
||||
package_name varchar(128),
|
||||
package_detail text,
|
||||
give_number int4 default 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 gpl_date_index
|
||||
on user_market_benefit_package_log (is_deleted, statistical_date, user_id);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package_log IS '兑换福利包记录';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.statistical_date IS '统计日期';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_name IS '用户名';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.type IS '1-积分兑换 2-后台划拨';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_package_id IS '积分包id';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.package_detail IS '积分包信息快照';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.give_number IS '赠送数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.remark IS '备注';
|
||||
comment on column user_market_benefit_package_log.create_user is '创建人';
|
||||
comment on column user_market_benefit_package_log.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package_log.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package_log.update_user is '修改人';
|
||||
comment on column user_market_benefit_package_log.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package_log.status is '状态';
|
||||
comment on column user_market_benefit_package_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package_log
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2016446332399943682, 0, 'userPackInfo', '福利包管理', 'menu', '/userPackInfo', 'iconfont iconicon_principal', 13, 1, -1, 1, '', '', 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878402', '2016446332399943682', 'userMarketBenefitPackage', '用户福利包信息', 'menu', '/userPackage/userMarketBenefitPackage', NULL, 2, 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 ('2019438517579878403', '2019438517579878402', 'userMarketBenefitPackage_add', '新增', 'add', '/userPackage/userMarketBenefitPackage/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 ('2019438517579878404', '2019438517579878402', 'userMarketBenefitPackage_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackage/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 ('2019438517579878405', '2019438517579878402', 'userMarketBenefitPackage_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackage/userMarketBenefitPackage/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 ('2019438517579878406', '2019438517579878402', 'userMarketBenefitPackage_view', '查看', 'view', '/userPackage/userMarketBenefitPackage/view', 'file-text', 4, 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 ('2019438517974142978', '2016446332399943682', 'userMarketBenefitPackageLog', '划拨福利包记录', 'menu', '/userPackage/userMarketBenefitPackageLog', NULL, 3, 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 ('2019438517974142979', '2019438517974142978', 'userMarketBenefitPackageLog_add', '新增', 'add', '/userPackage/userMarketBenefitPackageLog/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 ('2019438517974142980', '2019438517974142978', 'userMarketBenefitPackageLog_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageLog/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 ('2019438517974142981', '2019438517974142978', 'userMarketBenefitPackageLog_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagelog/userMarketBenefitPackageLog/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 ('2019438517974142982', '2019438517974142978', 'userMarketBenefitPackageLog_view', '查看', 'view', '/userPackage/userMarketBenefitPackageLog/view', 'file-text', 4, 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 ('2019438517080756225', '2016446332399943682', 'userMarketBenefitPackageTemplate', '福利包信息', 'menu', '/userPackage/userMarketBenefitPackageTemplate', 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 ('2019438517080756226', '2019438517080756225', 'userMarketBenefitPackageTemplate_add', '新增', 'add', '/userPackage/userMarketBenefitPackageTemplate/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 ('2019438517080756227', '2019438517080756225', 'userMarketBenefitPackageTemplate_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageTemplate/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 ('2019438517080756228', '2019438517080756225', 'userMarketBenefitPackageTemplate_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagetemplate/userMarketBenefitPackageTemplate/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 ('2019438517080756229', '2019438517080756225', 'userMarketBenefitPackageTemplate_view', '查看', 'view', '/userPackage/userMarketBenefitPackageTemplate/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256532300197889, 0, 'app_order_status', '-1', 'app订单状态', 17, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256701003493378, 2017256532300197889, 'app_order_status', '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 (2017256735887519745, 2017256532300197889, 'app_order_status', '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 (2017256766271057921, 2017256532300197889, 'app_order_status', '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 (2017256798575587330, 2017256532300197889, 'app_order_status', '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 (2017256831240826882, 2017256532300197889, 'app_order_status', '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 (2017277351755730945, 0, 'app_yes_no', '-1', 'app是否状态', 18, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017277404973060097, 2017277351755730945, 'app_yes_no', '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 (2017277445628448770, 2017277351755730945, 'app_yes_no', '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 (2017279052097212417, 0, 'app_pay_status', '-1', 'app支付状态', 19, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279219479302146, 2017279052097212417, 'app_pay_status', '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 (2017279260155662338, 2017279052097212417, 'app_pay_status', '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 (2017279292049149953, 2017279052097212417, 'app_pay_status', '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 (2017256666383708162, 2017256532300197889, 'app_order_status', '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 (2017256633735245825, 2017256532300197889, 'app_order_status', '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 (2017279326488580097, 2017279052097212417, 'app_pay_status', '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 (2017279356754677762, 2017279052097212417, 'app_pay_status', '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 (2017280506669256705, 0, 'app_order_model', '-1', 'app订单类型', 20, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017280559299383297, 2017280506669256705, 'app_order_model', '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 (2017448732011200513, 0, 'app_pay_type', '-1', 'app支付类型', 21, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017448799661129730, 2017448732011200513, 'app_pay_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 (2017448849464295426, 2017448732011200513, 'app_pay_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 (2017448927499321345, 2017448732011200513, 'app_pay_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 (2017256598469537794, 2017256532300197889, 'app_order_status', '0', '待支付', 0, '', 0, 1, 1);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017478580159041538, 0, 'app_point_spending_type', '-1', 'app积分消费类型', 22, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017478672572141569, 2017478580159041538, 'app_point_spending_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 (2017478708412469249, 2017478580159041538, 'app_point_spending_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 (2017517140190855170, 0, 'app_package_type', '-1', 'app福利包类型', 23, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017517209350733826, 2017517140190855170, 'app_package_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 (2017517264824598530, 2017517140190855170, 'app_package_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 (2018600540205121537, 0, 'app_banner_type', '-1', 'app轮播图类型', 24, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018600645536677890, 2018600540205121537, 'app_banner_type', '1', '主banner', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018600683209916417, 2018600540205121537, 'app_banner_type', '2', '商城banner', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018607816655708161, 0, 'app_user_notice', '-1', 'app用户通知类型', 25, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018607875027836929, 2018607816655708161, 'app_user_notice', '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 (2019414847658545153, 0, 'app_product_status', '-1', 'app上下架商品状态', 26, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019414970329354241, 2019414847658545153, 'app_product_status', '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 (2019415024934998018, 2019414847658545153, 'app_product_status', '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 (2019491173300129793, 0, 'app_package_status', '-1', '福利包状态', 27, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019491225556963329, 2019491173300129793, 'app_package_status', '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 (2019491256389292033, 2019491173300129793, 'app_package_status', '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 (2019491292992983042, 2019491173300129793, 'app_package_status', '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 (2019491330833993730, 2019491173300129793, 'app_package_status', '4', '已过期', 4, '', 0, 1, 0);
|
||||
1025
doc/sql/executed/20260209_increase.sql
Normal file
1025
doc/sql/executed/20260209_increase.sql
Normal file
File diff suppressed because it is too large
Load Diff
39
doc/sql/executed/20260224_increase.sql
Normal file
39
doc/sql/executed/20260224_increase.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
DROP TABLE IF EXISTS user_sms_log;
|
||||
CREATE TABLE user_sms_log
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键
|
||||
user_id int8 DEFAULT 0 NOT NULL, -- 用户id
|
||||
sms_type int4 NOT NULL DEFAULT 0, -- 短信类型 0-找回密码
|
||||
content TEXT, -- 存储短信业务发送的具体内容,用于回溯审计
|
||||
stat_date timestamp(6) NOT NULL, -- 统计日期,格式 '2026-02-24'
|
||||
remarks varchar(200) NULL, -- 备注
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
-- 用于按天统计查询用户发送短信次数
|
||||
CREATE INDEX idx_usl_stat ON user_sms_log (user_id, sms_type, stat_date, create_time);
|
||||
-- 用于按时间倒序查看某个用户的发送记录
|
||||
CREATE INDEX idx_usl_uid_time ON user_sms_log (user_id, sms_type, create_time DESC);
|
||||
|
||||
COMMENT ON TABLE user_sms_log IS '用户短信日志';
|
||||
COMMENT ON COLUMN user_sms_log.id IS '主键';
|
||||
COMMENT ON COLUMN user_sms_log.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_sms_log.sms_type IS '短信类型 0-找回密码';
|
||||
COMMENT ON COLUMN user_sms_log.content IS '存储短信业务发送的具体内容,用于回溯审计';
|
||||
COMMENT ON COLUMN user_sms_log.stat_date IS '统计日期';
|
||||
COMMENT ON COLUMN user_sms_log.remarks IS '备注';
|
||||
COMMENT ON COLUMN user_sms_log.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_sms_log.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_sms_log.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_sms_log.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_sms_log.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_sms_log.status IS '状态';
|
||||
COMMENT ON COLUMN user_sms_log.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
270
doc/sql/executed/20260310_increase.sql
Normal file
270
doc/sql/executed/20260310_increase.sql
Normal file
@@ -0,0 +1,270 @@
|
||||
DROP TABLE IF EXISTS market_upgrade_config;
|
||||
CREATE TABLE market_upgrade_config
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
type int4 NOT NULL, -- 等级类型:1=福利值, 2=现金
|
||||
level_name varchar(50) NOT NULL, -- 等级名称,如 '社区经销商V1', '无等级'
|
||||
direct_recommend int4, -- 直推人数 (持有福利包人数 / 统计现金下单人数)
|
||||
requirement_value decimal(20, 2), -- 要求值 (福利值 / 金额),使用 numeric 防止金额精度丢失
|
||||
reward_rate decimal(5, 2), -- 加速/分红比例 (如 8% 存为 8.00)
|
||||
description varchar(255), -- 详细规则备注 (对应图片中的括号说明)
|
||||
sort_order int4 DEFAULT 0, -- 排序
|
||||
next_level_id int8, -- 下一个等级的ID (关联自身ID)
|
||||
has_next_level int4 DEFAULT 0, -- 是否有下一个等级
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
COMMENT ON TABLE market_upgrade_config IS '用户等级升级配置表';
|
||||
COMMENT ON COLUMN market_upgrade_config.type IS '等级类型:1=福利值, 2=现金';
|
||||
COMMENT ON COLUMN market_upgrade_config.level_name IS '等级名称';
|
||||
COMMENT ON COLUMN market_upgrade_config.direct_recommend IS '直推人数要求';
|
||||
COMMENT ON COLUMN market_upgrade_config.requirement_value IS '业绩/福利值要求';
|
||||
COMMENT ON COLUMN market_upgrade_config.reward_rate IS '加速或分红比例';
|
||||
COMMENT ON COLUMN market_upgrade_config.description IS '等级详细说明';
|
||||
COMMENT ON COLUMN market_upgrade_config.next_level_id IS '下一个等级的ID';
|
||||
COMMENT ON COLUMN market_upgrade_config.has_next_level IS '是否拥有下一级';
|
||||
COMMENT ON COLUMN market_upgrade_config.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_upgrade_config.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_upgrade_config.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_upgrade_config.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_upgrade_config.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_upgrade_config.status IS '状态';
|
||||
COMMENT ON COLUMN market_upgrade_config.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (1, 1, '无等级', 0, '0.00', '0.00', '初始等级', 1, 2, 1, NULL, NULL, '2026-03-11 17:26:31.524', NULL, '2026-03-11 17:26:31.524', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2, 1, '社区经销商V1', 10, '100000.00', '0.08', '福利包加速动态: 社区经销商V1', 2, 3, 1, NULL, NULL, '2026-03-11 17:26:31.524', NULL, '2026-03-11 17:26:31.524', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (3, 1, '区县经销商V2', 20, '1000000.00', '0.06', '福利包加速动态: 区县经销商V2', 3, 4, 1, NULL, NULL, '2026-03-11 17:26:31.524', NULL, '2026-03-11 17:26:31.524', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (4, 1, '市级经销商V3', 30, '5000000.00', '0.04', '福利包加速动态: 市级经销商V3', 4, 5, 1, NULL, NULL, '2026-03-11 17:26:31.524', NULL, '2026-03-11 17:26:31.524', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (5, 1, '联合创始人V4', 40, '20000000.00', '0.02', '福利包加速动态: 联合创始人V4', 5, NULL, 0, NULL, NULL, '2026-03-11 17:26:31.524', NULL, '2026-03-11 17:26:31.524', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (6, 2, '无等级', 0, '0.00', '0.00', '初始等级', 1, 7, 1, NULL, NULL, '2026-03-11 17:28:42.821', NULL, '2026-03-11 17:28:42.821', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (7, 2, '社区经销商V1', 10, '100000.00', '0.05', '现金加速动态: 社区经销商V1', 2, 8, 1, NULL, NULL, '2026-03-11 17:28:42.822', NULL, '2026-03-11 17:28:42.822', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (8, 2, '区县经销商V2', 20, '1000000.00', '0.05', '现金加速动态: 区县经销商V2', 3, 9, 1, NULL, NULL, '2026-03-11 17:28:42.822', NULL, '2026-03-11 17:28:42.822', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (9, 2, '市级经销商V3', 30, '5000000.00', '0.05', '现金加速动态: 市级经销商V3', 4, 10, 1, NULL, NULL, '2026-03-11 17:28:42.822', NULL, '2026-03-11 17:28:42.822', 1, 0);
|
||||
INSERT INTO "market_upgrade_config" ("id", "type", "level_name", "direct_recommend", "requirement_value", "reward_rate", "description", "sort_order", "next_level_id", "has_next_level", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (10, 2, '联合创始人V4', 40, '20000000.00', '0.05', '现金加速动态: 联合创始人V4(全网加权,单独乘区,不累加级差)', 5, NULL, 0, NULL, NULL, '2026-03-11 17:28:42.822', NULL, '2026-03-11 17:28:42.822', 1, 0);
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS market_upgrade_welfare_log;
|
||||
CREATE TABLE market_upgrade_welfare_log
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
user_id int8 NOT NULL, -- 用户ID
|
||||
last_level int8, -- 升级前的等级ID (关联配置表ID)
|
||||
current_level_id int8, -- 用户当前等级
|
||||
current_level_name varchar(50), -- 用户当前等级
|
||||
upgrade_date timestamp(6) NOT NULL, -- 升级时间 (到天结束)
|
||||
remarks text, -- 详细升级信息/备注
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_muwl_uid
|
||||
ON market_upgrade_welfare_log (user_id, upgrade_date ,create_time DESC);
|
||||
|
||||
COMMENT ON TABLE market_upgrade_welfare_log IS '用户福利包升级日志表';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.last_level IS '升级前等级';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.current_level_id IS '当前等级ID';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.current_level_name IS '当前等级名称';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.upgrade_date IS '升级日期';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.remarks IS '升级详情备注';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.status IS '状态';
|
||||
COMMENT ON COLUMN market_upgrade_welfare_log.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS market_upgrade_cash_log;
|
||||
CREATE TABLE market_upgrade_cash_log
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
user_id int8 NOT NULL, -- 用户ID
|
||||
last_level int8, -- 升级前的等级ID (关联配置表ID)
|
||||
current_level_id int8, -- 用户当前等级
|
||||
current_level_name varchar(50), -- 用户当前等级
|
||||
upgrade_date timestamp(6) NOT NULL, -- 升级时间 (到天结束)
|
||||
remarks text, -- 详细升级信息/备注
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
CREATE INDEX idx_mucl_uid
|
||||
ON market_upgrade_cash_log (user_id, upgrade_date ,create_time DESC);
|
||||
COMMENT ON TABLE market_upgrade_cash_log IS '用户现金升级日志表';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.last_level IS '升级前等级';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.current_level_id IS '当前等级ID';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.current_level_name IS '当前等级名称';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.upgrade_date IS '升级日期';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.remarks IS '升级详情备注';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.status IS '状态';
|
||||
COMMENT ON COLUMN market_upgrade_cash_log.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS market_welfare_performance;
|
||||
CREATE TABLE market_welfare_performance
|
||||
(
|
||||
id int8 PRIMARY KEY, -- 主键ID (用户ID)
|
||||
owen_amount decimal(14, 2) DEFAULT 0.00, -- 自身业绩 (直推/个人产生的)
|
||||
total_amount decimal(14, 2) DEFAULT 0.00, -- 总业绩 (团队/包含下级的业绩)
|
||||
version int4 DEFAULT 1, -- 版本号 (用于乐观锁,防止并发更新覆盖)
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
COMMENT ON TABLE market_welfare_performance IS '福利包业绩表';
|
||||
COMMENT ON COLUMN market_welfare_performance.id IS '主键ID';
|
||||
COMMENT ON COLUMN market_welfare_performance.owen_amount IS '自身业绩';
|
||||
COMMENT ON COLUMN market_welfare_performance.total_amount IS '总业绩';
|
||||
COMMENT ON COLUMN market_welfare_performance.version IS '版本号';
|
||||
COMMENT ON COLUMN market_welfare_performance.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_welfare_performance.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_welfare_performance.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_welfare_performance.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_welfare_performance.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_welfare_performance.status IS '状态';
|
||||
COMMENT ON COLUMN market_welfare_performance.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS market_welfare_performance_log;
|
||||
CREATE TABLE market_welfare_performance_log
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
user_id int8 NOT NULL, -- 用户ID
|
||||
stat_date timestamp(6) NOT NULL, -- 统计时间 (到天)
|
||||
performance decimal(14, 2) NOT NULL, -- 业绩
|
||||
source_id int8, -- 来源ID (例如:订单ID, 产生业绩的具体业务ID)
|
||||
source_detail varchar(255), -- 来源详情 (例如:订单号, 业务简述)
|
||||
remarks text, -- 备注
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
COMMENT ON TABLE market_welfare_performance_log IS '福利包业绩日志表';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.stat_date IS '统计时间';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.performance IS '当前业绩';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.source_id IS '来源ID';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.source_detail IS '来源详情';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.remarks IS '备注';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.status IS '状态';
|
||||
COMMENT ON COLUMN market_welfare_performance_log.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_mwpl_uid ON market_welfare_performance_log (user_id, stat_date DESC);
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS market_cash_performance;
|
||||
CREATE TABLE market_cash_performance
|
||||
(
|
||||
id int8 PRIMARY KEY, -- 主键ID (用户ID)
|
||||
owen_amount decimal(14, 2) DEFAULT 0.00, -- 自身业绩 (直推/个人产生的)
|
||||
total_amount decimal(14, 2) DEFAULT 0.00, -- 总业绩 (团队/包含下级的业绩)
|
||||
version int4 DEFAULT 1, -- 版本号 (用于乐观锁,防止并发更新覆盖)
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
COMMENT ON TABLE market_cash_performance IS '现金业绩表';
|
||||
COMMENT ON COLUMN market_cash_performance.id IS '主键ID';
|
||||
COMMENT ON COLUMN market_cash_performance.owen_amount IS '自身业绩';
|
||||
COMMENT ON COLUMN market_cash_performance.total_amount IS '总业绩';
|
||||
COMMENT ON COLUMN market_cash_performance.version IS '版本号';
|
||||
COMMENT ON COLUMN market_cash_performance.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_cash_performance.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_cash_performance.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_cash_performance.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_cash_performance.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_cash_performance.status IS '状态';
|
||||
COMMENT ON COLUMN market_cash_performance.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS market_cash_performance_log;
|
||||
CREATE TABLE market_cash_performance_log
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
user_id int8 NOT NULL, -- 用户ID
|
||||
stat_date timestamp(6) NOT NULL, -- 统计时间 (到天)
|
||||
performance decimal(14, 2) NOT NULL, -- 业绩
|
||||
source_id int8, -- 来源ID (例如:订单ID, 产生业绩的具体业务ID)
|
||||
source_detail varchar(255), -- 来源详情 (例如:订单号, 业务简述)
|
||||
remarks text, -- 备注
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
);
|
||||
|
||||
COMMENT ON TABLE market_cash_performance_log IS '现金业绩日志表';
|
||||
COMMENT ON COLUMN market_cash_performance_log.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN market_cash_performance_log.stat_date IS '统计时间';
|
||||
COMMENT ON COLUMN market_cash_performance_log.performance IS '当前业绩';
|
||||
COMMENT ON COLUMN market_cash_performance_log.source_id IS '来源ID';
|
||||
COMMENT ON COLUMN market_cash_performance_log.source_detail IS '来源详情';
|
||||
COMMENT ON COLUMN market_cash_performance_log.remarks IS '备注';
|
||||
COMMENT ON COLUMN market_cash_performance_log.create_user IS '创建人';
|
||||
COMMENT ON COLUMN market_cash_performance_log.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN market_cash_performance_log.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN market_cash_performance_log.update_user IS '修改人';
|
||||
COMMENT ON COLUMN market_cash_performance_log.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN market_cash_performance_log.status IS '状态';
|
||||
COMMENT ON COLUMN market_cash_performance_log.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_mcpl_uid ON market_cash_performance_log (user_id, stat_date DESC);
|
||||
|
||||
|
||||
------------------------------ 参数配置
|
||||
|
||||
INSERT INTO blade_param (id, param_name, param_key, param_value, remark, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2029205589205626881, '后台划拨福利包数量配置', 'market.benefit.pack.allocate.number', '{2019440113307066370:10,2019440172115402754:4,2019440222086340610:2,2019440263022747650:1}', '后台划拨福利包数量配置', null, null, '2026-03-04 22:41:27.922000', null, '2026-03-04 22:41:27.922000', 1, 0);
|
||||
|
||||
|
||||
388
doc/sql/executed/202603123_increase.sql
Normal file
388
doc/sql/executed/202603123_increase.sql
Normal file
@@ -0,0 +1,388 @@
|
||||
-- =============================================
|
||||
-- 微信商户配置表 (blade_pay_wxpay_account_config)
|
||||
-- =============================================
|
||||
DROP TABLE IF EXISTS blade_pay_wxpay_account_config;
|
||||
CREATE TABLE blade_pay_wxpay_account_config
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- ID
|
||||
tenant_id varchar(12), -- 租户id
|
||||
mch_id varchar(255) NOT NULL, -- 商户号
|
||||
pay_key varchar(500) NOT NULL, -- 支付密钥
|
||||
pay_name varchar(255), -- 收款名称
|
||||
v3_key varchar(500), -- V3密钥
|
||||
api_type int4, -- API类型【0:普通】
|
||||
notify_url varchar(1000), -- 统一支付回调地址
|
||||
refund_notify_url varchar(1000), -- 统一退款回调
|
||||
cashier_url varchar(1000), -- 聚合收银台URL
|
||||
cert_pem text, -- 微信证书pem文件
|
||||
cert_pkcs text, -- 微信正式p12文件
|
||||
cert_pub_key text, -- 微信证书公钥
|
||||
cert_private_key text, -- 微信证书私钥
|
||||
cert_serial_no varchar(500), -- 商户 API 证书序列号
|
||||
cert_plat_serial_no varchar(500), -- 平台序列号
|
||||
wx_pub_key text, -- 微信支付公钥
|
||||
wx_pub_key_id varchar(255), -- 微信支付公钥ID
|
||||
status int4 NOT NULL DEFAULT 0, -- 状态【0:关闭、1:启用】
|
||||
create_user int8, -- 创建人
|
||||
create_dept int8, -- 创建部门
|
||||
create_time timestamp(6), -- 创建时间
|
||||
update_user int8, -- 修改人
|
||||
update_time timestamp(6), -- 修改时间
|
||||
is_deleted int4, -- 是否已删除
|
||||
remark varchar(500) DEFAULT '' -- 备注
|
||||
);
|
||||
|
||||
COMMENT ON TABLE blade_pay_wxpay_account_config IS '微信商户配置表';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.id IS 'ID';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.tenant_id IS '租户id';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.mch_id IS '商户号';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.pay_key IS '支付密钥';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.pay_name IS '收款名称';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.v3_key IS 'V3密钥';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.api_type IS 'API类型【0:普通】';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.notify_url IS '统一支付回调地址';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.refund_notify_url IS '统一退款回调';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cashier_url IS '聚合收银台URL';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cert_pem IS '微信证书pem文件';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cert_pkcs IS '微信正式p12文件';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cert_pub_key IS '微信证书公钥';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cert_private_key IS '微信证书私钥';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cert_serial_no IS '商户 API 证书序列号';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.cert_plat_serial_no IS '平台序列号';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.wx_pub_key IS '微信支付公钥';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.wx_pub_key_id IS '微信支付公钥ID';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.status IS '状态【0:关闭、1:启用】';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.create_user IS '创建人';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.update_user IS '修改人';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN blade_pay_wxpay_account_config.remark IS '备注';
|
||||
|
||||
|
||||
-- =============================================
|
||||
-- 支付订单表 (blade_pay_order)
|
||||
-- =============================================
|
||||
DROP TABLE IF EXISTS blade_pay_order;
|
||||
CREATE TABLE blade_pay_order
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- ID
|
||||
tenant_id varchar(12), -- 租户id
|
||||
order_no varchar(255) NOT NULL, -- 系统单号
|
||||
body varchar(255) NOT NULL, -- 商品名称
|
||||
money varchar(255) NOT NULL, -- 支付金额
|
||||
app_id varchar(255) NOT NULL, -- 应用ID
|
||||
mch_id varchar(255) NOT NULL, -- 商户号
|
||||
pay_name varchar(255) NOT NULL, -- 收款名称
|
||||
pay_type varchar(255) NOT NULL, -- 支付方式【code、native、jsapi、wxapp、h5、app】
|
||||
channel varchar(255) NOT NULL, -- 支付渠道【wxpay、alipay】
|
||||
buyer_id varchar(255), -- 买家ID
|
||||
status int4 NOT NULL DEFAULT 0, -- 0:未支付、1:已支付
|
||||
pay_no varchar(255), -- 第三方支付单号
|
||||
pay_time varchar(255), -- 支付时间
|
||||
is_refund int4 NOT NULL DEFAULT 0, -- 是否退款【0:否、1:是】
|
||||
refund_money varchar(255), -- 已退款金额
|
||||
notify_url varchar(255), -- 异步回调地址
|
||||
create_user int8, -- 创建人
|
||||
create_dept int8, -- 创建部门
|
||||
create_time timestamp(6), -- 创建时间
|
||||
update_user int8, -- 修改人
|
||||
update_time timestamp(6), -- 修改时间
|
||||
is_deleted int4, -- 是否已删除
|
||||
remark varchar(500) DEFAULT '' -- 备注
|
||||
);
|
||||
|
||||
COMMENT ON TABLE blade_pay_order IS '支付订单表';
|
||||
COMMENT ON COLUMN blade_pay_order.id IS 'ID';
|
||||
COMMENT ON COLUMN blade_pay_order.tenant_id IS '租户id';
|
||||
COMMENT ON COLUMN blade_pay_order.order_no IS '系统单号';
|
||||
COMMENT ON COLUMN blade_pay_order.body IS '商品名称';
|
||||
COMMENT ON COLUMN blade_pay_order.money IS '支付金额';
|
||||
COMMENT ON COLUMN blade_pay_order.app_id IS '应用ID';
|
||||
COMMENT ON COLUMN blade_pay_order.mch_id IS '商户号';
|
||||
COMMENT ON COLUMN blade_pay_order.pay_name IS '收款名称';
|
||||
COMMENT ON COLUMN blade_pay_order.pay_type IS '支付方式【code、native、jsapi、wxapp、h5、app】';
|
||||
COMMENT ON COLUMN blade_pay_order.channel IS '支付渠道【wxpay、alipay】';
|
||||
COMMENT ON COLUMN blade_pay_order.buyer_id IS '买家ID';
|
||||
COMMENT ON COLUMN blade_pay_order.status IS '0:未支付、1:已支付';
|
||||
COMMENT ON COLUMN blade_pay_order.pay_no IS '第三方支付单号';
|
||||
COMMENT ON COLUMN blade_pay_order.pay_time IS '支付时间';
|
||||
COMMENT ON COLUMN blade_pay_order.is_refund IS '是否退款【0:否、1:是】';
|
||||
COMMENT ON COLUMN blade_pay_order.refund_money IS '已退款金额';
|
||||
COMMENT ON COLUMN blade_pay_order.notify_url IS '异步回调地址';
|
||||
COMMENT ON COLUMN blade_pay_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN blade_pay_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN blade_pay_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN blade_pay_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN blade_pay_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN blade_pay_order.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN blade_pay_order.remark IS '备注';
|
||||
|
||||
|
||||
-- =============================================
|
||||
-- 订单退款表 (blade_pay_order_refund)
|
||||
-- =============================================
|
||||
DROP TABLE IF EXISTS blade_pay_order_refund;
|
||||
CREATE TABLE blade_pay_order_refund
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- ID
|
||||
tenant_id varchar(12), -- 租户id
|
||||
refund_no varchar(255) NOT NULL, -- 退款单号
|
||||
order_no varchar(255) NOT NULL, -- 业务订单
|
||||
pay_no varchar(255) NOT NULL, -- 支付单号
|
||||
refund_mch_id varchar(255) NOT NULL, -- 退款商户
|
||||
refund_money varchar(255) NOT NULL, -- 退款金额
|
||||
refund_desc varchar(255), -- 退款原因
|
||||
status int4 NOT NULL DEFAULT 0, -- 退款状态 -1:退款失败 0:已发起 1:退款成功
|
||||
notify_url varchar(1000), -- 退款回调地址
|
||||
create_user int8, -- 创建人
|
||||
create_dept int8, -- 创建部门
|
||||
create_time timestamp(6), -- 创建时间
|
||||
update_user int8, -- 修改人
|
||||
update_time timestamp(6), -- 修改时间
|
||||
is_deleted int4, -- 是否已删除
|
||||
remark varchar(500) DEFAULT '' -- 备注
|
||||
);
|
||||
|
||||
COMMENT ON TABLE blade_pay_order_refund IS '订单退款表';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.id IS 'ID';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.tenant_id IS '租户id';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.refund_no IS '退款单号';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.order_no IS '业务订单';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.pay_no IS '支付单号';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.refund_mch_id IS '退款商户';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.refund_money IS '退款金额';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.refund_desc IS '退款原因';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.status IS '退款状态 -1:退款失败 0:已发起 1:退款成功';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.notify_url IS '退款回调地址';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.create_user IS '创建人';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.update_user IS '修改人';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN blade_pay_order_refund.remark IS '备注';
|
||||
|
||||
|
||||
-- =============================================
|
||||
-- 支付宝商户配置表 (blade_pay_alipay_account_config)
|
||||
-- =============================================
|
||||
DROP TABLE IF EXISTS blade_pay_alipay_account_config;
|
||||
CREATE TABLE blade_pay_alipay_account_config
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- ID
|
||||
tenant_id varchar(12), -- 租户id
|
||||
mch_id varchar(255) NOT NULL, -- 商户号
|
||||
app_id varchar(255) NOT NULL, -- 支付宝应用ID
|
||||
account varchar(255) NOT NULL, -- 支付宝账户
|
||||
pay_key text, -- 支付密钥
|
||||
pub_key text, -- 支付宝公钥(开发者工具生成的txt文件)证书模式下通过程序提取该值
|
||||
private_key text, -- 支付宝私钥(开发者工具生成的txt文件,证书模式下CSR文件夹下的私钥)
|
||||
app_cert text, -- 应用证书,开发者网站下载
|
||||
alipay_pub_cert text, -- 支付宝公钥证书,开发者网站下载
|
||||
root_cert text, -- 支付宝根证书,开发者网站下载
|
||||
app_auth_token varchar(500), -- 三方模式授权token
|
||||
service_url varchar(500), -- 支付宝网关地址
|
||||
sign_type varchar(255) NOT NULL, -- 加密算法类型
|
||||
pay_name varchar(255), -- 收款名称
|
||||
company_name varchar(500), -- 公司名称
|
||||
api_type int4 NOT NULL DEFAULT 0, -- API类型【0:普通】
|
||||
notify_url varchar(1000), -- 统一支付回调地址
|
||||
refund_notify_url varchar(1000), -- 退款回调地址
|
||||
status int4 NOT NULL DEFAULT 0, -- 状态【0:关闭、1:启用】
|
||||
create_user int8, -- 创建人
|
||||
create_dept int8, -- 创建部门
|
||||
create_time timestamp(6), -- 创建时间
|
||||
update_user int8, -- 修改人
|
||||
update_time timestamp(6), -- 修改时间
|
||||
is_deleted int4, -- 是否已删除
|
||||
remark varchar(500) DEFAULT '' -- 备注
|
||||
);
|
||||
|
||||
COMMENT ON TABLE blade_pay_alipay_account_config IS '支付宝商户配置表';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.id IS 'ID';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.tenant_id IS '租户id';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.mch_id IS '商户号';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.app_id IS '支付宝应用ID';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.account IS '支付宝账户';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.pay_key IS '支付密钥';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.pub_key IS '支付宝公钥(开发者工具生成的txt文件)证书模式下通过程序提取该值';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.private_key IS '支付宝私钥(开发者工具生成的txt文件,证书模式下CSR文件夹下的私钥)';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.app_cert IS '应用证书,开发者网站下载';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.alipay_pub_cert IS '支付宝公钥证书,开发者网站下载';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.root_cert IS '支付宝根证书,开发者网站下载';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.app_auth_token IS '三方模式授权token';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.service_url IS '支付宝网关地址';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.sign_type IS '加密算法类型';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.pay_name IS '收款名称';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.company_name IS '公司名称';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.api_type IS 'API类型【0:普通】';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.notify_url IS '统一支付回调地址';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.refund_notify_url IS '退款回调地址';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.status IS '状态【0:关闭、1:启用】';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.create_user IS '创建人';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.update_user IS '修改人';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN blade_pay_alipay_account_config.remark IS '备注';
|
||||
|
||||
|
||||
-- =============================================
|
||||
-- 聚合支付配置表 (blade_pay_merge_pay_config)
|
||||
-- =============================================
|
||||
DROP TABLE IF EXISTS blade_pay_merge_pay_config;
|
||||
CREATE TABLE blade_pay_merge_pay_config
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- ID
|
||||
tenant_id varchar(12), -- 租户id
|
||||
mch_id varchar(255) NOT NULL, -- 商户号
|
||||
pay_key varchar(255) NOT NULL, -- 支付密钥
|
||||
notify_url varchar(1000), -- 统一支付回调地址
|
||||
refund_notify_url varchar(1000), -- 退款回调地址
|
||||
status int4 NOT NULL DEFAULT 0, -- 状态【0:关闭、1:启用】
|
||||
create_user int8, -- 创建人
|
||||
create_dept int8, -- 创建部门
|
||||
create_time timestamp(6), -- 创建时间
|
||||
update_user int8, -- 修改人
|
||||
update_time timestamp(6), -- 修改时间
|
||||
is_deleted int4, -- 是否已删除
|
||||
remark varchar(500) DEFAULT '' -- 备注
|
||||
);
|
||||
|
||||
COMMENT ON TABLE blade_pay_merge_pay_config IS '聚合支付配置表';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.id IS 'ID';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.tenant_id IS '租户id';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.mch_id IS '商户号';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.pay_key IS '支付密钥';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.notify_url IS '统一支付回调地址';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.refund_notify_url IS '退款回调地址';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.status IS '状态【0:关闭、1:启用】';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.create_user IS '创建人';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.update_user IS '修改人';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN blade_pay_merge_pay_config.remark IS '备注';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS common_order_confirm_log;
|
||||
|
||||
CREATE TABLE common_order_confirm_log
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
user_id int8, -- 用户ID
|
||||
order_id int8, -- 订单ID
|
||||
item_name varchar(32), -- 商品名称
|
||||
delivery_address varchar(255), -- 收货地址ID
|
||||
actual_amount numeric(10, 2) default 0.00 not null, -- 实际支付金额
|
||||
order_type varchar(32), -- 订单类型
|
||||
payment_type int4, -- 支付类型
|
||||
is_agency_distributed int4 NOT NULL DEFAULT 0, -- 是否分发极差代理 (0:未分发, 1:已分发)
|
||||
agency_distribute_time timestamp(6), -- 极差代理发放时间
|
||||
is_service_distributed int4 NOT NULL DEFAULT 0, -- 是否发放服务商佣金 (0:未发放, 1:已发放)
|
||||
service_distribute_time timestamp(6), -- 服务商佣金发放时间
|
||||
status int4 NOT NULL DEFAULT 0, -- 状态
|
||||
create_user int8, -- 创建人
|
||||
create_dept int8, -- 创建部门
|
||||
create_time timestamp(6), -- 创建时间
|
||||
update_user int8, -- 修改人
|
||||
update_time timestamp(6), -- 修改时间
|
||||
is_deleted int4, -- 是否已删除 (0:未删除, 1:已删除)
|
||||
remark varchar(500) DEFAULT '' -- 备注
|
||||
|
||||
);
|
||||
|
||||
CREATE INDEX idx_cocl_aop ON common_order_confirm_log (is_agency_distributed, order_type, payment_type);
|
||||
CREATE INDEX idx_cocl_sop ON common_order_confirm_log (is_service_distributed, order_type, payment_type);
|
||||
CREATE INDEX idx_cocl_poc ON common_order_confirm_log (payment_type, order_type, create_time DESC);
|
||||
|
||||
COMMENT ON TABLE common_order_confirm_log IS '订单确认收货记录表';
|
||||
|
||||
COMMENT ON COLUMN common_order_confirm_log.id IS 'id';
|
||||
COMMENT ON COLUMN common_order_confirm_log.user_id IS '用户id';
|
||||
COMMENT ON COLUMN common_order_confirm_log.order_id IS '订单id';
|
||||
COMMENT ON COLUMN common_order_confirm_log.item_name IS '商品名称';
|
||||
COMMENT ON COLUMN common_order_confirm_log.delivery_address IS '收货地址';
|
||||
COMMENT ON COLUMN common_order_confirm_log.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN common_order_confirm_log.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN common_order_confirm_log.payment_type IS '支付类型';
|
||||
COMMENT ON COLUMN common_order_confirm_log.is_agency_distributed IS '是否分发极差代理 (0:未分发, 1:已分发)';
|
||||
COMMENT ON COLUMN common_order_confirm_log.agency_distribute_time IS '极差代理发放时间';
|
||||
COMMENT ON COLUMN common_order_confirm_log.is_service_distributed IS '是否发放服务商佣金 (0:未发放, 1:已发放)';
|
||||
COMMENT ON COLUMN common_order_confirm_log.service_distribute_time IS '服务商佣金发放时间';
|
||||
COMMENT ON COLUMN common_order_confirm_log.status IS '状态';
|
||||
COMMENT ON COLUMN common_order_confirm_log.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_order_confirm_log.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_order_confirm_log.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_order_confirm_log.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_order_confirm_log.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_order_confirm_log.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN common_order_confirm_log.remark IS '备注';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- =============================================
|
||||
-- 菜单数据初始化 (blade_menu)
|
||||
-- =============================================
|
||||
|
||||
-- 1. 支付管理 (根节点)
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, is_open, remark, is_deleted) VALUES (1477199103906373633, 0, '14', '支付管理', 'pay', '/pay', 'iconfont icon-weixin1', 100, 1, 1, '', 0);
|
||||
|
||||
-- 2. 微信支付配置模块
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted) VALUES (1476839243041804294, 1477199103906373633, 'wxconfig', '微信支付配置', 'menu', '/plugin/pay/wxconfig', 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 (1476839243041804295, 1476839243041804294, 'wxconfig_add', '新增', 'add', '/plugin/pay/wxconfig/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 (1476839243041804296, 1476839243041804294, 'wxconfig_edit', '修改', 'edit', '/plugin/pay/wxconfig/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 (1476839243041804297, 1476839243041804294, 'wxconfig_delete', '删除', 'delete', '/api/blade-pay/wxconfig/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 (1476839243041804298, 1476839243041804294, 'wxconfig_view', '查看', 'view', '/plugin/pay/wxconfig/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
-- 3. 订单管理模块
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1476767495650865158, 1477199103906373633, 'order', '订单管理', 'menu', '/plugin/pay/order', 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 (1476767495650865159, 1476767495650865158, 'order_add', '新增', 'add', '/plugin/pay/order/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 (1476767495650865160, 1476767495650865158, 'order_edit', '修改', 'edit', '/plugin/pay/order/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 (1476767495650865161, 1476767495650865158, 'order_delete', '删除', 'delete', '/api/blade-pay/order/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 (1476767495650865162, 1476767495650865158, 'order_view', '查看', 'view', '/plugin/pay/order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
-- 4. 支付体验 (根节点下的子菜单)
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, is_open, remark, is_deleted)VALUES (1477222211518210049, 1477199103906373633, '12', '支付体验', 'pay-demo', '/plugin/pay/demo', 'iconfont iconicon_wechat', 3, 1, 1, '', 0);
|
||||
|
||||
-- 5. 退款管理模块
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1478012327564226566, 1477199103906373633, 'refund', '退款管理', 'menu', '/plugin/pay/refund', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
|
||||
-- 注意:原SQL中退款管理缺少“新增”按钮,此处保持原样。如果有需要可自行添加。
|
||||
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1478012327564226568, 1478012327564226566, 'refund_edit', '修改', 'edit', '/plugin/pay/refund/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 (1478012327564226569, 1478012327564226566, 'refund_delete', '删除', 'delete', '/api/blade-pay/refund/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 (1478012327564226570, 1478012327564226566, 'refund_view', '查看', 'view', '/plugin/pay/refund/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
-- 6. 支付宝配置模块
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1519502474608390145, 1477199103906373633, 'aliconfig', '支付宝配置', 'menu', '/plugin/pay/aliconfig', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
|
||||
-- 修正了原SQL中字段顺序不一致的问题,统一为 action 列
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1519502474608391478, 1477199103906373633, 'aliconfig_view', '查看', 'view', '/plugin/pay/aliconfig/view', 'file-text', 4, 2, 2, 1, '', 0);
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1519502474608398520, 1477199103906373633, 'aliconfig_delete', '删除', 'delete', '/api/blade-pay/aliconfig/remove', 'delete', 3, 2, 3, 1, '', 0);
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1519502474608399630, 1477199103906373633, 'aliconfig_edit', '修改', 'edit', '/plugin/pay/aliconfig/edit', 'form', 2, 2, 2, 1, '', 0);
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1519502474608397841, 1477199103906373633, 'aliconfig_add', '新增', 'add', '/plugin/pay/aliconfig/add', 'plus', 1, 2, 1, 1, '', 0);
|
||||
|
||||
-- 7. 聚合支付配置模块
|
||||
-- 注意:原SQL使用 VALUES 位置匹配,这里显式指定字段以确保安全
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES (1541359525647163398, 1477199103906373633, 'mergepayconfig', '聚合支付', 'menu', '/plugin/pay/merge/config', 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 (1541359525647163399, 1541359525647163398, 'mergepayconfig_add', '新增', 'add', '/plugin/pay/merge/config/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 (1541359525647163400, 1541359525647163398, 'mergepayconfig_edit', '修改', 'edit', '/plugin/pay/merge/config/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 (1541359525647163401, 1541359525647163398, 'mergepayconfig_delete', '删除', 'delete', '/api/blade-pay/merge/config/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 (1541359525647163402, 1541359525647163398, 'mergepayconfig_view', '查看', 'view', '/plugin/pay/merge/config/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
438
doc/sql/executed/20260316_increase.sql
Normal file
438
doc/sql/executed/20260316_increase.sql
Normal file
@@ -0,0 +1,438 @@
|
||||
DROP TABLE IF EXISTS merchant_flagship_store CASCADE;
|
||||
|
||||
CREATE TABLE merchant_flagship_store
|
||||
(
|
||||
|
||||
id int8 NOT NULL PRIMARY KEY, -- [主键]
|
||||
store_name VARCHAR(255) NOT NULL, -- 商家全称
|
||||
contact_phone VARCHAR(20), -- 商家联系电话
|
||||
province_id int8 NOT NULL,
|
||||
city_id int8 NOT NULL,
|
||||
regions_id int8 NOT NULL,
|
||||
region_name text NOT NULL, -- 地区名
|
||||
full_address text NOT NULL, -- 详细地址
|
||||
location geometry(Point, 4326) NOT NULL, -- 门店经纬度坐标(用于地图打点和距离计算)
|
||||
thumbnail_url text, -- 缩略图
|
||||
main_image_url text[] default '{}'::text[], -- 商家主图
|
||||
detail_images text[] default '{}'::text[], -- 详情展示多图
|
||||
business_hours VARCHAR(100), -- 营业时间描述
|
||||
store_description text, -- 商家详细介绍
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE merchant_flagship_store IS '商家旗舰店信息表';
|
||||
COMMENT ON COLUMN merchant_flagship_store.id IS '主键 ID';
|
||||
COMMENT ON COLUMN merchant_flagship_store.store_name IS '店铺名字';
|
||||
COMMENT ON COLUMN merchant_flagship_store.contact_phone IS '商家联系电话';
|
||||
COMMENT ON COLUMN merchant_flagship_store.province_id IS '省份id';
|
||||
COMMENT ON COLUMN merchant_flagship_store.city_id IS '城市id';
|
||||
COMMENT ON COLUMN merchant_flagship_store.regions_id IS '地址id';
|
||||
COMMENT ON COLUMN merchant_flagship_store.region_name IS '地区名';
|
||||
COMMENT ON COLUMN merchant_flagship_store.full_address IS '完整详细地址';
|
||||
COMMENT ON COLUMN merchant_flagship_store.location IS '地理坐标 POINT(经度,纬度),用于地图定位和距离计算';
|
||||
COMMENT ON COLUMN merchant_flagship_store.main_image_url IS '商家主图';
|
||||
COMMENT ON COLUMN merchant_flagship_store.thumbnail_url IS '缩略图';
|
||||
COMMENT ON COLUMN merchant_flagship_store.detail_images IS '详情图';
|
||||
COMMENT ON COLUMN merchant_flagship_store.business_hours IS '营业时间,如:10:00--23:00';
|
||||
COMMENT ON COLUMN merchant_flagship_store.store_description IS '商家详细介绍';
|
||||
COMMENT ON COLUMN merchant_flagship_store.create_user IS '创建人';
|
||||
COMMENT ON COLUMN merchant_flagship_store.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN merchant_flagship_store.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN merchant_flagship_store.update_user IS '修改人';
|
||||
COMMENT ON COLUMN merchant_flagship_store.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN merchant_flagship_store.status IS '状态';
|
||||
COMMENT ON COLUMN merchant_flagship_store.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
-- 4.3 地理位置索引 (GiST):核心!用于“附近店铺”查询和距离排序
|
||||
CREATE INDEX idx_mfs_location ON merchant_flagship_store USING gist(location);
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS cultural_tourism_spot CASCADE;
|
||||
CREATE TABLE cultural_tourism_spot
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 自增主键
|
||||
is_recommended int4 DEFAULT 0, -- 是否推荐
|
||||
spot_name VARCHAR(255) NOT NULL, -- 景点名称
|
||||
summary varchar(255), -- 简短摘要(列表页显示,如:“中国最美的地方”)
|
||||
rating NUMERIC(3, 2) DEFAULT 0.00, -- 用户评分
|
||||
visit_count int4 DEFAULT 0, -- 出行人数
|
||||
thumbnail_url text, -- 缩略图
|
||||
main_image_url text[] default '{}'::text[], -- 主图
|
||||
detail_images text[] default '{}'::text[], -- 详情多图集合
|
||||
video_url text, -- 宣传视频链接
|
||||
description text, -- 详细介绍
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE cultural_tourism_spot IS '文旅景点信息表';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.id IS '主键ID';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.is_recommended IS '是否推荐';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.spot_name IS '景点全称';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.rating IS '用户评分,范围0.00~5.00';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.visit_count IS '出行人数';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.thumbnail_url IS '缩略图';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.main_image_url IS '主图';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.detail_images IS '详情图';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.video_url IS '宣传视频链接';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.summary IS '简短摘要';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.description IS '详细介绍';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.create_user IS '创建人';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.update_user IS '修改人';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.status IS '状态';
|
||||
COMMENT ON COLUMN cultural_tourism_spot.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS news_category CASCADE;
|
||||
|
||||
CREATE TABLE news_category
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 自增主键
|
||||
category_name VARCHAR(50) NOT NULL, -- 分类名称
|
||||
sort_order int4 DEFAULT 0, -- 排序
|
||||
is_top int4 DEFAULT 0, -- 是否置顶
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL, -- 状态
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE news_category IS '资讯分类表,用于管理顶部导航标签';
|
||||
|
||||
COMMENT ON COLUMN news_category.id IS '主键';
|
||||
COMMENT ON COLUMN news_category.category_name IS '分类名称';
|
||||
COMMENT ON COLUMN news_category.sort_order IS '排序';
|
||||
COMMENT ON COLUMN news_category.is_top IS '是否置顶';
|
||||
COMMENT ON COLUMN news_category.create_user IS '创建人';
|
||||
COMMENT ON COLUMN news_category.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN news_category.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN news_category.update_user IS '修改人';
|
||||
COMMENT ON COLUMN news_category.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN news_category.status IS '状态';
|
||||
COMMENT ON COLUMN news_category.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_nc_pinned_sort ON news_category(is_top DESC, sort_order DESC, create_time DESC);
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS news_content CASCADE;
|
||||
|
||||
-- =================================================================
|
||||
-- 2. 创建资讯内容表
|
||||
-- =================================================================
|
||||
CREATE TABLE news_content
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 自增主键
|
||||
category_id int8 NOT NULL, -- 所属分类ID
|
||||
title VARCHAR(255) NOT NULL, -- 标题
|
||||
summary varchar(255), -- 简短摘要
|
||||
content_type int4 DEFAULT 0, -- 内容类型:0-图文 1-视频
|
||||
video_url text, -- 视频链接
|
||||
play_count int8 DEFAULT 0, -- 播放次数
|
||||
thumbnail_url text, -- 缩略图
|
||||
main_image_url text[] default '{}'::text[], -- 主图(
|
||||
detail_images text[] default '{}'::text[], -- 详情多图集合
|
||||
article_content text, -- 正文内容
|
||||
comment_count int8 DEFAULT 0, -- 评论数量
|
||||
is_featured int4 DEFAULT 0, -- 是否置顶
|
||||
sort_order int4 DEFAULT 0, -- 排序
|
||||
view_count int8 DEFAULT 0, -- 浏览次数
|
||||
create_user int8 NULL, -- 创建人
|
||||
create_dept int8 NULL, -- 创建部门
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL DEFAULT 1, -- 状态 ,0=下架,1=上架
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除
|
||||
|
||||
);
|
||||
|
||||
-- =================================================================
|
||||
-- 3. 添加字段备注
|
||||
-- =================================================================
|
||||
COMMENT ON TABLE news_content IS '资讯内容表';
|
||||
|
||||
COMMENT ON COLUMN news_content.id IS '主键ID';
|
||||
COMMENT ON COLUMN news_content.category_id IS '所属分类ID';
|
||||
COMMENT ON COLUMN news_content.title IS '资讯标题';
|
||||
COMMENT ON COLUMN news_content.summary IS '简短摘要';
|
||||
COMMENT ON COLUMN news_content.content_type IS '内容类型 0-图文 1-视频';
|
||||
COMMENT ON COLUMN news_content.video_url IS '视频链接';
|
||||
COMMENT ON COLUMN news_content.play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN news_content.thumbnail_url IS '缩略图';
|
||||
COMMENT ON COLUMN news_content.main_image_url IS '主图';
|
||||
COMMENT ON COLUMN news_content.detail_images IS '详情多图';
|
||||
COMMENT ON COLUMN news_content.article_content IS '正文内容';
|
||||
COMMENT ON COLUMN news_content.comment_count IS '评论数量';
|
||||
COMMENT ON COLUMN news_content.is_featured IS '是否置顶';
|
||||
COMMENT ON COLUMN news_content.sort_order IS '排序';
|
||||
COMMENT ON COLUMN news_content.view_count IS '浏览次数';
|
||||
COMMENT ON COLUMN news_content.create_user IS '创建人';
|
||||
COMMENT ON COLUMN news_content.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN news_content.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN news_content.update_user IS '修改人';
|
||||
COMMENT ON COLUMN news_content.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN news_content.status IS '状态 0=下架,1=上架';
|
||||
COMMENT ON COLUMN news_content.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_ncc_featured_sort ON news_content(is_featured DESC, sort_order DESC, create_time DESC);
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS tour_product;
|
||||
CREATE TABLE tour_product
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
product_name varchar(100) NOT NULL, -- 产品名称 (如:恩施硒茶文化之旅)
|
||||
sub_title varchar(255) DEFAULT NULL, -- 副标题/亮点 (如:4天3晚 | 研学之旅)
|
||||
thumbnail_url text DEFAULT NULL, -- 缩略图
|
||||
main_image_url text[] DEFAULT '{}'::text[], -- 商家主图 (数组)
|
||||
detail_images text[] DEFAULT '{}'::text[], -- 详情展示多图 (数组)
|
||||
city_name varchar(50) DEFAULT NULL, -- 目的地城市名称
|
||||
duration_days int4 DEFAULT NULL, -- 行程天数
|
||||
duration_nights int4 DEFAULT NULL, -- 住宿晚数
|
||||
base_price decimal(10, 2) NOT NULL, -- 基础起售价
|
||||
adult_price decimal(10, 2) DEFAULT NULL, -- 成人单价
|
||||
child_price decimal(10, 2) DEFAULT NULL, -- 儿童单价
|
||||
elderly_price decimal(10, 2) DEFAULT NULL, -- 老年人单价
|
||||
min_people int4 DEFAULT 1, -- 最小成团人数
|
||||
max_people int4 DEFAULT 9999, -- 最大接待人数
|
||||
is_recommended int4 DEFAULT 0, -- 是否推荐
|
||||
require_id_card int4 DEFAULT 0, -- 是否强制身份证
|
||||
require_passport int4 DEFAULT 0, -- 是否强制护照
|
||||
require_hk_macau_pass int4 DEFAULT 0, -- 是否强制港澳通行证
|
||||
description text DEFAULT NULL, -- 产品详情描述
|
||||
visit_count int4 DEFAULT 0, -- 已成团次数/销量
|
||||
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
|
||||
province_id int8 NOT NULL,
|
||||
city_id int8 NOT NULL,
|
||||
create_user int8 NULL, -- 创建人ID
|
||||
create_dept int8 NULL, -- 创建部门ID
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人ID
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL DEFAULT 1, -- 状态:0=下架,1=上架
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
|
||||
);
|
||||
|
||||
-- 添加表注释
|
||||
COMMENT ON TABLE tour_product IS '旅游产品表';
|
||||
|
||||
-- 添加列注释
|
||||
COMMENT ON COLUMN tour_product.id IS '主键ID';
|
||||
COMMENT ON COLUMN tour_product.product_name IS '产品名称 (如:恩施硒茶文化之旅)';
|
||||
COMMENT ON COLUMN tour_product.sub_title IS '副标题/亮点 (如:4天3晚 | 研学之旅)';
|
||||
COMMENT ON COLUMN tour_product.thumbnail_url IS '缩略图';
|
||||
COMMENT ON COLUMN tour_product.main_image_url IS '商家主图 (数组)';
|
||||
COMMENT ON COLUMN tour_product.detail_images IS '详情展示多图 (数组)';
|
||||
COMMENT ON COLUMN tour_product.city_name IS '目的地城市名称';
|
||||
COMMENT ON COLUMN tour_product.duration_days IS '行程天数';
|
||||
COMMENT ON COLUMN tour_product.duration_nights IS '住宿晚数';
|
||||
COMMENT ON COLUMN tour_product.base_price IS '基础起售价';
|
||||
COMMENT ON COLUMN tour_product.adult_price IS '成人单价';
|
||||
COMMENT ON COLUMN tour_product.child_price IS '儿童单价';
|
||||
COMMENT ON COLUMN tour_product.elderly_price IS '老年人单价';
|
||||
COMMENT ON COLUMN tour_product.min_people IS '最小成团人数';
|
||||
COMMENT ON COLUMN tour_product.max_people IS '最大接待人数';
|
||||
COMMENT ON COLUMN tour_product.is_recommended IS '是否推荐:0=否,1=是';
|
||||
COMMENT ON COLUMN tour_product.require_id_card IS '是否强制身份证:0=否,1=是';
|
||||
COMMENT ON COLUMN tour_product.require_passport IS '是否强制护照:0=否,1=是';
|
||||
COMMENT ON COLUMN tour_product.require_hk_macau_pass IS '是否强制港澳通行证:0=否,1=是';
|
||||
COMMENT ON COLUMN tour_product.description IS '产品详情描述';
|
||||
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量';
|
||||
COMMENT ON COLUMN tour_product.rating IS '用户评分';
|
||||
COMMENT ON COLUMN tour_product.province_id IS '省份id';
|
||||
COMMENT ON COLUMN tour_product.city_id IS '城市id';
|
||||
COMMENT ON COLUMN tour_product.create_user IS '创建人ID';
|
||||
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
|
||||
COMMENT ON COLUMN tour_product.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN tour_product.update_user IS '修改人ID';
|
||||
COMMENT ON COLUMN tour_product.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN tour_product.status IS '状态:0=下架,1=上架';
|
||||
COMMENT ON COLUMN tour_product.is_deleted IS '是否已删除:0=未删除,1=已删除';
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS tour_order_detail;
|
||||
|
||||
CREATE TABLE tour_order_detail
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
order_id int8 NOT NULL, -- 关联订单ID (主表 tour_order 的ID)
|
||||
user_id int8 NOT NULL, -- 下单用户ID
|
||||
traveler_detail jsonb DEFAULT NULL, -- 出行人信息快照 (数组格式,冗余存储,防止档案修改影响历史订单)
|
||||
product_snapshot jsonb DEFAULT NULL, -- 产品信息快照 (数组格式,包含线路名称、单价、数量、规格等,防止产品下架/改价影响历史订单)
|
||||
contract_url varchar(500) DEFAULT NULL, -- 电子合同地址/编号 (存储生成的合同PDF路径或第三方合同号)
|
||||
contract_status int4 DEFAULT 0, -- 合同状态:0=未签署,1=已签署,2=已过期 (扩展字段,建议加上)
|
||||
guide_name varchar(50) DEFAULT NULL, -- 导游姓名
|
||||
guide_phone varchar(20) DEFAULT NULL, -- 导游联系电话
|
||||
start_date timestamp(6) DEFAULT NULL, -- 出行日期 (具体出发时间)
|
||||
end_date timestamp(6) DEFAULT NULL, -- 预计返回日期
|
||||
remark varchar(255) DEFAULT NULL, -- 订单备注 (用户留言或内部备注)
|
||||
create_user int8 NULL, -- 创建人ID
|
||||
create_dept int8 NULL, -- 创建部门ID
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人ID
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL DEFAULT 1, -- 状态:0=下架,1=上架
|
||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
|
||||
);
|
||||
|
||||
-- 表注释
|
||||
COMMENT ON TABLE tour_order_detail IS '订单详情扩展表';
|
||||
|
||||
-- 字段注释
|
||||
COMMENT ON COLUMN tour_order_detail.id IS '主键ID';
|
||||
COMMENT ON COLUMN tour_order_detail.order_id IS '关联订单ID';
|
||||
COMMENT ON COLUMN tour_order_detail.user_id IS '下单用户ID';
|
||||
COMMENT ON COLUMN tour_order_detail.traveler_detail IS '出行人信息快照 (JSONB数组)';
|
||||
COMMENT ON COLUMN tour_order_detail.product_snapshot IS '产品信息快照 (JSONB数组)';
|
||||
COMMENT ON COLUMN tour_order_detail.contract_url IS '电子合同地址或编号';
|
||||
COMMENT ON COLUMN tour_order_detail.contract_status IS '合同签署状态:0=未签署,1=已签署,2=已过期';
|
||||
COMMENT ON COLUMN tour_order_detail.guide_name IS '导游姓名';
|
||||
COMMENT ON COLUMN tour_order_detail.guide_phone IS '导游联系电话';
|
||||
COMMENT ON COLUMN tour_order_detail.start_date IS '出行日期';
|
||||
COMMENT ON COLUMN tour_order_detail.end_date IS '预计返回日期';
|
||||
COMMENT ON COLUMN tour_order_detail.remark IS '备注信息';
|
||||
COMMENT ON COLUMN tour_order_detail.create_user IS '创建人ID';
|
||||
COMMENT ON COLUMN tour_order_detail.create_dept IS '创建部门ID';
|
||||
COMMENT ON COLUMN tour_order_detail.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN tour_order_detail.update_user IS '修改人ID';
|
||||
COMMENT ON COLUMN tour_order_detail.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN tour_order_detail.status IS '数据状态:0=无效,1=有效';
|
||||
COMMENT ON COLUMN tour_order_detail.is_deleted IS '是否已删除:0=未删除,1=已删除';
|
||||
|
||||
-- 索引优化
|
||||
-- 1. 关联订单查询 (最常用)
|
||||
CREATE INDEX idx_tod_order_id ON tour_order_detail (order_id);
|
||||
|
||||
-- 2. 用户查询我的订单详情
|
||||
CREATE INDEX idx_tod_user_id ON tour_order_detail (user_id);
|
||||
|
||||
DROP TABLE IF EXISTS common_tour_info;
|
||||
CREATE TABLE common_tour_info
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
user_id int8 NOT NULL, -- 关联系统用户ID
|
||||
id_card_no varchar(20) DEFAULT NULL, -- 身份证号
|
||||
passport_no varchar(30) DEFAULT NULL, -- 护照号码
|
||||
hk_macau_pass_no varchar(20) DEFAULT NULL, -- 港澳通行证号码
|
||||
user_name varchar(50) NOT NULL, -- 姓名
|
||||
gender int4 DEFAULT NULL,
|
||||
contact_phone varchar(20) DEFAULT NULL, -- 本人手机号
|
||||
traveler_type int4 DEFAULT 1, -- 默认人员类型:1=成人,2=儿童,3=老人 (系统可根据生日自动算,但允许用户手动修正)
|
||||
remark varchar(255) DEFAULT NULL, -- 备注 (如:晕车、素食、靠窗座位等偏好)
|
||||
create_user int8 NULL, -- 创建人ID (通常同 user_id)
|
||||
create_dept int8 NULL, -- 创建部门ID (若为B2B2C模式可能需要)
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 修改人ID
|
||||
update_time timestamp(6) NULL, -- 修改时间
|
||||
status int4 NULL DEFAULT 1,
|
||||
is_deleted int4 NOT NULL DEFAULT 0 -- 逻辑删除:0=未删除,1=已删除
|
||||
);
|
||||
|
||||
-- 表注释
|
||||
COMMENT ON TABLE common_tour_info IS '基础出行人档案表';
|
||||
COMMENT ON COLUMN common_tour_info.id IS '主键ID';
|
||||
COMMENT ON COLUMN common_tour_info.user_id IS '关联系统用户ID (所属人)';
|
||||
COMMENT ON COLUMN common_tour_info.id_card_no IS '身份证号';
|
||||
COMMENT ON COLUMN common_tour_info.passport_no IS '护照号码';
|
||||
COMMENT ON COLUMN common_tour_info.hk_macau_pass_no IS '港澳通行证号码';
|
||||
COMMENT ON COLUMN common_tour_info.user_name IS '姓名';
|
||||
COMMENT ON COLUMN common_tour_info.gender IS '性别:1=男,2=女';
|
||||
COMMENT ON COLUMN common_tour_info.contact_phone IS '本人手机号';
|
||||
COMMENT ON COLUMN common_tour_info.traveler_type IS '默认人员类型:1=成人,2=儿童,3=老人';
|
||||
COMMENT ON COLUMN common_tour_info.remark IS '备注偏好';
|
||||
COMMENT ON COLUMN common_tour_info.create_user IS '创建人ID';
|
||||
COMMENT ON COLUMN common_tour_info.create_dept IS '创建部门ID';
|
||||
COMMENT ON COLUMN common_tour_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_tour_info.update_user IS '修改人ID';
|
||||
COMMENT ON COLUMN common_tour_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_tour_info.is_deleted IS '是否已删除:0=未删除,1=已删除';
|
||||
|
||||
|
||||
CREATE INDEX idx_tup_uid ON common_tour_info (user_id);
|
||||
|
||||
|
||||
|
||||
--------------------------------------------- 商品分类 (自营商品 , 生态产品) ---------------------------------------------
|
||||
INSERT INTO mall_category (id, category_name, image_url, pid, level, sort, is_deleted, create_time, create_user, update_time, update_user, status, create_dept) VALUES (2033413707249164290, '自营商品', '', null, 1, 0, 0, '2026-03-16 13:23:01.460000', 1123598821738675201, '2026-03-16 13:23:01.460000', 1123598821738675201, 1, 1123598813738675201);
|
||||
INSERT INTO mall_category (id, category_name, image_url, pid, level, sort, is_deleted, create_time, create_user, update_time, update_user, status, create_dept) VALUES (2033413760969809921, '生态产品', '', null, 1, 0, 0, '2026-03-16 13:23:14.280000', 1123598821738675201, '2026-03-16 13:23:14.280000', 1123598821738675201, 1, 1123598813738675201);
|
||||
|
||||
--------------------------------------------- 系统参数 -app支付宝aesKey ---------------------------------------------
|
||||
INSERT INTO blade_param (id, param_name, param_key, param_value, remark, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2037772595062923266, 'app支付宝aesKey', 'yichuyilu.app.ali.aes.key', 'VS14+f0md0HjJ1D0Wp3Lgw==', 'app支付宝aesKey', null, null, '2026-03-28 14:03:41.282000', null, '2026-03-28 14:03:41.282000', 1, 0);
|
||||
|
||||
--------------------------------------------- 后台菜单 ---------------------------------------------
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2033415593821937665, 1123598815738675201, 'ecosystemProduct', '生态产品', 'menu', '/mall/ecosystemProduct', 'iconfont iconicon_addressbook', 11, 1, -1, 1, '', '', 0);
|
||||
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2033749606692487170, 1123598815738675201, 'merchantFlagshipStore', '商家旗舰店信息', 'menu', '/common/merchantFlagshipStore', 'iconfont iconicon_message', 13, 1, 0, 1, '', '', 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES ('2038120179162013698', '2033749606692487170', 'merchantFlagshipStore_add', '新增', 'add', '/common/merchantFlagshipStore/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 ('2038120179162013699', '2033749606692487170', 'merchantFlagshipStore_edit', '修改', 'edit', '/common/merchantFlagshipStore/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 ('2038120179162013700', '2033749606692487170', 'merchantFlagshipStore_delete', '删除', 'delete', '/api/common/merchant-store/merchantFlagshipStore/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 ('2038120179162013701', '2033749606692487170', 'merchantFlagshipStore_view', '查看', 'view', '/common/merchantFlagshipStore/view', 'file-text', 4, 2, 2, 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 (2033749607145472001, 1123598815738675201, 'culturalTourismSpot', '文旅景点信息', 'menu', '/common/culturalTourismSpot', 'iconfont iconicon_message', 14, 1, 0, 1, '', '', 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES ('2038120179677913091', '2033749607145472001', 'culturalTourismSpot_add', '新增', 'add', '/common/culturalTourismSpot/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 ('2038120179677913092', '2033749607145472001', 'culturalTourismSpot_edit', '修改', 'edit', '/common/culturalTourismSpot/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 ('2038120179677913093', '2033749607145472001', 'culturalTourismSpot_delete', '删除', 'delete', '/api/common/tourism-spot/culturalTourismSpot/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 ('2038120179677913094', '2033749607145472001', 'culturalTourismSpot_view', '查看', 'view', '/common/culturalTourismSpot/view', 'file-text', 4, 2, 2, 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 (2033749607535542273, 1123598815738675201, 'newsCategory', '资讯分类', 'menu', '/common/newsCategory', 'iconfont iconicon_message', 15, 1, 0, 1, '', '', 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES ('2038120180067983362', '2033749607535542273', 'newsCategory_add', '新增', 'add', '/common/newsCategory/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 ('2038120180067983363', '2033749607535542273', 'newsCategory_edit', '修改', 'edit', '/common/newsCategory/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 ('2038120180067983364', '2033749607535542273', 'newsCategory_delete', '删除', 'delete', '/api/common/news-category/newsCategory/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 ('2038120180067983365', '2033749607535542273', 'newsCategory_view', '查看', 'view', '/common/newsCategory/view', 'file-text', 4, 2, 2, 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 (2033749607929806849, 1123598815738675201, 'newsContent', '资讯内容', 'menu', '/common/newsContent', 'iconfont iconicon_message', 15, 1, 0, 1, '', '', 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES ('2038120180458053634', '2033749607929806849', 'newsContent_add', '新增', 'add', '/common/newsContent/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 ('2038120180458053635', '2033749607929806849', 'newsContent_edit', '修改', 'edit', '/common/newsContent/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 ('2038120180458053636', '2033749607929806849', 'newsContent_delete', '删除', 'delete', '/api/common/news-content/newsContent/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 ('2038120180458053637', '2033749607929806849', 'newsContent_view', '查看', 'view', '/common/newsContent/view', 'file-text', 4, 2, 2, 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 (2034868678830284801, 1123598815738675201, 'tourProduct', '旅游团产品', 'menu', '/common/tourProduct', 'iconfont iconicon_addressbook', 16, 1, 0, 1, '', '', 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)VALUES ('2038120180839735298', '2034868678830284801', 'tourProduct_add', '新增', 'add', '/common/tourProduct/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 ('2038120180839735299', '2034868678830284801', 'tourProduct_edit', '修改', 'edit', '/common/tourProduct/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 ('2038120180839735300', '2034868678830284801', 'tourProduct_delete', '删除', 'delete', '/api/common/tour-product/tourProduct/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 ('2038120180839735301', '2034868678830284801', 'tourProduct_view', '查看', 'view', '/common/tourProduct/view', 'file-text', 4, 2, 2, 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 (2034920957235105793, 1123598815738675201, 'commonTourProductOrder', '旅游团订单', 'menu', '/common/commonTourProductOrder', 'iconfont iconicon_addressbook', 17, 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 (2037361283308748801, 1123598815738675201, 'commonEcoOrder', '生态产品订单', 'menu', '/common/commonEcoOrder', 'iconfont iconicon_message', 12, 1, -1, 1, '', '', 0);
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2037414831325212674, 0, 'upgrade', '动态升级', 'upgrade', '/upgrade', 'iconfont iconicon_message', 16, 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 (2037416131144216577, 2037414831325212674, 'marketUpgradeConfig', '用户升级配置', 'menu', '/market/marketUpgradeConfig', 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, remark, is_deleted)VALUES ('2038120182441959427', '2037416131144216577', 'marketUpgradeConfig_add', '新增', 'add', '/market/marketUpgradeConfig/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 ('2038120182441959428', '2037416131144216577', 'marketUpgradeConfig_edit', '修改', 'edit', '/market/marketUpgradeConfig/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 ('2038120182441959429', '2037416131144216577', 'marketUpgradeConfig_delete', '删除', 'delete', '/api/market/upgrade-config/marketUpgradeConfig/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 ('2038120182441959430', '2037416131144216577', 'marketUpgradeConfig_view', '查看', 'view', '/market/marketUpgradeConfig/view', 'file-text', 4, 2, 2, 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 (2037416131601395714, 2037414831325212674, 'marketUpgradeCashLog', '用户现金升级日志', 'menu', '/market/marketUpgradeCashLog', 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 (2037416131991465985, 2037414831325212674, 'marketUpgradeWelfareLog', '用户福利包升级日志', 'menu', '/market/marketUpgradeWelfareLog', 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 (2037416132381536257, 2037414831325212674, 'marketCashPerformanceLog', '现金业绩日志', 'menu', '/market/marketCashPerformanceLog', 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 (2037416132771606529, 2037414831325212674, 'marketWelfarePerformanceLog', '福利包业绩日志', 'menu', '/market/marketWelfarePerformanceLog', null, 5, 1, 0, 1, null, null, 0);
|
||||
|
||||
129
doc/sql/executed/20260401_increase.sql
Normal file
129
doc/sql/executed/20260401_increase.sql
Normal file
@@ -0,0 +1,129 @@
|
||||
DROP TABLE IF EXISTS release_version CASCADE;
|
||||
CREATE TABLE release_version
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||
version_code int8 NULL, -- 内部版本号 (如: 10023)
|
||||
version_name varchar(50) NOT NULL, -- 版本显示名称 (如: 1.2.3)
|
||||
app_type int4 NOT NULL, -- 应用类型: 1-app, 2-market
|
||||
channel_code varchar(20) NOT NULL, -- 渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official
|
||||
package_type int4 NOT NULL, -- 包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)
|
||||
is_force_update int4 NOT NULL, -- 是否强制更新: 0-否, 1-是
|
||||
download_url varchar(255) NULL, -- 下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)
|
||||
update_content text NOT NULL, -- 更新日志内容
|
||||
privacy_agreement_url varchar(255) NULL, -- 隐私协议地址
|
||||
user_agreement_url varchar(255) NULL, -- 用户协议地址
|
||||
create_user int8 NULL, -- 创建人ID
|
||||
create_dept int8 NULL, -- 创建部门ID
|
||||
create_time timestamp(6) NULL, -- 创建时间
|
||||
update_user int8 NULL, -- 更新人ID
|
||||
update_time timestamp(6) NULL, -- 更新时间
|
||||
status int4 NULL, -- 上架状态: 1-启用, 2-已上架, 3-已过期
|
||||
is_deleted int4 DEFAULT 0 -- 逻辑删除标识
|
||||
);
|
||||
|
||||
-- 索引顺序:app_type -> channel_code -> status -> version_code (降序)
|
||||
CREATE INDEX idx_app_channel_version ON release_version (app_type, channel_code, status, version_name DESC);
|
||||
|
||||
-- 后台管理系统页面索引
|
||||
CREATE INDEX CONCURRENTLY idx_release_version_active_semver
|
||||
ON release_version (
|
||||
(string_to_array(version_name, '.')::int[]) DESC,
|
||||
app_type,
|
||||
id DESC
|
||||
)
|
||||
WHERE is_deleted = 0
|
||||
AND version_name ~ '^\d+\.\d+\.\d+$';
|
||||
|
||||
-- 添加表注释
|
||||
COMMENT ON TABLE release_version IS 'APP版本发布管理表';
|
||||
|
||||
-- 添加字段注释 (双注释)
|
||||
COMMENT ON COLUMN release_version.id IS '主键ID';
|
||||
COMMENT ON COLUMN release_version.version_code IS '内部版本号 (如: 10023)';
|
||||
COMMENT ON COLUMN release_version.version_name IS '版本显示名称 (如: 1.2.3)';
|
||||
COMMENT ON COLUMN release_version.app_type IS '应用类型: 1-app, 2-market';
|
||||
COMMENT ON COLUMN release_version.channel_code IS '渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official';
|
||||
COMMENT ON COLUMN release_version.package_type IS '包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)';
|
||||
COMMENT ON COLUMN release_version.is_force_update IS '是否强制更新: 0-否, 1-是';
|
||||
COMMENT ON COLUMN release_version.download_url IS '下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)';
|
||||
COMMENT ON COLUMN release_version.update_content IS '更新日志内容';
|
||||
COMMENT ON COLUMN release_version.privacy_agreement_url IS '隐私协议地址';
|
||||
COMMENT ON COLUMN release_version.user_agreement_url IS '用户协议地址';
|
||||
COMMENT ON COLUMN release_version.create_user IS '创建人ID';
|
||||
COMMENT ON COLUMN release_version.create_dept IS '创建部门ID';
|
||||
COMMENT ON COLUMN release_version.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN release_version.update_user IS '更新人ID';
|
||||
COMMENT ON COLUMN release_version.update_time IS '更新时间';
|
||||
COMMENT ON COLUMN release_version.status IS '上架状态: 1-启用, 2-已上架, 3-已过期';
|
||||
COMMENT ON COLUMN release_version.is_deleted IS '逻辑删除标识';
|
||||
|
||||
|
||||
---------------------------------------------------- 后台菜单 ----------------------------------------------------
|
||||
INSERT INTO public.blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open,
|
||||
component, remark, is_deleted)
|
||||
VALUES (2039320381549809665, 1123598815738675201, 'commonReleaseversion', 'APP版本发布管理', 'menu',
|
||||
'/common/commonReleaseversion', null, 18, 1, 0, 1, null, null, 0);
|
||||
INSERT INTO public.blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open,
|
||||
component, remark, is_deleted)
|
||||
VALUES (2039320381549809666, 2039320381549809665, 'commonReleaseversion_add', '新增', 'add',
|
||||
'/common/commonReleaseversion/add', 'plus', 1, 2, 1, 1, null, null, 0);
|
||||
INSERT INTO public.blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open,
|
||||
component, remark, is_deleted)
|
||||
VALUES (2039320381549809667, 2039320381549809665, 'commonReleaseversion_edit', '修改', 'edit',
|
||||
'/common/commonReleaseversion/edit', 'form', 2, 2, 2, 1, null, null, 0);
|
||||
INSERT INTO public.blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open,
|
||||
component, remark, is_deleted)
|
||||
VALUES (2039320381549809668, 2039320381549809665, 'commonReleaseversion_delete', '删除', 'delete',
|
||||
'/api/common/release-version/remove', 'delete', 3, 2, 3, 1, null, null, 0);
|
||||
INSERT INTO public.blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open,
|
||||
component, remark, is_deleted)
|
||||
VALUES (2039320381549809669, 2039320381549809665, 'commonReleaseversion_view', '查看', 'view',
|
||||
'/common/commonReleaseversion/view', 'file-text', 4, 2, 2, 1, null, null, 0);
|
||||
|
||||
---------------------------------------------------- 后台配置字典 ----------------------------------------------------
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323244292325377, 0, 'release_version_app_type', '-1', 'app版本控制应用类型', 36, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323352345985025, 2039323244292325377, 'release_version_app_type', '1', 'app', 1, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323392959430658, 2039323244292325377, 'release_version_app_type', '2', 'market', 2, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323732928741377, 0, 'release_version_channel_code', '-1', 'app版本控制渠道标识', 37, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323787798626306, 2039323732928741377, 'release_version_channel_code', 'xiaomi', '小米', 1, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323843163439106, 2039323732928741377, 'release_version_channel_code', 'huawei', '华为', 2, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323945001140225, 2039323732928741377, 'release_version_channel_code', 'honor', '荣耀', 3, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039323976445837313, 2039323732928741377, 'release_version_channel_code', 'oppo', 'oppo', 4, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039324008939110402, 2039323732928741377, 'release_version_channel_code', 'vivo', 'vivo', 5, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039324063599280129, 2039323732928741377, 'release_version_channel_code', 'apple', '苹果', 6, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039324159019696129, 2039323732928741377, 'release_version_channel_code', 'qihoo', '360手机助手', 7, '', 0, 1,
|
||||
0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039324367988310017, 2039323732928741377, 'release_version_channel_code', 'yingyongbao', '应用宝', 8, '', 0, 1,
|
||||
0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039324445138337793, 2039323732928741377, 'release_version_channel_code', 'pgyer', '蒲公英', 9, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039324932638097409, 2039323732928741377, 'release_version_channel_code', 'official', 'OSS/官网', 10, '', 0, 1,
|
||||
0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039325301409693698, 0, 'release_version_pack_type', '-1', 'app版本控制包类型', 38, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039325347425402882, 2039325301409693698, 'release_version_pack_type', '1', '应用市场包', 1, '', 0, 1, 0);
|
||||
INSERT INTO public.blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||
VALUES (2039325387288068097, 2039325301409693698, 'release_version_pack_type', '2', 'OSS直连包', 2, '', 0, 1, 0);
|
||||
|
||||
INSERT INTO public.blade_dict ("id","parent_id","code","dict_key","dict_value","sort","remark","is_sealed","status","is_deleted")
|
||||
VALUES (2040296637950734337,2040296304709087233,'release_version_status','3','已过期',3,'',0,1,0);
|
||||
INSERT INTO public.blade_dict ("id","parent_id","code","dict_key","dict_value","sort","remark","is_sealed","status","is_deleted")
|
||||
VALUES (2040296582749499393,2040296304709087233,'release_version_status','2','已上架',2,'',0,1,0);
|
||||
INSERT INTO public.blade_dict ("id","parent_id","code","dict_key","dict_value","sort","remark","is_sealed","status","is_deleted")
|
||||
VALUES (2040296549660635138,2040296304709087233,'release_version_status','1','已启用',1,'',0,1,0);
|
||||
INSERT INTO public.blade_dict ("id","parent_id","code","dict_key","dict_value","sort","remark","is_sealed","status","is_deleted")
|
||||
VALUES (2040296304709087233,0,'release_version_status','-1','app版本控制上架状态',39,'',0,1,0);
|
||||
5
doc/sql/executed/blade_menu_userNotice.sql
Normal file
5
doc/sql/executed/blade_menu_userNotice.sql
Normal 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);
|
||||
38
doc/sql/executed/market_packageInfo_menu.sql
Normal file
38
doc/sql/executed/market_packageInfo_menu.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2016446332399943682, 0, 'userPackInfo', '福利包管理', 'menu', '/userPackInfo', 'iconfont iconicon_principal', 13, 1, -1, 1, '', '', 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878402', '2016446332399943682', 'userMarketBenefitPackage', '用户福利包信息', 'menu', '/userPackage/userMarketBenefitPackage', NULL, 2, 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 ('2019438517579878403', '2019438517579878402', 'userMarketBenefitPackage_add', '新增', 'add', '/userPackage/userMarketBenefitPackage/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 ('2019438517579878404', '2019438517579878402', 'userMarketBenefitPackage_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackage/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 ('2019438517579878405', '2019438517579878402', 'userMarketBenefitPackage_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackage/userMarketBenefitPackage/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 ('2019438517579878406', '2019438517579878402', 'userMarketBenefitPackage_view', '查看', 'view', '/userPackage/userMarketBenefitPackage/view', 'file-text', 4, 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 ('2019438517974142978', '2016446332399943682', 'userMarketBenefitPackageLog', '划拨福利包记录', 'menu', '/userPackage/userMarketBenefitPackageLog', NULL, 3, 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 ('2019438517974142979', '2019438517974142978', 'userMarketBenefitPackageLog_add', '新增', 'add', '/userPackage/userMarketBenefitPackageLog/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 ('2019438517974142980', '2019438517974142978', 'userMarketBenefitPackageLog_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageLog/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 ('2019438517974142981', '2019438517974142978', 'userMarketBenefitPackageLog_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagelog/userMarketBenefitPackageLog/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 ('2019438517974142982', '2019438517974142978', 'userMarketBenefitPackageLog_view', '查看', 'view', '/userPackage/userMarketBenefitPackageLog/view', 'file-text', 4, 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 ('2019438517080756225', '2016446332399943682', 'userMarketBenefitPackageTemplate', '福利包信息', 'menu', '/userPackage/userMarketBenefitPackageTemplate', 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 ('2019438517080756226', '2019438517080756225', 'userMarketBenefitPackageTemplate_add', '新增', 'add', '/userPackage/userMarketBenefitPackageTemplate/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 ('2019438517080756227', '2019438517080756225', 'userMarketBenefitPackageTemplate_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageTemplate/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 ('2019438517080756228', '2019438517080756225', 'userMarketBenefitPackageTemplate_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagetemplate/userMarketBenefitPackageTemplate/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 ('2019438517080756229', '2019438517080756225', 'userMarketBenefitPackageTemplate_view', '查看', 'view', '/userPackage/userMarketBenefitPackageTemplate/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
10
doc/sql/executed/order.menu.sql
Normal file
10
doc/sql/executed/order.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781314', '1123598815738675201', 'order', '用户订单', 'menu', '/common/order', 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 ('2019446499472781315', '2019446499472781314', 'order_add', '新增', 'add', '/common/order/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 ('2019446499472781316', '2019446499472781314', 'order_edit', '修改', 'edit', '/common/order/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 ('2019446499472781317', '2019446499472781314', 'order_delete', '删除', 'delete', '/api/user-order/order/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 ('2019446499472781318', '2019446499472781314', 'order_view', '查看', 'view', '/common/order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
3
doc/sql/executed/user_order_update.sql
Normal file
3
doc/sql/executed/user_order_update.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
CREATE INDEX idx_user_order_search ON user_order (payment_status, order_status, payment_type, create_time);
|
||||
|
||||
update user_order set payment_status = 0 , order_status = 0 where payment_status = 2 and order_status = 5 and payment_type = 99;
|
||||
@@ -1,270 +0,0 @@
|
||||
------------------user_market_info common_user_address common_regions_info mall_product mall_category-------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
create table user_market_info
|
||||
(
|
||||
id int8 not null primary key, --user_id
|
||||
pid int8,
|
||||
has_synchronized int4 default 0, --是否同步
|
||||
vendor int4 default 0, -- 是否成为服务商 0-否 1-是
|
||||
e_signed int4 default 0, -- 是否已经签署电子合同 0-否 1-是
|
||||
e_signed_url text, -- 电子合同地址
|
||||
verified int4 default 0, -- 是否实名用户 0-否 1-是
|
||||
verified_date timestamp(6), -- 实名时间
|
||||
real_name varchar(128), -- 实名姓名
|
||||
id_card varchar(128), -- 实名身份证
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_user_market_pid ON user_market_info (pid) WHERE status = 1;
|
||||
|
||||
|
||||
comment on table user_market_info is '用户拓展信息表';
|
||||
comment on column user_market_info.id is '主键';
|
||||
comment on column user_market_info.pid is '邀请人';
|
||||
comment on column user_market_info.synchronized is '是否同步族谱 0-否 1-是';
|
||||
comment on column user_market_info.vendor is '是否成为服务商 0-否 1-是';
|
||||
comment on column user_market_info.e_signed is '是否签署法大大协议 0-否 1-是';
|
||||
comment on column user_market_info.e_signed_url is '电子合同地址';
|
||||
comment on column user_market_info.verified is '是否实名用户 0-否 1-是';
|
||||
comment on column user_market_info.verified_date is '实名时间';
|
||||
comment on column user_market_info.real_name is '实名姓名';
|
||||
comment on column user_market_info.id_card is '实名身份证';
|
||||
comment on column user_market_info.create_user is '创建人';
|
||||
comment on column user_market_info.create_dept is '创建部门';
|
||||
comment on column user_market_info.create_time is '创建时间';
|
||||
comment on column user_market_info.update_user is '修改人';
|
||||
comment on column user_market_info.update_time is '修改时间';
|
||||
comment on column user_market_info.status is '状态';
|
||||
comment on column user_market_info.is_deleted is '是否已删除';
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976193', '1123598815738675201', 'marketInfo', '用户拓展信息表', 'menu', '/market/marketInfo',
|
||||
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 ('2019319816467976194', '2019319816467976193', 'marketInfo_add', '新增', 'add', '/market/marketInfo/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 ('2019319816467976195', '2019319816467976193', 'marketInfo_edit', '修改', 'edit', '/market/marketInfo/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 ('2019319816467976196', '2019319816467976193', 'marketInfo_delete', '删除', 'delete',
|
||||
'/api/blade-marketinfo/marketInfo/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 ('2019319816467976197', '2019319816467976193', 'marketInfo_view', '查看', 'view', '/market/marketInfo/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
CREATE TABLE common_user_address
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
regions_id int8 NOT NULL,
|
||||
province VARCHAR(200) NULL,
|
||||
city VARCHAR(200) NULL,
|
||||
district VARCHAR(200) NULL,
|
||||
street VARCHAR(200) NULL,
|
||||
detail VARCHAR(500) NULL,
|
||||
consignee VARCHAR(200) NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
is_default int4 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_user_address IS '用户地址表';
|
||||
COMMENT ON COLUMN common_user_address.id IS '主键';
|
||||
COMMENT ON COLUMN common_user_address.user_id IS '用户id';
|
||||
COMMENT ON COLUMN common_user_address.regions_id IS '地区信息id';
|
||||
COMMENT ON COLUMN common_user_address.province IS '省份';
|
||||
COMMENT ON COLUMN common_user_address.city IS '城市';
|
||||
COMMENT ON COLUMN common_user_address.district IS '区县';
|
||||
COMMENT ON COLUMN common_user_address.street IS '街道';
|
||||
COMMENT ON COLUMN common_user_address.detail IS '详细地址';
|
||||
COMMENT ON COLUMN common_user_address.consignee IS '收货人';
|
||||
COMMENT ON COLUMN common_user_address.phone IS '联系电话';
|
||||
COMMENT ON COLUMN common_user_address.is_default IS '是否默认地址(0=否,1=是)';
|
||||
COMMENT ON COLUMN common_user_address.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_user_address.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_user_address.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_user_address.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_user_address.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_user_address.status IS '状态';
|
||||
COMMENT ON COLUMN common_user_address.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_user_address_user_id ON common_user_address (user_id);
|
||||
CREATE INDEX idx_user_address_regions_id ON common_user_address (regions_id);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
CREATE TABLE common_regions_info
|
||||
(
|
||||
id int4 PRIMARY KEY,
|
||||
name VARCHAR(50) NULL,
|
||||
level int4 NULL,
|
||||
pid int4 DEFAULT 0 NULL,
|
||||
coordinates point,
|
||||
region_code VARCHAR(128) NULL,
|
||||
full_name VARCHAR(500) NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_regions_info IS '地区详情表';
|
||||
COMMENT ON COLUMN common_regions_info.id IS '主键';
|
||||
COMMENT ON COLUMN common_regions_info.name IS '名称';
|
||||
COMMENT ON COLUMN common_regions_info.level IS '层级';
|
||||
COMMENT ON COLUMN common_regions_info.pid IS '父主键';
|
||||
COMMENT ON COLUMN common_regions_info.coordinates IS '坐标';
|
||||
COMMENT ON COLUMN common_regions_info.region_code IS '地区编码';
|
||||
COMMENT ON COLUMN common_regions_info.full_name IS '全称';
|
||||
COMMENT ON COLUMN common_regions_info.is_deleted IS '是否删除';
|
||||
COMMENT ON COLUMN common_regions_info.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_regions_info.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_regions_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_regions_info.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_regions_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_regions_info.status IS '状态';
|
||||
|
||||
CREATE INDEX idx_regions_pid ON common_regions_info (pid);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE mall_product
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
serial_number VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
product_name VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
main_image_urls text[] DEFAULT '{}' NOT NULL,
|
||||
detail_image_urls text[] DEFAULT '{}' NULL,
|
||||
thumb_image_url text NULL,
|
||||
specs JSONB DEFAULT '[]',
|
||||
unit VARCHAR(12),
|
||||
category_id int8 DEFAULT 0 NOT NULL,
|
||||
category_path int8[] DEFAULT '{}' NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
retail_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
freight DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
sales int4 DEFAULT 0 NOT NULL,
|
||||
stock int4 DEFAULT 0 NOT NULL,
|
||||
tags JSONB DEFAULT '[]' NOT NULL,
|
||||
status int4 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_product IS '商城商品';
|
||||
COMMENT ON COLUMN mall_product.id IS '主键';
|
||||
COMMENT ON COLUMN mall_product.serial_number IS '商品编码';
|
||||
COMMENT ON COLUMN mall_product.product_name IS '商品名称';
|
||||
COMMENT ON COLUMN mall_product.main_image_urls IS '主图';
|
||||
COMMENT ON COLUMN mall_product.detail_image_urls IS '详情图';
|
||||
COMMENT ON COLUMN mall_product.thumb_image_url IS '缩略图';
|
||||
COMMENT ON COLUMN mall_product.specs IS '规格详情,JSONB数组 [{"attr":"颜色","value":"红"}]';
|
||||
COMMENT ON COLUMN mall_product.unit IS '单位';
|
||||
COMMENT ON COLUMN mall_product.category_id IS '分类';
|
||||
COMMENT ON COLUMN mall_product.category_path IS '分类路径ID数组,如 [1,5,23]';
|
||||
COMMENT ON COLUMN mall_product.original_price IS '原价';
|
||||
COMMENT ON COLUMN mall_product.retail_price IS '销售价';
|
||||
COMMENT ON COLUMN mall_product.freight IS '运费';
|
||||
COMMENT ON COLUMN mall_product.sales IS '销量';
|
||||
COMMENT ON COLUMN mall_product.stock IS '库存';
|
||||
COMMENT ON COLUMN mall_product.tags IS '标签列表,JSONB数组格式,如 ["热销","包邮"]';
|
||||
COMMENT ON COLUMN mall_product.status IS '状态(0=下架,1=上架)';
|
||||
COMMENT ON COLUMN mall_product.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_product.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN mall_product.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_product.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_product.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_product.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_product_category ON mall_product (category_id);
|
||||
CREATE INDEX idx_product_status ON mall_product (status) WHERE is_deleted = 0;
|
||||
CREATE INDEX idx_product_tags ON mall_product USING GIN (tags);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061775732737', '2016445919294554113', 'mallProduct', '商城商品', 'menu', '/mall/mallProduct', 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 ('2019341061775732738', '2019341061775732737', 'mallProduct_add', '新增', 'add', '/mall/mallProduct/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 ('2019341061775732739', '2019341061775732737', 'mallProduct_edit', '修改', 'edit', '/mall/mallProduct/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 ('2019341061775732740', '2019341061775732737', 'mallProduct_delete', '删除', 'delete', '/api/blade-mallproduct/mallProduct/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 ('2019341061775732741', '2019341061775732737', 'mallProduct_view', '查看', 'view', '/mall/mallProduct/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE mall_category
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
category_name VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
image_url VARCHAR(200) NULL,
|
||||
pid int8 NULL,
|
||||
level int4 DEFAULT 0 NOT NULL,
|
||||
sort INT4 DEFAULT 0 NOT NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 DEFAULT 1 NOT NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE mall_category IS '商品分类(支持三级树形结构)';
|
||||
COMMENT ON COLUMN mall_category.id IS '主键';
|
||||
COMMENT ON COLUMN mall_category.category_name IS '分类名称';
|
||||
COMMENT ON COLUMN mall_category.image_url IS '图片';
|
||||
COMMENT ON COLUMN mall_category.pid IS '父分类ID,NULL 表示顶级分类';
|
||||
COMMENT ON COLUMN mall_category.level IS '层级:1-一级分类,2-二级分类,3-三级分类';
|
||||
COMMENT ON COLUMN mall_category.sort IS '排序值,越小越靠前';
|
||||
COMMENT ON COLUMN mall_category.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_category.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_category.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_category.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_category.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_category.status IS '状态:1-启用,2-禁用';
|
||||
COMMENT ON COLUMN mall_category.create_dept IS '创建部门';
|
||||
|
||||
CREATE INDEX idx_category_pid ON mall_category (pid);
|
||||
CREATE INDEX idx_category_sort ON mall_category(sort);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061003980801', '2016445919294554113', 'mallCategory', '商品分类', 'menu', '/mall/mallCategory', 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 ('2019341061003980802', '2019341061003980801', 'mallCategory_add', '新增', 'add', '/mall/mallCategory/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 ('2019341061003980803', '2019341061003980801', 'mallCategory_edit', '修改', 'edit', '/mall/mallCategory/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 ('2019341061003980804', '2019341061003980801', 'mallCategory_delete', '删除', 'delete', '/api/blade-mallcategory/mallCategory/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 ('2019341061003980805', '2019341061003980801', 'mallCategory_view', '查看', 'view', '/mall/mallCategory/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
53
pom.xml
53
pom.xml
@@ -277,6 +277,59 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.locationtech.jts</groupId>
|
||||
<artifactId>jts-core</artifactId>
|
||||
<version>1.19.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--blade-pay插件相关-->
|
||||
<dependency>
|
||||
<groupId>com.github.javen205</groupId>
|
||||
<artifactId>IJPay-WxPay</artifactId>
|
||||
<version>2.9.12</version>
|
||||
</dependency>
|
||||
<!--blade-pay插件相关 二维码生成-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-extra</artifactId>
|
||||
<version>5.8.29</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--支付宝SDK-->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.39.134.ALL</version>
|
||||
</dependency>
|
||||
|
||||
<!--YunGouOS聚合支付相关-->
|
||||
<dependency>
|
||||
<groupId>com.yungouos.pay</groupId>
|
||||
<artifactId>yungouos-pay-sdk</artifactId>
|
||||
<version>2.0.38</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Source: https://mvnrepository.com/artifact/org.semver4j/semver4j -->
|
||||
<dependency>
|
||||
<groupId>org.semver4j</groupId>
|
||||
<artifactId>semver4j</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -28,6 +28,8 @@ package org.springblade;
|
||||
import org.springblade.common.constant.CommonConstant;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
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 +41,8 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
|
||||
@EnableScheduling
|
||||
@EnableRedisHttpSession
|
||||
@SpringBootApplication
|
||||
@EnableRetry //重试机制
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
33
src/main/java/org/springblade/common/cache/PaymentCache.java
vendored
Normal file
33
src/main/java/org/springblade/common/cache/PaymentCache.java
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package org.springblade.common.cache;
|
||||
|
||||
import org.springblade.core.cache.utils.CacheUtil;
|
||||
import org.springblade.core.tool.utils.SpringUtil;
|
||||
import org.springblade.modules.common.eums.PaymentType;
|
||||
import org.springblade.plugin.pay.entity.AliPayAccountConfig;
|
||||
import org.springblade.plugin.pay.entity.WxPayAccountConfig;
|
||||
import org.springblade.plugin.pay.service.IAliPayAccountConfigService;
|
||||
import org.springblade.plugin.pay.service.IWxPayAccountConfigService;
|
||||
|
||||
import static org.springblade.plugin.pay.constant.PayConstant.PAYMENT_CONFIG_CACHE;
|
||||
|
||||
public class PaymentCache {
|
||||
|
||||
private static final String PAYMENT_TYPE = "payment:type:";
|
||||
|
||||
private static final IAliPayAccountConfigService alipayAccountConfigService;
|
||||
|
||||
private static final IWxPayAccountConfigService wxpayAccountConfigService;
|
||||
|
||||
static {
|
||||
alipayAccountConfigService = SpringUtil.getBean(IAliPayAccountConfigService.class);
|
||||
wxpayAccountConfigService = SpringUtil.getBean(IWxPayAccountConfigService.class);
|
||||
}
|
||||
|
||||
public static AliPayAccountConfig getAliConfig() {
|
||||
return CacheUtil.get(PAYMENT_CONFIG_CACHE, PAYMENT_TYPE, PaymentType.ALI.getCode(), alipayAccountConfigService::getDefault);
|
||||
}
|
||||
|
||||
public static WxPayAccountConfig getWxConfig() {
|
||||
return CacheUtil.get(PAYMENT_CONFIG_CACHE, PAYMENT_TYPE, PaymentType.WECHAT.getCode(), wxpayAccountConfigService::getDefault);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.springblade.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class AsyncConfiguration {
|
||||
|
||||
|
||||
// 通知类:短信、邮件、站内信
|
||||
@Bean("notificationExecutor")
|
||||
public ThreadPoolTaskExecutor notificationExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(6);
|
||||
executor.setMaxPoolSize(12);
|
||||
executor.setQueueCapacity(200);
|
||||
executor.setThreadNamePrefix("notify-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean("paymentAsyncExecutor")
|
||||
public ThreadPoolTaskExecutor paymentAsyncExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(6);
|
||||
executor.setMaxPoolSize(12);
|
||||
executor.setQueueCapacity(200);
|
||||
executor.setThreadNamePrefix("pay-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
@Bean("statsCommissionAsyncExecutor")
|
||||
public ThreadPoolTaskExecutor statsCommissionAsyncExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(6);
|
||||
executor.setMaxPoolSize(12);
|
||||
executor.setQueueCapacity(200);
|
||||
executor.setThreadNamePrefix("stats-commission-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.springblade.common.exception;
|
||||
|
||||
public class OptimisticLockException extends RuntimeException{
|
||||
public OptimisticLockException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.springblade.common.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
import org.postgresql.util.PGobject;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用于 PostgreSQL JSONB 与 Java 对象(如 List<Map>、Map 等)的双向转换
|
||||
*/
|
||||
@MappedJdbcTypes(JdbcType.OTHER)
|
||||
@MappedTypes({List.class, Map.class})
|
||||
public class PgJsonbTypeHandler extends BaseTypeHandler<Object> {
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
|
||||
PGobject jsonObject = new PGobject();
|
||||
jsonObject.setType("jsonb");
|
||||
try {
|
||||
jsonObject.setValue(objectMapper.writeValueAsString(parameter));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new SQLException("Error converting object to JSON", e);
|
||||
}
|
||||
ps.setObject(i, jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return parseJson(rs.getString(columnName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return parseJson(rs.getString(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return parseJson(cs.getString(columnIndex));
|
||||
}
|
||||
|
||||
private Object parseJson(String json) throws SQLException {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// 根据实际泛型类型反序列化(此处简化为返回 Object)
|
||||
// 更精确的做法是使用 ParameterizedType,但 MyBatis 不支持泛型擦除后的还原
|
||||
// 所以通常在 Service 层做二次转换,或使用 JsonNode
|
||||
return objectMapper.readValue(json, Object.class);
|
||||
} catch (Exception e) {
|
||||
throw new SQLException("Error parsing JSON", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.springblade.common.handler;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.locationtech.jts.io.ParseException;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
@MappedJdbcTypes(JdbcType.OTHER) // 对应 PG 的 point 类型
|
||||
@MappedTypes(Point.class)
|
||||
public class PgJtsPointTypeHandler extends BaseTypeHandler<Point> {
|
||||
|
||||
private static final GeometryFactory FACTORY = new GeometryFactory();
|
||||
private static final WKTReader WKT_READER = new WKTReader(FACTORY);
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Point parameter, JdbcType jdbcType) throws SQLException {
|
||||
if (parameter == null) {
|
||||
ps.setNull(i, java.sql.Types.OTHER);
|
||||
return;
|
||||
}
|
||||
|
||||
double x = parameter.getX(); // 经度
|
||||
double y = parameter.getY(); // 纬度
|
||||
|
||||
// 【修正】使用 WKT 格式:POINT(经度 纬度)
|
||||
// 注意:中间是空格,不是逗号;必须有 POINT 前缀
|
||||
String wkt = String.format("POINT(%f %f)", x, y);
|
||||
|
||||
// 打印日志方便调试(可选)
|
||||
// System.out.println("Inserting WKT: " + wkt);
|
||||
|
||||
// 将 WKT 字符串传入,PostGIS 会自动识别并转换
|
||||
ps.setObject(i, wkt, java.sql.Types.OTHER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
// 关键:获取字符串并解析
|
||||
return parse(rs.getString(columnName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return parse(rs.getString(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return parse(cs.getString(columnIndex));
|
||||
}
|
||||
|
||||
private Point parse(String value) throws SQLException {
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 1. 尝试直接作为 WKT 解析 (兼容 "POINT(x y)")
|
||||
try {
|
||||
return (Point) WKT_READER.read(value);
|
||||
} catch (ParseException e) {
|
||||
// 2. 如果失败,尝试解析 PG 原生格式 "(x,y)"
|
||||
// PG 原生格式不是标准 WKT,WKTReader 会报错,进入这里
|
||||
if (value.startsWith("(") && value.endsWith(")")) {
|
||||
try {
|
||||
String content = value.substring(1, value.length() - 1);
|
||||
String[] parts = content.split(",");
|
||||
if (parts.length == 2) {
|
||||
double x = Double.parseDouble(parts[0].trim());
|
||||
double y = Double.parseDouble(parts[1].trim());
|
||||
return FACTORY.createPoint(new Coordinate(x, y));
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new SQLException("Invalid Point format: " + value, ex);
|
||||
}
|
||||
}
|
||||
throw new SQLException("Failed to parse Point: " + value, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
|
||||
@MappedJdbcTypes(JdbcType.ARRAY)
|
||||
@MappedTypes(List.class)
|
||||
public class PgBigIntArrayToListTypeHandler extends BaseTypeHandler<List<Long>> {
|
||||
public class PgLongArrayToListTypeHandler extends BaseTypeHandler<List<Long>> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<Long> parameter, JdbcType jdbcType) throws SQLException {
|
||||
@@ -7,6 +7,7 @@ import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -16,17 +17,15 @@ public class PgStringArrayToListTypeHandler extends BaseTypeHandler<List<String>
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<String> parameter, JdbcType jdbcType) throws SQLException {
|
||||
if (parameter == null || parameter.isEmpty()) {
|
||||
ps.setNull(i, Types.ARRAY);
|
||||
} else {
|
||||
Array array = ps.getConnection().createArrayOf("TEXT", parameter.toArray());
|
||||
Array array = ps.getConnection().createArrayOf("text", parameter.toArray());
|
||||
ps.setArray(i, array);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return parseArray(rs.getArray(columnName));
|
||||
Array array = rs.getArray(columnName);
|
||||
if (array == null) return Collections.emptyList(); // 返回空列表而非 null
|
||||
return Arrays.asList((String[]) array.getArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.springblade.common.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class IdCardValidatorUtil {
|
||||
|
||||
private static final Pattern REGEX_18 = Pattern.compile("^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[\\dXx]$");
|
||||
|
||||
// 加权因子
|
||||
private static final int[] WEIGHTS = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
|
||||
// 校验码映射
|
||||
private static final String[] CHECK_CODES = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"};
|
||||
|
||||
public static Boolean validateIdCard(String idCard) {
|
||||
if (StringUtils.isBlank(idCard)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1. 格式初筛 (15位直接淘汰,只留18位)
|
||||
if (!REGEX_18.matcher(idCard).matches()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. 核心算法校验 (校验最后一位是否正确)
|
||||
return verifyCheckSum(idCard.toUpperCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* ISO 7064:1983.MOD 11-2 校验算法
|
||||
*/
|
||||
private static boolean verifyCheckSum(String idCard) {
|
||||
int sum = 0;
|
||||
// 只取前17位进行计算
|
||||
for (int i = 0; i < 17; i++) {
|
||||
int digit = Character.getNumericValue(idCard.charAt(i));
|
||||
if (digit < 0 || digit > 9) {
|
||||
return false;
|
||||
}
|
||||
sum += digit * WEIGHTS[i];
|
||||
}
|
||||
|
||||
int mod = sum % 11;
|
||||
String expectedCheckCode = CHECK_CODES[mod];
|
||||
String actualCheckCode = String.valueOf(idCard.charAt(17));
|
||||
|
||||
return expectedCheckCode.equals(actualCheckCode);
|
||||
}
|
||||
|
||||
}
|
||||
437
src/main/java/org/springblade/common/utils/date/DateUtil.java
Normal file
437
src/main/java/org/springblade/common/utils/date/DateUtil.java
Normal file
@@ -0,0 +1,437 @@
|
||||
package org.springblade.common.utils.date;
|
||||
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class DateUtil {
|
||||
|
||||
private static final ThreadLocal<SimpleDateFormat> SIMPLE_DAY = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd"));
|
||||
private static final ThreadLocal<SimpleDateFormat> SIMPLE_DATE_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
public static final ThreadLocal<DateTimeFormatter> THREAD_LOCAL_FORMAT = ThreadLocal.withInitial(() -> DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA));
|
||||
|
||||
|
||||
/**
|
||||
* 计算天数
|
||||
*
|
||||
* @param beginDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
*/
|
||||
public static Integer getDaySub(Date beginDate, Date endDate) {
|
||||
try {
|
||||
SimpleDateFormat sdf = SIMPLE_DAY.get();
|
||||
Date start = sdf.parse(sdf.format(beginDate));
|
||||
Date end = sdf.parse(sdf.format(endDate));
|
||||
return Math.toIntExact((end.getTime() - start.getTime()) / (24 * 60 * 60 * 1000));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Date geFirstDayOfThisMonth() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取本月最后一天
|
||||
*/
|
||||
public static Date geLastDayOfThisMonth() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
cal.roll(Calendar.DAY_OF_MONTH, -1);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
public static Date getThirtyMinuteLate() {
|
||||
Calendar now = Calendar.getInstance();
|
||||
now.add(Calendar.MINUTE, 30);
|
||||
return now.getTime();
|
||||
}
|
||||
|
||||
public static Date getSecondsLate(Date date, int seconds) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.SECOND, seconds);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getMinutesLate(Date date, int minutes) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.MINUTE, minutes);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getHoursLate(Date date, int hours) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.HOUR, hours);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getDaysLate(Date date, int days) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.DAY_OF_MONTH, days);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthsLate(Date date, int months) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.MONTH, months);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getZeroTime(Date date) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.set(Calendar.HOUR_OF_DAY, 0);
|
||||
result.set(Calendar.MINUTE, 0);
|
||||
result.set(Calendar.SECOND, 0);
|
||||
result.set(Calendar.MILLISECOND, 0);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static boolean isExpireDays(Date date, int i) {
|
||||
Calendar createDate = Calendar.getInstance();
|
||||
createDate.setTime(date);
|
||||
createDate.add(Calendar.DATE, i);
|
||||
return createDate.before(new Date());
|
||||
}
|
||||
|
||||
|
||||
public static Integer getPersonAgeFromIdCard(String pensonnelIdCard) {
|
||||
|
||||
//截取身份证中出行人出生日期中的年、月、日
|
||||
Integer personYear = Integer.parseInt(pensonnelIdCard.substring(6, 10));
|
||||
Integer personMonth = Integer.parseInt(pensonnelIdCard.substring(10, 12));
|
||||
Integer personDay = Integer.parseInt(pensonnelIdCard.substring(12, 14));
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// 得到当前时间的年、月、日
|
||||
Integer yearNow = cal.get(Calendar.YEAR);
|
||||
Integer monthNow = cal.get(Calendar.MONTH) + 1;
|
||||
Integer dayNow = cal.get(Calendar.DATE);
|
||||
|
||||
// 用当前年月日减去生日年月日
|
||||
Integer yearMinus = yearNow - personYear;
|
||||
Integer monthMinus = monthNow - personMonth;
|
||||
Integer dayMinus = dayNow - personDay;
|
||||
|
||||
Integer age = yearMinus; //先大致赋值
|
||||
|
||||
if (yearMinus == 0) { //出生年份为当前年份
|
||||
age = 0;
|
||||
} else { //出生年份大于当前年份
|
||||
if (monthMinus < 0) {//出生月份小于当前月份时,还没满周岁
|
||||
age = age - 1;
|
||||
}
|
||||
if (monthMinus == 0) {//当前月份为出生月份时,判断日期
|
||||
if (dayMinus < 0) {//出生日期小于当前月份时,没满周岁
|
||||
age = age - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
public static Date getToday() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Integer getYear() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
public static Integer getMonth() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.MONTH) + 1;
|
||||
}
|
||||
|
||||
public static Integer getDay() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.DATE);
|
||||
}
|
||||
|
||||
public static Date getYesterday() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getBeForeYesterday() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -2);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date setDayToNum(int day) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, day);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getLastWeek() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -7);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getSixDaysAgo() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -6);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getTomorrow() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
public static Integer getTimeHour() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
|
||||
public static Date getTodayHour(String end) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(end));
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Integer getTimeStampSec() {
|
||||
return Integer.valueOf(String.valueOf(Instant.now().getEpochSecond()));
|
||||
}
|
||||
|
||||
public static Date getDayOfMonth(Integer month) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.DAY_OF_MONTH, month);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* "starttime": "11:00",
|
||||
* "endtime": "20:00",
|
||||
*
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static int verificationPeriod(String startTime, String endTime) {
|
||||
int status = 0;
|
||||
SimpleDateFormat sdf = SIMPLE_DAY.get();
|
||||
SimpleDateFormat sdtf = SIMPLE_DATE_FORMAT.get();
|
||||
if (StringUtils.hasLength(startTime) && StringUtils.hasLength(endTime) && startTime.length() == 5 && endTime.length() == 5) {
|
||||
String currentDay = sdf.format(new Date());
|
||||
Long current = System.currentTimeMillis();
|
||||
//日期补全
|
||||
String startStr = new StringBuilder(currentDay).append(" ").append(startTime).append(":00").toString();
|
||||
String endStr = new StringBuilder(currentDay).append(" ").append(endTime).append(":00").toString();
|
||||
synchronized (DateUtil.class) {
|
||||
try {
|
||||
Long start = sdtf.parse(startStr).getTime();
|
||||
Long end = sdtf.parse(endStr).getTime();
|
||||
//判断是否跨天
|
||||
if (start > end) {
|
||||
status = current - end >= 0 && current - start <= 0 ? 1 : 0;
|
||||
} else {
|
||||
status = start.equals(end) ? 0 : current - start >= 0 && current - end <= 0 ? 0 : 1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("错误的日期格式 开始时间 {} 结束时间{}", startTime, endTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
public static Date convertFromString(String dateString, String format) {
|
||||
SimpleDateFormat ft = new SimpleDateFormat(format);
|
||||
try {
|
||||
return ft.parse(dateString);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static String convertFromDate(Date date, String format) {
|
||||
SimpleDateFormat ft = new SimpleDateFormat(format);
|
||||
return ft.format(date);
|
||||
}
|
||||
|
||||
public static Date convertLocalDateTimeToDate(LocalDateTime localDateTime) {
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
ZonedDateTime zdt = localDateTime.atZone(zoneId);
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
public static Integer getDays(Integer number, Integer type) {
|
||||
int days = 0;
|
||||
//计算包对应时长
|
||||
switch (type) {
|
||||
case 1: // 天
|
||||
days = number;
|
||||
break;
|
||||
case 2: // 月
|
||||
days = number * 30;
|
||||
break;
|
||||
case 3: //年
|
||||
days = number * 365;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false, "时间类型错误");
|
||||
}
|
||||
return days;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期后x天的日期
|
||||
*
|
||||
* @param start 日期
|
||||
* @param day 天数
|
||||
* @return
|
||||
*/
|
||||
public static Date getSpecifyDay(Date start, int day) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(start);
|
||||
calendar.add(Calendar.DATE, day);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getBegin(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getEnd(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthBegin(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, 0);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthEnd(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Long getExpireSecondWithTimestamp(int seconds) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.SECOND, seconds);
|
||||
return calendar.getTime().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期是否为周六/周日
|
||||
*
|
||||
* @param day
|
||||
* @return
|
||||
*/
|
||||
public static Boolean dayOfWeek(String day) {
|
||||
DateTimeFormatter formatter = THREAD_LOCAL_FORMAT.get();
|
||||
LocalDate date = LocalDate.parse(day, formatter);
|
||||
switch (date.getDayOfWeek()) {
|
||||
case SATURDAY:
|
||||
case SUNDAY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -77,8 +77,8 @@ public class JobInfoController extends BladeController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入jobInfo")
|
||||
public R<IPage<JobInfo>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> jobInfo, Query query) {
|
||||
IPage<JobInfo> pages = jobInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(jobInfo, JobInfo.class));
|
||||
public R<IPage<JobInfo>> list(JobInfo jobInfo, Query query) {
|
||||
IPage<JobInfo> pages = jobInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(jobInfo).orderByDesc("id"));
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,338 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
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.redis.cache.BladeRedis;
|
||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||
import org.springblade.modules.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.pojo.entity.CommonOrderConfirmLogEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonOrderConfirmLogService;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||
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.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 现金动态升级- 现金分红
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class AccelUpgradeCashProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketUpgradeConfigService upgradeConfigService;
|
||||
private final IMarketUpgradeCashLogService upgradeCashLogService;
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final ICommonOrderConfirmLogService orderConfirmLogService;
|
||||
private final IUserService userService;
|
||||
private final BladeRedis bladeRedis;
|
||||
private final IMarketUserCommissionService userCommissionService;
|
||||
private final IMarketUserCommissionLogService userCommissionLogService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final IMarketCommissionAccountService commissionAccountService;
|
||||
private final IMarketCommissionAgencyLogService agencyLogService;
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
|
||||
private static final Long AGENCY_ACCOUNT_ID = 2017486568441696258L;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
Date startDate = DateUtil.getYesterday();
|
||||
Date endDate = DateUtil.getToday();
|
||||
|
||||
List<MarketUpgradeCashLogEntity> list = upgradeCashLogService.list(
|
||||
Wrappers.lambdaQuery(MarketUpgradeCashLogEntity.class)
|
||||
.eq(MarketUpgradeCashLogEntity::getUpgradeDate, DateUtil.getYesterday())
|
||||
);
|
||||
|
||||
List<CommonUserOrderEntity> orderEntityList = userOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||
.select(CommonUserOrderEntity::getUserId)
|
||||
.eq(CommonUserOrderEntity::getOrderType, BusinessModule.SELF_OPERATED_MALL.getCode())
|
||||
.eq(CommonUserOrderEntity::getPaymentType, 1)
|
||||
.ge(CommonUserOrderEntity::getCreateTime, startDate)
|
||||
.le(CommonUserOrderEntity::getCreateTime, endDate)
|
||||
);
|
||||
|
||||
|
||||
if (orderEntityList.isEmpty()){
|
||||
log.info( "{} : 没有自营商城订单", DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||
return new ProcessResult(true, "result is success") ;
|
||||
}
|
||||
|
||||
Set<Long> orderUserIdSet = orderEntityList.stream()
|
||||
.map(CommonUserOrderEntity::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||
.eq(MarketUpgradeConfigEntity::getType, 2)
|
||||
.orderByAsc(MarketUpgradeConfigEntity::getSortOrder)
|
||||
);
|
||||
Map<Long, MarketUpgradeConfigEntity> upgradeConfigMap = upgradeConfigList.stream()
|
||||
.collect(Collectors.toMap(MarketUpgradeConfigEntity::getId, Function.identity()));
|
||||
|
||||
|
||||
Map<Long, MarketUpgradeCashLogEntity> upgradeCashLogMap = list.stream()
|
||||
.collect(Collectors.toMap(MarketUpgradeCashLogEntity::getUserId, Function.identity()));
|
||||
|
||||
BigDecimal totalRewardRate = upgradeConfigList.stream()
|
||||
.map(entity -> {
|
||||
BigDecimal amount = entity.getRewardRate();
|
||||
if (amount == null) return BigDecimal.ZERO;
|
||||
return amount;
|
||||
})
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
totalRewardRate = totalRewardRate.subtract(upgradeConfigList.get(upgradeConfigList.size() - 1).getRewardRate());
|
||||
|
||||
|
||||
|
||||
|
||||
String orderType = BusinessModule.SELF_OPERATED_MALL.getCode().toUpperCase();
|
||||
List<CommonOrderConfirmLogEntity> orderPageList = orderConfirmLogService.list(
|
||||
Wrappers.lambdaQuery(CommonOrderConfirmLogEntity.class)
|
||||
.eq(CommonOrderConfirmLogEntity::getIsAgencyDistributed, 0)
|
||||
.func(queryWrapper -> queryWrapper.apply("UPPER(order_type) = {0}", orderType))
|
||||
.in(CommonOrderConfirmLogEntity::getPaymentType, List.of(1, 2))
|
||||
.ge(CommonOrderConfirmLogEntity::getCreateTime, startDate)
|
||||
.le(CommonOrderConfirmLogEntity::getCreateTime, endDate)
|
||||
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
||||
);
|
||||
|
||||
if (orderPageList.isEmpty()){
|
||||
log.info( "{} : 没有自营商城订单", DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||
return new ProcessResult(true, "result is success") ;
|
||||
}
|
||||
|
||||
MarketCommissionAccountEntity agencyAccount = commissionAccountService.getById(AGENCY_ACCOUNT_ID);
|
||||
|
||||
if (agencyAccount == null || agencyAccount.getAmount().compareTo(BigDecimal.ZERO) < 0){
|
||||
log.info( "{} : 极差代理账户余额不足", DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||
return new ProcessResult(true, "result is success") ;
|
||||
}
|
||||
List<MarketCommissionAgencyLogEntity> agencyLogList = new ArrayList<>();
|
||||
|
||||
|
||||
List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = new ArrayList<>();
|
||||
Map<Long, BigDecimal> userRewardRateMap = new HashMap<>();
|
||||
Map<Long, BigDecimal> userLastAmountMap = new HashMap<>();
|
||||
List<MarketUserCommissionLogEntity> userCommissionLogList = new ArrayList<>();
|
||||
|
||||
BigDecimal agencyLastAmount = agencyAccount.getAmount();
|
||||
// 6. 处理订单
|
||||
for (CommonOrderConfirmLogEntity order : orderPageList) {
|
||||
Long userId = order.getUserId();
|
||||
|
||||
// 安全获取金额
|
||||
BigDecimal actualAmount = order.getActualAmount();
|
||||
if (actualAmount == null) {
|
||||
actualAmount = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal finalActualAmount = actualAmount;
|
||||
// 构建详情
|
||||
String sourceDetail = String.format("现金加速详情:订单号:%d;商品:%s;实付金额:%s元",
|
||||
order.getId(), order.getItemName(), actualAmount);
|
||||
|
||||
// 获取用户账号 (用于脱敏)
|
||||
User user = userService.getById(userId);
|
||||
String account = user != null ? SensitiveUtil.process(user.getAccount()) : "未知";
|
||||
String remarks = DateUtil.convertFromDate(DateUtil.getYesterday(), "yyyy-MM-dd") + "现金加速,来源:" + account;
|
||||
|
||||
|
||||
// 获取该用户的所有上级ID (包含自己)
|
||||
List<Long> ancestorIds = selectAncestorId(userId);
|
||||
// 移除列表中等于 userId 的元素
|
||||
ancestorIds.remove(userId);
|
||||
|
||||
BigDecimal accelerationPoint = totalRewardRate.multiply(finalActualAmount).setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
if (accelerationPoint.compareTo(BigDecimal.ZERO) <= 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
long indexLevelId = upgradeConfigList.get(0).getId();
|
||||
MarketUpgradeCashLogEntity userLog = upgradeCashLogMap.get(userId);
|
||||
if (userLog != null) {
|
||||
indexLevelId = userLog.getCurrentLevelId();
|
||||
}
|
||||
|
||||
|
||||
for (Long ancestorId : ancestorIds){
|
||||
if (accelerationPoint.compareTo(BigDecimal.ZERO) <= 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!upgradeCashLogMap.containsKey(ancestorId)){
|
||||
continue;
|
||||
}
|
||||
|
||||
MarketUpgradeCashLogEntity upgradeCashLog = upgradeCashLogMap.get(ancestorId);
|
||||
|
||||
long currentLevelId = upgradeCashLog.getCurrentLevelId();
|
||||
|
||||
|
||||
if (indexLevelId >= currentLevelId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
BigDecimal rewardRate = BigDecimal.ZERO;
|
||||
|
||||
// 2. 持续尝试升级,直到不满足条件或到达顶层
|
||||
while (true) {
|
||||
MarketUpgradeConfigEntity config = upgradeConfigMap.get(indexLevelId);
|
||||
if (config == null || config.getId() > currentLevelId) break;
|
||||
|
||||
// 安全获取比例
|
||||
BigDecimal rate = config.getRewardRate();
|
||||
BigDecimal configRate = rate == null ? BigDecimal.ZERO : rate;
|
||||
|
||||
if (config.getHasNextLevel() == 1 && config.getId() < 10){
|
||||
rewardRate = rewardRate.add(configRate);
|
||||
}
|
||||
|
||||
|
||||
if (config.getHasNextLevel() != 1) break;
|
||||
indexLevelId = config.getNextLevelId();
|
||||
}
|
||||
|
||||
|
||||
BigDecimal rewardRatePoint = rewardRate.multiply(finalActualAmount).setScale(2, RoundingMode.HALF_UP);
|
||||
if (rewardRatePoint.compareTo(BigDecimal.ZERO) <= 0){
|
||||
continue;
|
||||
}
|
||||
// 未在自营商城消费
|
||||
if (!orderUserIdSet.contains(ancestorId)){
|
||||
log.info( " 用户ID:{} , {} 未在自营商城消费 ", ancestorId,DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!userLastAmountMap.containsKey(ancestorId)){
|
||||
MarketUserCommissionEntity benefitPoint = userCommissionService.getById(ancestorId);
|
||||
if (benefitPoint == null){
|
||||
benefitPoint = new MarketUserCommissionEntity();
|
||||
benefitPoint.setId(ancestorId);
|
||||
benefitPoint.setCreateUser(ancestorId);
|
||||
userCommissionService.save(benefitPoint);
|
||||
userLastAmountMap.put(ancestorId, benefitPoint.getAmount());
|
||||
}else {
|
||||
userLastAmountMap.put(ancestorId, benefitPoint.getAmount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!userRewardRateMap.containsKey(ancestorId)){
|
||||
userRewardRateMap.put(ancestorId, rewardRatePoint);
|
||||
}else {
|
||||
userRewardRateMap.put(ancestorId, userRewardRateMap.get(ancestorId).add(rewardRatePoint));
|
||||
}
|
||||
|
||||
MarketUserCommissionLogEntity userCommissionLog = new MarketUserCommissionLogEntity()
|
||||
.setUserId(ancestorId)
|
||||
.setAmount(rewardRatePoint)
|
||||
.setLastAmount(userLastAmountMap.get(ancestorId))
|
||||
.setSourceId(userId)
|
||||
.setSourceDetail(sourceDetail)
|
||||
.setType(1)
|
||||
.setSourceType(MarketBusinessModule.CASH_ACCELERATION.getCode())
|
||||
.setIsComplete(1)
|
||||
.setRemark(remarks + ",加速比例:" + rewardRate + ",加速金额:" + rewardRatePoint )
|
||||
.setStatisticalDate(DateUtil.getYesterday());
|
||||
userCommissionLogList.add(userCommissionLog);
|
||||
|
||||
MarketCommissionAgencyLogEntity agencyLog = new MarketCommissionAgencyLogEntity();
|
||||
agencyLog.setAccountId(agencyAccount.getId());
|
||||
agencyLog.setUserId(ancestorId);
|
||||
agencyLog.setAmount(rewardRatePoint);
|
||||
agencyLog.setLastAmount(agencyLastAmount);
|
||||
agencyLog.setSourceType(orderType);
|
||||
agencyLog.setSourceId(order.getId());
|
||||
agencyLog.setSourceDetail(JSONObject.toJSONString(order));
|
||||
agencyLog.setType(1);
|
||||
agencyLog.setStatisticalDate(DateUtil.getYesterday());
|
||||
agencyLog.setIsComplete(2);
|
||||
agencyLog.setRemark("极差代理奖励发放, 来源账号:" + account + ",来源订单id:" + order.getId());
|
||||
agencyLogList.add(agencyLog);
|
||||
agencyLastAmount = agencyLastAmount.subtract(rewardRatePoint);
|
||||
|
||||
agencyAccount.setAmount(agencyAccount.getAmount().subtract(rewardRatePoint));
|
||||
|
||||
if (userLastAmountMap.containsKey(ancestorId)){
|
||||
userLastAmountMap.merge(ancestorId, rewardRatePoint, BigDecimal::add);
|
||||
}else {
|
||||
userLastAmountMap.put(ancestorId, rewardRatePoint);
|
||||
}
|
||||
|
||||
accelerationPoint = accelerationPoint.subtract(rewardRatePoint);
|
||||
|
||||
noticeItems.add(new MarketUpgradeNoticeEvent.NoticeItem(userCommissionLog.getUserId() ,userCommissionLog.getRemark()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
||||
noticeItems,
|
||||
MarketBusinessModule.CASH_ACCELERATION
|
||||
);
|
||||
|
||||
userRewardRateMap.forEach((userId, rewardRate) -> {
|
||||
MarketUserCommissionEntity benefitPoint = userCommissionService.getById(userId);
|
||||
benefitPoint.setAmount(benefitPoint.getAmount().add(rewardRate));
|
||||
userCommissionService.updateById(benefitPoint);
|
||||
});
|
||||
userCommissionLogService.saveBatch(userCommissionLogList , 5000);
|
||||
publisher.publishEvent(event);
|
||||
|
||||
commissionAccountService.updateById(agencyAccount);
|
||||
agencyLogService.saveBatch(agencyLogList , 5000);
|
||||
|
||||
orderPageList.forEach(order -> {
|
||||
order.setIsAgencyDistributed(1);
|
||||
order.setAgencyDistributeTime(new Date());
|
||||
});
|
||||
orderConfirmLogService.updateBatchById(orderPageList , 5000);
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
private List<Long> selectAncestorId(Long userId){
|
||||
List<Long> userAncestorCache = new ArrayList<>(List.of(userId));
|
||||
String key = "yiyu:market:user:ancestor:";
|
||||
Object ancestorIdsObject = bladeRedis.get(key + userId);
|
||||
if (ancestorIdsObject == null) {
|
||||
userAncestorCache.addAll(marketInfoService.selectAncestorIds(userId));
|
||||
bladeRedis.set(key + userId, userAncestorCache);
|
||||
}else {
|
||||
return JSONArray.parseArray(JSONArray.toJSONString(ancestorIdsObject), Long.class);
|
||||
}
|
||||
|
||||
return userAncestorCache;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||
import org.springblade.modules.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||
import org.springblade.modules.market.pojo.entity.*;
|
||||
import org.springblade.modules.market.service.*;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 福利包动态升级- 福利积分加速
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketUpgradeConfigService upgradeConfigService;
|
||||
private final IMarketUpgradeWelfareLogService upgradeWelfareLogService;
|
||||
private final IMarketBenefitPackageTemplateService benefitPackageTemplateService;
|
||||
private final IMarketBenefitPackageService benefitPackageService;
|
||||
private final IMarketBenefitPointService benefitPointService;
|
||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||
private final BladeRedis bladeRedis;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
// 1. 初始化配置
|
||||
Date searchDate = DateUtil.getYesterday();
|
||||
Date startDate = DateUtil.getYesterday();
|
||||
Date endDate = DateUtil.getToday();
|
||||
|
||||
// 2. 预加载基础数据 (减少循环内DB查询)
|
||||
List<MarketBenefitPackageTemplateEntity> templateEntityList = benefitPackageTemplateService.list();
|
||||
Map<Long, MarketBenefitPackageTemplateEntity> templateEntityMap = templateEntityList.stream()
|
||||
.collect(Collectors.toMap(MarketBenefitPackageTemplateEntity::getId, Function.identity()));
|
||||
|
||||
// 用户福利包list
|
||||
List<MarketBenefitPackageEntity> benefitPackageEntityList = benefitPackageService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.eq(MarketBenefitPackageEntity::getStatisticalDate, searchDate)
|
||||
.eq(MarketBenefitPackageEntity::getType, 1)
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
.orderByAsc(MarketBenefitPackageEntity::getId)
|
||||
);
|
||||
|
||||
// 直接停止
|
||||
if (benefitPackageEntityList.isEmpty()){
|
||||
log.info("searchDate : {} 没有昨日兑换的福利包" , searchDate);
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
List<CommonUserOrderEntity> orderEntityList = userOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||
.select(CommonUserOrderEntity::getUserId)
|
||||
.eq(CommonUserOrderEntity::getOrderType, BusinessModule.SELF_OPERATED_MALL.getCode())
|
||||
.eq(CommonUserOrderEntity::getPaymentType, 1)
|
||||
.ge(CommonUserOrderEntity::getCreateTime, startDate)
|
||||
.le(CommonUserOrderEntity::getCreateTime, endDate)
|
||||
);
|
||||
|
||||
|
||||
if (orderEntityList.isEmpty()){
|
||||
log.info( "{} : 没有自营商城订单", DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||
return new ProcessResult(true, "result is success") ;
|
||||
}
|
||||
|
||||
Set<Long> orderUserIdSet = orderEntityList.stream()
|
||||
.map(CommonUserOrderEntity::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 用户福利包分组map
|
||||
Map<Long, List<MarketBenefitPackageEntity>> packageEntityMap = benefitPackageEntityList.stream()
|
||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
||||
|
||||
// 升级配置list
|
||||
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||
.eq(MarketUpgradeConfigEntity::getType, 1)
|
||||
.orderByAsc(MarketUpgradeConfigEntity::getSortOrder)
|
||||
);
|
||||
Map<Long, MarketUpgradeConfigEntity> upgradeConfigMap = upgradeConfigList.stream()
|
||||
.collect(Collectors.toMap(MarketUpgradeConfigEntity::getId, Function.identity()));
|
||||
|
||||
// 升级日志list
|
||||
List<MarketUpgradeWelfareLogEntity> upgradeWelfareLogList = upgradeWelfareLogService.list(
|
||||
Wrappers.lambdaQuery(MarketUpgradeWelfareLogEntity.class)
|
||||
.eq(MarketUpgradeWelfareLogEntity::getUpgradeDate, DateUtil.getYesterday())
|
||||
);
|
||||
Map<Long, MarketUpgradeWelfareLogEntity> upgradeWelfareLogMap = upgradeWelfareLogList.stream()
|
||||
.collect(Collectors.toMap(MarketUpgradeWelfareLogEntity::getUserId, Function.identity()));
|
||||
|
||||
// 计算总奖励比例 (安全判空)
|
||||
BigDecimal totalRewardRate = upgradeConfigList.stream()
|
||||
.map(entity -> {
|
||||
BigDecimal rate = entity.getRewardRate();
|
||||
return rate != null ? rate : BigDecimal.ZERO;
|
||||
})
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
log.info("福利积分加速任务开始,预加载模板:{}个, 配置:{}个, 日志:{}个",
|
||||
templateEntityList.size(), upgradeConfigList.size(), upgradeWelfareLogList.size());
|
||||
|
||||
List<MarketBenefitPointLogEntity> pointLogList = new ArrayList<>();
|
||||
Map<Long, BigDecimal> userRewardRateMap = new HashMap<>();
|
||||
Map<Long, BigDecimal> userLastAmountMap = new HashMap<>();
|
||||
List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = new ArrayList<>();
|
||||
|
||||
|
||||
for (Map.Entry<Long, List<MarketBenefitPackageEntity>> entry : packageEntityMap.entrySet()) {
|
||||
Long userId = entry.getKey();
|
||||
List<MarketBenefitPackageEntity> packageList = entry.getValue();
|
||||
|
||||
// 1. 计算用户总收益 (安全转换)
|
||||
BigDecimal totalUserBenefit = packageList.stream()
|
||||
.map(entity -> {
|
||||
BigDecimal amount = entity.getUserBenefit();
|
||||
if (amount == null) return BigDecimal.ZERO;
|
||||
return amount;
|
||||
})
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 2. 构建来源详情 (防御空指针)
|
||||
String sourceDetail = packageList.stream()
|
||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getPackageId, Collectors.counting()))
|
||||
.entrySet().stream()
|
||||
.map(e -> {
|
||||
MarketBenefitPackageTemplateEntity template = templateEntityMap.get(e.getKey());
|
||||
// 防御:如果模板不存在,显示ID
|
||||
String name = (template != null && template.getPackageName() != null) ?
|
||||
template.getPackageName() : "ID:" + e.getKey();
|
||||
return name + "(" + e.getValue() + "个);";
|
||||
})
|
||||
.collect(Collectors.joining("", "福利积分加速详情:", ""));
|
||||
|
||||
|
||||
String account = packageList.get(0).getPhone() != null ? SensitiveUtil.process(String.valueOf(packageList.get(0).getPhone())) : "未知";
|
||||
String remarks = DateUtil.convertFromDate(DateUtil.getYesterday(), "yyyy-MM-dd") + "福利积分加速来源:" + account;
|
||||
|
||||
// 4. 获取上级链 (排除自己)
|
||||
List<Long> ancestorIds = selectAncestorId(userId);
|
||||
ancestorIds.remove(userId); // 移除自己
|
||||
// 5. 计算加速总额
|
||||
BigDecimal accelerationPoint = totalRewardRate.multiply(totalUserBenefit).setScale(2, RoundingMode.HALF_UP);
|
||||
// 修正逻辑:如果加速金额<=0,跳过该用户,不要中断整个分页任务
|
||||
if (accelerationPoint.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
// 6. 确定起始等级ID
|
||||
long indexLevelId = upgradeConfigList.get(0).getId();
|
||||
MarketUpgradeWelfareLogEntity userLog = upgradeWelfareLogMap.get(userId);
|
||||
if (userLog != null) {
|
||||
indexLevelId = userLog.getCurrentLevelId();
|
||||
}
|
||||
|
||||
// 7. 遍历上级进行分润计算
|
||||
for (Long ancestorId : ancestorIds) {
|
||||
// 基础校验
|
||||
MarketUpgradeWelfareLogEntity ancestorLog = upgradeWelfareLogMap.get(ancestorId);
|
||||
if (ancestorLog == null) continue;
|
||||
|
||||
// 当前上级的等级ID
|
||||
long currentLevelId = ancestorLog.getCurrentLevelId();
|
||||
if (indexLevelId >= currentLevelId) continue;
|
||||
|
||||
if (!packageEntityMap.containsKey(ancestorId)){
|
||||
continue;
|
||||
}
|
||||
// 先判断该上级的福利包是否为空
|
||||
List<MarketBenefitPackageEntity> ancestorPackages = packageEntityMap.get(ancestorId)
|
||||
.stream()
|
||||
.filter(p -> p.getStatus() == 2)
|
||||
.toList();
|
||||
// 福利包为空 跳过
|
||||
if (ancestorPackages.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
// 计算该上级的奖励比例
|
||||
BigDecimal rewardRate = BigDecimal.ZERO;
|
||||
while (true) {
|
||||
MarketUpgradeConfigEntity config = upgradeConfigMap.get(indexLevelId);
|
||||
if (config == null || config.getId() > currentLevelId) break;
|
||||
|
||||
// 安全获取比例
|
||||
BigDecimal rate = config.getRewardRate();
|
||||
BigDecimal configRate = rate == null ? BigDecimal.ZERO : rate;
|
||||
rewardRate = rewardRate.add(configRate);
|
||||
|
||||
if (config.getHasNextLevel() != 1) break;
|
||||
indexLevelId = config.getNextLevelId();
|
||||
}
|
||||
|
||||
// 计算该上级的奖励金额
|
||||
BigDecimal rewardRatePoint = rewardRate.multiply(totalUserBenefit).setScale(2, RoundingMode.HALF_UP);
|
||||
if (rewardRatePoint.compareTo(BigDecimal.ZERO) <= 0) continue;
|
||||
|
||||
// 未在自营商城消费
|
||||
if (!orderUserIdSet.contains(ancestorId)){
|
||||
log.info( " 用户ID:{} , {} 未在自营商城消费 ", ancestorId,DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||
continue;
|
||||
}
|
||||
|
||||
BigDecimal remainingPoint = rewardRatePoint; // 剩余需要扣除的金额
|
||||
|
||||
// 新增的积分
|
||||
BigDecimal ancestorAmount = BigDecimal.ZERO;
|
||||
|
||||
List<MarketBenefitPackageEntity> updatePackages = new ArrayList<>();
|
||||
|
||||
for (MarketBenefitPackageEntity pkg : ancestorPackages) {
|
||||
if (remainingPoint.compareTo(BigDecimal.ZERO) <= 0) break;
|
||||
|
||||
BigDecimal newOut = pkg.getAmountOut().add(remainingPoint);
|
||||
BigDecimal total = pkg.getAmountTotal();
|
||||
|
||||
if (newOut.compareTo(total) <= 0) {
|
||||
// 全部扣除,包未用完
|
||||
pkg.setAmountOut(newOut);
|
||||
ancestorAmount = ancestorAmount.add(remainingPoint);
|
||||
remainingPoint = BigDecimal.ZERO;
|
||||
} else {
|
||||
// 包用完,扣除剩余部分
|
||||
remainingPoint = newOut.subtract(total);
|
||||
ancestorAmount = newOut.subtract(total);
|
||||
pkg.setAmountOut(total);
|
||||
pkg.setStatus(3); // 标记为已用完
|
||||
}
|
||||
|
||||
updatePackages.add(pkg);
|
||||
}
|
||||
|
||||
packageEntityMap.put(ancestorId , updatePackages);
|
||||
|
||||
|
||||
if (!userLastAmountMap.containsKey(ancestorId)){
|
||||
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(ancestorId);
|
||||
if (benefitPoint == null){
|
||||
benefitPoint = new MarketBenefitPointEntity();
|
||||
benefitPoint.setId(ancestorId);
|
||||
benefitPoint.setCreateUser(ancestorId);
|
||||
benefitPointService.save(benefitPoint);
|
||||
userLastAmountMap.put(ancestorId, benefitPoint.getAmount());
|
||||
}else {
|
||||
userLastAmountMap.put(ancestorId, benefitPoint.getAmount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!userRewardRateMap.containsKey(ancestorId)){
|
||||
userRewardRateMap.put(ancestorId, ancestorAmount);
|
||||
}else {
|
||||
userRewardRateMap.put(ancestorId, userRewardRateMap.get(ancestorId).add(ancestorAmount));
|
||||
}
|
||||
|
||||
// A. 构建积分日志
|
||||
MarketBenefitPointLogEntity logEntity = new MarketBenefitPointLogEntity()
|
||||
.setUserId(ancestorId)
|
||||
.setAmount(ancestorAmount)
|
||||
.setLastAmount(userLastAmountMap.get(ancestorId)) // 这里通常需要查库,或者在最后统一处理
|
||||
.setFee(BigDecimal.ZERO)
|
||||
.setSourceId(userId)
|
||||
.setSourceDetail(sourceDetail)
|
||||
.setType(1)
|
||||
.setSourceType(MarketBusinessModule.WELFARE_ACCELERATION.getCode())
|
||||
.setIsComplete(1)
|
||||
.setRemark(remarks + ",加速比例:" + rewardRate + ",加速金额:" + rewardRatePoint)
|
||||
.setStatisticalDate(DateUtil.getYesterday());
|
||||
pointLogList.add(logEntity);
|
||||
|
||||
|
||||
if (userLastAmountMap.containsKey(ancestorId)){
|
||||
userLastAmountMap.merge(ancestorId, ancestorAmount, BigDecimal::add);
|
||||
}else {
|
||||
userLastAmountMap.put(ancestorId, ancestorAmount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// C. 构建通知
|
||||
noticeItems.add(new MarketUpgradeNoticeEvent.NoticeItem(ancestorId, logEntity.getRemark()));
|
||||
|
||||
// 更新剩余加速金额
|
||||
accelerationPoint = accelerationPoint.subtract(rewardRatePoint);
|
||||
}
|
||||
}
|
||||
|
||||
// --- 批量提交 (在分页结束时一次性提交,大幅提高性能) ---
|
||||
try {
|
||||
|
||||
if (!userRewardRateMap.isEmpty()){
|
||||
|
||||
// userRewardRateMap 转 List<MarketBenefitPointEntity>
|
||||
List<MarketBenefitPointEntity> userRewardRateList = userRewardRateMap.entrySet().stream()
|
||||
.map(entry -> {
|
||||
MarketBenefitPointEntity entity = new MarketBenefitPointEntity();
|
||||
entity.setId(entry.getKey());
|
||||
entity.setAmount(entry.getValue());
|
||||
entity.setUpdateTime(new Date());
|
||||
return entity;
|
||||
})
|
||||
.toList();
|
||||
|
||||
int batchSize = 2000;
|
||||
Lists.partition(userRewardRateList, batchSize).forEach(subList -> {
|
||||
// 在这里处理每一批数据
|
||||
log.info("处理批次-福利积分加速,数量:{}", subList.size());
|
||||
benefitPointService.addBenefitPointBatch(subList);
|
||||
// 模拟处理耗时
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("福利积分加速-线程中断:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 1. 批量保存积分日志
|
||||
if (!pointLogList.isEmpty()) {
|
||||
benefitPointLogService.saveBatch(pointLogList , 5000);
|
||||
}
|
||||
|
||||
// 2. 批量更新福利包
|
||||
if (!packageEntityMap.isEmpty()) {
|
||||
|
||||
// packageEntityMap value 转 List<MarketBenefitPackageEntity>
|
||||
List<MarketBenefitPackageEntity> packageUpdateList = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<Long, List<MarketBenefitPackageEntity>> entry : packageEntityMap.entrySet()) {
|
||||
packageUpdateList.addAll(entry.getValue());
|
||||
}
|
||||
|
||||
benefitPackageService.updateBatchById(packageUpdateList , 5000);
|
||||
}
|
||||
|
||||
// 3. 发布通知事件
|
||||
if (!noticeItems.isEmpty()) {
|
||||
MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
||||
noticeItems, MarketBusinessModule.WELFARE_ACCELERATION);
|
||||
publisher.publishEvent(event);
|
||||
}
|
||||
|
||||
log.info("分页处理完成,提交日志:{}条, 更新福利包:{}个", pointLogList.size(), packageEntityMap.size());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("福利包动态福利积分加速失败:{}", e.getMessage());
|
||||
throw new RuntimeException("福利包动态福利积分加速失败");
|
||||
}
|
||||
|
||||
|
||||
log.info("福利积分加速任务全部完成");
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
private List<Long> selectAncestorId(Long userId){
|
||||
List<Long> userAncestorCache = new ArrayList<>(List.of(userId));
|
||||
String key = "yiyu:market:user:ancestor:";
|
||||
Object ancestorIdsObject = bladeRedis.get(key + userId);
|
||||
if (ancestorIdsObject == null) {
|
||||
userAncestorCache.addAll(marketInfoService.selectAncestorIds(userId));
|
||||
bladeRedis.set(key + userId, userAncestorCache);
|
||||
}else {
|
||||
return JSONArray.parseArray(JSONArray.toJSONString(ancestorIdsObject), Long.class);
|
||||
}
|
||||
|
||||
return userAncestorCache;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.cache.PaymentCache;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.modules.api.service.IPaymentService;
|
||||
import org.springblade.modules.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.eums.OrderStatus;
|
||||
import org.springblade.modules.common.eums.PaymentStatus;
|
||||
import org.springblade.modules.common.eums.PaymentType;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.plugin.pay.entity.AliPayAccountConfig;
|
||||
import org.springblade.plugin.pay.service.IOrderService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户未支付订单关闭
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class AliUserOrderCloseProcessor implements BasicProcessor {
|
||||
|
||||
|
||||
|
||||
private final ICommonUserOrderService commonUserOrderService;
|
||||
private final IPaymentService paymentService;
|
||||
private final IOrderService orderService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
// 1. 计算截止时间 (30分钟前)
|
||||
Date expireTime = DateUtil.getMinutesLate(new Date(), 30);
|
||||
AliPayAccountConfig config = PaymentCache.getAliConfig();
|
||||
|
||||
int batchSize = 500;
|
||||
|
||||
while (true) {
|
||||
|
||||
List<CommonUserOrderEntity> payOrderList = commonUserOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||
.eq(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.UNPAID.getCode())
|
||||
.eq(CommonUserOrderEntity::getOrderStatus, OrderStatus.PENDING_PAYMENT.getCode())
|
||||
.ne(CommonUserOrderEntity::getPaymentType, PaymentType.OFFLINE.getCode()) // 只查询支付宝和微信
|
||||
.le(CommonUserOrderEntity::getCreateTime, expireTime)
|
||||
.orderByAsc(CommonUserOrderEntity::getCreateTime)
|
||||
.last("LIMIT " + batchSize)
|
||||
);
|
||||
|
||||
if (payOrderList == null || payOrderList.isEmpty()) {
|
||||
break; // 没有数据了,退出循环
|
||||
}
|
||||
|
||||
for (CommonUserOrderEntity payOrder : payOrderList) {
|
||||
try {
|
||||
processSingleOrder(payOrder , config);
|
||||
} catch (Exception e) {
|
||||
log.error("处理超时订单异常,订单号: {}", payOrder.getId(), e);
|
||||
// 单个失败不影响整体流程
|
||||
}
|
||||
}
|
||||
|
||||
// 如果本次查询数量小于批次大小,说明已经是最后一批,退出
|
||||
if (payOrderList.size() < batchSize) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理单个订单逻辑
|
||||
* 核心原则:先远程交互,成功后再开短事务更新本地
|
||||
*/
|
||||
private void processSingleOrder(CommonUserOrderEntity payOrder , AliPayAccountConfig config) {
|
||||
String orderNo = PaymentType.fromCodeOrNull(payOrder.getPaymentType()).getAbbr() + BusinessModule.fromCodeIgnoreCaseOrNull(payOrder.getOrderType()).getAbbr() + payOrder.getId();
|
||||
log.info("处理超时订单,订单号: {}", orderNo);
|
||||
|
||||
AlipayTradeQueryResponse response = paymentService.aliQuery(orderNo);
|
||||
log.info("查询结果: {}", response);
|
||||
|
||||
if (response == null) {
|
||||
commonUserOrderService.closeOrderById(payOrder.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.getTradeStatus().equalsIgnoreCase("TRADE_SUCCESS") || response.getTradeStatus().equalsIgnoreCase("TRADE_FINISHED")){
|
||||
orderService.paySuccess(orderNo, String.valueOf(config.getMchId()), response.getTradeNo(), DateUtil.convertFromDate(response.getSendPayDate() , "yyyy-MM-dd HH:mm:ss"), response.getBuyerUserId());
|
||||
}else {
|
||||
Boolean isClosed = paymentService.aliCloseOrder(orderNo);
|
||||
if (!Boolean.TRUE.equals(isClosed)) {
|
||||
log.error("订单 {} 调用支付宝关闭失败,保留本地状态等待下次重试", orderNo);
|
||||
// 策略:不更新本地状态,下次定时任务再试。防止误关。
|
||||
return;
|
||||
}
|
||||
|
||||
commonUserOrderService.closeOrderById(payOrder.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
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.core.cache.utils.CacheUtil;
|
||||
import org.springblade.modules.market.constant.BladeMarketConstant;
|
||||
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.springblade.modules.system.pojo.entity.Param;
|
||||
import org.springblade.modules.system.service.IParamService;
|
||||
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;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
|
||||
|
||||
|
||||
/**
|
||||
* 福利包每日发放福利积分到用户
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class BenefitPackageSendPointProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketBenefitPackageService userBenefitPackageService;
|
||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||
private final IMarketBenefitPointService benefitPointService;
|
||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||
private final IParamService paramService;
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
CacheUtil.clear(PARAM_CACHE);
|
||||
CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
|
||||
|
||||
paramService.update(Wrappers.<Param>lambdaUpdate().eq(Param::getParamKey, BladeMarketConstant.APP_BENEFIT_PACK_ALLOCATE_ENABLED).set(Param::getParamValue, Boolean.TRUE));
|
||||
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
|
||||
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(DateUtil.getToday())
|
||||
.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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
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.core.cache.utils.CacheUtil;
|
||||
import org.springblade.modules.market.constant.BladeMarketConstant;
|
||||
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.springblade.modules.system.pojo.entity.Param;
|
||||
import org.springblade.modules.system.service.IParamService;
|
||||
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;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
|
||||
|
||||
/**
|
||||
* 福利包每日发放结算记录
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketBenefitPackageService userBenefitPackageService;
|
||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||
private final IParamService paramService;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext context) {
|
||||
|
||||
OmsLogger omsLogger = context.getOmsLogger(); // PowerJob 内置日志,控制台可查
|
||||
|
||||
try {
|
||||
CacheUtil.clear(PARAM_CACHE);
|
||||
CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
|
||||
|
||||
paramService.update(Wrappers.<Param>lambdaUpdate().eq(Param::getParamKey, BladeMarketConstant.APP_BENEFIT_PACK_ALLOCATE_ENABLED).set(Param::getParamValue, Boolean.TRUE));
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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.*;
|
||||
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 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;
|
||||
|
||||
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||
|
||||
private final IMarketCashPerformanceService cashPerformanceService;
|
||||
|
||||
@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);
|
||||
}
|
||||
MarketWelfarePerformanceEntity welfarePerformance = welfarePerformanceService.getById(user.getId());
|
||||
if (welfarePerformance == null) {
|
||||
welfarePerformance = new MarketWelfarePerformanceEntity();
|
||||
welfarePerformance.setId(user.getId());
|
||||
welfarePerformanceService.save(welfarePerformance);
|
||||
}
|
||||
MarketCashPerformanceEntity cashPerformance = cashPerformanceService.getById(user.getId());
|
||||
if (cashPerformance == null) {
|
||||
cashPerformance = new MarketCashPerformanceEntity();
|
||||
cashPerformance.setId(user.getId());
|
||||
cashPerformanceService.save(cashPerformance);
|
||||
}
|
||||
});
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.modules.market.pojo.entity.*;
|
||||
import org.springblade.modules.market.service.*;
|
||||
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.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始化用户业绩 现金动态业绩 , 福利包动态业绩(执行一次)
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class InitUserPerformanceProcessor implements BasicProcessor {
|
||||
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketCashPerformanceService cashPerformanceService;
|
||||
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||
private final IMarketWelfarePerformanceLogService welfarePerformanceLogService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
List<MarketInfoEntity> marketInfoEntityList = marketInfoService.list();
|
||||
marketInfoEntityList.forEach(marketInfoEntity -> {
|
||||
MarketCashPerformanceEntity cashPerformance = cashPerformanceService.getById(marketInfoEntity.getId());
|
||||
if (cashPerformance == null) {
|
||||
cashPerformance = new MarketCashPerformanceEntity();
|
||||
cashPerformance.setId(marketInfoEntity.getId());
|
||||
cashPerformance.setOwenAmount(BigDecimal.ZERO);
|
||||
cashPerformance.setTotalAmount(BigDecimal.ZERO);
|
||||
cashPerformance.setVersion(1);
|
||||
cashPerformanceService.save(cashPerformance);
|
||||
}
|
||||
MarketWelfarePerformanceEntity welfarePerformance = welfarePerformanceService.getById(marketInfoEntity.getId());
|
||||
if (welfarePerformance == null) {
|
||||
welfarePerformance = new MarketWelfarePerformanceEntity();
|
||||
welfarePerformance.setId(marketInfoEntity.getId());
|
||||
welfarePerformance.setOwenAmount(BigDecimal.ZERO);
|
||||
welfarePerformance.setTotalAmount(BigDecimal.ZERO);
|
||||
welfarePerformance.setVersion(1);
|
||||
welfarePerformanceService.save(welfarePerformance);
|
||||
}
|
||||
});
|
||||
log.info("初始化用户业绩成功 , 用户数量: {}" , marketInfoEntityList.size());
|
||||
welfarePerformanceService.update(
|
||||
Wrappers.lambdaUpdate(MarketWelfarePerformanceEntity.class)
|
||||
.set(MarketWelfarePerformanceEntity::getTotalAmount, BigDecimal.ZERO)
|
||||
.set(MarketWelfarePerformanceEntity::getOwenAmount, BigDecimal.ZERO)
|
||||
.set(MarketWelfarePerformanceEntity::getVersion, 1)
|
||||
.eq(MarketWelfarePerformanceEntity::getIsDeleted, 0)
|
||||
);
|
||||
|
||||
welfarePerformanceLogService.remove(
|
||||
Wrappers.lambdaUpdate(MarketWelfarePerformanceLogEntity.class)
|
||||
.eq(MarketWelfarePerformanceLogEntity::getIsDeleted, 0)
|
||||
);
|
||||
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageTemplateEntity;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageTemplateService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 统计福利包兑换数量
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class StatsBenefitPackageProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketBenefitPackageTemplateService packageTemplateService;
|
||||
private final IMarketBenefitPackageService benefitPackageService;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
|
||||
List<MarketBenefitPackageTemplateEntity> templateList = packageTemplateService.list(
|
||||
Wrappers.<MarketBenefitPackageTemplateEntity>lambdaQuery()
|
||||
.orderByDesc(MarketBenefitPackageTemplateEntity::getId)
|
||||
);
|
||||
|
||||
templateList.forEach(template -> {
|
||||
|
||||
long count = benefitPackageService.count(
|
||||
Wrappers.<MarketBenefitPackageEntity>lambdaQuery()
|
||||
.eq(MarketBenefitPackageEntity::getType , 1)
|
||||
.eq(MarketBenefitPackageEntity::getPackageId, template.getId())
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
);
|
||||
template.setExchangedQuantity(Math.toIntExact(count));
|
||||
|
||||
});
|
||||
|
||||
packageTemplateService.updateBatchById(templateList);
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||
import org.springblade.modules.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.eums.OrderStatus;
|
||||
import org.springblade.modules.common.eums.PaymentStatus;
|
||||
import org.springblade.modules.common.pojo.entity.CommonOrderConfirmLogEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonOrderConfirmLogService;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashPerformanceEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashPerformanceLogEntity;
|
||||
import org.springblade.modules.market.service.IMarketCashPerformanceLogService;
|
||||
import org.springblade.modules.market.service.IMarketCashPerformanceService;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
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.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 现金动态业绩每日计算
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class StatsCalculatorCashProcessor implements BasicProcessor {
|
||||
|
||||
private final ICommonOrderConfirmLogService orderConfirmLogService;
|
||||
private final IUserService userService;
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketCashPerformanceService cashPerformanceService;
|
||||
private final IMarketCashPerformanceLogService cashPerformanceLogService;
|
||||
private final BladeRedis bladeRedis;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
|
||||
Date startDate = DateUtil.getYesterday();
|
||||
Date endDate = DateUtil.getToday();
|
||||
String orderType = BusinessModule.SELF_OPERATED_MALL.getCode().toUpperCase();
|
||||
|
||||
|
||||
List<CommonOrderConfirmLogEntity> orderPageList = orderConfirmLogService.list(
|
||||
Wrappers.lambdaQuery(CommonOrderConfirmLogEntity.class)
|
||||
.in(CommonOrderConfirmLogEntity::getPaymentType, List.of(1, 2))
|
||||
.func(queryWrapper -> queryWrapper.apply("UPPER(order_type) = {0}", orderType))
|
||||
.ge(CommonOrderConfirmLogEntity::getCreateTime, startDate)
|
||||
.le(CommonOrderConfirmLogEntity::getCreateTime, endDate)
|
||||
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
||||
);
|
||||
|
||||
if (orderPageList.isEmpty()){
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
// 2. 提取所有用户ID,用于批量查询
|
||||
Set<Long> userIds = orderPageList.stream()
|
||||
.map(CommonOrderConfirmLogEntity::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 3. 批量查询用户信息 (修复 N+1)
|
||||
Map<Long, User> userMap = userService.listByIds(new ArrayList<>(userIds)).stream()
|
||||
.collect(Collectors.toMap(User::getId, Function.identity()));
|
||||
|
||||
// 4. 批量查询上级链 (修复 N+1) - 假设你有一个批量方法 batchSelectAncestorIds
|
||||
// 如果没有,请参考之前的方法实现它
|
||||
Map<Long, List<Long>> userAncestorCache = batchSelectAncestorIds(userIds);
|
||||
|
||||
// 5. 准备数据容器
|
||||
List<MarketCashPerformanceLogEntity> cashPerformanceLogList = new ArrayList<>();
|
||||
Map<Long, MarketCashPerformanceEntity> cashPerformanceMap = new HashMap<>(); // 团队业绩
|
||||
Map<Long, MarketCashPerformanceEntity> owenCashPerformanceMap = new HashMap<>(); // 自身业绩
|
||||
|
||||
// 6. 处理订单
|
||||
for (CommonOrderConfirmLogEntity order : orderPageList) {
|
||||
Long userId = order.getUserId();
|
||||
|
||||
// 安全获取金额
|
||||
BigDecimal actualAmount = order.getActualAmount();
|
||||
if (actualAmount == null) {
|
||||
actualAmount = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal finalActualAmount = actualAmount;
|
||||
// 构建详情
|
||||
String sourceDetail = String.format("现金业绩详情:订单号:%d;商品:%s;实付金额:%s元",
|
||||
order.getId(), order.getItemName(), actualAmount);
|
||||
|
||||
// 获取用户账号 (用于脱敏)
|
||||
User user = userMap.get(userId);
|
||||
String account = user != null ? SensitiveUtil.process(user.getAccount()) : "未知";
|
||||
String remarks = DateUtil.convertFromDate(DateUtil.getYesterday(), "yyyy-MM-dd") + "业绩来源:" + account;
|
||||
|
||||
// 获取该用户的所有上级ID (包含自己)
|
||||
List<Long> ancestorIds = userAncestorCache.getOrDefault(userId, Collections.emptyList());
|
||||
|
||||
// --- 累加日志和业绩 ---
|
||||
|
||||
// 1. 构建日志
|
||||
for (Long ancestorId : ancestorIds) {
|
||||
MarketCashPerformanceLogEntity log = new MarketCashPerformanceLogEntity();
|
||||
log.setUserId(ancestorId);
|
||||
log.setStatDate(DateUtil.getYesterday());
|
||||
log.setPerformance(actualAmount);
|
||||
log.setSourceId(userId);
|
||||
log.setSourceDetail(sourceDetail);
|
||||
log.setRemarks(remarks);
|
||||
cashPerformanceLogList.add(log);
|
||||
}
|
||||
|
||||
// 2. 累加团队业绩 (给所有上级)
|
||||
for (Long ancestorId : ancestorIds) {
|
||||
|
||||
if(!cashPerformanceMap.containsKey(ancestorId)){
|
||||
MarketCashPerformanceEntity entity = new MarketCashPerformanceEntity();
|
||||
entity.setId(ancestorId);
|
||||
entity.setTotalAmount(finalActualAmount);
|
||||
entity.setUpdateTime(new Date());
|
||||
cashPerformanceMap.put(ancestorId, entity);
|
||||
|
||||
}else {
|
||||
MarketCashPerformanceEntity entity = cashPerformanceMap.get(ancestorId);
|
||||
entity.setTotalAmount(entity.getTotalAmount().add(finalActualAmount));
|
||||
cashPerformanceMap.put(ancestorId, entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(!owenCashPerformanceMap.containsKey(userId)){
|
||||
MarketCashPerformanceEntity entity = new MarketCashPerformanceEntity();
|
||||
entity.setId(userId);
|
||||
entity.setOwenAmount(finalActualAmount);
|
||||
entity.setUpdateTime(new Date());
|
||||
owenCashPerformanceMap.put(userId, entity);
|
||||
|
||||
}else {
|
||||
MarketCashPerformanceEntity entity = owenCashPerformanceMap.get(userId);
|
||||
entity.setOwenAmount(entity.getTotalAmount().add(finalActualAmount));
|
||||
owenCashPerformanceMap.put(userId, entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 7. 批量入库
|
||||
if (!cashPerformanceLogList.isEmpty()) {
|
||||
cashPerformanceLogService.saveBatch(cashPerformanceLogList, 5000);
|
||||
}
|
||||
if (!cashPerformanceMap.isEmpty()) {
|
||||
|
||||
ArrayList<MarketCashPerformanceEntity> marketCashPerformanceList = new ArrayList<>(cashPerformanceMap.values());
|
||||
int batchSize = 2000;
|
||||
Lists.partition(marketCashPerformanceList, batchSize).forEach(subList -> {
|
||||
// 在这里处理每一批数据
|
||||
log.info("处理批次-团队业绩,数量:{}", subList.size());
|
||||
cashPerformanceService.addPerformanceBatch(subList);
|
||||
// 模拟处理耗时
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("现金动态团队业绩-线程中断:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (!owenCashPerformanceMap.isEmpty()) {
|
||||
ArrayList<MarketCashPerformanceEntity> marketCashPerformanceList = new ArrayList<>(owenCashPerformanceMap.values());
|
||||
int batchSize = 2000;
|
||||
Lists.partition(marketCashPerformanceList, batchSize).forEach(subList -> {
|
||||
// 在这里处理每一批数据
|
||||
log.info("处理批次-自身业绩,数量:{}", subList.size());
|
||||
cashPerformanceService.addOwenPerformanceBatch(subList);
|
||||
// 模拟处理耗时
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("现金动态自身业绩-线程中断:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 清理本页数据,帮助 GC
|
||||
cashPerformanceLogList.clear();
|
||||
cashPerformanceMap.clear();
|
||||
owenCashPerformanceMap.clear();
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Map<Long, List<Long>> batchSelectAncestorIds(Set<Long> userIdList){
|
||||
Map<Long, List<Long>> userAncestorCache = new HashMap<>();
|
||||
String key = "yiyu:market:user:ancestor:";
|
||||
userIdList.forEach(userId -> {
|
||||
Object ancestorIdsObject = bladeRedis.get(key + userId);
|
||||
if (ancestorIdsObject == null) {
|
||||
|
||||
List<Long> ancestorIds = new ArrayList<>(List.of(userId));
|
||||
ancestorIds.addAll(marketInfoService.selectAncestorIds(userId));
|
||||
bladeRedis.set(key + userId, ancestorIds);
|
||||
userAncestorCache.put(userId, ancestorIds);
|
||||
}else {
|
||||
userAncestorCache.put(userId, JSONArray.parseArray(JSONArray.toJSONString(ancestorIdsObject), Long.class));
|
||||
}
|
||||
});
|
||||
|
||||
return userAncestorCache;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageTemplateEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketWelfarePerformanceEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketWelfarePerformanceLogEntity;
|
||||
import org.springblade.modules.market.service.*;
|
||||
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.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 福利包动态业绩每日计算
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class StatsCalculatorWelfareProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||
private final IMarketWelfarePerformanceLogService welfarePerformanceLogService;
|
||||
private final IMarketBenefitPackageTemplateService benefitPackageTemplateService;
|
||||
private final IMarketBenefitPackageService benefitPackageService;
|
||||
|
||||
private final BladeRedis bladeRedis;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
Date searchDate = DateUtil.getYesterday();
|
||||
|
||||
// 福利包模版
|
||||
List<MarketBenefitPackageTemplateEntity> templateEntityList = benefitPackageTemplateService.list();
|
||||
Map<Long, MarketBenefitPackageTemplateEntity> templateEntityMap = templateEntityList.stream()
|
||||
.collect(Collectors.toMap(MarketBenefitPackageTemplateEntity::getId, Function.identity()));
|
||||
|
||||
// 昨日兑换的福利包
|
||||
List<MarketBenefitPackageEntity> benefitPackageEntityList = benefitPackageService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.eq(MarketBenefitPackageEntity::getStatisticalDate, searchDate)
|
||||
.eq(MarketBenefitPackageEntity::getType, 1)
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
.orderByAsc(MarketBenefitPackageEntity::getId)
|
||||
);
|
||||
|
||||
// 直接停止
|
||||
if (benefitPackageEntityList.isEmpty()){
|
||||
log.info("searchDate : {} 没有昨日兑换的福利包" , searchDate);
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
// 按用户分组
|
||||
Map<Long, List<MarketBenefitPackageEntity>> packageEntityMap = benefitPackageEntityList.stream()
|
||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
||||
|
||||
// 批量获取上级链
|
||||
Map<Long, List<Long>> userAncestorCache = batchSelectAncestorIds(packageEntityMap.keySet());
|
||||
|
||||
|
||||
// 准备数据容器:现在存储的是实体对象
|
||||
List<MarketWelfarePerformanceLogEntity> welfarePerformanceLogList = new ArrayList<>();
|
||||
Map<Long, MarketWelfarePerformanceEntity> welfarePerformanceMap = new HashMap<>(); // 团队业绩
|
||||
Map<Long, MarketWelfarePerformanceEntity> owenWelfarePerformanceMap = new HashMap<>(); // 自身业绩
|
||||
|
||||
// 处理每个用户的数据
|
||||
for (Map.Entry<Long, List<MarketBenefitPackageEntity>> entry : packageEntityMap.entrySet()) {
|
||||
Long userId = entry.getKey();
|
||||
List<MarketBenefitPackageEntity> packageList = entry.getValue();
|
||||
|
||||
// 计算总金额 (强制转为 BigDecimal 以防 Double 混入)
|
||||
BigDecimal totalGiveAmount = packageList.stream()
|
||||
.map(entity -> {
|
||||
BigDecimal amount = entity.getGiveAmount();
|
||||
if (amount == null) return BigDecimal.ZERO;
|
||||
return amount;
|
||||
})
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 构建来源详情
|
||||
String sourceDetail = packageList.stream()
|
||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getPackageId, Collectors.counting()))
|
||||
.entrySet().stream()
|
||||
.map(e -> {
|
||||
MarketBenefitPackageTemplateEntity template = templateEntityMap.get(e.getKey());
|
||||
return template != null ? template.getPackageName() + "(" + e.getValue() + "个);" : "";
|
||||
})
|
||||
.filter(s -> !s.isEmpty())
|
||||
.collect(Collectors.joining("", "用户业绩详情:", ""));
|
||||
|
||||
|
||||
String account = packageList.get(0) != null ? SensitiveUtil.process(String.valueOf(packageList.get(0).getPhone())) : "未知";
|
||||
String remarks = DateUtil.convertFromDate(DateUtil.getYesterday(), "yyyy-MM-dd") + "业绩来源:" + account;
|
||||
|
||||
List<Long> ancestorIds = userAncestorCache.getOrDefault(userId, Collections.emptyList());
|
||||
|
||||
|
||||
if (!owenWelfarePerformanceMap.containsKey(userId)){
|
||||
MarketWelfarePerformanceEntity entity = new MarketWelfarePerformanceEntity();
|
||||
entity.setId(userId);
|
||||
entity.setOwenAmount(totalGiveAmount);
|
||||
entity.setUpdateTime(new Date());
|
||||
owenWelfarePerformanceMap.put(userId, entity);
|
||||
}else {
|
||||
MarketWelfarePerformanceEntity entity = owenWelfarePerformanceMap.get(userId);
|
||||
entity.setOwenAmount(entity.getOwenAmount().add(totalGiveAmount));
|
||||
entity.setUpdateTime(new Date());
|
||||
owenWelfarePerformanceMap.put(userId, entity);
|
||||
}
|
||||
|
||||
|
||||
// 2. 累加团队业绩 (给所有上级)
|
||||
for (Long ancestorId : ancestorIds) {
|
||||
|
||||
if (!welfarePerformanceMap.containsKey(ancestorId)){
|
||||
MarketWelfarePerformanceEntity entity = new MarketWelfarePerformanceEntity();
|
||||
entity.setId(ancestorId);
|
||||
entity.setTotalAmount(totalGiveAmount);
|
||||
entity.setUpdateTime(new Date());
|
||||
welfarePerformanceMap.put(ancestorId, entity);
|
||||
}else {
|
||||
MarketWelfarePerformanceEntity entity = welfarePerformanceMap.get(ancestorId);
|
||||
entity.setTotalAmount(entity.getTotalAmount().add(totalGiveAmount));
|
||||
entity.setUpdateTime(new Date());
|
||||
welfarePerformanceMap.put(ancestorId, entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 3. 构建日志
|
||||
List<MarketWelfarePerformanceLogEntity> logs = createPackageInfoLog(sourceDetail, remarks, ancestorIds, userId, totalGiveAmount);
|
||||
welfarePerformanceLogList.addAll(logs);
|
||||
}
|
||||
|
||||
// 批量入库
|
||||
if (!welfarePerformanceLogList.isEmpty()) {
|
||||
welfarePerformanceLogService.saveBatch(welfarePerformanceLogList, 5000);
|
||||
}
|
||||
|
||||
// 注意:将 Map 的值转为 List 传入 Mapper
|
||||
if (!welfarePerformanceMap.isEmpty()) {
|
||||
|
||||
ArrayList<MarketWelfarePerformanceEntity> marketWelfarePerformanceList = new ArrayList<>(welfarePerformanceMap.values());
|
||||
int batchSize = 2000;
|
||||
|
||||
Lists.partition(marketWelfarePerformanceList, batchSize).forEach(subList -> {
|
||||
// 在这里处理每一批数据
|
||||
log.info("处理批次-团队业绩,数量:{}", subList.size());
|
||||
welfarePerformanceService.addPerformanceBatch(subList);
|
||||
// 模拟处理耗时
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("福利包动态团队业绩-线程中断:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (!owenWelfarePerformanceMap.isEmpty()) {
|
||||
ArrayList<MarketWelfarePerformanceEntity> marketWelfarePerformanceList = new ArrayList<>(owenWelfarePerformanceMap.values());
|
||||
int batchSize = 2000;
|
||||
Lists.partition(marketWelfarePerformanceList, batchSize).forEach(subList -> {
|
||||
// 在这里处理每一批数据
|
||||
log.info("处理批次-自身业绩,数量:{}", subList.size());
|
||||
welfarePerformanceService.addOwenPerformanceBatch(subList);
|
||||
// 模拟处理耗时
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
log.error("福利包动态自身业绩-线程中断:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Map<Long, List<Long>> batchSelectAncestorIds(Set<Long> userIdList){
|
||||
Map<Long, List<Long>> userAncestorCache = new HashMap<>();
|
||||
String key = "yiyu:market:user:ancestor:";
|
||||
userIdList.forEach(userId -> {
|
||||
Object ancestorIdsObject = bladeRedis.get(key + userId);
|
||||
if (ancestorIdsObject == null) {
|
||||
|
||||
List<Long> ancestorIds = new ArrayList<>(List.of(userId));
|
||||
ancestorIds.addAll(marketInfoService.selectAncestorIds(userId));
|
||||
bladeRedis.set(key + userId, ancestorIds);
|
||||
userAncestorCache.put(userId, ancestorIds);
|
||||
}else {
|
||||
userAncestorCache.put(userId, JSONArray.parseArray(JSONArray.toJSONString(ancestorIdsObject), Long.class));
|
||||
}
|
||||
});
|
||||
|
||||
return userAncestorCache;
|
||||
|
||||
}
|
||||
|
||||
private List<MarketWelfarePerformanceLogEntity> createPackageInfoLog(String sourceDetail , String remarks , List<Long> userIdList ,Long sourceId , BigDecimal performance) {
|
||||
|
||||
List<MarketWelfarePerformanceLogEntity> list = new ArrayList<>();
|
||||
|
||||
for (Long aLong : userIdList) {
|
||||
|
||||
MarketWelfarePerformanceLogEntity performanceLog = new MarketWelfarePerformanceLogEntity();
|
||||
performanceLog.setUserId(aLong);
|
||||
performanceLog.setStatDate(DateUtil.getYesterday());
|
||||
performanceLog.setPerformance(performance);
|
||||
performanceLog.setSourceDetail(sourceDetail);
|
||||
performanceLog.setRemarks(remarks);
|
||||
performanceLog.setSourceId(sourceId);
|
||||
list.add(performanceLog);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
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.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashPerformanceEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUpgradeCashLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUpgradeConfigEntity;
|
||||
import org.springblade.modules.market.service.IMarketCashPerformanceService;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
import org.springblade.modules.market.service.IMarketUpgradeCashLogService;
|
||||
import org.springblade.modules.market.service.IMarketUpgradeConfigService;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 现金动态升级
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TallyCashUpgradeProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketUpgradeConfigService upgradeConfigService;
|
||||
private final IMarketCashPerformanceService cashPerformanceService;
|
||||
private final IMarketUpgradeCashLogService upgradeCashLogService;
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
Date startDate = DateUtil.getYesterday();
|
||||
Date endDate = DateUtil.getToday();
|
||||
|
||||
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||
.eq(MarketUpgradeConfigEntity::getType, 2)
|
||||
.orderByAsc(MarketUpgradeConfigEntity::getSortOrder)
|
||||
);
|
||||
Map<Long, MarketUpgradeConfigEntity> upgradeConfigMap = upgradeConfigList.stream()
|
||||
.collect(Collectors.toMap(MarketUpgradeConfigEntity::getId, Function.identity()));
|
||||
|
||||
// 找出 upgradeConfigList requirementValue > 0 最小的一个元素
|
||||
MarketUpgradeConfigEntity minConfig = upgradeConfigList.stream()
|
||||
.filter(config -> config.getRequirementValue().compareTo(BigDecimal.ZERO) > 0)
|
||||
.min(Comparator.comparing(MarketUpgradeConfigEntity::getRequirementValue))
|
||||
.orElse(null);
|
||||
|
||||
if (minConfig == null){
|
||||
log.error("没有找到福利值升级最小配置");
|
||||
throw new RuntimeException("没有找到福利值升级最小配置");
|
||||
}
|
||||
|
||||
List<MarketCashPerformanceEntity> performanceList = cashPerformanceService.list(
|
||||
Wrappers.lambdaQuery(MarketCashPerformanceEntity.class)
|
||||
.ge(MarketCashPerformanceEntity::getTotalAmount, minConfig.getRequirementValue())
|
||||
.orderByAsc(MarketCashPerformanceEntity::getTotalAmount)
|
||||
);
|
||||
|
||||
List<CommonUserOrderEntity> orderEntityList = userOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||
.select(CommonUserOrderEntity::getUserId)
|
||||
.eq(CommonUserOrderEntity::getOrderType, BusinessModule.SELF_OPERATED_MALL.getCode())
|
||||
.eq(CommonUserOrderEntity::getPaymentType, 1)
|
||||
.ge(CommonUserOrderEntity::getCreateTime, startDate)
|
||||
.le(CommonUserOrderEntity::getCreateTime, endDate)
|
||||
);
|
||||
|
||||
Set<Long> orderUserIdSet = orderEntityList.stream()
|
||||
.map(CommonUserOrderEntity::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<MarketUpgradeCashLogEntity> upgradeCashLogList = new ArrayList<>();
|
||||
|
||||
performanceList.forEach(performance -> {
|
||||
|
||||
long count = marketInfoService.count(
|
||||
Wrappers.lambdaQuery(MarketInfoEntity.class)
|
||||
.eq(MarketInfoEntity::getPid, performance.getId())
|
||||
|
||||
);
|
||||
|
||||
if (count < minConfig.getDirectRecommend()){
|
||||
log.error("用户ID:{} 没有达到升级条件 , 最低直推人数: {} , 现有直推人数: {}", performance.getId() , minConfig.getDirectRecommend() , count);
|
||||
return;
|
||||
}
|
||||
|
||||
long lastLevelId = upgradeConfigList.get(0).getId();
|
||||
MarketUpgradeCashLogEntity lastUpgradeWelfareLog = upgradeCashLogService.getOne(
|
||||
Wrappers.lambdaQuery(MarketUpgradeCashLogEntity.class)
|
||||
.eq(MarketUpgradeCashLogEntity::getUserId, performance.getId())
|
||||
.orderByDesc(MarketUpgradeCashLogEntity::getCreateTime)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (lastUpgradeWelfareLog != null){
|
||||
lastLevelId = lastUpgradeWelfareLog.getCurrentLevelId();
|
||||
}
|
||||
|
||||
Long upgradeId = getUpgradeId(upgradeConfigMap, minConfig.getId(), performance.getTotalAmount(), count);
|
||||
boolean contains = orderUserIdSet.contains(performance.getId());
|
||||
String spending = contains ? "自营商城已消费" : "自营商城未消费";
|
||||
|
||||
MarketUpgradeCashLogEntity upgradeCashLog = new MarketUpgradeCashLogEntity();
|
||||
upgradeCashLog.setUserId(performance.getId());
|
||||
upgradeCashLog.setLastLevel(lastLevelId);
|
||||
upgradeCashLog.setCurrentLevelId(upgradeId);
|
||||
upgradeCashLog.setCurrentLevelName(upgradeConfigMap.get(upgradeId).getLevelName());
|
||||
upgradeCashLog.setUpgradeDate(DateUtil.getYesterday());
|
||||
upgradeCashLog.setRemarks(DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd") +"升级详情: 业绩 " + performance.getTotalAmount() + "福利值, 下级人数" + count + "人," + spending);
|
||||
upgradeCashLogList.add(upgradeCashLog);
|
||||
});
|
||||
|
||||
upgradeCashLogService.saveBatch(upgradeCashLogList, 2000);
|
||||
// if (upgradeCashLogService.saveBatch(upgradeCashLogList, 2000)){
|
||||
// List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = upgradeCashLogList.stream()
|
||||
// .map(upgradeConfig -> new MarketUpgradeNoticeEvent.NoticeItem(
|
||||
// upgradeConfig.getUserId(),
|
||||
// "当前等级:" + upgradeConfig.getCurrentLevelName() + "," +upgradeConfig.getRemarks()
|
||||
// ))
|
||||
// .collect(Collectors.toList());
|
||||
// // 2. 发送事件 (只发一次,传入全部数据)
|
||||
// MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
||||
// noticeItems,
|
||||
// MarketBusinessModule.CASH_UPGRADE
|
||||
// );
|
||||
//
|
||||
// publisher.publishEvent(event);
|
||||
// log.info("已发布批量升级事件,数量: {}", noticeItems.size());
|
||||
// }
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
private Long getUpgradeId(Map<Long, MarketUpgradeConfigEntity> upgradeConfigMap,
|
||||
Long currentLevelId,
|
||||
BigDecimal performance,
|
||||
Long childCount){
|
||||
|
||||
if (!upgradeConfigMap.containsKey(currentLevelId)) {
|
||||
throw new RuntimeException("没有找到对应的福利值升级配置, levelId: " + currentLevelId);
|
||||
}
|
||||
|
||||
Long levelId = currentLevelId;
|
||||
|
||||
// 2. 持续尝试升级,直到不满足条件或到达顶层
|
||||
while (true) {
|
||||
MarketUpgradeConfigEntity config = upgradeConfigMap.get(levelId);
|
||||
|
||||
// 3. 检查是否满足升级条件(业绩达标 && 下级数量达标)
|
||||
boolean meetsPerformance = performance.compareTo(config.getRequirementValue()) >= 0;
|
||||
boolean meetsChildCount = childCount >= config.getDirectRecommend();
|
||||
|
||||
// 4. 如果有下一级 且 满足条件,则跳到下一级;否则停止
|
||||
if (config.getHasNextLevel() == 1 && meetsPerformance && meetsChildCount) {
|
||||
levelId = config.getNextLevelId();
|
||||
} else {
|
||||
break; // 不满足条件 或 已经是顶级,跳出循环
|
||||
}
|
||||
}
|
||||
|
||||
return levelId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
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.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUpgradeConfigEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUpgradeWelfareLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketWelfarePerformanceEntity;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
import org.springblade.modules.market.service.IMarketUpgradeConfigService;
|
||||
import org.springblade.modules.market.service.IMarketUpgradeWelfareLogService;
|
||||
import org.springblade.modules.market.service.IMarketWelfarePerformanceService;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 福利包动态升级
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketUpgradeConfigService upgradeConfigService;
|
||||
private final IMarketUpgradeWelfareLogService upgradeWelfareLogService;
|
||||
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
Date startDate = DateUtil.getYesterday();
|
||||
Date endDate = DateUtil.getToday();
|
||||
|
||||
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||
.eq(MarketUpgradeConfigEntity::getType, 1)
|
||||
.orderByAsc(MarketUpgradeConfigEntity::getSortOrder)
|
||||
);
|
||||
Map<Long, MarketUpgradeConfigEntity> upgradeConfigMap = upgradeConfigList.stream()
|
||||
.collect(Collectors.toMap(MarketUpgradeConfigEntity::getId, Function.identity()));
|
||||
|
||||
// 找出 upgradeConfigList requirementValue > 0 最小的一个元素
|
||||
MarketUpgradeConfigEntity minConfig = upgradeConfigList.stream()
|
||||
.filter(config -> config.getRequirementValue().compareTo(BigDecimal.ZERO) > 0)
|
||||
.min(Comparator.comparing(MarketUpgradeConfigEntity::getRequirementValue))
|
||||
.orElse(null);
|
||||
|
||||
if (minConfig == null){
|
||||
log.error("没有找到福利值升级最小配置");
|
||||
throw new RuntimeException("没有找到福利值升级最小配置");
|
||||
}
|
||||
|
||||
List<MarketWelfarePerformanceEntity> performanceList = welfarePerformanceService.list(
|
||||
Wrappers.lambdaQuery(MarketWelfarePerformanceEntity.class)
|
||||
.ge(MarketWelfarePerformanceEntity::getTotalAmount, minConfig.getRequirementValue())
|
||||
.orderByAsc(MarketWelfarePerformanceEntity::getTotalAmount)
|
||||
);
|
||||
|
||||
List<CommonUserOrderEntity> orderEntityList = userOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||
.select(CommonUserOrderEntity::getUserId)
|
||||
.eq(CommonUserOrderEntity::getOrderType, BusinessModule.SELF_OPERATED_MALL.getCode())
|
||||
.eq(CommonUserOrderEntity::getPaymentType, 1)
|
||||
.ge(CommonUserOrderEntity::getCreateTime, startDate)
|
||||
.le(CommonUserOrderEntity::getCreateTime, endDate)
|
||||
);
|
||||
|
||||
Set<Long> orderUserIdSet = orderEntityList.stream()
|
||||
.map(CommonUserOrderEntity::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<MarketUpgradeWelfareLogEntity> upgradeWelfareLogList = new ArrayList<>();
|
||||
|
||||
performanceList.forEach(performance -> {
|
||||
|
||||
long count = marketInfoService.count(
|
||||
Wrappers.lambdaQuery(MarketInfoEntity.class)
|
||||
.eq(MarketInfoEntity::getPid, performance.getId())
|
||||
|
||||
);
|
||||
if (count < minConfig.getDirectRecommend()){
|
||||
log.error("用户ID:{} 没有达到升级条件 , 最低直推人数: {} , 现有直推人数: {}", performance.getId() , minConfig.getDirectRecommend() , count);
|
||||
return;
|
||||
}
|
||||
|
||||
long lastLevelId = upgradeConfigList.get(0).getId();
|
||||
MarketUpgradeWelfareLogEntity lastUpgradeWelfareLog = upgradeWelfareLogService.getOne(
|
||||
Wrappers.lambdaQuery(MarketUpgradeWelfareLogEntity.class)
|
||||
.eq(MarketUpgradeWelfareLogEntity::getUserId, performance.getId())
|
||||
.orderByDesc(MarketUpgradeWelfareLogEntity::getCreateTime)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (lastUpgradeWelfareLog != null){
|
||||
lastLevelId = lastUpgradeWelfareLog.getCurrentLevelId();
|
||||
}
|
||||
|
||||
Long upgradeId = getUpgradeId(upgradeConfigMap, minConfig.getId(), performance.getTotalAmount(), count);
|
||||
|
||||
boolean contains = orderUserIdSet.contains(performance.getId());
|
||||
String spending = contains ? "自营商城已消费" : "自营商城未消费";
|
||||
|
||||
MarketUpgradeWelfareLogEntity upgradeWelfareLog = new MarketUpgradeWelfareLogEntity();
|
||||
upgradeWelfareLog.setUserId(performance.getId());
|
||||
upgradeWelfareLog.setLastLevel(lastLevelId);
|
||||
upgradeWelfareLog.setCurrentLevelId(upgradeId);
|
||||
upgradeWelfareLog.setCurrentLevelName(upgradeConfigMap.get(upgradeId).getLevelName());
|
||||
upgradeWelfareLog.setUpgradeDate(DateUtil.getYesterday());
|
||||
upgradeWelfareLog.setRemarks(DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd") +"升级详情: 业绩 " + performance.getTotalAmount() + "福利值, 下级人数" + count + "人," + spending);
|
||||
upgradeWelfareLogList.add(upgradeWelfareLog);
|
||||
});
|
||||
upgradeWelfareLogService.saveBatch(upgradeWelfareLogList, 2000);
|
||||
// if (upgradeWelfareLogService.saveBatch(upgradeWelfareLogList, 2000)){
|
||||
// List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = upgradeWelfareLogList.stream()
|
||||
// .map(upgradeConfig -> new MarketUpgradeNoticeEvent.NoticeItem(
|
||||
// upgradeConfig.getUserId(),
|
||||
// "当前等级:" + upgradeConfig.getCurrentLevelName() + "," +upgradeConfig.getRemarks()
|
||||
// ))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 2. 发送事件 (只发一次,传入全部数据)
|
||||
// MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
||||
// noticeItems,
|
||||
// MarketBusinessModule.WELFARE_UPGRADE
|
||||
// );
|
||||
//
|
||||
// publisher.publishEvent(event);
|
||||
//
|
||||
// log.info("已发布批量升级事件,数量: {}", noticeItems.size());
|
||||
// }
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
private Long getUpgradeId(Map<Long, MarketUpgradeConfigEntity> upgradeConfigMap,
|
||||
Long currentLevelId,
|
||||
BigDecimal performance,
|
||||
Long childCount){
|
||||
|
||||
if (!upgradeConfigMap.containsKey(currentLevelId)) {
|
||||
throw new RuntimeException("没有找到对应的福利值升级配置, levelId: " + currentLevelId);
|
||||
}
|
||||
|
||||
Long levelId = currentLevelId;
|
||||
|
||||
// 2. 持续尝试升级,直到不满足条件或到达顶层
|
||||
while (true) {
|
||||
MarketUpgradeConfigEntity config = upgradeConfigMap.get(levelId);
|
||||
|
||||
// 3. 检查是否满足升级条件(业绩达标 && 下级数量达标)
|
||||
boolean meetsPerformance = performance.compareTo(config.getRequirementValue()) >= 0;
|
||||
boolean meetsChildCount = childCount >= config.getDirectRecommend();
|
||||
|
||||
// 4. 如果有下一级 且 满足条件,则跳到下一级;否则停止
|
||||
if (config.getHasNextLevel() == 1 && meetsPerformance && meetsChildCount) {
|
||||
levelId = config.getNextLevelId();
|
||||
} else {
|
||||
break; // 不满足条件 或 已经是顶级,跳出循环
|
||||
}
|
||||
}
|
||||
|
||||
return levelId;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,15 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.redis.debounce.RedisDebounce;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.*;
|
||||
import org.springblade.modules.api.response.CheckVersionResponse;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.common.eums.AppType;
|
||||
import org.springblade.modules.common.manager.AppCommonManager;
|
||||
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
||||
import org.springblade.modules.common.service.ICommonRegionsInfoService;
|
||||
import org.springblade.modules.common.service.*;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -18,34 +24,83 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-common")
|
||||
@RequestMapping("/app/common")
|
||||
@Tag(name = "APP基础接口", description = "APP基础接口")
|
||||
public class APPCommonController {
|
||||
|
||||
private final IUserService userService;
|
||||
private final ICommonRegionsInfoService commonRegionsInfoService;
|
||||
|
||||
private final ICommonTourInfoService commonTourInfoService;
|
||||
private final AppCommonManager appCommonManager;
|
||||
private final ICommonReleaseVersionService releaseVersionService;
|
||||
|
||||
/**
|
||||
* 最新版本
|
||||
*/
|
||||
@GetMapping("/latest-version")
|
||||
@GetMapping("/version")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "最新版本")
|
||||
public R<Boolean> hasChangedPassword() {
|
||||
return R.data(userService.hasChangedPassword());
|
||||
public R<CheckVersionResponse> checkVersion(String version, String brand) {
|
||||
return R.data(releaseVersionService.checkUpdate(AppType.APP.getCode(), version, brand));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取省市区列表
|
||||
*/
|
||||
@GetMapping("/find-region-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@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) {
|
||||
return R.data(commonRegionsInfoService.findRegionList(pid , 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));
|
||||
}
|
||||
|
||||
|
||||
// 发送忘记密码的短信
|
||||
@RedisDebounce(key = "sms:forget_pwd", param = "#request.phone", interval = 60, includeRemainingTime = true, message = "短信发送过于频繁")
|
||||
@PostMapping("/send-forget-pwd-sms")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "发送忘记密码短信")
|
||||
public R<Boolean> sendForgetPwdSms(@RequestBody ForgetPwdSmsRequest request) {
|
||||
return R.status(userService.sendForgetPwdSms(request));
|
||||
}
|
||||
|
||||
// 提交验证码和新密码进行修改
|
||||
@PostMapping("/retrieve-password")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "重置密码")
|
||||
public R<Boolean> retrievePassword(@RequestBody ResetPasswordRequest request) {
|
||||
return R.status(userService.retrievePassword(request));
|
||||
}
|
||||
|
||||
@GetMapping("/tour-info-list")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "出行人列表")
|
||||
public R<List<CommonTourInfoApiVO>> tourUserProfileList() {
|
||||
return R.data(commonTourInfoService.tourUserProfileList());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/submit-tour-info")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增出行人信息")
|
||||
public R<Boolean> submitTourUserProfile(@RequestBody CommonTourUserInfoRequest request) {
|
||||
return R.data(commonTourInfoService.submitTourUserProfile(request));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-tour-info")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "删除出行人信息")
|
||||
public R<Boolean> removeTourUserProfile(@RequestBody CommonRemoveTourRequest request) {
|
||||
return R.data(commonTourInfoService.removeTourUserProfile(request.getIds()));
|
||||
}
|
||||
|
||||
@GetMapping("/pay-type")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "支付渠道")
|
||||
public R<List<CommonModulePayTypeApiVO>> getModulePayTypeList(@RequestParam String moduleCode) {
|
||||
return R.data(appCommonManager.getModulePayTypeList(moduleCode));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
||||
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderDetailApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductDetailApiVO;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.mall.service.IMallProductService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app/eco")
|
||||
@Tag(name = "APP生态产品接口", description = "APP生态产品接口")
|
||||
public class APPEcoController {
|
||||
|
||||
private final IMallProductService productService;
|
||||
private final ICommonUserOrderService orderService;
|
||||
/**
|
||||
* 生态产品-商品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "生态产品-商品列表")
|
||||
public R<List<MallProductApiVO>> ecosystemProductList() {
|
||||
return R.data(productService.apiVoEcosListToCategory());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "详情", description = "传入vo")
|
||||
public R<MallProductDetailApiVO> detail(@Valid MallProductDetailApiVO vo) {
|
||||
return R.data(productService.apiDetailVO(vo.getId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*/
|
||||
@PostMapping("/create-order")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "下单", description = "传入CreateMallOrderRequest")
|
||||
public R<CreateOrderResponse> createOrder(@Valid @RequestBody CreateMallOrderRequest request) {
|
||||
return R.data(orderService.createEcoOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认收货
|
||||
*/
|
||||
@PostMapping("/confirm")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "确认收货", description = "传入ConfirmOrderRequest")
|
||||
public R confirm(@Valid @RequestBody ConfirmOrderRequest request) {
|
||||
return R.status(orderService.confirmEcoOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户订单详情
|
||||
*/
|
||||
@GetMapping("/order-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户订单详情")
|
||||
public R<CommonUserOrderDetailApiVO> orderDetail(Long id) {
|
||||
return R.data(orderService.orderDetail(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,101 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
||||
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderDetailApiVO;
|
||||
import org.springblade.modules.api.vo.MallCategoryApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductDetailApiVO;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.mall.convert.AppMallConvert;
|
||||
import org.springblade.modules.mall.service.IMallCategoryService;
|
||||
import org.springblade.modules.mall.service.IMallProductService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-mall")
|
||||
@Tag(name = "APP用户接口", description = "APP用户接口")
|
||||
@RequestMapping("/app/mall")
|
||||
@Tag(name = "APP自营商城接口", description = "APP自营商城接口")
|
||||
public class APPMallController {
|
||||
|
||||
private final IMallProductService productService;
|
||||
|
||||
private final IMallCategoryService categoryService;
|
||||
|
||||
private final ICommonUserOrderService orderService;
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
@GetMapping("/categories")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "列表")
|
||||
public R<List<MallCategoryApiVO>> categories() {
|
||||
return R.data(AppMallConvert.INSTANCE.convertMallCategoryApiListVO(categoryService.categoryList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "列表")
|
||||
public R<List<MallProductApiVO>> list(@RequestParam(required = false) Long categoryId) {
|
||||
return R.data(productService.apiVoList(categoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "详情", description = "传入vo")
|
||||
public R<MallProductDetailApiVO> detail(@Valid MallProductDetailApiVO vo) {
|
||||
return R.data(productService.apiDetailVO(vo.getId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*/
|
||||
@PostMapping("/create-order")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "下单", description = "传入CreateMallOrderRequest")
|
||||
public R<CreateOrderResponse> createOrder(@Valid @RequestBody CreateMallOrderRequest request) {
|
||||
return R.data(orderService.createMallOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认收货
|
||||
*/
|
||||
@PostMapping("/confirm")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "确认收货", description = "传入ConfirmOrderRequest")
|
||||
public R confirm(@Valid @RequestBody ConfirmOrderRequest request) {
|
||||
return R.status(orderService.confirmMallOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户订单详情
|
||||
*/
|
||||
@GetMapping("/order-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户订单详情")
|
||||
public R<CommonUserOrderDetailApiVO> orderDetail(Long id) {
|
||||
return R.data(orderService.orderDetail(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.vo.CommonNewsCategoryApiVO;
|
||||
import org.springblade.modules.api.vo.CommonNewsContentApiVO;
|
||||
import org.springblade.modules.api.vo.CommonNewsContentDetailApiVO;
|
||||
import org.springblade.modules.common.service.INewsCategoryService;
|
||||
import org.springblade.modules.common.service.INewsContentService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app/news")
|
||||
@Tag(name = "APP资讯接口", description = "APP资讯接口")
|
||||
public class APPNewsController {
|
||||
|
||||
private final INewsCategoryService newsCategoryService;
|
||||
private final INewsContentService newsContentService;
|
||||
|
||||
@GetMapping("/category-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "资讯分类列表")
|
||||
public R<List<CommonNewsCategoryApiVO>> newsCategoryList() {
|
||||
return R.data(newsCategoryService.newsCategoryList());
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "资讯列表")
|
||||
public R<IPage<CommonNewsContentApiVO>> newsContentList(IPage<CommonNewsContentApiVO> page , @RequestParam(required = false) Long categoryId) {
|
||||
return R.data(newsContentService.newsCategoryList(page , categoryId));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "资讯详情")
|
||||
public R<CommonNewsContentDetailApiVO> newsContentDetail(CommonNewsContentApiVO vo) {
|
||||
return R.data(newsContentService.newsContentDetail(vo.getId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.MerchantStoreRequest;
|
||||
import org.springblade.modules.api.vo.CommonMerchantStoreApiVO;
|
||||
import org.springblade.modules.api.vo.CommonMerchantStoreDetailApiVO;
|
||||
import org.springblade.modules.common.service.IMerchantFlagshipStoreService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app/store")
|
||||
@Tag(name = "APP商家店铺接口", description = "APP商家店铺接口")
|
||||
public class APPStoreController {
|
||||
|
||||
private final IMerchantFlagshipStoreService merchantFlagshipStoreService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "商家店铺列表")
|
||||
public R<IPage<CommonMerchantStoreApiVO>> merchantStoreList(MerchantStoreRequest request , IPage<CommonMerchantStoreApiVO> page) {
|
||||
return R.data(merchantFlagshipStoreService.merchantStoreList(request , page));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "商家店铺详情")
|
||||
public R<CommonMerchantStoreDetailApiVO> merchantStoreDetail(CommonMerchantStoreApiVO vo) {
|
||||
return R.data(merchantFlagshipStoreService.merchantStoreDetail(vo.getId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.*;
|
||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.common.service.ICommonTourInfoService;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.common.service.ITourProductService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app/tour")
|
||||
@Tag(name = "APP旅游团接口", description = "APP旅游团接口")
|
||||
public class APPTourController {
|
||||
|
||||
private final ITourProductService tourProductService;
|
||||
private final ICommonUserOrderService orderService;
|
||||
|
||||
|
||||
@GetMapping("/product-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "旅游团列表")
|
||||
public R<IPage<CommonTourProductApiVO>> tourProductList(IPage<CommonTourProductApiVO> page , TourProductRequest request) {
|
||||
return R.data(tourProductService.tourProductList(page ,request));
|
||||
}
|
||||
|
||||
@GetMapping("/product-top-list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "旅游团推荐列表")
|
||||
public R<IPage<CommonTourProductApiVO>> tourProductTopList(IPage<CommonTourProductApiVO> page , TourProductRequest request) {
|
||||
return R.data(tourProductService.tourProductTopList(page ,request));
|
||||
}
|
||||
|
||||
@GetMapping("/product-detail")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "旅游团详情")
|
||||
public R<CommonTourProductDetailApiVO> tourProductDetail(CommonTourProductApiVO vo) {
|
||||
return R.data(tourProductService.tourProductDetail(vo.getId()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 旅行团下单
|
||||
*/
|
||||
@PostMapping("/create-order")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "下单", description = "传入CreateTravelOrderRequest")
|
||||
public R<CreateOrderResponse> createOrder(@Valid @RequestBody CreateTravelOrderRequest request) {
|
||||
return R.data(orderService.createTravelOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认收货
|
||||
*/
|
||||
@PostMapping("/confirm")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "确认收货", description = "传入ConfirmOrderRequest")
|
||||
public R confirm(@Valid @RequestBody ConfirmOrderRequest request) {
|
||||
return R.status(orderService.confirmTravelOrder(request));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/order-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "旅行团订单详情")
|
||||
public R<CommonTravelOrderDetailApiVO> orderDetail(Long id) {
|
||||
return R.data(orderService.travelOrderDetail(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.vo.CommonTourismSpotApiVO;
|
||||
import org.springblade.modules.api.vo.CommonTourismSpotDetailApiVO;
|
||||
import org.springblade.modules.common.service.ICulturalTourismSpotService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app/tourism-spot")
|
||||
@Tag(name = "APP文旅接口", description = "APP文旅接口")
|
||||
public class APPTourismSpotController {
|
||||
|
||||
private final ICulturalTourismSpotService culturalTourismSpotService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "文旅景点列表")
|
||||
public R<IPage<CommonTourismSpotApiVO>> tourismSpotList(IPage<CommonTourismSpotApiVO> page) {
|
||||
return R.data(culturalTourismSpotService.tourismSpotList(page));
|
||||
}
|
||||
|
||||
@GetMapping("/top-list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "文旅景点推荐列表")
|
||||
public R<IPage<CommonTourismSpotApiVO>> tourismSpotTopList(IPage<CommonTourismSpotApiVO> page) {
|
||||
return R.data(culturalTourismSpotService.tourismSpotTopList(page));
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "文旅景点详情")
|
||||
public R<CommonTourismSpotDetailApiVO> tourismSpotDetail(CommonTourismSpotApiVO vo) {
|
||||
return R.data(culturalTourismSpotService.tourismSpotDetail(vo.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +1,49 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
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.*;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
import org.springblade.modules.api.service.IPaymentService;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
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
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-user")
|
||||
@RequestMapping("/app/user")
|
||||
@Tag(name = "APP用户接口", description = "APP用户接口")
|
||||
public class APPUserController {
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
private final ICommonUserOrderService orderService;
|
||||
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
private final ICommonUserAddressService addressService;
|
||||
|
||||
private final ICommonUserPointService pointService;
|
||||
|
||||
private final ICommonLotteryRecordService lotteryRecordService;
|
||||
|
||||
private final ICommonLotteryPrizeService lotteryPrizeService;
|
||||
|
||||
private final IPaymentService paymentService;
|
||||
|
||||
|
||||
/**
|
||||
* 是否修改过密码
|
||||
@@ -35,7 +61,7 @@ public class APPUserController {
|
||||
@PostMapping("/change-password")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "修改登录密码", description = "传入String")
|
||||
public R submit(@RequestBody String password) {
|
||||
public R changePassword(@RequestBody String password) {
|
||||
return R.status(userService.changePassword(password));
|
||||
}
|
||||
|
||||
@@ -49,4 +75,136 @@ public class APPUserController {
|
||||
return R.data(userService.inviteCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝支付
|
||||
*/
|
||||
@PostMapping("/ali-pay")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "支付", description = "传入PaymentRequest")
|
||||
public R<PaymentResponse> aliPay(@Valid @RequestBody PaymentRequest request) {
|
||||
return R.data(paymentService.aliAppPay(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
*/
|
||||
@PostMapping("/wx-pay")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "支付", description = "传入PaymentRequest")
|
||||
public R<PaymentResponse> wxPay(@Valid @RequestBody PaymentRequest request) {
|
||||
return R.data(paymentService.wxAppPay(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户订单列表
|
||||
*/
|
||||
@GetMapping("/order-page")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "用户订单分页列表", description = "传入userAddress")
|
||||
public R<IPage<CommonUserOrderApiVO>> orderList(CommonUserOrderApiVO userOrder, Query query) {
|
||||
IPage<CommonUserOrderApiVO> pages = orderService.selectOrderApiPage(Condition.getPage(query), userOrder);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/system-notice")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "APP系统消息列表")
|
||||
public R<List<CommonUserNoticeApiVO>> systemNotice() {
|
||||
return R.data(userNoticeService.appSystemNoticeList());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-notice")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
||||
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/notice-detail")
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "用户读取消息")
|
||||
public R<CommonUserNoticeDetailApiVO> noticeDetail(Long id) {
|
||||
return R.data(userNoticeService.userNoticeDetail(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/unread")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "用户未读消息数量")
|
||||
public R<Long> unreadNum() {
|
||||
return R.data(userNoticeService.appUnreadNoticeNum());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-address")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "用户收货地址", description = "传入userAddressVO")
|
||||
public R<List<CommonUserAddressApiVO>> addressList(Query query) {
|
||||
return R.data(addressService.selectAddressList(Condition.getPage(query), new CommonUserAddressApiVO()));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/submit-address")
|
||||
@ApiOperationSupport(order = 13)
|
||||
@Operation(summary = "提交用户收货地址", description = "传入AddressSubmitRequest")
|
||||
public R<Boolean> submitAddress(@Valid @RequestBody AddressSubmitRequest request) {
|
||||
return R.status(addressService.submitAddress(request));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete-address")
|
||||
@ApiOperationSupport(order = 14)
|
||||
@Operation(summary = "删除用户收货地址", description = "传入id")
|
||||
public R<Boolean> removeAddress(@Valid @RequestBody AddressRemoveRequest request) {
|
||||
return R.status(addressService.removeAddress(request.getIds()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-points")
|
||||
@ApiOperationSupport(order = 15)
|
||||
@Operation(summary = "用户积分查询")
|
||||
public R<BigDecimal> userPoints() {
|
||||
return R.data(pointService.queryPoint());
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-prizes")
|
||||
@ApiOperationSupport(order = 16)
|
||||
@Operation(summary = "奖品列表")
|
||||
public R<List<CommonLotteryPrizeApiVO>> lotteryPrizes() {
|
||||
return R.data(lotteryPrizeService.staticList());
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-records")
|
||||
@ApiOperationSupport(order = 17)
|
||||
@Operation(summary = "抽奖记录")
|
||||
public R<IPage<CommonLotteryRecordApiVO>> lotteryRecords(Query query) {
|
||||
return R.data(lotteryRecordService.selectLotteryRecordApiPage(Condition.getPage(query), new CommonLotteryRecordApiVO()));
|
||||
}
|
||||
|
||||
@PostMapping("/lottery-draw")
|
||||
@ApiOperationSupport(order = 18)
|
||||
@Operation(summary = "用户抽奖", description = "传入LotteriesDrawRequest")
|
||||
public R<CommonLotteryPrizeApiVO> draw(@Valid @RequestBody LotteryDrawRequest request) {
|
||||
return R.data(lotteryPrizeService.draw(request));
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-rules")
|
||||
@ApiOperationSupport(order = 19)
|
||||
@Operation(summary = "抽奖规则")
|
||||
public R<String> lotteryRules() {
|
||||
return R.data(lotteryPrizeService.rules());
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-winners")
|
||||
@ApiOperationSupport(order = 20)
|
||||
@Operation(summary = "获奖名单")
|
||||
public R<List<CommonLotteryWinnerApiVO>> lotteryWinners() {
|
||||
return R.data(lotteryRecordService.lotteryWinners());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.springblade.modules.api.constant;
|
||||
|
||||
public interface AppAliPayConstant {
|
||||
|
||||
String APP_ALI_AES_KEY = "yichuyilu.app.ali.aes.key";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.springblade.modules.api.market;
|
||||
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.response.CheckVersionResponse;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.common.eums.AppType;
|
||||
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/common")
|
||||
@Tag(name = "APP福利包接口", description = "APP福利包接口")
|
||||
public class MarketCommonController {
|
||||
|
||||
private final ICommonReleaseVersionService releaseVersionService;
|
||||
|
||||
|
||||
/**
|
||||
* 最新版本
|
||||
*/
|
||||
@GetMapping("/version")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "最新版本")
|
||||
public R<CheckVersionResponse> checkVersion(String version, String brand) {
|
||||
return R.data(releaseVersionService.checkUpdate(AppType.MARKET.getCode(), version, brand));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package org.springblade.modules.api.market;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
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.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.market.manager.MarketUserPointManager;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/user")
|
||||
@Tag(name = "APP福利包接口", description = "APP福利包接口")
|
||||
public class MarketUserController {
|
||||
|
||||
private final IMarketBenefitPackageService userMarketBenefitPackageService;
|
||||
|
||||
private final MarketUserManager marketUserManager;
|
||||
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
private final MarketUserPointManager marketUserPointManager;
|
||||
|
||||
|
||||
@GetMapping("/package-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
||||
public R<IPage<MarketBenefitPackageVO>> findUserPackList(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
|
||||
IPage<MarketBenefitPackageVO> pages = userMarketBenefitPackageService.findUserPackList(Condition.getPage(query),userMarketBenefitPackage , AuthUtil.getUserId());
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/my-team")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "查直推")
|
||||
public R<List<MarketDirectInfoApiVO>> myTeam() {
|
||||
return R.data(marketUserManager.findUserPackList());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/my-invitor")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "查推荐人信息")
|
||||
public R<MarketDirectInfoApiVO> myInvitor() {
|
||||
return R.data(marketUserManager.findMarketParent());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/system-notice")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "Market系统消息列表")
|
||||
public R<List<CommonUserNoticeApiVO>> systemNotice() {
|
||||
return R.data(userNoticeService.marketSystemNoticeList());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-notice")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "Market用户消息列表", description = "传入userNoticeVO")
|
||||
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectMarketUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/notice-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户消息详情", description = "传入request")
|
||||
public R<CommonUserNoticeDetailApiVO> noticeDetail(Long id) {
|
||||
return R.data(userNoticeService.userNoticeDetail(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/unread")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "Market用户未读消息数量")
|
||||
public R<Long> unreadNum() {
|
||||
return R.data(userNoticeService.marketUnreadNoticeNum());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AddressRemoveRequest implements Serializable {
|
||||
|
||||
@NotEmpty(message = "至少选择一条地址")
|
||||
private List<Long> ids;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AddressSubmitRequest implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "请选择地区")
|
||||
private Integer regionsId;
|
||||
|
||||
@NotEmpty(message = "详细地址必填")
|
||||
private String detail;
|
||||
|
||||
@NotEmpty(message = "联系人必填")
|
||||
private String consignee;
|
||||
|
||||
@NotEmpty(message = "手机号必填")
|
||||
private String phone;
|
||||
|
||||
@NotNull(message = "是否默认必选")
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CommonRemoveTourRequest implements Serializable {
|
||||
@NotEmpty(message = "至少选择一条出行人信息")
|
||||
private List<Long> ids;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CommonTourUserInfoRequest implements Serializable {
|
||||
private Long id;
|
||||
private String contactPhone;
|
||||
private String userName;
|
||||
private String idCardNo;
|
||||
private String passportNo;
|
||||
private String hkMacauPassNo;
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConfirmOrderRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "Id is missing")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CreateMallOrderRequest implements Serializable {
|
||||
|
||||
@NotEmpty(message = "请填写联系人")
|
||||
private String consignee;
|
||||
|
||||
@NotEmpty(message = "请填写联系电话")
|
||||
private String consigneePhone;
|
||||
|
||||
@NotEmpty(message = "订单类型为空")
|
||||
private String orderType;
|
||||
|
||||
@NotEmpty(message = "商品编号为空")
|
||||
private String itemCode;
|
||||
|
||||
@NotNull(message = "商品数量不能为空")
|
||||
@Min(value = 1, message = "无效商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@NotEmpty(message = "请填写收货地址")
|
||||
private String address;
|
||||
|
||||
@NotNull(message = "无效支付方式")
|
||||
private Integer paymentType;
|
||||
|
||||
@NotNull(message = "无效标识")
|
||||
private Boolean isOfflinePayment;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CreateTravelOrderRequest implements Serializable {
|
||||
|
||||
|
||||
|
||||
@NotEmpty(message = "订单类型为空")
|
||||
private String orderType;
|
||||
|
||||
@NotEmpty(message = "商品编号为空")
|
||||
private String itemCode;
|
||||
|
||||
@Min(value = 1, message = "无效商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
|
||||
@NotNull(message = "无效支付方式")
|
||||
private Integer paymentType;
|
||||
|
||||
@NotNull(message = "无效标识")
|
||||
private Boolean isOfflinePayment;
|
||||
|
||||
|
||||
/**
|
||||
* 旅行团出行日期
|
||||
*/
|
||||
private Date tourStartDate;
|
||||
/**
|
||||
* 旅行团返回日期
|
||||
*/
|
||||
private Date tourEndDate;
|
||||
|
||||
private List<Long> tourInfoIds;
|
||||
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ForgetPwdSmsRequest implements Serializable {
|
||||
|
||||
private String phone;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class MerchantStoreRequest implements Serializable {
|
||||
|
||||
private BigDecimal longitude;
|
||||
private BigDecimal latitude;
|
||||
// private BigDecimal distance = new BigDecimal("2000");
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PaymentRequest implements Serializable {
|
||||
|
||||
private String orderId;
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ResetPasswordRequest implements Serializable {
|
||||
|
||||
private String phone;
|
||||
private String smsCode;
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class TourProductRequest implements Serializable {
|
||||
|
||||
private String cityName;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CheckVersionResponse implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Boolean needUpdate = Boolean.FALSE;
|
||||
|
||||
private Boolean isForceUpdate = Boolean.FALSE;
|
||||
|
||||
private String updateVersion;
|
||||
|
||||
private String updateContent;
|
||||
|
||||
private String url;
|
||||
|
||||
private String qihooUrl;
|
||||
|
||||
private String yingyongbaoUrl;
|
||||
|
||||
private String webDownloadUrl;
|
||||
|
||||
private String fallbackUrl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CreateOrderResponse implements Serializable {
|
||||
|
||||
private String orderId;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal discount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PaymentResponse implements Serializable {
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
private String payChannel;
|
||||
|
||||
private String params;
|
||||
|
||||
public PaymentResponse(Integer paymentType, String payChannel, String params) {
|
||||
this.paymentType = paymentType;
|
||||
this.payChannel = payChannel;
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.springblade.modules.api.service;
|
||||
|
||||
import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||
import org.springblade.modules.api.request.PaymentRequest;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
|
||||
|
||||
public interface IPaymentService {
|
||||
|
||||
PaymentResponse aliAppPay(PaymentRequest request) ;
|
||||
|
||||
AlipayTradeQueryResponse aliQuery(String orderNo);
|
||||
|
||||
Boolean aliCloseOrder(String orderNo);
|
||||
|
||||
PaymentResponse wxAppPay(PaymentRequest request);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package org.springblade.modules.api.service.impl;
|
||||
|
||||
import com.alipay.api.response.AlipayTradeCloseResponse;
|
||||
import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.cache.PaymentCache;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
import org.springblade.modules.api.request.PaymentRequest;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
import org.springblade.modules.common.eums.BusinessModule;
|
||||
import org.springblade.modules.common.eums.PaymentType;
|
||||
import org.springblade.modules.api.service.IPaymentService;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.plugin.pay.api.alipay.IAliPayApiService;
|
||||
import org.springblade.plugin.pay.constant.PayConstant;
|
||||
import org.springblade.plugin.pay.entity.AliPayAccountConfig;
|
||||
import org.springblade.plugin.pay.entity.Order;
|
||||
import org.springblade.plugin.pay.service.IOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class IPaymentServiceImpl implements IPaymentService {
|
||||
|
||||
private final ICommonUserOrderService commonUserOrderService;
|
||||
|
||||
private final IOrderService orderService;
|
||||
|
||||
private final IAliPayApiService aliPayApiService;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PaymentResponse aliAppPay(PaymentRequest request) {
|
||||
|
||||
if (!request.getPaymentType().equals(PaymentType.ALI.getCode())) {
|
||||
throw new ServiceException("请选择正确的支付方式");
|
||||
}
|
||||
|
||||
CommonUserOrderEntity userOrder = commonUserOrderService.getById(Long.valueOf(request.getOrderId()));
|
||||
if (userOrder == null) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
|
||||
if (!userOrder.getPaymentType().equals(request.getPaymentType())) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
|
||||
AliPayAccountConfig config = PaymentCache.getAliConfig();
|
||||
Order order = orderService.save(config.getAppId(), config.getMchId(), config.getPayName(), userOrder.getItemName(), Objects.toString(userOrder.getActualAmount(), "0"), PayConstant.ALIPAY, PayConstant.APPPAY, config.getNotifyUrl(), PaymentType.ALI.getAbbr() + BusinessModule.fromCodeIgnoreCaseOrNull(userOrder.getOrderType()).getAbbr() + userOrder.getId());
|
||||
String content = aliPayApiService.appPay(order, config, StringPool.EMPTY);
|
||||
return new PaymentResponse(PaymentType.ALI.getCode(), PaymentType.ALI.getName(), content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlipayTradeQueryResponse aliQuery(String orderNo) {
|
||||
AliPayAccountConfig config = PaymentCache.getAliConfig();
|
||||
|
||||
AlipayTradeQueryResponse response;
|
||||
try {
|
||||
response = aliPayApiService.query(orderNo, config);
|
||||
log.info("支付宝账单:[{}]的支付结果为:{}", orderNo, response.getBody());
|
||||
return response;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("查询订单异常:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean aliCloseOrder(String orderNo) {
|
||||
AliPayAccountConfig config = PaymentCache.getAliConfig();
|
||||
|
||||
AlipayTradeCloseResponse response;
|
||||
try {
|
||||
response = aliPayApiService.closeOrder(orderNo, config);
|
||||
log.info("关闭支付宝账单:[{}]的支付结果为:{}", orderNo, response.getBody());
|
||||
return response.getMsg().equalsIgnoreCase("SUCCESS")
|
||||
|| response.getCode().equalsIgnoreCase("10000");
|
||||
} catch (Exception e) {
|
||||
log.error("关闭支付宝账单异常:{}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaymentResponse wxAppPay(PaymentRequest request) {
|
||||
throw new ServiceException("当前微信支付未开放");
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 商家旗舰店信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonMerchantStoreApiVO implements Serializable {
|
||||
|
||||
@NotNull(message = "无效店铺")
|
||||
private Long id;
|
||||
|
||||
private String storeName;
|
||||
|
||||
private String fullAddress;
|
||||
|
||||
private String thumbnailUrl;
|
||||
|
||||
private BigDecimal distance;
|
||||
|
||||
private BigDecimal lng;
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商家旗舰店信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonMerchantStoreDetailApiVO implements Serializable {
|
||||
|
||||
|
||||
private String storeName;
|
||||
|
||||
private String contactPhone;
|
||||
|
||||
private String fullAddress;
|
||||
|
||||
private List<String> mainImageUrl;
|
||||
|
||||
private List<String> detailImages;
|
||||
|
||||
private String businessHours;
|
||||
|
||||
private String storeDescription;
|
||||
|
||||
private BigDecimal lng;
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class CommonModulePayTypeApiVO {
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer isEnable;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 文旅景点信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonNewsCategoryApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 文旅景点信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonNewsContentApiVO implements Serializable {
|
||||
|
||||
@NotNull(message = "无效资讯")
|
||||
private Long id;
|
||||
|
||||
|
||||
private String title;
|
||||
|
||||
private String summary;
|
||||
|
||||
private Integer type;
|
||||
/**
|
||||
* 视频链接
|
||||
*/
|
||||
private String videoUrl;
|
||||
|
||||
/**
|
||||
* 缩略图
|
||||
*/
|
||||
private String thumbnailUrl;
|
||||
|
||||
/**
|
||||
* 评论数量
|
||||
*/
|
||||
private Long commentCount;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springblade.common.handler.PgStringArrayToListTypeHandler;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 资讯内容
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonNewsContentDetailApiVO implements Serializable {
|
||||
|
||||
private String videoUrl;
|
||||
private Long playCount;
|
||||
|
||||
private List<String> mainImageUrl;
|
||||
|
||||
private List<String> detailImages;
|
||||
|
||||
private String articleContent;
|
||||
|
||||
private Long commentCount;
|
||||
|
||||
|
||||
private Long viewCount;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 旅游团信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonTourInfoApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
private String contactPhone;
|
||||
private String userName;
|
||||
private String idCardNo;
|
||||
private String hkMacauPassNo;
|
||||
private String passportNo;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 旅游团信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonTourProductApiVO implements Serializable {
|
||||
|
||||
@NotNull(message = "无效旅游团")
|
||||
private Long id;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String subTitle;
|
||||
|
||||
private String thumbnailUrl;
|
||||
|
||||
private Integer visitCount;
|
||||
|
||||
private Integer rating;
|
||||
|
||||
private BigDecimal basePrice;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 旅游团信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonTourProductDetailApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
private String productName;
|
||||
|
||||
private String subTitle;
|
||||
private Integer durationDays;
|
||||
private Integer durationNights;
|
||||
|
||||
private List<String> mainImageUrl;
|
||||
|
||||
private List<String> detailImages;
|
||||
|
||||
private BigDecimal basePrice;
|
||||
|
||||
private BigDecimal adultPrice;
|
||||
|
||||
private BigDecimal childPrice;
|
||||
|
||||
private BigDecimal elderlyPrice;
|
||||
|
||||
private Integer minPeople;
|
||||
|
||||
private Integer maxPeople;
|
||||
|
||||
private Integer requireIdCard;
|
||||
|
||||
private Integer requirePassport;
|
||||
|
||||
private Integer requireHkMacauPass;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer visitCount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 文旅景点信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonTourismSpotApiVO implements Serializable {
|
||||
|
||||
@NotNull(message = "无效景点")
|
||||
private Long id;
|
||||
|
||||
private String spotName;
|
||||
|
||||
private BigDecimal rating;
|
||||
|
||||
private Integer visitCount;
|
||||
|
||||
private String thumbnailUrl;
|
||||
|
||||
private String summary;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文旅景点信息
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-17
|
||||
*/
|
||||
@Data
|
||||
public class CommonTourismSpotDetailApiVO implements Serializable {
|
||||
|
||||
private List<String> mainImageUrl;
|
||||
private List<String> detailImages;
|
||||
private String videoUrl;
|
||||
private String description;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springblade.modules.common.pojo.entity.TourOrderDetailEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CommonTravelOrderDetailApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String consigneePhone;
|
||||
|
||||
private String consignee;
|
||||
|
||||
private String orderType;
|
||||
|
||||
private String itemCode;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
private Integer quantity;
|
||||
|
||||
|
||||
private Integer orderStatus;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
private Date paymentTime;
|
||||
|
||||
private Integer paymentStatus;
|
||||
|
||||
|
||||
private String contractUrl;
|
||||
/**
|
||||
* 合同签署状态:0=未签署,1=已签署,2=已过期
|
||||
*/
|
||||
|
||||
private Integer contractStatus;
|
||||
/**
|
||||
* 导游姓名
|
||||
*/
|
||||
private String guideName;
|
||||
/**
|
||||
* 导游联系电话
|
||||
*/
|
||||
private String guidePhone;
|
||||
|
||||
private Date tourStartDate;
|
||||
/**
|
||||
* 预计返回日期
|
||||
*/
|
||||
private Date tourEndDate;
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private List<TourOrderDetailEntity.TravelerDetail> travelerDetail;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class CommonUserAddressApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long regionsInfoId;
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
private String district;
|
||||
|
||||
private String street;
|
||||
|
||||
private String detail;
|
||||
|
||||
private String consignee;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class CommonUserNoticeApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String moduleType;
|
||||
/**
|
||||
* 是否已读 0-否 1-是
|
||||
*/
|
||||
private Integer hasRead;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class CommonUserNoticeDetailApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String moduleType;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CommonUserOrderApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String orderType;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
private Integer quantity;
|
||||
|
||||
private Integer orderStatus;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
@DateTimeFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CommonUserOrderDetailApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String consigneePhone;
|
||||
|
||||
private String consignee;
|
||||
|
||||
private String orderType;
|
||||
|
||||
private String itemCode;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
private Integer quantity;
|
||||
|
||||
private String deliveryAddress;
|
||||
|
||||
private String expressCompany;
|
||||
|
||||
private String expressNo;
|
||||
|
||||
private Integer orderStatus;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
private Date paymentTime;
|
||||
|
||||
private Integer paymentStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FullRegionInfoVO implements Serializable {
|
||||
|
||||
private Integer currentLevel = -1;
|
||||
|
||||
private String street = StringPool.EMPTY;
|
||||
|
||||
private String district = StringPool.EMPTY;
|
||||
|
||||
private String city = StringPool.EMPTY;
|
||||
|
||||
private String province = StringPool.EMPTY;
|
||||
|
||||
private Long streetId = -1L;
|
||||
|
||||
private Long districtId = -1L;
|
||||
|
||||
private Long cityId = -1L;
|
||||
|
||||
private Long provinceId = -1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class MallCategoryApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private String imageUrl;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MallProductApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String thumbImageUrl;
|
||||
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
private Integer sales;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springblade.modules.mall.pojo.entity.MallProductEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class MallProductDetailApiVO implements Serializable {
|
||||
|
||||
@NotNull(message = "无效商品")
|
||||
private Long id;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private String productName;
|
||||
|
||||
private List<String> mainImageUrls;
|
||||
|
||||
private List<String> detailImageUrls;
|
||||
|
||||
private String thumbImageUrl;
|
||||
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
private Integer sales;
|
||||
|
||||
private Integer stock;
|
||||
|
||||
private List<MallProductEntity.Spec> specs;
|
||||
|
||||
private List<String> tags;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* 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.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户积分包信息表 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-02-05
|
||||
*/
|
||||
@Data
|
||||
public class MarketBenefitPackageVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long packageId;
|
||||
|
||||
private String packageName;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private BigDecimal userBenefit;
|
||||
|
||||
private BigDecimal userCash;
|
||||
|
||||
private BigDecimal giveAmount;
|
||||
|
||||
private Integer dayTotal;
|
||||
|
||||
private BigDecimal amountTotal;
|
||||
|
||||
private BigDecimal amountDay;
|
||||
|
||||
private BigDecimal amountOut;
|
||||
|
||||
private Integer outDay;
|
||||
|
||||
|
||||
private Date expiredDate;
|
||||
|
||||
private Date activeTime;
|
||||
|
||||
/**
|
||||
* 状态 1-未激活 2-已激活 3-已完成 4-已过期
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user