Compare commits
59 Commits
34cf179254
...
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 |
@@ -269,43 +269,8 @@ 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_pay_order;
|
||||
create table common_pay_order
|
||||
(
|
||||
id int8 not null primary key, --支付插件支付记录id
|
||||
order_id int8, --系统内部订单id
|
||||
order_status int4 default 0 not null, --订单状态
|
||||
payment_status int4 default 0 not null, --支付状态
|
||||
order_no varchar(32), --支付插件orderNo
|
||||
payment_type int4, --支付类型
|
||||
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,
|
||||
remark varchar(500) default ''::character varying
|
||||
);
|
||||
|
||||
comment on table common_pay_order is '系统内部订单关联支付记录表';
|
||||
comment on column common_pay_order.id is '支付插件支付记录id';
|
||||
comment on column common_pay_order.order_id is '系统内部订单id';
|
||||
comment on column common_pay_order.order_no is '支付插件orderNo';
|
||||
comment on column common_pay_order.order_status is '订单状态';
|
||||
comment on column common_pay_order.payment_status is '支付状态';
|
||||
comment on column common_pay_order.payment_type is '支付类型';
|
||||
comment on column common_pay_order.status IS '状态';
|
||||
comment on column common_pay_order.create_user is '创建人';
|
||||
comment on column common_pay_order.create_dept is '创建部门';
|
||||
comment on column common_pay_order.create_time is '创建时间';
|
||||
comment on column common_pay_order.update_user is '修改人';
|
||||
comment on column common_pay_order.update_time is '修改时间';
|
||||
comment on column common_pay_order.is_deleted is '是否已删除';
|
||||
comment on column common_pay_order.remark is '备注';
|
||||
|
||||
create index idx_cpo_oid on common_pay_order (order_id); --订单id索引
|
||||
CREATE INDEX idx_cpo_ptime ON common_pay_order (payment_status, create_time);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS common_order_confirm_log;
|
||||
@@ -6,7 +6,10 @@ 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, -- 缩略图
|
||||
@@ -28,7 +31,10 @@ 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 '商家主图';
|
||||
@@ -224,6 +230,8 @@ CREATE TABLE tour_product
|
||||
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, -- 创建时间
|
||||
@@ -259,6 +267,8 @@ COMMENT ON COLUMN tour_product.require_hk_macau_pass IS '是否强制港澳通
|
||||
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 '创建时间';
|
||||
@@ -375,6 +385,54 @@ 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);
|
||||
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;
|
||||
20
pom.xml
20
pom.xml
@@ -277,19 +277,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot3-starter</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.locationtech.jts</groupId>
|
||||
<artifactId>jts-core</artifactId>
|
||||
@@ -334,6 +321,13 @@
|
||||
</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>
|
||||
|
||||
@@ -28,6 +28,7 @@ package org.springblade;
|
||||
import org.springblade.common.constant.CommonConstant;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.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;
|
||||
@@ -41,6 +42,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final IMarketCommissionAccountService commissionAccountService;
|
||||
private final IMarketCommissionAgencyLogService agencyLogService;
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
|
||||
private static final Long AGENCY_ACCOUNT_ID = 2017486568441696258L;
|
||||
|
||||
|
||||
@@ -66,6 +68,25 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
||||
.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)
|
||||
@@ -203,6 +224,11 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
||||
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);
|
||||
@@ -285,7 +311,10 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
||||
commissionAccountService.updateById(agencyAccount);
|
||||
agencyLogService.saveBatch(agencyLogList , 5000);
|
||||
|
||||
orderPageList.forEach(order -> order.setIsAgencyDistributed(1));
|
||||
orderPageList.forEach(order -> {
|
||||
order.setIsAgencyDistributed(1);
|
||||
order.setAgencyDistributeTime(new Date());
|
||||
});
|
||||
orderConfirmLogService.updateBatchById(orderPageList , 5000);
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
|
||||
@@ -8,6 +8,9 @@ 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.*;
|
||||
@@ -42,6 +45,7 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||
private final BladeRedis bladeRedis;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -49,6 +53,8 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
||||
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();
|
||||
@@ -59,9 +65,36 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
||||
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));
|
||||
@@ -188,6 +221,11 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
||||
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; // 剩余需要扣除的金额
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@ 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;
|
||||
@@ -14,6 +16,8 @@ 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;
|
||||
@@ -27,6 +31,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
|
||||
|
||||
|
||||
/**
|
||||
* 福利包每日发放福利积分到用户
|
||||
@@ -40,6 +46,7 @@ public class BenefitPackageSendPointProcessor implements BasicProcessor {
|
||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||
private final IMarketBenefitPointService benefitPointService;
|
||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||
private final IParamService paramService;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext context) {
|
||||
@@ -56,6 +63,10 @@ public class BenefitPackageSendPointProcessor implements BasicProcessor {
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -4,10 +4,14 @@ 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;
|
||||
@@ -19,6 +23,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
|
||||
|
||||
/**
|
||||
* 福利包每日发放结算记录
|
||||
*/
|
||||
@@ -29,6 +35,7 @@ public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketBenefitPackageService userBenefitPackageService;
|
||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||
private final IParamService paramService;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext context) {
|
||||
@@ -36,6 +43,10 @@ public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
|
||||
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("结束执行定时任务-初始化用户福利包每天结算记录");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
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;
|
||||
@@ -14,6 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* 初始化用户业绩 现金动态业绩 , 福利包动态业绩(执行一次)
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class InitUserPerformanceProcessor implements BasicProcessor {
|
||||
@@ -22,6 +25,7 @@ public class InitUserPerformanceProcessor implements BasicProcessor {
|
||||
private final IMarketInfoService marketInfoService;
|
||||
private final IMarketCashPerformanceService cashPerformanceService;
|
||||
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||
private final IMarketWelfarePerformanceLogService welfarePerformanceLogService;
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +53,21 @@ public class InitUserPerformanceProcessor implements BasicProcessor {
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ public class StatsCalculatorCashProcessor implements BasicProcessor {
|
||||
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
||||
);
|
||||
|
||||
if (orderPageList.isEmpty()){
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
// 2. 提取所有用户ID,用于批量查询
|
||||
Set<Long> userIds = orderPageList.stream()
|
||||
|
||||
@@ -55,10 +55,17 @@ public class StatsCalculatorWelfareProcessor implements BasicProcessor {
|
||||
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));
|
||||
|
||||
@@ -4,6 +4,9 @@ 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;
|
||||
@@ -23,10 +26,7 @@ import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -42,12 +42,16 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
||||
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)
|
||||
@@ -73,6 +77,19 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
||||
.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 -> {
|
||||
@@ -83,6 +100,11 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
||||
|
||||
);
|
||||
|
||||
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)
|
||||
@@ -95,35 +117,36 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
||||
}
|
||||
|
||||
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 + "人");
|
||||
upgradeCashLog.setRemarks(DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd") +"升级详情: 业绩 " + performance.getTotalAmount() + "福利值, 下级人数" + count + "人," + spending);
|
||||
upgradeCashLogList.add(upgradeCashLog);
|
||||
});
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ 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;
|
||||
@@ -22,10 +25,7 @@ import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -42,11 +42,15 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
||||
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)
|
||||
@@ -72,6 +76,19 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
||||
.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 -> {
|
||||
@@ -81,6 +98,10 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
||||
.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(
|
||||
@@ -94,33 +115,38 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
||||
}
|
||||
|
||||
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 + "人");
|
||||
upgradeWelfareLog.setRemarks(DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd") +"升级详情: 业绩 " + performance.getTotalAmount() + "福利值, 下级人数" + count + "人," + spending);
|
||||
upgradeWelfareLogList.add(upgradeWelfareLog);
|
||||
});
|
||||
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());
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.OrderStatus;
|
||||
import org.springblade.modules.common.eums.PaymentStatus;
|
||||
import org.springblade.modules.common.eums.PaymentType;
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonPayOrderService;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.plugin.pay.api.PaymentFacade;
|
||||
import org.springblade.plugin.pay.dto.APPQueryDto;
|
||||
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 UserOrderCloseProcessor implements BasicProcessor {
|
||||
|
||||
|
||||
|
||||
private final PaymentFacade paymentFacade;
|
||||
private final ICommonPayOrderService commonPayOrderService;
|
||||
private final ICommonUserOrderService commonUserOrderService;
|
||||
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
|
||||
// 1. 计算截止时间 (30分钟前)
|
||||
Date expireTime = DateUtil.getMinutesLate(new Date(), 30);
|
||||
|
||||
int batchSize = 500; // 【优化点3】分批处理,防止内存溢出
|
||||
int currentCount = 0;
|
||||
|
||||
while (true) {
|
||||
// 2. 分批查询数据库
|
||||
// 【优化点1】增加 orderByAsc 保证按时间顺序处理,增加 last("LIMIT") 限制数量
|
||||
List<CommonPayOrderEntity> payOrderList = commonPayOrderService.list(
|
||||
Wrappers.lambdaQuery(CommonPayOrderEntity.class)
|
||||
.eq(CommonPayOrderEntity::getPaymentStatus, PaymentStatus.UNPAID.getCode()) // 确保传的是 code 值,如果是枚举对象需调整
|
||||
.eq(CommonPayOrderEntity::getOrderStatus, OrderStatus.PENDING_PAYMENT.getCode())
|
||||
.le(CommonPayOrderEntity::getCreateTime, expireTime)
|
||||
.orderByAsc(CommonPayOrderEntity::getCreateTime)
|
||||
.last("LIMIT " + batchSize)
|
||||
);
|
||||
|
||||
if (payOrderList == null || payOrderList.isEmpty()) {
|
||||
break; // 没有数据了,退出循环
|
||||
}
|
||||
|
||||
for (CommonPayOrderEntity payOrder : payOrderList) {
|
||||
try {
|
||||
processSingleOrder(payOrder);
|
||||
} catch (Exception e) {
|
||||
log.error("处理超时订单异常,订单号: {}", payOrder.getOrderNo(), e);
|
||||
// 单个失败不影响整体流程
|
||||
}
|
||||
}
|
||||
|
||||
// 如果本次查询数量小于批次大小,说明已经是最后一批,退出
|
||||
if (payOrderList.size() < batchSize) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理单个订单逻辑
|
||||
* 核心原则:先远程交互,成功后再开短事务更新本地
|
||||
*/
|
||||
private void processSingleOrder(CommonPayOrderEntity payOrder) {
|
||||
String orderNo = payOrder.getOrderNo();
|
||||
Long orderId = payOrder.getOrderId();
|
||||
|
||||
CommonPayOrderEntity currentPayOrder = commonPayOrderService.getById(payOrder.getId());
|
||||
if (currentPayOrder == null ||
|
||||
currentPayOrder.getPaymentStatus() != PaymentStatus.UNPAID.getCode()) {
|
||||
log.debug("订单 {} 状态已变更,跳过", orderNo);
|
||||
return;
|
||||
}
|
||||
|
||||
CommonUserOrderEntity userOrder = commonUserOrderService.getById(orderId);
|
||||
if (userOrder == null) {
|
||||
log.error("关联用户订单不存在,orderId: {}", orderId);
|
||||
return;
|
||||
}
|
||||
|
||||
Boolean isPaid = paymentFacade.query(
|
||||
new APPQueryDto()
|
||||
.setOrderNo(orderNo)
|
||||
.setPaymentType(PaymentType.fromCodeOrNull(payOrder.getPaymentType()))
|
||||
);
|
||||
|
||||
if (Boolean.TRUE.equals(isPaid)) {
|
||||
log.warn("【掉单补偿】订单 {} 在支付宝侧已支付,执行补单", orderNo);
|
||||
updateOrderToSuccess(payOrder, userOrder);
|
||||
return;
|
||||
}
|
||||
|
||||
// 6. 【远程调用】支付宝侧确认未支付,执行关闭
|
||||
// 即使 query 返回 false (不存在),close 接口通常也是幂等的,可以尝试关闭
|
||||
Boolean isClosed = paymentFacade.closeOrder(
|
||||
new APPQueryDto()
|
||||
.setOrderNo(orderNo)
|
||||
.setPaymentType(PaymentType.fromCodeOrNull(payOrder.getPaymentType()))
|
||||
);
|
||||
|
||||
if (!Boolean.TRUE.equals(isClosed)) {
|
||||
log.error("订单 {} 调用支付宝关闭失败,保留本地状态等待下次重试", orderNo);
|
||||
// 策略:不更新本地状态,下次定时任务再试。防止误关。
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
updateOrderToClosed(payOrder, userOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务方法:更新为成功状态
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateOrderToSuccess(CommonPayOrderEntity payOrder, CommonUserOrderEntity userOrder) {
|
||||
// 再次校验状态,防止并发
|
||||
LambdaQueryWrapper<CommonPayOrderEntity> checkWrapper = Wrappers.lambdaQuery(CommonPayOrderEntity.class)
|
||||
.eq(CommonPayOrderEntity::getId, payOrder.getId())
|
||||
.eq(CommonPayOrderEntity::getPaymentStatus, PaymentStatus.UNPAID.getCode());
|
||||
|
||||
long count = commonPayOrderService.count(checkWrapper);
|
||||
if (count == 0) {
|
||||
log.warn("更新成功状态时,订单 {} 状态已变,跳过", payOrder.getOrderNo());
|
||||
return;
|
||||
}
|
||||
|
||||
payOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
||||
payOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
||||
// payOrder.setUpdateTime(new Date()); // 如果有自动填充可省略
|
||||
|
||||
userOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
||||
userOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
||||
userOrder.setPaymentType(payOrder.getPaymentType());
|
||||
// userOrder.setUpdateTime(new Date());
|
||||
|
||||
commonPayOrderService.updateById(payOrder);
|
||||
commonUserOrderService.updateById(userOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务方法:更新为关闭状态
|
||||
* 使用 update(entity, wrapper) 方式实现乐观锁检查
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateOrderToClosed(CommonPayOrderEntity payOrder, CommonUserOrderEntity userOrder) {
|
||||
// 构造更新条件:必须当前还是未支付状态才能更新,否则说明被并发修改了
|
||||
LambdaQueryWrapper<CommonPayOrderEntity> updateWrapper = Wrappers.lambdaQuery(CommonPayOrderEntity.class)
|
||||
.eq(CommonPayOrderEntity::getId, payOrder.getId())
|
||||
.eq(CommonPayOrderEntity::getPaymentStatus, PaymentStatus.UNPAID.getCode());
|
||||
|
||||
// 准备更新的数据
|
||||
CommonPayOrderEntity updatePayOrder = new CommonPayOrderEntity();
|
||||
updatePayOrder.setOrderStatus(OrderStatus.CLOSED_TIMEOUT.getCode());
|
||||
updatePayOrder.setPaymentStatus(PaymentStatus.FAILED.getCode());
|
||||
// updatePayOrder.setUpdateTime(new Date());
|
||||
|
||||
boolean updated = commonPayOrderService.update(updatePayOrder, updateWrapper);
|
||||
|
||||
if (updated) {
|
||||
// 支付单更新成功,再更新用户订单
|
||||
userOrder.setOrderStatus(OrderStatus.CLOSED_TIMEOUT.getCode());
|
||||
userOrder.setPaymentStatus(PaymentStatus.FAILED.getCode());
|
||||
// userOrder.setUpdateTime(new Date());
|
||||
commonUserOrderService.updateById(userOrder);
|
||||
|
||||
log.info("订单 {} 已成功关闭", payOrder.getOrderNo());
|
||||
} else {
|
||||
// 更新失败,说明在此期间状态变了(比如用户刚支付成功回调到了)
|
||||
log.warn("订单 {} 关闭更新失败,状态可能已变更,放弃本次关闭本地状态", payOrder.getOrderNo());
|
||||
// 这里可以选择抛出异常回滚,或者仅仅记录日志。
|
||||
// 既然支付宝侧已经 close 成功了,本地不一致可以通过后续的“对账任务”来修复,或者抛异常让事务回滚(但支付宝侧已关无法回滚,所以最好记录日志告警)
|
||||
throw new RuntimeException("并发冲突:订单状态已变更,关闭失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,10 @@ 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.*;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
@@ -21,22 +24,24 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +51,9 @@ public class APPCommonController {
|
||||
@GetMapping("/region-list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取省市区列表")
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -91,5 +96,12 @@ public class APPCommonController {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,23 +7,27 @@ 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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-eco")
|
||||
@RequestMapping("/app/eco")
|
||||
@Tag(name = "APP生态产品接口", description = "APP生态产品接口")
|
||||
public class APPEcoController {
|
||||
|
||||
private final IMallProductService productService;
|
||||
private final ICommonUserOrderService orderService;
|
||||
/**
|
||||
* 生态产品-商品列表
|
||||
*/
|
||||
@@ -42,4 +46,35 @@ public class APPEcoController {
|
||||
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,6 +1,5 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -17,7 +16,6 @@ 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.pojo.entity.MallCategoryEntity;
|
||||
import org.springblade.modules.mall.service.IMallCategoryService;
|
||||
import org.springblade.modules.mall.service.IMallProductService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -27,7 +25,7 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-mall")
|
||||
@RequestMapping("/app/mall")
|
||||
@Tag(name = "APP自营商城接口", description = "APP自营商城接口")
|
||||
public class APPMallController {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-news")
|
||||
@RequestMapping("/app/news")
|
||||
@Tag(name = "APP资讯接口", description = "APP资讯接口")
|
||||
public class APPNewsController {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-store")
|
||||
@RequestMapping("/app/store")
|
||||
@Tag(name = "APP商家店铺接口", description = "APP商家店铺接口")
|
||||
public class APPStoreController {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-tour")
|
||||
@RequestMapping("/app/tour")
|
||||
@Tag(name = "APP旅游团接口", description = "APP旅游团接口")
|
||||
public class APPTourController {
|
||||
|
||||
@@ -61,9 +61,19 @@ public class APPTourController {
|
||||
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 = 5)
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "旅行团订单详情")
|
||||
public R<CommonTravelOrderDetailApiVO> orderDetail(Long id) {
|
||||
return R.data(orderService.travelOrderDetail(id));
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-tourism-spot")
|
||||
@RequestMapping("/app/tourism-spot")
|
||||
@Tag(name = "APP文旅接口", description = "APP文旅接口")
|
||||
public class APPTourismSpotController {
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ 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.CreateOrderResponse;
|
||||
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;
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-user")
|
||||
@RequestMapping("/app/user")
|
||||
@Tag(name = "APP用户接口", description = "APP用户接口")
|
||||
public class APPUserController {
|
||||
|
||||
@@ -42,6 +42,8 @@ public class APPUserController {
|
||||
|
||||
private final ICommonLotteryPrizeService lotteryPrizeService;
|
||||
|
||||
private final IPaymentService paymentService;
|
||||
|
||||
|
||||
/**
|
||||
* 是否修改过密码
|
||||
@@ -74,13 +76,23 @@ public class APPUserController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* 支付宝支付
|
||||
*/
|
||||
@PostMapping("/pay")
|
||||
@PostMapping("/ali-pay")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "支付", description = "传入PaymentRequest")
|
||||
public R<PaymentResponse> pay(@Valid @RequestBody PaymentRequest request) {
|
||||
return R.data(orderService.pay(request));
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +100,7 @@ public class APPUserController {
|
||||
* 用户订单列表
|
||||
*/
|
||||
@GetMapping("/order-page")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market-user")
|
||||
@RequestMapping("/market/user")
|
||||
@Tag(name = "APP福利包接口", description = "APP福利包接口")
|
||||
public class MarketUserController {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -15,4 +15,9 @@ public class PaymentResponse implements Serializable {
|
||||
|
||||
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("当前微信支付未开放");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
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;
|
||||
@@ -25,4 +28,13 @@ public class CommonUserOrderApiVO implements Serializable {
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
@DateTimeFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.springblade.modules.common.client;
|
||||
|
||||
|
||||
import com.dtflys.forest.annotation.Get;
|
||||
import com.dtflys.forest.annotation.Query;
|
||||
import com.dtflys.forest.annotation.Var;
|
||||
import org.springblade.modules.common.request.GeoInfoRequest;
|
||||
import org.springblade.modules.common.response.GeoInfoResponse;
|
||||
|
||||
|
||||
|
||||
public interface AMapClient {
|
||||
|
||||
@Get("{baseUrl}/geocode/geo")
|
||||
GeoInfoResponse geoInfo(@Var("baseUrl") String baseUrl, @Query GeoInfoRequest request);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.springblade.modules.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "amap")
|
||||
public class AMapConfiguration {
|
||||
|
||||
private String key;
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.springblade.modules.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "tianditumap")
|
||||
public class TianDiTuConfiguration {
|
||||
|
||||
private String key;
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package org.springblade.modules.common.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonPayOrderVO;
|
||||
import org.springblade.modules.common.wrapper.CommonPayOrderWrapper;
|
||||
import org.springblade.modules.common.service.ICommonPayOrderService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 控制器
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("common/pay-order")
|
||||
@Tag(name = "系统内部订单关联支付记录", description = "系统内部订单关联支付记录接口")
|
||||
public class CommonPayOrderController extends BladeController {
|
||||
|
||||
private final ICommonPayOrderService commonPayOrderService;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入commonPayOrder")
|
||||
public R<CommonPayOrderVO> detail(CommonPayOrderEntity commonPayOrder) {
|
||||
CommonPayOrderEntity detail = commonPayOrderService.getOne(Condition.getQueryWrapper(commonPayOrder));
|
||||
return R.data(CommonPayOrderWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 系统内部订单关联支付记录 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入commonPayOrder")
|
||||
public R<IPage<CommonPayOrderVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> commonPayOrder, Query query) {
|
||||
IPage<CommonPayOrderEntity> pages = commonPayOrderService.page(Condition.getPage(query), Condition.getQueryWrapper(commonPayOrder, CommonPayOrderEntity.class));
|
||||
return R.data(CommonPayOrderWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入commonPayOrder")
|
||||
public R<IPage<CommonPayOrderVO>> page(CommonPayOrderVO commonPayOrder, Query query) {
|
||||
IPage<CommonPayOrderVO> pages = commonPayOrderService.selectCommonPayOrderPage(Condition.getPage(query), commonPayOrder);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入commonPayOrder")
|
||||
public R save(@Valid @RequestBody CommonPayOrderEntity commonPayOrder) {
|
||||
return R.status(commonPayOrderService.save(commonPayOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入commonPayOrder")
|
||||
public R update(@Valid @RequestBody CommonPayOrderEntity commonPayOrder) {
|
||||
return R.status(commonPayOrderService.updateById(commonPayOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入commonPayOrder")
|
||||
public R submit(@Valid @RequestBody CommonPayOrderEntity commonPayOrder) {
|
||||
return R.status(commonPayOrderService.saveOrUpdate(commonPayOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(commonPayOrderService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package org.springblade.modules.common.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import lombok.AllArgsConstructor;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.common.pojo.dto.CommonReleaseVersionDTO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||
import org.springblade.modules.common.wrapper.CommonReleaseVersionWrapper;
|
||||
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* APP版本发布管理 控制器
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("common/release-version")
|
||||
@Tag(name = "APP版本发布管理", description = "APP版本发布管理接口")
|
||||
public class CommonReleaseVersionController extends BladeController {
|
||||
|
||||
private final ICommonReleaseVersionService commonReleaseVersionService;
|
||||
|
||||
/**
|
||||
* APP版本发布管理 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入commonReleaseversion")
|
||||
public R<CommonReleaseVersionVO> detail(CommonReleaseVersionEntity commonReleaseVersion) {
|
||||
CommonReleaseVersionEntity detail = commonReleaseVersionService.getOne(Condition.getQueryWrapper(commonReleaseVersion));
|
||||
return R.data(CommonReleaseVersionWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本发布管理 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入commonReleaseversion")
|
||||
public R<IPage<CommonReleaseVersionVO>> list(CommonReleaseVersionEntity commonReleaseVersion, Query query) {
|
||||
IPage<CommonReleaseVersionEntity> pages = commonReleaseVersionService.page(Condition.getPage(query), Condition.getQueryWrapper(commonReleaseVersion).orderByDesc("id"));
|
||||
return R.data(CommonReleaseVersionWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本发布管理 详情查询
|
||||
*/
|
||||
@GetMapping("/detail-list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "详情查询", description = "传入versionName、appType")
|
||||
public R<List<CommonReleaseVersionDetailVO>> detailList(String versionName, Integer appType) {
|
||||
return R.data(commonReleaseVersionService.selectDetaiList(versionName, appType));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本发布管理 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入commonReleaseversion")
|
||||
public R<IPage<CommonReleaseVersionVO>> page(CommonReleaseVersionVO commonReleaseVersion, Query query) {
|
||||
IPage<CommonReleaseVersionVO> pages = commonReleaseVersionService.selectCommonReleaseVersionPage(Condition.getPage(query), commonReleaseVersion);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP版本发布管理 新增
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入vo")
|
||||
public R save(@Valid @RequestBody CommonReleaseVersionVO vo) {
|
||||
return R.status(commonReleaseVersionService.createVersion(vo));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本发布管理 修改
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入commonReleaseversion")
|
||||
public R update(@Valid @RequestBody CommonReleaseVersionEntity commonReleaseVersion) {
|
||||
return R.status(commonReleaseVersionService.updateById(commonReleaseVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本发布管理 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入commonReleaseversion")
|
||||
public R submit(@Valid @RequestBody CommonReleaseVersionEntity commonReleaseVersion) {
|
||||
return R.status(commonReleaseVersionService.saveOrUpdate(commonReleaseVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* APP版本发布管理 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "逻辑删除", description = "传入ids")
|
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(commonReleaseVersionService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/publish")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "上架版本")
|
||||
public R publish(@Valid @RequestBody CommonReleaseVersionDTO dto) {
|
||||
return R.status(commonReleaseVersionService.publish(dto.getId(), dto.getDownloadUrl()));
|
||||
}
|
||||
}
|
||||
@@ -104,6 +104,14 @@ public class CommonUserOrderController extends BladeController {
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@GetMapping("/eco-page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入order")
|
||||
public R<IPage<CommonUserOrderVO>> ecoOrderPage(CommonUserOrderVO order, Query query) {
|
||||
IPage<CommonUserOrderVO> pages = orderService.selectEcoOrderPage(Condition.getPage(query), order);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@GetMapping("/tour-order-page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入order")
|
||||
@@ -188,7 +196,18 @@ public class CommonUserOrderController extends BladeController {
|
||||
@RequestParam(required = false) String account ,
|
||||
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<CommonUserOrderExcel> excelList = commonUserManager.exportUserMallOrderToExcel(orderStatus , account ,searchDateRange);
|
||||
ExcelUtil.export(response, "用户积分流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户订单日志", excelList, CommonUserOrderExcel.class);
|
||||
ExcelUtil.export(response, "用户订单日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户订单日志", excelList, CommonUserOrderExcel.class);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/export-eco-order-excel")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "导出生态产品订单")
|
||||
public void exportEcoFlowToExcel(@RequestParam(required = false) Integer orderStatus ,
|
||||
@RequestParam(required = false) String account ,
|
||||
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<CommonUserOrderExcel> excelList = commonUserManager.exportUserEcoOrderToExcel(orderStatus , account ,searchDateRange);
|
||||
ExcelUtil.export(response, "生态产品订单" + org.springblade.core.tool.utils.DateUtil.time(), "生态产品订单日志", excelList, CommonUserOrderExcel.class);
|
||||
|
||||
}
|
||||
|
||||
@@ -200,7 +219,7 @@ public class CommonUserOrderController extends BladeController {
|
||||
@RequestParam(required = false) String account ,
|
||||
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||
List<CommonUserOrderExcel> excelList = commonUserManager.exportUserTourOrderToExcel(orderStatus , account ,searchDateRange);
|
||||
ExcelUtil.export(response, "用户积分流水日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户订单日志", excelList, CommonUserOrderExcel.class);
|
||||
ExcelUtil.export(response, "用户订单日志" + org.springblade.core.tool.utils.DateUtil.time(), "用户订单日志", excelList, CommonUserOrderExcel.class);
|
||||
|
||||
}
|
||||
|
||||
@@ -222,4 +241,11 @@ public class CommonUserOrderController extends BladeController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/confirm-itinerary")
|
||||
@ApiOperationSupport(order = 15)
|
||||
@Operation(summary = "确认行程", description = "传入order")
|
||||
public R confirmItinerary(@Valid @RequestBody CommonUserOrderEntity order) {
|
||||
return R.status(orderService.confirmItinerary(order.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,15 @@ public class CulturalTourismSpotController extends BladeController {
|
||||
return R.status(culturalTourismSpotService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/applyStatus")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "上下架文旅景点", description = "culturalTourismSpot.id")
|
||||
public R applyStatus(CulturalTourismSpotEntity culturalTourismSpot) {
|
||||
return R.status(culturalTourismSpotService.applyStatus(culturalTourismSpot.getId()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean isValidRating(BigDecimal rating) {
|
||||
if (rating == null) {
|
||||
return false;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MerchantFlagshipStoreController extends BladeController {
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入merchantFlagshipStore")
|
||||
public R<MerchantFlagshipStoreVO> detail(MerchantFlagshipStoreEntity merchantFlagshipStore) {
|
||||
MerchantFlagshipStoreEntity detail = merchantFlagshipStoreService.getById(merchantFlagshipStore.getId());
|
||||
MerchantFlagshipStoreEntity detail = merchantFlagshipStoreService.getByDetail(merchantFlagshipStore.getId());
|
||||
return R.data(MerchantFlagshipStoreWrapper.build().entityVO(detail));
|
||||
|
||||
}
|
||||
@@ -111,5 +111,12 @@ public class MerchantFlagshipStoreController extends BladeController {
|
||||
return R.status(merchantFlagshipStoreService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/applyStatus")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "上下架店铺", description = "merchantFlagshipStore.id")
|
||||
public R applyStatus(MerchantFlagshipStoreEntity merchantFlagshipStore) {
|
||||
return R.status(merchantFlagshipStoreService.applyStatus(merchantFlagshipStore.getId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,12 @@ public class NewsContentController extends BladeController {
|
||||
return R.status(newsContentService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/applyStatus")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "上下架资讯", description = "newsContent.id")
|
||||
public R applyStatus(NewsContentEntity newsContent) {
|
||||
return R.status(newsContentService.applyStatus(newsContent.getId()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -122,4 +122,6 @@ public class TourOrderDetailController extends BladeController {
|
||||
return R.status(tourOrderDetailService.fillContractUrl(order.getId() , order.getContractUrl()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.springblade.modules.common.pojo.vo.TourProductVO;
|
||||
import org.springblade.modules.common.wrapper.TourProductWrapper;
|
||||
import org.springblade.modules.common.service.ITourProductService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
@@ -132,6 +131,12 @@ public class TourProductController extends BladeController {
|
||||
return R.status(tourProductService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/applyStatus")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "上下架旅游产品", description = "tourProduct.id")
|
||||
public R applyStatus(TourProductEntity tourProduct) {
|
||||
return R.status(tourProductService.applyStatus(tourProduct.getId()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.springblade.modules.common.convert;
|
||||
|
||||
import org.mapstruct.*;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springblade.modules.common.eums.AppMarketChannelEnum;
|
||||
import org.springblade.modules.common.eums.VersionStatus;
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
|
||||
@Mapper
|
||||
public interface CommonReleaseVersionConvert {
|
||||
|
||||
CommonReleaseVersionConvert INSTANCE = Mappers.getMapper(CommonReleaseVersionConvert.class);
|
||||
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "createUser", ignore = true)
|
||||
@Mapping(target = "updateUser", ignore = true)
|
||||
CommonReleaseVersionEntity copyForChannel(CommonReleaseVersionEntity source, @Context AppMarketChannelEnum channel);
|
||||
|
||||
@AfterMapping
|
||||
default void setChannelAndStatus(@MappingTarget CommonReleaseVersionEntity target,
|
||||
@Context AppMarketChannelEnum channel) {
|
||||
target.setChannelCode(channel.getCode());
|
||||
// 注意:OFFICIAL 渠道状态为 PUBLISHED,其他为 ENABLED
|
||||
if (channel == AppMarketChannelEnum.OFFICIAL) {
|
||||
target.setPackageType(2);
|
||||
target.setStatus(VersionStatus.PUBLISHED.getCode());
|
||||
} else {
|
||||
target.setPackageType(1);
|
||||
target.setDownloadUrl(null);
|
||||
target.setStatus(VersionStatus.ENABLED.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.springblade.modules.common.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum AppMarketChannelEnum {
|
||||
|
||||
XIAOMI("xiaomi", "小米应用商店"),
|
||||
HUAWEI("huawei", "华为应用市场"),
|
||||
HONOR("honor", "荣耀应用市场"),
|
||||
OPPO("oppo", "OPPO 软件商店"),
|
||||
VIVO("vivo", "vivo 应用商店"),
|
||||
APPLE("apple", "App Store"),
|
||||
QIHOO("qihoo", "360手机助手"),
|
||||
YINGYONGBAO("yingyongbao", "应用宝"),
|
||||
PGYER("pgyer", "蒲公英分发平台"),
|
||||
OFFICIAL("official", "官网/自有渠道");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
AppMarketChannelEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 code 获取枚举项
|
||||
*/
|
||||
public static AppMarketChannelEnum fromCode(String code) {
|
||||
for (AppMarketChannelEnum channel : AppMarketChannelEnum.values()) {
|
||||
if (channel.code.equalsIgnoreCase(code)) {
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown app market channel code: " + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断 code 是否有效
|
||||
*/
|
||||
public static boolean isValid(String code) {
|
||||
try {
|
||||
fromCode(code);
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.springblade.modules.common.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum AppType {
|
||||
|
||||
/**
|
||||
* 亿茶一路 (App)
|
||||
*/
|
||||
APP(1, "亿茶一路"),
|
||||
|
||||
/**
|
||||
* 硒茶商汇 (Market)
|
||||
*/
|
||||
MARKET(2, "硒茶商汇");
|
||||
|
||||
/**
|
||||
* 应用类型的唯一代码值
|
||||
*/
|
||||
private final int code;
|
||||
|
||||
/**
|
||||
* 应用类型的中文描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param code 类型代码
|
||||
* @param description 中文描述
|
||||
*/
|
||||
AppType(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据代码值查找对应的枚举
|
||||
*
|
||||
* @param code 应用类型代码 (1 或 2)
|
||||
* @return 对应的 AppType 枚举,如果未找到则返回 null
|
||||
*/
|
||||
public static AppType fromCode(int code) {
|
||||
for (AppType type : AppType.values()) {
|
||||
if (type.code == code) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package org.springblade.modules.common.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
|
||||
@Getter
|
||||
public enum PhoneBrand {
|
||||
|
||||
/**
|
||||
* 苹果 (Apple)
|
||||
* 在 Android 设备上不会出现,但为接口统一性保留。
|
||||
* iOS 客户端可直接传 "APPLE"。
|
||||
*/
|
||||
APPLE("Apple", "苹果"),
|
||||
|
||||
/**
|
||||
* 华为 (Huawei)
|
||||
* Android Manufacturer: "HUAWEI"
|
||||
*/
|
||||
HUAWEI("HUAWEI", "华为"),
|
||||
|
||||
/**
|
||||
* 荣耀 (Honor)
|
||||
* Android Manufacturer: "HONOR"
|
||||
*/
|
||||
HONOR("HONOR", "荣耀"),
|
||||
|
||||
/**
|
||||
* 小米 (Xiaomi)
|
||||
* Android Manufacturer: "Xiaomi"
|
||||
*/
|
||||
XIAOMI("Xiaomi", "小米"),
|
||||
|
||||
/**
|
||||
* OPPO
|
||||
* Android Manufacturer: "OPPO"
|
||||
*/
|
||||
OPPO("OPPO", "OPPO"),
|
||||
|
||||
/**
|
||||
* VIVO
|
||||
* Android Manufacturer: "vivo"
|
||||
*/
|
||||
VIVO("vivo", "VIVO"),
|
||||
|
||||
/**
|
||||
* 其他品牌(兜底选项)
|
||||
*/
|
||||
OTHER("Other", "其他");
|
||||
|
||||
|
||||
/**
|
||||
* 品牌的标准英文标识(用于 API 通信、数据库存储等)
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 品牌的中文名称
|
||||
*/
|
||||
private final String displayName;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param code 品牌代码
|
||||
* @param displayName 中文显示名
|
||||
*/
|
||||
PhoneBrand(String code, String displayName) {
|
||||
this.code = code;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的品牌字符串(不区分大小写)查找对应的枚举。
|
||||
* 支持传入 {@code Build.MANUFACTURER} 的原始值或本枚举的 {@code code}。
|
||||
*
|
||||
* @param brandStr 品牌字符串,例如 "HUAWEI", "Xiaomi", "vivo" 等
|
||||
* @return 对应的 PhoneBrand 枚举,如果未找到则返回 null
|
||||
*/
|
||||
public static PhoneBrand fromString(String brandStr) {
|
||||
if (StringUtil.isBlank(brandStr)) {
|
||||
return OTHER;
|
||||
}
|
||||
String trimmed = brandStr.trim();
|
||||
String upperStr = trimmed.toUpperCase();
|
||||
for (PhoneBrand brand : PhoneBrand.values()) {
|
||||
// 跳过 OTHER 项,避免提前匹配
|
||||
if (brand == OTHER) {
|
||||
continue;
|
||||
}
|
||||
if (brand.code.equalsIgnoreCase(trimmed) ||
|
||||
brand.code.toUpperCase().equals(upperStr)) {
|
||||
return brand;
|
||||
}
|
||||
}
|
||||
return OTHER; // 未识别品牌统一归为 OTHER
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.springblade.modules.common.eums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum VersionStatus {
|
||||
ENABLED(1, "已启用"),
|
||||
PUBLISHED(2, "已上架"),
|
||||
EXPIRED(3, "已过期");
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
VersionStatus(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public static VersionStatus fromCode(int code) {
|
||||
for (VersionStatus status : values()) {
|
||||
if (status.code == code) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid code: " + code);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.springblade.modules.common.event;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.modules.common.eums.PaymentType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
@@ -12,6 +13,7 @@ public class PaymentCallbackEvent implements Serializable {
|
||||
|
||||
private Long id;
|
||||
private Date payTime;
|
||||
private PaymentType paymentType;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ import org.springblade.modules.common.eums.PaymentStatus;
|
||||
import org.springblade.modules.common.event.PaymentCallbackEvent;
|
||||
import org.springblade.modules.common.event.PaymentSuccessEvent;
|
||||
import org.springblade.modules.common.event.StatsCommissionAccountEvent;
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.service.ICommonPayOrderService;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.event.EventListener;
|
||||
@@ -23,7 +21,6 @@ import org.springframework.stereotype.Component;
|
||||
@AllArgsConstructor
|
||||
public class PaymentListener {
|
||||
|
||||
private final ICommonPayOrderService commonPayOrderService;
|
||||
private final ICommonUserOrderService commonUserOrderService;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
@@ -32,43 +29,27 @@ public class PaymentListener {
|
||||
public void callbackSuccessPayment(PaymentCallbackEvent event) {
|
||||
log.info("支付回调监听 : {}" , event);
|
||||
|
||||
CommonPayOrderEntity payOrder = commonPayOrderService.getById(event.getId());
|
||||
if (payOrder == null){
|
||||
log.error("支付回调监听 : 订单不存在 , 订单id : {}" , event.getId());
|
||||
return;
|
||||
}
|
||||
if (payOrder.getOrderStatus() == 1){
|
||||
log.error("支付回调监听 : 订单已支付 , 订单id : {}" , event.getId());
|
||||
return;
|
||||
}
|
||||
if (payOrder.getPaymentStatus() == 1){
|
||||
log.error("支付回调监听 : 订单已支付 , 订单id : {}" , event.getId());
|
||||
return;
|
||||
}
|
||||
CommonUserOrderEntity userOrder = commonUserOrderService.getById(payOrder.getOrderId());
|
||||
|
||||
CommonUserOrderEntity userOrder = commonUserOrderService.getById(event.getId());
|
||||
if (userOrder == null){
|
||||
log.error("支付回调监听 : 订单不存在 , 订单id : {}" , payOrder.getOrderId());
|
||||
log.error("支付回调监听 : 订单不存在 , 订单id : {}" , userOrder.getId());
|
||||
return;
|
||||
}
|
||||
if (userOrder.getOrderStatus() == 1){
|
||||
log.error("支付回调监听 : 订单已支付 , 订单id : {}" , payOrder.getOrderId());
|
||||
log.error("支付回调监听 : 订单已支付 , 订单id : {}" , userOrder.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
payOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
||||
payOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
||||
|
||||
userOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
||||
userOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
||||
userOrder.setPaymentType(payOrder.getPaymentType());
|
||||
userOrder.setPaymentTime(event.getPayTime());
|
||||
if (!commonPayOrderService.updateById(payOrder) || !commonUserOrderService.updateById(userOrder)){
|
||||
log.error("支付回调监听 : 订单支付失败 , 订单id : {}" , payOrder.getOrderId());
|
||||
if ( !commonUserOrderService.updateById(userOrder)){
|
||||
log.error("支付回调监听 : 订单支付失败 , 订单id : {}" , userOrder.getId());
|
||||
return;
|
||||
}
|
||||
log.info("支付回调监听 : 订单支付成功 , 订单id : {}" , payOrder.getOrderId());
|
||||
log.info("支付回调监听 : 订单支付成功 , 订单id : {}" , userOrder.getId());
|
||||
publisher.publishEvent(new StatsCommissionAccountEvent().setId(userOrder.getId()));
|
||||
publisher.publishEvent(new PaymentSuccessEvent(payOrder.getOrderId(), userOrder.getUserId(), BusinessModule.fromCodeIgnoreCase(userOrder.getOrderType())));
|
||||
publisher.publishEvent(new PaymentSuccessEvent(userOrder.getId(), userOrder.getUserId(), BusinessModule.fromCodeIgnoreCase(userOrder.getOrderType())));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Date;
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
public class StatsCommissionAccountListener {
|
||||
|
||||
private final ICommonUserOrderService userOrderService;
|
||||
@@ -85,7 +84,7 @@ public class StatsCommissionAccountListener {
|
||||
String orderType = userOrder.getOrderType();
|
||||
Long orderId = userOrder.getId();
|
||||
String orderJson = JSONObject.toJSONString(userOrder);
|
||||
Date statisticalDate = DateUtil.getYesterday();
|
||||
Date statisticalDate = DateUtil.getToday();
|
||||
|
||||
// --- 1. 广告补贴 (5%) ---
|
||||
BigDecimal advertisingAmount = totalActualAmount.multiply(BigDecimal.valueOf(0.05));
|
||||
|
||||
@@ -149,6 +149,59 @@ public class CommonUserManager {
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public List<CommonUserOrderExcel> exportUserEcoOrderToExcel(Integer orderStatus, String account, List<String> searchDateRange) {
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
if (searchDateRange == null) {
|
||||
throw new ServiceException("请选择时间范围");
|
||||
}
|
||||
|
||||
startDate = DateUtil.convertFromString(searchDateRange.get(0), "yyyy-MM-dd hh:mm:ss");
|
||||
endDate = DateUtil.convertFromString(searchDateRange.get(1), "yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
if (startDate.getTime() >= endDate.getTime()) {
|
||||
throw new ServiceException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
List<CommonUserOrderVO> commonUserOrderList = commonUserOrderService.exportUserEcoOrderToExcel(orderStatus, account, startDate, endDate);
|
||||
|
||||
List<CommonUserOrderExcel> excelList = new ArrayList<>();
|
||||
|
||||
commonUserOrderList.forEach(order -> {
|
||||
|
||||
CommonUserOrderExcel commonUserOrderExcel = new CommonUserOrderExcel();
|
||||
commonUserOrderExcel.setId(order.getId());
|
||||
commonUserOrderExcel.setAccount(order.getAccount());
|
||||
commonUserOrderExcel.setConsigneePhone(order.getConsigneePhone());
|
||||
commonUserOrderExcel.setConsignee(order.getConsignee());
|
||||
commonUserOrderExcel.setDeliveryAddress(order.getDeliveryAddress());
|
||||
commonUserOrderExcel.setItemName(order.getItemName());
|
||||
commonUserOrderExcel.setImageUrl(order.getImageUrl());
|
||||
commonUserOrderExcel.setQuantity(order.getQuantity());
|
||||
|
||||
|
||||
JSONArray specsJsonArray = JSONArray.parse(JSONArray.toJSONString(order.getSpecs()));
|
||||
List<String> specsJsonString = new ArrayList<>();
|
||||
specsJsonArray.forEach(spec -> {
|
||||
JSONObject specJsonObject = (JSONObject) spec;
|
||||
specsJsonString.add(specJsonObject.getString("attr") + ":" + specJsonObject.getString("value"));
|
||||
});
|
||||
|
||||
commonUserOrderExcel.setSpecs(JSONArray.toJSONString(specsJsonString));
|
||||
commonUserOrderExcel.setTotalAmount(order.getTotalAmount());
|
||||
commonUserOrderExcel.setActualAmount(order.getActualAmount());
|
||||
commonUserOrderExcel.setPaymentType(PaymentType.fromCodeOrNull(order.getPaymentType()).getName());
|
||||
commonUserOrderExcel.setPaymentTime(order.getPaymentTime());
|
||||
commonUserOrderExcel.setPaymentStatus(PaymentStatus.fromCodeOrNull(order.getPaymentStatus()).getDescription());
|
||||
commonUserOrderExcel.setCreateTime(order.getCreateTime());
|
||||
commonUserOrderExcel.setOrderStatus(ExcelOrderStatus.fromCode(order.getOrderStatus()).getMessage());
|
||||
excelList.add(commonUserOrderExcel);
|
||||
|
||||
});
|
||||
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public List<CommonUserOrderExcel> exportUserTourOrderToExcel(Integer orderStatus, String account, List<String> searchDateRange) {
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
@@ -292,4 +345,5 @@ public class CommonUserManager {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package org.springblade.modules.common.mapper;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonPayOrderVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 Mapper 接口
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
*/
|
||||
public interface CommonPayOrderMapper extends BaseMapper<CommonPayOrderEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param commonPayOrder 查询参数
|
||||
* @return List<CommonPayOrderVO>
|
||||
*/
|
||||
List<CommonPayOrderVO> selectCommonPayOrderPage(IPage page, CommonPayOrderVO commonPayOrder);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.modules.common.mapper.CommonPayOrderMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="commonPayOrderResultMap" type="org.springblade.modules.common.pojo.entity.CommonPayOrderEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="order_id" property="orderId"/>
|
||||
<result column="order_status" property="orderStatus"/>
|
||||
<result column="payment_status" property="paymentStatus"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectCommonPayOrderPage" resultMap="commonPayOrderResultMap">
|
||||
select * from common_pay_order where is_deleted = 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.springblade.modules.common.mapper;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP版本发布管理 Mapper 接口
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
public interface CommonReleaseVersionMapper extends BaseMapper<CommonReleaseVersionEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param commonReleaseVersion 查询参数
|
||||
* @return List<CommonReleaseVersionVO>
|
||||
*/
|
||||
List<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
||||
|
||||
List<CommonReleaseVersionVO> selectCustomerCommonReleaseVersionPage(IPage page, CommonReleaseVersionVO commonReleaseVersion);
|
||||
|
||||
List<CommonReleaseVersionDetailVO> selectDetaiList(String versionName, Integer appType);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.modules.common.mapper.CommonReleaseVersionMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="commonReleaseversionResultMap" type="org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="version_code" property="versionCode"/>
|
||||
<result column="version_name" property="versionName"/>
|
||||
<result column="app_type" property="appType"/>
|
||||
<result column="channel_code" property="channelCode"/>
|
||||
<result column="package_type" property="packageType"/>
|
||||
<result column="is_force_update" property="isForceUpdate"/>
|
||||
<result column="download_url" property="downloadUrl"/>
|
||||
<result column="update_content" property="updateContent"/>
|
||||
<result column="privacy_agreement_url" property="privacyAgreementUrl"/>
|
||||
<result column="user_agreement_url" property="userAgreementUrl"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectCommonReleaseVersionPage" resultMap="commonReleaseversionResultMap">
|
||||
select * from release_version where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectCustomerCommonReleaseVersionPage" resultType="org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO">
|
||||
SELECT DISTINCT ON (string_to_array(version_name, '.')::int[], app_type)
|
||||
app_type,
|
||||
version_name,
|
||||
is_force_update,
|
||||
download_url,
|
||||
privacy_agreement_url,
|
||||
user_agreement_url,
|
||||
update_content
|
||||
FROM release_version
|
||||
WHERE is_deleted = 0
|
||||
ORDER BY string_to_array(version_name, '.')::int[] DESC, app_type, id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectDetaiList" resultType="org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO">
|
||||
select id, channel_code, download_url, status
|
||||
from release_version
|
||||
where is_deleted = 0
|
||||
and version_name = #{versionName}
|
||||
and app_type = #{appType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -65,7 +65,7 @@
|
||||
merchant_flagship_store
|
||||
WHERE
|
||||
ST_DWithin(location, ST_SetSRID(ST_Point(#{request.longitude}, #{request.latitude}), 4326), 5000000)
|
||||
AND is_deleted = 0
|
||||
AND is_deleted = 0 and status = 1
|
||||
ORDER BY
|
||||
location <-> ST_SetSRID(ST_Point(#{request.longitude}, #{request.latitude}), 4326)
|
||||
LIMIT #{limit} OFFSET #{offset}
|
||||
|
||||
@@ -25,21 +25,29 @@
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.dto;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 数据传输对象实体类
|
||||
* APP版本发布管理 数据传输对象实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommonPayOrderDTO extends CommonPayOrderEntity {
|
||||
public class CommonReleaseVersionDTO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "ID 不能为空")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "上架链接不能为空")
|
||||
private String downloadUrl;
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("common_pay_order")
|
||||
@Schema(description = "CommonPayOrder对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class CommonPayOrderEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 系统内部订单id
|
||||
*/
|
||||
@Schema(description = "系统内部订单id")
|
||||
private Long orderId;
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
@Schema(description = "订单状态")
|
||||
private Integer orderStatus;
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
@Schema(description = "支付状态")
|
||||
private Integer paymentStatus;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
@Schema(description = "支付类型")
|
||||
private Integer paymentType;
|
||||
|
||||
/**
|
||||
* 支付插件orderNo
|
||||
*/
|
||||
@Schema(description = "支付插件orderNo")
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.springblade.modules.common.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* APP版本发布管理 实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
@Data
|
||||
@TableName("release_version")
|
||||
@Schema(description = "CommonReleaseVersion对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommonReleaseVersionEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 内部版本号 (如: 10023)
|
||||
*/
|
||||
@Schema(description = "内部版本号 (如: 10023)")
|
||||
private Integer versionCode;
|
||||
/**
|
||||
* 版本显示名称 (如: 1.2.3)
|
||||
*/
|
||||
@Schema(description = "版本显示名称 (如: 1.2.3)")
|
||||
private String versionName;
|
||||
/**
|
||||
* 应用类型: 1-app, 2-market
|
||||
*/
|
||||
@Schema(description = "应用类型: 1-app, 2-market")
|
||||
private Integer appType;
|
||||
/**
|
||||
* 渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official
|
||||
*/
|
||||
@Schema(description = "渠道标识: xiaomi, huawei, honor, oppo, vivo, apple, qihoo, yingyongbao, pgyer, official")
|
||||
private String channelCode;
|
||||
/**
|
||||
* 包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)
|
||||
*/
|
||||
@Schema(description = "包类型: 1-应用市场包(含跳转链接), 2-OSS直连包(兜底)")
|
||||
private Integer packageType;
|
||||
/**
|
||||
* 是否强制更新: 0-否, 1-是
|
||||
*/
|
||||
@Schema(description = "是否强制更新: 0-否, 1-是")
|
||||
private Integer isForceUpdate;
|
||||
/**
|
||||
* 下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)
|
||||
*/
|
||||
@Schema(description = "下载地址 (市场包通常为 schema 链接, OSS包为 http 链接)")
|
||||
private String downloadUrl;
|
||||
/**
|
||||
* 更新日志内容
|
||||
*/
|
||||
@Schema(description = "更新日志内容")
|
||||
private String updateContent;
|
||||
/**
|
||||
* 隐私协议地址
|
||||
*/
|
||||
@Schema(description = "隐私协议地址")
|
||||
private String privacyAgreementUrl;
|
||||
/**
|
||||
* 用户协议地址
|
||||
*/
|
||||
@Schema(description = "用户协议地址")
|
||||
private String userAgreementUrl;
|
||||
|
||||
}
|
||||
@@ -43,10 +43,11 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
|
||||
*/
|
||||
@Schema(description = "地址id")
|
||||
private Long regionsId;
|
||||
private String regionName;
|
||||
/**
|
||||
* 完整详细地址文本
|
||||
* 详细地址
|
||||
*/
|
||||
@Schema(description = "完整详细地址文本")
|
||||
@Schema(description = "详细地址")
|
||||
private String fullAddress;
|
||||
/**
|
||||
* 地理坐标 POINT(经度,纬度),用于地图定位和距离计算
|
||||
@@ -87,6 +88,10 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
|
||||
@Schema(description = "商家详细介绍")
|
||||
private String storeDescription;
|
||||
|
||||
private Long provinceId;
|
||||
|
||||
private Long cityId;
|
||||
|
||||
|
||||
public void setLocation(double longitude, double latitude) {
|
||||
this.location = new org.locationtech.jts.geom.GeometryFactory()
|
||||
|
||||
@@ -131,5 +131,10 @@ public class TourProductEntity extends BaseEntity {
|
||||
@Schema(description = "评分,范围0.00~5.00")
|
||||
private BigDecimal rating;
|
||||
|
||||
private Long provinceId;
|
||||
|
||||
private Long cityId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,21 +25,30 @@
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 视图实体类
|
||||
* APP版本发布管理 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommonPayOrderVO extends CommonPayOrderEntity {
|
||||
public class CommonReleaseVersionDetailVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String channelCode;
|
||||
|
||||
private String downloadUrl;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* APP版本发布管理 视图实体类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
@Data
|
||||
public class CommonReleaseVersionVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotEmpty
|
||||
private String versionName;
|
||||
|
||||
@NotNull
|
||||
private Integer appType;
|
||||
|
||||
@NotNull
|
||||
private Integer isForceUpdate;
|
||||
|
||||
@NotEmpty
|
||||
private String updateContent;
|
||||
|
||||
private String privacyAgreementUrl;
|
||||
|
||||
private String userAgreementUrl;
|
||||
|
||||
@NotEmpty
|
||||
private String downloadUrl;
|
||||
|
||||
private String dispatchUrl;
|
||||
|
||||
private String dispatchTargetVersion;
|
||||
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
|
||||
public class MerchantFlagshipStoreVO extends MerchantFlagshipStoreEntity {
|
||||
|
||||
|
||||
private Long area;
|
||||
private String addressDetail;
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,4 @@ public class TourProductVO extends TourProductEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long city;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package org.springblade.modules.common.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GeoInfoRequest implements Serializable {
|
||||
|
||||
private String key;
|
||||
|
||||
private String address;
|
||||
|
||||
private String output = "json";
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package org.springblade.modules.common.response;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GeoInfoResponse implements Serializable {
|
||||
|
||||
private String status;
|
||||
|
||||
private String info;
|
||||
|
||||
@JSONField(name = "infocode")
|
||||
private String infoCode;
|
||||
|
||||
private String count;
|
||||
|
||||
@JSONField(name = "geocodes")
|
||||
private List<GeoInfo> geoInfos;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class GeoInfo implements Serializable{
|
||||
|
||||
@JSONField(name = "formatted_address")
|
||||
private String formattedAddress;
|
||||
|
||||
private String country;
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
private String district;
|
||||
|
||||
private String street;
|
||||
|
||||
private String number;
|
||||
|
||||
private String location;
|
||||
|
||||
private String level;
|
||||
|
||||
@JSONField(name = "citycode")
|
||||
private String cityCode;
|
||||
|
||||
@JSONField(name = "adcode")
|
||||
private String adCode;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
|
||||
import org.springblade.modules.common.pojo.dto.LocationDTO;
|
||||
|
||||
public interface AMapService {
|
||||
|
||||
LocationDTO defaultLocation(String address);
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonPayOrderVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 服务类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
*/
|
||||
public interface ICommonPayOrderService extends BaseService<CommonPayOrderEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param commonPayOrder 查询参数
|
||||
* @return IPage<CommonPayOrderVO>
|
||||
*/
|
||||
IPage<CommonPayOrderVO> selectCommonPayOrderPage(IPage<CommonPayOrderVO> page, CommonPayOrderVO commonPayOrder);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springblade.modules.api.response.CheckVersionResponse;
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP版本发布管理 服务类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
public interface ICommonReleaseVersionService extends BaseService<CommonReleaseVersionEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param commonReleaseVersion 查询参数
|
||||
* @return IPage<CommonReleaseVersionVO>
|
||||
*/
|
||||
IPage<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage<CommonReleaseVersionVO> page, CommonReleaseVersionVO commonReleaseVersion);
|
||||
|
||||
|
||||
boolean applyStatus(Long id);
|
||||
|
||||
CheckVersionResponse checkUpdate(Integer type, String version, String brand);
|
||||
|
||||
boolean createVersion(CommonReleaseVersionVO vo);
|
||||
|
||||
List<CommonReleaseVersionDetailVO> selectDetaiList(String versionName, Integer appType);
|
||||
|
||||
boolean publish(Long id, String downloadUrl);
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
||||
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
||||
import org.springblade.modules.api.request.CreateTravelOrderRequest;
|
||||
@@ -61,9 +62,12 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
|
||||
*/
|
||||
IPage<CommonUserOrderVO> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order);
|
||||
|
||||
IPage<CommonUserOrderVO> selectEcoOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order);
|
||||
|
||||
IPage<CommonUserTourOrderVO> selectTourOrderPage(IPage<CommonUserTourOrderVO> page, CommonUserTourOrderVO order);
|
||||
|
||||
List<CommonUserOrderVO> exportUserMallOrderToExcel(Integer orderStatus , String account ,Date startDate , Date endDate);
|
||||
List<CommonUserOrderVO> exportUserEcoOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate);
|
||||
List<CommonUserOrderVO> exportUserTourOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate);
|
||||
/**
|
||||
* 导出数据
|
||||
@@ -77,7 +81,6 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
|
||||
|
||||
CreateOrderResponse createTravelOrder(CreateTravelOrderRequest request);
|
||||
|
||||
PaymentResponse pay(PaymentRequest request);
|
||||
|
||||
IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder);
|
||||
|
||||
@@ -92,5 +95,14 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
|
||||
boolean confirmMallOrder(ConfirmOrderRequest request);
|
||||
|
||||
|
||||
CreateOrderResponse createEcoOrder(@Valid CreateMallOrderRequest request);
|
||||
|
||||
boolean confirmEcoOrder(@Valid ConfirmOrderRequest request);
|
||||
|
||||
boolean confirmTravelOrder(@Valid ConfirmOrderRequest request);
|
||||
|
||||
|
||||
boolean confirmItinerary(Long id);
|
||||
|
||||
boolean closeOrderById(Long id);
|
||||
}
|
||||
|
||||
@@ -32,4 +32,5 @@ public interface ICulturalTourismSpotService extends BaseService<CulturalTourism
|
||||
CommonTourismSpotDetailApiVO tourismSpotDetail(@NotNull(message = "无效景点") Long id);
|
||||
|
||||
|
||||
boolean applyStatus(Long id);
|
||||
}
|
||||
|
||||
@@ -37,4 +37,8 @@ public interface IMerchantFlagshipStoreService extends BaseService<MerchantFlags
|
||||
IPage<CommonMerchantStoreApiVO> merchantStoreList(MerchantStoreRequest request , IPage<CommonMerchantStoreApiVO> page);
|
||||
|
||||
CommonMerchantStoreDetailApiVO merchantStoreDetail(@NotNull(message = "无效店铺") Long id);
|
||||
|
||||
MerchantFlagshipStoreEntity getByDetail(Long id);
|
||||
|
||||
boolean applyStatus(Long id);
|
||||
}
|
||||
|
||||
@@ -29,4 +29,6 @@ public interface INewsContentService extends BaseService<NewsContentEntity> {
|
||||
IPage<CommonNewsContentApiVO> newsCategoryList(IPage<CommonNewsContentApiVO> page , Long categoryId);
|
||||
|
||||
CommonNewsContentDetailApiVO newsContentDetail(@NotNull(message = "无效资讯") Long id);
|
||||
|
||||
boolean applyStatus(Long id);
|
||||
}
|
||||
|
||||
@@ -25,4 +25,5 @@ public interface ITourOrderDetailService extends BaseService<TourOrderDetailEnti
|
||||
boolean confirmGuideInfo(Long id, String guideName, String guidePhone);
|
||||
|
||||
boolean fillContractUrl(Long id, String contractUrl);
|
||||
|
||||
}
|
||||
|
||||
@@ -38,4 +38,6 @@ public interface ITourProductService extends BaseService<TourProductEntity> {
|
||||
IPage<CommonTourProductApiVO> tourProductTopList(IPage<CommonTourProductApiVO> page, TourProductRequest request);
|
||||
|
||||
CommonTourProductDetailApiVO tourProductDetail(@NotNull(message = "无效旅游团") Long id);
|
||||
|
||||
boolean applyStatus(Long id);
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
import org.springblade.modules.common.client.AMapClient;
|
||||
import org.springblade.modules.common.config.AMapConfiguration;
|
||||
import org.springblade.modules.common.pojo.dto.LocationDTO;
|
||||
import org.springblade.modules.common.request.GeoInfoRequest;
|
||||
import org.springblade.modules.common.response.GeoInfoResponse;
|
||||
import org.springblade.modules.common.service.AMapService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AMapServiceImpl implements AMapService {
|
||||
|
||||
@Resource
|
||||
private AMapClient client;
|
||||
|
||||
private final AMapConfiguration configuration;
|
||||
|
||||
|
||||
@Override
|
||||
public LocationDTO defaultLocation(String address) {
|
||||
GeoInfoResponse geoInfoResponse = client.geoInfo(configuration.getBaseUrl(), new GeoInfoRequest().setKey(configuration.getKey()).setAddress(address));
|
||||
log.info("地址解析结果:{}", geoInfoResponse);
|
||||
if (geoInfoResponse.getStatus().equals("1")) {
|
||||
GeoInfoResponse.GeoInfo geoInfo = geoInfoResponse.getGeoInfos().get(0);
|
||||
String[] location = geoInfo.getLocation().split(StringPool.COMMA);
|
||||
return new LocationDTO().setLongitude(Double.parseDouble(location[0])).setLatitude(Double.parseDouble(location[1]));
|
||||
}
|
||||
throw new ServiceException(String.valueOf(geoInfoResponse));
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonPayOrderVO;
|
||||
import org.springblade.modules.common.mapper.CommonPayOrderMapper;
|
||||
import org.springblade.modules.common.service.ICommonPayOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
*/
|
||||
@Service
|
||||
public class CommonPayOrderServiceImpl extends BaseServiceImpl<CommonPayOrderMapper, CommonPayOrderEntity> implements ICommonPayOrderService {
|
||||
|
||||
@Override
|
||||
public IPage<CommonPayOrderVO> selectCommonPayOrderPage(IPage<CommonPayOrderVO> page, CommonPayOrderVO commonPayOrder) {
|
||||
return page.setRecords(baseMapper.selectCommonPayOrderPage(page, commonPayOrder));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.validation.Valid;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.semver4j.Semver;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.modules.api.response.CheckVersionResponse;
|
||||
import org.springblade.modules.common.convert.CommonReleaseVersionConvert;
|
||||
import org.springblade.modules.common.eums.AppMarketChannelEnum;
|
||||
import org.springblade.modules.common.eums.AppType;
|
||||
import org.springblade.modules.common.eums.PhoneBrand;
|
||||
import org.springblade.modules.common.eums.VersionStatus;
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionDetailVO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||
import org.springblade.modules.common.mapper.CommonReleaseVersionMapper;
|
||||
import org.springblade.modules.common.service.ICommonReleaseVersionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* APP版本发布管理 服务实现类
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
@Service
|
||||
public class CommonReleaseVersionServiceImpl extends BaseServiceImpl<CommonReleaseVersionMapper, CommonReleaseVersionEntity> implements ICommonReleaseVersionService {
|
||||
|
||||
@Override
|
||||
public IPage<CommonReleaseVersionVO> selectCommonReleaseVersionPage(IPage<CommonReleaseVersionVO> page, CommonReleaseVersionVO commonReleaseVersion) {
|
||||
return page.setRecords(baseMapper.selectCustomerCommonReleaseVersionPage(page, commonReleaseVersion));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyStatus(Long id) {
|
||||
CommonReleaseVersionEntity releaseVersion = getById(id);
|
||||
if (releaseVersion == null) {
|
||||
throw new ServiceException("无效版本信息");
|
||||
}
|
||||
releaseVersion.setStatus(Math.abs(releaseVersion.getStatus() - 1));
|
||||
return updateById(releaseVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckVersionResponse checkUpdate(Integer type, String version, String brand) {
|
||||
CheckVersionResponse response = new CheckVersionResponse();
|
||||
List<CommonReleaseVersionEntity> list = list(Wrappers.lambdaQuery(CommonReleaseVersionEntity.class)
|
||||
.eq(CommonReleaseVersionEntity::getAppType, type)
|
||||
.gt(CommonReleaseVersionEntity::getVersionCode, convertVersionNameToVersionCode(version))
|
||||
.in(CommonReleaseVersionEntity::getChannelCode, List.of(PhoneBrand.fromString(brand).getCode(), AppMarketChannelEnum.PGYER.getCode(), AppMarketChannelEnum.QIHOO.getCode(), AppMarketChannelEnum.YINGYONGBAO.getCode(), AppMarketChannelEnum.OFFICIAL.getCode()))
|
||||
.eq(CommonReleaseVersionEntity::getStatus, VersionStatus.PUBLISHED.getCode())
|
||||
.eq(CommonReleaseVersionEntity::getIsDeleted, 0)
|
||||
.orderByDesc(CommonReleaseVersionEntity::getVersionCode)
|
||||
);
|
||||
if (!list.isEmpty()) {
|
||||
boolean f = false;
|
||||
CommonReleaseVersionEntity newest = list.get(0);
|
||||
response.setNeedUpdate(Boolean.TRUE);
|
||||
response.setUpdateVersion(newest.getVersionName());
|
||||
response.setUpdateContent(newest.getUpdateContent());
|
||||
int code = newest.getVersionCode();
|
||||
List<CommonReleaseVersionEntity> newestList = new ArrayList<>();
|
||||
for (CommonReleaseVersionEntity entity : list) {
|
||||
if (!f && Objects.equals(entity.getIsForceUpdate(), 1)) {
|
||||
f = true;
|
||||
}
|
||||
if (entity.getVersionCode() == code) {
|
||||
newestList.add(entity);
|
||||
}
|
||||
}
|
||||
for (CommonReleaseVersionEntity entity : newestList) {
|
||||
if (PhoneBrand.fromString(brand).getCode().equalsIgnoreCase(entity.getChannelCode())) {
|
||||
response.setUrl(entity.getDownloadUrl());
|
||||
}
|
||||
if (AppMarketChannelEnum.QIHOO.getCode().equalsIgnoreCase(entity.getChannelCode())) {
|
||||
response.setQihooUrl(entity.getDownloadUrl());
|
||||
}
|
||||
if (AppMarketChannelEnum.YINGYONGBAO.getCode().equalsIgnoreCase(entity.getChannelCode())) {
|
||||
response.setYingyongbaoUrl(entity.getDownloadUrl());
|
||||
}
|
||||
if (AppMarketChannelEnum.PGYER.getCode().equalsIgnoreCase(entity.getChannelCode())) {
|
||||
response.setWebDownloadUrl(entity.getDownloadUrl());
|
||||
}
|
||||
if (AppMarketChannelEnum.OFFICIAL.getCode().equalsIgnoreCase(entity.getChannelCode())) {
|
||||
response.setFallbackUrl(entity.getDownloadUrl());
|
||||
}
|
||||
}
|
||||
response.setIsForceUpdate(f);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean createVersion(CommonReleaseVersionVO vo) {
|
||||
AppType appType = AppType.fromCode(vo.getAppType());
|
||||
if (appType == null) {
|
||||
throw new ServiceException("无效类型");
|
||||
}
|
||||
Semver semver = new Semver(vo.getVersionName());
|
||||
CommonReleaseVersionEntity current = baseMapper.selectOne(
|
||||
Wrappers.lambdaQuery(CommonReleaseVersionEntity.class)
|
||||
.eq(CommonReleaseVersionEntity::getAppType, vo.getAppType())
|
||||
.ne(CommonReleaseVersionEntity::getStatus, VersionStatus.EXPIRED.getCode())
|
||||
.orderByDesc(CommonReleaseVersionEntity::getId)
|
||||
.last("LIMIT 1")
|
||||
);
|
||||
|
||||
if (current != null) {
|
||||
Semver currentSemver = new Semver(current.getVersionName());
|
||||
if (currentSemver.isGreaterThanOrEqualTo(semver)) {
|
||||
throw new ServiceException("当前版本号过小");
|
||||
}
|
||||
}
|
||||
List<CommonReleaseVersionEntity> versionList = new ArrayList<>();
|
||||
CommonReleaseVersionEntity officialVersion = getCommonReleaseVersionEntity(vo);
|
||||
versionList.add(officialVersion);
|
||||
versionList.add(getCopyByChannel(officialVersion, AppMarketChannelEnum.PGYER));
|
||||
|
||||
if (vo.getAppType().equals(AppType.APP.getCode())) {
|
||||
Arrays.stream(AppMarketChannelEnum.values()).filter(channel -> channel != AppMarketChannelEnum.PGYER && channel != AppMarketChannelEnum.OFFICIAL).forEach(channel -> {
|
||||
versionList.add(getCopyByChannel(officialVersion, channel));
|
||||
});
|
||||
}
|
||||
|
||||
return saveBatch(versionList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonReleaseVersionDetailVO> selectDetaiList(String versionName, Integer appType) {
|
||||
return baseMapper.selectDetaiList(versionName, appType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean publish(Long id, String downloadUrl) {
|
||||
if (id == null || StringUtil.isBlank(downloadUrl)) {
|
||||
throw new IllegalArgumentException("ID 和下载链接不能为空");
|
||||
}
|
||||
|
||||
CommonReleaseVersionEntity existing = getById(id);
|
||||
if (existing == null) {
|
||||
throw new ServiceException("版本不存在");
|
||||
}
|
||||
if (VersionStatus.PUBLISHED.getCode() == existing.getStatus()) {
|
||||
throw new ServiceException("版本已上架,不可重复操作");
|
||||
}
|
||||
|
||||
if (StringUtil.isBlank(downloadUrl)) {
|
||||
throw new ServiceException("下载链接不能为空");
|
||||
}
|
||||
existing.setDownloadUrl(downloadUrl);
|
||||
existing.setStatus(VersionStatus.PUBLISHED.getCode());
|
||||
return updateById(existing);
|
||||
}
|
||||
|
||||
private static CommonReleaseVersionEntity getCommonReleaseVersionEntity(CommonReleaseVersionVO vo) {
|
||||
CommonReleaseVersionEntity entity = new CommonReleaseVersionEntity();
|
||||
// 手动设 VO 特有字段(或也可用另一个 MapStruct VO->Entity)
|
||||
entity.setVersionCode(convertVersionNameToVersionCode(vo.getVersionName()));
|
||||
entity.setVersionName(vo.getVersionName());
|
||||
entity.setAppType(vo.getAppType());
|
||||
entity.setPrivacyAgreementUrl(vo.getPrivacyAgreementUrl());
|
||||
entity.setUserAgreementUrl(vo.getUserAgreementUrl());
|
||||
entity.setIsForceUpdate(vo.getIsForceUpdate());
|
||||
entity.setUpdateContent(vo.getUpdateContent());
|
||||
entity.setDownloadUrl(vo.getDownloadUrl());
|
||||
// 使用 MapStruct 设置渠道和状态
|
||||
return CommonReleaseVersionConvert.INSTANCE.copyForChannel(entity, AppMarketChannelEnum.OFFICIAL);
|
||||
}
|
||||
|
||||
private static CommonReleaseVersionEntity getCopyByChannel(CommonReleaseVersionEntity entity, AppMarketChannelEnum channel) {
|
||||
return CommonReleaseVersionConvert.INSTANCE.copyForChannel(entity, channel);
|
||||
}
|
||||
|
||||
private static Integer convertVersionNameToVersionCode(String versionName) {
|
||||
Semver semver = new Semver(versionName);
|
||||
return semver.getMajor() * 1000000 + semver.getMinor() * 1000 + semver.getPatch();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,9 +37,7 @@ import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
||||
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
||||
import org.springblade.modules.api.request.CreateTravelOrderRequest;
|
||||
import org.springblade.modules.api.request.PaymentRequest;
|
||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
import org.springblade.modules.api.vo.CommonTravelOrderDetailApiVO;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderDetailApiVO;
|
||||
@@ -61,9 +59,6 @@ import org.springblade.modules.mall.service.IMallProductService;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
import org.springblade.modules.market.service.IMarketUserCommissionService;
|
||||
import org.springblade.plugin.pay.api.PaymentFacade;
|
||||
import org.springblade.plugin.pay.dto.APPPayDto;
|
||||
import org.springblade.plugin.pay.response.APPPayResult;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
@@ -74,6 +69,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户订单 服务实现类
|
||||
@@ -94,10 +90,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
private final ITourOrderDetailService tourOrderDetailService;
|
||||
|
||||
private final IMarketUserCommissionService commissionService;
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
|
||||
private final PaymentFacade paymentFacade;
|
||||
private final ICommonOrderConfirmLogService orderConfirmLogService;
|
||||
|
||||
|
||||
@@ -117,6 +110,21 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
return page.setRecords(baseMapper.selectOrderPage(page, order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CommonUserOrderVO> selectEcoOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order) {
|
||||
if (order.getSearchDateRange() != null) {
|
||||
order.setStartDate(DateUtil.convertFromString(order.getSearchDateRange().get(0), "yyyy-MM-dd hh:mm:ss"));
|
||||
order.setEndDate(DateUtil.convertFromString(order.getSearchDateRange().get(1), "yyyy-MM-dd hh:mm:ss"));
|
||||
if (order.getStartDate().getTime() >= order.getEndDate().getTime()) {
|
||||
throw new RuntimeException("开始时间不能大于结束时间");
|
||||
}
|
||||
}
|
||||
|
||||
order.setOrderType(BusinessModule.ECOSYSTEM_PRODUCT.getCode());
|
||||
|
||||
return page.setRecords(baseMapper.selectOrderPage(page, order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CommonUserTourOrderVO> selectTourOrderPage(IPage<CommonUserTourOrderVO> page, CommonUserTourOrderVO order) {
|
||||
if (order.getSearchDateRange() != null) {
|
||||
@@ -133,14 +141,24 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonUserOrderVO> exportUserMallOrderToExcel(Integer orderStatus, String account ,Date startDate, Date endDate) {
|
||||
public List<CommonUserOrderVO> exportUserMallOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate) {
|
||||
|
||||
Long countItem = baseMapper.countOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.SELF_OPERATED_MALL.getCode());
|
||||
if (countItem > 10000) {
|
||||
throw new ServiceException("导出数据量过大,超过" + 10000 + "条数据,请缩小范围导出");
|
||||
}
|
||||
|
||||
return baseMapper.selectOrderExcelList(orderStatus, account ,startDate, endDate ,BusinessModule.SELF_OPERATED_MALL.getCode());
|
||||
return baseMapper.selectOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.SELF_OPERATED_MALL.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonUserOrderVO> exportUserEcoOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate) {
|
||||
Long countItem = baseMapper.countOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.ECOSYSTEM_PRODUCT.getCode());
|
||||
if (countItem > 10000) {
|
||||
throw new ServiceException("导出数据量过大,超过" + 10000 + "条数据,请缩小范围导出");
|
||||
}
|
||||
|
||||
return baseMapper.selectOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.ECOSYSTEM_PRODUCT.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,7 +168,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
throw new ServiceException("导出数据量过大,超过" + 10000 + "条数据,请缩小范围导出");
|
||||
}
|
||||
|
||||
return baseMapper.selectOrderExcelList(orderStatus, account ,startDate, endDate ,BusinessModule.TRAVEL_GROUP.getCode());
|
||||
return baseMapper.selectOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.TRAVEL_GROUP.getCode());
|
||||
}
|
||||
|
||||
|
||||
@@ -167,22 +185,26 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
public CreateOrderResponse createMallOrder(CreateMallOrderRequest request) {
|
||||
BigDecimal discount = BigDecimal.ZERO;
|
||||
String orderType = request.getOrderType().toUpperCase();
|
||||
if (!request.getIsOfflinePayment()) {
|
||||
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
|
||||
}
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.SELF_OPERATED_MALL)){
|
||||
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.SELF_OPERATED_MALL)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
if (request.getConsigneePhone() == null){
|
||||
if (request.getConsigneePhone() == null) {
|
||||
throw new ServiceException("请填写联系电话");
|
||||
}
|
||||
|
||||
if (request.getConsignee() == null){
|
||||
if (request.getConsignee() == null) {
|
||||
throw new ServiceException("请填写联系人");
|
||||
}
|
||||
|
||||
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
|
||||
Assert.notNull(product, "无效商品");
|
||||
if (product.getStatus() != 1) {
|
||||
throw new ServiceException("商品已下架");
|
||||
}
|
||||
if (!request.getIsOfflinePayment() && product.getRetailPrice().compareTo(BigDecimal.ONE) > 0) {
|
||||
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
|
||||
}
|
||||
CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product);
|
||||
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
|
||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||
@@ -191,7 +213,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
order.setTotalAmount(totalAmount);
|
||||
order.setActualAmount(actualAmount);
|
||||
order.setOrderType(orderType);
|
||||
order.setPaymentType(request.getIsOfflinePayment() ? request.getPaymentType() : null);
|
||||
order.setPaymentType(request.getPaymentType());
|
||||
order.setCreateTime(new Date());
|
||||
this.save(order);
|
||||
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
||||
@@ -214,20 +236,24 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
throw new ServiceException("商品ID格式非法");
|
||||
}
|
||||
|
||||
if (request.getPaymentType() != 1 && request.getPaymentType() != 2){
|
||||
if (request.getPaymentType() != 1 && request.getPaymentType() != 2) {
|
||||
throw new ServiceException("请选择正确的支付方式");
|
||||
}
|
||||
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(request.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
|
||||
List<Long> travelerIds = request.getTourInfoIds();
|
||||
if (CollectionUtils.isEmpty(travelerIds)) {
|
||||
throw new ServiceException("请至少选择一名出行人");
|
||||
}
|
||||
|
||||
if (request.getTourStartDate() == null || request.getTourEndDate() == null){
|
||||
if (request.getTourStartDate() == null || request.getTourEndDate() == null) {
|
||||
throw new ServiceException("请选择出行时间");
|
||||
}
|
||||
|
||||
if (request.getTourStartDate().getTime() >= request.getTourEndDate().getTime()){
|
||||
if (request.getTourStartDate().getTime() >= request.getTourEndDate().getTime()) {
|
||||
throw new ServiceException("开始时间不能大于结束时间");
|
||||
}
|
||||
|
||||
@@ -237,8 +263,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int selectedCount = travelerIds.size();
|
||||
// 使用 Optional 处理数据库中可能为 NULL 的最大/最小人数限制
|
||||
int minPeople = Optional.ofNullable(tourProduct.getMinPeople()).orElse(1);
|
||||
@@ -287,7 +311,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||
if (actualAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
actualAmount = BigDecimal.ZERO; // 防止实付金额为负
|
||||
@@ -328,36 +351,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaymentResponse pay(PaymentRequest request) {
|
||||
CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId()));
|
||||
if (order == null) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (order.getPaymentType().equals(PaymentType.OFFLINE.getCode())) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
try {
|
||||
APPPayResult appPayResult = paymentFacade.appPay(
|
||||
new APPPayDto()
|
||||
.setOrderId(Long.valueOf(request.getOrderId()))
|
||||
.setPaymentType(PaymentType.fromCode(request.getPaymentType()))
|
||||
.setBusinessModule(BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()))
|
||||
.setAmount(order.getActualAmount())
|
||||
.setBody(order.getItemName())
|
||||
.setRemark(order.getItemName())
|
||||
);
|
||||
return new PaymentResponse()
|
||||
.setPaymentType(appPayResult.getPaymentTypeEnum().getCode())
|
||||
.setParams(appPayResult.getContent())
|
||||
.setPayChannel(appPayResult.getPaymentTypeEnum().getName())
|
||||
;
|
||||
}catch (Exception e){
|
||||
log.error("支付异常 : {}" , e.getMessage());
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {
|
||||
@@ -365,7 +358,8 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
entity.setOrderStatus(userOrder.getOrderStatus());
|
||||
entity.setUserId(AuthUtil.getUserId());
|
||||
List<CommonUserOrderEntity> commonUserOrderEntityList = baseMapper.selectOrderEntityPage(page, entity);
|
||||
return page.setRecords(AppCommonConvert.INSTANCE.convertUserOrderEntityListTOApiList(commonUserOrderEntityList));
|
||||
List<CommonUserOrderApiVO> commonUserOrderApiVOS = AppCommonConvert.INSTANCE.convertUserOrderEntityListTOApiList(commonUserOrderEntityList);
|
||||
return page.setRecords(commonUserOrderApiVOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -458,7 +452,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
if (order == null) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.SELF_OPERATED_MALL)){
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.SELF_OPERATED_MALL)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
|
||||
@@ -480,8 +474,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
commissionService.earnedCommissionByUserOrder(order, marketInfo.getPid());
|
||||
}
|
||||
|
||||
orderConfirmLogService.save(
|
||||
new CommonOrderConfirmLogEntity()
|
||||
CommonOrderConfirmLogEntity commonOrderConfirmLog = new CommonOrderConfirmLogEntity()
|
||||
.setOrderId(order.getId())
|
||||
.setUserId(order.getUserId())
|
||||
.setItemName(order.getItemName())
|
||||
@@ -490,12 +483,133 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
.setActualAmount(order.getActualAmount())
|
||||
.setPaymentType(order.getPaymentType())
|
||||
.setIsServiceDistributed(0)
|
||||
.setIsAgencyDistributed(0)
|
||||
);
|
||||
.setIsAgencyDistributed(0);
|
||||
commonOrderConfirmLog.setCreateTime(new Date());
|
||||
orderConfirmLogService.save(commonOrderConfirmLog);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateOrderResponse createEcoOrder(CreateMallOrderRequest request) {
|
||||
BigDecimal discount = BigDecimal.ZERO;
|
||||
String orderType = request.getOrderType().toUpperCase();
|
||||
if (!request.getIsOfflinePayment()) {
|
||||
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
|
||||
}
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.ECOSYSTEM_PRODUCT)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
if (request.getConsigneePhone() == null) {
|
||||
throw new ServiceException("请填写联系电话");
|
||||
}
|
||||
|
||||
if (request.getConsignee() == null) {
|
||||
throw new ServiceException("请填写联系人");
|
||||
}
|
||||
|
||||
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
|
||||
Assert.notNull(product, "无效商品");
|
||||
if (product.getStatus() != 1){
|
||||
throw new ServiceException("商品已下架");
|
||||
}
|
||||
CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product);
|
||||
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
|
||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||
order.setOrderType(BusinessModule.ECOSYSTEM_PRODUCT.getCode());
|
||||
order.setUserId(AuthUtil.getUserId());
|
||||
order.setTotalAmount(totalAmount);
|
||||
order.setActualAmount(actualAmount);
|
||||
order.setOrderType(orderType);
|
||||
order.setPaymentType(request.getPaymentType());
|
||||
order.setCreateTime(new Date());
|
||||
this.save(order);
|
||||
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmEcoOrder(ConfirmOrderRequest request) {
|
||||
CommonUserOrderEntity order = getById(request.getId());
|
||||
if (order == null) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.ECOSYSTEM_PRODUCT)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
|
||||
.set(CommonUserOrderEntity::getOrderStatus, OrderStatus.COMPLETED.getCode())
|
||||
.eq(CommonUserOrderEntity::getId, order.getId())
|
||||
.eq(CommonUserOrderEntity::getOrderStatus, OrderStatus.SHIPPED.getCode()));
|
||||
if (!updated) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (order.getPaymentType().equals(PaymentType.OFFLINE.getCode())) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmTravelOrder(ConfirmOrderRequest request) {
|
||||
CommonUserOrderEntity order = getById(request.getId());
|
||||
if (order == null) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
|
||||
.set(CommonUserOrderEntity::getOrderStatus, OrderStatus.COMPLETED.getCode())
|
||||
.eq(CommonUserOrderEntity::getId, order.getId())
|
||||
.eq(CommonUserOrderEntity::getOrderStatus, OrderStatus.SHIPPED.getCode()));
|
||||
if (!updated) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (order.getPaymentType().equals(PaymentType.OFFLINE.getCode())) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean confirmItinerary(Long id) {
|
||||
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
|
||||
.set(CommonUserOrderEntity::getOrderStatus, OrderStatus.SHIPPED.getCode())
|
||||
.eq(CommonUserOrderEntity::getId, id)
|
||||
.eq(CommonUserOrderEntity::getOrderStatus, OrderStatus.PAID.getCode())
|
||||
.eq(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.PAID.getCode())
|
||||
.eq(CommonUserOrderEntity::getIsDeleted, 0)
|
||||
);
|
||||
if (!updated) {
|
||||
throw new ServiceException("状态更新无效,id=" + id);
|
||||
}
|
||||
CommonUserOrderEntity order = getById(id);
|
||||
if (order == null) {
|
||||
throw new IllegalStateException("订单更新成功但查询不到,id=" + id);
|
||||
}
|
||||
eventPublisher.publishEvent(new FillExpressEvent(id, order.getUserId(), BusinessModule.TRAVEL_GROUP));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean closeOrderById(Long id) {
|
||||
CommonUserOrderEntity userOrder = getById(id);
|
||||
if (userOrder == null) {
|
||||
throw new ServiceException("无效订单");
|
||||
}
|
||||
if (userOrder.getOrderStatus().equals(OrderStatus.CLOSED_TIMEOUT.getCode())) {
|
||||
return true;
|
||||
}
|
||||
if (userOrder.getPaymentStatus().equals(PaymentStatus.FAILED.getCode())) {
|
||||
return true;
|
||||
}
|
||||
userOrder.setOrderStatus(OrderStatus.CLOSED_TIMEOUT.getCode());
|
||||
userOrder.setPaymentStatus(PaymentStatus.FAILED.getCode());
|
||||
return updateById(userOrder);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void validateCertificates(CommonTourInfoEntity traveler, TourProductEntity product) {
|
||||
String name = Optional.ofNullable(traveler.getUserName()).orElse("未知用户");
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.springblade.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.modules.api.vo.CommonTourismSpotApiVO;
|
||||
import org.springblade.modules.api.vo.CommonTourismSpotDetailApiVO;
|
||||
import org.springblade.modules.common.convert.CommonTourismSpotConvert;
|
||||
@@ -39,6 +40,7 @@ public class CulturalTourismSpotServiceImpl extends BaseServiceImpl<CulturalTour
|
||||
CulturalTourismSpotEntity::getThumbnailUrl,
|
||||
CulturalTourismSpotEntity::getSummary)
|
||||
.eq(CulturalTourismSpotEntity::getIsRecommended, 0)
|
||||
.eq(CulturalTourismSpotEntity::getStatus, 1)
|
||||
.orderByDesc(CulturalTourismSpotEntity::getVisitCount)
|
||||
|
||||
);
|
||||
@@ -58,6 +60,7 @@ public class CulturalTourismSpotServiceImpl extends BaseServiceImpl<CulturalTour
|
||||
CulturalTourismSpotEntity::getThumbnailUrl,
|
||||
CulturalTourismSpotEntity::getSummary)
|
||||
.eq(CulturalTourismSpotEntity::getIsRecommended, 1)
|
||||
.eq(CulturalTourismSpotEntity::getStatus, 1)
|
||||
.orderByDesc(CulturalTourismSpotEntity::getVisitCount)
|
||||
|
||||
);
|
||||
@@ -71,7 +74,15 @@ public class CulturalTourismSpotServiceImpl extends BaseServiceImpl<CulturalTour
|
||||
return CommonTourismSpotConvert.INSTANCE.convertTourismSpotDetailApiVO(tourismSpot);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applyStatus(Long id) {
|
||||
CulturalTourismSpotEntity tourismSpot = getById(id);
|
||||
if (tourismSpot == null){
|
||||
throw new ServiceException("无效文旅景点");
|
||||
}
|
||||
tourismSpot.setStatus(Math.abs(tourismSpot.getStatus() - 1));
|
||||
return updateById(tourismSpot);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -12,7 +14,6 @@ import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
|
||||
import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
|
||||
import org.springblade.modules.common.pojo.vo.MerchantFlagshipStoreVO;
|
||||
import org.springblade.modules.common.mapper.MerchantFlagshipStoreMapper;
|
||||
import org.springblade.modules.common.service.AMapService;
|
||||
import org.springblade.modules.common.service.ICommonRegionsInfoService;
|
||||
import org.springblade.modules.common.service.IMerchantFlagshipStoreService;
|
||||
import org.springblade.modules.common.service.TianDiTuMapService;
|
||||
@@ -33,7 +34,6 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFlagshipStoreMapper, MerchantFlagshipStoreEntity> implements IMerchantFlagshipStoreService {
|
||||
|
||||
private final AMapService mapService;
|
||||
private final ICommonRegionsInfoService commonRegionsInfoService;
|
||||
private final TianDiTuMapService tianDiTuMapService;
|
||||
|
||||
@@ -44,15 +44,14 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
||||
|
||||
@Override
|
||||
public boolean saveStore(MerchantFlagshipStoreVO storeVO) {
|
||||
if (storeVO.getArea() == null){
|
||||
if (storeVO.getRegionsId() == null){
|
||||
throw new ServiceException("请选择地址");
|
||||
}
|
||||
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getArea());
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getRegionsId());
|
||||
if (regionsInfo == null){
|
||||
throw new ServiceException("请选择正确的地址");
|
||||
}
|
||||
// LocationDTO locationDTO = mapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||
|
||||
|
||||
@@ -60,7 +59,10 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
||||
|
||||
store.setLocation(locationDTO.getLongitude() , locationDTO.getLatitude());
|
||||
store.setRegionsId(regionsInfo.getId());
|
||||
store.setFullAddress(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||
store.setProvinceId(storeVO.getProvinceId());
|
||||
store.setCityId(storeVO.getCityId());
|
||||
store.setFullAddress( storeVO.getFullAddress());
|
||||
store.setRegionName( regionsInfo.getFullName());
|
||||
|
||||
store.setStoreName(storeVO.getStoreName());
|
||||
store.setContactPhone(storeVO.getContactPhone());
|
||||
@@ -77,23 +79,25 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
||||
|
||||
@Override
|
||||
public boolean updateStore(MerchantFlagshipStoreVO storeVO) {
|
||||
if (storeVO.getArea() == null) {
|
||||
if (storeVO.getRegionsId() == null) {
|
||||
throw new ServiceException("请选择地址");
|
||||
}
|
||||
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getArea());
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getRegionsId());
|
||||
if (regionsInfo == null) {
|
||||
throw new ServiceException("请选择正确的地址");
|
||||
}
|
||||
|
||||
// LocationDTO locationDTO = mapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||
|
||||
MerchantFlagshipStoreEntity store = new MerchantFlagshipStoreEntity();
|
||||
|
||||
store.setLocation(locationDTO.getLongitude(), locationDTO.getLatitude());
|
||||
store.setRegionsId(regionsInfo.getId());
|
||||
store.setFullAddress(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||
store.setProvinceId(storeVO.getProvinceId());
|
||||
store.setCityId(storeVO.getCityId());
|
||||
store.setFullAddress( storeVO.getFullAddress());
|
||||
store.setRegionName( regionsInfo.getFullName());
|
||||
|
||||
store.setId(storeVO.getId());
|
||||
store.setStoreName(storeVO.getStoreName());
|
||||
@@ -133,5 +137,48 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
||||
return this.baseMapper.merchantStoreDetail(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MerchantFlagshipStoreEntity getByDetail(Long id) {
|
||||
return getOne(
|
||||
new LambdaQueryWrapper<MerchantFlagshipStoreEntity>()
|
||||
.select(MerchantFlagshipStoreEntity::getId,
|
||||
MerchantFlagshipStoreEntity::getStoreName,
|
||||
MerchantFlagshipStoreEntity::getContactPhone,
|
||||
MerchantFlagshipStoreEntity::getThumbnailUrl,
|
||||
MerchantFlagshipStoreEntity::getMainImageUrl,
|
||||
MerchantFlagshipStoreEntity::getDetailImages,
|
||||
MerchantFlagshipStoreEntity::getBusinessHours,
|
||||
MerchantFlagshipStoreEntity::getStoreDescription,
|
||||
MerchantFlagshipStoreEntity::getRegionsId,
|
||||
MerchantFlagshipStoreEntity::getProvinceId,
|
||||
MerchantFlagshipStoreEntity::getCityId,
|
||||
MerchantFlagshipStoreEntity::getFullAddress,
|
||||
MerchantFlagshipStoreEntity::getRegionName
|
||||
)
|
||||
.eq(MerchantFlagshipStoreEntity::getId, id)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyStatus(Long id) {
|
||||
|
||||
MerchantFlagshipStoreEntity merchantFlagshipStore = getOne(
|
||||
Wrappers.lambdaQuery(MerchantFlagshipStoreEntity.class)
|
||||
.select(MerchantFlagshipStoreEntity::getId, MerchantFlagshipStoreEntity::getStatus)
|
||||
.eq(MerchantFlagshipStoreEntity::getId, id)
|
||||
);
|
||||
|
||||
if (merchantFlagshipStore == null) {
|
||||
throw new ServiceException("无效店铺");
|
||||
}
|
||||
int status = Math.abs(merchantFlagshipStore.getStatus() - 1);
|
||||
return update(
|
||||
Wrappers.lambdaUpdate(MerchantFlagshipStoreEntity.class)
|
||||
.eq(MerchantFlagshipStoreEntity::getId, id)
|
||||
.set(MerchantFlagshipStoreEntity::getStatus, status)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class NewsCategoryServiceImpl extends BaseServiceImpl<NewsCategoryMapper,
|
||||
|
||||
List<NewsCategoryEntity> categoryList = list(
|
||||
Wrappers.lambdaQuery(NewsCategoryEntity.class)
|
||||
.eq(NewsCategoryEntity::getStatus, 1)
|
||||
.orderByDesc(NewsCategoryEntity::getIsTop)
|
||||
.orderByDesc(NewsCategoryEntity::getSortOrder)
|
||||
.orderByDesc(NewsCategoryEntity::getCreateTime)
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.springblade.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.modules.api.vo.CommonNewsCategoryApiVO;
|
||||
import org.springblade.modules.api.vo.CommonNewsContentApiVO;
|
||||
import org.springblade.modules.api.vo.CommonNewsContentDetailApiVO;
|
||||
@@ -48,6 +49,7 @@ public class NewsContentServiceImpl extends BaseServiceImpl<NewsContentMapper, N
|
||||
NewsContentEntity::getCreateTime
|
||||
)
|
||||
.eq(categoryId != null ,NewsContentEntity::getCategoryId, categoryId)
|
||||
.eq(NewsContentEntity::getStatus, 1)
|
||||
.orderByDesc(NewsContentEntity::getIsFeatured)
|
||||
.orderByDesc(NewsContentEntity::getSortOrder)
|
||||
.orderByDesc(NewsContentEntity::getCreateTime)
|
||||
@@ -61,5 +63,15 @@ public class NewsContentServiceImpl extends BaseServiceImpl<NewsContentMapper, N
|
||||
return CommonNewsContentConvert.INSTANCE.convertNewsContentDetailApiVO(newsContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyStatus(Long id) {
|
||||
NewsContentEntity newsContent = getById(id);
|
||||
if (newsContent == null){
|
||||
throw new ServiceException("无效资讯信息");
|
||||
}
|
||||
newsContent.setStatus(Math.abs(newsContent.getStatus() - 1));
|
||||
return updateById(newsContent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.modules.common.config.TianDiTuConfiguration;
|
||||
import org.springblade.modules.common.pojo.dto.LocationDTO;
|
||||
import org.springblade.modules.common.response.TianDiTuGeoResponse;
|
||||
import org.springblade.modules.common.service.TianDiTuMapService;
|
||||
@@ -20,7 +19,8 @@ import java.util.HashMap;
|
||||
public class TianDiTuMapServiceImpl implements TianDiTuMapService {
|
||||
|
||||
|
||||
private final TianDiTuConfiguration configuration;
|
||||
private final String key = "481fce07effc76be3bcf1dd7a5869f84";
|
||||
|
||||
|
||||
private static String ADDRESS_TEMPLATE = """
|
||||
{"keyWord":"%s"}
|
||||
@@ -31,9 +31,9 @@ public class TianDiTuMapServiceImpl implements TianDiTuMapService {
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("ds", ADDRESS_TEMPLATE.formatted(address));
|
||||
paramMap.put("tk", configuration.getKey());
|
||||
paramMap.put("tk", key);
|
||||
|
||||
String result = HttpUtil.get(configuration.getBaseUrl() + "/geocoder", paramMap);
|
||||
String result = HttpUtil.get( "https://api.tianditu.gov.cn/geocoder", paramMap);
|
||||
TianDiTuGeoResponse response = JSONObject.parseObject(result, TianDiTuGeoResponse.class);
|
||||
if (response.getStatus().equals("0")) {
|
||||
TianDiTuGeoResponse.LocationInfo locationInfo = response.getLocation();
|
||||
|
||||
@@ -47,11 +47,11 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
throw new ServiceException("评分在0.1在5.0之间");
|
||||
}
|
||||
|
||||
if (tourProduct.getCity() == null){
|
||||
if (tourProduct.getCityId() == null){
|
||||
throw new ServiceException("请选择地址");
|
||||
}
|
||||
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCity());
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCityId());
|
||||
if (regionsInfo == null){
|
||||
throw new ServiceException("请选择正确的地址");
|
||||
}
|
||||
@@ -63,7 +63,9 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
|
||||
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
|
||||
tourProductEntity.setDetailImages(tourProduct.getDetailImages());
|
||||
tourProductEntity.setCityName(regionsInfo.getName());
|
||||
tourProductEntity.setCityName(regionsInfo.getFullName());
|
||||
tourProductEntity.setProvinceId(tourProduct.getProvinceId());
|
||||
tourProductEntity.setCityId(tourProduct.getCityId());
|
||||
tourProductEntity.setDurationDays(tourProduct.getDurationDays());
|
||||
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
|
||||
tourProductEntity.setBasePrice(tourProduct.getBasePrice());
|
||||
@@ -95,10 +97,10 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
}
|
||||
|
||||
|
||||
if (tourProduct.getCity() == null){
|
||||
if (tourProduct.getCityId() == null){
|
||||
throw new ServiceException("请选择地址");
|
||||
}
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCity());
|
||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCityId());
|
||||
if (regionsInfo == null){
|
||||
throw new ServiceException("请选择正确的地址");
|
||||
}
|
||||
@@ -110,7 +112,9 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
|
||||
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
|
||||
tourProductEntity.setDetailImages(tourProduct.getDetailImages());
|
||||
tourProductEntity.setCityName(regionsInfo.getName());
|
||||
tourProductEntity.setCityName(regionsInfo.getFullName());
|
||||
tourProductEntity.setProvinceId(tourProduct.getProvinceId());
|
||||
tourProductEntity.setCityId(tourProduct.getCityId());
|
||||
tourProductEntity.setDurationDays(tourProduct.getDurationDays());
|
||||
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
|
||||
tourProductEntity.setBasePrice(tourProduct.getBasePrice());
|
||||
@@ -143,6 +147,7 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
TourProductEntity::getRating,
|
||||
TourProductEntity::getBasePrice)
|
||||
.eq(TourProductEntity::getIsRecommended, 0)
|
||||
.eq(TourProductEntity::getStatus, 1)
|
||||
.like( request.getCityName() != null, TourProductEntity::getCityName, request.getCityName())
|
||||
.orderByDesc(TourProductEntity::getId)
|
||||
.orderByDesc(TourProductEntity::getVisitCount)
|
||||
@@ -164,6 +169,7 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
TourProductEntity::getRating,
|
||||
TourProductEntity::getBasePrice)
|
||||
.eq(TourProductEntity::getIsRecommended, 1)
|
||||
.eq(TourProductEntity::getStatus, 1)
|
||||
.like( request.getCityName() != null, TourProductEntity::getCityName, request.getCityName())
|
||||
.orderByDesc(TourProductEntity::getId)
|
||||
.orderByDesc(TourProductEntity::getVisitCount)
|
||||
@@ -178,6 +184,16 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
||||
return CommonTourProductConvert.INSTANCE.convertTourProductDetailApiVO(tourProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyStatus(Long id) {
|
||||
TourProductEntity tourProduct = getById(id);
|
||||
if (tourProduct == null) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
tourProduct.setStatus(Math.abs(tourProduct.getStatus() - 1));
|
||||
return updateById(tourProduct);
|
||||
}
|
||||
|
||||
|
||||
private boolean isValidRating(BigDecimal rating) {
|
||||
if (rating == null) {
|
||||
|
||||
@@ -27,32 +27,32 @@ package org.springblade.modules.common.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonPayOrderVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonReleaseVersionEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonReleaseVersionVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 系统内部订单关联支付记录 包装类,返回视图层所需的字段
|
||||
* APP版本发布管理 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author BladeX
|
||||
* @since 2026-03-24
|
||||
* @since 2026-04-01
|
||||
*/
|
||||
public class CommonPayOrderWrapper extends BaseEntityWrapper<CommonPayOrderEntity, CommonPayOrderVO> {
|
||||
public class CommonReleaseVersionWrapper extends BaseEntityWrapper<CommonReleaseVersionEntity, CommonReleaseVersionVO> {
|
||||
|
||||
public static CommonPayOrderWrapper build() {
|
||||
return new CommonPayOrderWrapper();
|
||||
public static CommonReleaseVersionWrapper build() {
|
||||
return new CommonReleaseVersionWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonPayOrderVO entityVO(CommonPayOrderEntity commonPayOrder) {
|
||||
CommonPayOrderVO commonPayOrderVO = Objects.requireNonNull(BeanUtil.copyProperties(commonPayOrder, CommonPayOrderVO.class));
|
||||
public CommonReleaseVersionVO entityVO(CommonReleaseVersionEntity commonReleaseversion) {
|
||||
CommonReleaseVersionVO commonReleaseversionVO = Objects.requireNonNull(BeanUtil.copyProperties(commonReleaseversion, CommonReleaseVersionVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(commonPayOrder.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(commonPayOrder.getUpdateUser());
|
||||
//commonPayOrderVO.setCreateUserName(createUser.getName());
|
||||
//commonPayOrderVO.setUpdateUserName(updateUser.getName());
|
||||
//User createUser = UserCache.getUser(commonReleaseversion.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(commonReleaseversion.getUpdateUser());
|
||||
//commonReleaseversionVO.setCreateUserName(createUser.getName());
|
||||
//commonReleaseversionVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return commonPayOrderVO;
|
||||
return commonReleaseversionVO;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,4 +150,11 @@ public class MallProductController extends BladeController {
|
||||
return R.status(mallProductService.deleteLogic(Func.toLongList(ids)));
|
||||
}
|
||||
|
||||
@PostMapping("/applyStatus")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "上下架商品", description = "mallProduct.id")
|
||||
public R applyStatus(MallProductEntity mallProduct) {
|
||||
return R.status(mallProductService.applyStatus(mallProduct.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
</select>
|
||||
|
||||
<select id="selectDirectMallPage" resultMap="mallProductResultMap">
|
||||
select * from mall_product where is_deleted = 0 and status = 1 and category_id = 2033413707249164290 order by create_time desc
|
||||
select * from mall_product where is_deleted = 0 and category_id = 2033413707249164290 order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEcosystemProductPage" resultMap="mallProductResultMap">
|
||||
select * from mall_product where is_deleted = 0 and status = 1 and category_id = 2033413760969809921 order by create_time desc
|
||||
select * from mall_product where is_deleted = 0 and category_id = 2033413760969809921 order by create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -39,4 +39,5 @@ public interface IMallProductService extends BaseService<MallProductEntity> {
|
||||
MallProductDetailApiVO apiDetailVO(@NotNull(message = "无效商品") Long id);
|
||||
|
||||
|
||||
boolean applyStatus(Long id);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package org.springblade.modules.mall.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.modules.api.vo.MallProductApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductDetailApiVO;
|
||||
import org.springblade.modules.mall.convert.AppMallConvert;
|
||||
@@ -93,4 +94,17 @@ public class MallProductServiceImpl extends BaseServiceImpl<MallProductMapper, M
|
||||
return AppMallConvert.INSTANCE.convertMallProductDetailApiVO(product);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyStatus(Long id) {
|
||||
|
||||
MallProductEntity product = getById(id);
|
||||
if (product == null) {
|
||||
throw new ServiceException("无效商品");
|
||||
}
|
||||
|
||||
product.setStatus(Math.abs(product.getStatus() - 1));
|
||||
|
||||
return updateById( product);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,5 +12,8 @@ public interface BladeMarketConstant {
|
||||
// 用户兑换福利包-上级福利积分奖励配置
|
||||
String BENEFIT_PACK_SUPERIOR_REWARD_CONFIG = "market.benefit.pack.superior.reward.config";
|
||||
|
||||
// 是否开启兑换福利包
|
||||
String APP_BENEFIT_PACK_ALLOCATE_ENABLED = "app.market.benefit.pack.allocate.enabled";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/cash-performance//marketCashPerformance")
|
||||
@RequestMapping("/market/cash-performance")
|
||||
@Tag(name = "现金业绩", description = "现金业绩接口")
|
||||
public class MarketCashPerformanceController extends BladeController {
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/cash-performance-log//marketCashPerformanceLog")
|
||||
@RequestMapping("/market/cash-performance-log")
|
||||
@Tag(name = "现金业绩日志", description = "现金业绩日志接口")
|
||||
public class MarketCashPerformanceLogController extends BladeController {
|
||||
|
||||
|
||||
@@ -38,13 +38,10 @@ import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.modules.market.manager.MarketUserManager;
|
||||
import org.springblade.modules.market.pojo.vo.UserAllPointInfoVO;
|
||||
import org.springblade.modules.market.pojo.vo.UserBenefitPackCountVO;
|
||||
import org.springblade.modules.market.pojo.vo.UserMallSpendVO;
|
||||
import org.springblade.modules.market.pojo.vo.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||
import org.springblade.modules.market.wrapper.MarketInfoWrapper;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
@@ -82,8 +79,8 @@ public class MarketInfoController extends BladeController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入marketInfo")
|
||||
public R<IPage<MarketInfoVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> marketInfo, Query query) {
|
||||
IPage<MarketInfoEntity> pages = marketInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(marketInfo, MarketInfoEntity.class));
|
||||
public R<IPage<MarketInfoVO>> list(MarketInfoEntity marketInfo, Query query) {
|
||||
IPage<MarketInfoEntity> pages = marketInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(marketInfo).orderByAsc("id"));
|
||||
return R.data(MarketInfoWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
@@ -169,6 +166,13 @@ public class MarketInfoController extends BladeController {
|
||||
return R.data(marketUserManager.getUserMallSpend(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/getUserPerformance")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "用户业绩统计", description = "传入userId")
|
||||
public R<UserPerformanceVO> getUserPerformance(@RequestParam Long userId) {
|
||||
return R.data(marketUserManager.getUserPerformance(userId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market/upgrade-cash-log//marketUpgradeCashLog")
|
||||
@RequestMapping("/market/upgrade-cash-log")
|
||||
@Tag(name = "用户现金升级日志", description = "用户现金升级日志接口")
|
||||
public class MarketUpgradeCashLogController extends BladeController {
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user