Commit 9cbd0fec1c7f4cfe8fd17e31cd9df84df6d8b4e9

Authored by puhui999
2 parents b697ee32 5d2d5202

Merge remote-tracking branch 'yudao/feature/mall_product' into feature/mall_product

Showing 135 changed files with 1235 additions and 4311 deletions

Too many changes.

To preserve performance only 100 of 135 files are displayed.

sql/mysql/menu.sql deleted
1   --- 菜单 SQL
2   -INSERT INTO system_menu(
3   - name, permission, type, sort, parent_id,
4   - path, icon, component, status, component_name
5   -)
6   -VALUES (
7   - '积分设置管理', '', 2, 0, 2162,
8   - 'config', '', 'point/config/index', 0, 'PointConfig'
9   -);
10   -
11   --- 按钮父菜单ID
12   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
13   -SELECT @parentId := LAST_INSERT_ID();
14   -
15   --- 按钮 SQL
16   -INSERT INTO system_menu(
17   - name, permission, type, sort, parent_id,
18   - path, icon, component, status
19   -)
20   -VALUES (
21   - '积分设置查询', 'point:config:query', 3, 1, @parentId,
22   - '', '', '', 0
23   -);
24   -INSERT INTO system_menu(
25   - name, permission, type, sort, parent_id,
26   - path, icon, component, status
27   -)
28   -VALUES (
29   - '积分设置创建', 'point:config:create', 3, 2, @parentId,
30   - '', '', '', 0
31   -);
32   -INSERT INTO system_menu(
33   - name, permission, type, sort, parent_id,
34   - path, icon, component, status
35   -)
36   -VALUES (
37   - '积分设置更新', 'point:config:update', 3, 3, @parentId,
38   - '', '', '', 0
39   -);
40   -INSERT INTO system_menu(
41   - name, permission, type, sort, parent_id,
42   - path, icon, component, status
43   -)
44   -VALUES (
45   - '积分设置删除', 'point:config:delete', 3, 4, @parentId,
46   - '', '', '', 0
47   -);
48   -INSERT INTO system_menu(
49   - name, permission, type, sort, parent_id,
50   - path, icon, component, status
51   -)
52   -VALUES (
53   - '积分设置导出', 'point:config:export', 3, 5, @parentId,
54   - '', '', '', 0
55   -);
56   -
57   -
58   -
59   --- 菜单 SQL
60   -INSERT INTO system_menu(
61   - name, permission, type, sort, parent_id,
62   - path, icon, component, status, component_name
63   -)
64   -VALUES (
65   - '积分签到规则管理', '', 2, 0, 2162,
66   - 'sign-in-config', '', 'point/signInConfig/index', 0, 'SignInConfig'
67   -);
68   -
69   --- 按钮父菜单ID
70   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
71   -SELECT @parentId := LAST_INSERT_ID();
72   -
73   --- 按钮 SQL
74   -INSERT INTO system_menu(
75   - name, permission, type, sort, parent_id,
76   - path, icon, component, status
77   -)
78   -VALUES (
79   - '积分签到规则查询', 'point:sign-in-config:query', 3, 1, @parentId,
80   - '', '', '', 0
81   -);
82   -INSERT INTO system_menu(
83   - name, permission, type, sort, parent_id,
84   - path, icon, component, status
85   -)
86   -VALUES (
87   - '积分签到规则创建', 'point:sign-in-config:create', 3, 2, @parentId,
88   - '', '', '', 0
89   -);
90   -INSERT INTO system_menu(
91   - name, permission, type, sort, parent_id,
92   - path, icon, component, status
93   -)
94   -VALUES (
95   - '积分签到规则更新', 'point:sign-in-config:update', 3, 3, @parentId,
96   - '', '', '', 0
97   -);
98   -INSERT INTO system_menu(
99   - name, permission, type, sort, parent_id,
100   - path, icon, component, status
101   -)
102   -VALUES (
103   - '积分签到规则删除', 'point:sign-in-config:delete', 3, 4, @parentId,
104   - '', '', '', 0
105   -);
106   -INSERT INTO system_menu(
107   - name, permission, type, sort, parent_id,
108   - path, icon, component, status
109   -)
110   -VALUES (
111   - '积分签到规则导出', 'point:sign-in-config:export', 3, 5, @parentId,
112   - '', '', '', 0
113   -);
114   -
115   -
116   --- 菜单 SQL
117   -INSERT INTO system_menu(
118   - name, permission, type, sort, parent_id,
119   - path, icon, component, status, component_name
120   -)
121   -VALUES (
122   - '用户积分记录管理', '', 2, 0, 2162,
123   - 'record', '', 'point/record/index', 0, 'PointRecord'
124   -);
125   -
126   --- 按钮父菜单ID
127   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
128   -SELECT @parentId := LAST_INSERT_ID();
129   -
130   --- 按钮 SQL
131   -INSERT INTO system_menu(
132   - name, permission, type, sort, parent_id,
133   - path, icon, component, status
134   -)
135   -VALUES (
136   - '用户积分记录查询', 'point:record:query', 3, 1, @parentId,
137   - '', '', '', 0
138   -);
139   -INSERT INTO system_menu(
140   - name, permission, type, sort, parent_id,
141   - path, icon, component, status
142   -)
143   -VALUES (
144   - '用户积分记录创建', 'point:record:create', 3, 2, @parentId,
145   - '', '', '', 0
146   -);
147   -INSERT INTO system_menu(
148   - name, permission, type, sort, parent_id,
149   - path, icon, component, status
150   -)
151   -VALUES (
152   - '用户积分记录更新', 'point:record:update', 3, 3, @parentId,
153   - '', '', '', 0
154   -);
155   -INSERT INTO system_menu(
156   - name, permission, type, sort, parent_id,
157   - path, icon, component, status
158   -)
159   -VALUES (
160   - '用户积分记录删除', 'point:record:delete', 3, 4, @parentId,
161   - '', '', '', 0
162   -);
163   -INSERT INTO system_menu(
164   - name, permission, type, sort, parent_id,
165   - path, icon, component, status
166   -)
167   -VALUES (
168   - '用户积分记录导出', 'point:record:export', 3, 5, @parentId,
169   - '', '', '', 0
170   -);
171   -
172   -
173   -
174   --- 菜单 SQL
175   -INSERT INTO system_menu(
176   - name, permission, type, sort, parent_id,
177   - path, icon, component, status, component_name
178   -)
179   -VALUES (
180   - '用户签到积分管理', '', 2, 0, 2162,
181   - 'sign-in-record', '', 'point/signInRecord/index', 0, 'SignInRecord'
182   -);
183   -
184   --- 按钮父菜单ID
185   --- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
186   -SELECT @parentId := LAST_INSERT_ID();
187   -
188   --- 按钮 SQL
189   -INSERT INTO system_menu(
190   - name, permission, type, sort, parent_id,
191   - path, icon, component, status
192   -)
193   -VALUES (
194   - '用户签到积分查询', 'point:sign-in-record:query', 3, 1, @parentId,
195   - '', '', '', 0
196   -);
197   -INSERT INTO system_menu(
198   - name, permission, type, sort, parent_id,
199   - path, icon, component, status
200   -)
201   -VALUES (
202   - '用户签到积分创建', 'point:sign-in-record:create', 3, 2, @parentId,
203   - '', '', '', 0
204   -);
205   -INSERT INTO system_menu(
206   - name, permission, type, sort, parent_id,
207   - path, icon, component, status
208   -)
209   -VALUES (
210   - '用户签到积分更新', 'point:sign-in-record:update', 3, 3, @parentId,
211   - '', '', '', 0
212   -);
213   -INSERT INTO system_menu(
214   - name, permission, type, sort, parent_id,
215   - path, icon, component, status
216   -)
217   -VALUES (
218   - '用户签到积分删除', 'point:sign-in-record:delete', 3, 4, @parentId,
219   - '', '', '', 0
220   -);
221   -INSERT INTO system_menu(
222   - name, permission, type, sort, parent_id,
223   - path, icon, component, status
224   -)
225   -VALUES (
226   - '用户签到积分导出', 'point:sign-in-record:export', 3, 5, @parentId,
227   - '', '', '', 0
228   -);
229   -
230   -
sql/mysql/optional/mall.sql deleted
1   -/*
2   - Navicat Premium Data Transfer
3   -
4   - Source Server : 127.0.0.1 MySQL
5   - Source Server Type : MySQL
6   - Source Server Version : 80026
7   - Source Host : localhost:3306
8   - Source Schema : ruoyi-vue-pro
9   -
10   - Target Server Type : MySQL
11   - Target Server Version : 80026
12   - File Encoding : 65001
13   -
14   - Date: 01/08/2022 23:01:36
15   -*/
16   -
17   -SET NAMES utf8mb4;
18   -SET FOREIGN_KEY_CHECKS = 0;
19   -
20   --- ----------------------------
21   --- Table structure for market_activity
22   --- ----------------------------
23   -DROP TABLE IF EXISTS `market_activity`;
24   -CREATE TABLE `market_activity` (
25   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动编号',
26   - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '活动标题',
27   - `activity_type` tinyint NOT NULL COMMENT '活动类型',
28   - `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态',
29   - `start_time` datetime NOT NULL COMMENT '开始时间',
30   - `end_time` datetime NOT NULL COMMENT '结束时间',
31   - `invalid_time` datetime NULL DEFAULT NULL COMMENT '失效时间',
32   - `delete_time` datetime NULL DEFAULT NULL COMMENT '删除时间',
33   - `time_limited_discount` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储',
34   - `full_privilege` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储',
35   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
36   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
37   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
38   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
39   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
40   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
41   - PRIMARY KEY (`id`) USING BTREE
42   -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '促销活动';
43   -
44   --- ----------------------------
45   --- Records of market_activity
46   --- ----------------------------
47   -BEGIN;
48   -COMMIT;
49   -
50   --- ----------------------------
51   --- Table structure for market_banner
52   --- ----------------------------
53   -DROP TABLE IF EXISTS `market_banner`;
54   -CREATE TABLE `market_banner` (
55   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Banner编号',
56   - `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'Banner标题',
57   - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片URL',
58   - `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态',
59   - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '跳转地址',
60   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
61   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
62   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
63   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
64   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
65   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
66   - `sort` tinyint NULL DEFAULT NULL COMMENT '排序',
67   - `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
68   - PRIMARY KEY (`id`) USING BTREE
69   -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Banner管理';
70   -
71   --- ----------------------------
72   --- Records of market_banner
73   --- ----------------------------
74   -BEGIN;
75   -COMMIT;
76   -
77   --- ----------------------------
78   --- Table structure for member_address
79   --- ----------------------------
80   -DROP TABLE IF EXISTS `member_address`;
81   -CREATE TABLE `member_address` (
82   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '收件地址编号',
83   - `user_id` bigint NOT NULL COMMENT '用户编号',
84   - `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件人名称',
85   - `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '手机号',
86   - `area_id` bigint NOT NULL COMMENT '地区编码',
87   - `post_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '邮编',
88   - `detail_address` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件详细地址',
89   - `defaulted` bit(1) NOT NULL COMMENT '是否默认',
90   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
91   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
92   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
93   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
94   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
95   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
96   - PRIMARY KEY (`id`) USING BTREE,
97   - INDEX `idx_userId`(`user_id` ASC) USING BTREE
98   -) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址';
99   -
100   --- ----------------------------
101   --- Records of member_address
102   --- ----------------------------
103   -BEGIN;
104   -INSERT INTO `ruoyi-vue-pro`.`member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `post_code`, `detail_address`, `defaulted`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 1, 'yunai', '15601691300', 610632, '200000', '芋道源码 233 号 666 室', b'1', '1', '2022-08-01 22:46:35', '1', '2022-08-01 22:46:35', b'0', 1);
105   -COMMIT;
106   -
107   --- ----------------------------
108   --- Table structure for product_brand
109   --- ----------------------------
110   -DROP TABLE IF EXISTS `product_brand`;
111   -CREATE TABLE `product_brand` (
112   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号',
113   - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌名称',
114   - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌图片',
115   - `sort` int NULL DEFAULT 0 COMMENT '品牌排序',
116   - `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '品牌描述',
117   - `status` tinyint NOT NULL COMMENT '状态',
118   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
119   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
120   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
121   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
122   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
123   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
124   - PRIMARY KEY (`id`) USING BTREE
125   -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品品牌';
126   -
127   --- ----------------------------
128   --- Records of product_brand
129   --- ----------------------------
130   -BEGIN;
131   -INSERT INTO `ruoyi-vue-pro`.`product_brand` (`id`, `name`, `pic_url`, `sort`, `description`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '苹果', 'http://test.yudao.iocoder.cn/e3726713fa56db5717c78c011762fcc7a251db12735c3581470638b8e1fa17e2.jpeg', 0, '是上市', 0, '1', '2022-07-30 22:12:18', '1', '2022-07-30 22:13:55', b'0', 1);
132   -COMMIT;
133   -
134   --- ----------------------------
135   --- Table structure for product_category
136   --- ----------------------------
137   -DROP TABLE IF EXISTS `product_category`;
138   -CREATE TABLE `product_category` (
139   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号',
140   - `parent_id` bigint NOT NULL COMMENT '父分类编号',
141   - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类名称',
142   - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '移动端分类图',
143   - `big_pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PC 端分类图',
144   - `sort` int DEFAULT '0' COMMENT '分类排序',
145   - `status` tinyint NOT NULL COMMENT '开启状态',
146   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
147   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
148   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
149   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
150   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
151   - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
152   - PRIMARY KEY (`id`) USING BTREE
153   -) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类';
154   -
155   --- ----------------------------
156   --- Records of product_category
157   --- ----------------------------
158   -BEGIN;
159   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 0, '电脑办公', 'http://test.yudao.iocoder.cn/122d548e1b3cd5dec72fe8075c6977a70f9cc13541a684ab3685f1b5df42f6bd.jpeg', '', 300, 0, '1', '2022-07-30 16:36:35', '1', '2022-07-30 20:27:16', b'0', 1);
160   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, 1, '笔记本', 'http://test.yudao.iocoder.cn/72713ac7b947600a019a18786ed0e6562e8692e253dbd35110a0a85c2469bbec.jpg', '', 310, 0, '1', '2022-07-30 16:38:09', '1', '2022-07-30 16:38:09', b'0', 1);
161   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3, 1, '游戏本', 'http://test.yudao.iocoder.cn/287c50dd9f5f575f57329a0c57b2095be6d1aeba83867b905fe549f54a296feb.jpg', '', 312, 0, '1', '2022-07-30 16:39:09', '1', '2022-07-30 20:26:59', b'0', 1);
162   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (4, 0, '手机', 'http://test.yudao.iocoder.cn/e1b63900c78dbb661b3e383960cee5cfea7e1dd2fb22cff2e317ff025faaf8b2.jpeg', '', 313, 0, '1', '2022-07-30 16:40:00', '1', '2022-07-30 16:40:09', b'0', 1);
163   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, 4, '5G手机', 'http://test.yudao.iocoder.cn/3af6557ac7def6423f046f5b2e920b644793420b466959aaa996a2e19068bbde.jpeg', '', 314, 0, '1', '2022-07-30 16:43:00', '1', '2022-07-30 16:43:00', b'0', 1);
164   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (6, 4, '游戏手机', 'http://test.yudao.iocoder.cn/964fe9ccd1710d64ede261dc36d231918a017641986c15293c367f9f66d94d05.jpeg', '', 315, 0, '1', '2022-07-30 16:43:44', '1', '2022-07-30 16:43:44', b'0', 1);
165   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (7, 5, '厉害的 5G 手机', 'http://test.yudao.iocoder.cn/b287122f277838e8de368769b96217918605743bc45f3a29bda3cc7359dc66e1.png', '', '123', 0, '1', '2022-07-30 20:38:09', '1', '2022-07-30 20:38:09', b'0', 1);
166   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (15, 0, '服装鞋包', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/a23f732db55e6adbc608f4b6cf2b0ab50db6d9147af0ee267a315805a596e175.jpg', '', 100, 0, '1', '2023-04-25 16:57:05', '1', '2023-04-25 17:08:26', b'0', 1);
167   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (16, 15, '时尚女装', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/aa8d5c44ac0390ab398bae0dc8883575e3cb57594f9ed00248febe8e3d7484d1.png', '', 200, 0, '1', '2023-04-25 17:09:00', '1', '2023-04-25 17:09:00', b'0', 1);
168   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (17, 15, '精品男装', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/b0c166c0846fa2280b4a02431e2ac2e2363f2d2a6b608598f34b067a5ccf1245.png', '', 100, 0, '1', '2023-04-25 17:09:33', '1', '2023-04-25 17:09:33', b'0', 1);
169   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (18, 15, '箱包', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/8682928caa2a5a49b380ac93059adc435099873cdf646084f31cea79d5c27f40.png', '', 80, 0, '1', '2023-04-25 17:09:51', '1', '2023-04-25 17:09:51', b'0', 1);
170   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (19, 15, '西服', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c202fa79f2fbe188cfdf40b107c7eca89c548a5c4b0047e26b7a6445c470615a.jpg', '', 0, 0, '1', '2023-04-25 17:10:15', '1', '2023-04-25 17:10:15', b'0', 1);
171   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (20, 15, '配饰', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/51bf43fcad0b947f5fa377356fb7034b47223fdbcec241d50e6e60a9be498730.jpg', '', 0, 0, '1', '2023-04-25 17:10:56', '1', '2023-04-25 17:10:56', b'0', 1);
172   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 15, '美妆工具', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c3cd6735cf157c218bc32ece312fd90cb2130c437dc9ec61d4030681d6ba4efb.png', '', 0, 0, '1', '2023-04-25 17:11:15', '1', '2023-04-25 17:11:24', b'0', 1);
173   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (22, 0, '网络盒子', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/74656bb8bc988c0419e0dbc613eda24a03956b950452b3565527301a5782db3a.png', '', 50, 0, '1', '2023-04-25 17:12:13', '1', '2023-04-25 17:12:13', b'0', 1);
174   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 22, '尿裤湿巾', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/20162f22d8f6b427f0d6f1678c9fbb7bf0c1b70768bdc86101bee8b5e13bec5a.jpeg', '', 0, 0, '1', '2023-04-25 17:12:42', '1', '2023-04-25 17:12:42', b'0', 1);
175   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 15, '宠物主粮', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/383729ba05711c400f9e44db11a63603af0fdbc99e58cd7b40e9296ca4e0510e.jpg', '', 0, 0, '1', '2023-04-25 17:13:09', '1', '2023-04-25 17:13:09', b'0', 1);
176   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (25, 0, '家电电器', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c8a34dc2688fd4d2c95b5f49888865db1c88fd3bde153e3f7f0bcd4ff9971c96.png', '', 50, 0, '1', '2023-04-25 17:13:43', '1', '2023-04-25 17:13:43', b'0', 1);
177   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (26, 25, '封口/封杯机', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/1c0c208cfcf871c146006d97f95ae4fcd14d8a2deb3eabe3696367af61cb5e69.png', '', 60, 0, '1', '2023-04-25 17:14:39', '1', '2023-04-25 17:14:39', b'0', 1);
178   -INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (27, 25, '空调', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/d578e1e60b2dc3efe70643d25a8b2150dabfecd658fdb2fafcdb786d525f66d1.png', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/34ed55f822ad25ab445e6b396dcd61a7d119882ef19f85f0e24742911d896959.jpeg', 60, 0, '1', '2023-04-25 17:15:12', '1', '2023-04-25 17:17:04', b'0', 1);
179   -COMMIT;
180   -
181   --- ----------------------------
182   --- Table structure for product_property
183   --- ----------------------------
184   -DROP TABLE IF EXISTS `product_property`;
185   -CREATE TABLE `product_property` (
186   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
187   - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格名称',
188   - `status` tinyint DEFAULT NULL COMMENT '状态: 0 开启 ,1 禁用',
189   - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
190   - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
191   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
192   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
193   - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
194   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
195   - `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
196   - PRIMARY KEY (`id`) USING BTREE,
197   - KEY `idx_name` (`name`(32)) USING BTREE COMMENT '规格名称索引'
198   -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格名称';
199   -
200   --- ----------------------------
201   --- Records of product_property
202   --- ----------------------------
203   -BEGIN;
204   -COMMIT;
205   -
206   --- ----------------------------
207   --- Table structure for product_property_value
208   --- ----------------------------
209   -DROP TABLE IF EXISTS `product_property_value`;
210   -CREATE TABLE `product_property_value` (
211   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
212   - `property_id` bigint DEFAULT NULL COMMENT '规格键id',
213   - `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格值名字',
214   - `status` tinyint DEFAULT NULL COMMENT '状态: 1 开启 ,2 禁用',
215   - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
216   - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
217   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
218   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
219   - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
220   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
221   - `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
222   - PRIMARY KEY (`id`) USING BTREE
223   -) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格值';
224   -
225   --- ----------------------------
226   --- Records of product_property_value
227   --- ----------------------------
228   -BEGIN;
229   -COMMIT;
230   -
231   --- ----------------------------
232   --- Table structure for product_sku
233   --- ----------------------------
234   -DROP TABLE IF EXISTS `product_sku`;
235   -CREATE TABLE `product_sku` (
236   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
237   - `spu_id` bigint NOT NULL COMMENT 'spu编号',
238   - `properties` varchar(512) DEFAULT NULL COMMENT '属性数组,JSON 格式 [{propertId: , valueId: }, {propertId: , valueId: }]',
239   - `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位:分',
240   - `market_price` int DEFAULT NULL COMMENT '市场价,单位:分',
241   - `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分',
242   - `bar_code` varchar(64) DEFAULT NULL COMMENT 'SKU 的条形码',
243   - `pic_url` varchar(256) NOT NULL COMMENT '图片地址',
244   - `stock` int DEFAULT NULL COMMENT '库存',
245   - `weight` double DEFAULT NULL COMMENT '商品重量,单位:kg 千克',
246   - `volume` double DEFAULT NULL COMMENT '商品体积,单位:m^3 平米',
247   - `sub_commission_first_price` int DEFAULT NULL COMMENT '一级分销的佣金,单位:分',
248   - `sub_commission_second_price` int DEFAULT NULL COMMENT '二级分销的佣金,单位:分',
249   - `sales_count` int DEFAULT NULL COMMENT '商品销量',
250   - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
251   - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
252   - `creator` varchar(64) DEFAULT NULL COMMENT '创建人',
253   - `updater` double(64,0) DEFAULT NULL COMMENT '更新人',
254   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
255   - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
256   -PRIMARY KEY (`id`) USING BTREE
257   -) ENGINE=InnoDB COMMENT='商品sku';
258   -
259   --- ----------------------------
260   --- Records of product_sku
261   --- ----------------------------
262   -BEGIN;
263   -COMMIT;
264   -
265   --- ----------------------------
266   --- Table structure for product_spu
267   --- ----------------------------
268   -DROP TABLE IF EXISTS `product_spu`;
269   -CREATE TABLE `product_spu` (
270   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品 SPU 编号,自增',
271   - `name` varchar(128) NOT NULL COMMENT '商品名称',
272   - `keyword` varchar(256) DEFAULT NULL COMMENT '关键字',
273   - `introduction` varchar(256) COMMENT '商品简介',
274   - `description` text COMMENT '商品详情',
275   - `bar_code` varchar(64) DEFAULT NULL COMMENT '条形码',
276   - `category_id` bigint NOT NULL COMMENT '商品分类编号',
277   - `brand_id` int DEFAULT NULL COMMENT '商品品牌编号',
278   - `pic_url` varchar(256) NOT NULL COMMENT '商品封面图',
279   - `slider_pic_urls` varchar(2000) DEFAULT '' COMMENT '商品轮播图地址\n 数组,以逗号分隔\n 最多上传15张',
280   - `video_url` varchar(256) DEFAULT NULL COMMENT '商品视频',
281   - `unit` tinyint NOT NULL COMMENT '单位',
282   - `sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
283   - `status` tinyint NOT NULL COMMENT '商品状态: 0 上架(开启) 1 下架(禁用)-1 回收',
284   - `spec_type` bit(1) DEFAULT NULL COMMENT '规格类型:0 单规格 1 多规格',
285   - `price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位使用:分',
286   - `market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分',
287   - `cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分',
288   - `stock` int NOT NULL DEFAULT '0' COMMENT '库存',
289   - `delivery_template_id` bigint NOT NULL COMMENT '物流配置模板编号',
290   - `recommend_hot` bit(1) DEFAULT NULL COMMENT '是否热卖推荐: 0 默认 1 热卖',
291   - `recommend_benefit` bit(1) DEFAULT NULL COMMENT '是否优惠推荐: 0 默认 1 优选',
292   - `recommend_best` bit(1) DEFAULT NULL COMMENT '是否精品推荐: 0 默认 1 精品',
293   - `recommend_new` bit(1) DEFAULT NULL COMMENT '是否新品推荐: 0 默认 1 新品',
294   - `recommend_good` bit(1) DEFAULT NULL COMMENT '是否优品推荐',
295   - `give_integral` int NOT NULL COMMENT '赠送积分',
296   - `give_coupon_template_ids` varchar(512) DEFAULT '' COMMENT '赠送的优惠劵编号的数组',
297   - `sub_commission_type` bit(1) DEFAULT NULL COMMENT '分销类型',
298   - `activity_orders` varchar(16) NOT NULL DEFAULT '' COMMENT '活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团',
299   - `sales_count` int DEFAULT '0' COMMENT '商品销量',
300   - `virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量',
301   - `browse_count` int DEFAULT '0' COMMENT '商品点击量',
302   - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
303   - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
304   - `creator` varchar(64) DEFAULT NULL COMMENT '创建人',
305   - `updater` varchar(64) DEFAULT NULL COMMENT '更新人',
306   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
307   - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
308   - PRIMARY KEY (`id`) USING BTREE
309   -) ENGINE=InnoDB COMMENT='商品spu';
310   -
311   --- ----------------------------
312   --- Table structure for product_favorite
313   --- ----------------------------
314   -DROP TABLE IF EXISTS `product_favorite`;
315   -CREATE TABLE `product_favorite` (
316   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
317   - `spu_id` bigint NOT NULL COMMENT '商品 SPU 编号',
318   - `user_id` bigint NOT NULL COMMENT '用户id',
319   - `type` int(10) NOT NULL DEFAULT 1 COMMENT '类型1:收藏 2:点赞',
320   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
321   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
322   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
323   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
324   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
325   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
326   - PRIMARY KEY (`id`) USING BTREE
327   -) ENGINE=InnoDB COMMENT='商品收藏表';
328   -
329   --- Table structure for trade_delivery_express_template
330   --- ----------------------------
331   -DROP TABLE IF EXISTS `trade_delivery_express_template`;
332   -CREATE TABLE `trade_delivery_express_template` (
333   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
334   - `name` varchar(64) NOT NULL COMMENT '模板名称',
335   - `charge_mode` tinyint NOT NULL COMMENT '配送计费方式',
336   - `sort` int NOT NULL DEFAULT 0 COMMENT '排序',
337   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
338   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
339   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
340   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
341   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
342   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
343   - PRIMARY KEY (`id`) USING BTREE
344   -) ENGINE=InnoDB COMMENT='快递运费模板';
345   -
346   --- ----------------------------
347   --- Table structure for trade_delivery_express_template_free
348   --- ----------------------------
349   -DROP TABLE IF EXISTS `trade_delivery_express_template_free`;
350   -CREATE TABLE `trade_delivery_express_template_free` (
351   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
352   - `template_id` bigint NOT NULL COMMENT '快递运费模板编号',
353   - `area_ids` varchar(100) NOT NULL COMMENT '包邮区域 ids',
354   - `free_price` int NOT NULL COMMENT '包邮金额,单位:分',
355   - `free_count` int NOT NULL DEFAULT 0 COMMENT '包邮件数,',
356   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
357   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
358   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
359   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
360   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
361   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
362   - PRIMARY KEY (`id`) USING BTREE
363   -) ENGINE=InnoDB COMMENT='快递运费模板包邮配置';
364   -
365   --- ----------------------------
366   --- Table structure for trade_delivery_express_template_charge
367   --- ----------------------------
368   -DROP TABLE IF EXISTS `trade_delivery_express_template_charge`;
369   -CREATE TABLE `trade_delivery_express_template_charge` (
370   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
371   - `template_id` bigint NOT NULL COMMENT '快递运费模板编号',
372   - `area_ids` varchar(100) NOT NULL COMMENT '配送区域 ids',
373   - `charge_mode` tinyint NOT NULL COMMENT '配送计费方式',
374   - `start_count` double NOT NULL COMMENT '首件数量',
375   - `start_price` int NOT NULL COMMENT '起步价,单位:分',
376   - `extra_count` double NOT NULL COMMENT '续件数量',
377   - `extra_price` int NOT NULL COMMENT '额外价,单位:分',
378   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
379   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
380   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
381   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
382   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
383   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
384   - PRIMARY KEY (`id`) USING BTREE
385   -) ENGINE=InnoDB COMMENT='快递运费模板计费配置';
386   -
387   --- ----------------------------
388   --- Table structure for trade_delivery_pick_up_store
389   --- ----------------------------
390   -DROP TABLE IF EXISTS `trade_delivery_pick_up_store`;
391   -CREATE TABLE `trade_delivery_pick_up_store` (
392   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
393   - `name` varchar(64) NOT NULL COMMENT '门店名称',
394   - `introduction` varchar(256) COMMENT '门店简介',
395   - `phone` varchar(16) NOT NULL COMMENT '门店手机',
396   - `area_id` int NOT NULL COMMENT '区域编号',
397   - `detail_address` varchar(256) NOT NULL COMMENT '门店详细地址',
398   - `logo` varchar(256) NOT NULL COMMENT '门店 logo',
399   - `opening_time` time NOT NULL COMMENT '营业开始时间',
400   - `closing_time` time NOT NULL COMMENT '营业结束时间',
401   - `latitude` double NOT NULL COMMENT '纬度',
402   - `longitude` double NOT NULL COMMENT '经度',
403   - `status` tinyint NOT NULL DEFAULT 0 COMMENT '门店状态',
404   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
405   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
406   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
407   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
408   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
409   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
410   - PRIMARY KEY (`id`) USING BTREE
411   -) ENGINE=InnoDB COMMENT='自提门店';
412   -
413   --- ----------------------------
414   --- Table structure for trade_delivery_pick_up_store_staff
415   --- ----------------------------
416   -DROP TABLE IF EXISTS `trade_delivery_pick_up_store_staff`;
417   -CREATE TABLE `trade_delivery_pick_up_store_staff` (
418   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
419   - store_id bigint NOT NULL COMMENT '自提门店编号',
420   - `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
421   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
422   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
423   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
424   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
425   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
426   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
427   - PRIMARY KEY (`id`) USING BTREE
428   -) ENGINE=InnoDB COMMENT='自提门店店员';
429   -
430   --- ----------------------------
431   --- Table structure for trade_delivery_express
432   --- ----------------------------
433   -DROP TABLE IF EXISTS `trade_delivery_express`;
434   -CREATE TABLE `trade_delivery_express` (
435   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
436   - `code` varchar(64) NOT NULL COMMENT '快递公司编码',
437   - `name` varchar(64) NOT NULL COMMENT '快递公司名称',
438   - `logo` varchar(256) COMMENT '快递公司 logo',
439   - `sort` int NOT NULL DEFAULT 0 COMMENT '排序',
440   - `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
441   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
442   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
443   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
444   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
445   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
446   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
447   - PRIMARY KEY (`id`) USING BTREE
448   -) ENGINE=InnoDB COMMENT='快递公司';
449   -
450   --- ----------------------------
451   --- 页面装修表
452   --- ----------------------------
453   -DROP TABLE IF EXISTS `promotion_decorate_component`;
454   -CREATE TABLE `promotion_decorate_component` (
455   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
456   - `page_id` int NOT NULL COMMENT '所属页面id',
457   - `code` varchar(64) NOT NULL COMMENT '组件编码',
458   - `value` json NOT NULL COMMENT '组件值:json 格式。包含配置和数据',
459   - `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
460   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
461   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
462   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
463   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
464   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
465   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
466   - PRIMARY KEY (`id`) USING BTREE
467   -) ENGINE=InnoDB COMMENT='页面装修表';
468   -
469   -SET FOREIGN_KEY_CHECKS = 1;
470   -
471   -BEGIN;
472   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, '商品中心', '', 1, 60, 0, '/product', 'merchant', NULL, 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:26:19', b'0');
473   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, '商品分类', '', 2, 2, 2000, 'category', 'dict', 'mall/product/category/index', 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:23:37', b'0');
474   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, '分类查询', 'product:category:query', 3, 1, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
475   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, '分类创建', 'product:category:create', 3, 2, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
476   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, '分类更新', 'product:category:update', 3, 3, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
477   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, '分类删除', 'product:category:delete', 3, 4, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
478   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2007, '分类导出', 'product:category:export', 3, 5, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-30 13:52:13', b'1');
479   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, '商品品牌', '', 2, 1, 2000, 'brand', 'dashboard', 'mall/product/brand/index', 0, b'1', b'1', '', '2022-07-30 13:52:44', '1', '2022-07-30 22:23:43', b'0');
480   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, '品牌查询', 'product:brand:query', 3, 1, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
481   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, '品牌创建', 'product:brand:create', 3, 2, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
482   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, '品牌更新', 'product:brand:update', 3, 3, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
483   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, '品牌删除', 'product:brand:delete', 3, 4, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
484   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2013, '品牌导出', 'product:brand:export', 3, 5, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 14:15:00', b'1');
485   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, '商品管理', '', 2, 0, 2000, 'spu', 'link', 'mall/product/spu/index', 0, b'1', b'1', '', '2022-07-30 14:22:58', '1', '2022-07-30 22:26:35', b'0');
486   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, '商品查询', 'product:spu:query', 3, 1, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
487   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, '商品创建', 'product:spu:create', 3, 2, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
488   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, '商品更新', 'product:spu:update', 3, 3, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
489   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品删除', 'product:spu:delete', 3, 4, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
490   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品导出', 'product:spu:export', 3, 5, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
491   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, '规格管理', '', 2, 3, 2000, 'property', '', 'mall/product/property/index', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
492   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, '规格查询', 'product:property:query', 3, 1, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
493   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
494   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
495   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
496   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2024, '规格导出', 'product:property:export', 3, 5, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
497   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 1, 2000, 'brand', '', 'mall/market/banner/index', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
498   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
499   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
500   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
501   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
502   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, '配送管理', '', 1, 0, 2072, 'delivery', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:18:02', '1', '2023-05-18 09:48:48', b'0');
503   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, '快递发货', '', 1, 0, 2164, 'express', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:22:06', '1', '2023-05-18 09:22:06', b'0');
504   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, '门店自提', '', 1, 1, 2164, 'pick-up', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:23:14', '1', '2023-05-18 09:23:14', b'0');
505   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, '快递公司', '', 2, 0, 2165, 'express', '', 'mall/trade/delivery/express/index', 'Express', 0, b'1', b'1', b'1', '1', '2023-05-18 09:27:21', '1', '2023-05-18 22:11:14', b'0');
506   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, '快递公司查询', 'trade:delivery:express:query', 3, 1, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
507   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, '快递公司创建', 'trade:delivery:express:create', 3, 2, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
508   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, '快递公司更新', 'trade:delivery:express:update', 3, 3, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
509   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, '快递公司删除', 'trade:delivery:express:delete', 3, 4, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
510   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, '快递公司导出', 'trade:delivery:express:export', 3, 5, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
511   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, '快递运费模板导出', 'trade:delivery:express-template:export', 3, 5, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
512   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, '快递运费模板删除', 'trade:delivery:express-template:delete', 3, 4, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
513   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2176, '快递运费模板更新', 'trade:delivery:express-template:update', 3, 3, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
514   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, '快递运费模板创建', 'trade:delivery:express-template:create', 3, 2, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
515   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, '快递运费模板查询', 'trade:delivery:express-template:query', 3, 1, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
516   -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, '运费模版', 'trade:delivery:express-template:query', 2, 1, 2165, 'express-template', '', 'mall/trade/delivery/expressTemplate/index', 'ExpressTemplate', 0, b'1', b'1', b'1', '1', '2023-05-20 06:48:10', '1', '2023-05-20 06:48:29', b'0');
517   -BEGIN;
518   -
519   --- ----------------------------
520   --- 字典管理,添加商品单位字典 product_unit
521   --- ----------------------------
522   -BEGIN;
523   -INSERT INTO `ruoyi-vue-pro`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '商品单位', 'product_unit', 0, '', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00');
524   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '个', 1, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
525   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '件', 2, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
526   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '盒', 3, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
527   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '袋', 4, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
528   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '箱', 5, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
529   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '套', 6, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
530   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '包', 7, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
531   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '双', 8, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
532   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '卷', 9, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
533   -COMMIT;
534   -
535   --- ----------------------------
536   --- 数字字典,快递计费方式
537   --- ----------------------------
538   -BEGIN;
539   -INSERT INTO `ruoyi-vue-pro`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '快递计费方式', 'trade_delivery_express_charge_mode', 0, '用于商城交易模块配送管理', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00');
540   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0');
541   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0');
542   -INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0');
543   -COMMIT;
544   -
545   --- ----------------------------
546   --- 门店管理 菜单
547   --- ----------------------------
548   -BEGIN;
549   -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2179, '门店管理', '', 2, 1, 2166, 'pick-up-store', '', 'mall/trade/delivery/pickUpStore/index', 'PickUpStore', 0, b'1', b'1', b'1', '1', '2023-05-25 10:50:00', '1', '2023-05-25 10:50:00', b'0');
550   -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2180, '自提门店查询', 'trade:delivery:pick-up-store:query', 3, 1, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
551   -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2181, '自提门店创建', 'trade:delivery:pick-up-store:create', 3, 2, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
552   -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2182, '自提门店更新', 'trade:delivery:pick-up-store:update', 3, 3, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
553   -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2183, '自提门店删除', 'trade:delivery:pick-up-store:delete', 3, 4, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
554   -INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2184, '自提门店导出', 'trade:delivery:pick-up-store:export', 3, 5, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
555   -COMMIT;
sql/mysql/ruoyi-vue-pro.sql
... ... @@ -876,294 +876,6 @@ BEGIN;
876 876 COMMIT;
877 877  
878 878 -- ----------------------------
879   --- Table structure for pay_app
880   --- ----------------------------
881   -DROP TABLE IF EXISTS `pay_app`;
882   -CREATE TABLE `pay_app` (
883   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '应用编号',
884   - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用名',
885   - `status` tinyint NOT NULL COMMENT '开启状态',
886   - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
887   - `pay_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付结果的回调地址',
888   - `refund_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款结果的回调地址',
889   - `merchant_id` bigint NOT NULL COMMENT '商户编号',
890   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
891   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
892   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
893   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
894   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
895   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
896   - PRIMARY KEY (`id`) USING BTREE
897   -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付应用信息';
898   -
899   --- ----------------------------
900   --- Records of pay_app
901   --- ----------------------------
902   -BEGIN;
903   -COMMIT;
904   -
905   --- ----------------------------
906   --- Table structure for pay_channel
907   --- ----------------------------
908   -DROP TABLE IF EXISTS `pay_channel`;
909   -CREATE TABLE `pay_channel` (
910   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商户编号',
911   - `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
912   - `status` tinyint NOT NULL COMMENT '开启状态',
913   - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
914   - `fee_rate` double NOT NULL DEFAULT 0 COMMENT '渠道费率,单位:百分比',
915   - `merchant_id` bigint NOT NULL COMMENT '商户编号',
916   - `app_id` bigint NOT NULL COMMENT '应用编号',
917   - `config` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置',
918   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
919   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
920   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
921   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
922   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
923   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
924   - PRIMARY KEY (`id`) USING BTREE
925   -) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付渠道\n';
926   -
927   --- ----------------------------
928   --- Records of pay_channel
929   --- ----------------------------
930   -BEGIN;
931   -COMMIT;
932   -
933   --- ----------------------------
934   --- Table structure for pay_demo_order
935   --- ----------------------------
936   -DROP TABLE IF EXISTS `pay_demo_order`;
937   -CREATE TABLE `pay_demo_order` (
938   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号',
939   - `user_id` bigint UNSIGNED NOT NULL COMMENT '用户编号',
940   - `spu_id` bigint NOT NULL COMMENT '商品编号',
941   - `spu_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '商品名字',
942   - `price` int NOT NULL COMMENT '价格,单位:分',
943   - `payed` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]',
944   - `pay_order_id` bigint NULL DEFAULT NULL COMMENT '支付订单编号',
945   - `pay_channel_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '支付成功的支付渠道',
946   - `pay_time` datetime NULL DEFAULT NULL COMMENT '订单支付时间',
947   - `pay_refund_id` bigint NULL DEFAULT NULL COMMENT '退款订单编号',
948   - `refund_price` int NOT NULL DEFAULT 0 COMMENT '退款金额,单位:分',
949   - `refund_time` datetime NULL DEFAULT NULL COMMENT '退款时间',
950   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
951   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
952   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
953   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
954   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
955   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
956   - PRIMARY KEY (`id`) USING BTREE
957   -) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '示例订单\n';
958   -
959   --- ----------------------------
960   --- Records of pay_demo_order
961   --- ----------------------------
962   -BEGIN;
963   -COMMIT;
964   -
965   --- ----------------------------
966   --- Table structure for pay_merchant
967   --- ----------------------------
968   -DROP TABLE IF EXISTS `pay_merchant`;
969   -CREATE TABLE `pay_merchant` (
970   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商户编号',
971   - `no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户号',
972   - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户全称',
973   - `short_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户简称',
974   - `status` tinyint NOT NULL COMMENT '开启状态',
975   - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
976   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
977   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
978   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
979   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
980   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
981   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
982   - PRIMARY KEY (`id`) USING BTREE
983   -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付商户信息';
984   -
985   --- ----------------------------
986   --- Records of pay_merchant
987   --- ----------------------------
988   -BEGIN;
989   -COMMIT;
990   -
991   --- ----------------------------
992   --- Table structure for pay_notify_log
993   --- ----------------------------
994   -DROP TABLE IF EXISTS `pay_notify_log`;
995   -CREATE TABLE `pay_notify_log` (
996   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志编号',
997   - `task_id` bigint NOT NULL COMMENT '通知任务编号',
998   - `notify_times` tinyint NOT NULL COMMENT '第几次被通知',
999   - `response` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '请求参数',
1000   - `status` tinyint NOT NULL COMMENT '通知状态',
1001   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
1002   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
1003   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
1004   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1005   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1006   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1007   - PRIMARY KEY (`id`) USING BTREE
1008   -) ENGINE = InnoDB AUTO_INCREMENT = 371964 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付通知 App 的日志';
1009   -
1010   --- ----------------------------
1011   --- Records of pay_notify_log
1012   --- ----------------------------
1013   -BEGIN;
1014   -COMMIT;
1015   -
1016   --- ----------------------------
1017   --- Table structure for pay_notify_task
1018   --- ----------------------------
1019   -DROP TABLE IF EXISTS `pay_notify_task`;
1020   -CREATE TABLE `pay_notify_task` (
1021   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号',
1022   - `merchant_id` bigint NOT NULL COMMENT '商户编号',
1023   - `app_id` bigint NOT NULL COMMENT '应用编号',
1024   - `type` tinyint NOT NULL COMMENT '通知类型',
1025   - `data_id` bigint NOT NULL COMMENT '数据编号',
1026   - `status` tinyint NOT NULL COMMENT '通知状态',
1027   - `merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号',
1028   - `next_notify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '下一次通知时间',
1029   - `last_execute_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次执行时间',
1030   - `notify_times` tinyint NOT NULL COMMENT '当前通知次数',
1031   - `max_notify_times` tinyint NOT NULL COMMENT '最大可通知次数',
1032   - `notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知地址',
1033   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
1034   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
1035   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
1036   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1037   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1038   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1039   - PRIMARY KEY (`id`) USING BTREE
1040   -) ENGINE = InnoDB AUTO_INCREMENT = 151 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商户支付、退款等的通知\n';
1041   -
1042   --- ----------------------------
1043   --- Records of pay_notify_task
1044   --- ----------------------------
1045   -BEGIN;
1046   -COMMIT;
1047   -
1048   --- ----------------------------
1049   --- Table structure for pay_order
1050   --- ----------------------------
1051   -DROP TABLE IF EXISTS `pay_order`;
1052   -CREATE TABLE `pay_order` (
1053   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付订单编号',
1054   - `merchant_id` bigint NOT NULL COMMENT '商户编号',
1055   - `app_id` bigint NOT NULL COMMENT '应用编号',
1056   - `channel_id` bigint NULL DEFAULT NULL COMMENT '渠道编号',
1057   - `channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道编码',
1058   - `merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号',
1059   - `subject` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品标题',
1060   - `body` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品描述',
1061   - `notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知地址',
1062   - `notify_status` tinyint NOT NULL COMMENT '通知商户支付结果的回调状态',
1063   - `amount` bigint NOT NULL COMMENT '支付金额,单位:分',
1064   - `channel_fee_rate` double NULL DEFAULT 0 COMMENT '渠道手续费,单位:百分比',
1065   - `channel_fee_amount` bigint NULL DEFAULT 0 COMMENT '渠道手续金额,单位:分',
1066   - `status` tinyint NOT NULL COMMENT '支付状态',
1067   - `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP',
1068   - `expire_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单失效时间',
1069   - `success_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单支付成功时间',
1070   - `notify_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单支付通知时间',
1071   - `success_extension_id` bigint NULL DEFAULT NULL COMMENT '支付成功的订单拓展单编号',
1072   - `refund_status` tinyint NOT NULL COMMENT '退款状态',
1073   - `refund_times` tinyint NOT NULL COMMENT '退款次数',
1074   - `refund_amount` bigint NOT NULL COMMENT '退款总金额,单位:分',
1075   - `channel_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道用户编号',
1076   - `channel_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道订单号',
1077   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
1078   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
1079   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
1080   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1081   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1082   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1083   - PRIMARY KEY (`id`) USING BTREE
1084   -) ENGINE = InnoDB AUTO_INCREMENT = 171 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付订单\n';
1085   -
1086   --- ----------------------------
1087   --- Records of pay_order
1088   --- ----------------------------
1089   -BEGIN;
1090   -COMMIT;
1091   -
1092   --- ----------------------------
1093   --- Table structure for pay_order_extension
1094   --- ----------------------------
1095   -DROP TABLE IF EXISTS `pay_order_extension`;
1096   -CREATE TABLE `pay_order_extension` (
1097   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付订单编号',
1098   - `no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付订单号',
1099   - `order_id` bigint NOT NULL COMMENT '支付订单编号',
1100   - `channel_id` bigint NOT NULL COMMENT '渠道编号',
1101   - `channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
1102   - `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP',
1103   - `status` tinyint NOT NULL COMMENT '支付状态',
1104   - `channel_extras` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道的额外参数',
1105   - `channel_notify_data` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道异步通知的内容',
1106   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
1107   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
1108   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
1109   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1110   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1111   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1112   - PRIMARY KEY (`id`) USING BTREE
1113   -) ENGINE = InnoDB AUTO_INCREMENT = 383 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付订单\n';
1114   -
1115   --- ----------------------------
1116   --- Records of pay_order_extension
1117   --- ----------------------------
1118   -BEGIN;
1119   -COMMIT;
1120   -
1121   --- ----------------------------
1122   --- Table structure for pay_refund
1123   --- ----------------------------
1124   -DROP TABLE IF EXISTS `pay_refund`;
1125   -CREATE TABLE `pay_refund` (
1126   - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付退款编号',
1127   - `merchant_id` bigint NOT NULL COMMENT '商户编号',
1128   - `app_id` bigint NOT NULL COMMENT '应用编号',
1129   - `channel_id` bigint NOT NULL COMMENT '渠道编号',
1130   - `channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
1131   - `order_id` bigint NOT NULL COMMENT '支付订单编号 pay_order 表id',
1132   - `trade_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易订单号 pay_extension 表no 字段',
1133   - `merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号(商户系统生成)',
1134   - `merchant_refund_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户退款订单号(商户系统生成)',
1135   - `notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知商户地址',
1136   - `notify_status` tinyint NOT NULL COMMENT '通知商户退款结果的回调状态',
1137   - `status` tinyint NOT NULL COMMENT '退款状态',
1138   - `type` tinyint NOT NULL COMMENT '退款类型(部分退款,全部退款)',
1139   - `pay_amount` bigint NOT NULL COMMENT '支付金额,单位分',
1140   - `refund_amount` bigint NOT NULL COMMENT '退款金额,单位分',
1141   - `reason` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款原因',
1142   - `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户 IP',
1143   - `channel_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道订单号,pay_order 中的channel_order_no 对应',
1144   - `channel_refund_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道退款单号,渠道返回',
1145   - `channel_error_code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误码',
1146   - `channel_error_msg` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误信息',
1147   - `channel_extras` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道的额外参数',
1148   - `expire_time` datetime NULL DEFAULT NULL COMMENT '退款失效时间',
1149   - `success_time` datetime NULL DEFAULT NULL COMMENT '退款成功时间',
1150   - `notify_time` datetime NULL DEFAULT NULL COMMENT '退款通知时间',
1151   - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
1152   - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
1153   - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
1154   - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
1155   - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
1156   - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
1157   - PRIMARY KEY (`id`) USING BTREE
1158   -) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '退款订单';
1159   -
1160   --- ----------------------------
1161   --- Records of pay_refund
1162   --- ----------------------------
1163   -BEGIN;
1164   -COMMIT;
1165   -
1166   --- ----------------------------
1167 879 -- Table structure for system_dept
1168 880 -- ----------------------------
1169 881 DROP TABLE IF EXISTS `system_dept`;
... ...
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/util/ServiceExceptionUtil.java
... ... @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.common.exception.util;
2 2  
3 3 import cn.iocoder.yudao.framework.common.exception.ErrorCode;
4 4 import cn.iocoder.yudao.framework.common.exception.ServiceException;
  5 +import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
5 6 import com.google.common.annotations.VisibleForTesting;
6 7 import lombok.extern.slf4j.Slf4j;
7 8  
... ... @@ -80,6 +81,10 @@ public class ServiceExceptionUtil {
80 81 return new ServiceException(code, message);
81 82 }
82 83  
  84 + public static ServiceException invalidParamException(String messagePattern, Object... params) {
  85 + return exception0(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), messagePattern, params);
  86 + }
  87 +
83 88 // ========== 格式化方法 ==========
84 89  
85 90 /**
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayOrderNotifyRespDTO.java
... ... @@ -35,14 +35,4 @@ public class PayOrderNotifyRespDTO {
35 35 */
36 36 private LocalDateTime successTime;
37 37  
38   - /**
39   - * TODO @jason 结合其他的渠道定义成枚举,
40   - *
41   - * alipay
42   - * TRADE_CLOSED,未付款交易超时关闭,或支付完成后全额退款。
43   - * TRADE_SUCCESS, 交易支付成功
44   - * TRADE_FINISHED 交易结束,不可退款。
45   - */
46   - private String tradeStatus;
47   -
48 38 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayRefundNotifyRespDTO.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.dto.notify;
2 2  
3   -import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum;
  3 +import cn.iocoder.yudao.framework.pay.core.enums.refund.PayNotifyRefundStatusEnum;
4 4 import lombok.Builder;
5 5 import lombok.Data;
6 6 import lombok.ToString;
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.dto.order;
2 2  
3   -import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
  3 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
4 4 import lombok.Data;
5 5 import org.hibernate.validator.constraints.Length;
6 6 import org.hibernate.validator.constraints.URL;
... ... @@ -8,7 +8,6 @@ import org.hibernate.validator.constraints.URL;
8 8 import javax.validation.constraints.DecimalMin;
9 9 import javax.validation.constraints.NotEmpty;
10 10 import javax.validation.constraints.NotNull;
11   -import java.awt.*;
12 11 import java.time.LocalDateTime;
13 12 import java.util.Map;
14 13  
... ... @@ -85,7 +84,7 @@ public class PayOrderUnifiedReqDTO {
85 84 *
86 85 * 如果不传递,则每个支付渠道使用默认的方式
87 86 *
88   - * 枚举 {@link PayDisplayModeEnum}
  87 + * 枚举 {@link PayOrderDisplayModeEnum}
89 88 */
90 89 private String displayMode;
91 90  
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedRespDTO.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.dto.order;
2 2  
3   -import lombok.AllArgsConstructor;
  3 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
  4 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum;
4 5 import lombok.Data;
5 6  
6 7 /**
... ... @@ -13,6 +14,8 @@ public class PayOrderUnifiedRespDTO {
13 14  
14 15 /**
15 16 * 展示模式
  17 + *
  18 + * 枚举 {@link PayOrderDisplayModeEnum} 类
16 19 */
17 20 private String displayMode;
18 21 /**
... ... @@ -20,4 +23,20 @@ public class PayOrderUnifiedRespDTO {
20 23 */
21 24 private String displayContent;
22 25  
  26 + /**
  27 + * 支付状态
  28 + *
  29 + * 枚举 {@link PayOrderStatusRespEnum} 类
  30 + */
  31 + private Integer status;
  32 +
  33 + public PayOrderUnifiedRespDTO(String displayMode, String displayContent) {
  34 + this(displayMode, displayContent, PayOrderStatusRespEnum.WAITING.getStatus());
  35 + }
  36 +
  37 + public PayOrderUnifiedRespDTO(String displayMode, String displayContent, Integer status) {
  38 + this.displayMode = displayMode;
  39 + this.displayContent = displayContent;
  40 + this.status = status;
  41 + }
23 42 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedRespDTO.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.dto.refund;
2 2  
3   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelRefundRespEnum;
4 3 import lombok.AllArgsConstructor;
5 4 import lombok.Builder;
6 5 import lombok.Data;
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/exception/PayException.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.exception;
  2 +
  3 +import lombok.Data;
  4 +import lombok.EqualsAndHashCode;
  5 +
  6 +/**
  7 + * 支付系统异常 Exception
  8 + */
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +public class PayException extends RuntimeException {
  12 +
  13 + public PayException(Throwable cause) {
  14 + super(cause);
  15 + }
  16 +
  17 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl;
2 2  
3   -import cn.hutool.core.date.LocalDateTimeUtil;
  3 +import cn.iocoder.yudao.framework.common.exception.ServiceException;
4 4 import cn.iocoder.yudao.framework.pay.core.client.PayClient;
5 5 import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
6 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
7 7 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
8 8 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
9 9 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
10   -import com.alipay.api.AlipayResponse;import lombok.extern.slf4j.Slf4j;
  10 +import cn.iocoder.yudao.framework.pay.core.client.exception.PayException;
  11 +import lombok.extern.slf4j.Slf4j;
11 12  
12 13 import javax.validation.Validation;
13   -import java.time.LocalDateTime;
14 14  
15   -import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER;
16   -import static cn.hutool.core.date.DatePattern.NORM_DATETIME_MS_FORMATTER;
17   -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
18   -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
19 15 import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
20   -import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.PAY_EXCEPTION;
21 16  
22 17 /**
23 18 * 支付客户端的抽象类,提供模板方法,减少子类的冗余代码
... ... @@ -78,16 +73,19 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
78 73 @Override
79 74 public final PayOrderUnifiedRespDTO unifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
80 75 Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO);
81   - // 执行短信发送
82   - PayOrderUnifiedRespDTO result;
  76 + // 执行统一下单
  77 + PayOrderUnifiedRespDTO resp;
83 78 try {
84   - result = doUnifiedOrder(reqDTO);
  79 + resp = doUnifiedOrder(reqDTO);
  80 + } catch (ServiceException ex) {
  81 + // 业务异常,都是实现类已经翻译,所以直接抛出即可
  82 + throw ex;
85 83 } catch (Throwable ex) {
86   - // 打印异常日志
87   - log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), ex);
  84 + // 系统异常,则包装成 PayException 异常抛出
  85 + log.error("[unifiedRefund][request({}) 发起支付异常]", toJsonString(reqDTO), ex);
88 86 throw buildException(ex);
89 87 }
90   - return result;
  88 + return resp;
91 89 }
92 90  
93 91 protected abstract PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO)
... ... @@ -95,12 +93,17 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
95 93  
96 94 @Override
97 95 public PayRefundUnifiedRespDTO unifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
  96 + Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO);
  97 + // 执行统一退款
98 98 PayRefundUnifiedRespDTO resp;
99 99 try {
100 100 resp = doUnifiedRefund(reqDTO);
101   - } catch (Throwable ex) {
102   - // 记录异常日志
103   - log.error("[unifiedRefund][request({}) 发起退款失败]", toJsonString(reqDTO), ex);
  101 + } catch (ServiceException ex) {
  102 + // 业务异常,都是实现类已经翻译,所以直接抛出即可
  103 + throw ex;
  104 + } catch (Throwable ex) {
  105 + // 系统异常,则包装成 PayException 异常抛出
  106 + log.error("[unifiedRefund][request({}) 发起退款异常]", toJsonString(reqDTO), ex);
104 107 throw buildException(ex);
105 108 }
106 109 return resp;
... ... @@ -110,32 +113,11 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
110 113  
111 114 // ========== 各种工具方法 ==========
112 115  
113   - private RuntimeException buildException(Throwable ex) {
114   - if (ex instanceof RuntimeException) {
115   - return (RuntimeException) ex;
116   - }
117   - throw new RuntimeException(ex);
118   - }
119   -
120   - protected void validateSuccess(AlipayResponse response) {
121   - if (response.isSuccess()) {
122   - return;
  116 + private PayException buildException(Throwable ex) {
  117 + if (ex instanceof PayException) {
  118 + return (PayException) ex;
123 119 }
124   - throw exception0(PAY_EXCEPTION.getCode(), response.getSubMsg());
125   - }
126   -
127   - protected String formatAmount(Integer amount) {
128   - return String.valueOf(amount / 100.0);
129   - }
130   -
131   - protected String formatTime(LocalDateTime time) {
132   - // "yyyy-MM-dd HH:mm:ss"
133   - return LocalDateTimeUtil.format(time, NORM_DATETIME_FORMATTER);
134   - }
135   -
136   - protected LocalDateTime parseTime(String str) {
137   - // "yyyy-MM-dd HH:mm:ss"
138   - return LocalDateTimeUtil.parse(str, NORM_DATETIME_FORMATTER);
  120 + throw new PayException(ex);
139 121 }
140 122  
141 123 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java
... ... @@ -5,11 +5,8 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient;
5 5 import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
6 6 import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
7 7 import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*;
8   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXLitePayClient;
9   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXNativePayClient;
10   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig;
11   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient;
12   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
  8 +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.*;
  9 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
13 10 import lombok.extern.slf4j.Slf4j;
14 11  
15 12 import java.util.concurrent.ConcurrentHashMap;
... ... @@ -58,12 +55,15 @@ public class PayClientFactoryImpl implements PayClientFactory {
58 55 PayChannelEnum channelEnum = PayChannelEnum.getByCode(channelCode);
59 56 Assert.notNull(channelEnum, String.format("支付渠道(%s) 为空", channelEnum));
60 57 // 创建客户端
61   - // TODO @芋艿 WX_LITE WX_APP 如果不添加在 项目启动的时候去初始化会报错无法启动。所以我手动加了两个,具体需要你来配
62 58 switch (channelEnum) {
63   - case WX_PUB: return (AbstractPayClient<Config>) new WXPubPayClient(channelId, (WXPayClientConfig) config);
64   - case WX_LITE: return (AbstractPayClient<Config>) new WXLitePayClient(channelId, (WXPayClientConfig) config); //微信小程序请求支付
65   - case WX_APP: return (AbstractPayClient<Config>) new WXPubPayClient(channelId, (WXPayClientConfig) config);
66   - case WX_NATIVE: return (AbstractPayClient<Config>) new WXNativePayClient(channelId, (WXPayClientConfig) config);
  59 + // 微信支付
  60 + case WX_PUB: return (AbstractPayClient<Config>) new WxPubPayClient(channelId, (WxPayClientConfig) config);
  61 + case WX_LITE: return (AbstractPayClient<Config>) new WxLitePayClient(channelId, (WxPayClientConfig) config);
  62 + case WX_APP: return (AbstractPayClient<Config>) new WxAppPayClient(channelId, (WxPayClientConfig) config);
  63 + case WX_BAR: return (AbstractPayClient<Config>) new WxBarPayClient(channelId, (WxPayClientConfig) config);
  64 + case WX_NATIVE: return (AbstractPayClient<Config>) new WxNativePayClient(channelId, (WxPayClientConfig) config);
  65 + case WX_H5: return (AbstractPayClient<Config>) new WxH5PayClient(channelId, (WxPayClientConfig) config);
  66 + // 支付宝支付
67 67 case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config);
68 68 case ALIPAY_QR: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config);
69 69 case ALIPAY_APP: return (AbstractPayClient<Config>) new AlipayAppPayClient(channelId, (AlipayPayClientConfig) config);
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayPayClient.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
3 3 import cn.hutool.core.bean.BeanUtil;
  4 +import cn.hutool.core.date.LocalDateTimeUtil;
4 5 import cn.hutool.http.HttpUtil;
  6 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
5 7 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
6 8 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
7 9 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
8 10 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
9 11 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
10 12 import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
11   -import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum;
12   -import com.alipay.api.AlipayApiException;
13   -import com.alipay.api.AlipayConfig;
14   -import com.alipay.api.DefaultAlipayClient;
  13 +import cn.iocoder.yudao.framework.pay.core.enums.refund.PayNotifyRefundStatusEnum;
  14 +import com.alipay.api.*;
15 15 import com.alipay.api.domain.AlipayTradeRefundModel;
16 16 import com.alipay.api.internal.util.AlipaySignature;
17 17 import com.alipay.api.request.AlipayTradeRefundRequest;
... ... @@ -20,21 +20,25 @@ import lombok.SneakyThrows;
20 20 import lombok.extern.slf4j.Slf4j;
21 21  
22 22 import java.nio.charset.StandardCharsets;
  23 +import java.time.LocalDateTime;
23 24 import java.util.Map;
24 25  
  26 +import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER;
  27 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
25 28 import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
  29 +import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.ORDER_UNIFIED_ERROR;
26 30  
27 31 /**
28   - * 支付宝抽象类, 实现支付宝统一的接口。如退款
  32 + * 支付宝抽象类,实现支付宝统一的接口、以及部分实现(退款)
29 33 *
30   - * @author jason
  34 + * @author jason
31 35 */
32 36 @Slf4j
33   -public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayClientConfig> {
  37 +public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPayClientConfig> {
34 38  
35 39 protected DefaultAlipayClient client;
36 40  
37   - public AbstractAlipayClient(Long channelId, String channelCode, AlipayPayClientConfig config) {
  41 + public AbstractAlipayPayClient(Long channelId, String channelCode, AlipayPayClientConfig config) {
38 42 super(channelId, channelCode, config);
39 43 }
40 44  
... ... @@ -58,7 +62,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient&lt;AlipayPayCl
58 62 model.setOutTradeNo(reqDTO.getPayTradeNo());
59 63  
60 64 model.setOutRequestNo(reqDTO.getMerchantRefundId());
61   - model.setRefundAmount(formatAmount(reqDTO.getAmount()).toString());
  65 + model.setRefundAmount(formatAmount(reqDTO.getAmount()));
62 66 model.setRefundReason(reqDTO.getReason());
63 67  
64 68 AlipayTradeRefundRequest refundRequest = new AlipayTradeRefundRequest();
... ... @@ -106,10 +110,43 @@ public abstract class AbstractAlipayClient extends AbstractPayClient&lt;AlipayPayCl
106 110 .build();
107 111 }
108 112 // 2.2 支付的情况
109   - return PayOrderNotifyRespDTO.builder().orderExtensionNo(bodyObj.get("out_trade_no"))
110   - .channelOrderNo(bodyObj.get("trade_no")).channelUserId(bodyObj.get("seller_id"))
111   - .tradeStatus(bodyObj.get("trade_status")).successTime(parseTime(params.get("notify_time")))
  113 + return PayOrderNotifyRespDTO.builder()
  114 + .orderExtensionNo(bodyObj.get("out_trade_no"))
  115 + .channelOrderNo(bodyObj.get("trade_no"))
  116 + .channelUserId(bodyObj.get("seller_id"))
  117 + .successTime(parseTime(params.get("notify_time")))
112 118 .build();
113 119 }
114 120  
  121 + // ========== 各种工具方法 ==========
  122 +
  123 + protected String formatAmount(Integer amount) {
  124 + return String.valueOf(amount / 100.0);
  125 + }
  126 +
  127 + protected String formatTime(LocalDateTime time) {
  128 + return LocalDateTimeUtil.format(time, NORM_DATETIME_FORMATTER);
  129 + }
  130 +
  131 + protected LocalDateTime parseTime(String str) {
  132 + return LocalDateTimeUtil.parse(str, NORM_DATETIME_FORMATTER);
  133 + }
  134 +
  135 + /**
  136 + * 校验支付宝统一下单的响应
  137 + *
  138 + * 如果校验不通过,则抛出 {@link cn.iocoder.yudao.framework.common.exception.ServiceException} 异常
  139 + *
  140 + * @param request 请求
  141 + * @param response 响应
  142 + */
  143 + protected void validateUnifiedOrderResponse(Object request, AlipayResponse response) {
  144 + if (response.isSuccess()) {
  145 + return;
  146 + }
  147 + log.error("[validateUnifiedOrderResponse][发起支付失败,request({}),response({})]",
  148 + JsonUtils.toJsonString(request), JsonUtils.toJsonString(response));
  149 + throw exception0(ORDER_UNIFIED_ERROR.getCode(), response.getSubMsg());
  150 + }
  151 +
115 152 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java
... ... @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
3 3 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
4 4 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
5   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
6   -import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
  5 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  6 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
7 7 import com.alipay.api.AlipayApiException;
8 8 import com.alipay.api.domain.AlipayTradeAppPayModel;
9 9 import com.alipay.api.request.AlipayTradeAppPayRequest;
... ... @@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
20 20 * @author 芋道源码
21 21 */
22 22 @Slf4j
23   -public class AlipayAppPayClient extends AbstractAlipayClient {
  23 +public class AlipayAppPayClient extends AbstractAlipayPayClient {
24 24  
25 25 public AlipayAppPayClient(Long channelId, AlipayPayClientConfig config) {
26 26 super(channelId, PayChannelEnum.ALIPAY_APP.getCode(), config);
... ... @@ -38,7 +38,7 @@ public class AlipayAppPayClient extends AbstractAlipayClient {
38 38 model.setProductCode(" QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品
39 39 // ② 个性化的参数【无】
40 40 // ③ 支付宝扫码支付只有一种展示
41   - String displayMode = PayDisplayModeEnum.APP.getMode();
  41 + String displayMode = PayOrderDisplayModeEnum.APP.getMode();
42 42  
43 43 // 1.2 构建 AlipayTradePrecreateRequest 请求
44 44 AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
... ... @@ -49,9 +49,8 @@ public class AlipayAppPayClient extends AbstractAlipayClient {
49 49 // 2.1 执行请求
50 50 AlipayTradeAppPayResponse response = client.execute(request);
51 51 // 2.2 处理结果
52   - validateSuccess(response);
53   - return new PayOrderUnifiedRespDTO()
54   - .setDisplayMode(displayMode).setDisplayContent("");
  52 + validateUnifiedOrderResponse(request, response);
  53 + return new PayOrderUnifiedRespDTO(displayMode, "");
55 54 }
56 55  
57 56 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayBarPayClient.java
... ... @@ -4,8 +4,8 @@ import cn.hutool.core.map.MapUtil;
4 4 import cn.hutool.core.util.StrUtil;
5 5 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
6 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
7   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
8   -import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  8 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
9 9 import com.alipay.api.AlipayApiException;
10 10 import com.alipay.api.domain.AlipayTradePayModel;
11 11 import com.alipay.api.request.AlipayTradePayRequest;
... ... @@ -13,7 +13,6 @@ import com.alipay.api.response.AlipayTradePayResponse;
13 13 import lombok.extern.slf4j.Slf4j;
14 14  
15 15 import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
16   -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
17 16 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
18 17  
19 18 /**
... ... @@ -24,7 +23,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
24 23 * @author 芋道源码
25 24 */
26 25 @Slf4j
27   -public class AlipayBarPayClient extends AbstractAlipayClient {
  26 +public class AlipayBarPayClient extends AbstractAlipayPayClient {
28 27  
29 28 public AlipayBarPayClient(Long channelId, AlipayPayClientConfig config) {
30 29 super(channelId, PayChannelEnum.ALIPAY_BAR.getCode(), config);
... ... @@ -48,7 +47,7 @@ public class AlipayBarPayClient extends AbstractAlipayClient {
48 47 // ② 个性化的参数
49 48 model.setAuthCode(authCode);
50 49 // ③ 支付宝条码支付只有一种展示
51   - String displayMode = PayDisplayModeEnum.BAR_CODE.getMode();
  50 + String displayMode = PayOrderDisplayModeEnum.BAR_CODE.getMode();
52 51  
53 52 // 1.2 构建 AlipayTradePayRequest 请求
54 53 AlipayTradePayRequest request = new AlipayTradePayRequest();
... ... @@ -59,8 +58,8 @@ public class AlipayBarPayClient extends AbstractAlipayClient {
59 58 // 2.1 执行请求
60 59 AlipayTradePayResponse response = client.execute(request);
61 60 // 2.2 处理结果
62   - validateSuccess(response);
63   - return new PayOrderUnifiedRespDTO()
64   - .setDisplayMode(displayMode).setDisplayContent("");
  61 + validateUnifiedOrderResponse(request, response);
  62 + return new PayOrderUnifiedRespDTO(displayMode, "");
65 63 }
  64 +
66 65 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayClientConfig.java
... ... @@ -9,8 +9,6 @@ import javax.validation.constraints.NotBlank;
9 9 import javax.validation.constraints.NotNull;
10 10 import java.util.Set;
11 11  
12   -// TODO 芋艿:参数校验
13   -
14 12 /**
15 13 * 支付宝的 PayClientConfig 实现类
16 14 * 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性
... ... @@ -111,7 +109,9 @@ public class AlipayPayClientConfig implements PayClientConfig {
111 109  
112 110 @Override
113 111 public Set<ConstraintViolation<PayClientConfig>> verifyParam(Validator validator) {
  112 + // TODO 芋艿:参数校验
114 113 return validator.validate(this,
115 114 MODE_PUBLIC_KEY.equals(this.getMode()) ? ModePublicKey.class : ModeCertificate.class);
116 115 }
  116 +
117 117 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPcPayClient.java
... ... @@ -4,8 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
4 4 import cn.hutool.http.Method;
5 5 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
6 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
7   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
8   -import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  8 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
9 9 import com.alipay.api.AlipayApiException;
10 10 import com.alipay.api.domain.AlipayTradePagePayModel;
11 11 import com.alipay.api.request.AlipayTradePagePayRequest;
... ... @@ -22,7 +22,7 @@ import java.util.Objects;
22 22 * @author XGD
23 23 */
24 24 @Slf4j
25   -public class AlipayPcPayClient extends AbstractAlipayClient {
  25 +public class AlipayPcPayClient extends AbstractAlipayPayClient {
26 26  
27 27 public AlipayPcPayClient(Long channelId, AlipayPayClientConfig config) {
28 28 super(channelId, PayChannelEnum.ALIPAY_PC.getCode(), config);
... ... @@ -44,7 +44,7 @@ public class AlipayPcPayClient extends AbstractAlipayClient {
44 44 model.setQrPayMode("2"); // 跳转模式 - 订单码,效果参见:https://help.pingxx.com/article/1137360/
45 45 // ③ 支付宝 PC 支付有两种展示模式:FORM、URL
46 46 String displayMode = ObjectUtil.defaultIfNull(reqDTO.getDisplayMode(),
47   - PayDisplayModeEnum.URL.getMode());
  47 + PayOrderDisplayModeEnum.URL.getMode());
48 48  
49 49 // 1.2 构建 AlipayTradePagePayRequest 请求
50 50 AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
... ... @@ -54,16 +54,14 @@ public class AlipayPcPayClient extends AbstractAlipayClient {
54 54  
55 55 // 2.1 执行请求
56 56 AlipayTradePagePayResponse response;
57   - if (Objects.equals(displayMode, PayDisplayModeEnum.FORM.getMode())) {
  57 + if (Objects.equals(displayMode, PayOrderDisplayModeEnum.FORM.getMode())) {
58 58 response = client.pageExecute(request, Method.POST.name()); // 需要特殊使用 POST 请求
59 59 } else {
60 60 response = client.pageExecute(request, Method.GET.name());
61 61 }
62   -
63 62 // 2.2 处理结果
64   - validateSuccess(response);
65   - return new PayOrderUnifiedRespDTO().setDisplayMode(displayMode)
66   - .setDisplayContent(response.getBody());
  63 + validateUnifiedOrderResponse(request, response);
  64 + return new PayOrderUnifiedRespDTO(displayMode, response.getBody());
67 65 }
68 66  
69 67 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayQrPayClient.java
... ... @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
3 3 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
4 4 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
5   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
6   -import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
  5 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  6 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
7 7 import com.alipay.api.AlipayApiException;
8 8 import com.alipay.api.domain.AlipayTradePrecreateModel;
9 9 import com.alipay.api.request.AlipayTradePrecreateRequest;
... ... @@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
18 18 * @author 芋道源码
19 19 */
20 20 @Slf4j
21   -public class AlipayQrPayClient extends AbstractAlipayClient {
  21 +public class AlipayQrPayClient extends AbstractAlipayPayClient {
22 22  
23 23 public AlipayQrPayClient(Long channelId, AlipayPayClientConfig config) {
24 24 super(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config);
... ... @@ -36,7 +36,7 @@ public class AlipayQrPayClient extends AbstractAlipayClient {
36 36 model.setProductCode("FACE_TO_FACE_PAYMENT"); // 销售产品码. 目前扫码支付场景下仅支持 FACE_TO_FACE_PAYMENT
37 37 // ② 个性化的参数【无】
38 38 // ③ 支付宝扫码支付只有一种展示,考虑到前端可能希望二维码扫描后,手机打开
39   - String displayMode = PayDisplayModeEnum.QR_CODE.getMode();
  39 + String displayMode = PayOrderDisplayModeEnum.QR_CODE.getMode();
40 40  
41 41 // 1.2 构建 AlipayTradePrecreateRequest 请求
42 42 AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
... ... @@ -47,8 +47,8 @@ public class AlipayQrPayClient extends AbstractAlipayClient {
47 47 // 2.1 执行请求
48 48 AlipayTradePrecreateResponse response = client.execute(request);
49 49 // 2.2 处理结果
50   - validateSuccess(response);
51   - return new PayOrderUnifiedRespDTO()
52   - .setDisplayMode(displayMode).setDisplayContent(response.getQrCode());
  50 + validateUnifiedOrderResponse(request, response);
  51 + return new PayOrderUnifiedRespDTO(displayMode, response.getQrCode());
53 52 }
  53 +
54 54 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java
... ... @@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
3 3 import cn.hutool.http.Method;
4 4 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
5 5 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
6   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
7   -import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
  6 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
8 8 import com.alipay.api.AlipayApiException;
9 9 import com.alipay.api.domain.AlipayTradeWapPayModel;
10 10 import com.alipay.api.request.AlipayTradeWapPayRequest;
... ... @@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
19 19 * @author 芋道源码
20 20 */
21 21 @Slf4j
22   -public class AlipayWapPayClient extends AbstractAlipayClient {
  22 +public class AlipayWapPayClient extends AbstractAlipayPayClient {
23 23  
24 24 public AlipayWapPayClient(Long channelId, AlipayPayClientConfig config) {
25 25 super(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config);
... ... @@ -37,7 +37,7 @@ public class AlipayWapPayClient extends AbstractAlipayClient {
37 37 model.setProductCode("QUICK_WAP_PAY"); // 销售产品码. 目前 Wap 支付场景下仅支持 QUICK_WAP_PAY
38 38 // ② 个性化的参数【无】
39 39 // ③ 支付宝 Wap 支付只有一种展示:URL
40   - String displayMode = PayDisplayModeEnum.URL.getMode();
  40 + String displayMode = PayOrderDisplayModeEnum.URL.getMode();
41 41  
42 42 // 1.2 构建 AlipayTradeWapPayRequest 请求
43 43 AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
... ... @@ -50,9 +50,8 @@ public class AlipayWapPayClient extends AbstractAlipayClient {
50 50 AlipayTradeWapPayResponse response = client.pageExecute(request, Method.GET.name());
51 51  
52 52 // 2.2 处理结果
53   - validateSuccess(response);
54   - return new PayOrderUnifiedRespDTO()
55   - .setDisplayMode(displayMode).setDisplayContent(response.getBody());
  53 + validateUnifiedOrderResponse(request, response);
  54 + return new PayOrderUnifiedRespDTO(displayMode, response.getBody());
56 55 }
57 56  
58 57 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/AbstractWxPayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.hutool.core.bean.BeanUtil;
  4 +import cn.hutool.core.date.LocalDateTimeUtil;
  5 +import cn.hutool.core.date.TemporalAccessorUtil;
  6 +import cn.hutool.core.lang.Assert;
  7 +import cn.hutool.core.util.StrUtil;
  8 +import cn.iocoder.yudao.framework.common.util.io.FileUtils;
  9 +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
  10 +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
  11 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  12 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
  13 +import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
  14 +import cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants;
  15 +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
  16 +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
  17 +import com.github.binarywang.wxpay.config.WxPayConfig;
  18 +import com.github.binarywang.wxpay.exception.WxPayException;
  19 +import com.github.binarywang.wxpay.service.WxPayService;
  20 +import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
  21 +import lombok.extern.slf4j.Slf4j;
  22 +
  23 +import java.time.LocalDateTime;
  24 +import java.time.ZoneId;
  25 +import java.util.Objects;
  26 +
  27 +import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
  28 +import static cn.hutool.core.date.DatePattern.UTC_WITH_XXX_OFFSET_PATTERN;
  29 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.*;
  30 +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
  31 +
  32 +/**
  33 + * 微信支付抽象类,实现微信统一的接口、以及部分实现(退款)
  34 + *
  35 + * @author 遇到源码
  36 + */
  37 +@Slf4j
  38 +public abstract class AbstractWxPayClient extends AbstractPayClient<WxPayClientConfig> {
  39 +
  40 + protected WxPayService client;
  41 +
  42 + public AbstractWxPayClient(Long channelId, String channelCode, WxPayClientConfig config) {
  43 + super(channelId, channelCode, config);
  44 + }
  45 +
  46 + /**
  47 + * 初始化 client 客户端
  48 + *
  49 + * @param tradeType 交易类型
  50 + */
  51 + protected void doInit(String tradeType) {
  52 + // 创建 config 配置
  53 + WxPayConfig payConfig = new WxPayConfig();
  54 + BeanUtil.copyProperties(config, payConfig, "keyContent");
  55 + payConfig.setTradeType(tradeType);
  56 + if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
  57 + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
  58 + payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
  59 + }
  60 + if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
  61 + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
  62 + payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
  63 + }
  64 +
  65 + // 创建 client 客户端
  66 + client = new WxPayServiceImpl();
  67 + client.setConfig(payConfig);
  68 + }
  69 +
  70 + @Override
  71 + protected PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) throws Exception {
  72 + try {
  73 + switch (config.getApiVersion()) {
  74 + case WxPayClientConfig.API_VERSION_V2:
  75 + return doUnifiedOrderV2(reqDTO);
  76 + case WxPayClientConfig.API_VERSION_V3:
  77 + return doUnifiedOrderV3(reqDTO);
  78 + default:
  79 + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
  80 + }
  81 + } catch (WxPayException e) {
  82 + throw buildUnifiedOrderException(reqDTO, e);
  83 + }
  84 + }
  85 +
  86 + /**
  87 + * 【V2】调用支付渠道,统一下单
  88 + *
  89 + * @param reqDTO 下单信息
  90 + * @return 各支付渠道的返回结果
  91 + */
  92 + protected abstract PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO)
  93 + throws WxPayException;
  94 +
  95 + /**
  96 + * 【V3】调用支付渠道,统一下单
  97 + *
  98 + * @param reqDTO 下单信息
  99 + * @return 各支付渠道的返回结果
  100 + */
  101 + protected abstract PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO)
  102 + throws WxPayException;
  103 +
  104 +
  105 + @Override
  106 + public Object parseNotify(PayNotifyReqDTO rawNotify) {
  107 + log.info("[parseNotify][微信支付回调 data 数据: {}]", rawNotify.getBody());
  108 + try {
  109 + // 微信支付 v2 回调结果处理
  110 + switch (config.getApiVersion()) {
  111 + case WxPayClientConfig.API_VERSION_V2:
  112 + return parseOrderNotifyV2(rawNotify);
  113 + case WxPayClientConfig.API_VERSION_V3:
  114 + return parseOrderNotifyV3(rawNotify);
  115 + default:
  116 + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
  117 + }
  118 + } catch (WxPayException e) {
  119 + log.error("[parseNotify][rawNotify({}) 解析失败]", toJsonString(rawNotify), e);
  120 +// throw buildPayException(e);
  121 + throw new RuntimeException(e);
  122 + // TODO 芋艿:缺一个异常翻译
  123 + }
  124 + }
  125 +
  126 + private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
  127 + WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
  128 + Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
  129 + // 转换结果
  130 + return PayOrderNotifyRespDTO
  131 + .builder()
  132 + .orderExtensionNo(notifyResult.getOutTradeNo())
  133 + .channelOrderNo(notifyResult.getTransactionId())
  134 + .channelUserId(notifyResult.getOpenid())
  135 + .successTime(parseDateV2(notifyResult.getTimeEnd()))
  136 + .build();
  137 + }
  138 +
  139 + private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
  140 + WxPayOrderNotifyV3Result notifyResult = client.parseOrderNotifyV3Result(data.getBody(), null);
  141 + WxPayOrderNotifyV3Result.DecryptNotifyResult result = notifyResult.getResult();
  142 + // 转换结果
  143 + Assert.isTrue(Objects.equals(notifyResult.getResult().getTradeState(), "SUCCESS"),
  144 + "支付结果非 SUCCESS");
  145 + return PayOrderNotifyRespDTO.builder()
  146 + .orderExtensionNo(result.getOutTradeNo())
  147 + .channelOrderNo(result.getTradeState())
  148 + .channelUserId(result.getPayer() != null ? result.getPayer().getOpenid() : null)
  149 + .successTime(parseDateV3(result.getSuccessTime()))
  150 + .build();
  151 + }
  152 +
  153 + // ========== 各种工具方法 ==========
  154 +
  155 + /**
  156 + * 构建统一下单的异常
  157 + *
  158 + * 目的:将参数不正确等异常,转换成 {@link cn.iocoder.yudao.framework.common.exception.ServiceException} 业务异常
  159 + *
  160 + * @param reqDTO 请求
  161 + * @param e 微信的支付异常
  162 + * @return 转换后的异常
  163 + *
  164 + */
  165 + static Exception buildUnifiedOrderException(PayOrderUnifiedReqDTO reqDTO, WxPayException e) {
  166 + // 情况一:业务结果为 FAIL
  167 + if (Objects.equals(e.getResultCode(), "FAIL")) {
  168 + log.error("[buildUnifiedOrderException][request({}) 发起支付失败]", toJsonString(reqDTO), e);
  169 + if (Objects.equals(e.getErrCode(), "PARAM_ERROR")) {
  170 + throw invalidParamException(e.getErrCodeDes());
  171 + }
  172 + throw exception(PayFrameworkErrorCodeConstants.ORDER_UNIFIED_ERROR, e.getErrCodeDes());
  173 + }
  174 + // 情况二:状态码结果为 FAIL
  175 + if (Objects.equals(e.getReturnCode(), "FAIL")) {
  176 + throw exception(PayFrameworkErrorCodeConstants.ORDER_UNIFIED_ERROR, e.getReturnMsg());
  177 + }
  178 + // 情况三:系统异常,这里暂时不打,交给上层的 AbstractPayClient 统一打
  179 + return e;
  180 + }
  181 +
  182 + static String formatDateV2(LocalDateTime time) {
  183 + return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), PURE_DATETIME_PATTERN);
  184 + }
  185 +
  186 + static LocalDateTime parseDateV2(String time) {
  187 + return LocalDateTimeUtil.parse(time, PURE_DATETIME_PATTERN);
  188 + }
  189 +
  190 + static String formatDateV3(LocalDateTime time) {
  191 + return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), UTC_WITH_XXX_OFFSET_PATTERN);
  192 + }
  193 +
  194 + static LocalDateTime parseDateV3(String time) {
  195 + return LocalDateTimeUtil.parse(time, UTC_WITH_XXX_OFFSET_PATTERN);
  196 + }
  197 +
  198 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxAppPayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  4 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
  5 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
  6 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  8 +import com.github.binarywang.wxpay.constant.WxPayConstants;
  9 +import com.github.binarywang.wxpay.exception.WxPayException;
  10 +
  11 +// TODO 芋艿:未实现
  12 +public class WxAppPayClient extends AbstractWxPayClient {
  13 +
  14 + public WxAppPayClient(Long channelId, WxPayClientConfig config) {
  15 + super(channelId, PayChannelEnum.WX_APP.getCode(), config);
  16 + }
  17 +
  18 + @Override
  19 + protected void doInit() {
  20 + super.doInit(WxPayConstants.TradeType.APP);
  21 + }
  22 +
  23 + @Override
  24 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
  25 + return null;
  26 + }
  27 +
  28 + @Override
  29 + protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  30 + return null;
  31 + }
  32 +
  33 + @Override
  34 + protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  35 + return null;
  36 + }
  37 +
  38 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxBarPayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.hutool.core.map.MapUtil;
  4 +import cn.hutool.core.thread.ThreadUtil;
  5 +import cn.hutool.core.util.StrUtil;
  6 +import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
  7 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  8 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  9 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
  10 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
  11 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
  12 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  13 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
  14 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum;
  15 +import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest;
  16 +import com.github.binarywang.wxpay.bean.result.WxPayMicropayResult;
  17 +import com.github.binarywang.wxpay.constant.WxPayConstants;
  18 +import com.github.binarywang.wxpay.exception.WxPayException;
  19 +import lombok.extern.slf4j.Slf4j;
  20 +
  21 +import java.time.Duration;
  22 +import java.time.LocalDateTime;
  23 +import java.util.concurrent.TimeUnit;
  24 +
  25 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
  26 +
  27 +/**
  28 + * 微信支付【付款码支付】的 PayClient 实现类
  29 + *
  30 + * 文档:<a href="https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1">付款码支付</a>
  31 + *
  32 + * @author 芋道源码
  33 + */
  34 +@Slf4j
  35 +public class WxBarPayClient extends AbstractWxPayClient {
  36 +
  37 + /**
  38 + * 微信付款码的过期时间
  39 + */
  40 + private static final Duration AUTH_CODE_EXPIRE = Duration.ofMinutes(3);
  41 +
  42 + public WxBarPayClient(Long channelId, WxPayClientConfig config) {
  43 + super(channelId, PayChannelEnum.WX_BAR.getCode(), config);
  44 + }
  45 +
  46 + @Override
  47 + protected void doInit() {
  48 + super.doInit(WxPayConstants.TradeType.MICROPAY);
  49 + }
  50 +
  51 + @Override
  52 + protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  53 + // 由于付款码需要不断轮询,所以需要在较短的时间完成支付
  54 + LocalDateTime expireTime = LocalDateTimeUtils.addTime(AUTH_CODE_EXPIRE);
  55 + if (expireTime.isAfter(reqDTO.getExpireTime())) {
  56 + expireTime = reqDTO.getExpireTime();
  57 + }
  58 + // 构建 WxPayMicropayRequest 对象
  59 + WxPayMicropayRequest request = WxPayMicropayRequest.newBuilder()
  60 + .outTradeNo(reqDTO.getMerchantOrderId())
  61 + .body(reqDTO.getSubject())
  62 + .detail(reqDTO.getBody())
  63 + .totalFee(reqDTO.getAmount()) // 单位分
  64 + .timeExpire(formatDateV2(expireTime))
  65 + .spbillCreateIp(reqDTO.getUserIp())
  66 + .authCode(getAuthCode(reqDTO))
  67 + .build();
  68 + // 执行请求,重试直到失败(过期),或者成功
  69 + for (int i = 1; i < Byte.MAX_VALUE; i++) {
  70 + try {
  71 + WxPayMicropayResult response = client.micropay(request);
  72 + // 支付成功(例如说,用户输入了密码)
  73 + return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.BAR_CODE.getMode(),
  74 + JsonUtils.toJsonString(response),
  75 + PayOrderStatusRespEnum.SUCCESS.getStatus());
  76 + } catch (WxPayException ex) {
  77 + // 如果不满足这 3 种任一的,则直接抛出 WxPayException 异常,不仅需处理
  78 + // 1. SYSTEMERROR:接口返回错误:请立即调用被扫订单结果查询API,查询当前订单状态,并根据订单的状态决定下一步的操作。
  79 + // 2. USERPAYING:用户支付中,需要输入密码:等待 5 秒,然后调用被扫订单结果查询 API,查询当前订单的不同状态,决定下一步的操作。
  80 + // 3. BANKERROR:银行系统异常:请立即调用被扫订单结果查询 API,查询当前订单的不同状态,决定下一步的操作。
  81 + if (!StrUtil.equalsAny(ex.getErrCode(), "SYSTEMERROR", "USERPAYING", "BANKERROR")) {
  82 + throw ex;
  83 + }
  84 + // 等待 5 秒,继续下一轮重新发起支付
  85 + log.info("[doUnifiedOrderV2][发起微信 Bar 支付第({})失败,等待下一轮重试,请求({}),响应({})]", i,
  86 + JsonUtils.toJsonString(request), ex.getMessage());
  87 + ThreadUtil.sleep(5, TimeUnit.SECONDS);
  88 + }
  89 + }
  90 + throw new IllegalStateException("微信 Bar 支付,重试多次失败");
  91 + }
  92 +
  93 + @Override
  94 + protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  95 + return doUnifiedOrderV2(reqDTO);
  96 + }
  97 +
  98 + @Override
  99 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
  100 + return null;
  101 + }
  102 +
  103 + // ========== 各种工具方法 ==========
  104 +
  105 + static String getAuthCode(PayOrderUnifiedReqDTO reqDTO) {
  106 + String authCode = MapUtil.getStr(reqDTO.getChannelExtras(), "authCode");
  107 + if (StrUtil.isEmpty(authCode)) {
  108 + throw invalidParamException("支付请求的 authCode 不能为空!");
  109 + }
  110 + return authCode;
  111 + }
  112 +
  113 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxH5PayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  4 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
  5 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
  6 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  8 +import com.github.binarywang.wxpay.constant.WxPayConstants;
  9 +import com.github.binarywang.wxpay.exception.WxPayException;
  10 +
  11 +// TODO 芋艿:未实现
  12 +public class WxH5PayClient extends AbstractWxPayClient {
  13 +
  14 + public WxH5PayClient(Long channelId, WxPayClientConfig config) {
  15 + super(channelId, PayChannelEnum.WX_H5.getCode(), config);
  16 + }
  17 +
  18 + @Override
  19 + protected void doInit() {
  20 + super.doInit(WxPayConstants.TradeType.MWEB);
  21 + }
  22 +
  23 + @Override
  24 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
  25 + return null;
  26 + }
  27 +
  28 + @Override
  29 + protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  30 + return null;
  31 + }
  32 +
  33 + @Override
  34 + protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  35 + return null;
  36 + }
  37 +
  38 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxLitePayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  4 +import lombok.extern.slf4j.Slf4j;
  5 +
  6 +/**
  7 + * 微信支付【小程序】的 PayClient 实现类
  8 + *
  9 + * 由于公众号和小程序的微信支付逻辑一致,所以直接进行继承
  10 + *
  11 + * 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_1.shtml">JSAPI 下单</>
  12 + *
  13 + * @author zwy
  14 + */
  15 +@Slf4j
  16 +public class WxLitePayClient extends WxPubPayClient {
  17 +
  18 + public WxLitePayClient(Long channelId, WxPayClientConfig config) {
  19 + super(channelId, PayChannelEnum.WX_LITE.getCode(), config);
  20 + }
  21 +
  22 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxNativePayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  4 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
  5 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
  6 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  8 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
  9 +import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
  10 +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
  11 +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
  12 +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
  13 +import com.github.binarywang.wxpay.constant.WxPayConstants;
  14 +import com.github.binarywang.wxpay.exception.WxPayException;
  15 +import lombok.extern.slf4j.Slf4j;
  16 +
  17 +/**
  18 + * 微信支付【Native 二维码】的 PayClient 实现类
  19 + *
  20 + * 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml">Native 下单</a>
  21 + *
  22 + * @author zwy
  23 + */
  24 +@Slf4j
  25 +public class WxNativePayClient extends AbstractWxPayClient {
  26 +
  27 + public WxNativePayClient(Long channelId, WxPayClientConfig config) {
  28 + super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config);
  29 + }
  30 +
  31 + @Override
  32 + protected void doInit() {
  33 + super.doInit(WxPayConstants.TradeType.NATIVE);
  34 + }
  35 +
  36 + @Override
  37 + protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  38 + // 构建 WxPayUnifiedOrderRequest 对象
  39 + WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
  40 + .outTradeNo(reqDTO.getMerchantOrderId())
  41 + .body(reqDTO.getSubject())
  42 + .detail(reqDTO.getBody())
  43 + .totalFee(reqDTO.getAmount()) // 单位分
  44 + .productId(reqDTO.getMerchantOrderId())
  45 + .timeExpire(formatDateV2(reqDTO.getExpireTime()))
  46 + .spbillCreateIp(reqDTO.getUserIp())
  47 + .notifyUrl(reqDTO.getNotifyUrl())
  48 + .build();
  49 + // 执行请求
  50 + WxPayNativeOrderResult response = client.createOrder(request);
  51 +
  52 + // 转换结果
  53 + return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.QR_CODE_URL.getMode(),
  54 + response.getCodeUrl());
  55 + }
  56 +
  57 + @Override
  58 + protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  59 + // 构建 WxPayUnifiedOrderRequest 对象
  60 + WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
  61 + request.setOutTradeNo(reqDTO.getMerchantOrderId());
  62 + request.setDescription(reqDTO.getBody());
  63 + request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount())); // 单位分
  64 + request.setTimeExpire(formatDateV3(reqDTO.getExpireTime()));
  65 + request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
  66 + request.setNotifyUrl(reqDTO.getNotifyUrl());
  67 + // 执行请求
  68 + WxPayNativeOrderResult response = client.createOrderV3(TradeTypeEnum.NATIVE, request);
  69 +
  70 + // 转换结果
  71 + return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.QR_CODE_URL.getMode(),
  72 + response.getCodeUrl());
  73 + }
  74 +
  75 + @Override
  76 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
  77 + return null;
  78 + }
  79 +
  80 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPayClientConfig.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxPayClientConfig.java
1   -package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
2 2  
3 3 import cn.hutool.core.io.IoUtil;
4 4 import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
... ... @@ -18,23 +18,26 @@ import java.util.Set;
18 18 * @author 芋道源码
19 19 */
20 20 @Data
21   -public class WXPayClientConfig implements PayClientConfig {
  21 +public class WxPayClientConfig implements PayClientConfig {
22 22  
23 23 /**
24 24 * API 版本 - V2
25   - * https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_1
  25 + *
  26 + * <a href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_1">V2 协议说明</a>
26 27 */
27 28 public static final String API_VERSION_V2 = "v2";
28 29 /**
29 30 * API 版本 - V3
30   - * https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay-1.shtml
  31 + *
  32 + * <a href="https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay-1.shtml">V3 协议说明</a>
31 33 */
32 34 public static final String API_VERSION_V3 = "v3";
33 35  
34 36 /**
35 37 * 公众号或者小程序的 appid
  38 + *
  39 + * 只有公众号或小程序需要该字段
36 40 */
37   - @NotBlank(message = "APPID 不能为空", groups = {V2.class, V3.class})
38 41 private String appId;
39 42 /**
40 43 * 商户号
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxPubPayClient.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
  2 +
  3 +import cn.hutool.core.map.MapUtil;
  4 +import cn.hutool.core.util.StrUtil;
  5 +import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  6 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  7 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
  8 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
  9 +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
  10 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  11 +import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
  12 +import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
  13 +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
  14 +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
  15 +import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
  16 +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
  17 +import com.github.binarywang.wxpay.constant.WxPayConstants;
  18 +import com.github.binarywang.wxpay.exception.WxPayException;
  19 +import lombok.extern.slf4j.Slf4j;
  20 +
  21 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
  22 +
  23 +/**
  24 + * 微信支付(公众号)的 PayClient 实现类
  25 + *
  26 + * 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml">JSAPI 下单</>
  27 + *
  28 + * @author 芋道源码
  29 + */
  30 +@Slf4j
  31 +public class WxPubPayClient extends AbstractWxPayClient {
  32 +
  33 + public WxPubPayClient(Long channelId, WxPayClientConfig config) {
  34 + super(channelId, PayChannelEnum.WX_PUB.getCode(), config);
  35 + }
  36 +
  37 + protected WxPubPayClient(Long channelId, String channelCode, WxPayClientConfig config) {
  38 + super(channelId, channelCode, config);
  39 + }
  40 +
  41 + @Override
  42 + protected void doInit() {
  43 + super.doInit(WxPayConstants.TradeType.JSAPI);
  44 + }
  45 +
  46 + @Override
  47 + protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  48 + // 构建 WxPayUnifiedOrderRequest 对象
  49 + WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
  50 + .outTradeNo(reqDTO.getMerchantOrderId())
  51 + .body(reqDTO.getSubject())
  52 + .detail(reqDTO.getBody())
  53 + .totalFee(reqDTO.getAmount()) // 单位分
  54 + .timeExpire(formatDateV2(reqDTO.getExpireTime()))
  55 + .spbillCreateIp(reqDTO.getUserIp())
  56 + .openid(getOpenid(reqDTO))
  57 + .notifyUrl(reqDTO.getNotifyUrl())
  58 + .build();
  59 + // 执行请求
  60 + WxPayMpOrderResult response = client.createOrder(request);
  61 +
  62 + // 转换结果
  63 + return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.CUSTOM.getMode(),
  64 + JsonUtils.toJsonString(response));
  65 + }
  66 +
  67 + @Override
  68 + protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
  69 + // 构建 WxPayUnifiedOrderRequest 对象
  70 + WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
  71 + request.setOutTradeNo(reqDTO.getMerchantOrderId());
  72 + request.setDescription(reqDTO.getSubject());
  73 + request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount())); // 单位分
  74 + request.setTimeExpire(formatDateV3(reqDTO.getExpireTime()));
  75 + request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO)));
  76 + request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
  77 + request.setNotifyUrl(reqDTO.getNotifyUrl());
  78 + // 执行请求
  79 + WxPayUnifiedOrderV3Result.JsapiResult response = client.createOrderV3(TradeTypeEnum.JSAPI, request);
  80 +
  81 + // 转换结果
  82 + return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.CUSTOM.getMode(),
  83 + JsonUtils.toJsonString(response));
  84 + }
  85 +
  86 + @Override
  87 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
  88 + // TODO 需要实现
  89 + throw new UnsupportedOperationException();
  90 + }
  91 +
  92 + // ========== 各种工具方法 ==========
  93 +
  94 + static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
  95 + String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
  96 + if (StrUtil.isEmpty(openid)) {
  97 + throw invalidParamException("支付请求的 openid 不能为空!");
  98 + }
  99 + return openid;
  100 + }
  101 +
  102 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
2   -
3   -import cn.hutool.core.bean.BeanUtil;
4   -import cn.hutool.core.date.DateUtil;
5   -import cn.hutool.core.date.LocalDateTimeUtil;
6   -import cn.hutool.core.lang.Assert;
7   -import cn.hutool.core.map.MapUtil;
8   -import cn.hutool.core.util.StrUtil;
9   -import cn.iocoder.yudao.framework.common.util.io.FileUtils;
10   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
11   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
12   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
13   -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
14   -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
15   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
16   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
17   -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
18   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
19   -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
20   -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
21   -import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
22   -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
23   -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
24   -import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
25   -import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
26   -import com.github.binarywang.wxpay.config.WxPayConfig;
27   -import com.github.binarywang.wxpay.constant.WxPayConstants;
28   -import com.github.binarywang.wxpay.exception.WxPayException;
29   -import com.github.binarywang.wxpay.service.WxPayService;
30   -import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
31   -import lombok.extern.slf4j.Slf4j;
32   -
33   -import java.time.ZoneId;
34   -import java.util.Date;
35   -import java.util.Objects;
36   -
37   -/**
38   - * 微信小程序下支付
39   - *
40   - * @author zwy
41   - */
42   -@Slf4j
43   -public class WXLitePayClient extends AbstractPayClient<WXPayClientConfig> {
44   -
45   - private WxPayService client;
46   -
47   - public WXLitePayClient(Long channelId, WXPayClientConfig config) {
48   - super(channelId, PayChannelEnum.WX_LITE.getCode(), config);
49   - }
50   -
51   - @Override
52   - protected void doInit() {
53   - WxPayConfig payConfig = new WxPayConfig();
54   - BeanUtil.copyProperties(config, payConfig, "privateKeyContent","privateCertContent");
55   - payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式
56   -// if (StrUtil.isNotEmpty(config.getKeyContent())) {
57   -// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8));
58   -// }
59   - if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
60   - // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
61   - payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
62   - }
63   - if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
64   - // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
65   - payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
66   - }
67   - // 真实客户端
68   - this.client = new WxPayServiceImpl();
69   - client.setConfig(payConfig);
70   - }
71   -
72   - @Override
73   - public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
74   - throw new UnsupportedOperationException();
75   -// WxPayMpOrderResult response;
76   -// try {
77   -// switch (config.getApiVersion()) {
78   -// case WXPayClientConfig.API_VERSION_V2:
79   -// response = this.unifiedOrderV2(reqDTO);
80   -// break;
81   -// case WXPayClientConfig.API_VERSION_V3:
82   -// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
83   -// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
84   -// response = new WxPayMpOrderResult();
85   -// BeanUtil.copyProperties(responseV3, response, true);
86   -// break;
87   -// default:
88   -// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
89   -// }
90   -// } catch (WxPayException e) {
91   -// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
92   -// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
93   -// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
94   -// }
95   -// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
96   - }
97   -
98   - private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
99   - // 构建 WxPayUnifiedOrderRequest 对象
100   - WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
101   - .outTradeNo(reqDTO.getMerchantOrderId())
102   - .body(reqDTO.getBody())
103   - .totalFee(reqDTO.getAmount().intValue()) // 单位分
104   - .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyyMMddHHmmss")) // v2的时间格式
105   - .spbillCreateIp(reqDTO.getUserIp())
106   - .openid(getOpenid(reqDTO))
107   - .notifyUrl(reqDTO.getNotifyUrl())
108   - .build();
109   - // 执行请求
110   - return client.createOrder(request);
111   - }
112   -
113   - private WxPayUnifiedOrderV3Result.JsapiResult unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
114   - // 构建 WxPayUnifiedOrderRequest 对象
115   - WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
116   - request.setOutTradeNo(reqDTO.getMerchantOrderId());
117   -
118   - request.setDescription(reqDTO.getBody());
119   - request.setAmount(new WxPayUnifiedOrderV3Request
120   - .Amount()
121   - .setTotal(reqDTO
122   - .getAmount()
123   - .intValue())); // 单位分
124   - request.setTimeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式
125   - request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO)));
126   - request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
127   - request.setNotifyUrl(reqDTO.getNotifyUrl());
128   - // 执行请求
129   - return client.createOrderV3(TradeTypeEnum.JSAPI, request);
130   - }
131   -
132   - private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
133   - String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
134   - if (StrUtil.isEmpty(openid)) {
135   - throw new IllegalArgumentException("支付请求的 openid 不能为空!");
136   - }
137   - return openid;
138   - }
139   -
140   - /**
141   - *
142   - * 微信支付回调 分 v2 和v3 的处理方式
143   - *
144   - * @param data 通知结果
145   - * @return 支付回调对象
146   - * @throws WxPayException 微信异常类
147   - */
148   -// @Override
149   - public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyReqDTO data) throws WxPayException {
150   - log.info("[parseOrderNotify][微信支付回调data数据:{}]", data.getBody());
151   - // 微信支付 v2 回调结果处理
152   - switch (config.getApiVersion()) {
153   - case WXPayClientConfig.API_VERSION_V2:
154   - return parseOrderNotifyV2(data);
155   - case WXPayClientConfig.API_VERSION_V3:
156   - return parseOrderNotifyV3(data);
157   - default:
158   - throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
159   - }
160   - }
161   -
162   - private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
163   - WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null);
164   - WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult();
165   - // 转换结果
166   - Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"),
167   - "支付结果非 SUCCESS");
168   -
169   - return PayOrderNotifyRespDTO
170   - .builder()
171   - .orderExtensionNo(result.getOutTradeNo())
172   - .channelOrderNo(result.getTransactionId())
173   - .channelUserId(result.getPayer().getOpenid())
174   - .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX"))
175   - .build();
176   - }
177   -
178   - private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
179   - WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
180   - Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
181   - // 转换结果
182   - return PayOrderNotifyRespDTO
183   - .builder()
184   - .orderExtensionNo(notifyResult.getOutTradeNo())
185   - .channelOrderNo(notifyResult.getTransactionId())
186   - .channelUserId(notifyResult.getOpenid())
187   - .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
188   - .build();
189   -
190   - }
191   -
192   - @Override
193   - protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
194   - //TODO 需要实现
195   - throw new UnsupportedOperationException();
196   - }
197   -
198   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
2   -
3   -import cn.hutool.core.bean.BeanUtil;
4   -import cn.hutool.core.date.DateUtil;
5   -import cn.hutool.core.date.LocalDateTimeUtil;
6   -import cn.hutool.core.lang.Assert;
7   -import cn.hutool.core.util.StrUtil;
8   -import cn.iocoder.yudao.framework.common.util.io.FileUtils;
9   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
10   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
11   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
12   -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
13   -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
14   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
15   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
16   -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
17   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
18   -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
19   -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
20   -import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
21   -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
22   -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
23   -import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
24   -import com.github.binarywang.wxpay.config.WxPayConfig;
25   -import com.github.binarywang.wxpay.constant.WxPayConstants;
26   -import com.github.binarywang.wxpay.exception.WxPayException;
27   -import com.github.binarywang.wxpay.service.WxPayService;
28   -import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
29   -import lombok.extern.slf4j.Slf4j;
30   -
31   -import java.time.ZoneId;
32   -import java.util.Date;
33   -import java.util.Objects;
34   -
35   -/**
36   - * 微信 App 支付
37   - *
38   - * @author zwy
39   - */
40   -@Slf4j
41   -public class WXNativePayClient extends AbstractPayClient<WXPayClientConfig> {
42   -
43   - private WxPayService client;
44   -
45   - public WXNativePayClient(Long channelId, WXPayClientConfig config) {
46   - super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config);
47   - }
48   -
49   - @Override
50   - protected void doInit() {
51   - WxPayConfig payConfig = new WxPayConfig();
52   - BeanUtil.copyProperties(config, payConfig, "keyContent");
53   - payConfig.setTradeType(WxPayConstants.TradeType.NATIVE); // 设置使用 native 支付方式
54   -// if (StrUtil.isNotEmpty(config.getKeyContent())) {
55   -// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8));
56   -// }
57   - if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
58   - // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
59   - payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
60   - }
61   - if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
62   - // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
63   - payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
64   - }
65   - // 真实客户端
66   - this.client = new WxPayServiceImpl();
67   - client.setConfig(payConfig);
68   - }
69   -
70   - @Override
71   - public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
72   - throw new UnsupportedOperationException();
73   -// // 这里原生的返回的是支付的 url 所以直接使用string接收
74   -// // "invokeResponse": "weixin://wxpay/bizpayurl?pr=EGYAem7zz"
75   -// String responseV3;
76   -// try {
77   -// switch (config.getApiVersion()) {
78   -// case WXPayClientConfig.API_VERSION_V2:
79   -// responseV3 = unifiedOrderV2(reqDTO).getCodeUrl();
80   -// break;
81   -// case WXPayClientConfig.API_VERSION_V3:
82   -// responseV3 = this.unifiedOrderV3(reqDTO);
83   -// break;
84   -// default:
85   -// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
86   -// }
87   -// } catch (WxPayException e) {
88   -// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
89   -// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
90   -// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
91   -// }
92   -// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, responseV3, codeMapping);
93   - }
94   -
95   - private WxPayNativeOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
96   - //前端
97   - String tradeType = reqDTO.getChannelExtras().get("trade_type");
98   - // 构建 WxPayUnifiedOrderRequest 对象
99   - WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest
100   - .newBuilder()
101   - .outTradeNo(reqDTO.getMerchantOrderId())
102   - .body(reqDTO.getBody())
103   - .totalFee(reqDTO.getAmount().intValue()) // 单位分
104   - .timeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX"))
105   - .spbillCreateIp(reqDTO.getUserIp())
106   - .notifyUrl(reqDTO.getNotifyUrl())
107   - .productId(tradeType)
108   - .build();
109   - // 执行请求
110   - return client.createOrder(request);
111   - }
112   -
113   - private String unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
114   - // 构建 WxPayUnifiedOrderRequest 对象
115   - WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
116   - request.setOutTradeNo(reqDTO.getMerchantOrderId());
117   - request.setDescription(reqDTO.getBody());
118   - request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount().intValue())); // 单位分
119   - request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
120   - request.setNotifyUrl(reqDTO.getNotifyUrl());
121   - // 执行请求
122   - return client.createOrderV3(TradeTypeEnum.NATIVE, request);
123   - }
124   -
125   - /**
126   - *
127   - * 微信支付回调 分v2 和v3 的处理方式
128   - *
129   - * @param data 通知结果
130   - * @return 支付回调对象
131   - * @throws WxPayException 微信异常类
132   - */
133   -// @Override
134   - public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyReqDTO data) throws WxPayException {
135   - log.info("微信支付回调data数据:{}", data.getBody());
136   - // 微信支付 v2 回调结果处理
137   - switch (config.getApiVersion()) {
138   - case WXPayClientConfig.API_VERSION_V2:
139   - return parseOrderNotifyV2(data);
140   - case WXPayClientConfig.API_VERSION_V3:
141   - return parseOrderNotifyV3(data);
142   - default:
143   - throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
144   - }
145   - }
146   -
147   - private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
148   - WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null);
149   - WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult();
150   - // 转换结果
151   - Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"),
152   - "支付结果非 SUCCESS");
153   - return PayOrderNotifyRespDTO
154   - .builder()
155   - .orderExtensionNo(result.getOutTradeNo())
156   - .channelOrderNo(result.getTradeState())
157   - .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX"))
158   - .build();
159   - }
160   -
161   - private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
162   - WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
163   - Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
164   - // 转换结果
165   - return PayOrderNotifyRespDTO
166   - .builder()
167   - .orderExtensionNo(notifyResult.getOutTradeNo())
168   - .channelOrderNo(notifyResult.getTransactionId())
169   - .channelUserId(notifyResult.getOpenid())
170   - .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
171   - .build();
172   -
173   - }
174   -
175   - @Override
176   - protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
177   - // TODO 需要实现
178   - throw new UnsupportedOperationException();
179   - }
180   -
181   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
2   -
3   -import cn.hutool.core.bean.BeanUtil;
4   -import cn.hutool.core.date.LocalDateTimeUtil;
5   -import cn.hutool.core.date.TemporalAccessorUtil;
6   -import cn.hutool.core.lang.Assert;
7   -import cn.hutool.core.map.MapUtil;
8   -import cn.hutool.core.util.StrUtil;
9   -import cn.iocoder.yudao.framework.common.util.io.FileUtils;
10   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
11   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
12   -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
13   -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
14   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
15   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
16   -import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
17   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
18   -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
19   -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
20   -import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
21   -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
22   -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
23   -import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
24   -import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
25   -import com.github.binarywang.wxpay.config.WxPayConfig;
26   -import com.github.binarywang.wxpay.constant.WxPayConstants;
27   -import com.github.binarywang.wxpay.exception.WxPayException;
28   -import com.github.binarywang.wxpay.service.WxPayService;
29   -import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
30   -import lombok.extern.slf4j.Slf4j;
31   -
32   -import java.time.LocalDateTime;
33   -import java.time.ZoneId;
34   -import java.util.Objects;
35   -
36   -/**
37   - * 微信支付(公众号)的 PayClient 实现类
38   - *
39   - * @author 芋道源码
40   - */
41   -@Slf4j
42   -public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> {
43   -
44   - private WxPayService client;
45   -
46   - public WXPubPayClient(Long channelId, WXPayClientConfig config) {
47   - super(channelId, PayChannelEnum.WX_PUB.getCode(), config);
48   - }
49   -
50   - @Override
51   - protected void doInit() {
52   - WxPayConfig payConfig = new WxPayConfig();
53   - BeanUtil.copyProperties(config, payConfig, "keyContent");
54   - payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式
55   -// if (StrUtil.isNotEmpty(config.getKeyContent())) {
56   -// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8));
57   -// }
58   - if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
59   - // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
60   - payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
61   - }
62   - if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
63   - // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
64   - payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
65   - }
66   - // 真实客户端
67   - this.client = new WxPayServiceImpl();
68   - client.setConfig(payConfig);
69   - }
70   -
71   - @Override
72   - public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
73   - throw new UnsupportedOperationException();
74   -//
75   -// WxPayMpOrderResult response;
76   -// try {
77   -// switch (config.getApiVersion()) {
78   -// case WXPayClientConfig.API_VERSION_V2:
79   -// response = this.unifiedOrderV2(reqDTO);
80   -// break;
81   -// case WXPayClientConfig.API_VERSION_V3:
82   -// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
83   -// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
84   -// response = new WxPayMpOrderResult();
85   -// BeanUtil.copyProperties(responseV3, response, true);
86   -// break;
87   -// default:
88   -// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
89   -// }
90   -// } catch (WxPayException e) {
91   -// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
92   -// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
93   -// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping);
94   -// }
95   -// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
96   - }
97   -
98   -
99   - private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
100   - // 构建 WxPayUnifiedOrderRequest 对象
101   - WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
102   - .outTradeNo(reqDTO.getMerchantOrderId())
103   - .body(reqDTO.getBody())
104   - .totalFee(reqDTO.getAmount()) // 单位分
105   - .timeExpire(formatDate(reqDTO.getExpireTime()))
106   - .spbillCreateIp(reqDTO.getUserIp())
107   - .openid(getOpenid(reqDTO))
108   - .notifyUrl(reqDTO.getNotifyUrl())
109   - .build();
110   - // 执行请求
111   - return client.createOrder(request);
112   - }
113   -
114   - private WxPayUnifiedOrderV3Result.JsapiResult unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
115   - // 构建 WxPayUnifiedOrderRequest 对象
116   - WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
117   - request.setOutTradeNo(reqDTO.getMerchantOrderId());
118   - request.setDescription(reqDTO.getBody());
119   - request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount())); // 单位分
120   - request.setTimeExpire(formatDate(reqDTO.getExpireTime()));
121   - request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO)));
122   - request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
123   - request.setNotifyUrl(reqDTO.getNotifyUrl());
124   - // 执行请求
125   - return client.createOrderV3(TradeTypeEnum.JSAPI, request);
126   - }
127   -
128   - private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
129   - String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
130   - if (StrUtil.isEmpty(openid)) {
131   - throw new IllegalArgumentException("支付请求的 openid 不能为空!");
132   - }
133   - return openid;
134   - }
135   -
136   - /**
137   - *
138   - * 微信支付回调 分v2 和v3 的处理方式
139   - *
140   - * @param data 通知结果
141   - * @return 支付回调对象
142   - * @throws WxPayException 微信异常类
143   - */
144   -// @Override
145   - public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyReqDTO data) throws WxPayException {
146   - log.info("[parseOrderNotify][微信支付回调data数据: {}]", data.getBody());
147   - // 微信支付 v2 回调结果处理
148   - switch (config.getApiVersion()) {
149   - case WXPayClientConfig.API_VERSION_V2:
150   - return parseOrderNotifyV2(data);
151   - case WXPayClientConfig.API_VERSION_V3:
152   - return parseOrderNotifyV3(data);
153   - default:
154   - throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
155   - }
156   - }
157   -
158   - private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
159   - WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null);
160   - WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult();
161   - // 转换结果
162   - Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"),
163   - "支付结果非 SUCCESS");
164   - return PayOrderNotifyRespDTO
165   - .builder()
166   - .orderExtensionNo(result.getOutTradeNo())
167   - .channelOrderNo(result.getTradeState())
168   - .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX"))
169   - .build();
170   - }
171   -
172   - private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
173   - WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
174   - Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
175   - // 转换结果
176   - return PayOrderNotifyRespDTO
177   - .builder()
178   - .orderExtensionNo(notifyResult.getOutTradeNo())
179   - .channelOrderNo(notifyResult.getTransactionId())
180   - .channelUserId(notifyResult.getOpenid())
181   - .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
182   - .build();
183   -
184   - }
185   -
186   - @Override
187   - protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
188   - // TODO 需要实现
189   - throw new UnsupportedOperationException();
190   - }
191   -
192   - private static String formatDate(LocalDateTime time) {
193   - return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), "yyyy-MM-dd'T'HH:mm:ssXXX");
194   - }
195   -
196   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayFrameworkErrorCodeConstants.java
... ... @@ -11,19 +11,6 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
11 11 */
12 12 public interface PayFrameworkErrorCodeConstants {
13 13  
14   - ErrorCode PAY_UNKNOWN = new ErrorCode(2002000000, "未知错误,需要解析");
15   -
16   - // ========== 配置相关相关 2002000100 ==========
17   - // todo 芋艿:如下的错误码,怎么处理掉
18   - ErrorCode PAY_CONFIG_APP_ID_ERROR = new ErrorCode(2002000100, "支付渠道 AppId 不正确");
19   - ErrorCode PAY_CONFIG_SIGN_ERROR = new ErrorCode(2002000100, "签名错误"); // 例如说,微信支付,配置错了 mchId 或者 mchKey
20   -
21   -
22   - // ========== 其它相关 2002000900 开头 ==========
23   - // todo 芋艿:如下的错误码,怎么处理掉
24   - ErrorCode PAY_OPENID_ERROR = new ErrorCode(2002000900, "无效的 openid"); // 例如说,微信 openid 未授权过
25   - ErrorCode PAY_PARAM_MISSING = new ErrorCode(2002000901, "请求参数缺失"); // 例如说,支付少传了金额
26   -
27   - ErrorCode PAY_EXCEPTION = new ErrorCode(2002000999, "调用异常");
  14 + ErrorCode ORDER_UNIFIED_ERROR = new ErrorCode(2002000000, "发起支付失败,原因:{}");
28 15  
29 16 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelEnum.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java
1   -package cn.iocoder.yudao.framework.pay.core.enums;
  1 +package cn.iocoder.yudao.framework.pay.core.enums.channel;
2 2  
3 3 import cn.hutool.core.util.ArrayUtil;
4 4 import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
5 5 import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
6   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig;
  6 +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig;
7 7 import lombok.AllArgsConstructor;
8 8 import lombok.Getter;
9 9  
10 10 /**
11 11 * 支付渠道的编码的枚举
12   - * 枚举值
13 12 *
14 13 * @author 芋道源码
15 14 */
... ... @@ -17,10 +16,12 @@ import lombok.Getter;
17 16 @AllArgsConstructor
18 17 public enum PayChannelEnum {
19 18  
20   - WX_PUB("wx_pub", "微信 JSAPI 支付", WXPayClientConfig.class), // 公众号网页
21   - WX_LITE("wx_lite", "微信小程序支付", WXPayClientConfig.class),
22   - WX_APP("wx_app", "微信 App 支付", WXPayClientConfig.class),
23   - WX_NATIVE("wx_native", "微信 native 支付", WXPayClientConfig.class),
  19 + WX_PUB("wx_pub", "微信 JSAPI 支付", WxPayClientConfig.class), // 公众号网页
  20 + WX_LITE("wx_lite", "微信小程序支付", WxPayClientConfig.class),
  21 + WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class),
  22 + WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class),
  23 + WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class),
  24 + WX_H5("wx_h5", "微信 H5 支付", WxPayClientConfig.class),
24 25  
25 26 ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class),
26 27 ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class),
... ... @@ -30,8 +31,8 @@ public enum PayChannelEnum {
30 31  
31 32 /**
32 33 * 编码
33   - * <p>
34   - * 参考 https://www.pingxx.com/api/支付渠道属性值.html
  34 + *
  35 + * 参考 <a href="https://www.pingxx.com/api/支付渠道属性值.html">支付渠道属性值</a>
35 36 */
36 37 private final String code;
37 38 /**
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayDisplayModeEnum.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/order/PayOrderDisplayModeEnum.java
1   -package cn.iocoder.yudao.framework.pay.core.enums;
  1 +package cn.iocoder.yudao.framework.pay.core.enums.order;
2 2  
3 3 import lombok.AllArgsConstructor;
4 4 import lombok.Getter;
... ... @@ -10,15 +10,16 @@ import lombok.Getter;
10 10 */
11 11 @Getter
12 12 @AllArgsConstructor
13   -public enum PayDisplayModeEnum {
  13 +public enum PayOrderDisplayModeEnum {
14 14  
15 15 URL("url"), // Redirect 跳转链接的方式
16   - IFRAME("iframe"), // IFrame 内嵌链接的方式
  16 + IFRAME("iframe"), // IFrame 内嵌链接的方式【目前暂时用不到】
17 17 FORM("form"), // HTML 表单提交
18 18 QR_CODE("qr_code"), // 二维码的文字内容
19 19 QR_CODE_URL("qr_code_url"), // 二维码的图片链接
20 20 BAR_CODE("bar_code"), // 条形码
21   - APP("app"), // 应用
  21 + APP("app"), // 应用【目前暂时用不到】
  22 + CUSTOM("custom"), // 自定义:每种支付方式,做个性化处理;例如说,微信公众号支付时,调用 JSAPI 接口
22 23 ;
23 24  
24 25 /**
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/order/PayOrderStatusRespEnum.java 0 → 100644
  1 +package cn.iocoder.yudao.framework.pay.core.enums.order;
  2 +
  3 +import lombok.AllArgsConstructor;
  4 +import lombok.Getter;
  5 +
  6 +/**
  7 + * 渠道的支付状态枚举
  8 + *
  9 + * @author 遇到源码
  10 + */
  11 +@Getter
  12 +@AllArgsConstructor
  13 +public enum PayOrderStatusRespEnum {
  14 +
  15 + WAITING(0, "未支付"),
  16 + SUCCESS(10, "支付成功"),
  17 + CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款
  18 + ;
  19 +
  20 + private final Integer status;
  21 + private final String name;
  22 +
  23 +}
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayNotifyRefundStatusEnum.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/refund/PayNotifyRefundStatusEnum.java
1   -package cn.iocoder.yudao.framework.pay.core.enums;
  1 +package cn.iocoder.yudao.framework.pay.core.enums.refund;
2 2  
  3 +// TODO 芋艿:看看能不能去掉
3 4 /**
4 5 * 退款通知, 统一的渠道退款状态
5 6 *
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayChannelRefundRespEnum.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/refund/PayRefundRespEnum.java
1   -package cn.iocoder.yudao.framework.pay.core.enums;
  1 +package cn.iocoder.yudao.framework.pay.core.enums.refund;
2 2  
3 3 import lombok.AllArgsConstructor;
4 4 import lombok.Getter;
5 5  
6 6 /**
7   - * 渠道统一的退款返回结果
  7 + * 渠道的退款状态枚举
8 8 *
9   - * @author jason
  9 + * @author jason
10 10 */
11 11 @Getter
12 12 @AllArgsConstructor
13   -public enum PayChannelRefundRespEnum {
  13 +public enum PayRefundRespEnum {
14 14  
15 15 SUCCESS(1, "退款成功"),
16 16 FAILURE(2, "退款失败"),
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImplIntegrationTest.java
... ... @@ -2,17 +2,14 @@ package cn.iocoder.yudao.framework.pay.core.client.impl;
2 2  
3 3 import cn.hutool.core.io.IoUtil;
4 4 import cn.hutool.core.util.RandomUtil;
5   -import cn.iocoder.yudao.framework.common.pojo.CommonResult;
6   -import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
7 5 import cn.iocoder.yudao.framework.pay.core.client.PayClient;
8 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
9 7 import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
10 8 import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient;
11 9 import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient;
12   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig;
13   -import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient;
14   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
15   -import com.alipay.api.response.AlipayTradePrecreateResponse;
  10 +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig;
  11 +import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPubPayClient;
  12 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
16 13 import org.junit.jupiter.api.Disabled;
17 14 import org.junit.jupiter.api.Test;
18 15  
... ... @@ -30,15 +27,15 @@ public class PayClientFactoryImplIntegrationTest {
30 27 private final PayClientFactoryImpl payClientFactory = new PayClientFactoryImpl();
31 28  
32 29 /**
33   - * {@link WXPubPayClient} 的 V2 版本
  30 + * {@link WxPubPayClient} 的 V2 版本
34 31 */
35 32 @Test
36 33 public void testCreatePayClient_WX_PUB_V2() {
37 34 // 创建配置
38   - WXPayClientConfig config = new WXPayClientConfig();
  35 + WxPayClientConfig config = new WxPayClientConfig();
39 36 config.setAppId("wx041349c6f39b268b");
40 37 config.setMchId("1545083881");
41   - config.setApiVersion(WXPayClientConfig.API_VERSION_V2);
  38 + config.setApiVersion(WxPayClientConfig.API_VERSION_V2);
42 39 config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p");
43 40 // 创建客户端
44 41 Long channelId = RandomUtil.randomLong();
... ... @@ -51,15 +48,15 @@ public class PayClientFactoryImplIntegrationTest {
51 48 }
52 49  
53 50 /**
54   - * {@link WXPubPayClient} 的 V3 版本
  51 + * {@link WxPubPayClient} 的 V3 版本
55 52 */
56 53 @Test
57 54 public void testCreatePayClient_WX_PUB_V3() throws FileNotFoundException {
58 55 // 创建配置
59   - WXPayClientConfig config = new WXPayClientConfig();
  56 + WxPayClientConfig config = new WxPayClientConfig();
60 57 config.setAppId("wx041349c6f39b268b");
61 58 config.setMchId("1545083881");
62   - config.setApiVersion(WXPayClientConfig.API_VERSION_V3);
  59 + config.setApiVersion(WxPayClientConfig.API_VERSION_V3);
63 60 config.setPrivateKeyContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_key.pem")));
64 61 config.setPrivateCertContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem")));
65 62 config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase");
... ...
yudao-module-member/yudao-module-member-biz/pom.xml
... ... @@ -41,11 +41,11 @@
41 41 </dependency>
42 42 <dependency>
43 43 <groupId>cn.iocoder.boot</groupId>
44   - <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
  44 + <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
45 45 </dependency>
46 46 <dependency>
47 47 <groupId>cn.iocoder.boot</groupId>
48   - <artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
  48 + <artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
49 49 </dependency>
50 50  
51 51 <!-- Web 相关 -->
... ...
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/weixin/AppWxMpController.http deleted
1   -### 请求 /login 接口 => 成功
2   -GET {{userServerUrl}}/wx/mp/get-jsapi-ticket
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
... ... @@ -125,6 +125,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
125 125 @Override
126 126 public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) {
127 127 // 获得对应的手机号信息
  128 + // TODO @芋艿:需要弱化微信小程序的依赖,通过 system 获取手机号
128 129 WxMaPhoneNumberInfo phoneNumberInfo;
129 130 try {
130 131 phoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(reqVO.getPhoneCode());
... ...
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java
1 1 package cn.iocoder.yudao.module.pay.enums;
2 2  
3   -import cn.hutool.core.util.ObjectUtil;
4 3 import cn.iocoder.yudao.framework.common.exception.ErrorCode;
5 4  
6 5 /**
... ... @@ -21,21 +20,15 @@ public interface ErrorCodeConstants {
21 20 ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在");
22 21 ErrorCode CHANNEL_NOT_EXISTS = new ErrorCode(1007001003, "支付渠道不存在");
23 22 ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001005, "已存在相同的渠道");
24   - ErrorCode CHANNEL_WECHAT_VERSION_2_MCH_KEY_IS_NULL = new ErrorCode(1007001006,"微信渠道v2版本中商户密钥不可为空");
25   - ErrorCode CHANNEL_WECHAT_VERSION_3_PRIVATE_KEY_IS_NULL = new ErrorCode(1007001007,"微信渠道v3版本apiclient_key.pem不可为空");
26   - ErrorCode CHANNEL_WECHAT_VERSION_3_CERT_KEY_IS_NULL = new ErrorCode(1007001008,"微信渠道v3版本中apiclient_cert.pem不可为空");
27   - ErrorCode PAY_CHANNEL_NOTIFY_VERIFY_FAILED = new ErrorCode(1007001009, "渠道通知校验失败");
28 23  
29 24 // ========== ORDER 模块 1007002000 ==========
30 25 ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
31 26 ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
32 27 ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付");
33   - ErrorCode PAY_ORDER_ERROR_USER = new ErrorCode(1007002003, "支付订单用户不正确");
34 28  
35 29 // ========== ORDER 模块(拓展单) 1007003000 ==========
36 30 ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
37 31 ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
38   - ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007003002, "支付订单不处于已支付");
39 32  
40 33 // ========== 支付模块(退款) 1007006000 ==========
41 34 ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额");
... ...
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/order/PayOrderStatusEnum.java
... ... @@ -17,7 +17,7 @@ public enum PayOrderStatusEnum implements IntArrayValuable {
17 17  
18 18 WAITING(0, "未支付"),
19 19 SUCCESS(10, "支付成功"),
20   - CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款 TODO 芋艿:需要优化下
  20 + CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款
21 21 ;
22 22  
23 23 private final Integer status;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayAppController.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/PayAppController.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app;
2 2  
3 3 import cn.hutool.core.collection.CollUtil;
4 4 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 6 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
7   -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
8   -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
9   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
10   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.*;
  7 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  8 +import cn.iocoder.yudao.module.pay.controller.admin.app.vo.*;
11 9 import cn.iocoder.yudao.module.pay.convert.app.PayAppConvert;
12   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
13   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
14   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
15   -import cn.iocoder.yudao.module.pay.service.merchant.PayAppService;
16   -import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService;
17   -import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
18   -import io.swagger.v3.oas.annotations.tags.Tag;
19   -import io.swagger.v3.oas.annotations.Parameter;
  10 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
  11 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
  12 +import cn.iocoder.yudao.module.pay.service.app.PayAppService;
  13 +import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
20 14 import io.swagger.v3.oas.annotations.Operation;
  15 +import io.swagger.v3.oas.annotations.Parameter;
  16 +import io.swagger.v3.oas.annotations.tags.Tag;
21 17 import lombok.extern.slf4j.Slf4j;
22 18 import org.springframework.security.access.prepost.PreAuthorize;
23 19 import org.springframework.validation.annotation.Validated;
24 20 import org.springframework.web.bind.annotation.*;
25 21  
26 22 import javax.annotation.Resource;
27   -import javax.servlet.http.HttpServletResponse;
28 23 import javax.validation.Valid;
29   -import java.io.IOException;
30 24 import java.util.*;
31 25  
32 26 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
33   -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
34 27  
35 28 @Slf4j
36 29 @Tag(name = "管理后台 - 支付应用信息")
... ... @@ -43,8 +36,6 @@ public class PayAppController {
43 36 private PayAppService appService;
44 37 @Resource
45 38 private PayChannelService channelService;
46   - @Resource
47   - private PayMerchantService merchantService;
48 39  
49 40 @PostMapping("/create")
50 41 @Operation(summary = "创建支付应用信息")
... ... @@ -112,17 +103,11 @@ public class PayAppController {
112 103 // TODO @aquan:可以基于 appId 简历一个 multiMap。这样下面,直接 get 到之后,CollUtil buildSet 即可
113 104 Iterator<PayChannelDO> iterator = channels.iterator();
114 105  
115   - // 得到所有的商户信息
116   - Collection<Long> merchantIds = CollectionUtils.convertList(pageResult.getList(), PayAppDO::getMerchantId);
117   - Map<Long, PayMerchantDO> deptMap = merchantService.getMerchantMap(merchantIds);
118   -
119 106 // 利用反射将渠道数据复制到返回的数据结构中去
120 107 List<PayAppPageItemRespVO> appList = new ArrayList<>(pageResult.getList().size());
121 108 pageResult.getList().forEach(app -> {
122 109 // 写入应用信息的数据
123 110 PayAppPageItemRespVO respVO = PayAppConvert.INSTANCE.pageConvert(app);
124   - // 写入商户的数据
125   - respVO.setPayMerchant(PayAppConvert.INSTANCE.convert(deptMap.get(app.getMerchantId())));
126 111 // 写入支付渠道信息的数据
127 112 Set<String> channelCodes = new HashSet<>(PayChannelEnum.values().length);
128 113 while (iterator.hasNext()) {
... ... @@ -139,25 +124,4 @@ public class PayAppController {
139 124 return success(new PageResult<>(appList, pageResult.getTotal()));
140 125 }
141 126  
142   - @GetMapping("/export-excel")
143   - @Operation(summary = "导出支付应用信息 Excel")
144   - @PreAuthorize("@ss.hasPermission('pay:app:export')")
145   - @OperateLog(type = EXPORT)
146   - public void exportAppExcel(@Valid PayAppExportReqVO exportReqVO,
147   - HttpServletResponse response) throws IOException {
148   - List<PayAppDO> list = appService.getAppList(exportReqVO);
149   - // 导出 Excel
150   - List<PayAppExcelVO> datas = PayAppConvert.INSTANCE.convertList02(list);
151   - ExcelUtils.write(response, "支付应用信息.xls", "数据", PayAppExcelVO.class, datas);
152   - }
153   -
154   - @GetMapping("/list-merchant-id")
155   - @Operation(summary = "根据商户 ID 查询支付应用信息")
156   - @Parameter(name = "merchantId", description = "商户ID", required = true, example = "1")
157   - @PreAuthorize("@ss.hasPermission('pay:merchant:query')")
158   - public CommonResult<List<PayAppRespVO>> getMerchantListByName(@RequestParam Long merchantId) {
159   - List<PayAppDO> appListDO = appService.getListByMerchantId(merchantId);
160   - return success(PayAppConvert.INSTANCE.convertList(appListDO));
161   - }
162   -
163 127 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppBaseVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppBaseVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4 import javax.validation.constraints.*;
... ... @@ -29,8 +29,4 @@ public class PayAppBaseVO {
29 29 @NotNull(message = "退款结果的回调地址不能为空")
30 30 private String refundNotifyUrl;
31 31  
32   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
33   - @NotNull(message = "商户编号不能为空")
34   - private Long merchantId;
35   -
36 32 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppCreateReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppCreateReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageItemRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppPageItemRespVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
... ... @@ -20,25 +20,7 @@ public class PayAppPageItemRespVO extends PayAppBaseVO {
20 20 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
21 21 private LocalDateTime createTime;
22 22  
23   - /**
24   - * 所属商户
25   - */
26   - private PayMerchant payMerchant;
27   -
28   - @Schema(description = "商户")
29   - @Data
30   - public static class PayMerchant {
31   -
32   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
33   - private Long id;
34   -
35   - @Schema(description = "商户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
36   - private String name;
37   -
38   - }
39   -
40   - @Schema(description = "渠道编码集合", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_pc,alipay_wap...")
  23 + @Schema(description = "渠道编码集合", requiredMode = Schema.RequiredMode.REQUIRED, example = "[alipay_pc, alipay_wap]")
41 24 private Set<String> channelCodes;
42 25  
43   -
44 26 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppPageReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppPageReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
4 2  
5   -import java.time.LocalDateTime;
6 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.ToString;
7 8 import org.springframework.format.annotation.DateTimeFormat;
8 9  
  10 +import java.time.LocalDateTime;
  11 +
9 12 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10 13  
11 14 @Schema(description = "管理后台 - 支付应用信息分页 Request VO")
... ... @@ -29,9 +32,6 @@ public class PayAppPageReqVO extends PageParam {
29 32 @Schema(description = "退款结果的回调地址")
30 33 private String refundNotifyUrl;
31 34  
32   - @Schema(description = "商户名称")
33   - private String merchantName;
34   -
35 35 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
36 36 @Schema(description = "创建时间")
37 37 private LocalDateTime[] createTime;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppRespVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4 import javax.validation.constraints.*;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppUpdateStatusReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/app/vo/PayAppUpdateStatusReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayChannelController.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/PayChannelController.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.channel;
2 2  
3   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.*;
4   -import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert;
5   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
6   -import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService;
7 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
8 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
9   -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
10   -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
11   -import io.swagger.v3.oas.annotations.tags.Tag;
  5 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO;
  6 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelPageReqVO;
  7 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelRespVO;
  8 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO;
  9 +import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert;
  10 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
  11 +import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
  12 +import io.swagger.v3.oas.annotations.Operation;
12 13 import io.swagger.v3.oas.annotations.Parameter;
13 14 import io.swagger.v3.oas.annotations.Parameters;
14   -import io.swagger.v3.oas.annotations.Operation;
  15 +import io.swagger.v3.oas.annotations.tags.Tag;
15 16 import org.springframework.security.access.prepost.PreAuthorize;
16 17 import org.springframework.validation.annotation.Validated;
17 18 import org.springframework.web.bind.annotation.*;
18 19  
19 20 import javax.annotation.Resource;
20   -import javax.servlet.http.HttpServletResponse;
21 21 import javax.validation.Valid;
22   -import java.io.IOException;
23   -import java.util.Collection;
24 22 import java.util.List;
  23 +import java.util.Set;
25 24  
26 25 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
27   -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
  26 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
28 27  
29 28 @Tag(name = "管理后台 - 支付渠道")
30 29 @RestController
... ... @@ -68,16 +67,6 @@ public class PayChannelController {
68 67 return success(PayChannelConvert.INSTANCE.convert(channel));
69 68 }
70 69  
71   - @GetMapping("/list")
72   - @Operation(summary = "获得支付渠道列表")
73   - @Parameter(name = "ids", description = "编号列表",
74   - required = true, example = "1024,2048")
75   - @PreAuthorize("@ss.hasPermission('pay:channel:query')")
76   - public CommonResult<List<PayChannelRespVO>> getChannelList(@RequestParam("ids") Collection<Long> ids) {
77   - List<PayChannelDO> list = channelService.getChannelList(ids);
78   - return success(PayChannelConvert.INSTANCE.convertList(list));
79   - }
80   -
81 70 @GetMapping("/page")
82 71 @Operation(summary = "获得支付渠道分页")
83 72 @PreAuthorize("@ss.hasPermission('pay:channel:query')")
... ... @@ -86,33 +75,17 @@ public class PayChannelController {
86 75 return success(PayChannelConvert.INSTANCE.convertPage(pageResult));
87 76 }
88 77  
89   - @GetMapping("/export-excel")
90   - @Operation(summary = "导出支付渠道Excel")
91   - @PreAuthorize("@ss.hasPermission('pay:channel:export')")
92   - @OperateLog(type = EXPORT)
93   - public void exportChannelExcel(@Valid PayChannelExportReqVO exportReqVO,
94   - HttpServletResponse response) throws IOException {
95   - List<PayChannelDO> list = channelService.getChannelList(exportReqVO);
96   - // 导出 Excel
97   - List<PayChannelExcelVO> datas = PayChannelConvert.INSTANCE.convertList02(list);
98   - ExcelUtils.write(response, "支付渠道.xls", "数据", PayChannelExcelVO.class, datas);
99   - }
100   -
  78 + // TODO 芋艿:需要 review 下实现
101 79 @GetMapping("/get-channel")
102 80 @Operation(summary = "根据条件查询微信支付渠道")
103 81 @Parameters({
104   - @Parameter(name = "merchantId", description = "商户编号",
105   - required = true, example = "1"),
106   - @Parameter(name = "appId", description = "应用编号",
107   - required = true, example = "1"),
108   - @Parameter(name = "code", description = "支付渠道编码",
109   - required = true, example = "wx_pub")
  82 + @Parameter(name = "appId", description = "应用编号", required = true, example = "1"),
  83 + @Parameter(name = "code", description = "支付渠道编码", required = true, example = "wx_pub")
110 84 })
111 85 @PreAuthorize("@ss.hasPermission('pay:channel:query')")
112   - public CommonResult<PayChannelRespVO> getChannel(
113   - @RequestParam Long merchantId, @RequestParam Long appId, @RequestParam String code) {
  86 + public CommonResult<PayChannelRespVO> getChannel(@RequestParam Long appId, @RequestParam String code) {
114 87 // 獲取渠道
115   - PayChannelDO channel = channelService.getChannelByConditions(merchantId, appId, code);
  88 + PayChannelDO channel = channelService.getChannelByConditions(appId, code);
116 89 if (channel == null) {
117 90 return success(new PayChannelRespVO());
118 91 }
... ... @@ -121,4 +94,12 @@ public class PayChannelController {
121 94 return success(respVo);
122 95 }
123 96  
  97 + @GetMapping("/get-enable-code-list")
  98 + @Operation(summary = "获得指定应用的开启的支付渠道编码列表")
  99 + @Parameter(name = "appId", description = "应用编号", required = true, example = "1")
  100 + public CommonResult<Set<String>> getEnableChannelCodeList(@RequestParam("appId") Long appId) {
  101 + List<PayChannelDO> channels = channelService.getEnableChannelList(appId);
  102 + return success(convertSet(channels, PayChannelDO::getCode));
  103 + }
  104 +
124 105 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelBaseVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelBaseVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4 import javax.validation.constraints.*;
... ... @@ -25,10 +25,6 @@ public class PayChannelBaseVO {
25 25 @NotNull(message = "渠道费率,单位:百分比不能为空")
26 26 private Double feeRate;
27 27  
28   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
29   - @NotNull(message = "商户编号不能为空")
30   - private Long merchantId;
31   -
32 28 @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
33 29 @NotNull(message = "应用编号不能为空")
34 30 private Long appId;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelCreateReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelCreateReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelPageReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelPageReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
4 2  
5   -import java.time.LocalDateTime;
6 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import lombok.Data;
  6 +import lombok.EqualsAndHashCode;
  7 +import lombok.ToString;
7 8 import org.springframework.format.annotation.DateTimeFormat;
8 9  
  10 +import java.time.LocalDateTime;
  11 +
9 12 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10 13  
11 14 @Schema(description = "管理后台 - 支付渠道 分页 Request VO")
... ... @@ -26,9 +29,6 @@ public class PayChannelPageReqVO extends PageParam {
26 29 @Schema(description = "渠道费率,单位:百分比")
27 30 private Double feeRate;
28 31  
29   - @Schema(description = "商户编号")
30   - private Long merchantId;
31   -
32 32 @Schema(description = "应用编号")
33 33 private Long appId;
34 34  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelRespVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelUpdateReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/channel/vo/PayChannelUpdateReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
2 2 import io.swagger.v3.oas.annotations.media.Schema;
3 3 import lombok.*;
4 4 import javax.validation.constraints.*;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/PayMerchantController.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant;
2   -
3   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.*;
4   -import cn.iocoder.yudao.module.pay.convert.merchant.PayMerchantConvert;
5   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
6   -import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
7   -import cn.iocoder.yudao.framework.common.pojo.CommonResult;
8   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
9   -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
10   -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
11   -import io.swagger.v3.oas.annotations.tags.Tag;
12   -import io.swagger.v3.oas.annotations.Parameter;
13   -import io.swagger.v3.oas.annotations.Operation;
14   -import org.springframework.security.access.prepost.PreAuthorize;
15   -import org.springframework.validation.annotation.Validated;
16   -import org.springframework.web.bind.annotation.*;
17   -
18   -import javax.annotation.Resource;
19   -import javax.servlet.http.HttpServletResponse;
20   -import javax.validation.Valid;
21   -import java.io.IOException;
22   -import java.util.Collection;
23   -import java.util.List;
24   -
25   -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
26   -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
27   -
28   -@Tag(name = "支付商户信息")
29   -@RestController
30   -@RequestMapping("/pay/merchant")
31   -@Validated
32   -public class PayMerchantController {
33   -
34   - @Resource
35   - private PayMerchantService merchantService;
36   -
37   - @PostMapping("/create")
38   - @Operation(summary = "创建支付商户信息")
39   - @PreAuthorize("@ss.hasPermission('pay:merchant:create')")
40   - public CommonResult<Long> createMerchant(@Valid @RequestBody PayMerchantCreateReqVO createReqVO) {
41   - return success(merchantService.createMerchant(createReqVO));
42   - }
43   -
44   - @PutMapping("/update")
45   - @Operation(summary = "更新支付商户信息")
46   - @PreAuthorize("@ss.hasPermission('pay:merchant:update')")
47   - public CommonResult<Boolean> updateMerchant(@Valid @RequestBody PayMerchantUpdateReqVO updateReqVO) {
48   - merchantService.updateMerchant(updateReqVO);
49   - return success(true);
50   - }
51   -
52   - @PutMapping("/update-status")
53   - @Operation(summary = "修改支付商户状态")
54   - @PreAuthorize("@ss.hasPermission('pay:merchant:update')")
55   - public CommonResult<Boolean> updateMerchantStatus(@Valid @RequestBody PayMerchantUpdateStatusReqVO reqVO) {
56   - merchantService.updateMerchantStatus(reqVO.getId(), reqVO.getStatus());
57   - return success(true);
58   - }
59   -
60   - @DeleteMapping("/delete")
61   - @Operation(summary = "删除支付商户信息")
62   - @Parameter(name = "id", description = "编号", required = true)
63   - @PreAuthorize("@ss.hasPermission('pay:merchant:delete')")
64   - public CommonResult<Boolean> deleteMerchant(@RequestParam("id") Long id) {
65   - merchantService.deleteMerchant(id);
66   - return success(true);
67   - }
68   -
69   - @GetMapping("/get")
70   - @Operation(summary = "获得支付商户信息")
71   - @Parameter(name = "id", description = "编号", required = true, example = "1024")
72   - @PreAuthorize("@ss.hasPermission('pay:merchant:query')")
73   - public CommonResult<PayMerchantRespVO> getMerchant(@RequestParam("id") Long id) {
74   - PayMerchantDO merchant = merchantService.getMerchant(id);
75   - return success(PayMerchantConvert.INSTANCE.convert(merchant));
76   - }
77   -
78   - @GetMapping("/list-by-name")
79   - @Operation(summary = "根据商户名称获得支付商户信息列表")
80   - @Parameter(name = "name", description = "商户名称", example = "芋道")
81   - @PreAuthorize("@ss.hasPermission('pay:merchant:query')")
82   - public CommonResult<List<PayMerchantRespVO>> getMerchantListByName(@RequestParam(required = false) String name) {
83   - List<PayMerchantDO> merchantListDO = merchantService.getMerchantListByName(name);
84   - return success(PayMerchantConvert.INSTANCE.convertList(merchantListDO));
85   - }
86   -
87   - @GetMapping("/list")
88   - @Operation(summary = "获得支付商户信息列表")
89   - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
90   - @PreAuthorize("@ss.hasPermission('pay:merchant:query')")
91   - public CommonResult<List<PayMerchantRespVO>> getMerchantList(@RequestParam("ids") Collection<Long> ids) {
92   - List<PayMerchantDO> list = merchantService.getMerchantList(ids);
93   - return success(PayMerchantConvert.INSTANCE.convertList(list));
94   - }
95   -
96   - @GetMapping("/page")
97   - @Operation(summary = "获得支付商户信息分页")
98   - @PreAuthorize("@ss.hasPermission('pay:merchant:query')")
99   - public CommonResult<PageResult<PayMerchantRespVO>> getMerchantPage(@Valid PayMerchantPageReqVO pageVO) {
100   - PageResult<PayMerchantDO> pageResult = merchantService.getMerchantPage(pageVO);
101   - return success(PayMerchantConvert.INSTANCE.convertPage(pageResult));
102   - }
103   -
104   - @GetMapping("/export-excel")
105   - @Operation(summary = "导出支付商户信息 Excel")
106   - @PreAuthorize("@ss.hasPermission('pay:merchant:export')")
107   - @OperateLog(type = EXPORT)
108   - public void exportMerchantExcel(@Valid PayMerchantExportReqVO exportReqVO,
109   - HttpServletResponse response) throws IOException {
110   - List<PayMerchantDO> list = merchantService.getMerchantList(exportReqVO);
111   - // 导出 Excel
112   - List<PayMerchantExcelVO> datas = PayMerchantConvert.INSTANCE.convertList02(list);
113   - ExcelUtils.write(response, "支付商户信息.xls", "数据", PayMerchantExcelVO.class, datas);
114   - }
115   -
116   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExcelVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
2   -
3   -import com.alibaba.excel.annotation.ExcelProperty;
4   -import lombok.Data;
5   -
6   -import java.time.LocalDateTime;
7   -
8   -/**
9   - * 支付应用信息 Excel VO
10   - *
11   - * @author 芋艿
12   - */
13   -@Data
14   -public class PayAppExcelVO {
15   -
16   - @ExcelProperty("应用编号")
17   - private Long id;
18   -
19   - @ExcelProperty("应用名")
20   - private String name;
21   -
22   - @ExcelProperty("开启状态")
23   - private Integer status;
24   -
25   - @ExcelProperty("备注")
26   - private String remark;
27   -
28   - @ExcelProperty("支付结果的回调地址")
29   - private String payNotifyUrl;
30   -
31   - @ExcelProperty("退款结果的回调地址")
32   - private String refundNotifyUrl;
33   -
34   - @ExcelProperty("商户编号")
35   - private Long merchantId;
36   -
37   - @ExcelProperty("创建时间")
38   - private LocalDateTime createTime;
39   -
40   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/app/PayAppExportReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
4   -
5   -import java.time.LocalDateTime;
6   -import org.springframework.format.annotation.DateTimeFormat;
7   -
8   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
9   -
10   -@Schema(description = "管理后台 - 支付应用信息 Excel 导出 Request VO,参数和 PayAppPageReqVO 是一致的")
11   -@Data
12   -public class PayAppExportReqVO {
13   -
14   - @Schema(description = "应用名")
15   - private String name;
16   -
17   - @Schema(description = "开启状态")
18   - private Integer status;
19   -
20   - @Schema(description = "备注")
21   - private String remark;
22   -
23   - @Schema(description = "支付结果的回调地址")
24   - private String payNotifyUrl;
25   -
26   - @Schema(description = "退款结果的回调地址")
27   - private String refundNotifyUrl;
28   -
29   - @Schema(description = "商户名称")
30   - private String merchantName;
31   -
32   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
33   - @Schema(description = "创建时间")
34   - private LocalDateTime[] createTime;
35   -
36   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExcelVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
2   -
3   -import lombok.*;
4   -
5   -import java.time.LocalDateTime;
6   -
7   -import com.alibaba.excel.annotation.ExcelProperty;
8   -
9   -/**
10   - * 支付渠道 Excel VO
11   - *
12   - * @author 芋艿
13   - */
14   -@Data
15   -public class PayChannelExcelVO {
16   -
17   - @ExcelProperty("商户编号")
18   - private Long id;
19   -
20   - @ExcelProperty("渠道编码")
21   - private String code;
22   -
23   - @ExcelProperty("开启状态")
24   - private Integer status;
25   -
26   - @ExcelProperty("备注")
27   - private String remark;
28   -
29   - @ExcelProperty("渠道费率,单位:百分比")
30   - private Double feeRate;
31   -
32   - @ExcelProperty("商户编号")
33   - private Long merchantId;
34   -
35   - @ExcelProperty("应用编号")
36   - private Long appId;
37   -
38   - /**
39   - * todo @芋艿 mapStruct 存在转换问题
40   - * java: Can't map property "PayClientConfig payChannelDO.config" to "String payChannelExcelVO.config".
41   - * Consider to declare/implement a mapping method: "String map(PayClientConfig value)".
42   - */
43   - /// @ExcelProperty("支付渠道配置")
44   - /// private String config;
45   -
46   - @ExcelProperty("创建时间")
47   - private LocalDateTime createTime;
48   -
49   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/channel/PayChannelExportReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
4   -
5   -import java.time.LocalDateTime;
6   -import org.springframework.format.annotation.DateTimeFormat;
7   -
8   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
9   -
10   -@Schema(description = "管理后台 - 支付渠道 Excel 导出 Request VO,参数和 PayChannelPageReqVO 是一致的")
11   -@Data
12   -public class PayChannelExportReqVO {
13   -
14   - @Schema(description = "渠道编码")
15   - private String code;
16   -
17   - @Schema(description = "开启状态")
18   - private Integer status;
19   -
20   - @Schema(description = "备注")
21   - private String remark;
22   -
23   - @Schema(description = "渠道费率,单位:百分比")
24   - private Double feeRate;
25   -
26   - @Schema(description = "商户编号")
27   - private Long merchantId;
28   -
29   - @Schema(description = "应用编号")
30   - private Long appId;
31   -
32   - @Schema(description = "支付渠道配置")
33   - private String config;
34   -
35   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
36   - @Schema(description = "创建时间")
37   - private LocalDateTime[] createTime;
38   -
39   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantBaseVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.Data;
4   -
5   -import javax.validation.constraints.NotNull;
6   -
7   -/**
8   -* 支付商户信息 Base VO,提供给添加、修改、详细的子 VO 使用
9   -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
10   -*/
11   -@Data
12   -public class PayMerchantBaseVO {
13   -
14   - @Schema(description = "商户全称", requiredMode = Schema.RequiredMode.REQUIRED)
15   - @NotNull(message = "商户全称不能为空")
16   - private String name;
17   -
18   - @Schema(description = "商户简称", requiredMode = Schema.RequiredMode.REQUIRED)
19   - @NotNull(message = "商户简称不能为空")
20   - private String shortName;
21   -
22   - @Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED)
23   - @NotNull(message = "开启状态不能为空")
24   - private Integer status;
25   -
26   - @Schema(description = "备注")
27   - private String remark;
28   -
29   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantCreateReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
4   -
5   -@Schema(description = "管理后台 - 支付商户信息创建 Request VO")
6   -@Data
7   -@EqualsAndHashCode(callSuper = true)
8   -@ToString(callSuper = true)
9   -public class PayMerchantCreateReqVO extends PayMerchantBaseVO {
10   -
11   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExcelVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -
3   -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
4   -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
5   -import com.alibaba.excel.annotation.ExcelProperty;
6   -import lombok.Data;
7   -
8   -import java.time.LocalDateTime;
9   -
10   -/**
11   - * 支付商户信息 Excel VO
12   - *
13   - * @author 芋艿
14   - */
15   -@Data
16   -public class PayMerchantExcelVO {
17   -
18   - @ExcelProperty("商户编号")
19   - private Long id;
20   -
21   - @ExcelProperty("商户号")
22   - private String no;
23   -
24   - @ExcelProperty("商户全称")
25   - private String name;
26   -
27   - @ExcelProperty("商户简称")
28   - private String shortName;
29   -
30   - @ExcelProperty(value = "开启状态",converter = DictConvert.class)
31   - @DictFormat("sys_common_status")
32   - private Integer status;
33   -
34   - @ExcelProperty("备注")
35   - private String remark;
36   -
37   - @ExcelProperty("创建时间")
38   - private LocalDateTime createTime;
39   -
40   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantExportReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
4   -
5   -import java.time.LocalDateTime;
6   -import org.springframework.format.annotation.DateTimeFormat;
7   -
8   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
9   -
10   -@Schema(description = "管理后台 - 支付商户信息 Excel 导出 Request VO,参数和 PayMerchantPageReqVO 是一致的")
11   -@Data
12   -public class PayMerchantExportReqVO {
13   -
14   - @Schema(description = "商户号")
15   - private String no;
16   -
17   - @Schema(description = "商户全称")
18   - private String name;
19   -
20   - @Schema(description = "商户简称")
21   - private String shortName;
22   -
23   - @Schema(description = "开启状态")
24   - private Integer status;
25   -
26   - @Schema(description = "备注")
27   - private String remark;
28   -
29   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
30   - @Schema(description = "创建时间")
31   - private LocalDateTime[] createTime;
32   -
33   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantPageReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
4   -
5   -import java.time.LocalDateTime;
6   -import cn.iocoder.yudao.framework.common.pojo.PageParam;
7   -import org.springframework.format.annotation.DateTimeFormat;
8   -
9   -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
10   -
11   -@Schema(description = "管理后台 - 支付商户信息分页 Request VO")
12   -@Data
13   -@EqualsAndHashCode(callSuper = true)
14   -@ToString(callSuper = true)
15   -public class PayMerchantPageReqVO extends PageParam {
16   -
17   - @Schema(description = "商户号")
18   - private String no;
19   -
20   - @Schema(description = "商户全称")
21   - private String name;
22   -
23   - @Schema(description = "商户简称")
24   - private String shortName;
25   -
26   - @Schema(description = "开启状态")
27   - private Integer status;
28   -
29   - @Schema(description = "备注")
30   - private String remark;
31   -
32   - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
33   - @Schema(description = "创建时间")
34   - private LocalDateTime[] createTime;
35   -
36   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantRespVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -
3   -import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.Data;
5   -import lombok.EqualsAndHashCode;
6   -import lombok.ToString;
7   -
8   -import java.time.LocalDateTime;
9   -
10   -@Schema(description = "管理后台 - 支付商户信息 Response VO")
11   -@Data
12   -@EqualsAndHashCode(callSuper = true)
13   -@ToString(callSuper = true)
14   -public class PayMerchantRespVO extends PayMerchantBaseVO {
15   -
16   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
17   - private Long id;
18   -
19   - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
20   - private LocalDateTime createTime;
21   -
22   - @Schema(description = "商户号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M233666999")
23   - private String no;
24   -
25   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -import io.swagger.v3.oas.annotations.media.Schema;
3   -import lombok.*;
4   -import javax.validation.constraints.*;
5   -
6   -@Schema(description = "管理后台 - 支付商户信息更新 Request VO")
7   -@Data
8   -@EqualsAndHashCode(callSuper = true)
9   -@ToString(callSuper = true)
10   -public class PayMerchantUpdateReqVO extends PayMerchantBaseVO {
11   -
12   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
13   - @NotNull(message = "商户编号不能为空")
14   - private Long id;
15   -
16   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/merchant/vo/merchant/PayMerchantUpdateStatusReqVO.java deleted
1   -package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
2   -
3   -import io.swagger.v3.oas.annotations.media.Schema;
4   -import lombok.Data;
5   -
6   -import javax.validation.constraints.NotNull;
7   -
8   -@Schema(description = "管理后台 - 商户更新状态 Request VO")
9   -@Data
10   -public class PayMerchantUpdateStatusReqVO {
11   -
12   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
13   - @NotNull(message = "商户编号不能为空")
14   - private Long id;
15   -
16   - @Schema(description = "状态,见 SysCommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
17   - @NotNull(message = "状态不能为空")
18   - private Integer status;
19   -
20   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/PayOrderController.java
... ... @@ -7,15 +7,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
8 8 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
9 9 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
10   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
  10 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
11 11 import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*;
12 12 import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert;
13   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
14   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
  13 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
15 14 import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
16 15 import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
17   -import cn.iocoder.yudao.module.pay.service.merchant.PayAppService;
18   -import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
  16 +import cn.iocoder.yudao.module.pay.service.app.PayAppService;
19 17 import cn.iocoder.yudao.module.pay.service.order.PayOrderExtensionService;
20 18 import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
21 19 import io.swagger.v3.oas.annotations.Operation;
... ... @@ -48,8 +46,6 @@ public class PayOrderController {
48 46 @Resource
49 47 private PayOrderExtensionService orderExtensionService;
50 48 @Resource
51   - private PayMerchantService merchantService;
52   - @Resource
53 49 private PayAppService appService;
54 50  
55 51 @GetMapping("/get")
... ... @@ -71,13 +67,11 @@ public class PayOrderController {
71 67 return success(new PayOrderDetailsRespVO());
72 68 }
73 69  
74   - PayMerchantDO merchantDO = merchantService.getMerchant(order.getMerchantId());
75 70 PayAppDO appDO = appService.getApp(order.getAppId());
76 71 PayChannelEnum channelEnum = PayChannelEnum.getByCode(order.getChannelCode());
77 72  
78 73 // TODO @aquan:文案,都是前端 format;
79 74 PayOrderDetailsRespVO respVO = PayOrderConvert.INSTANCE.orderDetailConvert(order);
80   - respVO.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
81 75 respVO.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
82 76 respVO.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
83 77  
... ... @@ -105,21 +99,16 @@ public class PayOrderController {
105 99 return success(new PageResult<>(pageResult.getTotal()));
106 100 }
107 101  
108   - // 处理商户ID数据
109   - Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
110   - CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getMerchantId));
111 102 // 处理应用ID数据
112 103 Map<Long, PayAppDO> appMap = appService.getAppMap(
113 104 CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getAppId));
114 105  
115 106 List<PayOrderPageItemRespVO> pageList = new ArrayList<>(pageResult.getList().size());
116 107 pageResult.getList().forEach(c -> {
117   - PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
118 108 PayAppDO appDO = appMap.get(c.getAppId());
119 109 PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
120 110  
121 111 PayOrderPageItemRespVO orderItem = PayOrderConvert.INSTANCE.pageConvertItemPage(c);
122   - orderItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
123 112 orderItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
124 113 orderItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
125 114 pageList.add(orderItem);
... ... @@ -133,16 +122,12 @@ public class PayOrderController {
133 122 @OperateLog(type = EXPORT)
134 123 public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO,
135 124 HttpServletResponse response) throws IOException {
136   -
137 125 List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO);
138 126 if (CollectionUtil.isEmpty(list)) {
139 127 ExcelUtils.write(response, "支付订单.xls", "数据",
140 128 PayOrderExcelVO.class, new ArrayList<>());
141 129 }
142 130  
143   - // 处理商户ID数据
144   - Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
145   - CollectionUtils.convertList(list, PayOrderDO::getMerchantId));
146 131 // 处理应用ID数据
147 132 Map<Long, PayAppDO> appMap = appService.getAppMap(
148 133 CollectionUtils.convertList(list, PayOrderDO::getAppId));
... ... @@ -152,13 +137,11 @@ public class PayOrderController {
152 137  
153 138 List<PayOrderExcelVO> excelDatum = new ArrayList<>(list.size());
154 139 list.forEach(c -> {
155   - PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
156 140 PayAppDO appDO = appMap.get(c.getAppId());
157 141 PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
158 142 PayOrderExtensionDO orderExtensionDO = orderExtensionMap.get(c.getSuccessExtensionId());
159 143  
160 144 PayOrderExcelVO excelItem = PayOrderConvert.INSTANCE.excelConvert(c);
161   - excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
162 145 excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
163 146 excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
164 147 excelItem.setNo(ObjectUtil.isNotNull(orderExtensionDO) ? orderExtensionDO.getNo() : "");
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderBaseVO.java
... ... @@ -17,10 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 17 @Data
18 18 public class PayOrderBaseVO {
19 19  
20   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
21   - @NotNull(message = "商户编号不能为空")
22   - private Long merchantId;
23   -
24 20 @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
25 21 @NotNull(message = "应用编号不能为空")
26 22 private Long appId;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderDetailsRespVO.java
... ... @@ -16,9 +16,6 @@ public class PayOrderDetailsRespVO extends PayOrderBaseVO {
16 16 @Schema(description = "支付订单编号")
17 17 private Long id;
18 18  
19   - @Schema(description = "商户名称")
20   - private String merchantName;
21   -
22 19 @Schema(description = "应用名称")
23 20 private String appName;
24 21  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExcelVO.java
... ... @@ -19,9 +19,6 @@ public class PayOrderExcelVO {
19 19 @ExcelProperty("支付订单编号")
20 20 private Long id;
21 21  
22   - @ExcelProperty(value = "商户名称")
23   - private String merchantName;
24   -
25 22 @ExcelProperty(value = "应用名称")
26 23 private String appName;
27 24  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderExportReqVO.java
... ... @@ -12,9 +12,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
12 12 @Data
13 13 public class PayOrderExportReqVO {
14 14  
15   - @Schema(description = "商户编号")
16   - private Long merchantId;
17   -
18 15 @Schema(description = "应用编号")
19 16 private Long appId;
20 17  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageItemRespVO.java
... ... @@ -19,9 +19,6 @@ public class PayOrderPageItemRespVO extends PayOrderBaseVO {
19 19 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
20 20 private LocalDateTime createTime;
21 21  
22   - @Schema(description = "商户名称")
23   - private String merchantName;
24   -
25 22 @Schema(description = "应用名称")
26 23 private String appName;
27 24  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/order/vo/PayOrderPageReqVO.java
... ... @@ -17,9 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 17 @ToString(callSuper = true)
18 18 public class PayOrderPageReqVO extends PageParam {
19 19  
20   - @Schema(description = "商户编号")
21   - private Long merchantId;
22   -
23 20 @Schema(description = "应用编号")
24 21 private Long appId;
25 22  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/PayRefundController.java
... ... @@ -4,12 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
4 4 import cn.hutool.core.util.ObjectUtil;
5 5 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*;
6 6 import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert;
7   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
8   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
  7 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
9 8 import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
10 9 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
11   -import cn.iocoder.yudao.module.pay.service.merchant.PayAppService;
12   -import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
  10 +import cn.iocoder.yudao.module.pay.service.app.PayAppService;
13 11 import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
14 12 import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
15 13 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
... ... @@ -17,7 +15,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
17 15 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
18 16 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
19 17 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
20   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
  18 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
21 19 import io.swagger.v3.oas.annotations.tags.Tag;
22 20 import io.swagger.v3.oas.annotations.Parameter;
23 21 import io.swagger.v3.oas.annotations.Operation;
... ... @@ -48,8 +46,6 @@ public class PayRefundController {
48 46 @Resource
49 47 private PayRefundService refundService;
50 48 @Resource
51   - private PayMerchantService merchantService;
52   - @Resource
53 49 private PayAppService appService;
54 50 @Resource
55 51 private PayOrderService orderService;
... ... @@ -64,13 +60,11 @@ public class PayRefundController {
64 60 return success(new PayRefundDetailsRespVO());
65 61 }
66 62  
67   - PayMerchantDO merchantDO = merchantService.getMerchant(refund.getMerchantId());
68 63 PayAppDO appDO = appService.getApp(refund.getAppId());
69 64 PayChannelEnum channelEnum = PayChannelEnum.getByCode(refund.getChannelCode());
70 65 PayOrderDO orderDO = orderService.getOrder(refund.getOrderId());
71 66  
72 67 PayRefundDetailsRespVO refundDetail = PayRefundConvert.INSTANCE.refundDetailConvert(refund);
73   - refundDetail.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
74 68 refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
75 69 refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
76 70 refundDetail.setSubject(orderDO.getSubject());
... ... @@ -87,21 +81,16 @@ public class PayRefundController {
87 81 return success(new PageResult<>(pageResult.getTotal()));
88 82 }
89 83  
90   - // 处理商户ID数据
91   - Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
92   - CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getMerchantId));
93 84 // 处理应用ID数据
94 85 Map<Long, PayAppDO> appMap = appService.getAppMap(
95 86 CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId));
96 87 List<PayRefundPageItemRespVO> list = new ArrayList<>(pageResult.getList().size());
97 88 pageResult.getList().forEach(c -> {
98   - PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
99 89 PayAppDO appDO = appMap.get(c.getAppId());
100 90 PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
101 91  
102 92 PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c);
103 93  
104   - item.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
105 94 item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
106 95 item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
107 96 list.add(item);
... ... @@ -123,9 +112,6 @@ public class PayRefundController {
123 112 PayRefundExcelVO.class, new ArrayList<>());
124 113 }
125 114  
126   - // 处理商户ID数据
127   - Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
128   - CollectionUtils.convertList(list, PayRefundDO::getMerchantId));
129 115 // 处理应用ID数据
130 116 Map<Long, PayAppDO> appMap = appService.getAppMap(
131 117 CollectionUtils.convertList(list, PayRefundDO::getAppId));
... ... @@ -136,12 +122,10 @@ public class PayRefundController {
136 122 CollectionUtils.convertList(list, PayRefundDO::getOrderId));
137 123  
138 124 list.forEach(c -> {
139   - PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
140 125 PayAppDO appDO = appMap.get(c.getAppId());
141 126 PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
142 127  
143 128 PayRefundExcelVO excelItem = PayRefundConvert.INSTANCE.excelConvert(c);
144   - excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
145 129 excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
146 130 excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
147 131 excelItem.setSubject(orderMap.get(c.getOrderId()).getSubject());
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundBaseVO.java
... ... @@ -15,10 +15,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
15 15 @Data
16 16 public class PayRefundBaseVO {
17 17  
18   - @Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
19   - @NotNull(message = "商户编号不能为空")
20   - private Long merchantId;
21   -
22 18 @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
23 19 @NotNull(message = "应用编号不能为空")
24 20 private Long appId;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundDetailsRespVO.java
... ... @@ -17,9 +17,6 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO {
17 17 @Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)
18 18 private Long id;
19 19  
20   - @Schema(description = "商户名称")
21   - private String merchantName;
22   -
23 20 @Schema(description = "应用名称")
24 21 private String appName;
25 22  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExcelVO.java
... ... @@ -22,9 +22,6 @@ public class PayRefundExcelVO {
22 22 @ExcelProperty("商品名称")
23 23 private String subject;
24 24  
25   - @ExcelProperty(value = "商户名称")
26   - private String merchantName;
27   -
28 25 @ExcelProperty(value = "应用名称")
29 26 private String appName;
30 27  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundExportReqVO.java
... ... @@ -12,9 +12,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
12 12 @Data
13 13 public class PayRefundExportReqVO {
14 14  
15   - @Schema(description = "商户编号")
16   - private Long merchantId;
17   -
18 15 @Schema(description = "应用编号")
19 16 private Long appId;
20 17  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageItemRespVO.java
... ... @@ -16,9 +16,6 @@ public class PayRefundPageItemRespVO extends PayRefundBaseVO {
16 16 @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
17 17 private Long id;
18 18  
19   - @Schema(description = "商户名称")
20   - private String merchantName;
21   -
22 19 @Schema(description = "应用名称")
23 20 private String appName;
24 21  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/refund/vo/PayRefundPageReqVO.java
... ... @@ -17,9 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
17 17 @ToString(callSuper = true)
18 18 public class PayRefundPageReqVO extends PageParam {
19 19  
20   - @Schema(description = "商户编号")
21   - private Long merchantId;
22   -
23 20 @Schema(description = "应用编号")
24 21 private Long appId;
25 22  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/channel/AppPayChannelController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.pay.controller.app.channel;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
  5 +import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
  6 +import io.swagger.v3.oas.annotations.Operation;
  7 +import io.swagger.v3.oas.annotations.Parameter;
  8 +import io.swagger.v3.oas.annotations.tags.Tag;
  9 +import org.springframework.validation.annotation.Validated;
  10 +import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import javax.annotation.Resource;
  16 +import java.util.List;
  17 +import java.util.Set;
  18 +
  19 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  20 +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
  21 +
  22 +@Tag(name = "用户 App - 支付渠道")
  23 +@RestController
  24 +@RequestMapping("/pay/channel")
  25 +@Validated
  26 +public class AppPayChannelController {
  27 +
  28 + @Resource
  29 + private PayChannelService channelService;
  30 +
  31 + @GetMapping("/get-enable-code-list")
  32 + @Operation(summary = "获得指定应用的开启的支付渠道编码列表")
  33 + @Parameter(name = "appId", description = "应用编号", required = true, example = "1")
  34 + public CommonResult<Set<String>> getEnableChannelCodeList(@RequestParam("appId") Long appId) {
  35 + List<PayChannelDO> channels = channelService.getEnableChannelList(appId);
  36 + return success(convertSet(channels, PayChannelDO::getCode));
  37 + }
  38 +
  39 +}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/order/AppPayOrderController.http
1   -### /pay/create 提交支付订单
  1 +### /pay/create 提交支付订单【alipay_pc】
2 2 POST {{appApi}}/pay/order/submit
3 3 Content-Type: application/json
4 4 Authorization: Bearer {{appToken}}
... ... @@ -8,3 +8,56 @@ tenant-id: {{appTenentId}}
8 8 "id": 174,
9 9 "channelCode": "alipay_pc"
10 10 }
  11 +
  12 +### /pay/create 提交支付订单【wx_bar】
  13 +POST {{appApi}}/pay/order/submit
  14 +Content-Type: application/json
  15 +Authorization: Bearer {{appToken}}
  16 +tenant-id: {{appTenentId}}
  17 +
  18 +{
  19 + "id": 202,
  20 + "channelCode": "wx_bar",
  21 + "channelExtras": {
  22 + "authCode": "132990241553789274"
  23 + }
  24 +}
  25 +
  26 +### /pay/create 提交支付订单【wx_pub】
  27 +POST {{appApi}}/pay/order/submit
  28 +Content-Type: application/json
  29 +Authorization: Bearer {{appToken}}
  30 +tenant-id: {{appTenentId}}
  31 +
  32 +{
  33 + "id": 202,
  34 + "channelCode": "wx_pub",
  35 + "channelExtras": {
  36 + "openid": "ockUAwIZ-0OeMZl9ogcZ4ILrGba0"
  37 + }
  38 +}
  39 +
  40 +### /pay/create 提交支付订单【wx_lite】
  41 +POST {{appApi}}/pay/order/submit
  42 +Content-Type: application/json
  43 +Authorization: Bearer {{appToken}}
  44 +tenant-id: {{appTenentId}}
  45 +
  46 +{
  47 + "id": 202,
  48 + "channelCode": "wx_lite",
  49 + "channelExtras": {
  50 + "openid": "oLefc4g5GjKWHJjLjMSXB3wX0fD0"
  51 + }
  52 +}
  53 +
  54 +### /pay/create 提交支付订单【wx_native】
  55 +POST {{appApi}}/pay/order/submit
  56 +Content-Type: application/json
  57 +Authorization: Bearer {{appToken}}
  58 +tenant-id: {{appTenentId}}
  59 +
  60 +{
  61 + "id": 202,
  62 + "channelCode": "wx_native"
  63 +}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/app/PayAppConvert.java
1 1 package cn.iocoder.yudao.module.pay.convert.app;
2 2  
3   -import java.util.*;
4   -
5 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -
7   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.*;
8   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
9   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppCreateReqVO;
  5 +import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageItemRespVO;
  6 +import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppRespVO;
  7 +import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO;
  8 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
10 9 import org.mapstruct.Mapper;
11 10 import org.mapstruct.factory.Mappers;
12 11  
  12 +import java.util.List;
  13 +
13 14 /**
14 15 * 支付应用信息 Convert
15 16 *
... ... @@ -22,8 +23,6 @@ public interface PayAppConvert {
22 23  
23 24 PayAppPageItemRespVO pageConvert (PayAppDO bean);
24 25  
25   - PayAppPageItemRespVO.PayMerchant convert(PayMerchantDO bean);
26   -
27 26 PayAppDO convert(PayAppCreateReqVO bean);
28 27  
29 28 PayAppDO convert(PayAppUpdateReqVO bean);
... ... @@ -34,6 +33,4 @@ public interface PayAppConvert {
34 33  
35 34 PageResult<PayAppRespVO> convertPage(PageResult<PayAppDO> page);
36 35  
37   - List<PayAppExcelVO> convertList02(List<PayAppDO> list);
38   -
39 36 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/channel/PayChannelConvert.java
1 1 package cn.iocoder.yudao.module.pay.convert.channel;
2 2  
3   -import java.util.*;
4   -
5 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -
7   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO;
8   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExcelVO;
9   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelRespVO;
10   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO;
11   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO;
  5 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelRespVO;
  6 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO;
  7 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
12 8 import org.mapstruct.Mapper;
13 9 import org.mapstruct.Mapping;
14 10 import org.mapstruct.factory.Mappers;
... ... @@ -27,12 +23,6 @@ public interface PayChannelConvert {
27 23 @Mapping(target = "config",expression = "java(cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString(bean.getConfig()))")
28 24 PayChannelRespVO convert(PayChannelDO bean);
29 25  
30   - List<PayChannelRespVO> convertList(List<PayChannelDO> list);
31   -
32 26 PageResult<PayChannelRespVO> convertPage(PageResult<PayChannelDO> page);
33 27  
34   - List<PayChannelExcelVO> convertList02(List<PayChannelDO> list);
35   -
36   -
37   -
38 28 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/merchant/PayMerchantConvert.java deleted
1   -package cn.iocoder.yudao.module.pay.convert.merchant;
2   -
3   -import java.util.*;
4   -
5   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -
7   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO;
8   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExcelVO;
9   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantRespVO;
10   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO;
11   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
12   -import org.mapstruct.Mapper;
13   -import org.mapstruct.factory.Mappers;
14   -
15   -@Mapper
16   -public interface PayMerchantConvert {
17   -
18   - PayMerchantConvert INSTANCE = Mappers.getMapper(PayMerchantConvert.class);
19   -
20   - PayMerchantDO convert(PayMerchantCreateReqVO bean);
21   -
22   - PayMerchantDO convert(PayMerchantUpdateReqVO bean);
23   -
24   - PayMerchantRespVO convert(PayMerchantDO bean);
25   -
26   - List<PayMerchantRespVO> convertList(List<PayMerchantDO> list);
27   -
28   - PageResult<PayMerchantRespVO> convertPage(PageResult<PayMerchantDO> page);
29   -
30   - List<PayMerchantExcelVO> convertList02(List<PayMerchantDO> list);
31   -
32   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java
... ... @@ -94,7 +94,7 @@ public interface PayOrderConvert {
94 94 @Mapping(target = "id", ignore = true)
95 95 PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp);
96 96  
97   - PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO);
  97 + PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO, String userIp);
98 98  
99 99 PayOrderSubmitRespVO convert(PayOrderUnifiedRespDTO bean);
100 100  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayAppDO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/app/PayAppDO.java
1   -package cn.iocoder.yudao.module.pay.dal.dataobject.merchant;
  1 +package cn.iocoder.yudao.module.pay.dal.dataobject.app;
2 2  
3 3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
... ... @@ -54,11 +54,4 @@ public class PayAppDO extends BaseDO {
54 54 */
55 55 private String refundNotifyUrl;
56 56  
57   - /**
58   - * 商户编号
59   - *
60   - * 关联 {@link PayMerchantDO#getId()}
61   - */
62   - private Long merchantId;
63   -
64 57 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayChannelDO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/channel/PayChannelDO.java
1   -package cn.iocoder.yudao.module.pay.dal.dataobject.merchant;
  1 +package cn.iocoder.yudao.module.pay.dal.dataobject.channel;
2 2  
3 3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 4 import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
5   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
  5 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
6 6 import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
  7 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
7 8 import com.baomidou.mybatisplus.annotation.KeySequence;
8 9 import com.baomidou.mybatisplus.annotation.TableField;
9 10 import com.baomidou.mybatisplus.annotation.TableName;
... ... @@ -54,12 +55,6 @@ public class PayChannelDO extends TenantBaseDO {
54 55 private String remark;
55 56  
56 57 /**
57   - * 商户编号
58   - *
59   - * 关联 {@link PayMerchantDO#getId()}
60   - */
61   - private Long merchantId;
62   - /**
63 58 * 应用编号
64 59 *
65 60 * 关联 {@link PayAppDO#getId()}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/merchant/PayMerchantDO.java deleted
1   -package cn.iocoder.yudao.module.pay.dal.dataobject.merchant;
2   -
3   -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4   -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5   -import com.baomidou.mybatisplus.annotation.*;
6   -import lombok.*;
7   -
8   -/**
9   - * 支付商户信息 DO
10   - * 目前暂时没有特别的用途,主要为未来多商户提供基础。
11   - *
12   - * @author 芋道源码
13   - */
14   -@TableName("pay_merchant")
15   -@KeySequence("pay_merchant_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
16   -@Data
17   -@EqualsAndHashCode(callSuper = true)
18   -@ToString(callSuper = true)
19   -@Builder
20   -@NoArgsConstructor
21   -@AllArgsConstructor
22   -public class PayMerchantDO extends BaseDO {
23   -
24   - /**
25   - * 商户编号,数据库自增
26   - */
27   - @TableId
28   - private Long id;
29   - /**
30   - * 商户号
31   - * 例如说,M233666999
32   - * 只有新增时插入,不允许修改
33   - */
34   - private String no;
35   - /**
36   - * 商户全称
37   - */
38   - private String name;
39   - /**
40   - * 商户简称
41   - */
42   - private String shortName;
43   - /**
44   - * 状态
45   - *
46   - * 枚举 {@link CommonStatusEnum}
47   - */
48   - private Integer status;
49   - /**
50   - * 备注
51   - */
52   - private String remark;
53   -
54   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java
1 1 package cn.iocoder.yudao.module.pay.dal.dataobject.notify;
2 2  
3   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
4   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
5 5 import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
6 6 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
7 7 import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum;
8 8 import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum;
9   -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
10 9 import com.baomidou.mybatisplus.annotation.KeySequence;
11 10 import com.baomidou.mybatisplus.annotation.TableName;
12 11 import lombok.Data;
... ... @@ -43,12 +42,6 @@ public class PayNotifyTaskDO extends BaseDO {
43 42 */
44 43 private Long id;
45 44 /**
46   - * 商户编号
47   - *
48   - * 关联 {@link PayMerchantDO#getId()}
49   - */
50   - private Long merchantId;
51   - /**
52 45 * 应用编号
53 46 *
54 47 * 关联 {@link PayAppDO#getId()}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderDO.java
1 1 package cn.iocoder.yudao.module.pay.dal.dataobject.order;
2 2  
3   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
4   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
5   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  5 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
  6 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
6 7 import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum;
7   -import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
8 8 import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
9   -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
10   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
  9 +import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
11 10 import com.baomidou.mybatisplus.annotation.KeySequence;
12 11 import com.baomidou.mybatisplus.annotation.TableName;
13 12 import lombok.*;
... ... @@ -34,12 +33,6 @@ public class PayOrderDO extends BaseDO {
34 33 */
35 34 private Long id;
36 35 /**
37   - * 商户编号
38   - *
39   - * 关联 {@link PayMerchantDO#getId()}
40   - */
41   - private Long merchantId;
42   - /**
43 36 * 应用编号
44 37 *
45 38 * 关联 {@link PayAppDO#getId()}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/order/PayOrderExtensionDO.java
1 1 package cn.iocoder.yudao.module.pay.dal.dataobject.order;
2 2  
3   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
  3 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
4 4 import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
5 5 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
6 6 import com.baomidou.mybatisplus.annotation.KeySequence;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/refund/PayRefundDO.java
1 1 package cn.iocoder.yudao.module.pay.dal.dataobject.refund;
2 2  
3   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
4   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
5   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
  5 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
  6 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
6 7 import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
7 8 import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
8 9 import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
9   -import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
10   -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
11 10 import com.baomidou.mybatisplus.annotation.KeySequence;
12 11 import com.baomidou.mybatisplus.annotation.TableId;
13 12 import com.baomidou.mybatisplus.annotation.TableName;
... ... @@ -40,12 +39,6 @@ public class PayRefundDO extends BaseDO {
40 39 private Long id;
41 40  
42 41 /**
43   - * 商户编号
44   - *
45   - * 关联 {@link PayMerchantDO#getId()}
46   - */
47   - private Long merchantId;
48   - /**
49 42 * 应用编号
50 43 *
51 44 * 关联 {@link PayAppDO#getId()}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/app/PayAppMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.pay.dal.mysql.app;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
  6 +import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO;
  7 +import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
  8 +import org.apache.ibatis.annotations.Mapper;
  9 +
  10 +@Mapper
  11 +public interface PayAppMapper extends BaseMapperX<PayAppDO> {
  12 +
  13 + default PageResult<PayAppDO> selectPage(PayAppPageReqVO reqVO) {
  14 + return selectPage(reqVO, new QueryWrapperX<PayAppDO>()
  15 + .likeIfPresent("name", reqVO.getName())
  16 + .eqIfPresent("status", reqVO.getStatus())
  17 + .eqIfPresent("remark", reqVO.getRemark())
  18 + .eqIfPresent("pay_notify_url", reqVO.getPayNotifyUrl())
  19 + .eqIfPresent("refund_notify_url", reqVO.getRefundNotifyUrl())
  20 + .betweenIfPresent("create_time", reqVO.getCreateTime())
  21 + .orderByDesc("id"));
  22 + }
  23 +
  24 +}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayChannelMapper.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/channel/PayChannelMapper.java
1   -package cn.iocoder.yudao.module.pay.dal.mysql.merchant;
  1 +package cn.iocoder.yudao.module.pay.dal.mysql.channel;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
5 6 import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
6   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO;
7   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO;
8   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
  7 +import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelPageReqVO;
  8 +import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
9 9 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
10 10 import org.apache.ibatis.annotations.Mapper;
11 11  
... ... @@ -25,51 +25,21 @@ public interface PayChannelMapper extends BaseMapperX&lt;PayChannelDO&gt; {
25 25 .eqIfPresent("status", reqVO.getStatus())
26 26 .eqIfPresent("remark", reqVO.getRemark())
27 27 .eqIfPresent("fee_rate", reqVO.getFeeRate())
28   - .eqIfPresent("merchant_id", reqVO.getMerchantId())
29   - .eqIfPresent("app_id", reqVO.getAppId())
30   - .betweenIfPresent("create_time", reqVO.getCreateTime())
31   - .orderByDesc("id"));
32   - }
33   -
34   - default List<PayChannelDO> selectList(PayChannelExportReqVO reqVO) {
35   - return selectList(new QueryWrapperX<PayChannelDO>()
36   - .eqIfPresent("code", reqVO.getCode())
37   - .eqIfPresent("status", reqVO.getStatus())
38   - .eqIfPresent("remark", reqVO.getRemark())
39   - .eqIfPresent("fee_rate", reqVO.getFeeRate())
40   - .eqIfPresent("merchant_id", reqVO.getMerchantId())
41 28 .eqIfPresent("app_id", reqVO.getAppId())
42 29 .betweenIfPresent("create_time", reqVO.getCreateTime())
43 30 .orderByDesc("id"));
44 31 }
45 32  
46 33 /**
47   - * 根据条件获取渠道数量
48   - *
49   - * @param merchantId 商户编号
50   - * @param appid 应用编号
51   - * @param code 渠道编码
52   - * @return 数量
53   - */
54   - default Integer selectCount(Long merchantId, Long appid, String code) {
55   - return this.selectCount(new QueryWrapper<PayChannelDO>().lambda()
56   - .eq(PayChannelDO::getMerchantId, merchantId)
57   - .eq(PayChannelDO::getAppId, appid)
58   - .eq(PayChannelDO::getCode, code)).intValue();
59   - }
60   -
61   - /**
62 34 * 根据条件获取渠道
63 35 *
64   - * @param merchantId 商户编号
65   - * @param appI 应用编号
  36 + * @param appId 应用编号
66 37 * @param code 渠道编码
67 38 * @return 数量
68 39 */
69   - default PayChannelDO selectOne(Long merchantId, Long appI, String code) {
  40 + default PayChannelDO selectOne(Long appId, String code) {
70 41 return this.selectOne((new QueryWrapper<PayChannelDO>().lambda()
71   - .eq(PayChannelDO::getMerchantId, merchantId)
72   - .eq(PayChannelDO::getAppId, appI)
  42 + .eq(PayChannelDO::getAppId, appId)
73 43 .eq(PayChannelDO::getCode, code)
74 44 ));
75 45 }
... ... @@ -86,4 +56,10 @@ public interface PayChannelMapper extends BaseMapperX&lt;PayChannelDO&gt; {
86 56 .in(PayChannelDO::getAppId, appIds));
87 57 }
88 58  
  59 + default List<PayChannelDO> selectListByAppId(Long appId, Integer status) {
  60 + return selectList(new LambdaQueryWrapperX<PayChannelDO>()
  61 + .eq(PayChannelDO::getAppId, appId)
  62 + .eq(PayChannelDO::getStatus, status));
  63 + }
  64 +
89 65 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayAppMapper.java deleted
1   -package cn.iocoder.yudao.module.pay.dal.mysql.merchant;
2   -
3   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO;
4   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO;
5   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
7   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
8   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
9   -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
10   -import org.apache.ibatis.annotations.Mapper;
11   -
12   -import java.util.Collection;
13   -import java.util.List;
14   -
15   -@Mapper
16   -public interface PayAppMapper extends BaseMapperX<PayAppDO> {
17   -
18   - default PageResult<PayAppDO> selectPage(PayAppPageReqVO reqVO, Collection<Long> merchantIds) {
19   - return selectPage(reqVO, new QueryWrapperX<PayAppDO>()
20   - .likeIfPresent("name", reqVO.getName())
21   - .eqIfPresent("status", reqVO.getStatus())
22   - .eqIfPresent("remark", reqVO.getRemark())
23   - .eqIfPresent("pay_notify_url", reqVO.getPayNotifyUrl())
24   - .eqIfPresent("refund_notify_url", reqVO.getRefundNotifyUrl())
25   - .inIfPresent("merchant_id", merchantIds)
26   - .betweenIfPresent("create_time", reqVO.getCreateTime())
27   - .orderByDesc("id"));
28   - }
29   -
30   - default List<PayAppDO> selectList(PayAppExportReqVO reqVO, Collection<Long> merchantIds) {
31   - return selectList(new QueryWrapperX<PayAppDO>()
32   - .likeIfPresent("name", reqVO.getName())
33   - .eqIfPresent("status", reqVO.getStatus())
34   - .eqIfPresent("remark", reqVO.getRemark())
35   - .eqIfPresent("pay_notify_url", reqVO.getPayNotifyUrl())
36   - .eqIfPresent("refund_notify_url", reqVO.getRefundNotifyUrl())
37   - .inIfPresent("merchant_id", merchantIds)
38   - .betweenIfPresent("create_time", reqVO.getCreateTime())
39   - .orderByDesc("id"));
40   - }
41   -
42   - default List<PayAppDO> getListByMerchantId(Long merchantId) {
43   - return selectList(new LambdaQueryWrapper<PayAppDO>()
44   - .select(PayAppDO::getId, PayAppDO::getName)
45   - .eq(PayAppDO::getMerchantId, merchantId));
46   - }
47   -
48   - // TODO @aquan:方法名补充 ByMerchantId
49   - default Long selectCount(Long merchantId) {
50   - return selectCount(new LambdaQueryWrapper<PayAppDO>().eq(PayAppDO::getMerchantId, merchantId));
51   - }
52   -
53   -}
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/merchant/PayMerchantMapper.java deleted
1   -package cn.iocoder.yudao.module.pay.dal.mysql.merchant;
2   -
3   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExportReqVO;
4   -import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantPageReqVO;
5   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
6   -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
7   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
8   -import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
9   -import org.apache.ibatis.annotations.Mapper;
10   -
11   -import java.util.List;
12   -
13   -@Mapper
14   -public interface PayMerchantMapper extends BaseMapperX<PayMerchantDO> {
15   -
16   - default PageResult<PayMerchantDO> selectPage(PayMerchantPageReqVO reqVO) {
17   - return selectPage(reqVO, new QueryWrapperX<PayMerchantDO>()
18   - .likeIfPresent("no", reqVO.getNo())
19   - .likeIfPresent("name", reqVO.getName())
20   - .likeIfPresent("short_name", reqVO.getShortName())
21   - .eqIfPresent("status", reqVO.getStatus())
22   - .eqIfPresent("remark", reqVO.getRemark())
23   - .betweenIfPresent("create_time", reqVO.getCreateTime())
24   - .orderByDesc("id"));
25   - }
26   -
27   - default List<PayMerchantDO> selectList(PayMerchantExportReqVO reqVO) {
28   - return selectList(new QueryWrapperX<PayMerchantDO>()
29   - .likeIfPresent("no", reqVO.getNo())
30   - .likeIfPresent("name", reqVO.getName())
31   - .likeIfPresent("short_name", reqVO.getShortName())
32   - .eqIfPresent("status", reqVO.getStatus())
33   - .eqIfPresent("remark", reqVO.getRemark())
34   - .betweenIfPresent("create_time", reqVO.getCreateTime())
35   - .orderByDesc("id"));
36   - }
37   -
38   - /**
39   - * 根据商户名称模糊查询商户集合
40   - *
41   - * @param merchantName 商户名称
42   - * @return 商户集合
43   - */
44   - default List<PayMerchantDO> getMerchantListByName(String merchantName) {
45   - return this.selectList(new QueryWrapperX<PayMerchantDO>()
46   - .likeIfPresent("name", merchantName));
47   - }
48   -}