Compare commits
26 Commits
34cf179254
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 '备注';
|
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;
|
DROP TABLE IF EXISTS common_order_confirm_log;
|
||||||
@@ -6,7 +6,10 @@ CREATE TABLE merchant_flagship_store
|
|||||||
id int8 NOT NULL PRIMARY KEY, -- [主键]
|
id int8 NOT NULL PRIMARY KEY, -- [主键]
|
||||||
store_name VARCHAR(255) NOT NULL, -- 商家全称
|
store_name VARCHAR(255) NOT NULL, -- 商家全称
|
||||||
contact_phone VARCHAR(20), -- 商家联系电话
|
contact_phone VARCHAR(20), -- 商家联系电话
|
||||||
|
province_id int8 NOT NULL,
|
||||||
|
city_id int8 NOT NULL,
|
||||||
regions_id int8 NOT NULL,
|
regions_id int8 NOT NULL,
|
||||||
|
region_name text NOT NULL, -- 地区名
|
||||||
full_address text NOT NULL, -- 详细地址
|
full_address text NOT NULL, -- 详细地址
|
||||||
location geometry(Point, 4326) NOT NULL, -- 门店经纬度坐标(用于地图打点和距离计算)
|
location geometry(Point, 4326) NOT NULL, -- 门店经纬度坐标(用于地图打点和距离计算)
|
||||||
thumbnail_url text, -- 缩略图
|
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.id IS '主键 ID';
|
||||||
COMMENT ON COLUMN merchant_flagship_store.store_name IS '店铺名字';
|
COMMENT ON COLUMN merchant_flagship_store.store_name IS '店铺名字';
|
||||||
COMMENT ON COLUMN merchant_flagship_store.contact_phone 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.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.full_address IS '完整详细地址';
|
||||||
COMMENT ON COLUMN merchant_flagship_store.location IS '地理坐标 POINT(经度,纬度),用于地图定位和距离计算';
|
COMMENT ON COLUMN merchant_flagship_store.location IS '地理坐标 POINT(经度,纬度),用于地图定位和距离计算';
|
||||||
COMMENT ON COLUMN merchant_flagship_store.main_image_url IS '商家主图';
|
COMMENT ON COLUMN merchant_flagship_store.main_image_url IS '商家主图';
|
||||||
@@ -224,6 +230,8 @@ CREATE TABLE tour_product
|
|||||||
description text DEFAULT NULL, -- 产品详情描述
|
description text DEFAULT NULL, -- 产品详情描述
|
||||||
visit_count int4 DEFAULT 0, -- 已成团次数/销量
|
visit_count int4 DEFAULT 0, -- 已成团次数/销量
|
||||||
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
|
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
|
||||||
|
province_id int8 NOT NULL,
|
||||||
|
city_id int8 NOT NULL,
|
||||||
create_user int8 NULL, -- 创建人ID
|
create_user int8 NULL, -- 创建人ID
|
||||||
create_dept int8 NULL, -- 创建部门ID
|
create_dept int8 NULL, -- 创建部门ID
|
||||||
create_time timestamp(6) NULL, -- 创建时间
|
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.description IS '产品详情描述';
|
||||||
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量';
|
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量';
|
||||||
COMMENT ON COLUMN tour_product.rating 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_user IS '创建人ID';
|
||||||
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
|
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
|
||||||
COMMENT ON COLUMN tour_product.create_time IS '创建时间';
|
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 (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);
|
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);
|
||||||
|
|
||||||
13
pom.xml
13
pom.xml
@@ -277,19 +277,6 @@
|
|||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.locationtech.jts</groupId>
|
<groupId>org.locationtech.jts</groupId>
|
||||||
<artifactId>jts-core</artifactId>
|
<artifactId>jts-core</artifactId>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package org.springblade;
|
|||||||
import org.springblade.common.constant.CommonConstant;
|
import org.springblade.common.constant.CommonConstant;
|
||||||
import org.springblade.core.launch.BladeApplication;
|
import org.springblade.core.launch.BladeApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||||
import org.springframework.retry.annotation.EnableRetry;
|
import org.springframework.retry.annotation.EnableRetry;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
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
|
@EnableRedisHttpSession
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableRetry //重试机制
|
@EnableRetry //重试机制
|
||||||
|
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,6 +51,8 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
|||||||
private final ApplicationEventPublisher publisher;
|
private final ApplicationEventPublisher publisher;
|
||||||
private final IMarketCommissionAccountService commissionAccountService;
|
private final IMarketCommissionAccountService commissionAccountService;
|
||||||
private final IMarketCommissionAgencyLogService agencyLogService;
|
private final IMarketCommissionAgencyLogService agencyLogService;
|
||||||
|
private final ICommonUserOrderService userOrderService;
|
||||||
|
|
||||||
private static final Long AGENCY_ACCOUNT_ID = 2017486568441696258L;
|
private static final Long AGENCY_ACCOUNT_ID = 2017486568441696258L;
|
||||||
|
|
||||||
|
|
||||||
@@ -66,6 +68,25 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
|||||||
.eq(MarketUpgradeCashLogEntity::getUpgradeDate, DateUtil.getYesterday())
|
.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(
|
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||||
.eq(MarketUpgradeConfigEntity::getType, 2)
|
.eq(MarketUpgradeConfigEntity::getType, 2)
|
||||||
@@ -203,6 +224,11 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
|||||||
if (rewardRatePoint.compareTo(BigDecimal.ZERO) <= 0){
|
if (rewardRatePoint.compareTo(BigDecimal.ZERO) <= 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// 未在自营商城消费
|
||||||
|
if (!orderUserIdSet.contains(ancestorId)){
|
||||||
|
log.info( " 用户ID:{} , {} 未在自营商城消费 ", ancestorId,DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!userLastAmountMap.containsKey(ancestorId)){
|
if (!userLastAmountMap.containsKey(ancestorId)){
|
||||||
MarketUserCommissionEntity benefitPoint = userCommissionService.getById(ancestorId);
|
MarketUserCommissionEntity benefitPoint = userCommissionService.getById(ancestorId);
|
||||||
@@ -285,7 +311,10 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
|||||||
commissionAccountService.updateById(agencyAccount);
|
commissionAccountService.updateById(agencyAccount);
|
||||||
agencyLogService.saveBatch(agencyLogList , 5000);
|
agencyLogService.saveBatch(agencyLogList , 5000);
|
||||||
|
|
||||||
orderPageList.forEach(order -> order.setIsAgencyDistributed(1));
|
orderPageList.forEach(order -> {
|
||||||
|
order.setIsAgencyDistributed(1);
|
||||||
|
order.setAgencyDistributeTime(new Date());
|
||||||
|
});
|
||||||
orderConfirmLogService.updateBatchById(orderPageList , 5000);
|
orderConfirmLogService.updateBatchById(orderPageList , 5000);
|
||||||
|
|
||||||
return new ProcessResult(true, "result is success");
|
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.common.utils.date.DateUtil;
|
||||||
import org.springblade.core.redis.cache.BladeRedis;
|
import org.springblade.core.redis.cache.BladeRedis;
|
||||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
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.eums.MarketBusinessModule;
|
||||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||||
import org.springblade.modules.market.pojo.entity.*;
|
import org.springblade.modules.market.pojo.entity.*;
|
||||||
@@ -42,6 +45,7 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
|||||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||||
private final BladeRedis bladeRedis;
|
private final BladeRedis bladeRedis;
|
||||||
private final ApplicationEventPublisher publisher;
|
private final ApplicationEventPublisher publisher;
|
||||||
|
private final ICommonUserOrderService userOrderService;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -49,6 +53,8 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
|||||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||||
// 1. 初始化配置
|
// 1. 初始化配置
|
||||||
Date searchDate = DateUtil.getYesterday();
|
Date searchDate = DateUtil.getYesterday();
|
||||||
|
Date startDate = DateUtil.getYesterday();
|
||||||
|
Date endDate = DateUtil.getToday();
|
||||||
|
|
||||||
// 2. 预加载基础数据 (减少循环内DB查询)
|
// 2. 预加载基础数据 (减少循环内DB查询)
|
||||||
List<MarketBenefitPackageTemplateEntity> templateEntityList = benefitPackageTemplateService.list();
|
List<MarketBenefitPackageTemplateEntity> templateEntityList = benefitPackageTemplateService.list();
|
||||||
@@ -62,6 +68,31 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
|||||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||||
.orderByAsc(MarketBenefitPackageEntity::getId)
|
.orderByAsc(MarketBenefitPackageEntity::getId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (benefitPackageEntityList.isEmpty()){
|
||||||
|
log.info("没有需要处理的用户福利包");
|
||||||
|
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
|
||||||
Map<Long, List<MarketBenefitPackageEntity>> packageEntityMap = benefitPackageEntityList.stream()
|
Map<Long, List<MarketBenefitPackageEntity>> packageEntityMap = benefitPackageEntityList.stream()
|
||||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
||||||
@@ -188,6 +219,11 @@ public class AccelUpgradeWelfareProcessor implements BasicProcessor {
|
|||||||
BigDecimal rewardRatePoint = rewardRate.multiply(totalUserBenefit).setScale(2, RoundingMode.HALF_UP);
|
BigDecimal rewardRatePoint = rewardRate.multiply(totalUserBenefit).setScale(2, RoundingMode.HALF_UP);
|
||||||
if (rewardRatePoint.compareTo(BigDecimal.ZERO) <= 0) continue;
|
if (rewardRatePoint.compareTo(BigDecimal.ZERO) <= 0) continue;
|
||||||
|
|
||||||
|
// 未在自营商城消费
|
||||||
|
if (!orderUserIdSet.contains(ancestorId)){
|
||||||
|
log.info( " 用户ID:{} , {} 未在自营商城消费 ", ancestorId,DateUtil.convertFromDate(DateUtil.getYesterday() , "yyyy-MM-dd"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal remainingPoint = rewardRatePoint; // 剩余需要扣除的金额
|
BigDecimal remainingPoint = rewardRatePoint; // 剩余需要扣除的金额
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
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; // 【优化点3】分批处理,防止内存溢出
|
||||||
|
int currentCount = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
// 2. 分批查询数据库
|
||||||
|
// 【优化点1】增加 orderByAsc 保证按时间顺序处理,增加 last("LIMIT") 限制数量
|
||||||
|
List<CommonUserOrderEntity> payOrderList = commonUserOrderService.list(
|
||||||
|
Wrappers.lambdaQuery(CommonUserOrderEntity.class)
|
||||||
|
.eq(CommonUserOrderEntity::getPaymentStatus, PaymentStatus.UNPAID.getCode()) // 确保传的是 code 值,如果是枚举对象需调整
|
||||||
|
.eq(CommonUserOrderEntity::getOrderStatus, OrderStatus.PENDING_PAYMENT.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) {
|
||||||
|
Long orderId = payOrder.getId();
|
||||||
|
String orderNo = PaymentType.fromCodeOrNull(payOrder.getPaymentType()).getAbbr() + BusinessModule.fromCodeIgnoreCaseOrNull(payOrder.getOrderType()).getAbbr() + payOrder.getId();
|
||||||
|
log.info("处理超时订单,订单号: {}", orderNo);
|
||||||
|
if (payOrder == null) {
|
||||||
|
log.error("关联用户订单不存在,orderId: {}", orderId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AlipayTradeQueryResponse response = paymentService.aliQuery(orderNo);
|
||||||
|
log.info("查询结果: {}", response);
|
||||||
|
|
||||||
|
|
||||||
|
if (response == null) {
|
||||||
|
updateOrderToClosed(payOrder);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateOrderToClosed(payOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事务方法:更新为关闭状态
|
||||||
|
* 使用 update(entity, wrapper) 方式实现乐观锁检查
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateOrderToClosed( CommonUserOrderEntity userOrder) {
|
||||||
|
// 支付单更新成功,再更新用户订单
|
||||||
|
userOrder.setOrderStatus(OrderStatus.CLOSED_TIMEOUT.getCode());
|
||||||
|
userOrder.setPaymentStatus(PaymentStatus.FAILED.getCode());
|
||||||
|
// userOrder.setUpdateTime(new Date());
|
||||||
|
commonUserOrderService.updateById(userOrder);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.utils.date.DateUtil;
|
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.eums.MarketBusinessModule;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
|
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.IMarketBenefitPointLogService;
|
||||||
import org.springblade.modules.market.service.IMarketBenefitPointService;
|
import org.springblade.modules.market.service.IMarketBenefitPointService;
|
||||||
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
|
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 org.springframework.stereotype.Component;
|
||||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||||
import tech.powerjob.worker.core.processor.TaskContext;
|
import tech.powerjob.worker.core.processor.TaskContext;
|
||||||
@@ -27,6 +31,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
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 IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||||
private final IMarketBenefitPointService benefitPointService;
|
private final IMarketBenefitPointService benefitPointService;
|
||||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||||
|
private final IParamService paramService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProcessResult process(TaskContext context) {
|
public ProcessResult process(TaskContext context) {
|
||||||
@@ -56,6 +63,10 @@ public class BenefitPackageSendPointProcessor implements BasicProcessor {
|
|||||||
return new ProcessResult(false, "系统异常: " + e.getMessage());
|
return new ProcessResult(false, "系统异常: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CacheUtil.clear(PARAM_CACHE);
|
||||||
|
CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
|
||||||
|
|
||||||
|
paramService.update(Wrappers.<Param>lambdaUpdate().eq(Param::getParamKey, BladeMarketConstant.APP_BENEFIT_PACK_ALLOCATE_ENABLED).set(Param::getParamValue, Boolean.TRUE));
|
||||||
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
|
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
|
||||||
return new ProcessResult(true, "result is success");
|
return new ProcessResult(true, "result is success");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.utils.date.DateUtil;
|
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.MarketBenefitPackageEntity;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
|
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
|
||||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||||
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
|
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 org.springframework.stereotype.Component;
|
||||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||||
import tech.powerjob.worker.core.processor.TaskContext;
|
import tech.powerjob.worker.core.processor.TaskContext;
|
||||||
@@ -19,6 +23,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
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 IMarketBenefitPackageService userBenefitPackageService;
|
||||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||||
|
private final IParamService paramService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProcessResult process(TaskContext context) {
|
public ProcessResult process(TaskContext context) {
|
||||||
@@ -36,6 +43,10 @@ public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
|
|||||||
OmsLogger omsLogger = context.getOmsLogger(); // PowerJob 内置日志,控制台可查
|
OmsLogger omsLogger = context.getOmsLogger(); // PowerJob 内置日志,控制台可查
|
||||||
|
|
||||||
try {
|
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("开始执行定时任务-初始化用户福利包每天结算记录...");
|
omsLogger.info("开始执行定时任务-初始化用户福利包每天结算记录...");
|
||||||
initUserPackageDailySettlement();
|
initUserPackageDailySettlement();
|
||||||
omsLogger.info("结束执行定时任务-初始化用户福利包每天结算记录");
|
omsLogger.info("结束执行定时任务-初始化用户福利包每天结算记录");
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ public class StatsCalculatorCashProcessor implements BasicProcessor {
|
|||||||
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (orderPageList.isEmpty()){
|
||||||
|
return new ProcessResult(true, "result is success");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 2. 提取所有用户ID,用于批量查询
|
// 2. 提取所有用户ID,用于批量查询
|
||||||
Set<Long> userIds = orderPageList.stream()
|
Set<Long> userIds = orderPageList.stream()
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ public class StatsCalculatorWelfareProcessor implements BasicProcessor {
|
|||||||
.orderByAsc(MarketBenefitPackageEntity::getId)
|
.orderByAsc(MarketBenefitPackageEntity::getId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (benefitPackageEntityList.isEmpty()){
|
||||||
|
return new ProcessResult(true, "result is success");
|
||||||
|
}
|
||||||
|
|
||||||
// 按用户分组
|
// 按用户分组
|
||||||
Map<Long, List<MarketBenefitPackageEntity>> packageEntityMap = benefitPackageEntityList.stream()
|
Map<Long, List<MarketBenefitPackageEntity>> packageEntityMap = benefitPackageEntityList.stream()
|
||||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.utils.date.DateUtil;
|
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.eums.MarketBusinessModule;
|
||||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketCashPerformanceEntity;
|
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 tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -42,12 +42,16 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
|||||||
private final IMarketUpgradeConfigService upgradeConfigService;
|
private final IMarketUpgradeConfigService upgradeConfigService;
|
||||||
private final IMarketCashPerformanceService cashPerformanceService;
|
private final IMarketCashPerformanceService cashPerformanceService;
|
||||||
private final IMarketUpgradeCashLogService upgradeCashLogService;
|
private final IMarketUpgradeCashLogService upgradeCashLogService;
|
||||||
|
private final ICommonUserOrderService userOrderService;
|
||||||
private final ApplicationEventPublisher publisher;
|
private final ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||||
|
|
||||||
|
Date startDate = DateUtil.getYesterday();
|
||||||
|
Date endDate = DateUtil.getToday();
|
||||||
|
|
||||||
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||||
.eq(MarketUpgradeConfigEntity::getType, 2)
|
.eq(MarketUpgradeConfigEntity::getType, 2)
|
||||||
@@ -73,6 +77,19 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
|||||||
.orderByAsc(MarketCashPerformanceEntity::getTotalAmount)
|
.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<>();
|
List<MarketUpgradeCashLogEntity> upgradeCashLogList = new ArrayList<>();
|
||||||
|
|
||||||
performanceList.forEach(performance -> {
|
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();
|
long lastLevelId = upgradeConfigList.get(0).getId();
|
||||||
MarketUpgradeCashLogEntity lastUpgradeWelfareLog = upgradeCashLogService.getOne(
|
MarketUpgradeCashLogEntity lastUpgradeWelfareLog = upgradeCashLogService.getOne(
|
||||||
Wrappers.lambdaQuery(MarketUpgradeCashLogEntity.class)
|
Wrappers.lambdaQuery(MarketUpgradeCashLogEntity.class)
|
||||||
@@ -95,35 +117,36 @@ public class TallyCashUpgradeProcessor implements BasicProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Long upgradeId = getUpgradeId(upgradeConfigMap, minConfig.getId(), performance.getTotalAmount(), count);
|
Long upgradeId = getUpgradeId(upgradeConfigMap, minConfig.getId(), performance.getTotalAmount(), count);
|
||||||
|
boolean contains = orderUserIdSet.contains(performance.getId());
|
||||||
|
String spending = contains ? "自营商城已消费" : "自营商城未消费";
|
||||||
|
|
||||||
MarketUpgradeCashLogEntity upgradeCashLog = new MarketUpgradeCashLogEntity();
|
MarketUpgradeCashLogEntity upgradeCashLog = new MarketUpgradeCashLogEntity();
|
||||||
upgradeCashLog.setUserId(performance.getId());
|
upgradeCashLog.setUserId(performance.getId());
|
||||||
upgradeCashLog.setLastLevel(lastLevelId);
|
upgradeCashLog.setLastLevel(lastLevelId);
|
||||||
upgradeCashLog.setCurrentLevelId(upgradeId);
|
upgradeCashLog.setCurrentLevelId(upgradeId);
|
||||||
upgradeCashLog.setCurrentLevelName(upgradeConfigMap.get(upgradeId).getLevelName());
|
upgradeCashLog.setCurrentLevelName(upgradeConfigMap.get(upgradeId).getLevelName());
|
||||||
upgradeCashLog.setUpgradeDate(DateUtil.getYesterday());
|
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);
|
upgradeCashLogList.add(upgradeCashLog);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
upgradeCashLogService.saveBatch(upgradeCashLogList, 2000);
|
||||||
if (upgradeCashLogService.saveBatch(upgradeCashLogList, 2000)){
|
// if (upgradeCashLogService.saveBatch(upgradeCashLogList, 2000)){
|
||||||
List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = upgradeCashLogList.stream()
|
// List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = upgradeCashLogList.stream()
|
||||||
.map(upgradeConfig -> new MarketUpgradeNoticeEvent.NoticeItem(
|
// .map(upgradeConfig -> new MarketUpgradeNoticeEvent.NoticeItem(
|
||||||
upgradeConfig.getUserId(),
|
// upgradeConfig.getUserId(),
|
||||||
"当前等级:" + upgradeConfig.getCurrentLevelName() + "," +upgradeConfig.getRemarks()
|
// "当前等级:" + upgradeConfig.getCurrentLevelName() + "," +upgradeConfig.getRemarks()
|
||||||
))
|
// ))
|
||||||
.collect(Collectors.toList());
|
// .collect(Collectors.toList());
|
||||||
|
// // 2. 发送事件 (只发一次,传入全部数据)
|
||||||
// 2. 发送事件 (只发一次,传入全部数据)
|
// MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
||||||
MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
// noticeItems,
|
||||||
noticeItems,
|
// MarketBusinessModule.CASH_UPGRADE
|
||||||
MarketBusinessModule.CASH_UPGRADE
|
// );
|
||||||
);
|
//
|
||||||
|
// publisher.publishEvent(event);
|
||||||
publisher.publishEvent(event);
|
// log.info("已发布批量升级事件,数量: {}", noticeItems.size());
|
||||||
|
// }
|
||||||
log.info("已发布批量升级事件,数量: {}", noticeItems.size());
|
|
||||||
}
|
|
||||||
return new ProcessResult(true, "result is success");
|
return new ProcessResult(true, "result is success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.common.utils.date.DateUtil;
|
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.eums.MarketBusinessModule;
|
||||||
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
import org.springblade.modules.market.event.MarketUpgradeNoticeEvent;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
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 tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -42,11 +42,15 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
|||||||
private final IMarketUpgradeWelfareLogService upgradeWelfareLogService;
|
private final IMarketUpgradeWelfareLogService upgradeWelfareLogService;
|
||||||
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||||
private final ApplicationEventPublisher publisher;
|
private final ApplicationEventPublisher publisher;
|
||||||
|
private final ICommonUserOrderService userOrderService;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||||
|
|
||||||
|
Date startDate = DateUtil.getYesterday();
|
||||||
|
Date endDate = DateUtil.getToday();
|
||||||
|
|
||||||
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
List<MarketUpgradeConfigEntity> upgradeConfigList = upgradeConfigService.list(
|
||||||
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
Wrappers.lambdaQuery(MarketUpgradeConfigEntity.class)
|
||||||
.eq(MarketUpgradeConfigEntity::getType, 1)
|
.eq(MarketUpgradeConfigEntity::getType, 1)
|
||||||
@@ -72,6 +76,19 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
|||||||
.orderByAsc(MarketWelfarePerformanceEntity::getTotalAmount)
|
.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<>();
|
List<MarketUpgradeWelfareLogEntity> upgradeWelfareLogList = new ArrayList<>();
|
||||||
|
|
||||||
performanceList.forEach(performance -> {
|
performanceList.forEach(performance -> {
|
||||||
@@ -81,6 +98,10 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
|||||||
.eq(MarketInfoEntity::getPid, performance.getId())
|
.eq(MarketInfoEntity::getPid, performance.getId())
|
||||||
|
|
||||||
);
|
);
|
||||||
|
if (count < minConfig.getDirectRecommend()){
|
||||||
|
log.error("用户ID:{} 没有达到升级条件 , 最低直推人数: {} , 现有直推人数: {}", performance.getId() , minConfig.getDirectRecommend() , count);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
long lastLevelId = upgradeConfigList.get(0).getId();
|
long lastLevelId = upgradeConfigList.get(0).getId();
|
||||||
MarketUpgradeWelfareLogEntity lastUpgradeWelfareLog = upgradeWelfareLogService.getOne(
|
MarketUpgradeWelfareLogEntity lastUpgradeWelfareLog = upgradeWelfareLogService.getOne(
|
||||||
@@ -94,33 +115,38 @@ public class TallyWelfareUpgradeProcessor implements BasicProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Long upgradeId = getUpgradeId(upgradeConfigMap, minConfig.getId(), performance.getTotalAmount(), count);
|
Long upgradeId = getUpgradeId(upgradeConfigMap, minConfig.getId(), performance.getTotalAmount(), count);
|
||||||
|
|
||||||
|
boolean contains = orderUserIdSet.contains(performance.getId());
|
||||||
|
String spending = contains ? "自营商城已消费" : "自营商城未消费";
|
||||||
|
|
||||||
MarketUpgradeWelfareLogEntity upgradeWelfareLog = new MarketUpgradeWelfareLogEntity();
|
MarketUpgradeWelfareLogEntity upgradeWelfareLog = new MarketUpgradeWelfareLogEntity();
|
||||||
upgradeWelfareLog.setUserId(performance.getId());
|
upgradeWelfareLog.setUserId(performance.getId());
|
||||||
upgradeWelfareLog.setLastLevel(lastLevelId);
|
upgradeWelfareLog.setLastLevel(lastLevelId);
|
||||||
upgradeWelfareLog.setCurrentLevelId(upgradeId);
|
upgradeWelfareLog.setCurrentLevelId(upgradeId);
|
||||||
upgradeWelfareLog.setCurrentLevelName(upgradeConfigMap.get(upgradeId).getLevelName());
|
upgradeWelfareLog.setCurrentLevelName(upgradeConfigMap.get(upgradeId).getLevelName());
|
||||||
upgradeWelfareLog.setUpgradeDate(DateUtil.getYesterday());
|
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);
|
upgradeWelfareLogList.add(upgradeWelfareLog);
|
||||||
});
|
});
|
||||||
if (upgradeWelfareLogService.saveBatch(upgradeWelfareLogList, 2000)){
|
upgradeWelfareLogService.saveBatch(upgradeWelfareLogList, 2000);
|
||||||
List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = upgradeWelfareLogList.stream()
|
// if (upgradeWelfareLogService.saveBatch(upgradeWelfareLogList, 2000)){
|
||||||
.map(upgradeConfig -> new MarketUpgradeNoticeEvent.NoticeItem(
|
// List<MarketUpgradeNoticeEvent.NoticeItem> noticeItems = upgradeWelfareLogList.stream()
|
||||||
upgradeConfig.getUserId(),
|
// .map(upgradeConfig -> new MarketUpgradeNoticeEvent.NoticeItem(
|
||||||
"当前等级:" + upgradeConfig.getCurrentLevelName() + "," +upgradeConfig.getRemarks()
|
// upgradeConfig.getUserId(),
|
||||||
))
|
// "当前等级:" + upgradeConfig.getCurrentLevelName() + "," +upgradeConfig.getRemarks()
|
||||||
.collect(Collectors.toList());
|
// ))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
// 2. 发送事件 (只发一次,传入全部数据)
|
//
|
||||||
MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
// // 2. 发送事件 (只发一次,传入全部数据)
|
||||||
noticeItems,
|
// MarketUpgradeNoticeEvent event = new MarketUpgradeNoticeEvent(
|
||||||
MarketBusinessModule.WELFARE_UPGRADE
|
// noticeItems,
|
||||||
);
|
// MarketBusinessModule.WELFARE_UPGRADE
|
||||||
|
// );
|
||||||
publisher.publishEvent(event);
|
//
|
||||||
|
// publisher.publishEvent(event);
|
||||||
log.info("已发布批量升级事件,数量: {}", noticeItems.size());
|
//
|
||||||
}
|
// log.info("已发布批量升级事件,数量: {}", noticeItems.size());
|
||||||
|
// }
|
||||||
|
|
||||||
return new ProcessResult(true, "result is success");
|
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("并发冲突:订单状态已变更,关闭失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,15 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.tool.api.R;
|
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.MallProductApiVO;
|
||||||
import org.springblade.modules.api.vo.MallProductDetailApiVO;
|
import org.springblade.modules.api.vo.MallProductDetailApiVO;
|
||||||
|
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||||
import org.springblade.modules.mall.service.IMallProductService;
|
import org.springblade.modules.mall.service.IMallProductService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -24,6 +27,7 @@ import java.util.List;
|
|||||||
public class APPEcoController {
|
public class APPEcoController {
|
||||||
|
|
||||||
private final IMallProductService productService;
|
private final IMallProductService productService;
|
||||||
|
private final ICommonUserOrderService orderService;
|
||||||
/**
|
/**
|
||||||
* 生态产品-商品列表
|
* 生态产品-商品列表
|
||||||
*/
|
*/
|
||||||
@@ -42,4 +46,35 @@ public class APPEcoController {
|
|||||||
return R.data(productService.apiDetailVO(vo.getId()));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,9 +61,19 @@ public class APPTourController {
|
|||||||
return R.data(orderService.createTravelOrder(request));
|
return R.data(orderService.createTravelOrder(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认收货
|
||||||
|
*/
|
||||||
|
@PostMapping("/confirm")
|
||||||
|
@ApiOperationSupport(order = 5)
|
||||||
|
@Operation(summary = "确认收货", description = "传入ConfirmOrderRequest")
|
||||||
|
public R confirm(@Valid @RequestBody ConfirmOrderRequest request) {
|
||||||
|
return R.status(orderService.confirmTravelOrder(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/order-detail")
|
@GetMapping("/order-detail")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "旅行团订单详情")
|
@Operation(summary = "旅行团订单详情")
|
||||||
public R<CommonTravelOrderDetailApiVO> orderDetail(Long id) {
|
public R<CommonTravelOrderDetailApiVO> orderDetail(Long id) {
|
||||||
return R.data(orderService.travelOrderDetail(id));
|
return R.data(orderService.travelOrderDetail(id));
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import org.springblade.core.mp.support.Condition;
|
|||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
import org.springblade.modules.api.request.*;
|
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.response.PaymentResponse;
|
||||||
|
import org.springblade.modules.api.service.IPaymentService;
|
||||||
import org.springblade.modules.api.vo.*;
|
import org.springblade.modules.api.vo.*;
|
||||||
import org.springblade.modules.common.service.*;
|
import org.springblade.modules.common.service.*;
|
||||||
import org.springblade.modules.system.service.IUserService;
|
import org.springblade.modules.system.service.IUserService;
|
||||||
@@ -42,6 +42,8 @@ public class APPUserController {
|
|||||||
|
|
||||||
private final ICommonLotteryPrizeService lotteryPrizeService;
|
private final ICommonLotteryPrizeService lotteryPrizeService;
|
||||||
|
|
||||||
|
private final IPaymentService paymentService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否修改过密码
|
* 是否修改过密码
|
||||||
@@ -74,13 +76,23 @@ public class APPUserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付
|
* 支付宝支付
|
||||||
*/
|
*/
|
||||||
@PostMapping("/pay")
|
@PostMapping("/ali-pay")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 5)
|
||||||
@Operation(summary = "支付", description = "传入PaymentRequest")
|
@Operation(summary = "支付", description = "传入PaymentRequest")
|
||||||
public R<PaymentResponse> pay(@Valid @RequestBody PaymentRequest request) {
|
public R<PaymentResponse> aliPay(@Valid @RequestBody PaymentRequest request) {
|
||||||
return R.data(orderService.pay(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")
|
@GetMapping("/order-page")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 7)
|
||||||
@Operation(summary = "用户订单分页列表", description = "传入userAddress")
|
@Operation(summary = "用户订单分页列表", description = "传入userAddress")
|
||||||
public R<IPage<CommonUserOrderApiVO>> orderList(CommonUserOrderApiVO userOrder, Query query) {
|
public R<IPage<CommonUserOrderApiVO>> orderList(CommonUserOrderApiVO userOrder, Query query) {
|
||||||
IPage<CommonUserOrderApiVO> pages = orderService.selectOrderApiPage(Condition.getPage(query), userOrder);
|
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";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,4 +15,9 @@ public class PaymentResponse implements Serializable {
|
|||||||
|
|
||||||
private String params;
|
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;
|
package org.springblade.modules.api.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -25,4 +28,13 @@ public class CommonUserOrderApiVO implements Serializable {
|
|||||||
|
|
||||||
private BigDecimal actualAmount;
|
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)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -104,6 +104,14 @@ public class CommonUserOrderController extends BladeController {
|
|||||||
return R.data(pages);
|
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")
|
@GetMapping("/tour-order-page")
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 3)
|
||||||
@Operation(summary = "分页", description = "传入order")
|
@Operation(summary = "分页", description = "传入order")
|
||||||
@@ -188,7 +196,18 @@ public class CommonUserOrderController extends BladeController {
|
|||||||
@RequestParam(required = false) String account ,
|
@RequestParam(required = false) String account ,
|
||||||
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||||
List<CommonUserOrderExcel> excelList = commonUserManager.exportUserMallOrderToExcel(orderStatus , account ,searchDateRange);
|
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(required = false) String account ,
|
||||||
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
@RequestParam List<String> searchDateRange , HttpServletResponse response) {
|
||||||
List<CommonUserOrderExcel> excelList = commonUserManager.exportUserTourOrderToExcel(orderStatus , account ,searchDateRange);
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class MerchantFlagshipStoreController extends BladeController {
|
|||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@Operation(summary = "详情", description = "传入merchantFlagshipStore")
|
@Operation(summary = "详情", description = "传入merchantFlagshipStore")
|
||||||
public R<MerchantFlagshipStoreVO> detail(MerchantFlagshipStoreEntity 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));
|
return R.data(MerchantFlagshipStoreWrapper.build().entityVO(detail));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,4 +122,6 @@ public class TourOrderDetailController extends BladeController {
|
|||||||
return R.status(tourOrderDetailService.fillContractUrl(order.getId() , order.getContractUrl()));
|
return R.status(tourOrderDetailService.fillContractUrl(order.getId() , order.getContractUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.springblade.modules.common.event;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springblade.modules.common.eums.PaymentType;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -12,6 +13,7 @@ public class PaymentCallbackEvent implements Serializable {
|
|||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
private Date payTime;
|
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.PaymentCallbackEvent;
|
||||||
import org.springblade.modules.common.event.PaymentSuccessEvent;
|
import org.springblade.modules.common.event.PaymentSuccessEvent;
|
||||||
import org.springblade.modules.common.event.StatsCommissionAccountEvent;
|
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.pojo.entity.CommonUserOrderEntity;
|
||||||
import org.springblade.modules.common.service.ICommonPayOrderService;
|
|
||||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
@@ -23,7 +21,6 @@ import org.springframework.stereotype.Component;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PaymentListener {
|
public class PaymentListener {
|
||||||
|
|
||||||
private final ICommonPayOrderService commonPayOrderService;
|
|
||||||
private final ICommonUserOrderService commonUserOrderService;
|
private final ICommonUserOrderService commonUserOrderService;
|
||||||
private final ApplicationEventPublisher publisher;
|
private final ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
@@ -32,43 +29,27 @@ public class PaymentListener {
|
|||||||
public void callbackSuccessPayment(PaymentCallbackEvent event) {
|
public void callbackSuccessPayment(PaymentCallbackEvent event) {
|
||||||
log.info("支付回调监听 : {}" , event);
|
log.info("支付回调监听 : {}" , event);
|
||||||
|
|
||||||
CommonPayOrderEntity payOrder = commonPayOrderService.getById(event.getId());
|
|
||||||
if (payOrder == null){
|
CommonUserOrderEntity userOrder = commonUserOrderService.getById(event.getId());
|
||||||
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());
|
|
||||||
if (userOrder == null){
|
if (userOrder == null){
|
||||||
log.error("支付回调监听 : 订单不存在 , 订单id : {}" , payOrder.getOrderId());
|
log.error("支付回调监听 : 订单不存在 , 订单id : {}" , userOrder.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (userOrder.getOrderStatus() == 1){
|
if (userOrder.getOrderStatus() == 1){
|
||||||
log.error("支付回调监听 : 订单已支付 , 订单id : {}" , payOrder.getOrderId());
|
log.error("支付回调监听 : 订单已支付 , 订单id : {}" , userOrder.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
payOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
|
||||||
payOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
|
||||||
|
|
||||||
userOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
userOrder.setOrderStatus(OrderStatus.PAID.getCode());
|
||||||
userOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
userOrder.setPaymentStatus(PaymentStatus.PAID.getCode());
|
||||||
userOrder.setPaymentType(payOrder.getPaymentType());
|
|
||||||
userOrder.setPaymentTime(event.getPayTime());
|
userOrder.setPaymentTime(event.getPayTime());
|
||||||
if (!commonPayOrderService.updateById(payOrder) || !commonUserOrderService.updateById(userOrder)){
|
if ( !commonUserOrderService.updateById(userOrder)){
|
||||||
log.error("支付回调监听 : 订单支付失败 , 订单id : {}" , payOrder.getOrderId());
|
log.error("支付回调监听 : 订单支付失败 , 订单id : {}" , userOrder.getId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("支付回调监听 : 订单支付成功 , 订单id : {}" , payOrder.getOrderId());
|
log.info("支付回调监听 : 订单支付成功 , 订单id : {}" , userOrder.getId());
|
||||||
publisher.publishEvent(new StatsCommissionAccountEvent().setId(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
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
|
||||||
public class StatsCommissionAccountListener {
|
public class StatsCommissionAccountListener {
|
||||||
|
|
||||||
private final ICommonUserOrderService userOrderService;
|
private final ICommonUserOrderService userOrderService;
|
||||||
@@ -85,7 +84,7 @@ public class StatsCommissionAccountListener {
|
|||||||
String orderType = userOrder.getOrderType();
|
String orderType = userOrder.getOrderType();
|
||||||
Long orderId = userOrder.getId();
|
Long orderId = userOrder.getId();
|
||||||
String orderJson = JSONObject.toJSONString(userOrder);
|
String orderJson = JSONObject.toJSONString(userOrder);
|
||||||
Date statisticalDate = DateUtil.getYesterday();
|
Date statisticalDate = DateUtil.getToday();
|
||||||
|
|
||||||
// --- 1. 广告补贴 (5%) ---
|
// --- 1. 广告补贴 (5%) ---
|
||||||
BigDecimal advertisingAmount = totalActualAmount.multiply(BigDecimal.valueOf(0.05));
|
BigDecimal advertisingAmount = totalActualAmount.multiply(BigDecimal.valueOf(0.05));
|
||||||
|
|||||||
@@ -149,6 +149,59 @@ public class CommonUserManager {
|
|||||||
return excelList;
|
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) {
|
public List<CommonUserOrderExcel> exportUserTourOrderToExcel(Integer orderStatus, String account, List<String> searchDateRange) {
|
||||||
Date startDate = null;
|
Date startDate = null;
|
||||||
Date endDate = 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>
|
|
||||||
@@ -1,45 +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.dto;
|
|
||||||
|
|
||||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统内部订单关联支付记录 数据传输对象实体类
|
|
||||||
*
|
|
||||||
* @author BladeX
|
|
||||||
* @since 2026-03-24
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class CommonPayOrderDTO extends CommonPayOrderEntity {
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -43,10 +43,11 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "地址id")
|
@Schema(description = "地址id")
|
||||||
private Long regionsId;
|
private Long regionsId;
|
||||||
|
private String regionName;
|
||||||
/**
|
/**
|
||||||
* 完整详细地址文本
|
* 详细地址
|
||||||
*/
|
*/
|
||||||
@Schema(description = "完整详细地址文本")
|
@Schema(description = "详细地址")
|
||||||
private String fullAddress;
|
private String fullAddress;
|
||||||
/**
|
/**
|
||||||
* 地理坐标 POINT(经度,纬度),用于地图定位和距离计算
|
* 地理坐标 POINT(经度,纬度),用于地图定位和距离计算
|
||||||
@@ -87,6 +88,10 @@ public class MerchantFlagshipStoreEntity extends BaseEntity {
|
|||||||
@Schema(description = "商家详细介绍")
|
@Schema(description = "商家详细介绍")
|
||||||
private String storeDescription;
|
private String storeDescription;
|
||||||
|
|
||||||
|
private Long provinceId;
|
||||||
|
|
||||||
|
private Long cityId;
|
||||||
|
|
||||||
|
|
||||||
public void setLocation(double longitude, double latitude) {
|
public void setLocation(double longitude, double latitude) {
|
||||||
this.location = new org.locationtech.jts.geom.GeometryFactory()
|
this.location = new org.locationtech.jts.geom.GeometryFactory()
|
||||||
|
|||||||
@@ -131,5 +131,10 @@ public class TourProductEntity extends BaseEntity {
|
|||||||
@Schema(description = "评分,范围0.00~5.00")
|
@Schema(description = "评分,范围0.00~5.00")
|
||||||
private BigDecimal rating;
|
private BigDecimal rating;
|
||||||
|
|
||||||
|
private Long provinceId;
|
||||||
|
|
||||||
|
private Long cityId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +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.vo;
|
|
||||||
|
|
||||||
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统内部订单关联支付记录 视图实体类
|
|
||||||
*
|
|
||||||
* @author BladeX
|
|
||||||
* @since 2026-03-24
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
public class CommonPayOrderVO extends CommonPayOrderEntity {
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,6 @@ import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
|
|||||||
public class MerchantFlagshipStoreVO extends MerchantFlagshipStoreEntity {
|
public class MerchantFlagshipStoreVO extends MerchantFlagshipStoreEntity {
|
||||||
|
|
||||||
|
|
||||||
private Long area;
|
|
||||||
private String addressDetail;
|
private String addressDetail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,4 @@ public class TourProductVO extends TourProductEntity {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
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);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
package org.springblade.modules.common.service;
|
package org.springblade.modules.common.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
||||||
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
||||||
import org.springblade.modules.api.request.CreateTravelOrderRequest;
|
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> selectOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order);
|
||||||
|
|
||||||
|
IPage<CommonUserOrderVO> selectEcoOrderPage(IPage<CommonUserOrderVO> page, CommonUserOrderVO order);
|
||||||
|
|
||||||
IPage<CommonUserTourOrderVO> selectTourOrderPage(IPage<CommonUserTourOrderVO> page, CommonUserTourOrderVO order);
|
IPage<CommonUserTourOrderVO> selectTourOrderPage(IPage<CommonUserTourOrderVO> page, CommonUserTourOrderVO order);
|
||||||
|
|
||||||
List<CommonUserOrderVO> exportUserMallOrderToExcel(Integer orderStatus , String account ,Date startDate , Date endDate);
|
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);
|
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);
|
CreateOrderResponse createTravelOrder(CreateTravelOrderRequest request);
|
||||||
|
|
||||||
PaymentResponse pay(PaymentRequest request);
|
|
||||||
|
|
||||||
IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder);
|
IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder);
|
||||||
|
|
||||||
@@ -92,5 +95,12 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
|
|||||||
boolean confirmMallOrder(ConfirmOrderRequest request);
|
boolean confirmMallOrder(ConfirmOrderRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
CreateOrderResponse createEcoOrder(@Valid CreateMallOrderRequest request);
|
||||||
|
|
||||||
|
boolean confirmEcoOrder(@Valid ConfirmOrderRequest request);
|
||||||
|
|
||||||
|
boolean confirmTravelOrder(@Valid ConfirmOrderRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
boolean confirmItinerary(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,6 @@ public interface IMerchantFlagshipStoreService extends BaseService<MerchantFlags
|
|||||||
IPage<CommonMerchantStoreApiVO> merchantStoreList(MerchantStoreRequest request , IPage<CommonMerchantStoreApiVO> page);
|
IPage<CommonMerchantStoreApiVO> merchantStoreList(MerchantStoreRequest request , IPage<CommonMerchantStoreApiVO> page);
|
||||||
|
|
||||||
CommonMerchantStoreDetailApiVO merchantStoreDetail(@NotNull(message = "无效店铺") Long id);
|
CommonMerchantStoreDetailApiVO merchantStoreDetail(@NotNull(message = "无效店铺") Long id);
|
||||||
|
|
||||||
|
MerchantFlagshipStoreEntity getByDetail(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ public interface ITourOrderDetailService extends BaseService<TourOrderDetailEnti
|
|||||||
boolean confirmGuideInfo(Long id, String guideName, String guidePhone);
|
boolean confirmGuideInfo(Long id, String guideName, String guidePhone);
|
||||||
|
|
||||||
boolean fillContractUrl(Long id, String contractUrl);
|
boolean fillContractUrl(Long id, String contractUrl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -37,9 +37,7 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|||||||
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
import org.springblade.modules.api.request.ConfirmOrderRequest;
|
||||||
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
import org.springblade.modules.api.request.CreateMallOrderRequest;
|
||||||
import org.springblade.modules.api.request.CreateTravelOrderRequest;
|
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.CreateOrderResponse;
|
||||||
import org.springblade.modules.api.response.PaymentResponse;
|
|
||||||
import org.springblade.modules.api.vo.CommonTravelOrderDetailApiVO;
|
import org.springblade.modules.api.vo.CommonTravelOrderDetailApiVO;
|
||||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||||
import org.springblade.modules.api.vo.CommonUserOrderDetailApiVO;
|
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.pojo.entity.MarketInfoEntity;
|
||||||
import org.springblade.modules.market.service.IMarketInfoService;
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
import org.springblade.modules.market.service.IMarketUserCommissionService;
|
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.context.ApplicationEventPublisher;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
@@ -74,6 +69,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户订单 服务实现类
|
* 用户订单 服务实现类
|
||||||
@@ -94,10 +90,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
private final ITourOrderDetailService tourOrderDetailService;
|
private final ITourOrderDetailService tourOrderDetailService;
|
||||||
|
|
||||||
private final IMarketUserCommissionService commissionService;
|
private final IMarketUserCommissionService commissionService;
|
||||||
|
|
||||||
private final IMarketInfoService marketInfoService;
|
private final IMarketInfoService marketInfoService;
|
||||||
|
|
||||||
private final PaymentFacade paymentFacade;
|
|
||||||
private final ICommonOrderConfirmLogService orderConfirmLogService;
|
private final ICommonOrderConfirmLogService orderConfirmLogService;
|
||||||
|
|
||||||
|
|
||||||
@@ -117,6 +110,21 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
return page.setRecords(baseMapper.selectOrderPage(page, order));
|
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
|
@Override
|
||||||
public IPage<CommonUserTourOrderVO> selectTourOrderPage(IPage<CommonUserTourOrderVO> page, CommonUserTourOrderVO order) {
|
public IPage<CommonUserTourOrderVO> selectTourOrderPage(IPage<CommonUserTourOrderVO> page, CommonUserTourOrderVO order) {
|
||||||
if (order.getSearchDateRange() != null) {
|
if (order.getSearchDateRange() != null) {
|
||||||
@@ -143,6 +151,16 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
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
|
@Override
|
||||||
public List<CommonUserOrderVO> exportUserTourOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate) {
|
public List<CommonUserOrderVO> exportUserTourOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate) {
|
||||||
Long countItem = baseMapper.countOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.TRAVEL_GROUP.getCode());
|
Long countItem = baseMapper.countOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.TRAVEL_GROUP.getCode());
|
||||||
@@ -167,9 +185,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
public CreateOrderResponse createMallOrder(CreateMallOrderRequest request) {
|
public CreateOrderResponse createMallOrder(CreateMallOrderRequest request) {
|
||||||
BigDecimal discount = BigDecimal.ZERO;
|
BigDecimal discount = BigDecimal.ZERO;
|
||||||
String orderType = request.getOrderType().toUpperCase();
|
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("无效业务订单");
|
throw new ServiceException("无效业务订单");
|
||||||
}
|
}
|
||||||
@@ -183,6 +199,9 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
|
|
||||||
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
|
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
|
||||||
Assert.notNull(product, "无效商品");
|
Assert.notNull(product, "无效商品");
|
||||||
|
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);
|
CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product);
|
||||||
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
|
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
|
||||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||||
@@ -191,7 +210,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
order.setTotalAmount(totalAmount);
|
order.setTotalAmount(totalAmount);
|
||||||
order.setActualAmount(actualAmount);
|
order.setActualAmount(actualAmount);
|
||||||
order.setOrderType(orderType);
|
order.setOrderType(orderType);
|
||||||
order.setPaymentType(request.getIsOfflinePayment() ? request.getPaymentType() : null);
|
order.setPaymentType(request.getPaymentType());
|
||||||
order.setCreateTime(new Date());
|
order.setCreateTime(new Date());
|
||||||
this.save(order);
|
this.save(order);
|
||||||
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
||||||
@@ -218,6 +237,10 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
throw new ServiceException("请选择正确的支付方式");
|
throw new ServiceException("请选择正确的支付方式");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!BusinessModule.fromCodeIgnoreCaseOrNull(request.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)) {
|
||||||
|
throw new ServiceException("无效业务订单");
|
||||||
|
}
|
||||||
|
|
||||||
List<Long> travelerIds = request.getTourInfoIds();
|
List<Long> travelerIds = request.getTourInfoIds();
|
||||||
if (CollectionUtils.isEmpty(travelerIds)) {
|
if (CollectionUtils.isEmpty(travelerIds)) {
|
||||||
throw new ServiceException("请至少选择一名出行人");
|
throw new ServiceException("请至少选择一名出行人");
|
||||||
@@ -237,8 +260,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int selectedCount = travelerIds.size();
|
int selectedCount = travelerIds.size();
|
||||||
// 使用 Optional 处理数据库中可能为 NULL 的最大/最小人数限制
|
// 使用 Optional 处理数据库中可能为 NULL 的最大/最小人数限制
|
||||||
int minPeople = Optional.ofNullable(tourProduct.getMinPeople()).orElse(1);
|
int minPeople = Optional.ofNullable(tourProduct.getMinPeople()).orElse(1);
|
||||||
@@ -287,7 +308,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||||
if (actualAmount.compareTo(BigDecimal.ZERO) < 0) {
|
if (actualAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
actualAmount = BigDecimal.ZERO; // 防止实付金额为负
|
actualAmount = BigDecimal.ZERO; // 防止实付金额为负
|
||||||
@@ -328,36 +348,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
|
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
|
@Override
|
||||||
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {
|
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {
|
||||||
@@ -365,7 +355,8 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
entity.setOrderStatus(userOrder.getOrderStatus());
|
entity.setOrderStatus(userOrder.getOrderStatus());
|
||||||
entity.setUserId(AuthUtil.getUserId());
|
entity.setUserId(AuthUtil.getUserId());
|
||||||
List<CommonUserOrderEntity> commonUserOrderEntityList = baseMapper.selectOrderEntityPage(page, entity);
|
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
|
@Override
|
||||||
@@ -480,8 +471,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
commissionService.earnedCommissionByUserOrder(order, marketInfo.getPid());
|
commissionService.earnedCommissionByUserOrder(order, marketInfo.getPid());
|
||||||
}
|
}
|
||||||
|
|
||||||
orderConfirmLogService.save(
|
CommonOrderConfirmLogEntity commonOrderConfirmLog = new CommonOrderConfirmLogEntity()
|
||||||
new CommonOrderConfirmLogEntity()
|
|
||||||
.setOrderId(order.getId())
|
.setOrderId(order.getId())
|
||||||
.setUserId(order.getUserId())
|
.setUserId(order.getUserId())
|
||||||
.setItemName(order.getItemName())
|
.setItemName(order.getItemName())
|
||||||
@@ -490,12 +480,111 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
|||||||
.setActualAmount(order.getActualAmount())
|
.setActualAmount(order.getActualAmount())
|
||||||
.setPaymentType(order.getPaymentType())
|
.setPaymentType(order.getPaymentType())
|
||||||
.setIsServiceDistributed(0)
|
.setIsServiceDistributed(0)
|
||||||
.setIsAgencyDistributed(0)
|
.setIsAgencyDistributed(0);
|
||||||
);
|
commonOrderConfirmLog.setCreateTime(new Date());
|
||||||
|
orderConfirmLogService.save(commonOrderConfirmLog);
|
||||||
}
|
}
|
||||||
return true;
|
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, "无效商品");
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void validateCertificates(CommonTourInfoEntity traveler, TourProductEntity product) {
|
private void validateCertificates(CommonTourInfoEntity traveler, TourProductEntity product) {
|
||||||
String name = Optional.ofNullable(traveler.getUserName()).orElse("未知用户");
|
String name = Optional.ofNullable(traveler.getUserName()).orElse("未知用户");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.springblade.modules.common.service.impl;
|
package org.springblade.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -12,7 +13,6 @@ import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
|
|||||||
import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
|
import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.MerchantFlagshipStoreVO;
|
import org.springblade.modules.common.pojo.vo.MerchantFlagshipStoreVO;
|
||||||
import org.springblade.modules.common.mapper.MerchantFlagshipStoreMapper;
|
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.ICommonRegionsInfoService;
|
||||||
import org.springblade.modules.common.service.IMerchantFlagshipStoreService;
|
import org.springblade.modules.common.service.IMerchantFlagshipStoreService;
|
||||||
import org.springblade.modules.common.service.TianDiTuMapService;
|
import org.springblade.modules.common.service.TianDiTuMapService;
|
||||||
@@ -33,7 +33,6 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFlagshipStoreMapper, MerchantFlagshipStoreEntity> implements IMerchantFlagshipStoreService {
|
public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFlagshipStoreMapper, MerchantFlagshipStoreEntity> implements IMerchantFlagshipStoreService {
|
||||||
|
|
||||||
private final AMapService mapService;
|
|
||||||
private final ICommonRegionsInfoService commonRegionsInfoService;
|
private final ICommonRegionsInfoService commonRegionsInfoService;
|
||||||
private final TianDiTuMapService tianDiTuMapService;
|
private final TianDiTuMapService tianDiTuMapService;
|
||||||
|
|
||||||
@@ -44,15 +43,14 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveStore(MerchantFlagshipStoreVO storeVO) {
|
public boolean saveStore(MerchantFlagshipStoreVO storeVO) {
|
||||||
if (storeVO.getArea() == null){
|
if (storeVO.getRegionsId() == null){
|
||||||
throw new ServiceException("请选择地址");
|
throw new ServiceException("请选择地址");
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getArea());
|
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getRegionsId());
|
||||||
if (regionsInfo == null){
|
if (regionsInfo == null){
|
||||||
throw new ServiceException("请选择正确的地址");
|
throw new ServiceException("请选择正确的地址");
|
||||||
}
|
}
|
||||||
// LocationDTO locationDTO = mapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
|
||||||
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +58,10 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
|||||||
|
|
||||||
store.setLocation(locationDTO.getLongitude() , locationDTO.getLatitude());
|
store.setLocation(locationDTO.getLongitude() , locationDTO.getLatitude());
|
||||||
store.setRegionsId(regionsInfo.getId());
|
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.setStoreName(storeVO.getStoreName());
|
||||||
store.setContactPhone(storeVO.getContactPhone());
|
store.setContactPhone(storeVO.getContactPhone());
|
||||||
@@ -77,23 +78,25 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateStore(MerchantFlagshipStoreVO storeVO) {
|
public boolean updateStore(MerchantFlagshipStoreVO storeVO) {
|
||||||
if (storeVO.getArea() == null) {
|
if (storeVO.getRegionsId() == null) {
|
||||||
throw new ServiceException("请选择地址");
|
throw new ServiceException("请选择地址");
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getArea());
|
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(storeVO.getRegionsId());
|
||||||
if (regionsInfo == null) {
|
if (regionsInfo == null) {
|
||||||
throw new ServiceException("请选择正确的地址");
|
throw new ServiceException("请选择正确的地址");
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocationDTO locationDTO = mapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
|
||||||
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
|
||||||
|
|
||||||
MerchantFlagshipStoreEntity store = new MerchantFlagshipStoreEntity();
|
MerchantFlagshipStoreEntity store = new MerchantFlagshipStoreEntity();
|
||||||
|
|
||||||
store.setLocation(locationDTO.getLongitude(), locationDTO.getLatitude());
|
store.setLocation(locationDTO.getLongitude(), locationDTO.getLatitude());
|
||||||
store.setRegionsId(regionsInfo.getId());
|
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.setId(storeVO.getId());
|
||||||
store.setStoreName(storeVO.getStoreName());
|
store.setStoreName(storeVO.getStoreName());
|
||||||
@@ -133,5 +136,28 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
|
|||||||
return this.baseMapper.merchantStoreDetail(id);
|
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)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
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.pojo.dto.LocationDTO;
|
||||||
import org.springblade.modules.common.response.TianDiTuGeoResponse;
|
import org.springblade.modules.common.response.TianDiTuGeoResponse;
|
||||||
import org.springblade.modules.common.service.TianDiTuMapService;
|
import org.springblade.modules.common.service.TianDiTuMapService;
|
||||||
@@ -20,7 +19,8 @@ import java.util.HashMap;
|
|||||||
public class TianDiTuMapServiceImpl implements TianDiTuMapService {
|
public class TianDiTuMapServiceImpl implements TianDiTuMapService {
|
||||||
|
|
||||||
|
|
||||||
private final TianDiTuConfiguration configuration;
|
private final String key = "481fce07effc76be3bcf1dd7a5869f84";
|
||||||
|
|
||||||
|
|
||||||
private static String ADDRESS_TEMPLATE = """
|
private static String ADDRESS_TEMPLATE = """
|
||||||
{"keyWord":"%s"}
|
{"keyWord":"%s"}
|
||||||
@@ -31,9 +31,9 @@ public class TianDiTuMapServiceImpl implements TianDiTuMapService {
|
|||||||
|
|
||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("ds", ADDRESS_TEMPLATE.formatted(address));
|
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);
|
TianDiTuGeoResponse response = JSONObject.parseObject(result, TianDiTuGeoResponse.class);
|
||||||
if (response.getStatus().equals("0")) {
|
if (response.getStatus().equals("0")) {
|
||||||
TianDiTuGeoResponse.LocationInfo locationInfo = response.getLocation();
|
TianDiTuGeoResponse.LocationInfo locationInfo = response.getLocation();
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
|||||||
throw new ServiceException("评分在0.1在5.0之间");
|
throw new ServiceException("评分在0.1在5.0之间");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tourProduct.getCity() == null){
|
if (tourProduct.getCityId() == null){
|
||||||
throw new ServiceException("请选择地址");
|
throw new ServiceException("请选择地址");
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCity());
|
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCityId());
|
||||||
if (regionsInfo == null){
|
if (regionsInfo == null){
|
||||||
throw new ServiceException("请选择正确的地址");
|
throw new ServiceException("请选择正确的地址");
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,9 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
|||||||
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
|
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
|
||||||
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
|
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
|
||||||
tourProductEntity.setDetailImages(tourProduct.getDetailImages());
|
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.setDurationDays(tourProduct.getDurationDays());
|
||||||
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
|
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
|
||||||
tourProductEntity.setBasePrice(tourProduct.getBasePrice());
|
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("请选择地址");
|
throw new ServiceException("请选择地址");
|
||||||
}
|
}
|
||||||
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCity());
|
CommonRegionsInfoEntity regionsInfo = commonRegionsInfoService.getById(tourProduct.getCityId());
|
||||||
if (regionsInfo == null){
|
if (regionsInfo == null){
|
||||||
throw new ServiceException("请选择正确的地址");
|
throw new ServiceException("请选择正确的地址");
|
||||||
}
|
}
|
||||||
@@ -110,7 +112,9 @@ public class TourProductServiceImpl extends BaseServiceImpl<TourProductMapper, T
|
|||||||
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
|
tourProductEntity.setThumbnailUrl(tourProduct.getThumbnailUrl());
|
||||||
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
|
tourProductEntity.setMainImageUrl(tourProduct.getMainImageUrl());
|
||||||
tourProductEntity.setDetailImages(tourProduct.getDetailImages());
|
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.setDurationDays(tourProduct.getDurationDays());
|
||||||
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
|
tourProductEntity.setDurationNights(tourProduct.getDurationNights());
|
||||||
tourProductEntity.setBasePrice(tourProduct.getBasePrice());
|
tourProductEntity.setBasePrice(tourProduct.getBasePrice());
|
||||||
|
|||||||
@@ -1,59 +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.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 java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统内部订单关联支付记录 包装类,返回视图层所需的字段
|
|
||||||
*
|
|
||||||
* @author BladeX
|
|
||||||
* @since 2026-03-24
|
|
||||||
*/
|
|
||||||
public class CommonPayOrderWrapper extends BaseEntityWrapper<CommonPayOrderEntity, CommonPayOrderVO> {
|
|
||||||
|
|
||||||
public static CommonPayOrderWrapper build() {
|
|
||||||
return new CommonPayOrderWrapper();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonPayOrderVO entityVO(CommonPayOrderEntity commonPayOrder) {
|
|
||||||
CommonPayOrderVO commonPayOrderVO = Objects.requireNonNull(BeanUtil.copyProperties(commonPayOrder, CommonPayOrderVO.class));
|
|
||||||
|
|
||||||
//User createUser = UserCache.getUser(commonPayOrder.getCreateUser());
|
|
||||||
//User updateUser = UserCache.getUser(commonPayOrder.getUpdateUser());
|
|
||||||
//commonPayOrderVO.setCreateUserName(createUser.getName());
|
|
||||||
//commonPayOrderVO.setUpdateUserName(updateUser.getName());
|
|
||||||
|
|
||||||
return commonPayOrderVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -12,5 +12,8 @@ public interface BladeMarketConstant {
|
|||||||
// 用户兑换福利包-上级福利积分奖励配置
|
// 用户兑换福利包-上级福利积分奖励配置
|
||||||
String BENEFIT_PACK_SUPERIOR_REWARD_CONFIG = "market.benefit.pack.superior.reward.config";
|
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
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/cash-performance//marketCashPerformance")
|
@RequestMapping("/market/cash-performance")
|
||||||
@Tag(name = "现金业绩", description = "现金业绩接口")
|
@Tag(name = "现金业绩", description = "现金业绩接口")
|
||||||
public class MarketCashPerformanceController extends BladeController {
|
public class MarketCashPerformanceController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/cash-performance-log//marketCashPerformanceLog")
|
@RequestMapping("/market/cash-performance-log")
|
||||||
@Tag(name = "现金业绩日志", description = "现金业绩日志接口")
|
@Tag(name = "现金业绩日志", description = "现金业绩日志接口")
|
||||||
public class MarketCashPerformanceLogController extends BladeController {
|
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.api.R;
|
||||||
import org.springblade.core.tool.utils.Func;
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.modules.market.manager.MarketUserManager;
|
import org.springblade.modules.market.manager.MarketUserManager;
|
||||||
import org.springblade.modules.market.pojo.vo.UserAllPointInfoVO;
|
import org.springblade.modules.market.pojo.vo.*;
|
||||||
import org.springblade.modules.market.pojo.vo.UserBenefitPackCountVO;
|
|
||||||
import org.springblade.modules.market.pojo.vo.UserMallSpendVO;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
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.wrapper.MarketInfoWrapper;
|
||||||
import org.springblade.modules.market.service.IMarketInfoService;
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.boot.ctrl.BladeController;
|
||||||
@@ -82,8 +79,8 @@ public class MarketInfoController extends BladeController {
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@Operation(summary = "分页", description = "传入marketInfo")
|
@Operation(summary = "分页", description = "传入marketInfo")
|
||||||
public R<IPage<MarketInfoVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> marketInfo, Query query) {
|
public R<IPage<MarketInfoVO>> list(MarketInfoEntity marketInfo, Query query) {
|
||||||
IPage<MarketInfoEntity> pages = marketInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(marketInfo, MarketInfoEntity.class));
|
IPage<MarketInfoEntity> pages = marketInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(marketInfo).orderByAsc("id"));
|
||||||
return R.data(MarketInfoWrapper.build().pageVO(pages));
|
return R.data(MarketInfoWrapper.build().pageVO(pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +166,13 @@ public class MarketInfoController extends BladeController {
|
|||||||
return R.data(marketUserManager.getUserMallSpend(userId));
|
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
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/upgrade-cash-log//marketUpgradeCashLog")
|
@RequestMapping("/market/upgrade-cash-log")
|
||||||
@Tag(name = "用户现金升级日志", description = "用户现金升级日志接口")
|
@Tag(name = "用户现金升级日志", description = "用户现金升级日志接口")
|
||||||
public class MarketUpgradeCashLogController extends BladeController {
|
public class MarketUpgradeCashLogController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/upgrade-config//marketUpgradeConfig")
|
@RequestMapping("/market/upgrade-config")
|
||||||
@Tag(name = "用户等级升级配置", description = "用户等级升级配置接口")
|
@Tag(name = "用户等级升级配置", description = "用户等级升级配置接口")
|
||||||
public class MarketUpgradeConfigController extends BladeController {
|
public class MarketUpgradeConfigController extends BladeController {
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ public class MarketUpgradeConfigController extends BladeController {
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@Operation(summary = "分页", description = "传入marketUpgradeConfig")
|
@Operation(summary = "分页", description = "传入marketUpgradeConfig")
|
||||||
public R<IPage<MarketUpgradeConfigVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> marketUpgradeConfig, Query query) {
|
public R<IPage<MarketUpgradeConfigVO>> list(MarketUpgradeConfigEntity marketUpgradeConfig, Query query) {
|
||||||
IPage<MarketUpgradeConfigEntity> pages = marketUpgradeConfigService.page(Condition.getPage(query), Condition.getQueryWrapper(marketUpgradeConfig, MarketUpgradeConfigEntity.class));
|
IPage<MarketUpgradeConfigEntity> pages = marketUpgradeConfigService.page(Condition.getPage(query), Condition.getQueryWrapper(marketUpgradeConfig).orderByAsc("id"));
|
||||||
return R.data(MarketUpgradeConfigWrapper.build().pageVO(pages));
|
return R.data(MarketUpgradeConfigWrapper.build().pageVO(pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/upgrade-welfare-log//marketUpgradeWelfareLog")
|
@RequestMapping("/market/upgrade-welfare-log")
|
||||||
@Tag(name = "用户福利包升级日志", description = "用户福利包升级日志接口")
|
@Tag(name = "用户福利包升级日志", description = "用户福利包升级日志接口")
|
||||||
public class MarketUpgradeWelfareLogController extends BladeController {
|
public class MarketUpgradeWelfareLogController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/welfare-performance//marketWelfarePerformance")
|
@RequestMapping("/market/welfare-performance/")
|
||||||
@Tag(name = "福利包业绩", description = "福利包业绩接口")
|
@Tag(name = "福利包业绩", description = "福利包业绩接口")
|
||||||
public class MarketWelfarePerformanceController extends BladeController {
|
public class MarketWelfarePerformanceController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("/market/welfare-performance-log//marketWelfarePerformanceLog")
|
@RequestMapping("/market/welfare-performance-log")
|
||||||
@Tag(name = "福利包业绩日志", description = "福利包业绩日志接口")
|
@Tag(name = "福利包业绩日志", description = "福利包业绩日志接口")
|
||||||
public class MarketWelfarePerformanceLogController extends BladeController {
|
public class MarketWelfarePerformanceLogController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ import org.springblade.modules.market.pojo.entity.*;
|
|||||||
import org.springblade.modules.market.pojo.vo.UserAllPointInfoVO;
|
import org.springblade.modules.market.pojo.vo.UserAllPointInfoVO;
|
||||||
import org.springblade.modules.market.pojo.vo.UserBenefitPackCountVO;
|
import org.springblade.modules.market.pojo.vo.UserBenefitPackCountVO;
|
||||||
import org.springblade.modules.market.pojo.vo.UserMallSpendVO;
|
import org.springblade.modules.market.pojo.vo.UserMallSpendVO;
|
||||||
|
import org.springblade.modules.market.pojo.vo.UserPerformanceVO;
|
||||||
import org.springblade.modules.market.service.*;
|
import org.springblade.modules.market.service.*;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
|
import org.springblade.modules.system.service.IParamService;
|
||||||
import org.springblade.modules.system.service.IUserService;
|
import org.springblade.modules.system.service.IUserService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -56,9 +58,13 @@ public class MarketUserManager {
|
|||||||
private final IMarketUserCommissionService commissionService;
|
private final IMarketUserCommissionService commissionService;
|
||||||
|
|
||||||
private final ICommonUserPointService commonUserPointService;
|
private final ICommonUserPointService commonUserPointService;
|
||||||
|
|
||||||
private final ICommonUserOrderService commonUserOrderService;
|
private final ICommonUserOrderService commonUserOrderService;
|
||||||
|
|
||||||
|
private final IMarketCashPerformanceService cashPerformanceService;
|
||||||
|
private final IMarketWelfarePerformanceService welfarePerformanceService;
|
||||||
|
|
||||||
|
private final IParamService paramService;
|
||||||
|
|
||||||
public List<MarketDirectInfoApiVO> findUserPackList() {
|
public List<MarketDirectInfoApiVO> findUserPackList() {
|
||||||
Long userId = AuthUtil.getUserId();
|
Long userId = AuthUtil.getUserId();
|
||||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||||
@@ -147,6 +153,11 @@ public class MarketUserManager {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = ServiceException.class)
|
@Transactional(rollbackFor = ServiceException.class)
|
||||||
public boolean acquireBenefitPackage(AcquireBenefitPackageRequest request) {
|
public boolean acquireBenefitPackage(AcquireBenefitPackageRequest request) {
|
||||||
|
|
||||||
|
if (!Boolean.parseBoolean(ParamCache.getValue(BladeMarketConstant.APP_BENEFIT_PACK_ALLOCATE_ENABLED))){
|
||||||
|
throw new ServiceException("系统结算中,请于结算完成之后再兑换。");
|
||||||
|
}
|
||||||
|
|
||||||
Long userId = AuthUtil.getUserId();
|
Long userId = AuthUtil.getUserId();
|
||||||
User user = userService.getById(userId);
|
User user = userService.getById(userId);
|
||||||
if(user == null){
|
if(user == null){
|
||||||
@@ -455,4 +466,19 @@ public class MarketUserManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UserPerformanceVO getUserPerformance(Long userId) {
|
||||||
|
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||||
|
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||||
|
MarketCashPerformanceEntity cashPerformance = cashPerformanceService.getById(userId);
|
||||||
|
MarketWelfarePerformanceEntity welfarePerformance = welfarePerformanceService.getById(userId);
|
||||||
|
UserPerformanceVO userPerformanceVO = new UserPerformanceVO();
|
||||||
|
if (cashPerformance != null){
|
||||||
|
userPerformanceVO.setUserCash(cashPerformance.getTotalAmount());
|
||||||
|
}
|
||||||
|
if (welfarePerformance != null){
|
||||||
|
userPerformanceVO.setBenefitWelfare(welfarePerformance.getTotalAmount());
|
||||||
|
}
|
||||||
|
return userPerformanceVO;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface MarketCashPerformanceLogMapper extends BaseMapper<MarketCashPer
|
|||||||
* @param marketCashPerformanceLog 查询参数
|
* @param marketCashPerformanceLog 查询参数
|
||||||
* @return List<MarketCashPerformanceLogVO>
|
* @return List<MarketCashPerformanceLogVO>
|
||||||
*/
|
*/
|
||||||
List<MarketCashPerformanceLogVO> selectMarketCashPerformanceLogPage(IPage page, MarketCashPerformanceLogVO marketCashPerformanceLog);
|
List<MarketCashPerformanceLogVO> selectMarketCashPerformanceLogPage(IPage page, MarketCashPerformanceLogVO performanceLog);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
<result column="id" property="id"/>
|
<result column="id" property="id"/>
|
||||||
<result column="user_id" property="userId"/>
|
<result column="user_id" property="userId"/>
|
||||||
<result column="stat_date" property="statDate"/>
|
<result column="stat_date" property="statDate"/>
|
||||||
<result column="last_amount" property="lastAmount"/>
|
|
||||||
<result column="current_amount" property="currentAmount"/>
|
|
||||||
<result column="source_id" property="sourceId"/>
|
<result column="source_id" property="sourceId"/>
|
||||||
<result column="source_detail" property="sourceDetail"/>
|
<result column="source_detail" property="sourceDetail"/>
|
||||||
<result column="remarks" property="remarks"/>
|
<result column="remarks" property="remarks"/>
|
||||||
@@ -23,7 +21,17 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="selectMarketCashPerformanceLogPage" resultMap="marketCashPerformanceLogResultMap">
|
<select id="selectMarketCashPerformanceLogPage" resultMap="marketCashPerformanceLogResultMap">
|
||||||
select * from market_cash_performance_log where is_deleted = 0
|
select
|
||||||
|
mcpl.*,
|
||||||
|
bu.account
|
||||||
|
from market_cash_performance_log mcpl
|
||||||
|
left join blade_user bu on bu.id = mcpl.user_id
|
||||||
|
where mcpl.is_deleted = 0
|
||||||
|
<if test="performanceLog.account != null">
|
||||||
|
and bu.account = #{performanceLog.account}
|
||||||
|
</if>
|
||||||
|
order by mcpl.id desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface MarketUpgradeCashLogMapper extends BaseMapper<MarketUpgradeCash
|
|||||||
* @param marketUpgradeCashLog 查询参数
|
* @param marketUpgradeCashLog 查询参数
|
||||||
* @return List<MarketUpgradeCashLogVO>
|
* @return List<MarketUpgradeCashLogVO>
|
||||||
*/
|
*/
|
||||||
List<MarketUpgradeCashLogVO> selectMarketUpgradeCashLogPage(IPage page, MarketUpgradeCashLogVO marketUpgradeCashLog);
|
List<MarketUpgradeCashLogVO> selectMarketUpgradeCashLogPage(IPage page, MarketUpgradeCashLogVO upgradeLog);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,17 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="selectMarketUpgradeCashLogPage" resultMap="marketUpgradeCashLogResultMap">
|
<select id="selectMarketUpgradeCashLogPage" resultMap="marketUpgradeCashLogResultMap">
|
||||||
select * from market_upgrade_cash_log where is_deleted = 0
|
select
|
||||||
|
mucl.*,
|
||||||
|
bu.account
|
||||||
|
from market_upgrade_cash_log mucl
|
||||||
|
left join blade_user bu on bu.id = mucl.user_id
|
||||||
|
where mucl.is_deleted = 0
|
||||||
|
<if test="upgradeLog.account != null">
|
||||||
|
and bu.account = #{upgradeLog.account}
|
||||||
|
</if>
|
||||||
|
order by mucl.id desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface MarketUpgradeWelfareLogMapper extends BaseMapper<MarketUpgradeW
|
|||||||
* @param marketUpgradeWelfareLog 查询参数
|
* @param marketUpgradeWelfareLog 查询参数
|
||||||
* @return List<MarketUpgradeWelfareLogVO>
|
* @return List<MarketUpgradeWelfareLogVO>
|
||||||
*/
|
*/
|
||||||
List<MarketUpgradeWelfareLogVO> selectMarketUpgradeWelfareLogPage(IPage page, MarketUpgradeWelfareLogVO marketUpgradeWelfareLog);
|
List<MarketUpgradeWelfareLogVO> selectMarketUpgradeWelfareLogPage(IPage page, MarketUpgradeWelfareLogVO upgradeLog);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,18 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="selectMarketUpgradeWelfareLogPage" resultMap="marketUpgradeWelfareLogResultMap">
|
<select id="selectMarketUpgradeWelfareLogPage" resultMap="marketUpgradeWelfareLogResultMap">
|
||||||
select * from market_upgrade_welfare_log where is_deleted = 0
|
|
||||||
|
select
|
||||||
|
muwl.*,
|
||||||
|
bu.account
|
||||||
|
from market_upgrade_welfare_log muwl
|
||||||
|
left join blade_user bu on bu.id = muwl.user_id
|
||||||
|
where muwl.is_deleted = 0
|
||||||
|
<if test="upgradeLog.account != null">
|
||||||
|
and bu.account = #{upgradeLog.account}
|
||||||
|
</if>
|
||||||
|
order by muwl.id desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface MarketWelfarePerformanceLogMapper extends BaseMapper<MarketWelf
|
|||||||
* @param marketWelfarePerformanceLog 查询参数
|
* @param marketWelfarePerformanceLog 查询参数
|
||||||
* @return List<MarketWelfarePerformanceLogVO>
|
* @return List<MarketWelfarePerformanceLogVO>
|
||||||
*/
|
*/
|
||||||
List<MarketWelfarePerformanceLogVO> selectMarketWelfarePerformanceLogPage(IPage page, MarketWelfarePerformanceLogVO marketWelfarePerformanceLog);
|
List<MarketWelfarePerformanceLogVO> selectMarketWelfarePerformanceLogPage(IPage page, MarketWelfarePerformanceLogVO performanceLog);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
<result column="id" property="id"/>
|
<result column="id" property="id"/>
|
||||||
<result column="user_id" property="userId"/>
|
<result column="user_id" property="userId"/>
|
||||||
<result column="stat_date" property="statDate"/>
|
<result column="stat_date" property="statDate"/>
|
||||||
<result column="last_amount" property="lastAmount"/>
|
|
||||||
<result column="current_amount" property="currentAmount"/>
|
|
||||||
<result column="source_id" property="sourceId"/>
|
<result column="source_id" property="sourceId"/>
|
||||||
<result column="source_detail" property="sourceDetail"/>
|
<result column="source_detail" property="sourceDetail"/>
|
||||||
<result column="remarks" property="remarks"/>
|
<result column="remarks" property="remarks"/>
|
||||||
@@ -23,7 +21,17 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="selectMarketWelfarePerformanceLogPage" resultMap="marketWelfarePerformanceLogResultMap">
|
<select id="selectMarketWelfarePerformanceLogPage" resultMap="marketWelfarePerformanceLogResultMap">
|
||||||
select * from market_welfare_performance_log where is_deleted = 0
|
select
|
||||||
|
mwpl.*,
|
||||||
|
bu.account
|
||||||
|
from market_welfare_performance_log mwpl
|
||||||
|
left join blade_user bu on bu.id = mwpl.user_id
|
||||||
|
where mwpl.is_deleted = 0
|
||||||
|
<if test="performanceLog.account != null">
|
||||||
|
and bu.account = #{performanceLog.account}
|
||||||
|
</if>
|
||||||
|
order by mwpl.id desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ import java.io.Serial;
|
|||||||
public class MarketCashPerformanceLogVO extends MarketCashPerformanceLogEntity {
|
public class MarketCashPerformanceLogVO extends MarketCashPerformanceLogEntity {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String account;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ public class MarketUpgradeCashLogVO extends MarketUpgradeCashLogEntity {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String account;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ import java.io.Serial;
|
|||||||
public class MarketUpgradeWelfareLogVO extends MarketUpgradeWelfareLogEntity {
|
public class MarketUpgradeWelfareLogVO extends MarketUpgradeWelfareLogEntity {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String account;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ import java.io.Serial;
|
|||||||
public class MarketWelfarePerformanceLogVO extends MarketWelfarePerformanceLogEntity {
|
public class MarketWelfarePerformanceLogVO extends MarketWelfarePerformanceLogEntity {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String account;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.springblade.modules.market.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class UserPerformanceVO implements Serializable {
|
||||||
|
|
||||||
|
private BigDecimal userCash = BigDecimal.ZERO;
|
||||||
|
private BigDecimal benefitWelfare = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.springblade.plugin.pay.api;
|
|
||||||
|
|
||||||
import org.springblade.plugin.pay.dto.APPPayDto;
|
|
||||||
import org.springblade.plugin.pay.dto.APPQueryDto;
|
|
||||||
import org.springblade.plugin.pay.response.APPPayResult;
|
|
||||||
|
|
||||||
public interface PaymentFacade {
|
|
||||||
|
|
||||||
APPPayResult appPay(APPPayDto dto) throws Exception;
|
|
||||||
|
|
||||||
Boolean query(APPQueryDto dto);
|
|
||||||
|
|
||||||
Boolean closeOrder(APPQueryDto dto);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
package org.springblade.plugin.pay.api.impl;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springblade.modules.common.eums.BusinessModule;
|
|
||||||
import org.springblade.modules.common.eums.PaymentType;
|
|
||||||
import org.springblade.plugin.pay.api.PaymentFacade;
|
|
||||||
import org.springblade.plugin.pay.config.AliPayConfiguration;
|
|
||||||
import org.springblade.plugin.pay.config.WxPayConfiguration;
|
|
||||||
import org.springblade.plugin.pay.dto.APPPayDto;
|
|
||||||
import org.springblade.plugin.pay.dto.APPQueryDto;
|
|
||||||
import org.springblade.plugin.pay.response.APPPayResult;
|
|
||||||
import org.springblade.plugin.pay.service.IAliPayService;
|
|
||||||
import org.springblade.plugin.pay.service.IWxPayService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class PaymentFacadeImpl implements PaymentFacade {
|
|
||||||
|
|
||||||
private final IAliPayService aliPayService;
|
|
||||||
private final AliPayConfiguration aliPayConfig;
|
|
||||||
|
|
||||||
private final IWxPayService wxPayService;
|
|
||||||
private final WxPayConfiguration wxPayConfig;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public APPPayResult appPay(APPPayDto dto) {
|
|
||||||
|
|
||||||
PaymentType paymentType = dto.getPaymentType();
|
|
||||||
BusinessModule businessModule = dto.getBusinessModule();
|
|
||||||
|
|
||||||
APPPayResult result = new APPPayResult();
|
|
||||||
String content = "success";
|
|
||||||
|
|
||||||
switch (paymentType) {
|
|
||||||
case ALI:
|
|
||||||
content = aliPayService.appPay(
|
|
||||||
aliPayConfig.getAppId(),
|
|
||||||
aliPayConfig.getMachId(),
|
|
||||||
dto.getBody(),
|
|
||||||
String.valueOf(dto.getAmount()),
|
|
||||||
aliPayConfig.getNotifyUrl(),
|
|
||||||
dto.getRemark(),
|
|
||||||
paymentType.getAbbr() + businessModule.getAbbr(),
|
|
||||||
dto.getOrderId()
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case WECHAT:
|
|
||||||
Map<String, String> stringStringMap = wxPayService.appPay(
|
|
||||||
wxPayConfig.getAppId(),
|
|
||||||
wxPayConfig.getMachId(),
|
|
||||||
dto.getBody(),
|
|
||||||
String.valueOf(dto.getAmount()),
|
|
||||||
wxPayConfig.getNotifyUrl(),
|
|
||||||
dto.getRemark(),
|
|
||||||
paymentType.getAbbr() + businessModule.getAbbr(),
|
|
||||||
dto.getOrderId()
|
|
||||||
);
|
|
||||||
log.info("微信APP支付结果:{}", stringStringMap);
|
|
||||||
//todo 微信app支付结果处理
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("支付类型错误");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
.setSuccess(Boolean.TRUE)
|
|
||||||
.setContent(content)
|
|
||||||
.setPaymentTypeEnum(paymentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean query(APPQueryDto dto){
|
|
||||||
PaymentType paymentType = dto.getPaymentType();
|
|
||||||
Boolean result = false;
|
|
||||||
switch (paymentType) {
|
|
||||||
case ALI:
|
|
||||||
result = aliPayService.query(dto.getOrderNo(),aliPayConfig.getAppId(), aliPayConfig.getMachId());
|
|
||||||
break;
|
|
||||||
case WECHAT:
|
|
||||||
|
|
||||||
//todo 微信app查询支付结果
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("支付类型错误");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean closeOrder(APPQueryDto dto) {
|
|
||||||
PaymentType paymentType = dto.getPaymentType();
|
|
||||||
Boolean result = false;
|
|
||||||
switch (paymentType) {
|
|
||||||
case ALI:
|
|
||||||
result = aliPayService.closeOrder(dto.getOrderNo(),aliPayConfig.getAppId(), aliPayConfig.getMachId());
|
|
||||||
break;
|
|
||||||
case WECHAT:
|
|
||||||
|
|
||||||
//todo 微信app查询支付结果
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("支付类型错误");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package org.springblade.plugin.pay.config;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "alipay")
|
|
||||||
public class AliPayConfiguration {
|
|
||||||
|
|
||||||
|
|
||||||
private String appId;
|
|
||||||
private String machId;
|
|
||||||
private String notifyUrl;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package org.springblade.plugin.pay.config;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "wechatpay")
|
|
||||||
public class WxPayConfiguration {
|
|
||||||
|
|
||||||
private String appId;
|
|
||||||
private String machId;
|
|
||||||
private String notifyUrl;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -44,5 +44,7 @@ public interface PayConstant {
|
|||||||
// 电脑支付
|
// 电脑支付
|
||||||
String PCPAY = "pc";
|
String PCPAY = "pc";
|
||||||
|
|
||||||
|
String PAYMENT_CONFIG_CACHE = "blade:payment";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.boot.ctrl.BladeController;
|
||||||
|
import org.springblade.core.cache.utils.CacheUtil;
|
||||||
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Condition;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
@@ -19,6 +20,8 @@ import org.springblade.plugin.pay.service.IAliPayAccountConfigService;
|
|||||||
import org.springblade.plugin.pay.vo.AliPayAccountConfigVO;
|
import org.springblade.plugin.pay.vo.AliPayAccountConfigVO;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import static org.springblade.plugin.pay.constant.PayConstant.PAYMENT_CONFIG_CACHE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付宝商户配置控制器
|
* 支付宝商户配置控制器
|
||||||
@@ -115,6 +118,8 @@ public class AliPayAccountConfigController extends BladeController {
|
|||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "新增或修改", description = "传入aliPayAccountConfig")
|
@Operation(summary = "新增或修改", description = "传入aliPayAccountConfig")
|
||||||
public R submit(@Valid @RequestBody AliPayAccountConfig aliPayAccountConfig) {
|
public R submit(@Valid @RequestBody AliPayAccountConfig aliPayAccountConfig) {
|
||||||
|
CacheUtil.clear(PAYMENT_CONFIG_CACHE);
|
||||||
|
CacheUtil.clear(PAYMENT_CONFIG_CACHE, Boolean.FALSE);
|
||||||
if (!StringUtil.isBlank(aliPayAccountConfig.getAlipayPubCert())) {
|
if (!StringUtil.isBlank(aliPayAccountConfig.getAlipayPubCert())) {
|
||||||
aliPayAccountConfig.setAlipayPubCert(null);
|
aliPayAccountConfig.setAlipayPubCert(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springblade.common.cache.PaymentCache;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.core.tool.utils.StringUtil;
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
import org.springblade.plugin.pay.api.wxpay.IWxPayApiService;
|
import org.springblade.plugin.pay.api.wxpay.IWxPayApiService;
|
||||||
@@ -148,26 +149,26 @@ public class CallbackController {
|
|||||||
try {
|
try {
|
||||||
// 获取支付宝POST过来反馈信息
|
// 获取支付宝POST过来反馈信息
|
||||||
Map<String, String> params = AliPayApiUtil.toMap(request);
|
Map<String, String> params = AliPayApiUtil.toMap(request);
|
||||||
System.out.println("支付宝回调参数:" + params.toString());
|
System.out.println("支付宝回调参数:" + params);
|
||||||
String mchId = params.get("seller_id");
|
String mchId = params.get("seller_id");
|
||||||
String appId = params.get("app_id");
|
String appId = params.get("app_id");
|
||||||
if (StringUtils.isBlank(mchId)) {
|
if (StringUtils.isBlank(mchId)) {
|
||||||
result = "seller_id is not null";
|
result = "seller_id is not null";
|
||||||
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, new String[]{"encoding:UTF-8"});
|
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, "encoding:UTF-8");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AliPayAccountConfig aliPayAccountConfig = aliPayAccountConfigService.getInfoByMchIdAndAppId(mchId, appId);
|
AliPayAccountConfig config = PaymentCache.getAliConfig();
|
||||||
if (aliPayAccountConfig == null) {
|
if (config == null) {
|
||||||
result = "该商户号尚未接入";
|
result = "该商户号尚未接入";
|
||||||
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, new String[]{"encoding:UTF-8"});
|
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, "encoding:UTF-8");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String signType = aliPayAccountConfig.getSignType();
|
String signType = config.getSignType();
|
||||||
String pubKey = aliPayAccountConfig.getPubKey();
|
String pubKey = config.getPubKey();
|
||||||
boolean verify_result = AlipaySignature.rsaCheckV1(params, pubKey, "UTF-8", signType);
|
boolean verify_result = AlipaySignature.rsaCheckV1(params, pubKey, "UTF-8", signType);
|
||||||
if (!verify_result) {
|
if (!verify_result) {
|
||||||
result = "签名验证失败";
|
result = "签名验证失败";
|
||||||
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, new String[]{"encoding:UTF-8"});
|
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, "encoding:UTF-8");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//支付状态
|
//支付状态
|
||||||
@@ -218,13 +219,13 @@ public class CallbackController {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, new String[]{"encoding:UTF-8"});
|
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), result, "encoding:UTF-8");
|
||||||
} catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), e.getMessage(), new String[]{"encoding:UTF-8"});
|
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), e.getMessage(), "encoding:UTF-8");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), e.getMessage(), new String[]{"encoding:UTF-8"});
|
AliPayApiUtil.render(response, ContentType.TEXT_PLAIN.getValue(), e.getMessage(), "encoding:UTF-8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.boot.ctrl.BladeController;
|
||||||
|
import org.springblade.core.cache.utils.CacheUtil;
|
||||||
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Condition;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
@@ -19,6 +20,8 @@ import org.springblade.plugin.pay.service.IWxPayAccountConfigService;
|
|||||||
import org.springblade.plugin.pay.vo.WxPayAccountConfigVO;
|
import org.springblade.plugin.pay.vo.WxPayAccountConfigVO;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import static org.springblade.plugin.pay.constant.PayConstant.PAYMENT_CONFIG_CACHE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制器
|
* 控制器
|
||||||
*
|
*
|
||||||
@@ -153,6 +156,8 @@ public class WxPayAccountConfigController extends BladeController {
|
|||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary ="新增或修改", description ="传入wxpayAccountConfig")
|
@Operation(summary ="新增或修改", description ="传入wxpayAccountConfig")
|
||||||
public R submit(@Valid @RequestBody WxPayAccountConfig wxpayAccountConfig) {
|
public R submit(@Valid @RequestBody WxPayAccountConfig wxpayAccountConfig) {
|
||||||
|
CacheUtil.clear(PAYMENT_CONFIG_CACHE);
|
||||||
|
CacheUtil.clear(PAYMENT_CONFIG_CACHE, Boolean.FALSE);
|
||||||
if (wxpayAccountConfig.getPrivateKey() != null) {
|
if (wxpayAccountConfig.getPrivateKey() != null) {
|
||||||
wxpayAccountConfig.setPrivateKey(null);
|
wxpayAccountConfig.setPrivateKey(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import org.springblade.core.mp.base.BaseEntity;
|
import org.springblade.core.mp.base.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付宝商户配置对象
|
* 支付宝商户配置对象
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("blade_pay_alipay_account_config")
|
@TableName("blade_pay_alipay_account_config")
|
||||||
@Schema(description = "AlipayAccountConfig对象")
|
@Schema(description = "AlipayAccountConfig对象")
|
||||||
public class AliPayAccountConfig extends BaseEntity {
|
public class AliPayAccountConfig extends BaseEntity {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import com.ijpay.core.kit.RsaKit;
|
import com.ijpay.core.kit.RsaKit;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springblade.core.mp.base.BaseEntity;
|
import org.springblade.core.mp.base.BaseEntity;
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ import java.security.PrivateKey;
|
|||||||
* @since 2021-12-31
|
* @since 2021-12-31
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("blade_pay_wxpay_account_config")
|
@TableName("blade_pay_wxpay_account_config")
|
||||||
@Schema(description = "WxPayAccountConfig对象")
|
@Schema(description = "WxPayAccountConfig对象")
|
||||||
public class WxPayAccountConfig extends BaseEntity {
|
public class WxPayAccountConfig extends BaseEntity {
|
||||||
@@ -204,8 +206,7 @@ public class WxPayAccountConfig extends BaseEntity {
|
|||||||
if (!StringUtils.isBlank(certPkcs)) {
|
if (!StringUtils.isBlank(certPkcs)) {
|
||||||
try {
|
try {
|
||||||
byte[] decode = Base64.decode(certPkcs);
|
byte[] decode = Base64.decode(certPkcs);
|
||||||
ByteArrayInputStream stream = new ByteArrayInputStream(decode);
|
certPkcsStream = new ByteArrayInputStream(decode);
|
||||||
certPkcsStream = stream;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.err.println("微信p12证书格式错误");
|
System.err.println("微信p12证书格式错误");
|
||||||
@@ -217,8 +218,7 @@ public class WxPayAccountConfig extends BaseEntity {
|
|||||||
public ByteArrayInputStream getCertPubKeyStream() {
|
public ByteArrayInputStream getCertPubKeyStream() {
|
||||||
if (!StringUtils.isBlank(certPubKey)) {
|
if (!StringUtils.isBlank(certPubKey)) {
|
||||||
try {
|
try {
|
||||||
ByteArrayInputStream stream = new ByteArrayInputStream(certPubKey.getBytes());
|
certPubKeyStream = new ByteArrayInputStream(certPubKey.getBytes());
|
||||||
certPubKeyStream = stream;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.err.println("微信公钥证书格式错误");
|
System.err.println("微信公钥证书格式错误");
|
||||||
@@ -229,3 +229,4 @@ public class WxPayAccountConfig extends BaseEntity {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package org.springblade.plugin.pay.response;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
import org.springblade.core.tool.utils.StringPool;
|
|
||||||
import org.springblade.modules.common.eums.PaymentType;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class APPPayResult implements Serializable {
|
|
||||||
|
|
||||||
private Boolean success = false;
|
|
||||||
|
|
||||||
private String content = StringPool.EMPTY;
|
|
||||||
|
|
||||||
PaymentType paymentTypeEnum;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -64,4 +64,6 @@ public interface IAliPayAccountConfigService extends BaseService<AliPayAccountCo
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public AliPayAccountConfig getInfoByMchIdAndAppId(String mchId, String appId);
|
public AliPayAccountConfig getInfoByMchIdAndAppId(String mchId, String appId);
|
||||||
|
|
||||||
|
AliPayAccountConfig getDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.springblade.plugin.pay.service;
|
package org.springblade.plugin.pay.service;
|
||||||
|
|
||||||
|
import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||||
import com.alipay.api.response.AlipayTradeRefundResponse;
|
import com.alipay.api.response.AlipayTradeRefundResponse;
|
||||||
import org.springblade.plugin.pay.entityBiz.AliPayBiz;
|
import org.springblade.plugin.pay.entityBiz.AliPayBiz;
|
||||||
import org.springblade.plugin.pay.entityBiz.AliPayPageApiBiz;
|
import org.springblade.plugin.pay.entityBiz.AliPayPageApiBiz;
|
||||||
@@ -112,7 +113,7 @@ public interface IAliPayService {
|
|||||||
*/
|
*/
|
||||||
public AlipayTradeRefundResponse refund(String appId,String orderNo, String mchId, String refundMoney, String reason, String notifyUrl);
|
public AlipayTradeRefundResponse refund(String appId,String orderNo, String mchId, String refundMoney, String reason, String notifyUrl);
|
||||||
|
|
||||||
Boolean query(String orderNo , String appId, String mchId);
|
AlipayTradeQueryResponse query(String orderNo , String appId, String mchId);
|
||||||
|
|
||||||
Boolean closeOrder(String orderNo , String appId, String mchId);
|
Boolean closeOrder(String orderNo , String appId, String mchId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public interface IOrderService extends BaseService<Order> {
|
|||||||
* @param notifyUrl
|
* @param notifyUrl
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Order save(String appId, String mchId, String payName, String body, String money, String chanel, String payType, String notifyUrl , String orderPrefix);
|
public Order save(String appId, String mchId, String payName, String body, String money, String chanel, String payType, String notifyUrl , String orderNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单号、商户号查询支付订单
|
* 根据订单号、商户号查询支付订单
|
||||||
|
|||||||
@@ -65,4 +65,7 @@ public interface IWxPayAccountConfigService extends BaseService<WxPayAccountConf
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public WxPayAccountConfig getInfoByMchId(String mchId);
|
public WxPayAccountConfig getInfoByMchId(String mchId);
|
||||||
|
|
||||||
|
WxPayAccountConfig getDefault();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.springblade.plugin.pay.service.impl;
|
|||||||
|
|
||||||
import com.alipay.api.internal.util.AntCertificationUtil;
|
import com.alipay.api.internal.util.AntCertificationUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
@@ -158,4 +159,12 @@ public class AliPayAccountConfigServiceImpl extends BaseServiceImpl<AliPayAccoun
|
|||||||
return aliPayAccountConfig;
|
return aliPayAccountConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AliPayAccountConfig getDefault() {
|
||||||
|
AliPayAccountConfig config = getOne(Wrappers.<AliPayAccountConfig>lambdaQuery().eq(AliPayAccountConfig::getStatus, 1));
|
||||||
|
if (config == null) {
|
||||||
|
throw new ServiceException("该商户号尚未接入");
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ import org.springblade.core.log.exception.ServiceException;
|
|||||||
import org.springblade.core.oss.model.BladeFile;
|
import org.springblade.core.oss.model.BladeFile;
|
||||||
import org.springblade.core.tool.utils.PathUtil;
|
import org.springblade.core.tool.utils.PathUtil;
|
||||||
import org.springblade.core.tool.utils.StringUtil;
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
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.service.ICommonPayOrderService;
|
|
||||||
import org.springblade.modules.resource.builder.OssBuilder;
|
import org.springblade.modules.resource.builder.OssBuilder;
|
||||||
import org.springblade.plugin.pay.api.alipay.IAliPayApiService;
|
import org.springblade.plugin.pay.api.alipay.IAliPayApiService;
|
||||||
import org.springblade.plugin.pay.common.AliPayException;
|
import org.springblade.plugin.pay.common.AliPayException;
|
||||||
@@ -44,6 +39,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -63,25 +59,24 @@ public class AliPayServiceImpl implements IAliPayService {
|
|||||||
private final IAliPayAccountConfigService aliPayAccountConfigService;
|
private final IAliPayAccountConfigService aliPayAccountConfigService;
|
||||||
private final OssBuilder ossBuilder;
|
private final OssBuilder ossBuilder;
|
||||||
private final IRefundService refundService;
|
private final IRefundService refundService;
|
||||||
private final ICommonPayOrderService commonPayOrderService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单前置验证
|
* 订单前置验证
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private AliPayCheckBiz beforeCheck(String appId, String mchId, String body, String money, String notifyUrl, String payType , String orderPrefix) {
|
private AliPayCheckBiz beforeCheck(String appId, String mchId, String body, String money, String notifyUrl, String payType , String orderNo) {
|
||||||
AliPayAccountConfig aliPayAccountConfig = aliPayAccountConfigService.getInfoByMchIdAndAppId(mchId, appId);
|
AliPayAccountConfig aliPayAccountConfig = aliPayAccountConfigService.getInfoByMchIdAndAppId(mchId, appId);
|
||||||
if (aliPayAccountConfig == null) {
|
if (aliPayAccountConfig == null) {
|
||||||
throw new ServiceException("该商户号尚未接入");
|
throw new ServiceException("该商户号尚未接入");
|
||||||
}
|
}
|
||||||
if (aliPayAccountConfig.getStatus().intValue() != 1) {
|
if (aliPayAccountConfig.getStatus() != 1) {
|
||||||
throw new ServiceException("该商户号已暂停交易");
|
throw new ServiceException("该商户号已暂停交易");
|
||||||
}
|
}
|
||||||
if (StringUtil.isBlank(notifyUrl)) {
|
if (StringUtil.isBlank(notifyUrl)) {
|
||||||
notifyUrl = aliPayAccountConfig.getNotifyUrl();
|
notifyUrl = aliPayAccountConfig.getNotifyUrl();
|
||||||
}
|
}
|
||||||
Order order = orderService.save(appId, mchId, aliPayAccountConfig.getPayName(), body, money, PayConstant.ALIPAY, payType, notifyUrl , orderPrefix);
|
Order order = orderService.save(appId, mchId, aliPayAccountConfig.getPayName(), body, money, PayConstant.ALIPAY, payType, notifyUrl , orderNo);
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
throw new ServiceException("下单失败,请稍候再试");
|
throw new ServiceException("下单失败,请稍候再试");
|
||||||
}
|
}
|
||||||
@@ -325,16 +320,9 @@ public class AliPayServiceImpl implements IAliPayService {
|
|||||||
public String appPay(String appId, String mchId, String body, String money, String notifyUrl, String attach ,String orderPrefix , Long orderId) {
|
public String appPay(String appId, String mchId, String body, String money, String notifyUrl, String attach ,String orderPrefix , Long orderId) {
|
||||||
String appPayStr = null;
|
String appPayStr = null;
|
||||||
try {
|
try {
|
||||||
AliPayCheckBiz aliPayCheckBiz = beforeCheck(appId, mchId, body, money, notifyUrl,PayConstant.APPPAY , orderPrefix);
|
AliPayCheckBiz aliPayCheckBiz = beforeCheck(appId, mchId, body, money, notifyUrl,PayConstant.APPPAY , orderPrefix + orderId);
|
||||||
Order order = aliPayCheckBiz.getOrder();
|
Order order = aliPayCheckBiz.getOrder();
|
||||||
CommonPayOrderEntity commonPayOrderEntity = new CommonPayOrderEntity();
|
|
||||||
commonPayOrderEntity.setId(order.getId());
|
|
||||||
commonPayOrderEntity.setOrderId(orderId);
|
|
||||||
commonPayOrderEntity.setStatus(OrderStatus.PENDING_PAYMENT.getCode());
|
|
||||||
commonPayOrderEntity.setPaymentStatus(PaymentStatus.UNPAID.getCode());
|
|
||||||
commonPayOrderEntity.setOrderNo(order.getOrderNo());
|
|
||||||
commonPayOrderEntity.setPaymentType(PaymentType.ALI.getCode());
|
|
||||||
commonPayOrderService.save(commonPayOrderEntity);
|
|
||||||
AliPayAccountConfig aliPayAccountConfig = aliPayCheckBiz.getAliPayAccountConfig();
|
AliPayAccountConfig aliPayAccountConfig = aliPayCheckBiz.getAliPayAccountConfig();
|
||||||
Integer apiType = aliPayAccountConfig.getApiType();
|
Integer apiType = aliPayAccountConfig.getApiType();
|
||||||
switch (apiType) {
|
switch (apiType) {
|
||||||
@@ -430,7 +418,7 @@ public class AliPayServiceImpl implements IAliPayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean query(String orderNo , String appId, String mchId) {
|
public AlipayTradeQueryResponse query(String orderNo , String appId, String mchId) {
|
||||||
|
|
||||||
|
|
||||||
AliPayAccountConfig aliPayAccountConfig = aliPayAccountConfigService.getInfoByMchIdAndAppId(mchId, appId);
|
AliPayAccountConfig aliPayAccountConfig = aliPayAccountConfigService.getInfoByMchIdAndAppId(mchId, appId);
|
||||||
@@ -442,11 +430,11 @@ public class AliPayServiceImpl implements IAliPayService {
|
|||||||
try {
|
try {
|
||||||
response = aliPayApiService.query(orderNo, aliPayAccountConfig);
|
response = aliPayApiService.query(orderNo, aliPayAccountConfig);
|
||||||
log.info("支付宝账单:[{}]的支付结果为:{}", orderNo, response.getBody());
|
log.info("支付宝账单:[{}]的支付结果为:{}", orderNo, response.getBody());
|
||||||
return response.getTradeStatus().equalsIgnoreCase("TRADE_SUCCESS")
|
return response;
|
||||||
|| response.getTradeStatus().equalsIgnoreCase("TRADE_FINISHED");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询订单异常:{}", e.getMessage());
|
log.error("查询订单异常:{}", e.getMessage());
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Order save(String appId, String mchId, String payName, String body, String money, String chanel, String payType, String notifyUrl ,String orderPrefix) {
|
public Order save(String appId, String mchId, String payName, String body, String money, String chanel, String payType, String notifyUrl ,String orderNo) {
|
||||||
Order order = null;
|
Order order = null;
|
||||||
try {
|
try {
|
||||||
order = new Order();
|
order = new Order();
|
||||||
order.setOrderNo(OrderUtil.createOrderNo(orderPrefix));
|
order.setOrderNo(orderNo);
|
||||||
order.setBody(body);
|
order.setBody(body);
|
||||||
order.setMoney(money);
|
order.setMoney(money);
|
||||||
order.setMchId(mchId);
|
order.setMchId(mchId);
|
||||||
@@ -131,7 +131,7 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|||||||
.eq(Order::getMchId, mchId));
|
.eq(Order::getMchId, mchId));
|
||||||
|
|
||||||
if (update){
|
if (update){
|
||||||
publisher.publishEvent(new PaymentCallbackEvent().setId(order.getId()).setPayTime(DateUtil.convertFromString(payTime , "yyyy-MM-dd hh:mm:ss")));
|
publisher.publishEvent(new PaymentCallbackEvent().setId(parsePrefixString(orderNo)).setPayTime(DateUtil.convertFromString(payTime , "yyyy-MM-dd hh:mm:ss")));
|
||||||
}
|
}
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
@@ -172,4 +172,22 @@ public class OrderServiceImpl extends BaseServiceImpl<OrderMapper, Order> implem
|
|||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long parsePrefixString(String input) {
|
||||||
|
if (input == null || input.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("订单号为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
String numberPart = input.replaceAll("^[A-Za-z]+", "");
|
||||||
|
|
||||||
|
if (numberPart.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("去除前缀后未找到数字部分");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Long.parseLong(numberPart);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new IllegalArgumentException("数字部分格式错误或超出 long 范围: " + numberPart, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.springblade.plugin.pay.service.impl;
|
package org.springblade.plugin.pay.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.ijpay.core.kit.PayKit;
|
import com.ijpay.core.kit.PayKit;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.log.exception.ServiceException;
|
||||||
@@ -174,4 +175,12 @@ public class WxPayAccountConfigServiceImpl extends BaseServiceImpl<WxPayAccountC
|
|||||||
return wxPayAccountConfig;
|
return wxPayAccountConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxPayAccountConfig getDefault() {
|
||||||
|
WxPayAccountConfig config = getOne(Wrappers.<WxPayAccountConfig>lambdaQuery().eq(WxPayAccountConfig::getStatus, 1));
|
||||||
|
if (config == null) {
|
||||||
|
throw new ServiceException("该商户号尚未接入");
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ import org.springblade.core.log.exception.ServiceException;
|
|||||||
import org.springblade.core.oss.model.BladeFile;
|
import org.springblade.core.oss.model.BladeFile;
|
||||||
import org.springblade.core.tool.utils.PathUtil;
|
import org.springblade.core.tool.utils.PathUtil;
|
||||||
import org.springblade.core.tool.utils.StringUtil;
|
import org.springblade.core.tool.utils.StringUtil;
|
||||||
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.service.ICommonPayOrderService;
|
|
||||||
import org.springblade.modules.resource.builder.OssBuilder;
|
import org.springblade.modules.resource.builder.OssBuilder;
|
||||||
import org.springblade.plugin.pay.api.wxpay.IWxPayApiService;
|
import org.springblade.plugin.pay.api.wxpay.IWxPayApiService;
|
||||||
import org.springblade.plugin.pay.common.WxPayException;
|
import org.springblade.plugin.pay.common.WxPayException;
|
||||||
@@ -40,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -60,7 +56,6 @@ public class WxPayServiceImpl implements IWxPayService {
|
|||||||
private final OssBuilder ossBuilder;
|
private final OssBuilder ossBuilder;
|
||||||
private final WxPayV3ParamsUtil wxPayV3ParamsUtil;
|
private final WxPayV3ParamsUtil wxPayV3ParamsUtil;
|
||||||
private final IRefundService refundService;
|
private final IRefundService refundService;
|
||||||
private final ICommonPayOrderService commonPayOrderService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,16 +227,8 @@ public class WxPayServiceImpl implements IWxPayService {
|
|||||||
public Map<String, String> appPay(String appId, String mchId, String body, String money, String notifyUrl, String attach, String orderPrefix, Long orderId) {
|
public Map<String, String> appPay(String appId, String mchId, String body, String money, String notifyUrl, String attach, String orderPrefix, Long orderId) {
|
||||||
Map<String, String> appPayParams = null;
|
Map<String, String> appPayParams = null;
|
||||||
try {
|
try {
|
||||||
WxPayCheckBiz wxPayCheckBiz = beforeCheck(appId, mchId, body, money, notifyUrl,PayConstant.APPPAY , orderPrefix);
|
WxPayCheckBiz wxPayCheckBiz = beforeCheck(appId, mchId, body, money, notifyUrl,PayConstant.APPPAY , orderPrefix + orderId);
|
||||||
Order order = wxPayCheckBiz.getOrder();
|
Order order = wxPayCheckBiz.getOrder();
|
||||||
CommonPayOrderEntity commonPayOrderEntity = new CommonPayOrderEntity();
|
|
||||||
commonPayOrderEntity.setId(order.getId());
|
|
||||||
commonPayOrderEntity.setOrderId(orderId);
|
|
||||||
commonPayOrderEntity.setStatus(OrderStatus.PENDING_PAYMENT.getCode());
|
|
||||||
commonPayOrderEntity.setPaymentStatus(PaymentStatus.UNPAID.getCode());
|
|
||||||
commonPayOrderEntity.setOrderNo(order.getOrderNo());
|
|
||||||
commonPayOrderEntity.setPaymentType(PaymentType.WECHAT.getCode());
|
|
||||||
commonPayOrderService.save(commonPayOrderEntity);
|
|
||||||
|
|
||||||
WxPayAccountConfig wxPayAccountConfig = wxPayCheckBiz.getWxPayAccountConfig();
|
WxPayAccountConfig wxPayAccountConfig = wxPayCheckBiz.getWxPayAccountConfig();
|
||||||
Integer apiType = wxPayAccountConfig.getApiType();
|
Integer apiType = wxPayAccountConfig.getApiType();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user