diff --git a/README.md b/README.md index 769b35ae5072cae993f94d64de55b2d42ac695d4..b9bbe591176fceba0ae1717ef61dbbdaf149458a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Bootx-Platform (v1.1.0-beta-4) +# Bootx-Platform (v1.1.0-beta-5)

star - Build Status + Build Status Build Status Downloads @@ -24,11 +24,20 @@ - 日志收集:[ELK](http://elk.dev.bootx.cn:5601/app/discove) [PlumeLog](http://platform.dev.bootx.cn:8080/plumelog/#/) - 项目文档:[项目使用指南文档](https://www.yuque.com/bootx/bootx-platform/) - 更新日志:[更新日志](./_doc/ChangeLog.md) +## 🛠️重磅版本更新 +一大波支付相关功能来袭,支付宝、微信、聚合支付、现金支付、储值卡支付、钱包,对各种支付方式抽象成策略类,通过模板模式进行串通,方便扩展新的支付方式或业务, + +增加支付结算台演示,不需要登录沙箱账号,欢迎扫体验,ps:支付后可以在后台支付订单模块处进行退款💪💪💪 + +结算台演示地址:[http://web.platform.bootx.cn/cashier](http://web.platform.bootx.cn/cashier) + +![](https://oscimg.oschina.net/oscnet/up-9f0044b76071d5a7f598ceab591c5fedb02.png) ## 🚩路线图 -### 1.1.0-beta5(预计七月中旬完成) +### 1.1.0-beta5(一期完成) -完善支付模块,主要是微信支付方面,适配V3版本API, +- [x] 完善支付模块,支付宝、微信、聚合支付、退款、超时关闭,支付信息同步、消息通知等功能 +- [ ] 退款信息同步优化、网关对账、异常情况报警、支付后可以在支付宝/微信上查看商品订单明细 ### 1.1.0-beta6(预计八月前完成) 微信服务号消息通知、钉钉消息通知、短信消息通知等通知相关功能实现, @@ -85,7 +94,7 @@ bootx-platform ├── common-starter-code-gen -- 代码生成模块 ├── common-starter-data-perm -- 数据权限模块 ├── common-starter-file -- 文件管理模块 - ├── common-starter-monitor 系统监控 + ├── common-starter-monitor -- 系统监控 ├── common-starter-quartz -- Quartz定时任务模块 ├── bootx-commons -- commons工具配置封装 ├── common-cache -- 缓存配置 @@ -93,7 +102,7 @@ bootx-platform ├── common-header-holder -- 请求头获取工具 ├── common-idempotency -- 幂等控制组件 ├── common-jackson -- Json序列化配置 - ├── common-lock 分布式锁 + ├── common-lock -- 分布式锁 ├── common-log -- 日志配置 ├── common-mongo -- MongoDB配置 ├── common-mqtt -- mqtt配置 diff --git a/_config/sql/V1.1.0_bate3_up_bate4.sql b/_config/sql/1.1.0-bate4/V1.1.0_bate3_up_bate4.sql similarity index 100% rename from _config/sql/V1.1.0_bate3_up_bate4.sql rename to _config/sql/1.1.0-bate4/V1.1.0_bate3_up_bate4.sql diff --git a/_config/sql/V1.1.0_bate4_up_bate4-fix.sql b/_config/sql/1.1.0-bate4/V1.1.0_bate4_up_bate4-fix.sql similarity index 100% rename from _config/sql/V1.1.0_bate4_up_bate4-fix.sql rename to _config/sql/1.1.0-bate4/V1.1.0_bate4_up_bate4-fix.sql diff --git a/_config/sql/1.1.0-bate4/bootx-platform.sql b/_config/sql/1.1.0-bate4/bootx-platform.sql new file mode 100644 index 0000000000000000000000000000000000000000..a5a6a7fb99b2b019f813083c0ece4aa15f5dcd2f --- /dev/null +++ b/_config/sql/1.1.0-bate4/bootx-platform.sql @@ -0,0 +1,2688 @@ +/* + Navicat Premium Data Transfer + + Source Server : 阿里 + Source Server Type : MySQL + Source Server Version : 50735 + + Target Server Type : MySQL + Target Server Version : 50735 + File Encoding : 65001 + + Date: 07/07/2022 10:57:51 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for base_dict +-- ---------------------------- +DROP TABLE IF EXISTS `base_dict`; +CREATE TABLE `base_dict` ( + `id` bigint(20) NOT NULL, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '编码', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', + `group_tag` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '分类标签', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + `version` int(8) NULL DEFAULT NULL COMMENT '版本', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_dict +-- ---------------------------- +INSERT INTO `base_dict` VALUES (1422929378374828033, 'Sex', '性别', '基础属性', '性别', 0, '2021-08-04 22:36:15', 1399985191002447872, '2022-05-11 19:48:40', 0, 6); +INSERT INTO `base_dict` VALUES (1425744045414772737, 'MenuType', '菜单类型', '系统属性', '菜单类型', 0, '2021-08-12 17:00:44', 1399985191002447872, '2022-05-11 19:48:44', 0, 4); +INSERT INTO `base_dict` VALUES (1430063572491411456, 'loginType', '字典类型', NULL, '字典类型', 1399985191002447872, '2021-08-24 15:05:00', 1399985191002447872, '2021-08-24 15:05:00', 1, 2); +INSERT INTO `base_dict` VALUES (1435829999592759296, 'UserStatusCode', '用户状态码', '系统属性', '用户状态码', 1399985191002447872, '2021-09-09 12:58:43', 1399985191002447872, '2022-05-11 19:48:56', 0, 2); +INSERT INTO `base_dict` VALUES (1435838066191458304, 'LogBusinessType', '业务操作类型', '系统属性', '操作日志记录的业务操作类型', 1399985191002447872, '2021-09-09 13:30:46', 1399985191002447872, '2022-05-11 19:49:00', 0, 2); +INSERT INTO `base_dict` VALUES (1438078864509317120, 'MailSecurityCode', '邮箱安全方式编码', '消息服务', '邮箱安全方式编码', 1399985191002447872, '2021-09-15 17:54:54', 1399985191002447872, '2022-05-11 19:49:06', 0, 2); +INSERT INTO `base_dict` VALUES (1439961232651034624, 'MessageTemplateCode', '消息模板类型', '消息服务', '消息模板类型', 1399985191002447872, '2021-09-20 22:34:46', 1399985191002447872, '2022-05-11 19:48:34', 0, 1); +INSERT INTO `base_dict` VALUES (1452836604783845376, 'SocialType', '三方系统类型', '系统属性', '三方系统类型', 1399985191002447872, '2021-10-26 11:16:54', 1399985191002447872, '2022-05-11 19:48:28', 0, 3); +INSERT INTO `base_dict` VALUES (1452843488735621120, 'ParamType', '参数类型', '系统属性', '参数类型', 1399985191002447872, '2021-10-26 11:44:15', 1399985191002447872, '2022-05-11 19:48:21', 0, 2); +INSERT INTO `base_dict` VALUES (1496024933900169216, 'Political', '政治面貌', '基础数据', '政治面貌', 1399985191002447872, '2022-02-22 15:31:54', 1399985191002447872, '2022-05-11 19:48:04', 0, 1); +INSERT INTO `base_dict` VALUES (1496722894707728384, 'PayChannel', '支付通道', '支付服务', '支付宝, 微信, 云闪付等', 1399985191002447872, '2022-02-24 13:45:21', 1399985191002447872, '2022-05-11 19:47:51', 0, 1); +INSERT INTO `base_dict` VALUES (1496723207565058048, 'PayWay', '支付方式', '支付服务', '扫码支付、Wap、App支付等', 1399985191002447872, '2022-02-24 13:46:35', 1399985191002447872, '2022-05-11 19:47:46', 0, 1); +INSERT INTO `base_dict` VALUES (1497140849954185216, 'PayStatus', '支付状态', '支付服务', '支付中,成功,失败等', 1399985191002447872, '2022-02-25 17:26:09', 1399985191002447872, '2022-05-11 19:47:40', 0, 2); +INSERT INTO `base_dict` VALUES (1501031423232937984, 'AsyncPayChannel', '异步支付通道', '支付服务', '如微信支付宝云闪付等第三方支付', 1399985191002447872, '2022-03-08 11:05:54', 1399985191002447872, '2022-05-11 19:47:37', 0, 1); +INSERT INTO `base_dict` VALUES (1502276739978473472, 'WalletStatus', '钱包状态', '支付服务', '钱包状态', 1399985191002447872, '2022-03-11 21:34:20', 1399985191002447872, '2022-05-11 19:47:33', 0, 2); +INSERT INTO `base_dict` VALUES (1502624342339448832, 'WalletOperation', '钱包日志操作类型', NULL, '', 1399985191002447872, '2022-03-12 20:35:35', 1399985191002447872, '2022-03-12 20:35:35', 1, 0); +INSERT INTO `base_dict` VALUES (1502624515799085056, 'WalletLogType', '钱包日志类型', '支付服务', '钱包日志类型', 1399985191002447872, '2022-03-12 20:36:17', 1399985191002447872, '2022-05-11 19:47:29', 0, 1); +INSERT INTO `base_dict` VALUES (1502624632392347648, 'WalletLogOperation', '钱包日志操作类型', '支付服务', '钱包日志操作类型', 1399985191002447872, '2022-03-12 20:36:44', 1399985191002447872, '2022-05-11 19:47:21', 0, 1); +INSERT INTO `base_dict` VALUES (1503340128037212160, 'VoucherStatus', '储值卡状态', '支付服务', '储值卡状态', 1399985191002447872, '2022-03-14 19:59:52', 1399985191002447872, '2022-05-11 19:47:12', 0, 1); +INSERT INTO `base_dict` VALUES (1524356168611188736, 'input', '手工输入', '商品服务', '', 1399985191002447872, '2022-05-11 19:50:06', 1399985191002447872, '2022-05-11 19:50:06', 1, 0); +INSERT INTO `base_dict` VALUES (1524356376518643712, 'GoodsParamType', '参数类型', '商品服务', '列表/手动输入', 1399985191002447872, '2022-05-11 19:50:56', 1399985191002447872, '2022-05-14 23:05:41', 0, 1); + +-- ---------------------------- +-- Table structure for base_dict_item +-- ---------------------------- +DROP TABLE IF EXISTS `base_dict_item`; +CREATE TABLE `base_dict_item` ( + `id` bigint(20) NOT NULL, + `dict_id` bigint(20) NOT NULL COMMENT '字典id', + `dict_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字典code', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字典项code', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字典项名称', + `sort_no` double(8, 2) NOT NULL COMMENT '排序', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + `version` int(8) NOT NULL COMMENT '版本', + PRIMARY KEY (`id`) USING BTREE, + INDEX `idx_dictionary_id`(`dict_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典项' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_dict_item +-- ---------------------------- +INSERT INTO `base_dict_item` VALUES (1422931375807242241, 1422929378374828033, 'Sex', '1', '男', 0.00, '男性', 0, '2021-08-04 22:44:11', 0, '2021-08-04 22:44:11', 0, 2); +INSERT INTO `base_dict_item` VALUES (1425729455402401794, 1422929378374828033, 'Sex', '2', '女', 0.00, '女性', 0, '2021-08-12 16:02:46', 0, '2021-08-12 16:02:46', 0, 1); +INSERT INTO `base_dict_item` VALUES (1425744258544136194, 1425744045414772737, 'MenuType', '0', '顶级菜单', 0.00, '顶级菜单', 0, '2021-08-12 17:01:35', 0, '2021-08-12 17:01:35', 0, 0); +INSERT INTO `base_dict_item` VALUES (1425744436592340993, 1425744045414772737, 'MenuType', '1', '子菜单', 0.00, '子菜单', 0, '2021-08-12 17:02:17', 0, '2021-08-12 17:02:17', 0, 0); +INSERT INTO `base_dict_item` VALUES (1425744470582980610, 1425744045414772737, 'MenuType', '2', '按钮权限', 0.00, '按钮权限', 0, '2021-08-12 17:02:26', 0, '2021-08-12 17:02:26', 0, 0); +INSERT INTO `base_dict_item` VALUES (1430094707250413568, 1422929378374828033, 'Sex', '0', '未知', 0.00, '不确定性别', 1399985191002447872, '2021-08-24 17:08:43', 1399985191002447872, '2021-08-24 17:08:43', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435830086406463488, 1435829999592759296, 'UserStatusCode', '1', '正常', 0.00, 'NORMAL', 1399985191002447872, '2021-09-09 12:59:04', 1399985191002447872, '2021-09-09 12:59:04', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435830141855162368, 1435829999592759296, 'UserStatusCode', '2', '锁定', 0.00, 'LOCK, 多次登录失败被锁定', 1399985191002447872, '2021-09-09 12:59:17', 1399985191002447872, '2021-09-09 12:59:17', 0, 1); +INSERT INTO `base_dict_item` VALUES (1435830260503633920, 1435829999592759296, 'UserStatusCode', '3', '封禁', 0.00, 'BAN', 1399985191002447872, '2021-09-09 12:59:45', 1399985191002447872, '2021-09-09 12:59:45', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838374749626368, 1435838066191458304, 'LogBusinessType', 'other', '其它', 0.00, '', 1399985191002447872, '2021-09-09 13:32:00', 1399985191002447872, '2021-09-09 13:32:00', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838414436130816, 1435838066191458304, 'LogBusinessType', 'insert', '新增', 0.00, '', 1399985191002447872, '2021-09-09 13:32:09', 1399985191002447872, '2021-09-09 13:32:09', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838467624099840, 1435838066191458304, 'LogBusinessType', 'update', '修改', 0.00, '', 1399985191002447872, '2021-09-09 13:32:22', 1399985191002447872, '2021-09-09 13:32:22', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838502755590144, 1435838066191458304, 'LogBusinessType', 'delete', '删除', 0.00, '', 1399985191002447872, '2021-09-09 13:32:30', 1399985191002447872, '2021-09-09 13:32:30', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838546934194176, 1435838066191458304, 'LogBusinessType', 'grant', '授权', 0.00, '', 1399985191002447872, '2021-09-09 13:32:41', 1399985191002447872, '2021-09-09 13:32:41', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838605537009664, 1435838066191458304, 'LogBusinessType', 'export', '导出', 0.00, '', 1399985191002447872, '2021-09-09 13:32:55', 1399985191002447872, '2021-09-09 13:32:55', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838705457913856, 1435838066191458304, 'LogBusinessType', 'import', '导入', 0.00, '', 1399985191002447872, '2021-09-09 13:33:19', 1399985191002447872, '2021-09-09 13:33:19', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838745861644288, 1435838066191458304, 'LogBusinessType', 'force', '强退', 0.00, '', 1399985191002447872, '2021-09-09 13:33:28', 1399985191002447872, '2021-09-09 13:33:28', 0, 0); +INSERT INTO `base_dict_item` VALUES (1435838786273763328, 1435838066191458304, 'LogBusinessType', 'clean', '清空数据', 0.00, '', 1399985191002447872, '2021-09-09 13:33:38', 1399985191002447872, '2021-09-09 13:33:38', 0, 0); +INSERT INTO `base_dict_item` VALUES (1438079113630003200, 1438078864509317120, 'MailSecurityCode', '1', '普通方式', 0.00, 'SECURITY_TYPE_PLAIN', 1399985191002447872, '2021-09-15 17:55:54', 1399985191002447872, '2021-09-15 17:55:54', 0, 0); +INSERT INTO `base_dict_item` VALUES (1438080323061755904, 1438078864509317120, 'MailSecurityCode', '2', 'TLS方式', 0.00, 'SECURITY_TYPE_TLS', 1399985191002447872, '2021-09-15 18:00:42', 1399985191002447872, '2021-09-15 18:00:42', 0, 0); +INSERT INTO `base_dict_item` VALUES (1438080372231581696, 1438078864509317120, 'MailSecurityCode', '3', 'SSL方式', 0.00, 'SECURITY_TYPE_SSL', 1399985191002447872, '2021-09-15 18:00:54', 1399985191002447872, '2021-09-15 18:00:54', 0, 0); +INSERT INTO `base_dict_item` VALUES (1439961603914047488, 1439961232651034624, 'MessageTemplateCode', '5', '微信', -10.00, 'WECHAT', 1399985191002447872, '2021-09-20 22:36:14', 1399985191002447872, '2021-09-20 22:36:14', 0, 1); +INSERT INTO `base_dict_item` VALUES (1439961704321490944, 1439961232651034624, 'MessageTemplateCode', '4', 'Email', 0.00, 'EMAIL', 1399985191002447872, '2021-09-20 22:36:38', 1399985191002447872, '2021-09-20 22:36:38', 0, 0); +INSERT INTO `base_dict_item` VALUES (1439962132744478720, 1439961232651034624, 'MessageTemplateCode', '3', '短信', 0.00, 'SMS', 1399985191002447872, '2021-09-20 22:38:20', 1399985191002447872, '2021-09-20 22:38:20', 0, 0); +INSERT INTO `base_dict_item` VALUES (1439962205578567680, 1439961232651034624, 'MessageTemplateCode', '2', '钉钉机器人', 0.00, 'DING_TALK_ROBOT', 1399985191002447872, '2021-09-20 22:38:38', 1399985191002447872, '2021-09-20 22:38:38', 0, 0); +INSERT INTO `base_dict_item` VALUES (1439962267511660544, 1439961232651034624, 'MessageTemplateCode', '1', '钉钉', 0.00, 'DING_TALK', 1399985191002447872, '2021-09-20 22:38:52', 1399985191002447872, '2021-09-20 22:38:52', 0, 0); +INSERT INTO `base_dict_item` VALUES (1452836696873984000, 1452836604783845376, 'SocialType', 'WeChat', '微信', 0.00, '', 1399985191002447872, '2021-10-26 11:17:16', 1399985191002447872, '2021-10-26 11:17:16', 0, 0); +INSERT INTO `base_dict_item` VALUES (1452837435482529792, 1452836604783845376, 'SocialType', 'QQ', 'QQ', 0.00, '', 1399985191002447872, '2021-10-26 11:20:12', 1399985191002447872, '2021-10-26 11:20:12', 0, 0); +INSERT INTO `base_dict_item` VALUES (1452837523030237184, 1452836604783845376, 'SocialType', 'DingTalk', '钉钉', 0.00, '', 1399985191002447872, '2021-10-26 11:20:33', 1399985191002447872, '2021-10-26 11:20:33', 0, 0); +INSERT INTO `base_dict_item` VALUES (1452844537911406592, 1452843488735621120, 'ParamType', '1', '系统参数', 0.00, '', 1399985191002447872, '2021-10-26 11:48:25', 1399985191002447872, '2021-10-26 11:48:25', 0, 0); +INSERT INTO `base_dict_item` VALUES (1452844565031776256, 1452843488735621120, 'ParamType', '2', '用户参数', 0.00, '', 1399985191002447872, '2021-10-26 11:48:32', 1399985191002447872, '2021-10-26 11:48:32', 0, 2); +INSERT INTO `base_dict_item` VALUES (1496026946344005632, 1496024933900169216, 'Political', '1', '中共党员', 1.00, '', 1399985191002447872, '2022-02-22 15:39:54', 1399985191002447872, '2022-02-22 15:39:54', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027004560945152, 1496024933900169216, 'Political', '2', '中共预备党员', 2.00, '', 1399985191002447872, '2022-02-22 15:40:07', 1399985191002447872, '2022-02-22 15:40:07', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027039264616448, 1496024933900169216, 'Political', '3', '共青团员', 3.00, '', 1399985191002447872, '2022-02-22 15:40:16', 1399985191002447872, '2022-02-22 15:40:16', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027077550223360, 1496024933900169216, 'Political', '4', '民革党员', 4.00, '', 1399985191002447872, '2022-02-22 15:40:25', 1399985191002447872, '2022-02-22 15:40:25', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027123461074944, 1496024933900169216, 'Political', '5', '民盟盟员', 5.00, '', 1399985191002447872, '2022-02-22 15:40:36', 1399985191002447872, '2022-02-22 15:40:36', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027197566038016, 1496024933900169216, 'Political', '6', '民建会员', 6.00, '', 1399985191002447872, '2022-02-22 15:40:53', 1399985191002447872, '2022-02-22 15:40:53', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027234803068928, 1496024933900169216, 'Political', '7', '民进会员', 7.00, '', 1399985191002447872, '2022-02-22 15:41:02', 1399985191002447872, '2022-02-22 15:41:02', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027272941875200, 1496024933900169216, 'Political', '8', '农工党党员', 8.00, '', 1399985191002447872, '2022-02-22 15:41:11', 1399985191002447872, '2022-02-22 15:41:11', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027306634719232, 1496024933900169216, 'Political', '9', '致公党党员', 9.00, '', 1399985191002447872, '2022-02-22 15:41:19', 1399985191002447872, '2022-02-22 15:41:19', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027369796743168, 1496024933900169216, 'Political', '10', '九三学社社员', 10.00, '', 1399985191002447872, '2022-02-22 15:41:34', 1399985191002447872, '2022-02-22 15:41:35', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027408141070336, 1496024933900169216, 'Political', '11', '台盟盟员', 11.00, '', 1399985191002447872, '2022-02-22 15:41:44', 1399985191002447872, '2022-02-22 15:41:44', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027456849522688, 1496024933900169216, 'Political', '12', '无党派人士', 12.00, '', 1399985191002447872, '2022-02-22 15:41:55', 1399985191002447872, '2022-02-22 15:41:55', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496027516639326208, 1496024933900169216, 'Political', '13', '群众', 13.00, '', 1399985191002447872, '2022-02-22 15:42:09', 1399985191002447872, '2022-02-22 15:42:10', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496780500696539136, 1496722894707728384, 'PayChannel', '1', '支付宝', 1.00, '', 1399985191002447872, '2022-02-24 17:34:15', 1399985191002447872, '2022-03-08 11:02:59', 0, 3); +INSERT INTO `base_dict_item` VALUES (1496780576818962432, 1496722894707728384, 'PayChannel', '2', '微信', 2.00, '', 1399985191002447872, '2022-02-24 17:34:33', 1399985191002447872, '2022-03-08 11:04:00', 0, 2); +INSERT INTO `base_dict_item` VALUES (1496780712492113920, 1496723207565058048, 'PayWay', '1', 'wap支付', 0.00, '', 1399985191002447872, '2022-02-24 17:35:05', 1399985191002447872, '2022-02-24 17:35:05', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496780757647990784, 1496723207565058048, 'PayWay', '2', '应用支付', 0.00, '', 1399985191002447872, '2022-02-24 17:35:16', 1399985191002447872, '2022-02-24 17:35:16', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496780799691694080, 1496723207565058048, 'PayWay', '3', 'web支付', 0.00, '', 1399985191002447872, '2022-02-24 17:35:26', 1399985191002447872, '2022-02-24 17:35:26', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496780838451257344, 1496723207565058048, 'PayWay', '4', '二维码扫码支付', 0.00, '', 1399985191002447872, '2022-02-24 17:35:35', 1399985191002447872, '2022-02-24 17:35:35', 0, 0); +INSERT INTO `base_dict_item` VALUES (1496780876388737024, 1496723207565058048, 'PayWay', '5', '付款码支付', 0.00, '', 1399985191002447872, '2022-02-24 17:35:44', 1399985191002447872, '2022-02-24 17:35:44', 0, 0); +INSERT INTO `base_dict_item` VALUES (1497141630803566592, 1497140849954185216, 'PayStatus', '3', '支付取消', 0.00, '', 1399985191002447872, '2022-02-25 17:29:15', 1399985191002447872, '2022-02-25 17:29:15', 0, 0); +INSERT INTO `base_dict_item` VALUES (1497141652379066368, 1497140849954185216, 'PayStatus', '2', '失败', 0.00, '', 1399985191002447872, '2022-02-25 17:29:20', 1399985191002447872, '2022-02-25 17:29:20', 0, 0); +INSERT INTO `base_dict_item` VALUES (1497141681915355136, 1497140849954185216, 'PayStatus', '1', '成功', 0.00, '', 1399985191002447872, '2022-02-25 17:29:27', 1399985191002447872, '2022-02-25 17:29:27', 0, 0); +INSERT INTO `base_dict_item` VALUES (1497141712743489536, 1497140849954185216, 'PayStatus', '0', '支付中', 0.00, '', 1399985191002447872, '2022-02-25 17:29:35', 1399985191002447872, '2022-02-25 17:29:35', 0, 0); +INSERT INTO `base_dict_item` VALUES (1497506810439892992, 1497140849954185216, 'PayStatus', '4', '部分退款', 1.00, '部分退款', 1399985191002447872, '2022-02-26 17:40:21', 1399985191002447872, '2022-03-04 21:22:46', 0, 7); +INSERT INTO `base_dict_item` VALUES (1499367587857694720, 1497140849954185216, 'PayStatus', '5', '已退款', 2.00, '完全退款', 1399985191002447872, '2022-03-03 20:54:25', 1399985191002447872, '2022-03-04 21:22:49', 0, 3); +INSERT INTO `base_dict_item` VALUES (1501030031432847360, 1496722894707728384, 'PayChannel', '3', '云闪付', 3.00, '', 1399985191002447872, '2022-03-08 11:00:22', 1399985191002447872, '2022-03-08 11:04:07', 0, 2); +INSERT INTO `base_dict_item` VALUES (1501030073489133568, 1496722894707728384, 'PayChannel', '4', '现金', 4.00, '', 1399985191002447872, '2022-03-08 11:00:32', 1399985191002447872, '2022-03-08 11:04:10', 0, 2); +INSERT INTO `base_dict_item` VALUES (1501030108314439680, 1496722894707728384, 'PayChannel', '5', '钱包', 5.00, '', 1399985191002447872, '2022-03-08 11:00:40', 1399985191002447872, '2022-03-08 11:04:14', 0, 2); +INSERT INTO `base_dict_item` VALUES (1501031490513768448, 1501031423232937984, 'AsyncPayChannel', '3', '云闪付', 0.00, '', 1399985191002447872, '2022-03-08 11:06:10', 1399985191002447872, '2022-03-08 11:06:10', 0, 0); +INSERT INTO `base_dict_item` VALUES (1501031518208757760, 1501031423232937984, 'AsyncPayChannel', '2', '微信', 0.00, '', 1399985191002447872, '2022-03-08 11:06:16', 1399985191002447872, '2022-03-08 11:06:16', 0, 0); +INSERT INTO `base_dict_item` VALUES (1501031544360243200, 1501031423232937984, 'AsyncPayChannel', '1', '支付宝', 0.00, '', 1399985191002447872, '2022-03-08 11:06:23', 1399985191002447872, '2022-03-08 11:06:23', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502276841057005568, 1502276739978473472, 'WalletStatus', '2', '禁用', 0.00, '', 1399985191002447872, '2022-03-11 21:34:45', 1399985191002447872, '2022-03-11 21:34:45', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502276862108217344, 1502276739978473472, 'WalletStatus', '1', '正常', 0.00, '', 1399985191002447872, '2022-03-11 21:34:50', 1399985191002447872, '2022-03-11 21:34:50', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502624716257456128, 1502624515799085056, 'WalletLogType', '1', '开通', 0.00, '', 1399985191002447872, '2022-03-12 20:37:04', 1399985191002447872, '2022-03-12 20:37:04', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502624931978899456, 1502624515799085056, 'WalletLogType', '2', '主动充值', 0.00, '', 1399985191002447872, '2022-03-12 20:37:56', 1399985191002447872, '2022-03-12 20:37:56', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502624956209393664, 1502624515799085056, 'WalletLogType', '3', '自动充值', 0.00, '', 1399985191002447872, '2022-03-12 20:38:02', 1399985191002447872, '2022-03-12 20:38:02', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625014719934464, 1502624515799085056, 'WalletLogType', '4', '余额变动', 0.00, '', 1399985191002447872, '2022-03-12 20:38:16', 1399985191002447872, '2022-03-12 20:38:16', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625053097816064, 1502624515799085056, 'WalletLogType', '5', '支付', 0.00, '', 1399985191002447872, '2022-03-12 20:38:25', 1399985191002447872, '2022-03-12 20:38:25', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625091639275520, 1502624515799085056, 'WalletLogType', '6', '系统扣除余额', 0.00, '', 1399985191002447872, '2022-03-12 20:38:34', 1399985191002447872, '2022-03-12 20:38:34', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625123725701120, 1502624515799085056, 'WalletLogType', '7', '退款', 0.00, '', 1399985191002447872, '2022-03-12 20:38:42', 1399985191002447872, '2022-03-12 20:38:42', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625783145787392, 1502624632392347648, 'WalletLogOperation', '1', '系统操作', 0.00, '', 1399985191002447872, '2022-03-12 20:41:19', 1399985191002447872, '2022-03-12 20:41:19', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625814837948416, 1502624632392347648, 'WalletLogOperation', '2', '管理员操作', 0.00, '', 1399985191002447872, '2022-03-12 20:41:26', 1399985191002447872, '2022-03-12 20:41:26', 0, 0); +INSERT INTO `base_dict_item` VALUES (1502625850355314688, 1502624632392347648, 'WalletLogOperation', '3', '用户操作', 0.00, '', 1399985191002447872, '2022-03-12 20:41:35', 1399985191002447872, '2022-03-12 20:41:35', 0, 0); +INSERT INTO `base_dict_item` VALUES (1503340241493135360, 1503340128037212160, 'VoucherStatus', '1', '启用', 0.00, '', 1399985191002447872, '2022-03-14 20:00:19', 1399985191002447872, '2022-03-14 20:00:19', 0, 0); +INSERT INTO `base_dict_item` VALUES (1503340326645895168, 1503340128037212160, 'VoucherStatus', '2', '停用', 0.00, '', 1399985191002447872, '2022-03-14 20:00:39', 1399985191002447872, '2022-03-14 20:00:39', 0, 0); +INSERT INTO `base_dict_item` VALUES (1505112357976612864, 1496722894707728384, 'PayChannel', '6', '储值卡', 0.00, '', 1399985191002447872, '2022-03-19 17:22:04', 1399985191002447872, '2022-03-19 17:22:04', 0, 0); +INSERT INTO `base_dict_item` VALUES (1524356452720758784, 1524356376518643712, 'GoodsParamType', 'input', '手工录入', 0.00, '', 1399985191002447872, '2022-05-11 19:51:14', 1399985191002447872, '2022-05-11 19:51:14', 0, 0); +INSERT INTO `base_dict_item` VALUES (1524356510157557760, 1524356376518643712, 'GoodsParamType', 'select', '列表选择', 0.00, '', 1399985191002447872, '2022-05-11 19:51:28', 1399985191002447872, '2022-05-11 19:51:28', 0, 0); + +-- ---------------------------- +-- Table structure for base_key_value +-- ---------------------------- +DROP TABLE IF EXISTS `base_key_value`; +CREATE TABLE `base_key_value` ( + `id` bigint(20) NOT NULL, + `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '参数键名', + `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '参数值', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + `version` int(8) NOT NULL COMMENT '版本', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'kv存储' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_key_value +-- ---------------------------- + +-- ---------------------------- +-- Table structure for base_param +-- ---------------------------- +DROP TABLE IF EXISTS `base_param`; +CREATE TABLE `base_param` ( + `id` bigint(20) NOT NULL, + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数名称', + `param_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '参数键名', + `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '参数值', + `type` int(4) NULL DEFAULT NULL COMMENT '参数类型', + `internal` bit(1) NOT NULL COMMENT '内置参数', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + `version` int(8) NOT NULL COMMENT '版本', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统参数配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of base_param +-- ---------------------------- +INSERT INTO `base_param` VALUES (1452842684284891136, '测试', 'test.v1', '123', 1, b'0', NULL, 1399985191002447872, '2021-10-26 11:41:03', 1399985191002447872, '2021-10-26 11:41:03', 0, 0); +INSERT INTO `base_param` VALUES (1500338438182789120, '结算台聚合支付请求地址', 'CashierAggregateUrl', 'http://pay1.bootx.cn/cashier/aggregatePay?key=', 1, b'1', '', 1399985191002447872, '2022-03-06 13:12:13', 1399985191002447872, '2022-05-01 15:03:03', 0, 3); +INSERT INTO `base_param` VALUES (1520668030248361984, '文件服务器地址', 'FileServerUrl', 'http://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-05-01 15:34:46', 1399985191002447872, '2022-05-19 12:53:21', 0, 5); +INSERT INTO `base_param` VALUES (1529281530059161600, 'websocket服务器地址', 'WebsocketServerUrl', 'ws://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-05-25 10:01:44', 1399985191002447872, '2022-05-25 10:01:44', 0, 0); + +-- ---------------------------- +-- Table structure for common_sequence_range +-- ---------------------------- +DROP TABLE IF EXISTS `common_sequence_range`; +CREATE TABLE `common_sequence_range` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `range_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '区间key', + `range_value` bigint(20) NOT NULL COMMENT '区间开始值', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '序列生成器队列区间管理' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of common_sequence_range +-- ---------------------------- +INSERT INTO `common_sequence_range` VALUES (1470679520373862400, 'Sequence:cs', 2006, 0, '2021-12-14 16:58:16', 0, '2021-12-14 16:58:16', 6, 0); +INSERT INTO `common_sequence_range` VALUES (1470679955230908416, 'cs', 2020, 0, '2021-12-14 17:00:00', 0, '2021-12-14 17:00:00', 13, 0); + +-- ---------------------------- +-- Table structure for demo_data_encrypt +-- ---------------------------- +DROP TABLE IF EXISTS `demo_data_encrypt`; +CREATE TABLE `demo_data_encrypt` ( + `id` bigint(20) NOT NULL, + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '内容', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据加密解密演示' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of demo_data_encrypt +-- ---------------------------- +INSERT INTO `demo_data_encrypt` VALUES (1506922411881103360, '测试加密效果', 'eI2RIrRLG+QUna3jMK+kejyJTTKdPFhaYWP4EhktJ2lkGTEsIxZesetNTzcqUA934ZN/OUdw4aj4t5Q+u1sH7A==', 1399985191002447872, '2022-03-24 17:14:35', 1399985191002447872, '2022-03-24 17:23:41', 1, 0); +INSERT INTO `demo_data_encrypt` VALUES (1506943412354408448, '测试下', 'Dgv5OSNiXuknceoZzeOUOQ==', 1399985191002447872, '2022-03-24 17:14:35', 1399985191002447872, '2022-03-24 17:23:41', 1, 0); + +-- ---------------------------- +-- Table structure for demo_data_perm +-- ---------------------------- +DROP TABLE IF EXISTS `demo_data_perm`; +CREATE TABLE `demo_data_perm` ( + `id` bigint(20) NOT NULL COMMENT '角色ID', + `name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称', + `creator_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者名称', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '说明', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据权限演示' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of demo_data_perm +-- ---------------------------- +INSERT INTO `demo_data_perm` VALUES (1495969849707220992, '33', 'xxm', '444', 1399985191002447872, '2022-02-22 11:53:01', 1399985191002447872, '2022-02-22 11:53:01', 0, 0); +INSERT INTO `demo_data_perm` VALUES (1506921683460521984, '测试', '小小明', NULL, 1399985191002447872, '2022-03-24 17:11:41', 1399985191002447872, '2022-03-24 17:11:41', 0, 0); +INSERT INTO `demo_data_perm` VALUES (1531547191561072640, '测试', '测试', '123', 1435967884114194432, '2022-05-31 16:04:40', 1435967884114194432, '2022-05-31 16:04:40', 0, 0); + +-- ---------------------------- +-- Table structure for demo_data_sensitive +-- ---------------------------- +DROP TABLE IF EXISTS `demo_data_sensitive`; +CREATE TABLE `demo_data_sensitive` ( + `id` bigint(20) NOT NULL COMMENT '角色ID', + `chinese_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '中文名字', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '密码', + `id_card` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证号', + `mobile_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', + `car_license` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '车牌号', + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电子邮件', + `other` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '其他', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据脱敏演示' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of demo_data_sensitive +-- ---------------------------- +INSERT INTO `demo_data_sensitive` VALUES (1506942377435037696, '刘向东', '123456', '372921199302021125', '13324591123', '鲁A8S8866', 'bootx123@outlook.com', '测试测试测试测试测试测试测试问题', 1399985191002447872, '2022-03-24 18:33:55', 1399985191002447872, '2022-03-24 18:36:09', 2, 0); +INSERT INTO `demo_data_sensitive` VALUES (1506943326094352384, '成是非', '99885511', '101278112512107721', '18855446622', '汉S123456', 'chengshifei@foxmail.com', '这个就是就是就是就是就是就是这样的', 1399985191002447872, '2022-03-24 18:33:55', 1399985191002447872, '2022-03-24 18:35:00', 1, 0); + +-- ---------------------------- +-- Table structure for demo_super_query +-- ---------------------------- +DROP TABLE IF EXISTS `demo_super_query`; +CREATE TABLE `demo_super_query` ( + `id` bigint(20) NOT NULL COMMENT '角色ID', + `name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称', + `age` int(5) NULL DEFAULT NULL COMMENT '年龄', + `vip` bit(1) NULL DEFAULT NULL COMMENT '是否vip', + `birthday` date NULL DEFAULT NULL COMMENT '生日', + `work_time` time(0) NULL DEFAULT NULL COMMENT '上班时间', + `registration_time` datetime(0) NULL DEFAULT NULL COMMENT '注册时间', + `political` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '政治面貌', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '超级查询演示' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of demo_super_query +-- ---------------------------- +INSERT INTO `demo_super_query` VALUES (1496046463434567680, '小小明', 18, b'1', '1998-01-23', '08:30:00', '2022-02-22 16:57:27', '13', '这是备注', 1399985191002447872, '2022-02-22 16:57:27', 1399985191002447872, '2022-02-22 17:03:34', 1, 0); +INSERT INTO `demo_super_query` VALUES (1496372341213433856, '关羽', 52, b'1', '2000-02-23', '14:31:36', '2022-02-23 14:32:22', '1', '', 1399985191002447872, '2022-02-23 14:32:22', 1399985191002447872, '2022-02-23 14:32:22', 0, 0); +INSERT INTO `demo_super_query` VALUES (1496372489909899264, '张飞', 54, b'0', '1996-02-11', '08:00:00', '2022-02-23 14:32:58', '7', '备注', 1399985191002447872, '2022-02-23 14:32:58', 1399985191002447872, '2022-02-23 14:32:58', 0, 0); +INSERT INTO `demo_super_query` VALUES (1496372766427779072, '梁冀', 38, b'1', '1958-02-08', '08:30:00', '2022-02-23 14:34:03', '1', '', 1399985191002447872, '2022-02-23 14:34:03', 1399985191002447872, '2022-02-23 14:34:03', 0, 0); +INSERT INTO `demo_super_query` VALUES (1496373512871284736, '刘备', 108, b'0', '1993-11-12', '09:30:10', '2022-02-23 14:37:01', '2', '刘羽禅的粑粑', 1399985191002447872, '2022-02-23 14:37:01', 1399985191002447872, '2022-02-23 14:37:01', 0, 0); + +-- ---------------------------- +-- Table structure for ding_config +-- ---------------------------- +DROP TABLE IF EXISTS `ding_config`; +CREATE TABLE `ding_config` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `app_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + `app_secret` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + `enable` bit(1) NOT NULL COMMENT '是否启用', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(6) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` bit(1) NOT NULL COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '钉钉配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of ding_config +-- ---------------------------- +INSERT INTO `ding_config` VALUES (1511265279181553664, '测试钉钉小程序配置', 'dingg4kj0ymmvbrvrg5a', 'Ushk8RuIT694Y7qhPQs2PHa0MFHa4PjHVUv1Th4AYW8W5kuDRcwnV3irpnAupAJK', b'0', '备注', 0, '2022-04-05 16:51:35.166000', 1399985191002447872, '2022-04-05 18:02:13.542000', 3, b'0'); +INSERT INTO `ding_config` VALUES (1511283139236810752, '测试钉钉h5配置', 'dingcksft7waezipjcjq', 'WCc3q4-iOFxSmPG_OyKIKL1l0DvM-HX0B2_jsbOrOxxsYuy0iBCXKTyFbv2RZ3jX', b'1', NULL, 1399985191002447872, '2022-04-05 18:02:33.334000', 1399985191002447872, '2022-04-05 18:04:25.936000', 3, b'0'); + +-- ---------------------------- +-- Table structure for ding_robot_config +-- ---------------------------- +DROP TABLE IF EXISTS `ding_robot_config`; +CREATE TABLE `ding_robot_config` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编号', + `access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '钉钉机器人访问token', + `enable_signature_check` bit(1) NOT NULL COMMENT '是否开启验签', + `sign_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '钉钉机器人私钥', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(6) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` bit(1) NOT NULL COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '钉钉机器人配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of ding_robot_config +-- ---------------------------- +INSERT INTO `ding_robot_config` VALUES (1333022277138264064, 'bootx机器人', 'bootx', '4a6212971d64208f45d647190ebc69986d6e9b67faf6aa7f1c8fc332f6652060', b'1', 'SECb6f9f872847caec745fcf10a46f4250b36c0337bade670d2f1f4756682b8cad2', 'bootx群机器人', -1, '2020-11-29 20:17:31.875000', -1, '2020-11-29 20:17:31.875000', 1, b'0'); +INSERT INTO `ding_robot_config` VALUES (1454001517812203520, '33', '12', '111111111111111111', b'1', '', '', 1399985191002447872, '2021-10-29 16:25:50.547000', 1399985191002447872, '2021-10-29 16:25:50.597000', 2, b'1'); + +-- ---------------------------- +-- Table structure for flyway_schema_history +-- ---------------------------- +DROP TABLE IF EXISTS `flyway_schema_history`; +CREATE TABLE `flyway_schema_history` ( + `installed_rank` int(11) NOT NULL, + `version` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `script` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `checksum` int(11) NULL DEFAULT NULL, + `installed_by` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `installed_on` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), + `execution_time` int(11) NOT NULL, + `success` tinyint(1) NOT NULL, + PRIMARY KEY (`installed_rank`) USING BTREE, + INDEX `flyway_schema_history_s_idx`(`success`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of flyway_schema_history +-- ---------------------------- +INSERT INTO `flyway_schema_history` VALUES (1, '1.1.0.220604', 'init', 'SQL', 'V1.1.0_220604__init.sql', -474276030, 'bootx', '2022-07-07 10:32:27', 83640, 1); +INSERT INTO `flyway_schema_history` VALUES (2, '1.1.0.220624', 'bate3', 'SQL', 'V1.1.0_220624__bate3.sql', 85360861, 'bootx', '2022-07-07 10:32:28', 723, 1); +INSERT INTO `flyway_schema_history` VALUES (3, '1.1.0.220702', 'bate4', 'SQL', 'V1.1.0_220702__bate4.sql', 764266899, 'bootx', '2022-07-07 10:32:35', 6172, 1); + +-- ---------------------------- +-- Table structure for goods_brand +-- ---------------------------- +DROP TABLE IF EXISTS `goods_brand`; +CREATE TABLE `goods_brand` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌名称', + `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌图标', + `enable` bit(1) NULL DEFAULT NULL COMMENT '是否启用', + `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_brand +-- ---------------------------- +INSERT INTO `goods_brand` VALUES (1524046765181800448, '鸭鸭', '', NULL, '', 1399985191002447872, '2022-05-10 23:20:39', 1399985191002447872, '2022-05-10 23:20:39', 0, 0); +INSERT INTO `goods_brand` VALUES (1525092807788691456, '微信', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:15', 1399985191002447872, '2022-05-13 20:37:15', 0, 0); +INSERT INTO `goods_brand` VALUES (1525092835118776320, '舜泰', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:21', 1399985191002447872, '2022-05-13 20:37:21', 0, 0); +INSERT INTO `goods_brand` VALUES (1525092854139944960, '绿城', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:26', 1399985191002447872, '2022-05-13 20:37:26', 0, 0); + +-- ---------------------------- +-- Table structure for goods_category +-- ---------------------------- +DROP TABLE IF EXISTS `goods_category`; +CREATE TABLE `goods_category` ( + `id` bigint(20) NOT NULL, + `pid` bigint(20) NULL DEFAULT NULL COMMENT '上级类目id', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类目名称', + `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标/图片地址', + `enable` bit(1) NOT NULL COMMENT '是否启用', + `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', + `level` int(5) NULL DEFAULT NULL COMMENT '层级', + `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_category +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_category_brand +-- ---------------------------- +DROP TABLE IF EXISTS `goods_category_brand`; +CREATE TABLE `goods_category_brand` ( + `id` bigint(20) NOT NULL, + `category_id` bigint(20) NOT NULL COMMENT '分类id', + `brand_id` bigint(20) NOT NULL COMMENT '品牌id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目品牌关联' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_category_brand +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_category_parameter +-- ---------------------------- +DROP TABLE IF EXISTS `goods_category_parameter`; +CREATE TABLE `goods_category_parameter` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '品牌名称', + `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型', + `options` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '选择值(列表)', + `required` bit(1) NULL DEFAULT NULL COMMENT '是否必填', + `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', + `group_id` bigint(20) NULL DEFAULT NULL COMMENT '参数组id', + `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', + `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目参数' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_category_parameter +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_category_parameter_group +-- ---------------------------- +DROP TABLE IF EXISTS `goods_category_parameter_group`; +CREATE TABLE `goods_category_parameter_group` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', + `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', + `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目参数组' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_category_parameter_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_category_specification +-- ---------------------------- +DROP TABLE IF EXISTS `goods_category_specification`; +CREATE TABLE `goods_category_specification` ( + `id` bigint(20) NOT NULL, + `category_id` bigint(20) NOT NULL COMMENT '分类id', + `specification_id` bigint(20) NOT NULL COMMENT '规格id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目规格关联' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_category_specification +-- ---------------------------- +INSERT INTO `goods_category_specification` VALUES (1525131071690076160, 1523994966466924544, 1524258633343254528); +INSERT INTO `goods_category_specification` VALUES (1525131071694270464, 1523994966466924544, 1524360756764590080); + +-- ---------------------------- +-- Table structure for goods_goods +-- ---------------------------- +DROP TABLE IF EXISTS `goods_goods`; +CREATE TABLE `goods_goods` ( + `id` bigint(20) NOT NULL, + `cid` bigint(20) NULL DEFAULT NULL COMMENT '类目id', + `cname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类目名称', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码', + `packing` bit(1) NOT NULL COMMENT '是否是打包品', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `addition` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', + `state` int(11) NOT NULL COMMENT '状态', + `banner_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `display_price` decimal(19, 2) NULL DEFAULT NULL, + `goods_type` int(11) NULL DEFAULT NULL, + `main_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `sale_off_time` datetime(6) NULL DEFAULT NULL, + `sale_on_time` datetime(6) NULL DEFAULT NULL, + `sale_state` int(11) NULL DEFAULT NULL, + `shop_id` bigint(20) NULL DEFAULT NULL, + `attr_def_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `attr_values` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `display_lower_price` decimal(19, 2) NULL DEFAULT NULL, + `display_upper_price` decimal(19, 2) NULL DEFAULT NULL, + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + `out_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品spu' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_goods +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_goods_packing +-- ---------------------------- +DROP TABLE IF EXISTS `goods_goods_packing`; +CREATE TABLE `goods_goods_packing` ( + `id` bigint(20) NOT NULL, + `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '打包品', + `packed_goods_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包品', + `create_time` datetime(6) NULL DEFAULT NULL, + `creator` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品打包关系' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_goods_packing +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_goods_sku +-- ---------------------------- +DROP TABLE IF EXISTS `goods_goods_sku`; +CREATE TABLE `goods_goods_sku` ( + `id` bigint(20) NOT NULL, + `cid` bigint(20) NULL DEFAULT NULL COMMENT '所属类目id', + `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '所属商品 id', + `shop_id` bigint(20) NULL DEFAULT NULL COMMENT '所属商户', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部编码', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'SKU 名称', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `packing` bit(1) NOT NULL COMMENT '是否打包品', + `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加信息', + `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id', + `attr_def_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生成此商品 SKU 的属性定义的 id 拼接串', + `attr_values` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值id拼接串', + `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '示值拼接串', + `is_unlimited` bit(1) NOT NULL COMMENT '是否无限库存', + `capacity` int(11) NOT NULL COMMENT '初始库存', + `locked` int(11) NOT NULL COMMENT '预占库存', + `sold` int(11) NOT NULL COMMENT '已用库存', + `available` int(11) NOT NULL COMMENT '可用库存', + `sale_state` int(11) NULL DEFAULT NULL COMMENT '销售状态', + `sale_off_time` datetime(6) NULL DEFAULT NULL COMMENT '上架时间', + `sale_on_time` datetime(6) NULL DEFAULT NULL COMMENT '下架时间', + `price` decimal(19, 2) NULL DEFAULT NULL COMMENT '价格', + `state` int(11) NOT NULL COMMENT '状态', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NULL DEFAULT NULL, + `out_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品sku' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_goods_sku +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_goods_sku_attr +-- ---------------------------- +DROP TABLE IF EXISTS `goods_goods_sku_attr`; +CREATE TABLE `goods_goods_sku_attr` ( + `id` bigint(20) NOT NULL, + `cid` bigint(20) NULL DEFAULT NULL COMMENT '类目 id', + `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品 id', + `sku_id` bigint(20) NULL DEFAULT NULL COMMENT 'SKU id', + `attr_def_id` bigint(20) NULL DEFAULT NULL COMMENT '属性定义 id', + `attr_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值', + `attr_value_display` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示值', + `tid` bigint(20) NOT NULL, + `attr_values_display` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku属性' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_goods_sku_attr +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_goods_sku_packing +-- ---------------------------- +DROP TABLE IF EXISTS `goods_goods_sku_packing`; +CREATE TABLE `goods_goods_sku_packing` ( + `id` bigint(20) NOT NULL, + `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '打包品', + `packed_goods_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包品', + `goods_sku_id` bigint(20) NULL DEFAULT NULL COMMENT '打包SKU', + `packed_sku_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包SKU', + `create_time` datetime(6) NULL DEFAULT NULL, + `creator` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku打包关系' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_goods_sku_packing +-- ---------------------------- + +-- ---------------------------- +-- Table structure for goods_specification +-- ---------------------------- +DROP TABLE IF EXISTS `goods_specification`; +CREATE TABLE `goods_specification` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格名称', + `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型', + `options` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格列表值', + `state` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态', + `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '规格' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of goods_specification +-- ---------------------------- + +-- ---------------------------- +-- Table structure for iam_application +-- ---------------------------- +DROP TABLE IF EXISTS `iam_application`; +CREATE TABLE `iam_application` ( + `id` bigint(20) NOT NULL, + `code` varchar(21) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `system` bit(1) NOT NULL COMMENT '是否系统内置', + `enable` bit(1) NOT NULL COMMENT '是否可用', + `client_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '关联终端', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '认证应用' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_application +-- ---------------------------- +INSERT INTO `iam_application` VALUES (1430430071299207168, 'admin', 'pc管理端', b'1', b'1', '1430430071299207168,1435138582839009280,1430478946919653376,1542091599907115008,1542804450312122368,1543126042909016064', 'pc浏览器', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-07-02 14:55:11', 4, 0); +INSERT INTO `iam_application` VALUES (1430430071299207169, 'h5', 'h5端', b'1', b'1', '1430430071299207168,1435138582839009280', '手机wap', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-06-29 18:31:45', 1, 0); + +-- ---------------------------- +-- Table structure for iam_client +-- ---------------------------- +DROP TABLE IF EXISTS `iam_client`; +CREATE TABLE `iam_client` ( + `id` bigint(20) NOT NULL, + `code` varchar(21) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `system` bit(1) NOT NULL COMMENT '是否系统内置', + `timeout` bigint(11) NULL DEFAULT NULL COMMENT '在线时长 秒', + `captcha` bit(1) NOT NULL COMMENT '启用验证码', + `pwd_err_num` int(8) NOT NULL COMMENT '密码错误次数', + `enable` bit(1) NOT NULL COMMENT '是否可用', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '认证终端' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_client +-- ---------------------------- +INSERT INTO `iam_client` VALUES (1430430071299207168, 'password', '账号密码登陆', b'1', 3600, b'0', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-04-24 19:51:13', 16, 0); +INSERT INTO `iam_client` VALUES (1430478946919653376, 'miniApp', '微信小程序', b'0', 99999, b'1', 0, b'1', NULL, 1399985191002447872, '2021-08-25 18:35:33', 1399985191002447872, '2021-08-25 18:35:33', 2, 0); +INSERT INTO `iam_client` VALUES (1435138582839009280, 'phone', '手机短信登录', b'0', 3600, b'1', 0, b'1', NULL, 1399985191002447872, '2021-09-07 15:11:16', 1399985191002447872, '2022-06-26 21:35:20', 4, 0); +INSERT INTO `iam_client` VALUES (1542091599907115008, 'dingTalk', '钉钉', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-06-29 18:24:23', 1399985191002447872, '2022-07-02 14:55:01', 5, 0); +INSERT INTO `iam_client` VALUES (1542804450312122368, 'weCom', '企业微信', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-01 17:37:00', 1399985191002447872, '2022-07-01 17:37:00', 0, 0); +INSERT INTO `iam_client` VALUES (1543126042909016064, 'WeChat', '微信登录', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-02 14:54:53', 1399985191002447872, '2022-07-02 14:54:53', 0, 0); + +-- ---------------------------- +-- Table structure for iam_data_scope +-- ---------------------------- +DROP TABLE IF EXISTS `iam_data_scope`; +CREATE TABLE `iam_data_scope` ( + `id` bigint(20) NOT NULL COMMENT '角色ID', + `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '编码', + `name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称', + `type` int(4) NOT NULL COMMENT '类型', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '说明', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据范围权限' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_data_scope +-- ---------------------------- +INSERT INTO `iam_data_scope` VALUES (1474706893178871808, 'self', '自身数据', 1, '只能查看自身范围的数据', 1399985191002447872, '2021-12-25 19:41:37', 1399985191002447872, '2021-12-25 19:41:37', 1, 0); +INSERT INTO `iam_data_scope` VALUES (1474717084985270272, 'user', '用户数据权限', 2, '用户数据权限', 1399985191002447872, '2021-12-25 20:22:07', 1399985191002447872, '2021-12-25 20:22:07', 0, 0); +INSERT INTO `iam_data_scope` VALUES (1474717160671485952, 'dept', '部门权限', 3, '', 1399985191002447872, '2021-12-25 20:22:25', 1399985191002447872, '2021-12-25 20:22:25', 0, 0); +INSERT INTO `iam_data_scope` VALUES (1474717276908232704, 'userAndDept', '用户和部门权限', 4, '', 1399985191002447872, '2021-12-25 20:22:52', 1399985191002447872, '2021-12-25 20:22:52', 0, 0); +INSERT INTO `iam_data_scope` VALUES (1474717344562356224, 'all', '全部数据', 5, '', 1399985191002447872, '2021-12-25 20:23:09', 1399985191002447872, '2021-12-25 20:23:09', 0, 0); +INSERT INTO `iam_data_scope` VALUES (1477990268903804928, 'belong_dept', '所在部门', 6, '', 1399985191002447872, '2022-01-03 21:08:34', 1399985191002447872, '2022-01-03 21:08:35', 0, 0); +INSERT INTO `iam_data_scope` VALUES (1477990290521247744, 'belong_dept', '所在部门', 6, '', 1399985191002447872, '2022-01-03 21:08:40', 1399985191002447872, '2022-01-03 21:08:40', 0, 1); +INSERT INTO `iam_data_scope` VALUES (1477990439800721408, 'belong_dept_and_sub', '所在及下级部门', 7, '', 1399985191002447872, '2022-01-03 21:09:15', 1399985191002447872, '2022-01-03 21:09:15', 0, 0); + +-- ---------------------------- +-- Table structure for iam_data_scope_dept +-- ---------------------------- +DROP TABLE IF EXISTS `iam_data_scope_dept`; +CREATE TABLE `iam_data_scope_dept` ( + `id` bigint(20) NOT NULL, + `data_scope_id` bigint(20) NOT NULL COMMENT '数据范围id', + `dept_id` bigint(20) NOT NULL COMMENT '部门id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据范围部门关联配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_data_scope_dept +-- ---------------------------- +INSERT INTO `iam_data_scope_dept` VALUES (1478742690014101504, 1474717160671485952, 1477978464559484928); +INSERT INTO `iam_data_scope_dept` VALUES (1478742920071675904, 1474717160671485952, 1477977592291053568); + +-- ---------------------------- +-- Table structure for iam_data_scope_user +-- ---------------------------- +DROP TABLE IF EXISTS `iam_data_scope_user`; +CREATE TABLE `iam_data_scope_user` ( + `id` bigint(20) NOT NULL, + `data_scope_id` bigint(20) NOT NULL COMMENT '数据范围id', + `user_id` bigint(20) NOT NULL COMMENT '用户id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据范围用户关联配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_data_scope_user +-- ---------------------------- +INSERT INTO `iam_data_scope_user` VALUES (1478738754876149760, 1474717084985270272, 1399985191002447872); +INSERT INTO `iam_data_scope_user` VALUES (1478738766460817408, 1474717084985270272, 1414143554414059520); +INSERT INTO `iam_data_scope_user` VALUES (1478738811792855040, 1474717084985270272, 1477997602862505984); +INSERT INTO `iam_data_scope_user` VALUES (1478747304583114752, 1474717084985270272, 1435894470432456704); +INSERT INTO `iam_data_scope_user` VALUES (1478747304587309056, 1474717084985270272, 1477997391729631232); + +-- ---------------------------- +-- Table structure for iam_dept +-- ---------------------------- +DROP TABLE IF EXISTS `iam_dept`; +CREATE TABLE `iam_dept` ( + `id` bigint(20) NOT NULL COMMENT 'ID', + `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父机构ID', + `dept_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '机构/部门名称', + `sort_no` int(11) NOT NULL DEFAULT 0 COMMENT '排序', + `org_category` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' COMMENT '机构类别 1公司 2部门 3岗位', + `org_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '机构编码', + `mobile` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号', + `fax` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '传真', + `address` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门组织机构表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_dept +-- ---------------------------- +INSERT INTO `iam_dept` VALUES (1259382878857957377, NULL, 'Bootx Platform总公司', 0, '1', '1', '', NULL, '济南市高新区齐鲁软件园', NULL, -1, '2020-05-10 15:20:51', -1, '2020-05-10 17:52:15', 4, 0); +INSERT INTO `iam_dept` VALUES (1477976804995026944, NULL, 'Bootx Cloud公司', 0, '1', '1', '', NULL, '济南市高新区汉峪金谷', '', 1399985191002447872, '2022-01-03 20:15:04', 1399985191002447872, '2022-01-03 20:15:05', 0, 1); +INSERT INTO `iam_dept` VALUES (1477977184768282624, NULL, 'Bootx Cloud公司', 0, '1', '1', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:16:35', 1399985191002447872, '2022-01-03 20:16:35', 0, 1); +INSERT INTO `iam_dept` VALUES (1477977301365739520, NULL, 'Bootx Cloud总公司', 0, '1', '2', '', NULL, '济南市高新区汉峪金谷', '', 1399985191002447872, '2022-01-03 20:17:03', 1399985191002447872, '2022-01-03 20:17:03', 1, 0); +INSERT INTO `iam_dept` VALUES (1477977592291053568, 1259382878857957377, 'bp济南分公司', 0, '1', '1_1', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:18:12', 1399985191002447872, '2022-01-03 20:18:12', 1, 0); +INSERT INTO `iam_dept` VALUES (1477977690928500736, 1259382878857957377, '历城分公司', 0, '1', '1_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:18:36', 1399985191002447872, '2022-01-03 20:18:36', 0, 1); +INSERT INTO `iam_dept` VALUES (1477977827897692160, 1259382878857957377, 'bp潍坊分公司', 0, '1', '1_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:19:08', 1399985191002447872, '2022-01-03 20:19:08', 0, 0); +INSERT INTO `iam_dept` VALUES (1477977880947249152, 1477977301365739520, 'bc菏泽分公司', 0, '1', '2_1', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:19:21', 1399985191002447872, '2022-01-03 20:19:21', 0, 0); +INSERT INTO `iam_dept` VALUES (1477977930175795200, 1477977301365739520, 'bc日照分公司', 0, '1', '2_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:19:33', 1399985191002447872, '2022-01-03 20:19:33', 0, 0); +INSERT INTO `iam_dept` VALUES (1477978464559484928, 1477977592291053568, '历城办事部', 0, '2', '1_1_1', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:21:40', 1399985191002447872, '2022-01-03 20:21:40', 1, 0); +INSERT INTO `iam_dept` VALUES (1477978512177418240, 1477977592291053568, '历下办事部', 0, '2', '1_1_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:21:51', 1399985191002447872, '2022-01-03 20:21:52', 0, 0); +INSERT INTO `iam_dept` VALUES (1477978610865197056, 1477977592291053568, '高新办事部', 0, '2', '1_1_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:22:15', 1399985191002447872, '2022-01-03 20:22:15', 0, 0); +INSERT INTO `iam_dept` VALUES (1477978810526650368, 1477977827897692160, '奎文办事部', 0, '2', '1_2_1', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:23:03', 1399985191002447872, '2022-01-03 20:23:03', 0, 0); +INSERT INTO `iam_dept` VALUES (1477978883247493120, 1477977827897692160, '潍城办事部', 0, '2', '1_2_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:23:20', 1399985191002447872, '2022-01-03 20:23:20', 0, 0); + +-- ---------------------------- +-- Table structure for iam_perm_menu +-- ---------------------------- +DROP TABLE IF EXISTS `iam_perm_menu`; +CREATE TABLE `iam_perm_menu` ( + `id` bigint(20) NOT NULL, + `app_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '应用code', + `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父id', + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单名称', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由名称', + `perm_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单权限编码', + `effect` bit(1) NULL DEFAULT NULL COMMENT '是否有效', + `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单图标', + `hidden` bit(1) NOT NULL COMMENT '是否隐藏', + `hide_children_in_menu` bit(1) NOT NULL COMMENT '是否隐藏子菜单', + `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件', + `component_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件名字', + `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路径', + `redirect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '菜单跳转地址(重定向)', + `sort_no` double NOT NULL COMMENT '菜单排序', + `menu_type` int(5) NOT NULL COMMENT '类型(0:一级菜单;1:子菜单 ;2:按钮权限)', + `leaf` bit(1) NULL DEFAULT NULL COMMENT '是否叶子节点', + `keep_alive` bit(1) NULL DEFAULT NULL COMMENT '是否缓存页面', + `target_outside` bit(1) NULL DEFAULT NULL COMMENT '是否外部打开方式', + `hidden_header_content` bit(1) NULL DEFAULT NULL COMMENT '隐藏的标题内容', + `admin` bit(1) NOT NULL COMMENT '系统菜单', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '权限_菜单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_perm_menu +-- ---------------------------- +INSERT INTO `iam_perm_menu` VALUES (1414596052497092608, 'admin', NULL, '系统管理', 'system', '', NULL, 'desktop', b'0', b'0', 'RouteView', '', '/system', '/system/user', 0, 0, b'0', b'1', b'0', b'0', b'1', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-27 10:02:16', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1414596647509446656, 'admin', 1452569691537256448, '用户管理', 'User', '', NULL, '', b'0', b'0', 'system/user/UserList', '', '/system/userAuth/user', '', 0, 1, b'0', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-27 10:17:40', 4, 0); +INSERT INTO `iam_perm_menu` VALUES (1414596773275652096, 'admin', 1414596052497092608, '菜单管理', 'Menu', '', NULL, '', b'0', b'0', 'system/menu/MenuList', '', '/system/permission/menu', '', 0, 1, b'0', b'1', b'0', b'0', b'1', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-26 23:56:16', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1414596805538238464, 'admin', 1452569339987472384, '角色管理', 'Role', '', NULL, '', b'0', b'0', 'system/role/RoleList', '', '/system/permission/role', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-26 23:56:04', 4, 0); +INSERT INTO `iam_perm_menu` VALUES (1414596842322284544, 'admin', 1452569691537256448, '部门管理', 'Dept', '', NULL, '', b'0', b'0', 'system/dept/DeptList', '', '/system/userAuth/dept', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-26 23:56:31', 7, 0); +INSERT INTO `iam_perm_menu` VALUES (1414596877617352704, 'admin', 1452571269199540224, '数据字典', 'Dict', '', b'0', '', b'0', b'0', 'system/dict/DictList', '', '/system/config/dict', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2022-05-19 09:04:55', 11, 0); +INSERT INTO `iam_perm_menu` VALUES (1431082258161434624, 'admin', 1452569691537256448, '在线用户管理', 'OnlineUser', '', NULL, '', b'0', b'0', 'system/online/OnlineUserList', NULL, '/system/userAuth/online', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-27 10:32:53', 6, 0); +INSERT INTO `iam_perm_menu` VALUES (1431083330909208576, 'admin', 1541427353886859264, '认证终端', 'Client', '', b'0', '', b'0', b'0', 'system/client/ClientList', NULL, '/system/config/client', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:37:09', 1399985191002447872, '2022-06-27 22:25:16', 8, 0); +INSERT INTO `iam_perm_menu` VALUES (1431089129232498688, 'admin', 1452569339987472384, '请求权限管理', 'Path', '', NULL, '', b'0', b'0', 'system/path/PathList', NULL, '/system/permission/path', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 11:00:11', 1399985191002447872, '2021-08-27 11:00:11', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1431152689832525824, 'admin', NULL, '系统监控', 'monitor', '', b'0', 'radar-chart', b'0', b'0', 'RouteView', NULL, '/monitor', '', 0, 0, b'1', b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2021-08-27 15:12:45', 1399985191002447872, '2022-06-17 17:57:30', 21, 0); +INSERT INTO `iam_perm_menu` VALUES (1431153358157348864, 'admin', 1431152689832525824, '接口文档', 'ApiSwagger', '', b'0', '', b'0', b'0', '', NULL, 'http://127.0.0.1:9999/doc.html', '', 0, 1, b'1', b'1', b'1', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 15:15:25', 1399985191002447872, '2022-06-07 11:06:52', 15, 0); +INSERT INTO `iam_perm_menu` VALUES (1435143678721236992, 'admin', 1452567897717321728, '登录日志', 'LoginLog', '', NULL, '', b'0', b'0', 'starter/log/LoginLogList', NULL, '/system/log/loginLog', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-07 15:31:31', 1399985191002447872, '2021-09-07 15:31:31', 5, 0); +INSERT INTO `iam_perm_menu` VALUES (1435476255797624832, 'admin', 1452567897717321728, '操作日志', 'OperateLog', '', NULL, '', b'0', b'0', 'starter/log/OperateLogList', NULL, '/system/log/OperateLog', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-08 13:33:04', 1399985191002447872, '2021-09-08 13:33:04', 7, 0); +INSERT INTO `iam_perm_menu` VALUES (1438061887002759168, 'admin', NULL, '通知管理', 'notice', '', NULL, 'message', b'0', b'0', 'RouteView', NULL, '/notice', '', 0, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-15 16:47:26', 1399985191002447872, '2021-09-15 16:47:26', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1438072357281542144, 'admin', 1438061887002759168, '邮件配置', 'MailConfig', '', NULL, '', b'0', b'0', 'notice/mail/MailConfigList', NULL, '/notice/mailConfig', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-15 17:29:03', 1399985191002447872, '2021-09-15 17:29:03', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1439196893514031104, 'admin', 1438061887002759168, '消息模板', 'MessageTemplate', '', NULL, '', b'0', b'0', 'notice/template/TemplateList', NULL, '/notice/template', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-18 19:57:33', 1399985191002447872, '2021-09-18 19:57:33', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1440216178722050048, 'admin', 1438061887002759168, '钉钉', 'DingTalk', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/notice/dingTalk', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-21 15:27:50', 1399985191002447872, '2021-09-21 15:27:50', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1440216612211757056, 'admin', 1440216178722050048, '钉钉机器人', 'DingTalkRobot', '', NULL, '', b'0', b'0', 'notice/dingTalk/robot/DingRobotConfigList', NULL, '/notice/dingTalk/robot', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-09-21 15:29:33', 1399985191002447872, '2021-09-21 15:29:33', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1450473063320526848, 'admin', 1452569691537256448, '第三方登录', 'Social', '', NULL, '', b'0', b'0', 'system/social/SocialList', NULL, '/system/userAuth/social', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-19 22:45:01', 1399985191002447872, '2021-10-19 22:45:01', 4, 0); +INSERT INTO `iam_perm_menu` VALUES (1450803906215886848, 'admin', 1452571269199540224, '定时任务', 'QuartzJobList', '', NULL, '', b'0', b'0', 'starter/quartz/QuartzJobList', NULL, '/system/config/quartz', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 20:39:41', 1399985191002447872, '2021-10-20 20:39:41', 5, 0); +INSERT INTO `iam_perm_menu` VALUES (1450819607680991232, 'admin', NULL, '第三方对接', 'social', '', b'0', 'branches', b'0', b'0', 'RouteView', NULL, '/social', '', 0, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:42:04', 1399985191002447872, '2022-04-05 16:53:25', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1450821723027881984, 'admin', 1450819607680991232, '微信', 'SocialWeChat', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/social/wechat', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:50:28', 1399985191002447872, '2021-10-20 21:50:28', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1450821877831254016, 'admin', 1450819607680991232, '企业微信', 'SocialWeCom', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/social/wecom', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:51:05', 1399985191002447872, '2021-10-20 21:51:05', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450822511087271936, 'admin', 1450819607680991232, '钉钉', 'SocialDingTalk', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/social/dingtalk', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:53:36', 1399985191002447872, '2021-10-20 21:53:36', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1450822842995130368, 'admin', NULL, '支付管理', 'PayManager', '', NULL, 'pay-circle', b'0', b'0', 'RouteView', NULL, '/payment', '', 0, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:54:55', 1399985191002447872, '2021-10-20 21:54:55', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450823960236081152, 'admin', 1450822842995130368, '支付通道', 'PayChannel', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/payment/channel', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:59:22', 1399985191002447872, '2021-10-20 21:59:22', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450824117849636864, 'admin', 1450823960236081152, '支付宝', 'AliPayConfig', '', NULL, '', b'0', b'0', 'payment/channel/alipay/AliPayConfigList', NULL, '/payment/channel/alipay', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 21:59:59', 1399985191002447872, '2021-10-20 21:59:59', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1450824319868289024, 'admin', 1450823960236081152, '微信支付', 'WeChatPayConfig', '', NULL, '', b'0', b'0', 'payment/channel/wechat/WeChatConfigList', NULL, '/payment/channel/wechat', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:00:48', 1399985191002447872, '2021-10-20 22:00:48', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1450824637876224000, 'admin', 1450823960236081152, '云闪付', 'UnionPayConfig', '', b'0', '', b'0', b'0', 'payment/channel/unionpay/UnionPayConfigList', NULL, '/payment/channel/unionpay', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:02:03', 1399985191002447872, '2022-03-04 16:12:13', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1450824875198332928, 'admin', 1450823960236081152, '现金支付', 'CashPayConfig', '', b'0', '', b'1', b'0', '', NULL, '/payment/channel/cash', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:03:00', 1399985191002447872, '2022-03-04 16:12:08', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1450825488577544192, 'admin', 1450822842995130368, '收银台', 'PayCashier', '', NULL, '', b'0', b'0', 'payment/cashier/Cashier', NULL, '/payment/cashier', '', -1, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:05:26', 1399985191002447872, '2021-10-20 22:05:26', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450825615857893376, 'admin', 1450822842995130368, '订单管理', 'PayOrder', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/payment/order', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:05:57', 1399985191002447872, '2021-10-20 22:05:57', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450825819436826624, 'admin', 1450822842995130368, '回调记录', 'PayNotify', '', NULL, '', b'0', b'0', 'payment/notify/PayNotifyRecordList', NULL, '/payment/notify', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:06:45', 1399985191002447872, '2021-10-20 22:06:45', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1450826890318135296, 'admin', 1450825615857893376, '支付订单', 'PaymentOrder', '', b'0', '', b'0', b'0', 'payment/order/payment/PaymentList', NULL, '/payment/order/payment', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:11:00', 1399985191002447872, '2022-02-25 15:17:07', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450827159626006528, 'admin', 1450825615857893376, '退款订单', 'ReturnOrder', '', b'0', '', b'0', b'0', 'payment/order/refund/RefundRecordList', NULL, '/payment/order/return', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:12:05', 1399985191002447872, '2022-03-04 15:44:06', 4, 0); +INSERT INTO `iam_perm_menu` VALUES (1450827308515409920, 'admin', 1450825615857893376, '转账订单', 'TransferOrder', '', b'0', '', b'1', b'0', 'payment/order/transfer/TransferList', NULL, '/payment/order/transfer', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:12:40', 1399985191002447872, '2022-03-04 15:33:31', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1450827660459458560, 'admin', 1438061887002759168, '微信', 'NoticeWeChat', '', b'0', '', b'0', b'0', 'Dev', NULL, '/notice/wechat', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:14:04', 1399985191002447872, '2022-06-21 20:53:04', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1452567897717321728, 'admin', 1414596052497092608, '审计日志', 'auditLog', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/system/log', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-25 17:29:09', 1399985191002447872, '2021-10-25 17:29:09', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1452569339987472384, 'admin', 1414596052497092608, '权限管理', 'permission', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/system/permission', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-25 17:34:53', 1399985191002447872, '2021-10-25 17:34:53', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1452569691537256448, 'admin', 1414596052497092608, '用户信息', 'userAuth', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/system/userAuth', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-25 17:36:17', 1399985191002447872, '2021-10-25 17:36:17', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1452571269199540224, 'admin', 1414596052497092608, '系统配置', 'systemConfig', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/system/config', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-25 17:42:33', 1399985191002447872, '2021-10-25 17:42:33', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1452638905302966272, 'admin', 1452571269199540224, '系统参数', 'SystemParam', '', NULL, '', b'0', b'0', 'system/param/SystemParamList', NULL, '/system/config/param', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-25 22:11:18', 1399985191002447872, '2021-10-25 22:11:18', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1474694545336676352, 'admin', 1452569339987472384, '数据范围权限', 'DataScope', '', NULL, '', b'0', b'0', 'system/scope/DataScopeList', NULL, '/system/permission/data', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-12-25 18:52:33', 1399985191002447872, '2021-12-25 18:52:33', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1476489893513404416, 'admin', 1414596052497092608, '22', NULL, '22', b'1', NULL, b'0', b'0', NULL, NULL, NULL, NULL, 0, 2, NULL, b'0', b'0', b'0', b'0', '', 1399985191002447872, '2021-12-30 17:46:37', 1399985191002447872, '2021-12-30 17:46:37', 4, 1); +INSERT INTO `iam_perm_menu` VALUES (1478002945936015360, 'admin', 1414596052497092608, '1', NULL, '1', b'1', NULL, b'0', b'0', NULL, NULL, NULL, NULL, 0, 2, NULL, b'0', b'0', b'0', b'0', '', 1399985191002447872, '2022-01-03 21:58:57', 1399985191002447872, '2022-01-03 21:58:57', 0, 1); +INSERT INTO `iam_perm_menu` VALUES (1478004271512240128, 'admin', 1414596052497092608, '22', NULL, '22', b'1', NULL, b'0', b'0', NULL, NULL, NULL, NULL, 0, 2, NULL, b'0', b'0', b'0', b'0', '', 1399985191002447872, '2022-01-03 22:04:13', 1399985191002447872, '2022-01-03 22:04:13', 0, 1); +INSERT INTO `iam_perm_menu` VALUES (1480839877352476672, 'admin', 1452567897717321728, '数据版本日志', 'DataVersionLog', NULL, b'0', '', b'0', b'0', 'starter/log/DataVersionLogList', NULL, '/system/log/DataVersionLog', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-01-11 17:51:54', 1399985191002447872, '2022-01-11 17:51:54', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1490984296616263680, 'admin', 1452571269199540224, '文件管理', 'FIleUpLoad', NULL, b'0', '', b'0', b'0', 'starter/file/FileUploadList', NULL, '/system/config/file', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-02-08 17:42:12', 1399985191002447872, '2022-02-08 17:42:12', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1495013564652429312, 'admin', 1452571269199540224, '代码生成', 'CodeGen', NULL, b'0', '', b'0', b'0', 'starter/codegen/CodeGenList', NULL, '/system/config/codeGen', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-02-19 20:33:04', 1399985191002447872, '2022-02-19 20:33:05', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1495968302034210816, 'admin', NULL, '功能演示', 'Demo', NULL, b'0', 'block', b'0', b'0', 'RouteView', NULL, '/demo', '', 99, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-02-22 11:46:52', 1399985191002447872, '2022-05-10 11:02:05', 3, 0); +INSERT INTO `iam_perm_menu` VALUES (1495969099987963904, 'admin', 1495968302034210816, '数据相关', 'DemoData', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/demo/data', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-02-22 11:50:02', 1399985191002447872, '2022-03-24 16:27:46', 4, 0); +INSERT INTO `iam_perm_menu` VALUES (1496020308992143360, 'admin', 1495968302034210816, '超级查询', 'SuperQueryDemo', NULL, b'0', '', b'0', b'0', 'demo/query/SuperQueryDemoList', NULL, '/demo/query/super', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-02-22 15:13:31', 1399985191002447872, '2022-05-27 17:34:41', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1501740492360962048, 'admin', 1450822842995130368, '钱包管理', 'Wallet', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/payment/wallet', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 10:03:29', 1399985191002447872, '2022-03-10 10:04:53', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1501742229142556672, 'admin', 1501740492360962048, '钱包列表', 'WalletList', NULL, b'0', '', b'0', b'0', 'payment/wallet/list/WalletList', NULL, '/payment/wallet/list', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 10:10:23', 1399985191002447872, '2022-03-10 17:06:19', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1501742417378725888, 'admin', 1501740492360962048, '个人钱包', 'PersonalWallet', NULL, b'0', '', b'0', b'0', 'payment/wallet/list/WalletList', NULL, '/payment/wallet/personal', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 10:11:08', 1399985191002447872, '2022-03-10 17:06:10', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1501847310319972352, 'admin', 1450822842995130368, '组合支付', 'CombinationCashier', NULL, b'0', '', b'0', b'0', 'payment/combination/CombinationCashier', NULL, '/payment/combination', '', -0.5, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 17:07:56', 1399985191002447872, '2022-03-10 17:09:28', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1502926397176242176, 'admin', 1450822842995130368, '储值卡', 'Voucher', NULL, b'0', '', b'0', b'0', 'payment/voucher/VoucherList', NULL, '/payment/voucher', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-13 16:35:51', 1399985191002447872, '2022-03-14 19:39:45', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1506910599819165696, 'admin', 1495969099987963904, '数据权限', 'DataPermDemoList', NULL, b'0', '', b'0', b'0', 'demo/data/perm/DataPermDemoList', NULL, '/demo/data/perm', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-24 16:27:39', 1399985191002447872, '2022-03-24 16:28:56', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1506910885463851008, 'admin', 1495969099987963904, '加密解密', 'DataEncryptDemo', NULL, b'0', '', b'0', b'0', 'demo/data/encrypt/DataEncryptDemoList', NULL, '/demo/data/encrypt', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-24 16:28:47', 1399985191002447872, '2022-03-24 16:28:47', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1506911113394913280, 'admin', 1495969099987963904, '数据脱敏', 'DataSensitiveDemo', NULL, b'0', '', b'0', b'0', 'demo/data/sensitive/DataSensitiveDemoList', NULL, '/demo/data/sensitive', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-24 16:29:41', 1399985191002447872, '2022-03-24 17:16:03', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1507998458886197248, 'admin', 1495968302034210816, 'WS演示', 'WebsocketDemo', NULL, b'0', '', b'0', b'0', 'demo/ws/WebsocketDemo', NULL, '/demo/ws', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-27 16:30:25', 1399985191002447872, '2022-03-27 16:30:25', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1509488473583562752, 'admin', 1495968302034210816, '幂等请求演示', 'IdempotentDemo', NULL, b'0', '', b'0', b'0', 'demo/idempotent/Idempotent', NULL, '/demo/idempotent', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-31 19:11:12', 1399985191002447872, '2022-05-27 17:35:00', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1511266086400524288, 'admin', 1450822511087271936, '钉钉配置', 'DingTalkConfig', NULL, b'0', '', b'0', b'0', 'social/dingtalk/config/DingTalkConfigList', NULL, '/social/dingtalk/config', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-04-05 16:54:48', 1399985191002447872, '2022-04-05 16:54:48', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1523860792695283712, 'admin', NULL, '商品管理', 'GoodsManager', NULL, b'0', 'car', b'0', b'0', 'RouteView', NULL, '/goods', '', 0, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-10 11:01:40', 1399985191002447872, '2022-05-10 11:02:45', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1523941932282114048, 'admin', 1523860792695283712, '类目管理', 'CategoryManager', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/goods/category', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-10 16:24:05', 1399985191002447872, '2022-05-10 16:24:17', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1523942130555252736, 'admin', 1523941932282114048, '类目', 'Category', NULL, b'0', '', b'0', b'0', 'goods/category/CategoryList', NULL, '/goods/category/category', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-10 16:24:52', 1399985191002447872, '2022-05-10 16:25:23', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1524044195818278912, 'admin', 1523941932282114048, '品牌', 'Brand', NULL, b'0', '', b'0', b'0', 'goods/brand/BrandList', NULL, '/goods/category/brand', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-10 23:10:26', 1399985191002447872, '2022-05-10 23:14:20', 4, 0); +INSERT INTO `iam_perm_menu` VALUES (1524044395823665152, 'admin', 1523941932282114048, '规格', 'SpecificationList', NULL, b'0', '', b'0', b'0', 'goods/spec/SpecificationList', NULL, '/goods/category/spec', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-10 23:11:14', 1399985191002447872, '2022-05-10 23:13:51', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1524044678314233856, 'admin', 1523941932282114048, '参数组', 'ParameterGroup', NULL, b'0', '', b'1', b'0', 'goods/parameter/ParameterGroupList', NULL, '/goods/category/parameter', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-10 23:12:21', 1399985191002447872, '2022-05-12 20:30:23', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1525472571967860736, 'admin', 1523860792695283712, '商品', 'Goods', '', b'0', '', b'0', b'0', 'goods/goods/GoodsList', NULL, '/goods/goods', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-14 21:46:18', 1399985191002447872, '2022-05-14 21:46:18', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1530120084482084864, 'admin', 1495968302034210816, '消息中间件演示', 'MQDemo', NULL, b'0', '', b'0', b'0', 'demo/mq/MqDemo', NULL, '/demo/mq', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-27 17:33:51', 1399985191002447872, '2022-05-31 15:12:15', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1530120684645044224, 'admin', 1530120084482084864, 'MQTT消息', 'MqttDemo', NULL, b'0', '', b'0', b'0', '', NULL, '/demo/mq/mqtt', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-27 17:36:14', 1399985191002447872, '2022-05-27 17:36:14', 0, 1); +INSERT INTO `iam_perm_menu` VALUES (1530120821144473600, 'admin', 1530120084482084864, 'RabbitMQ', 'RabbitDemo', NULL, b'0', '', b'0', b'0', '', NULL, '/demo/mq/rabbit', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-05-27 17:36:47', 1399985191002447872, '2022-05-27 17:36:47', 0, 1); +INSERT INTO `iam_perm_menu` VALUES (1534000136370204672, 'admin', 1431152689832525824, 'ELK日志', 'ELK', '', b'0', '', b'0', b'0', '', NULL, 'http://elk.dev.bootx.cn:5601/app/discover', '', 0, 1, NULL, b'1', b'1', b'0', b'0', NULL, 1399985191002447872, '2022-06-07 10:31:48', 1399985191002447872, '2022-06-07 10:31:48', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1534008203006652416, 'admin', 1431152689832525824, 'PlumeLog日志', 'PlumeLog', '', b'0', '', b'0', b'0', '', NULL, 'http://127.0.0.1:9999/plumelog/#/', '', 0, 1, NULL, b'1', b'1', b'0', b'0', NULL, 1399985191002447872, '2022-06-07 11:03:51', 1399985191002447872, '2022-06-07 11:06:13', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1535451167008436224, 'admin', 1431152689832525824, '系统信息', 'SysInfo', NULL, b'0', '', b'0', b'0', 'starter/monitor/SystemInfoMonitor', NULL, '/monitor/sysinfo', '', 0, 1, NULL, b'0', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-11 10:37:40', 1399985191002447872, '2022-06-13 13:07:46', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1535965936371085312, 'admin', 1431152689832525824, 'Redis监控', 'RedisInfoMonitor', NULL, b'0', '', b'0', b'0', 'starter/monitor/RedisInfoMonitor', NULL, '/monitor/redis', '', 0, 1, NULL, b'0', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-12 20:43:11', 1399985191002447872, '2022-06-13 13:07:38', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1537730140522348544, 'admin', 1438061887002759168, '站内信', 'SiteMessage', '', b'0', '', b'0', b'0', 'notice/site/SiteMessage', NULL, '/notice/siteMessage', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:33:30', 1399985191002447872, '2022-06-17 17:33:30', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1537732440632524800, 'admin', NULL, '个人办公', 'person', '', b'0', 'user', b'0', b'0', 'RouteView', NULL, '/person', '', -99, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:42:38', 1399985191002447872, '2022-06-17 17:45:24', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1537733801860333568, 'admin', 1537732440632524800, '我的消息', 'PersonSiteMessage', NULL, b'0', '', b'0', b'0', 'Dev', NULL, '/person/siteMessage', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:48:03', 1399985191002447872, '2022-06-21 20:52:50', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1537735851818024960, 'admin', 1537732440632524800, '待办任务', 'PersonTaskList', NULL, b'0', '', b'0', b'0', 'Dev', NULL, '/person/taskList', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:56:11', 1399985191002447872, '2022-06-21 20:52:42', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1538160478872625152, 'admin', 1495968302034210816, '富文本编辑', 'WangEditorDemo', NULL, b'0', '', b'0', b'0', 'demo/wangeditor/WangEditorDemo', NULL, '/demo/wangEditor', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-18 22:03:30', 1399985191002447872, '2022-06-18 22:03:31', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1541355214204030976, 'admin', 1541427353886859264, '认证应用', 'AuthApplication', '', b'0', '', b'0', b'0', 'system/client/ApplicationList', NULL, '/system/config/application', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:37:08', 1399985191002447872, '2022-06-27 22:25:37', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1541427353886859264, 'admin', 1414596052497092608, '认证管理', 'Auth', '', b'0', '', b'0', b'0', 'RouteView', NULL, '/system/auth', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-27 22:24:54', 1399985191002447872, '2022-06-27 22:24:54', 0, 0); + +-- ---------------------------- +-- Table structure for iam_perm_path +-- ---------------------------- +DROP TABLE IF EXISTS `iam_perm_path`; +CREATE TABLE `iam_perm_path` ( + `id` bigint(20) NOT NULL, + `code` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限标识', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限名称', + `request_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求类型', + `path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求路径', + `group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分组名称', + `enable` bit(1) NOT NULL COMMENT '启用状态', + `generate` bit(1) NOT NULL COMMENT '是否通过系统生成的权限', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + `version` int(11) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '权限_请求' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_perm_path +-- ---------------------------- + +-- ---------------------------- +-- Table structure for iam_role +-- ---------------------------- +DROP TABLE IF EXISTS `iam_role`; +CREATE TABLE `iam_role` ( + `id` bigint(20) NOT NULL COMMENT '角色ID', + `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '编码', + `name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称', + `internal` bit(1) NOT NULL COMMENT '是否系统内置', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '说明', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_role +-- ---------------------------- +INSERT INTO `iam_role` VALUES (1405414804771971072, 'admin', '管理员', b'1', '管理员', 1, '2021-06-17 14:39:35', 1399985191002447872, '2021-07-18 22:31:02', 6, 0); +INSERT INTO `iam_role` VALUES (1416730722714144768, 'test', '测试', b'0', '测试角色', 1399985191002447872, '2021-07-18 20:05:01', 1399985191002447872, '2021-07-18 20:16:15', 1, 0); +INSERT INTO `iam_role` VALUES (1422832797731778562, 'user', '用户', b'0', '用户角色', 0, '2021-08-04 16:12:29', 1399985191002447872, '2021-08-04 16:15:03', 7, 1); +INSERT INTO `iam_role` VALUES (1428891259564445696, 'manager', '管理者', b'0', 'manager管理者', 1399985191002447872, '2021-08-21 09:26:38', 1399985191002447872, '2021-08-21 09:26:39', 0, 1); + +-- ---------------------------- +-- Table structure for iam_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `iam_role_menu`; +CREATE TABLE `iam_role_menu` ( + `id` bigint(20) NOT NULL, + `role_id` bigint(20) NOT NULL COMMENT '角色id', + `app_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '应用code', + `permission_id` bigint(20) NOT NULL COMMENT '菜单权限id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色菜单权限表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_role_menu +-- ---------------------------- + +-- ---------------------------- +-- Table structure for iam_role_path +-- ---------------------------- +DROP TABLE IF EXISTS `iam_role_path`; +CREATE TABLE `iam_role_path` ( + `id` bigint(20) NOT NULL, + `role_id` bigint(20) NOT NULL COMMENT '角色id', + `permission_id` bigint(20) NOT NULL COMMENT '请求权限id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色请求权限表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_role_path +-- ---------------------------- + +-- ---------------------------- +-- Table structure for iam_user_data_scope +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_data_scope`; +CREATE TABLE `iam_user_data_scope` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `data_scope_id` bigint(20) NOT NULL COMMENT '数据权限ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户数据范围关系\r\n' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_data_scope +-- ---------------------------- +INSERT INTO `iam_user_data_scope` VALUES (1477617820165345280, 1414143554414059520, 1474717084985270272); +INSERT INTO `iam_user_data_scope` VALUES (1477991040840290304, 1477990832987361280, 1477990439800721408); +INSERT INTO `iam_user_data_scope` VALUES (1477997504506077184, 1477997391729631232, 1477990268903804928); +INSERT INTO `iam_user_data_scope` VALUES (1477997685993611264, 1477997602862505984, 1474706893178871808); + +-- ---------------------------- +-- Table structure for iam_user_dept +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_dept`; +CREATE TABLE `iam_user_dept` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL COMMENT '用户id', + `dept_id` bigint(20) NOT NULL COMMENT '部门id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户部门关联表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_dept +-- ---------------------------- +INSERT INTO `iam_user_dept` VALUES (1450088892861501440, 1399985191002447872, 1259383345604300802); +INSERT INTO `iam_user_dept` VALUES (1477996765012533248, 1477990832987361280, 1477977592291053568); +INSERT INTO `iam_user_dept` VALUES (1477997463997489152, 1477997391729631232, 1477978610865197056); +INSERT INTO `iam_user_dept` VALUES (1477997655618461696, 1477997602862505984, 1477978610865197056); +INSERT INTO `iam_user_dept` VALUES (1478741775446118400, 1435967884114194432, 1477978810526650368); +INSERT INTO `iam_user_dept` VALUES (1478741775450312704, 1435967884114194432, 1477978464559484928); +INSERT INTO `iam_user_dept` VALUES (1478741775450312705, 1435967884114194432, 1477978610865197056); + +-- ---------------------------- +-- Table structure for iam_user_expand_info +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_expand_info`; +CREATE TABLE `iam_user_expand_info` ( + `id` bigint(20) NOT NULL, + `sex` int(4) NULL DEFAULT NULL COMMENT '性别', + `birthday` date NULL DEFAULT NULL COMMENT '生日', + `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像', + `last_login_time` datetime(0) NULL DEFAULT NULL COMMENT '上次登录时间', + `current_login_time` datetime(0) NULL DEFAULT NULL COMMENT '本次登录时间', + `initial_password` bit(1) NOT NULL COMMENT '是否初始密码', + `last_change_password_time` datetime(0) NULL DEFAULT NULL COMMENT '上次修改密码时间', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户扩展信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_expand_info +-- ---------------------------- +INSERT INTO `iam_user_expand_info` VALUES (1399985191002447872, 1, '1996-12-01', '1495331905770315776', '2022-07-02 16:26:31', '2022-07-02 17:21:14', b'0', '2022-06-19 21:25:00', 1, '2021-06-02 15:04:15', 0, '2022-07-02 17:21:14', 253, 0); +INSERT INTO `iam_user_expand_info` VALUES (1414143554414059520, 1, NULL, '1530065639127871488', NULL, '2022-05-27 13:56:02', b'0', NULL, 1, '2021-07-11 16:44:32', 1414143554414059520, '2022-05-27 13:57:32', 2, 0); +INSERT INTO `iam_user_expand_info` VALUES (1435894470432456704, 1, NULL, NULL, NULL, NULL, b'0', '2022-06-29 00:39:23', 1399985191002447872, '2021-09-09 17:14:54', 0, '2022-06-29 00:39:23', 2, 0); +INSERT INTO `iam_user_expand_info` VALUES (1435967884114194432, 1, NULL, NULL, NULL, '2022-05-31 15:59:42', b'0', NULL, 1414143554414059520, '2021-09-09 22:06:37', 0, '2022-05-31 15:59:42', 1, 0); +INSERT INTO `iam_user_expand_info` VALUES (1477990832987361280, 1, NULL, NULL, NULL, NULL, b'0', NULL, 1399985191002447872, '2022-01-03 21:10:49', 1399985191002447872, '2022-01-03 21:10:49', 0, 0); +INSERT INTO `iam_user_expand_info` VALUES (1477997391729631232, 1, NULL, NULL, NULL, NULL, b'0', NULL, 1399985191002447872, '2022-01-03 21:36:53', 1399985191002447872, '2022-01-03 21:36:53', 0, 0); +INSERT INTO `iam_user_expand_info` VALUES (1477997602862505984, 1, NULL, NULL, NULL, '2022-06-01 16:51:46', b'0', NULL, 1399985191002447872, '2022-01-03 21:37:43', 0, '2022-06-01 16:51:46', 1, 0); + +-- ---------------------------- +-- Table structure for iam_user_info +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_info`; +CREATE TABLE `iam_user_info` ( + `id` bigint(20) NOT NULL, + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称', + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '账号', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码', + `phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机号', + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱', + `app_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '关联应用ds', + `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像', + `source` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '注册来源', + `admin` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否超级管理员', + `register_time` datetime(0) NULL DEFAULT NULL COMMENT '注册时间', + `status` tinyint(4) NOT NULL COMMENT '账号状态', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_info +-- ---------------------------- +INSERT INTO `iam_user_info` VALUES (1399985191002447872, '小小明', 'xxm', 'f52020dca765fd3943ed40a615dc2c5c', '13333333333', 'xxm1995@outlook.com', '1430430071299207168,1430430071299207169', NULL, NULL, b'1', '2021-06-02 15:04:12', 1, 1, '2021-06-02 15:04:15', 1399985191002447872, '2022-06-27 23:09:31', 50, 0); +INSERT INTO `iam_user_info` VALUES (1414143554414059520, '小小明1995', 'xxm1995', 'f52020dca765fd3943ed40a615dc2c5c', '13000000000', 'xxm1995@foxmail.com', NULL, NULL, NULL, b'1', '2021-07-11 16:44:31', 1, 1, '2021-07-11 16:44:32', 1414143554414059520, '2022-05-27 13:57:33', 3, 0); +INSERT INTO `iam_user_info` VALUES (1435894470432456704, '管理员', 'admin', 'c80a93d89e6590e8909a1a9f842b1615', '13000001111', 'admin@qq.com', '1430430071299207168', '', NULL, b'0', '2021-09-09 17:14:52', 1, 1399985191002447872, '2021-09-09 17:14:54', 0, '2022-06-29 00:39:23', 6, 0); +INSERT INTO `iam_user_info` VALUES (1435967884114194432, '测试', 'test', 'f52020dca765fd3943ed40a615dc2c5c', '13311111111', 'test@qq.com', '1430430071299207168', '', NULL, b'0', '2021-09-09 22:06:37', 1, 1414143554414059520, '2021-09-09 22:06:37', 1399985191002447872, '2022-05-31 15:59:37', 9, 0); +INSERT INTO `iam_user_info` VALUES (1477990832987361280, '测试用户001', 'test001', 'f52020dca765fd3943ed40a615dc2c5c', '', '', '1430430071299207168', '', NULL, b'0', '2022-01-03 21:10:49', 1, 1399985191002447872, '2022-01-03 21:10:49', 1399985191002447872, '2022-06-05 20:26:26', 1, 0); +INSERT INTO `iam_user_info` VALUES (1477997391729631232, '测试用户002', 'test002', 'f52020dca765fd3943ed40a615dc2c5c', '', '', '1430430071299207168', '', NULL, b'0', '2022-01-03 21:36:53', 1, 1399985191002447872, '2022-01-03 21:36:53', 1399985191002447872, '2022-06-05 20:26:19', 1, 0); +INSERT INTO `iam_user_info` VALUES (1477997602862505984, '测试用户003', 'test003', 'f52020dca765fd3943ed40a615dc2c5c', '', '', '1430430071299207168', '', NULL, b'0', '2022-01-03 21:37:43', 1, 1399985191002447872, '2022-01-03 21:37:43', 1399985191002447872, '2022-05-19 13:00:05', 4, 0); + +-- ---------------------------- +-- Table structure for iam_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_role`; +CREATE TABLE `iam_user_role` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户角色关系\r\n' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_role +-- ---------------------------- +INSERT INTO `iam_user_role` VALUES (1533038443724980224, 1435894470432456704, 1405414804771971072); + +-- ---------------------------- +-- Table structure for iam_user_social +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_social`; +CREATE TABLE `iam_user_social` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `we_chat_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信openId', + `qq_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'qqId', + `weibo_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微博Id', + `gitee_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '码云唯一标识', + `ding_talk_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '钉钉唯一标识', + `we_com_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '企业微信唯一标识', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE, + INDEX `pk_user_index`(`user_id`) USING BTREE COMMENT '用户id索引' +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户三方登录绑定' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_social +-- ---------------------------- +INSERT INTO `iam_user_social` VALUES (1399985191002447872, 1399985191002447872, NULL, NULL, NULL, NULL, NULL, NULL, 0, '2022-06-29 18:44:34', 1399985191002447872, '2022-07-02 14:50:16', 4, 0); + +-- ---------------------------- +-- Table structure for iam_user_social_info +-- ---------------------------- +DROP TABLE IF EXISTS `iam_user_social_info`; +CREATE TABLE `iam_user_social_info` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `user_id` bigint(20) NOT NULL COMMENT '用户id', + `client_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '第三方终端类型', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户名', + `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户昵称', + `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户头像', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE, + INDEX `pk_user_client`(`user_id`, `client_code`) USING BTREE COMMENT '用户id和终端code' +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户三方登录绑定详情' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_user_social_info +-- ---------------------------- + +-- ---------------------------- +-- Table structure for notice_mail_config +-- ---------------------------- +DROP TABLE IF EXISTS `notice_mail_config`; +CREATE TABLE `notice_mail_config` ( + `id` bigint(20) NOT NULL, + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '编号', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称', + `host` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮箱服务器host', + `port` int(5) NOT NULL COMMENT '邮箱服务器 port', + `username` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮箱服务器 username', + `password` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮箱服务器 password', + `sender` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱服务器 sender', + `from_` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱服务器 from', + `activity` tinyint(1) NULL DEFAULT 0 COMMENT '是否默认配置,0:否。1:是', + `security_type` int(2) NULL DEFAULT NULL COMMENT '安全传输方式 1:plain 2:tls 3:ssl', + `creator` bigint(18) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(18) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + `version` int(8) NULL DEFAULT NULL COMMENT '版本', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of notice_mail_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for notice_message_template +-- ---------------------------- +DROP TABLE IF EXISTS `notice_message_template`; +CREATE TABLE `notice_message_template` ( + `id` bigint(20) NOT NULL, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '模板数据', + `type` int(11) NULL DEFAULT NULL COMMENT '模板类型', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '消息模板' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of notice_message_template +-- ---------------------------- +INSERT INTO `notice_message_template` VALUES (1424936204932169730, 'cs', '测试', 'hello ${msg}6666666666666666666666666666', 1, '测试模板', 0, '2021-08-10 11:30:40', 0, '2021-08-10 11:30:40', 0, 0); + +-- ---------------------------- +-- Table structure for notice_site_message +-- ---------------------------- +DROP TABLE IF EXISTS `notice_site_message`; +CREATE TABLE `notice_site_message` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消息标题', + `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '消息内容', + `sender_id` bigint(20) NULL DEFAULT NULL COMMENT '发送者id', + `sender_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发送者姓名', + `receive_id` bigint(20) NULL DEFAULT NULL COMMENT '接收者id', + `receive_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '接收者姓名', + `sender_time` datetime(0) NULL DEFAULT NULL COMMENT '发送时间', + `have_read` bit(1) NULL DEFAULT NULL COMMENT '是否已读', + `read_time` datetime(0) NULL DEFAULT NULL COMMENT '已读时间', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '站内信' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of notice_site_message +-- ---------------------------- +INSERT INTO `notice_site_message` VALUES (1424212599079161857, '测试消息', '测试测试测试', 1399985191002447872, '小小明', 1414143554414059520, 'xxm', '2021-08-08 11:34:11', b'0', NULL, 1399985191002447872, '2021-08-08 11:35:19', 1399985191002447872, '2021-08-08 11:35:19', 0, 0); + +-- ---------------------------- +-- Table structure for notice_sms_config +-- ---------------------------- +DROP TABLE IF EXISTS `notice_sms_config`; +CREATE TABLE `notice_sms_config` ( + `id` bigint(18) NOT NULL, + `tid` bigint(18) NOT NULL COMMENT '租户id', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `account_sid` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `path_sid` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送号码的唯一标识(基于twillio的命名风格)', + `auth_token` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `from_num` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `is_default` tinyint(1) NULL DEFAULT 0 COMMENT '是否默认配置,0:否。1:是', + `creator` bigint(18) NULL DEFAULT NULL, + `create_time` datetime(0) NULL DEFAULT NULL, + `last_modifier` bigint(18) NULL DEFAULT NULL, + `last_modified_time` datetime(0) NULL DEFAULT NULL, + `version` int(10) NULL DEFAULT NULL, + `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + `secret` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `isp` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `reply_msg` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of notice_sms_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for notice_wechat_config +-- ---------------------------- +DROP TABLE IF EXISTS `notice_wechat_config`; +CREATE TABLE `notice_wechat_config` ( + `id` bigint(18) NOT NULL, + `tid` bigint(18) NOT NULL COMMENT '租户id', + `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `corp_id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `corp_secret` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `is_default` tinyint(1) NULL DEFAULT 0 COMMENT '是否默认配置,0:否。1:是', + `creator` bigint(18) NULL DEFAULT NULL, + `create_time` datetime(0) NULL DEFAULT NULL, + `last_modifier` bigint(18) NULL DEFAULT NULL, + `last_modified_time` datetime(0) NULL DEFAULT NULL, + `version` int(10) NULL DEFAULT NULL, + `deleted` tinyint(1) NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '微信消息配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of notice_wechat_config +-- ---------------------------- +INSERT INTO `notice_wechat_config` VALUES (181361815405135421, 0, 'test01', 'test01', 'ww9d6247559117d202', '8n6A3SzN-DJNkw8wyCcJnr8-SOjFFWSOlBqZN8vypKM', 1, 1415, '2018-11-20 11:07:07', 1415, '2018-11-20 11:07:07', 0, 0); + +-- ---------------------------- +-- Table structure for order_order +-- ---------------------------- +DROP TABLE IF EXISTS `order_order`; +CREATE TABLE `order_order` ( + `id` bigint(20) NOT NULL, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码', + `contact_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', + `contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', + `contact_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系邮箱', + `channel_id` bigint(20) NULL DEFAULT NULL COMMENT '渠道', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '购买用户id', + `status` int(11) NOT NULL COMMENT '状态', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `type` int(11) NULL DEFAULT NULL COMMENT '类型', + `total_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '总金额', + `pay_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '实付金额', + `coupon_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所用优惠券ids', + `address_info` json NULL COMMENT '地址参数', + `invoice_info` json NULL COMMENT '发票参数', + `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', + `device_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备id', + `source` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源', + `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of order_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_order_billing +-- ---------------------------- +DROP TABLE IF EXISTS `order_order_billing`; +CREATE TABLE `order_order_billing` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `channel_id` bigint(20) NULL DEFAULT NULL COMMENT '渠道id', + `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', + `pay_type` int(11) NOT NULL COMMENT '交易目的', + `transaction_purpose` int(11) NOT NULL COMMENT '交易类型', + `transaction_type` int(11) NOT NULL COMMENT '支付类型', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '金额', + `count` int(11) NULL DEFAULT NULL COMMENT '交易数量', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单账单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of order_order_billing +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_order_detail +-- ---------------------------- +DROP TABLE IF EXISTS `order_order_detail`; +CREATE TABLE `order_order_detail` ( + `id` bigint(20) NOT NULL, + `active_id` bigint(20) NULL DEFAULT NULL COMMENT '活动id', + `shop_id` bigint(20) NULL DEFAULT NULL COMMENT '店铺id', + `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', + `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', + `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品id', + `sku_id` bigint(20) NULL DEFAULT NULL COMMENT '库存id', + `goods_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称', + `goods_price` decimal(19, 2) NULL DEFAULT NULL COMMENT '商品价格', + `num` int(11) NOT NULL COMMENT '数量', + `total_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '总价', + `pay_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '支付价', + `state` int(11) NULL DEFAULT NULL COMMENT '状态', + `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单明细' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of order_order_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_order_item_billing +-- ---------------------------- +DROP TABLE IF EXISTS `order_order_item_billing`; +CREATE TABLE `order_order_item_billing` ( + `id` bigint(20) NOT NULL, + `order_billing_id` bigint(20) NULL DEFAULT NULL COMMENT '账单id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', + `order_item_id` bigint(20) NULL DEFAULT NULL COMMENT '订单项id', + `sku_id` bigint(20) NULL DEFAULT NULL COMMENT '订单项目skuId', + `transaction_purpose` int(11) NOT NULL COMMENT '交易目的', + `transaction_type` int(11) NOT NULL COMMENT '交易类型(名目)', + `pay_type` int(11) NOT NULL COMMENT '支付类型', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '支付金额', + `count` int(11) NULL DEFAULT NULL COMMENT '使用数量', + `bookkeeping_time` bigint(20) NULL DEFAULT NULL COMMENT '入账时间', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NOT NULL, + `business_type` int(11) NULL DEFAULT NULL, + `source_item_billing_id` bigint(20) NULL DEFAULT NULL, + `source_order_item_id` bigint(20) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单明细账单' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of order_order_item_billing +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_order_strategy_mapping +-- ---------------------------- +DROP TABLE IF EXISTS `order_order_strategy_mapping`; +CREATE TABLE `order_order_strategy_mapping` ( + `id` bigint(20) NOT NULL, + `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', + `order_detail_id` bigint(20) NULL DEFAULT NULL COMMENT '明细id', + `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略ID', + `strategy_type` int(11) NULL DEFAULT NULL COMMENT '策略类型(普通/优惠券ID)', + `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册ID', + `price_change` decimal(19, 2) NULL DEFAULT NULL COMMENT '价格变动', + `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注信息', + `coupon_id` bigint(20) NULL DEFAULT NULL, + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单策略映射' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of order_order_strategy_mapping +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_ali_payment +-- ---------------------------- +DROP TABLE IF EXISTS `pay_ali_payment`; +CREATE TABLE `pay_ali_payment` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NULL DEFAULT NULL COMMENT '交易记录ID', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '交易金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款余额', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务id', + `pay_status` int(11) NULL DEFAULT NULL COMMENT '支付状态', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `trade_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付宝关联流水号', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(6) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(6) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NULL DEFAULT NULL COMMENT '版本', + `deleted` bit(1) NOT NULL COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付宝支付记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_ali_payment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_alipay_config +-- ---------------------------- +DROP TABLE IF EXISTS `pay_alipay_config`; +CREATE TABLE `pay_alipay_config` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', + `app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付宝商户appId', + `notify_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务器异步通知页面路径', + `return_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '页面跳转同步通知页面路径', + `server_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求网关地址', + `auth_type` int(4) NOT NULL COMMENT '认证方式', + `sign_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签名类型', + `alipay_public_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付宝公钥', + `private_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '私钥', + `app_cert` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '应用公钥', + `alipay_cert` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付宝公钥证书', + `alipay_root_cert` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付宝CA根证书', + `sandbox` bit(1) NOT NULL COMMENT '是否沙箱环境', + `expire_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '超时配置', + `pay_ways` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支持的支付类型', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `activity` bit(1) NOT NULL COMMENT '是否启用', + `state` int(11) NOT NULL COMMENT '状态', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付宝配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_alipay_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_cash_payment +-- ---------------------------- +DROP TABLE IF EXISTS `pay_cash_payment`; +CREATE TABLE `pay_cash_payment` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NOT NULL COMMENT '支付id', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款金额', + `pay_status` int(11) NULL DEFAULT NULL COMMENT '支付状态', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '现金交易记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_cash_payment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_pay_notify_record +-- ---------------------------- +DROP TABLE IF EXISTS `pay_pay_notify_record`; +CREATE TABLE `pay_pay_notify_record` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NOT NULL COMMENT '支付号', + `notify_info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通知消息', + `pay_channel` int(11) NOT NULL COMMENT '支付通道', + `status` int(2) NOT NULL COMMENT '处理状态', + `msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '提示信息', + `notify_time` datetime(6) NULL DEFAULT NULL COMMENT '回调时间', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付回调记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_pay_notify_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_pay_order_log +-- ---------------------------- +DROP TABLE IF EXISTS `pay_pay_order_log`; +CREATE TABLE `pay_pay_order_log` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NOT NULL COMMENT '支付id', + `business_pay_param` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '订单扩展业务参数', + `pay_order_param` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '订单参数', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付关联订单信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_pay_order_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_payment +-- ---------------------------- +DROP TABLE IF EXISTS `pay_payment`; +CREATE TABLE `pay_payment` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL COMMENT '用户id', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务id', + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `amount` decimal(19, 2) NOT NULL COMMENT '金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款余额', + `pay_status` int(11) NOT NULL COMMENT '支付状态', + `error_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误码', + `error_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误信息', + `pay_type_info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付信息', + `async_pay_mode` bit(1) NOT NULL COMMENT '是否是异步支付', + `async_pay_channel` int(11) NULL DEFAULT NULL COMMENT '异步支付方式', + `pay_channel_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付通道信息列表', + `refundable_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '可退款信息', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `expired_time` datetime(6) NULL DEFAULT NULL COMMENT '过期时间', + `client_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ip', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_payment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_refund_record +-- ---------------------------- +DROP TABLE IF EXISTS `pay_refund_record`; +CREATE TABLE `pay_refund_record` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NOT NULL COMMENT '支付记录id', + `business_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联业务id', + `refund_request_no` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '异步方式关联退款请求号', + `user_id` bigint(20) NOT NULL COMMENT '用户id', + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `amount` decimal(19, 2) NOT NULL COMMENT '金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '剩余可退款金额', + `refundable_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '可退款信息', + `refund_status` int(2) NULL DEFAULT NULL COMMENT '退款状态', + `refund_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `client_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客户ip', + `error_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误码', + `error_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误信息', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '退款记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_refund_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_voucher +-- ---------------------------- +DROP TABLE IF EXISTS `pay_voucher`; +CREATE TABLE `pay_voucher` ( + `id` bigint(20) NOT NULL, + `card_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '卡号', + `batch_no` bigint(20) NULL DEFAULT NULL COMMENT '批次号', + `face_value` decimal(15, 2) NULL DEFAULT NULL COMMENT '面值', + `balance` decimal(15, 2) NULL DEFAULT NULL COMMENT '余额', + `enduring` bit(1) NOT NULL COMMENT '是否长期有效', + `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间', + `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间', + `status` int(2) NOT NULL COMMENT '状态', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '储值卡' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_voucher +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_voucher_log +-- ---------------------------- +DROP TABLE IF EXISTS `pay_voucher_log`; +CREATE TABLE `pay_voucher_log` ( + `id` bigint(20) NOT NULL, + `voucher_id` bigint(20) NOT NULL, + `voucher_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `amount` decimal(19, 2) NULL DEFAULT NULL, + `type` int(5) NOT NULL COMMENT '类型', + `payment_id` bigint(20) NULL DEFAULT NULL COMMENT '交易记录ID', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务ID', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '储值卡日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_voucher_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_voucher_payment +-- ---------------------------- +DROP TABLE IF EXISTS `pay_voucher_payment`; +CREATE TABLE `pay_voucher_payment` ( + `id` bigint(20) NOT NULL, + `voucher_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '储值卡id列表', + `payment_id` bigint(20) NOT NULL COMMENT '支付id', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款金额', + `pay_status` int(11) NULL DEFAULT NULL COMMENT '支付状态', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '储值卡支付记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_voucher_payment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_wallet +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wallet`; +CREATE TABLE `pay_wallet` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL COMMENT '关联用户id', + `balance` decimal(19, 2) NOT NULL COMMENT '余额', + `status` int(11) NOT NULL COMMENT '状态', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE, + INDEX `pk_user_id`(`user_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '钱包' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_wallet +-- ---------------------------- +INSERT INTO `pay_wallet` VALUES (1336489524259352576, 1399985191002447872, 999982.96, 1, NULL, '2022-03-11 21:37:33', 1399985191002447872, '2022-05-03 21:24:04', 29, 0); +INSERT INTO `pay_wallet` VALUES (1502554238582968320, 1414143554414059520, 1019.00, 1, 1399985191002447872, '2022-03-12 15:57:01', 1399985191002447872, '2022-03-13 11:21:10', 2, 0); +INSERT INTO `pay_wallet` VALUES (1502848353136791552, 1435894470432456704, 100.00, 1, 1399985191002447872, '2022-03-13 11:25:44', 1399985191002447872, '2022-03-24 13:22:37', 1, 0); + +-- ---------------------------- +-- Table structure for pay_wallet_log +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wallet_log`; +CREATE TABLE `pay_wallet_log` ( + `id` bigint(20) NOT NULL, + `wallet_id` bigint(20) NOT NULL COMMENT '钱包id', + `user_id` bigint(20) NOT NULL COMMENT '用户id', + `type` int(11) NOT NULL COMMENT '类型', + `payment_id` bigint(20) NULL DEFAULT NULL COMMENT '交易记录ID', + `client_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作终端ip', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务ID', + `operation_source` int(11) NOT NULL COMMENT '操作源', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '金额', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '钱包日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_wallet_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_wallet_payment +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wallet_payment`; +CREATE TABLE `pay_wallet_payment` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NOT NULL COMMENT '交易记录ID', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `wallet_id` bigint(20) NULL DEFAULT NULL COMMENT '钱包ID', + `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '交易金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款金额', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `pay_status` int(11) NOT NULL COMMENT '支付状态', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '钱包交易记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_wallet_payment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_wechat_pay_config +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wechat_pay_config`; +CREATE TABLE `pay_wechat_pay_config` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信应用AppId', + `sl_app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商应用编号', + `api_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 API 密钥', + `api_key3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv3 密钥', + `mch_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户号', + `sl_mch_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商商户号', + `auth_type` int(3) NULL DEFAULT NULL COMMENT '认证方式', + `cert_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'API 证书中的 p12', + `cert_pem_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'API 证书中的 key.pem', + `key_pem_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'API 证书中的 cert.pem', + `domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用域名,回调中会使用此参数', + `notify_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务器异步通知页面路径', + `return_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '页面跳转同步通知页面路径', + `partner_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '同 apiKey 后续版本会舍弃', + `is_default` bit(1) NULL DEFAULT NULL COMMENT '是否默认', + `pay_ways` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支持的支付类型', + `sandbox` bit(1) NOT NULL COMMENT '是否沙箱环境', + `activity` bit(1) NOT NULL COMMENT '是否启用', + `state` int(11) NULL DEFAULT NULL COMMENT '状态', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信支付配置' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_wechat_pay_config +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_wechat_payment +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wechat_payment`; +CREATE TABLE `pay_wechat_payment` ( + `id` bigint(20) NOT NULL, + `payment_id` bigint(20) NOT NULL COMMENT '交易记录ID', + `pay_status` int(11) NOT NULL COMMENT '支付状态', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID', + `trade_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信交易号', + `amount` decimal(19, 2) NOT NULL COMMENT '交易金额', + `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款金额', + `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', + `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信支付记录' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of pay_wechat_payment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_blob_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_blob_triggers`; +CREATE TABLE `qrtz_blob_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `BLOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `SCHED_NAME`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_blob_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_calendars +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_calendars`; +CREATE TABLE `qrtz_calendars` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `CALENDAR` blob NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_calendars +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_cron_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_cron_triggers`; +CREATE TABLE `qrtz_cron_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_cron_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_fired_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_fired_triggers`; +CREATE TABLE `qrtz_fired_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `ENTRY_ID` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `FIRED_TIME` bigint(13) NOT NULL, + `SCHED_TIME` bigint(13) NOT NULL, + `PRIORITY` int(11) NOT NULL, + `STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `ENTRY_ID`) USING BTREE, + INDEX `IDX_QRTZ_FT_T_G`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_FT_TRIG_INST_NAME`(`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE, + INDEX `IDX_QRTZ_FT_J_G`(`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY`(`SCHED_NAME`, `INSTANCE_NAME`, `REQUESTS_RECOVERY`) USING BTREE, + INDEX `IDX_QRTZ_FT_TG`(`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_FT_JG`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_fired_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_job_details +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_job_details`; +CREATE TABLE `qrtz_job_details` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `IS_DURABLE` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_J_GRP`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_J_REQ_RECOVERY`(`SCHED_NAME`, `REQUESTS_RECOVERY`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_job_details +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_locks +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_locks`; +CREATE TABLE `qrtz_locks` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `LOCK_NAME` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `LOCK_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_locks +-- ---------------------------- +INSERT INTO `qrtz_locks` VALUES ('quartzScheduler', 'STATE_ACCESS'); +INSERT INTO `qrtz_locks` VALUES ('quartzScheduler', 'TRIGGER_ACCESS'); + +-- ---------------------------- +-- Table structure for qrtz_paused_trigger_grps +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; +CREATE TABLE `qrtz_paused_trigger_grps` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_paused_trigger_grps +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_scheduler_state +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_scheduler_state`; +CREATE TABLE `qrtz_scheduler_state` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `LAST_CHECKIN_TIME` bigint(13) NOT NULL, + `CHECKIN_INTERVAL` bigint(13) NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_scheduler_state +-- ---------------------------- +INSERT INTO `qrtz_scheduler_state` VALUES ('quartzScheduler', 'xxm1638448483700', 1638451157328, 10000); + +-- ---------------------------- +-- Table structure for qrtz_simple_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simple_triggers`; +CREATE TABLE `qrtz_simple_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `REPEAT_COUNT` bigint(7) NOT NULL, + `REPEAT_INTERVAL` bigint(12) NOT NULL, + `TIMES_TRIGGERED` bigint(10) NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_simple_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_simprop_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simprop_triggers`; +CREATE TABLE `qrtz_simprop_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `STR_PROP_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `STR_PROP_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `STR_PROP_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `INT_PROP_1` int(11) NULL DEFAULT NULL, + `INT_PROP_2` int(11) NULL DEFAULT NULL, + `LONG_PROP_1` bigint(20) NULL DEFAULT NULL, + `LONG_PROP_2` bigint(20) NULL DEFAULT NULL, + `DEC_PROP_1` decimal(13, 4) NULL DEFAULT NULL, + `DEC_PROP_2` decimal(13, 4) NULL DEFAULT NULL, + `BOOL_PROP_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `BOOL_PROP_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_simprop_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_triggers`; +CREATE TABLE `qrtz_triggers` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `NEXT_FIRE_TIME` bigint(13) NULL DEFAULT NULL, + `PREV_FIRE_TIME` bigint(13) NULL DEFAULT NULL, + `PRIORITY` int(11) NULL DEFAULT NULL, + `TRIGGER_STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `START_TIME` bigint(13) NOT NULL, + `END_TIME` bigint(13) NULL DEFAULT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `MISFIRE_INSTR` smallint(2) NULL DEFAULT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST`(`SCHED_NAME`, `TRIGGER_STATE`, `NEXT_FIRE_TIME`) USING BTREE, + INDEX `IDX_QRTZ_T_N_STATE`(`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_NEXT_FIRE_TIME`(`SCHED_NAME`, `NEXT_FIRE_TIME`) USING BTREE, + INDEX `IDX_QRTZ_T_C`(`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_G`(`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_J`(`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_JG`(`SCHED_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_N_G_STATE`(`SCHED_NAME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_MISFIRE`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`) USING BTREE, + INDEX `IDX_QRTZ_T_STATE`(`SCHED_NAME`, `TRIGGER_STATE`) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP`(`SCHED_NAME`, `MISFIRE_INSTR`, `NEXT_FIRE_TIME`, `TRIGGER_GROUP`, `TRIGGER_STATE`) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of qrtz_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sales_activity +-- ---------------------------- +DROP TABLE IF EXISTS `sales_activity`; +CREATE TABLE `sales_activity` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'name', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `strategy_id` bigint(255) NULL DEFAULT NULL COMMENT '策略id', + `strategy_register_id` bigint(20) NOT NULL COMMENT '策略注册id', + `activity_mutual` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动互斥', + `start_time` datetime(6) NOT NULL COMMENT '有效开始时间', + `end_time` datetime(6) NOT NULL COMMENT '有效结束时间', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠活动' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_activity +-- ---------------------------- +INSERT INTO `sales_activity` VALUES (1394892920481533952, '100-16', '100-16活动策略2', NULL, 1394892919403597824, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-19 13:49:22.757000', 1, '2021-05-19 13:49:22.757000', 0, b'0'); +INSERT INTO `sales_activity` VALUES (1394918400265965568, '100-5', '100-5活动策略3', NULL, 1394918398827319296, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-19 15:30:37.611000', 1, '2021-05-19 15:30:37.611000', 0, b'0'); +INSERT INTO `sales_activity` VALUES (1395308738893729792, '50-20', '50-20活动策略3', 1382517531398524928, 1395308573587820544, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-20 17:21:41.592000', 1, '2021-05-20 17:21:41.592000', 0, b'0'); + +-- ---------------------------- +-- Table structure for sales_check_rule +-- ---------------------------- +DROP TABLE IF EXISTS `sales_check_rule`; +CREATE TABLE `sales_check_rule` ( + `id` bigint(20) NOT NULL, + `strategy_register_id` bigint(20) NOT NULL COMMENT '关联策略注册id', + `register_type` int(6) NOT NULL COMMENT '策略类型 策略/优惠券', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名称', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则code', + `rule_type` int(11) NOT NULL COMMENT '规则类型', + `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '对应策略id', + `addition` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '附加对象 json', + `priority` int(11) NULL DEFAULT NULL COMMENT '优先级', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '检查规则' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_check_rule +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sales_coupon +-- ---------------------------- +DROP TABLE IF EXISTS `sales_coupon`; +CREATE TABLE `sales_coupon` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `template_id` bigint(20) NULL DEFAULT NULL COMMENT '模板id', + `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册id', + `start_time` datetime(6) NULL DEFAULT NULL COMMENT '有效开始时间', + `end_time` datetime(6) NULL DEFAULT NULL COMMENT '有效结束时间', + `status` int(6) NOT NULL COMMENT '状态', + `obtain_time` datetime(6) NULL DEFAULT NULL COMMENT '领取时间', + `used_time` datetime(6) NULL DEFAULT NULL COMMENT '使用时间', + `order_id` bigint(20) NULL DEFAULT NULL COMMENT '所用订单Id', + `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', + `creator` bigint(20) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_coupon +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sales_coupon_template +-- ---------------------------- +DROP TABLE IF EXISTS `sales_coupon_template`; +CREATE TABLE `sales_coupon_template` ( + `id` bigint(20) NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `strategy_register_id` bigint(20) NOT NULL COMMENT '策略注册id', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `num` int(11) NOT NULL COMMENT '数量', + `channel_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道', + `activity_mutual` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动互斥', + `coupon_mutual` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠券互斥', + `effective_type` int(8) NOT NULL COMMENT '有效类型', + `time_type` int(8) NULL DEFAULT NULL COMMENT '时间类型', + `effective_time` bigint(20) NULL DEFAULT NULL COMMENT '有效时间', + `start_time` datetime(6) NULL DEFAULT NULL COMMENT '开始时间', + `end_time` datetime(6) NULL DEFAULT NULL COMMENT '结束时间', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券模板' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_coupon_template +-- ---------------------------- +INSERT INTO `sales_coupon_template` VALUES (1395284918623424512, '100-33', 1395284918430486528, '100-33优惠券', 999, NULL, '', '', 0, 1, NULL, NULL, NULL, 1, '2021-05-20 15:47:02.397000', 1, '2021-05-20 15:58:10.795000', 1, b'0'); +INSERT INTO `sales_coupon_template` VALUES (1395320423364841472, '100-33', 1395320422941216768, '100-33优惠券', 988, NULL, '', '', 0, 1, NULL, NULL, NULL, 1, '2021-05-20 18:08:07.387000', 1, '2021-05-20 18:28:33.743000', 12, b'0'); + +-- ---------------------------- +-- Table structure for sales_match_rule +-- ---------------------------- +DROP TABLE IF EXISTS `sales_match_rule`; +CREATE TABLE `sales_match_rule` ( + `id` bigint(20) NOT NULL, + `strategy_register_id` bigint(20) NOT NULL COMMENT '关联策略注册id', + `register_type` int(6) NOT NULL COMMENT '策略类型 策略/优惠券', + `feature_type` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特征类型(sku/spu/shop)', + `feature_point` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特征点', + `match_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '匹配类型', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '匹配检查' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_match_rule +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sales_strategy +-- ---------------------------- +DROP TABLE IF EXISTS `sales_strategy`; +CREATE TABLE `sales_strategy` ( + `id` bigint(20) NOT NULL, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '唯一编码', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `engine_type` int(1) NOT NULL COMMENT '引擎类型, java/js/groovy', + `target_type` int(11) NOT NULL COMMENT '目标类型', + `rule_script` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '规则脚本', + `show` int(1) NULL DEFAULT NULL COMMENT '是否展示 0不展示,1展示(default)', + `state` int(1) NOT NULL COMMENT '0 可用 1 不可用', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + `tid` bigint(20) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_strategy +-- ---------------------------- +INSERT INTO `sales_strategy` VALUES (1382516141636866048, 'instantReduction', '立减策略', '立减指定的金额', 1, 1, NULL, 1, 1, 1, '2021-04-15 10:08:28.720000', 1, '2021-04-15 10:08:28.720000', 0, b'0', 10011); +INSERT INTO `sales_strategy` VALUES (1382517531398524928, 'fullReduction', '满减策略', '满减策略', 1, 1, NULL, 1, 1, 1, '2021-04-15 10:14:00.075000', 1, '2021-04-15 10:14:00.075000', 0, b'0', 10011); +INSERT INTO `sales_strategy` VALUES (1394909889247203328, 'channelCheck', '渠道检查', '渠道检查', 1, 2, NULL, 1, 1, 1, '2021-05-19 14:56:48.426000', 1, '2021-05-19 14:56:48.426000', 0, b'0', 10011); +INSERT INTO `sales_strategy` VALUES (1395320340615417856, 'obtainMultiple', '多张领取检查', '多张领取检查', 1, 3, '', NULL, 1, 1, '2021-05-20 18:07:47.642000', 1, '2021-05-20 18:07:47.642000', 0, b'0', 10011); + +-- ---------------------------- +-- Table structure for sales_strategy_check_rule +-- ---------------------------- +DROP TABLE IF EXISTS `sales_strategy_check_rule`; +CREATE TABLE `sales_strategy_check_rule` ( + `id` bigint(20) NOT NULL, + `register_id` bigint(20) NULL DEFAULT NULL COMMENT '模板id', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名称', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则code', + `type` int(11) NOT NULL COMMENT '类型', + `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数 json', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NULL DEFAULT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略规则检查' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_strategy_check_rule +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sales_strategy_config +-- ---------------------------- +DROP TABLE IF EXISTS `sales_strategy_config`; +CREATE TABLE `sales_strategy_config` ( + `id` bigint(20) NOT NULL, + `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数类型', + `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '方法参数名', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数名称', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略参数定义' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_strategy_config +-- ---------------------------- +INSERT INTO `sales_strategy_config` VALUES (1382517531788595199, 1382516141636866048, 'BigDecimal', 'amount', '立减金额', '立减金额', 1, '2021-04-15 10:08:28.873000', 1, '2021-04-15 10:08:28.873000', 0, b'0'); +INSERT INTO `sales_strategy_config` VALUES (1382517531788595200, 1382517531398524928, 'BigDecimal', 'satisfy', '满多少', '配置满多少的字段', 1, '2021-04-15 10:14:00.169000', 1, '2021-04-15 10:14:00.169000', 0, b'0'); +INSERT INTO `sales_strategy_config` VALUES (1382517531788595201, 1382517531398524928, 'BigDecimal', 'minus', '减多少', '配置减多少的字段', 1, '2021-04-15 10:14:00.169000', 1, '2021-04-15 10:14:00.169000', 0, b'0'); + +-- ---------------------------- +-- Table structure for sales_strategy_config_value +-- ---------------------------- +DROP TABLE IF EXISTS `sales_strategy_config_value`; +CREATE TABLE `sales_strategy_config_value` ( + `id` bigint(20) NOT NULL, + `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', + `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册id', + `strategy_config_id` bigint(20) NULL DEFAULT NULL COMMENT '策略定义id', + `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略参数key', + `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数值', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略配置参数' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_strategy_config_value +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sales_strategy_register +-- ---------------------------- +DROP TABLE IF EXISTS `sales_strategy_register`; +CREATE TABLE `sales_strategy_register` ( + `id` bigint(20) NOT NULL, + `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略注册名称', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `strategy_type` int(11) NULL DEFAULT NULL COMMENT '策略类型(1活动/2优惠券)', + `creator` bigint(20) NULL DEFAULT NULL, + `create_time` datetime(6) NULL DEFAULT NULL, + `last_modifier` bigint(20) NULL DEFAULT NULL, + `last_modified_time` datetime(6) NULL DEFAULT NULL, + `version` int(11) NOT NULL, + `deleted` bit(1) NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略注册' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of sales_strategy_register +-- ---------------------------- + +-- ---------------------------- +-- Table structure for starter_audit_data_version +-- ---------------------------- +DROP TABLE IF EXISTS `starter_audit_data_version`; +CREATE TABLE `starter_audit_data_version` ( + `id` bigint(20) NOT NULL, + `data_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据名称', + `data_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '数据主键', + `data_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '数据内容', + `version` int(10) NOT NULL COMMENT '版本', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据版本日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of starter_audit_data_version +-- ---------------------------- +INSERT INTO `starter_audit_data_version` VALUES (1480550993828446208, 'client', '1', '{\"dataName\":\"client\",\"dataId\":\"1\",\"dataContent\":{\"id\":\"1\",\"creator\":null,\"createTime\":\"2022-01-10 22:43:58\",\"lastModifier\":null,\"lastModifiedTime\":null,\"deleted\":false,\"version\":0,\"code\":null,\"name\":null,\"timeout\":null,\"captcha\":false,\"enable\":false,\"description\":null}}', 1, 0, '2022-01-10 22:43:59'); +INSERT INTO `starter_audit_data_version` VALUES (1480551021779288064, 'client', '1', '{\"dataName\":\"client\",\"dataId\":\"1\",\"dataContent\":{\"id\":\"1\",\"creator\":null,\"createTime\":\"2022-01-10 22:44:05\",\"lastModifier\":null,\"lastModifiedTime\":null,\"deleted\":false,\"version\":0,\"code\":null,\"name\":null,\"timeout\":null,\"captcha\":false,\"enable\":false,\"description\":null}}', 2, 0, '2022-01-10 22:44:06'); + +-- ---------------------------- +-- Table structure for starter_audit_login_log +-- ---------------------------- +DROP TABLE IF EXISTS `starter_audit_login_log`; +CREATE TABLE `starter_audit_login_log` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(11) NULL DEFAULT NULL COMMENT '用户id', + `account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户名称', + `login` bit(1) NULL DEFAULT NULL COMMENT '登录成功状态', + `client` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '终端', + `ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录IP地址', + `login_location` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '登录地点', + `os` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作系统', + `browser` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浏览器类型', + `msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '提示消息', + `login_time` datetime(0) NULL DEFAULT NULL COMMENT '访问时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '登陆日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of starter_audit_login_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for starter_audit_operate_log +-- ---------------------------- +DROP TABLE IF EXISTS `starter_audit_operate_log`; +CREATE TABLE `starter_audit_operate_log` ( + `id` bigint(20) NOT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作模块', + `operate_id` bigint(20) NULL DEFAULT NULL COMMENT '操作人员id', + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作人员账号', + `business_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务类型', + `method` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求方法', + `request_method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求方式', + `operate_url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求url', + `operate_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作ip', + `operate_location` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作地点', + `operate_param` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求参数', + `operate_return` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '返回参数', + `success` bit(1) NULL DEFAULT NULL COMMENT '是否成功', + `error_msg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '错误提示', + `operate_time` datetime(0) NULL DEFAULT NULL COMMENT '操作时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '操作日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of starter_audit_operate_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for starter_file_upload_info +-- ---------------------------- +DROP TABLE IF EXISTS `starter_file_upload_info`; +CREATE TABLE `starter_file_upload_info` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '存储位置', + `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件名称', + `file_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件类型', + `file_suffix` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀', + `file_size` bigint(20) NULL DEFAULT NULL COMMENT '文件大小', + `external_storage_id` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部关联id', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传文件信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of starter_file_upload_info +-- ---------------------------- +INSERT INTO `starter_file_upload_info` VALUES (1495330622946631680, NULL, 'blob', 'jpg', 'jpg', 68, '62120ac9efeec06e2275fc52', 1399985191002447872, '2022-02-20 17:32:57'); +INSERT INTO `starter_file_upload_info` VALUES (1495331213525606400, NULL, 'blob', 'jpg', 'jpg', 68, '62120b55efeec06e2275fc54', 1399985191002447872, '2022-02-20 17:35:28'); +INSERT INTO `starter_file_upload_info` VALUES (1495331812178616320, NULL, 'blob', 'jpg', 'jpg', 74, '62120be4efeec06e2275fc56', 1399985191002447872, '2022-02-20 17:37:43'); +INSERT INTO `starter_file_upload_info` VALUES (1495331905770315776, NULL, 'blob', 'jpg', 'jpg', 76, '62120bfaefeec06e2275fc58', 1399985191002447872, '2022-02-20 17:38:03'); +INSERT INTO `starter_file_upload_info` VALUES (1530065639127871488, NULL, 'blob', 'jpg', 'jpg', 83, '6290684abf0e90583f414dcf', 1414143554414059520, '2022-05-27 13:57:31'); + +-- ---------------------------- +-- Table structure for starter_quartz_job +-- ---------------------------- +DROP TABLE IF EXISTS `starter_quartz_job`; +CREATE TABLE `starter_quartz_job` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务名称', + `job_class_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '任务类名', + `cron` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'cron表达式', + `parameter` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '参数', + `state` int(4) NULL DEFAULT NULL COMMENT '状态', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '定时任务' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of starter_quartz_job +-- ---------------------------- +INSERT INTO `starter_quartz_job` VALUES (1456579473573867520, '测试任务', 'cn.bootx.starter.quartz.task.TestTask', '50 0 * * * ? *', '{\"aaa\":\"5255\"}', 0, '测试任务', 1399985191002447872, '2021-11-05 19:09:43', 1399985191002447872, '2022-06-22 00:37:48', 25, 0); + +-- ---------------------------- +-- Table structure for starter_quartz_job_log +-- ---------------------------- +DROP TABLE IF EXISTS `starter_quartz_job_log`; +CREATE TABLE `starter_quartz_job_log` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `handler_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '处理器名称', + `class_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '处理器全限定名', + `success` bit(1) NOT NULL COMMENT '是否执行成功', + `error_message` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误信息', + `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间', + `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间', + `duration` bigint(255) NULL DEFAULT NULL COMMENT '执行时长', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '任务执行日志' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of starter_quartz_job_log +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/_config/sql/V1.1.0_bate4_up_bate5.sql b/_config/sql/V1.1.0_bate4_up_bate5.sql new file mode 100644 index 0000000000000000000000000000000000000000..2146d24c57ecfcb41eec50ecdb08156033333b9e --- /dev/null +++ b/_config/sql/V1.1.0_bate4_up_bate5.sql @@ -0,0 +1,84 @@ +SET FOREIGN_KEY_CHECKS=0; + +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `expire_time` int(10) NOT NULL COMMENT '超时配置' AFTER `sandbox`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `state`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `creator`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `create_time`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `last_modifier`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `version` int(11) NOT NULL COMMENT '版本' AFTER `last_modified_time`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除' AFTER `version`; + +ALTER TABLE `pay_payment` MODIFY COLUMN `business_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务id' AFTER `user_id`; +ALTER TABLE `pay_payment` MODIFY COLUMN `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题' AFTER `business_id`; +ALTER TABLE `pay_payment` MODIFY COLUMN `description` varchar(240) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述' AFTER `title`; +ALTER TABLE `pay_payment` ADD UNIQUE INDEX `uniq_business_id`(`business_id`) USING BTREE COMMENT '业务编号id, 唯一ID'; + +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `api_version` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商应用编号' AFTER `mch_id`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `api_key_v2` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv2 密钥' AFTER `api_version`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `api_key_v3` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv3 密钥' AFTER `api_key_v2`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `app_secret` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'APPID对应的接口密码,用于获取接口调用凭证access_token时使用' AFTER `api_key_v3`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `p12` bigint(20) NULL DEFAULT NULL COMMENT 'p12的文件id' AFTER `app_secret`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `cert_pem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'API 证书中的 cert.pem' AFTER `p12`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `key_pem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'API 证书中的 key.pem' AFTER `cert_pem`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `expire_time` int(10) NOT NULL COMMENT '超时配置' AFTER `sandbox`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `id` bigint(20) NOT NULL COMMENT '主键' FIRST; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称' AFTER `id`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `app_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信应用AppId' AFTER `name`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `mch_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户号' AFTER `app_id`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `pay_ways` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支持的支付类型' AFTER `return_url`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `state`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `remark`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `creator`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `create_time`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `last_modifier`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `version` int(11) NOT NULL COMMENT '版本' AFTER `last_modified_time`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除' AFTER `version`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `sl_app_id`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `api_key`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `api_key3`; + +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `sl_mch_id`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `auth_type`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `cert_path`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `cert_pem_path`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `key_pem_path`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `partner_key`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `is_default`; + +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `pay_time`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `creator`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `create_time`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `last_modifier`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `version` int(11) NOT NULL COMMENT '版本' AFTER `last_modified_time`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除' AFTER `version`; +ALTER TABLE `pay_wechat_payment` DROP COLUMN `tid`; + +INSERT INTO `base_dict` VALUES (1546757092010078208, 'PayNotifyProcess', '支付回调处理状态', '支付服务', '成功/忽略/失败', 1399985191002447872, '2022-07-12 15:23:23', 1399985191002447872, '2022-07-12 15:23:53', 0, 1); + +INSERT INTO `base_dict_item` VALUES (1546757293592522752, 1546757092010078208, 'PayNotifyProcess', '0', '失败', 0.00, '', 1399985191002447872, '2022-07-12 15:24:11', 1399985191002447872, '2022-07-12 15:24:11', 0, 0); +INSERT INTO `base_dict_item` VALUES (1546757327901929472, 1546757092010078208, 'PayNotifyProcess', '1', '成功', -1.00, '', 1399985191002447872, '2022-07-12 15:24:19', 1399985191002447872, '2022-07-12 15:31:38', 0, 2); +INSERT INTO `base_dict_item` VALUES (1546757375637303296, 1546757092010078208, 'PayNotifyProcess', '2', '忽略', 0.00, '', 1399985191002447872, '2022-07-12 15:24:30', 1399985191002447872, '2022-07-12 15:24:30', 0, 0); + +INSERT INTO `base_param` VALUES (1545765299880448000, '服务器地址', 'ServerUrl', 'http://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-07-09 21:42:21', 1399985191002447872, '2022-07-09 21:42:21', 0, 0); +INSERT INTO `base_param` VALUES (1547511252795912192, '微信jsapi支付回调服务地址', 'JsapiRedirectUrl', 'http://127.0.0.1/api/', 1, b'1', '', 1414143554414059520, '2022-07-14 17:20:09', 1414143554414059520, '2022-07-14 17:20:09', 0, 0); +UPDATE `base_param` SET `value` = 'http://127.0.0.1/api/' WHERE `id` = 1500338438182789120; + +INSERT INTO `iam_perm_menu` VALUES (1544952211901218816, 'admin', 1546850918849249280, '支付结算台演示', 'CashierDemo', NULL, b'0', '', b'0', b'0', '', NULL, '/cashier', '', 0, 1, NULL, b'0', b'1', b'0', b'0', NULL, 1399985191002447872, '2022-07-07 15:51:26', 1399985191002447872, '2022-07-12 21:36:34', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1546850918849249280, 'admin', 1495968302034210816, '支付演示', 'DemoPay', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/demo/pay', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-07-12 21:36:13', 1399985191002447872, '2022-07-12 21:36:13', 0, 0); + +UPDATE `iam_perm_menu` SET `client_code` = 'admin', `parent_id` = 1546850918849249280, `title` = '收银台', `name` = 'PayCashier', `perm_code` = '', `effect` = b'0', `icon` = '', `hidden` = b'0', `hide_children_in_menu` = b'0', `component` = 'payment/cashier/Cashier', `component_name` = NULL, `path` = '/demo/pay/cashier', `redirect` = '', `sort_no` = -1, `menu_type` = 1, `leaf` = NULL, `keep_alive` = b'1', `target_outside` = b'0', `hidden_header_content` = b'0', `admin` = b'0', `remark` = NULL, `creator` = 1399985191002447872, `create_time` = '2021-10-20 22:05:26', `last_modifier` = 1399985191002447872, `last_modified_time` = '2022-07-12 21:37:22', `version` = 3, `deleted` = 0 WHERE `id` = 1450825488577544192; +UPDATE `iam_perm_menu` SET `client_code` = 'admin', `parent_id` = 1546850918849249280, `title` = '组合支付', `name` = 'CombinationCashier', `perm_code` = NULL, `effect` = b'0', `icon` = '', `hidden` = b'0', `hide_children_in_menu` = b'0', `component` = 'payment/combination/CombinationCashier', `component_name` = NULL, `path` = '/demo/pay/combination', `redirect` = '', `sort_no` = -0.5, `menu_type` = 1, `leaf` = NULL, `keep_alive` = b'1', `target_outside` = b'0', `hidden_header_content` = b'0', `admin` = b'0', `remark` = NULL, `creator` = 1399985191002447872, `create_time` = '2022-03-10 17:07:56', `last_modifier` = 1399985191002447872, `last_modified_time` = '2022-07-12 21:37:59', `version` = 4, `deleted` = 0 WHERE `id` = 1501847310319972352; + +UPDATE `iam_user_expand_info` SET `sex` = 1, `birthday` = '1996-12-01', `avatar` = '1495331905770315776', `last_login_time` = '2022-07-12 15:20:44', `current_login_time` = '2022-07-12 21:35:26', `initial_password` = b'0', `last_change_password_time` = '2022-06-19 21:25:00', `creator` = 1, `create_time` = '2021-06-02 15:04:15', `last_modifier` = 0, `last_modified_time` = '2022-07-12 21:35:26', `version` = 273, `deleted` = 0 WHERE `id` = 1399985191002447872; + +INSERT INTO `qrtz_cron_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '0/5 * * * * ? *', 'Asia/Shanghai'); + +INSERT INTO `qrtz_fired_triggers` VALUES ('quartzScheduler', 'NON_CLUSTERED1657763850994', '1546857070483939328', 'DEFAULT', 'NON_CLUSTERED', 1657767410672, 1657767415000, 5, 'ACQUIRED', NULL, NULL, '0', '0'); + +INSERT INTO `qrtz_job_details` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', NULL, 'cn.bootx.payment.task.PayExpiredTimeTask', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C77080000001000000001740009706172616D65746572707800); + +INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '1546857070483939328', 'DEFAULT', NULL, 1657767415000, 1657767410000, 5, 'ACQUIRED', 'CRON', 1657634445000, 0, NULL, 0, ''); + +INSERT INTO `starter_quartz_job` VALUES (1546857070483939328, '支付单超时检测', 'cn.bootx.payment.task.PayExpiredTimeTask', '0/5 * * * * ? *', NULL, 1, '检测超时的支付单, 超时后发送超时事件', 1399985191002447872, '2022-07-12 22:00:39', 1399985191002447872, '2022-07-12 22:00:45', 1, 0); + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/_config/sql/bootx-platform.sql b/_config/sql/bootx-platform.sql index a5a6a7fb99b2b019f813083c0ece4aa15f5dcd2f..959a4a0e2ac3be4f519e20e53915c41fab9555f4 100644 --- a/_config/sql/bootx-platform.sql +++ b/_config/sql/bootx-platform.sql @@ -9,7 +9,7 @@ Target Server Version : 50735 File Encoding : 65001 - Date: 07/07/2022 10:57:51 + Date: 14/07/2022 12:49:56 */ SET NAMES utf8mb4; @@ -58,6 +58,7 @@ INSERT INTO `base_dict` VALUES (1502624632392347648, 'WalletLogOperation', '钱 INSERT INTO `base_dict` VALUES (1503340128037212160, 'VoucherStatus', '储值卡状态', '支付服务', '储值卡状态', 1399985191002447872, '2022-03-14 19:59:52', 1399985191002447872, '2022-05-11 19:47:12', 0, 1); INSERT INTO `base_dict` VALUES (1524356168611188736, 'input', '手工输入', '商品服务', '', 1399985191002447872, '2022-05-11 19:50:06', 1399985191002447872, '2022-05-11 19:50:06', 1, 0); INSERT INTO `base_dict` VALUES (1524356376518643712, 'GoodsParamType', '参数类型', '商品服务', '列表/手动输入', 1399985191002447872, '2022-05-11 19:50:56', 1399985191002447872, '2022-05-14 23:05:41', 0, 1); +INSERT INTO `base_dict` VALUES (1546757092010078208, 'PayNotifyProcess', '支付回调处理状态', '支付服务', '成功/忽略/失败', 1399985191002447872, '2022-07-12 15:23:23', 1399985191002447872, '2022-07-12 15:23:53', 0, 1); -- ---------------------------- -- Table structure for base_dict_item @@ -164,6 +165,9 @@ INSERT INTO `base_dict_item` VALUES (1503340326645895168, 1503340128037212160, ' INSERT INTO `base_dict_item` VALUES (1505112357976612864, 1496722894707728384, 'PayChannel', '6', '储值卡', 0.00, '', 1399985191002447872, '2022-03-19 17:22:04', 1399985191002447872, '2022-03-19 17:22:04', 0, 0); INSERT INTO `base_dict_item` VALUES (1524356452720758784, 1524356376518643712, 'GoodsParamType', 'input', '手工录入', 0.00, '', 1399985191002447872, '2022-05-11 19:51:14', 1399985191002447872, '2022-05-11 19:51:14', 0, 0); INSERT INTO `base_dict_item` VALUES (1524356510157557760, 1524356376518643712, 'GoodsParamType', 'select', '列表选择', 0.00, '', 1399985191002447872, '2022-05-11 19:51:28', 1399985191002447872, '2022-05-11 19:51:28', 0, 0); +INSERT INTO `base_dict_item` VALUES (1546757293592522752, 1546757092010078208, 'PayNotifyProcess', '0', '失败', 0.00, '', 1399985191002447872, '2022-07-12 15:24:11', 1399985191002447872, '2022-07-12 15:24:11', 0, 0); +INSERT INTO `base_dict_item` VALUES (1546757327901929472, 1546757092010078208, 'PayNotifyProcess', '1', '成功', -1.00, '', 1399985191002447872, '2022-07-12 15:24:19', 1399985191002447872, '2022-07-12 15:31:38', 0, 2); +INSERT INTO `base_dict_item` VALUES (1546757375637303296, 1546757092010078208, 'PayNotifyProcess', '2', '忽略', 0.00, '', 1399985191002447872, '2022-07-12 15:24:30', 1399985191002447872, '2022-07-12 15:24:30', 0, 0); -- ---------------------------- -- Table structure for base_key_value @@ -205,15 +209,17 @@ CREATE TABLE `base_param` ( `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', `version` int(8) NOT NULL COMMENT '版本', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统参数配置' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统参数配置' ROW_FORMAT = DYNAMIC;pay_alipay_config -- ---------------------------- -- Records of base_param -- ---------------------------- INSERT INTO `base_param` VALUES (1452842684284891136, '测试', 'test.v1', '123', 1, b'0', NULL, 1399985191002447872, '2021-10-26 11:41:03', 1399985191002447872, '2021-10-26 11:41:03', 0, 0); -INSERT INTO `base_param` VALUES (1500338438182789120, '结算台聚合支付请求地址', 'CashierAggregateUrl', 'http://pay1.bootx.cn/cashier/aggregatePay?key=', 1, b'1', '', 1399985191002447872, '2022-03-06 13:12:13', 1399985191002447872, '2022-05-01 15:03:03', 0, 3); +INSERT INTO `base_param` VALUES (1500338438182789120, '结算台聚合支付请求地址', 'CashierAggregateUrl', 'http://127.0.0.1/api/', 1, b'1', '', 1399985191002447872, '2022-03-06 13:12:13', 1399985191002447872, '2022-05-01 15:03:03', 0, 3); INSERT INTO `base_param` VALUES (1520668030248361984, '文件服务器地址', 'FileServerUrl', 'http://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-05-01 15:34:46', 1399985191002447872, '2022-05-19 12:53:21', 0, 5); INSERT INTO `base_param` VALUES (1529281530059161600, 'websocket服务器地址', 'WebsocketServerUrl', 'ws://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-05-25 10:01:44', 1399985191002447872, '2022-05-25 10:01:44', 0, 0); +INSERT INTO `base_param` VALUES (1545765299880448000, '服务器地址', 'ServerUrl', 'http://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-07-09 21:42:21', 1399985191002447872, '2022-07-09 21:42:21', 0, 0); +INSERT INTO `base_param` VALUES (1547511252795912192, '微信jsapi支付回调服务地址', 'JsapiRedirectUrl', 'http://127.0.0.1/api/', 1, b'1', '', 1414143554414059520, '2022-07-14 17:20:09', 1414143554414059520, '2022-07-14 17:20:09', 0, 0); -- ---------------------------- -- Table structure for common_sequence_range @@ -421,9 +427,11 @@ CREATE TABLE `flyway_schema_history` ( -- ---------------------------- -- Records of flyway_schema_history -- ---------------------------- -INSERT INTO `flyway_schema_history` VALUES (1, '1.1.0.220604', 'init', 'SQL', 'V1.1.0_220604__init.sql', -474276030, 'bootx', '2022-07-07 10:32:27', 83640, 1); -INSERT INTO `flyway_schema_history` VALUES (2, '1.1.0.220624', 'bate3', 'SQL', 'V1.1.0_220624__bate3.sql', 85360861, 'bootx', '2022-07-07 10:32:28', 723, 1); -INSERT INTO `flyway_schema_history` VALUES (3, '1.1.0.220702', 'bate4', 'SQL', 'V1.1.0_220702__bate4.sql', 764266899, 'bootx', '2022-07-07 10:32:35', 6172, 1); +INSERT INTO `flyway_schema_history` VALUES (1, '1.1.0.220604', 'init', 'SQL', 'V1.1.0_220604__init.sql', -474276030, 'bootx', '2022-07-14 12:28:56', 71928, 1); +INSERT INTO `flyway_schema_history` VALUES (2, '1.1.0.220624', 'bate3', 'SQL', 'V1.1.0_220624__bate3.sql', 85360861, 'bootx', '2022-07-14 12:28:57', 788, 1); +INSERT INTO `flyway_schema_history` VALUES (3, '1.1.0.220702', 'bate4', 'SQL', 'V1.1.0_220702__bate4.sql', 764266899, 'bootx', '2022-07-14 12:29:03', 5982, 1); +INSERT INTO `flyway_schema_history` VALUES (4, '1.1.0.220707', 'bate4-fix', 'SQL', 'V1.1.0_220707__bate4-fix.sql', 1727269960, 'bootx', '2022-07-14 12:29:10', 6278, 1); +INSERT INTO `flyway_schema_history` VALUES (5, '1.1.0.220714', 'bate5', 'SQL', 'V1.1.0_220714__bate5.sql', -1924142323, 'bootx', '2022-07-14 12:29:14', 3516, 1); -- ---------------------------- -- Table structure for goods_brand @@ -735,33 +743,6 @@ CREATE TABLE `goods_specification` ( -- Records of goods_specification -- ---------------------------- --- ---------------------------- --- Table structure for iam_application --- ---------------------------- -DROP TABLE IF EXISTS `iam_application`; -CREATE TABLE `iam_application` ( - `id` bigint(20) NOT NULL, - `code` varchar(21) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `system` bit(1) NOT NULL COMMENT '是否系统内置', - `enable` bit(1) NOT NULL COMMENT '是否可用', - `client_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '关联终端', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '认证应用' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of iam_application --- ---------------------------- -INSERT INTO `iam_application` VALUES (1430430071299207168, 'admin', 'pc管理端', b'1', b'1', '1430430071299207168,1435138582839009280,1430478946919653376,1542091599907115008,1542804450312122368,1543126042909016064', 'pc浏览器', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-07-02 14:55:11', 4, 0); -INSERT INTO `iam_application` VALUES (1430430071299207169, 'h5', 'h5端', b'1', b'1', '1430430071299207168,1435138582839009280', '手机wap', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-06-29 18:31:45', 1, 0); - -- ---------------------------- -- Table structure for iam_client -- ---------------------------- @@ -771,10 +752,8 @@ CREATE TABLE `iam_client` ( `code` varchar(21) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码', `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', `system` bit(1) NOT NULL COMMENT '是否系统内置', - `timeout` bigint(11) NULL DEFAULT NULL COMMENT '在线时长 秒', - `captcha` bit(1) NOT NULL COMMENT '启用验证码', - `pwd_err_num` int(8) NOT NULL COMMENT '密码错误次数', `enable` bit(1) NOT NULL COMMENT '是否可用', + `login_type_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '关联登录方式\r\n', `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', @@ -788,12 +767,8 @@ CREATE TABLE `iam_client` ( -- ---------------------------- -- Records of iam_client -- ---------------------------- -INSERT INTO `iam_client` VALUES (1430430071299207168, 'password', '账号密码登陆', b'1', 3600, b'0', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-04-24 19:51:13', 16, 0); -INSERT INTO `iam_client` VALUES (1430478946919653376, 'miniApp', '微信小程序', b'0', 99999, b'1', 0, b'1', NULL, 1399985191002447872, '2021-08-25 18:35:33', 1399985191002447872, '2021-08-25 18:35:33', 2, 0); -INSERT INTO `iam_client` VALUES (1435138582839009280, 'phone', '手机短信登录', b'0', 3600, b'1', 0, b'1', NULL, 1399985191002447872, '2021-09-07 15:11:16', 1399985191002447872, '2022-06-26 21:35:20', 4, 0); -INSERT INTO `iam_client` VALUES (1542091599907115008, 'dingTalk', '钉钉', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-06-29 18:24:23', 1399985191002447872, '2022-07-02 14:55:01', 5, 0); -INSERT INTO `iam_client` VALUES (1542804450312122368, 'weCom', '企业微信', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-01 17:37:00', 1399985191002447872, '2022-07-01 17:37:00', 0, 0); -INSERT INTO `iam_client` VALUES (1543126042909016064, 'WeChat', '微信登录', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-02 14:54:53', 1399985191002447872, '2022-07-02 14:54:53', 0, 0); +INSERT INTO `iam_client` VALUES (1430430071299207168, 'admin', 'pc管理端', b'1', b'1', '1430430071299207168,1435138582839009280,1430478946919653376,1542091599907115008,1542804450312122368,1543126042909016064', 'pc浏览器', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-07-02 14:55:11', 4, 0); +INSERT INTO `iam_client` VALUES (1430430071299207169, 'h5', 'h5端', b'1', b'1', '1430430071299207168,1435138582839009280', '手机wap', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-06-29 18:31:45', 1, 0); -- ---------------------------- -- Table structure for iam_data_scope @@ -905,13 +880,47 @@ INSERT INTO `iam_dept` VALUES (1477978610865197056, 1477977592291053568, '高新 INSERT INTO `iam_dept` VALUES (1477978810526650368, 1477977827897692160, '奎文办事部', 0, '2', '1_2_1', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:23:03', 1399985191002447872, '2022-01-03 20:23:03', 0, 0); INSERT INTO `iam_dept` VALUES (1477978883247493120, 1477977827897692160, '潍城办事部', 0, '2', '1_2_2', '', NULL, '', '', 1399985191002447872, '2022-01-03 20:23:20', 1399985191002447872, '2022-01-03 20:23:20', 0, 0); +-- ---------------------------- +-- Table structure for iam_login_type +-- ---------------------------- +DROP TABLE IF EXISTS `iam_login_type`; +CREATE TABLE `iam_login_type` ( + `id` bigint(20) NOT NULL, + `code` varchar(21) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型', + `system` bit(1) NOT NULL COMMENT '是否系统内置', + `timeout` bigint(11) NULL DEFAULT NULL COMMENT '在线时长 秒', + `captcha` bit(1) NOT NULL COMMENT '启用验证码', + `pwd_err_num` int(8) NOT NULL COMMENT '密码错误次数', + `enable` bit(1) NOT NULL COMMENT '是否可用', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '登录方式' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of iam_login_type +-- ---------------------------- +INSERT INTO `iam_login_type` VALUES (1430430071299207168, 'password', '账号密码登陆', 'password', b'1', 3600, b'0', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-04-24 19:51:13', 16, 0); +INSERT INTO `iam_login_type` VALUES (1430478946919653376, 'miniApp', '微信小程序', 'openId', b'0', 99999, b'1', 0, b'1', NULL, 1399985191002447872, '2021-08-25 18:35:33', 1399985191002447872, '2021-08-25 18:35:33', 2, 0); +INSERT INTO `iam_login_type` VALUES (1435138582839009280, 'phone', '手机短信登录', 'openId', b'0', 3600, b'1', 0, b'1', NULL, 1399985191002447872, '2021-09-07 15:11:16', 1399985191002447872, '2022-06-26 21:35:20', 4, 0); +INSERT INTO `iam_login_type` VALUES (1542091599907115008, 'dingTalk', '钉钉', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-06-29 18:24:23', 1399985191002447872, '2022-07-02 14:55:01', 5, 0); +INSERT INTO `iam_login_type` VALUES (1542804450312122368, 'weCom', '企业微信', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-01 17:37:00', 1399985191002447872, '2022-07-01 17:37:00', 0, 0); +INSERT INTO `iam_login_type` VALUES (1543126042909016064, 'WeChat', '微信登录', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-02 14:54:53', 1399985191002447872, '2022-07-02 14:54:53', 0, 0); + -- ---------------------------- -- Table structure for iam_perm_menu -- ---------------------------- DROP TABLE IF EXISTS `iam_perm_menu`; CREATE TABLE `iam_perm_menu` ( `id` bigint(20) NOT NULL, - `app_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '应用code', + `client_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '终端code', `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父id', `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '菜单名称', `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由名称', @@ -951,7 +960,7 @@ INSERT INTO `iam_perm_menu` VALUES (1414596805538238464, 'admin', 14525693399874 INSERT INTO `iam_perm_menu` VALUES (1414596842322284544, 'admin', 1452569691537256448, '部门管理', 'Dept', '', NULL, '', b'0', b'0', 'system/dept/DeptList', '', '/system/userAuth/dept', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-26 23:56:31', 7, 0); INSERT INTO `iam_perm_menu` VALUES (1414596877617352704, 'admin', 1452571269199540224, '数据字典', 'Dict', '', b'0', '', b'0', b'0', 'system/dict/DictList', '', '/system/config/dict', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2022-05-19 09:04:55', 11, 0); INSERT INTO `iam_perm_menu` VALUES (1431082258161434624, 'admin', 1452569691537256448, '在线用户管理', 'OnlineUser', '', NULL, '', b'0', b'0', 'system/online/OnlineUserList', NULL, '/system/userAuth/online', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:32:53', 1399985191002447872, '2021-08-27 10:32:53', 6, 0); -INSERT INTO `iam_perm_menu` VALUES (1431083330909208576, 'admin', 1541427353886859264, '认证终端', 'Client', '', b'0', '', b'0', b'0', 'system/client/ClientList', NULL, '/system/config/client', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:37:09', 1399985191002447872, '2022-06-27 22:25:16', 8, 0); +INSERT INTO `iam_perm_menu` VALUES (1431083330909208576, 'admin', 1541427353886859264, '登录方式', 'LoginType', '', b'0', '', b'0', b'0', 'system/client/LoginTypeList', NULL, '/system/config/loginType', '', 9, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:37:09', 1399985191002447872, '2022-07-05 21:18:12', 11, 0); INSERT INTO `iam_perm_menu` VALUES (1431089129232498688, 'admin', 1452569339987472384, '请求权限管理', 'Path', '', NULL, '', b'0', b'0', 'system/path/PathList', NULL, '/system/permission/path', '', 0, 1, b'1', b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 11:00:11', 1399985191002447872, '2021-08-27 11:00:11', 2, 0); INSERT INTO `iam_perm_menu` VALUES (1431152689832525824, 'admin', NULL, '系统监控', 'monitor', '', b'0', 'radar-chart', b'0', b'0', 'RouteView', NULL, '/monitor', '', 0, 0, b'1', b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2021-08-27 15:12:45', 1399985191002447872, '2022-06-17 17:57:30', 21, 0); INSERT INTO `iam_perm_menu` VALUES (1431153358157348864, 'admin', 1431152689832525824, '接口文档', 'ApiSwagger', '', b'0', '', b'0', b'0', '', NULL, 'http://127.0.0.1:9999/doc.html', '', 0, 1, b'1', b'1', b'1', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 15:15:25', 1399985191002447872, '2022-06-07 11:06:52', 15, 0); @@ -974,7 +983,7 @@ INSERT INTO `iam_perm_menu` VALUES (1450824117849636864, 'admin', 14508239602360 INSERT INTO `iam_perm_menu` VALUES (1450824319868289024, 'admin', 1450823960236081152, '微信支付', 'WeChatPayConfig', '', NULL, '', b'0', b'0', 'payment/channel/wechat/WeChatConfigList', NULL, '/payment/channel/wechat', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:00:48', 1399985191002447872, '2021-10-20 22:00:48', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1450824637876224000, 'admin', 1450823960236081152, '云闪付', 'UnionPayConfig', '', b'0', '', b'0', b'0', 'payment/channel/unionpay/UnionPayConfigList', NULL, '/payment/channel/unionpay', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:02:03', 1399985191002447872, '2022-03-04 16:12:13', 3, 0); INSERT INTO `iam_perm_menu` VALUES (1450824875198332928, 'admin', 1450823960236081152, '现金支付', 'CashPayConfig', '', b'0', '', b'1', b'0', '', NULL, '/payment/channel/cash', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:03:00', 1399985191002447872, '2022-03-04 16:12:08', 1, 0); -INSERT INTO `iam_perm_menu` VALUES (1450825488577544192, 'admin', 1450822842995130368, '收银台', 'PayCashier', '', NULL, '', b'0', b'0', 'payment/cashier/Cashier', NULL, '/payment/cashier', '', -1, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:05:26', 1399985191002447872, '2021-10-20 22:05:26', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1450825488577544192, 'admin', 1546850918849249280, '收银台', 'PayCashier', '', b'0', '', b'0', b'0', 'payment/cashier/Cashier', NULL, '/demo/pay/cashier', '', -1, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:05:26', 1399985191002447872, '2022-07-12 21:37:22', 3, 0); INSERT INTO `iam_perm_menu` VALUES (1450825615857893376, 'admin', 1450822842995130368, '订单管理', 'PayOrder', '', NULL, '', b'0', b'0', 'RouteView', NULL, '/payment/order', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:05:57', 1399985191002447872, '2021-10-20 22:05:57', 2, 0); INSERT INTO `iam_perm_menu` VALUES (1450825819436826624, 'admin', 1450822842995130368, '回调记录', 'PayNotify', '', NULL, '', b'0', b'0', 'payment/notify/PayNotifyRecordList', NULL, '/payment/notify', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:06:45', 1399985191002447872, '2021-10-20 22:06:45', 0, 0); INSERT INTO `iam_perm_menu` VALUES (1450826890318135296, 'admin', 1450825615857893376, '支付订单', 'PaymentOrder', '', b'0', '', b'0', b'0', 'payment/order/payment/PaymentList', NULL, '/payment/order/payment', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-10-20 22:11:00', 1399985191002447872, '2022-02-25 15:17:07', 2, 0); @@ -999,7 +1008,7 @@ INSERT INTO `iam_perm_menu` VALUES (1496020308992143360, 'admin', 14959683020342 INSERT INTO `iam_perm_menu` VALUES (1501740492360962048, 'admin', 1450822842995130368, '钱包管理', 'Wallet', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/payment/wallet', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 10:03:29', 1399985191002447872, '2022-03-10 10:04:53', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1501742229142556672, 'admin', 1501740492360962048, '钱包列表', 'WalletList', NULL, b'0', '', b'0', b'0', 'payment/wallet/list/WalletList', NULL, '/payment/wallet/list', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 10:10:23', 1399985191002447872, '2022-03-10 17:06:19', 2, 0); INSERT INTO `iam_perm_menu` VALUES (1501742417378725888, 'admin', 1501740492360962048, '个人钱包', 'PersonalWallet', NULL, b'0', '', b'0', b'0', 'payment/wallet/list/WalletList', NULL, '/payment/wallet/personal', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 10:11:08', 1399985191002447872, '2022-03-10 17:06:10', 2, 0); -INSERT INTO `iam_perm_menu` VALUES (1501847310319972352, 'admin', 1450822842995130368, '组合支付', 'CombinationCashier', NULL, b'0', '', b'0', b'0', 'payment/combination/CombinationCashier', NULL, '/payment/combination', '', -0.5, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 17:07:56', 1399985191002447872, '2022-03-10 17:09:28', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1501847310319972352, 'admin', 1546850918849249280, '组合支付', 'CombinationCashier', NULL, b'0', '', b'0', b'0', 'payment/combination/CombinationCashier', NULL, '/demo/pay/combination', '', -0.5, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-10 17:07:56', 1399985191002447872, '2022-07-12 21:37:59', 4, 0); INSERT INTO `iam_perm_menu` VALUES (1502926397176242176, 'admin', 1450822842995130368, '储值卡', 'Voucher', NULL, b'0', '', b'0', b'0', 'payment/voucher/VoucherList', NULL, '/payment/voucher', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-13 16:35:51', 1399985191002447872, '2022-03-14 19:39:45', 2, 0); INSERT INTO `iam_perm_menu` VALUES (1506910599819165696, 'admin', 1495969099987963904, '数据权限', 'DataPermDemoList', NULL, b'0', '', b'0', b'0', 'demo/data/perm/DataPermDemoList', NULL, '/demo/data/perm', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-24 16:27:39', 1399985191002447872, '2022-03-24 16:28:56', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1506910885463851008, 'admin', 1495969099987963904, '加密解密', 'DataEncryptDemo', NULL, b'0', '', b'0', b'0', 'demo/data/encrypt/DataEncryptDemoList', NULL, '/demo/data/encrypt', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-03-24 16:28:47', 1399985191002447872, '2022-03-24 16:28:47', 0, 0); @@ -1022,12 +1031,14 @@ INSERT INTO `iam_perm_menu` VALUES (1534008203006652416, 'admin', 14311526898325 INSERT INTO `iam_perm_menu` VALUES (1535451167008436224, 'admin', 1431152689832525824, '系统信息', 'SysInfo', NULL, b'0', '', b'0', b'0', 'starter/monitor/SystemInfoMonitor', NULL, '/monitor/sysinfo', '', 0, 1, NULL, b'0', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-11 10:37:40', 1399985191002447872, '2022-06-13 13:07:46', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1535965936371085312, 'admin', 1431152689832525824, 'Redis监控', 'RedisInfoMonitor', NULL, b'0', '', b'0', b'0', 'starter/monitor/RedisInfoMonitor', NULL, '/monitor/redis', '', 0, 1, NULL, b'0', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-12 20:43:11', 1399985191002447872, '2022-06-13 13:07:38', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1537730140522348544, 'admin', 1438061887002759168, '站内信', 'SiteMessage', '', b'0', '', b'0', b'0', 'notice/site/SiteMessage', NULL, '/notice/siteMessage', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:33:30', 1399985191002447872, '2022-06-17 17:33:30', 0, 0); -INSERT INTO `iam_perm_menu` VALUES (1537732440632524800, 'admin', NULL, '个人办公', 'person', '', b'0', 'user', b'0', b'0', 'RouteView', NULL, '/person', '', -99, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:42:38', 1399985191002447872, '2022-06-17 17:45:24', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1537732440632524800, 'admin', NULL, '个人办公', 'person', '', b'0', 'user', b'1', b'0', 'RouteView', NULL, '/person', '', -99, 0, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:42:38', 1399985191002447872, '2022-07-04 22:28:06', 3, 0); INSERT INTO `iam_perm_menu` VALUES (1537733801860333568, 'admin', 1537732440632524800, '我的消息', 'PersonSiteMessage', NULL, b'0', '', b'0', b'0', 'Dev', NULL, '/person/siteMessage', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:48:03', 1399985191002447872, '2022-06-21 20:52:50', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1537735851818024960, 'admin', 1537732440632524800, '待办任务', 'PersonTaskList', NULL, b'0', '', b'0', b'0', 'Dev', NULL, '/person/taskList', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-17 17:56:11', 1399985191002447872, '2022-06-21 20:52:42', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1538160478872625152, 'admin', 1495968302034210816, '富文本编辑', 'WangEditorDemo', NULL, b'0', '', b'0', b'0', 'demo/wangeditor/WangEditorDemo', NULL, '/demo/wangEditor', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-18 22:03:30', 1399985191002447872, '2022-06-18 22:03:31', 0, 0); -INSERT INTO `iam_perm_menu` VALUES (1541355214204030976, 'admin', 1541427353886859264, '认证应用', 'AuthApplication', '', b'0', '', b'0', b'0', 'system/client/ApplicationList', NULL, '/system/config/application', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:37:08', 1399985191002447872, '2022-06-27 22:25:37', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1541355214204030976, 'admin', 1541427353886859264, '认证终端', 'Client', '', b'0', '', b'0', b'0', 'system/client/ClientList', NULL, '/system/config/client', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2021-08-27 10:37:08', 1399985191002447872, '2022-07-05 21:17:45', 3, 0); INSERT INTO `iam_perm_menu` VALUES (1541427353886859264, 'admin', 1414596052497092608, '认证管理', 'Auth', '', b'0', '', b'0', b'0', 'RouteView', NULL, '/system/auth', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-06-27 22:24:54', 1399985191002447872, '2022-06-27 22:24:54', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1544952211901218816, 'admin', 1546850918849249280, '支付结算台演示', 'CashierDemo', NULL, b'0', '', b'0', b'0', '', NULL, '/cashier', '', 0, 1, NULL, b'0', b'1', b'0', b'0', NULL, 1399985191002447872, '2022-07-07 15:51:26', 1399985191002447872, '2022-07-12 21:36:34', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1546850918849249280, 'admin', 1495968302034210816, '支付演示', 'DemoPay', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/demo/pay', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-07-12 21:36:13', 1399985191002447872, '2022-07-12 21:36:13', 0, 0); -- ---------------------------- -- Table structure for iam_perm_path @@ -1090,7 +1101,7 @@ DROP TABLE IF EXISTS `iam_role_menu`; CREATE TABLE `iam_role_menu` ( `id` bigint(20) NOT NULL, `role_id` bigint(20) NOT NULL COMMENT '角色id', - `app_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '应用code', + `client_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '终端code', `permission_id` bigint(20) NOT NULL COMMENT '菜单权限id', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色菜单权限表' ROW_FORMAT = DYNAMIC; @@ -1180,8 +1191,8 @@ CREATE TABLE `iam_user_expand_info` ( -- ---------------------------- -- Records of iam_user_expand_info -- ---------------------------- -INSERT INTO `iam_user_expand_info` VALUES (1399985191002447872, 1, '1996-12-01', '1495331905770315776', '2022-07-02 16:26:31', '2022-07-02 17:21:14', b'0', '2022-06-19 21:25:00', 1, '2021-06-02 15:04:15', 0, '2022-07-02 17:21:14', 253, 0); -INSERT INTO `iam_user_expand_info` VALUES (1414143554414059520, 1, NULL, '1530065639127871488', NULL, '2022-05-27 13:56:02', b'0', NULL, 1, '2021-07-11 16:44:32', 1414143554414059520, '2022-05-27 13:57:32', 2, 0); +INSERT INTO `iam_user_expand_info` VALUES (1399985191002447872, 1, '1996-12-01', '1495331905770315776', '2022-07-12 15:20:44', '2022-07-12 21:35:26', b'0', '2022-06-19 21:25:00', 1, '2021-06-02 15:04:15', 0, '2022-07-12 21:35:26', 273, 0); +INSERT INTO `iam_user_expand_info` VALUES (1414143554414059520, 1, NULL, '1530065639127871488', '2022-05-27 13:56:02', '2022-07-04 22:39:33', b'0', NULL, 1, '2021-07-11 16:44:32', 0, '2022-07-04 22:39:33', 3, 0); INSERT INTO `iam_user_expand_info` VALUES (1435894470432456704, 1, NULL, NULL, NULL, NULL, b'0', '2022-06-29 00:39:23', 1399985191002447872, '2021-09-09 17:14:54', 0, '2022-06-29 00:39:23', 2, 0); INSERT INTO `iam_user_expand_info` VALUES (1435967884114194432, 1, NULL, NULL, NULL, '2022-05-31 15:59:42', b'0', NULL, 1414143554414059520, '2021-09-09 22:06:37', 0, '2022-05-31 15:59:42', 1, 0); INSERT INTO `iam_user_expand_info` VALUES (1477990832987361280, 1, NULL, NULL, NULL, NULL, b'0', NULL, 1399985191002447872, '2022-01-03 21:10:49', 1399985191002447872, '2022-01-03 21:10:49', 0, 0); @@ -1199,7 +1210,7 @@ CREATE TABLE `iam_user_info` ( `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码', `phone` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机号', `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱', - `app_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '关联应用ds', + `client_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '关联终端ds', `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像', `source` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '注册来源', `admin` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否超级管理员', @@ -1242,10 +1253,10 @@ CREATE TABLE `iam_user_role` ( INSERT INTO `iam_user_role` VALUES (1533038443724980224, 1435894470432456704, 1405414804771971072); -- ---------------------------- --- Table structure for iam_user_social +-- Table structure for iam_user_third -- ---------------------------- -DROP TABLE IF EXISTS `iam_user_social`; -CREATE TABLE `iam_user_social` ( +DROP TABLE IF EXISTS `iam_user_third`; +CREATE TABLE `iam_user_third` ( `id` bigint(20) NOT NULL COMMENT '主键', `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', `we_chat_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信openId', @@ -1265,15 +1276,14 @@ CREATE TABLE `iam_user_social` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户三方登录绑定' ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of iam_user_social +-- Records of iam_user_third -- ---------------------------- -INSERT INTO `iam_user_social` VALUES (1399985191002447872, 1399985191002447872, NULL, NULL, NULL, NULL, NULL, NULL, 0, '2022-06-29 18:44:34', 1399985191002447872, '2022-07-02 14:50:16', 4, 0); -- ---------------------------- --- Table structure for iam_user_social_info +-- Table structure for iam_user_third_info -- ---------------------------- -DROP TABLE IF EXISTS `iam_user_social_info`; -CREATE TABLE `iam_user_social_info` ( +DROP TABLE IF EXISTS `iam_user_third_info`; +CREATE TABLE `iam_user_third_info` ( `id` bigint(20) NOT NULL COMMENT '主键', `user_id` bigint(20) NOT NULL COMMENT '用户id', `client_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '第三方终端类型', @@ -1291,7 +1301,7 @@ CREATE TABLE `iam_user_social_info` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户三方登录绑定详情' ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of iam_user_social_info +-- Records of iam_user_third_info -- ---------------------------- -- ---------------------------- @@ -1639,17 +1649,17 @@ CREATE TABLE `pay_alipay_config` ( `alipay_cert` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付宝公钥证书', `alipay_root_cert` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付宝CA根证书', `sandbox` bit(1) NOT NULL COMMENT '是否沙箱环境', - `expire_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '超时配置', + `expire_time` int(10) NOT NULL COMMENT '超时配置', `pay_ways` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支持的支付类型', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', `activity` bit(1) NOT NULL COMMENT '是否启用', `state` int(11) NOT NULL COMMENT '状态', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付宝配置' ROW_FORMAT = DYNAMIC; @@ -1738,9 +1748,9 @@ DROP TABLE IF EXISTS `pay_payment`; CREATE TABLE `pay_payment` ( `id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL COMMENT '用户id', - `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务id', - `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + `business_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务id', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `description` varchar(240) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', `amount` decimal(19, 2) NOT NULL COMMENT '金额', `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款余额', `pay_status` int(11) NOT NULL COMMENT '支付状态', @@ -1760,7 +1770,8 @@ CREATE TABLE `pay_payment` ( `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', `version` int(11) NOT NULL COMMENT '版本', `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `uniq_business_id`(`business_id`) USING BTREE COMMENT '业务编号id, 唯一ID' ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '支付记录' ROW_FORMAT = DYNAMIC; -- ---------------------------- @@ -1965,34 +1976,32 @@ CREATE TABLE `pay_wallet_payment` ( -- ---------------------------- DROP TABLE IF EXISTS `pay_wechat_pay_config`; CREATE TABLE `pay_wechat_pay_config` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', - `app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信应用AppId', - `sl_app_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商应用编号', - `api_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 API 密钥', - `api_key3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv3 密钥', - `mch_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户号', - `sl_mch_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商商户号', - `auth_type` int(3) NULL DEFAULT NULL COMMENT '认证方式', - `cert_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'API 证书中的 p12', - `cert_pem_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'API 证书中的 key.pem', - `key_pem_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'API 证书中的 cert.pem', + `id` bigint(20) NOT NULL COMMENT '主键', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', + `app_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信应用AppId', + `mch_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户号', + `api_version` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商应用编号', + `api_key_v2` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv2 密钥', + `api_key_v3` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv3 密钥', + `app_secret` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'APPID对应的接口密码,用于获取接口调用凭证access_token时使用', + `p12` bigint(20) NULL DEFAULT NULL COMMENT 'p12的文件id', + `cert_pem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'API 证书中的 cert.pem', + `key_pem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'API 证书中的 key.pem', `domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用域名,回调中会使用此参数', `notify_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务器异步通知页面路径', `return_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '页面跳转同步通知页面路径', - `partner_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '同 apiKey 后续版本会舍弃', - `is_default` bit(1) NULL DEFAULT NULL COMMENT '是否默认', - `pay_ways` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支持的支付类型', + `pay_ways` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支持的支付类型', `sandbox` bit(1) NOT NULL COMMENT '是否沙箱环境', + `expire_time` int(10) NOT NULL COMMENT '超时配置', `activity` bit(1) NOT NULL COMMENT '是否启用', `state` int(11) NULL DEFAULT NULL COMMENT '状态', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信支付配置' ROW_FORMAT = DYNAMIC; @@ -2014,13 +2023,12 @@ CREATE TABLE `pay_wechat_payment` ( `refundable_balance` decimal(19, 2) NULL DEFAULT NULL COMMENT '可退款金额', `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NOT NULL, + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '版本', + `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信支付记录' ROW_FORMAT = DYNAMIC; @@ -2078,6 +2086,7 @@ CREATE TABLE `qrtz_cron_triggers` ( -- ---------------------------- -- Records of qrtz_cron_triggers -- ---------------------------- +INSERT INTO `qrtz_cron_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '0/5 * * * * ? *', 'Asia/Shanghai'); -- ---------------------------- -- Table structure for qrtz_fired_triggers @@ -2109,6 +2118,7 @@ CREATE TABLE `qrtz_fired_triggers` ( -- ---------------------------- -- Records of qrtz_fired_triggers -- ---------------------------- +INSERT INTO `qrtz_fired_triggers` VALUES ('quartzScheduler', 'NON_CLUSTERED1657772921496', '1546857070483939328', 'DEFAULT', 'NON_CLUSTERED', 1657774220709, 1657774225000, 5, 'ACQUIRED', NULL, NULL, '0', '0'); -- ---------------------------- -- Table structure for qrtz_job_details @@ -2133,6 +2143,7 @@ CREATE TABLE `qrtz_job_details` ( -- ---------------------------- -- Records of qrtz_job_details -- ---------------------------- +INSERT INTO `qrtz_job_details` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', NULL, 'cn.bootx.payment.task.PayExpiredTimeTask', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C77080000001000000001740009706172616D65746572707800); -- ---------------------------- -- Table structure for qrtz_locks @@ -2267,6 +2278,7 @@ CREATE TABLE `qrtz_triggers` ( -- ---------------------------- -- Records of qrtz_triggers -- ---------------------------- +INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '1546857070483939328', 'DEFAULT', NULL, 1657774225000, 1657774220000, 5, 'ACQUIRED', 'CRON', 1657634445000, 0, NULL, 0, ''); -- ---------------------------- -- Table structure for sales_activity @@ -2663,6 +2675,7 @@ CREATE TABLE `starter_quartz_job` ( -- Records of starter_quartz_job -- ---------------------------- INSERT INTO `starter_quartz_job` VALUES (1456579473573867520, '测试任务', 'cn.bootx.starter.quartz.task.TestTask', '50 0 * * * ? *', '{\"aaa\":\"5255\"}', 0, '测试任务', 1399985191002447872, '2021-11-05 19:09:43', 1399985191002447872, '2022-06-22 00:37:48', 25, 0); +INSERT INTO `starter_quartz_job` VALUES (1546857070483939328, '支付单超时检测', 'cn.bootx.payment.task.PayExpiredTimeTask', '0/5 * * * * ? *', NULL, 1, '检测超时的支付单, 超时后发送超时事件', 1399985191002447872, '2022-07-12 22:00:39', 1399985191002447872, '2022-07-12 22:00:45', 1, 0); -- ---------------------------- -- Table structure for starter_quartz_job_log diff --git a/_doc/ChangeLog.md b/_doc/ChangeLog.md index 66c4fdbe88cada2654c3b308c247d5b56c951281..d65983061d6a2ffc3d88e6fec0bdde97432b0bde 100644 --- a/_doc/ChangeLog.md +++ b/_doc/ChangeLog.md @@ -1,5 +1,22 @@ # CHANGELOG ## [v1.1.0-bate-5] 一号线-工研院.测试版5 +- 微信支付,支持扫码支付、付款码支付、公众号支付、小程序支付、APP支付 +- 支付宝支付,支持扫码支付、PC网站支付、H5网站支付、付款码支付 +- 钱包支付,支持钱包支付 +- 储值卡支付,支持多卡组合支付和单卡多次支付 +- 现金支付,支持现金支付 +- 聚合支付,支持微信和支付宝二维码扫码或付款码支付 +- 组合支付,支持一种异步支付方式和多种同步支付方式进行合并支付 +- 增加退款功能,支持多次部分退款和全额退款 +- 增加支付信息同步功能,支持手动和自动与支付网关同步支付状态 +- 增加支付定时关闭功能,使用定时时间轮+消息通知实现 +- 增加结算收银台演示,演示微信和支付各种方式的支付,以及扫码和付款码的聚合支付演示 +- 增加简单支付收银台演示,演示单渠道支付 +- 增加组合支付演示,演示多种支付方式组合进行支付 +- 增加`JacksonListTypeHandler` `MyBatis-Plus`的类型处理器 +- 优化系统中注入的`Jackson`的`ObjectMapper`注入,增加携带类型信息`ObjectMapper`注入 +- 优化`JacksonUtil`方法设置`ObjectMapper`限制,增加支持序列化带类型信息的Json方法 +- fix: 前端业务页面F5刷新后,字典项有几率获取不到 ## [v1.1.0-bate-4-fix] 一号线-工研院.测试版4-优化版 - 重构认证应用和认证终端重新设计为认证终端和登录方式 diff --git a/bootx-common-core/pom.xml b/bootx-common-core/pom.xml index 79599b7820953c27ef0757631998ea6489abf4d2..a4d95c5fdce1751acde8abde3fecf639265acd62 100644 --- a/bootx-common-core/pom.xml +++ b/bootx-common-core/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/JobLog.java b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/JobLog.java new file mode 100644 index 0000000000000000000000000000000000000000..92160164e7b12aacf6d16e9d60dd2cd496813820 --- /dev/null +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/JobLog.java @@ -0,0 +1,25 @@ +package cn.bootx.common.core.annotation; + +import java.lang.annotation.*; + +/** +* 定时任务日志 +* @author xxm +* @date 2022/7/12 +*/ +@Target({ElementType.METHOD,ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface JobLog { + + /** + * 是否记录正常日志 + */ + boolean log() default true; + + /** + * 是否记录异常日志 + */ + boolean errorLog() default true; +} diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/code/CommonCode.java b/bootx-common-core/src/main/java/cn/bootx/common/core/code/CommonCode.java index 0bca37a4d84f91aba8990bb58cced6cb7676c0e7..fe28e390c050489c9704754465c8a596e0ec49d7 100644 --- a/bootx-common-core/src/main/java/cn/bootx/common/core/code/CommonCode.java +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/code/CommonCode.java @@ -7,6 +7,9 @@ package cn.bootx.common.core.code; */ public interface CommonCode { + /** 服务器地址 */ + String SERVER_URL = "ServerUrl"; + /** 开发环境 */ String ENV_DEV = "dev"; /** 测试环境 */ diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/util/LocalDateTimeUtil.java b/bootx-common-core/src/main/java/cn/bootx/common/core/util/LocalDateTimeUtil.java index e4ae76021dc6e34b44dbd1a0a508e4264ae80fad..d6bf438864179fb071056ca1624605ab09c22f4d 100644 --- a/bootx-common-core/src/main/java/cn/bootx/common/core/util/LocalDateTimeUtil.java +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/util/LocalDateTimeUtil.java @@ -13,7 +13,7 @@ import java.time.ZoneId; * @date 2020/11/10 */ @UtilityClass -public class LocalDateTimeUtil { +public class LocalDateTimeUtil extends cn.hutool.core.date.LocalDateTimeUtil { /** * 是否在指定的时间范围内 diff --git a/bootx-common-starters/common-starter-audit-log/README.md b/bootx-common-starters/common-starter-audit-log/README.md index 38f0bec80f5aab673a597dffc3f802415529521e..a0a399ea56e1ac204b839ef5ad49ccf34d7b741b 100644 --- a/bootx-common-starters/common-starter-audit-log/README.md +++ b/bootx-common-starters/common-starter-audit-log/README.md @@ -135,7 +135,6 @@ public class OperateLogParam { ### 数据版本记录 -TODO 开发中 ### 参数配置 diff --git a/bootx-common-starters/common-starter-audit-log/pom.xml b/bootx-common-starters/common-starter-audit-log/pom.xml index 666b2abf924accc58ab34818a35b19426cb919a6..f58c64c50e34e886f53ff5d34e53392049d8c859 100644 --- a/bootx-common-starters/common-starter-audit-log/pom.xml +++ b/bootx-common-starters/common-starter-audit-log/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-starters/common-starter-auth/pom.xml b/bootx-common-starters/common-starter-auth/pom.xml index a50aebf3e6f70be286a7224b8724526e9d695f32..aab1dd8a36bd361782a6b214e8eeaf3dfe8e4407 100644 --- a/bootx-common-starters/common-starter-auth/pom.xml +++ b/bootx-common-starters/common-starter-auth/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 common-starter-auth diff --git a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/online/OnlineUserService.java b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/online/OnlineUserService.java index 32905580f694f060490ec3fb8bca841b96b2d16d..22cb875c8ce88efcd4d823ef63960369e18e349e 100644 --- a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/online/OnlineUserService.java +++ b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/online/OnlineUserService.java @@ -7,9 +7,9 @@ import cn.bootx.common.core.enums.BusinessType; import cn.bootx.common.core.exception.BizException; import cn.bootx.common.core.rest.PageResult; import cn.bootx.common.core.rest.param.PageParam; +import cn.bootx.common.core.util.LocalDateTimeUtil; import cn.dev33.satoken.session.SaSession; import cn.dev33.satoken.stp.StpUtil; -import cn.hutool.core.date.LocalDateTimeUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; diff --git a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/redis/SaTokenRedisConfiguration.java b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/redis/SaTokenRedisConfiguration.java index a15625f7f53f0f9770e511ffb4ea1b5cc9a5e128..62d43ea0769790f1e690250d826b89cba6453f24 100644 --- a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/redis/SaTokenRedisConfiguration.java +++ b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/redis/SaTokenRedisConfiguration.java @@ -39,7 +39,7 @@ public class SaTokenRedisConfiguration { private final RedisConnectionFactory connectionFactory; @Resource - private ObjectMapper redisObjectMapper; + private ObjectMapper typeObjectMapper; /** * 配置信息的前缀 @@ -133,7 +133,7 @@ public class SaTokenRedisConfiguration { */ protected RedisTemplate objectRedisTemplate(){ StringRedisSerializer keySerializer = new StringRedisSerializer(); - RedisSerializer valueSerializer = new GenericJackson2JsonRedisSerializer(redisObjectMapper); + RedisSerializer valueSerializer = new GenericJackson2JsonRedisSerializer(typeObjectMapper); // 构建RedisTemplate RedisTemplate template = new RedisTemplate<>(); diff --git a/bootx-common-starters/common-starter-code-gen/pom.xml b/bootx-common-starters/common-starter-code-gen/pom.xml index 88c14e5c47bee23557a5d7f8ee0caebd849c3ab3..8e77fa41bd0f52937c72ef30d8da736419fb056f 100644 --- a/bootx-common-starters/common-starter-code-gen/pom.xml +++ b/bootx-common-starters/common-starter-code-gen/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-starters/common-starter-data-perm/pom.xml b/bootx-common-starters/common-starter-data-perm/pom.xml index e32bd6027622cb833b70daa111d0ca944ef971a8..1a389897f7301d97886cb7f98dca3a3c53fe081a 100644 --- a/bootx-common-starters/common-starter-data-perm/pom.xml +++ b/bootx-common-starters/common-starter-data-perm/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-starters/common-starter-dingtalk/pom.xml b/bootx-common-starters/common-starter-dingtalk/pom.xml index 1d50ee2c815ad3750123caa40ed9260d9be82cf6..2aa626d19b3448ffd685c08d8cc3cb5e9c54fa80 100644 --- a/bootx-common-starters/common-starter-dingtalk/pom.xml +++ b/bootx-common-starters/common-starter-dingtalk/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-starters/common-starter-file/pom.xml b/bootx-common-starters/common-starter-file/pom.xml index 3c0dbd7e8e5ea9d9fe00903aa40151afaf117ed8..949a14990cba5b7546bbca0de4516d653f8c25fd 100644 --- a/bootx-common-starters/common-starter-file/pom.xml +++ b/bootx-common-starters/common-starter-file/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/controller/FIleUpLoadController.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/controller/FIleUpLoadController.java index 7c2f873369910c977ddd273d6266f17867c02bef..d92f086bce3799588771557d826f9c711157e6b6 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/controller/FIleUpLoadController.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/controller/FIleUpLoadController.java @@ -70,8 +70,8 @@ public class FIleUpLoadController { @Operation(summary = "下载文件") @GetMapping("/download/{id}") - public ResponseEntity download(@PathVariable Long id, HttpServletResponse response){ - return uploadService.download(id,response); + public ResponseEntity download(@PathVariable Long id){ + return uploadService.download(id); } } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/FileUploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/FileUploadService.java index 5402e78a6297b14b9128445bd57921c5924d0ea1..fce0012cc587a586990da707e89df1661663174e 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/FileUploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/FileUploadService.java @@ -32,7 +32,7 @@ import java.nio.charset.StandardCharsets; import java.util.List; /** -* 文件上传 +* 文件上传管理类 * @author xxm * @date 2022/1/14 */ @@ -64,7 +64,7 @@ public class FileUploadService { if (StrUtil.isBlank(fileName)){ fileName = file.getOriginalFilename(); } - String fileType = FileTypeUtil.getType(file.getInputStream()); + String fileType = FileTypeUtil.getType(file.getInputStream(),fileName); String fileSuffix = fileType; // 获取不到类型名,后缀名使用上传文件名称的后缀 @@ -101,14 +101,14 @@ public class FileUploadService { /** * 文件下载 */ - public ResponseEntity download(Long id, HttpServletResponse response){ + public ResponseEntity download(Long id){ val uploadType = fileUploadProperties.getUploadType(); UploadService uploadService = uploadServices.stream() .filter(s -> s.enable(uploadType)) .findFirst() - .orElseThrow(() -> new BizException("未找到该类的上传处理器")); + .orElseThrow(() -> new BizException("未找到该类文件的处理器")); UpdateFileInfo updateFileInfo = updateFileManager.findById(id).orElseThrow(() -> new BizException("文件不存在")); - InputStream inputStream = uploadService.download(updateFileInfo, response); + InputStream inputStream = uploadService.download(updateFileInfo); //设置header信息 HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); @@ -117,6 +117,20 @@ public class FileUploadService { return new ResponseEntity<>(IoUtil.readBytes(inputStream),headers, HttpStatus.OK); } + /** + * 获取文件字节数组 + */ + public byte[] getFileBytes(Long id){ + val uploadType = fileUploadProperties.getUploadType(); + UploadService uploadService = uploadServices.stream() + .filter(s -> s.enable(uploadType)) + .findFirst() + .orElseThrow(() -> new BizException("未找到该类文件的处理器")); + UpdateFileInfo updateFileInfo = updateFileManager.findById(id).orElseThrow(() -> new BizException("文件不存在")); + InputStream inputStream = uploadService.download(updateFileInfo); + return IoUtil.readBytes(inputStream); + } + /** * 分页 */ diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java index 87f3259f72c3cb5f2d44755542cc8330b46d43eb..832a2c9d6ecd5239017d6b22b02a4e8946827e84 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java @@ -30,5 +30,5 @@ public interface UploadService { /** * 下载文件 */ - InputStream download(UpdateFileInfo updateFileInfo, HttpServletResponse response); + InputStream download(UpdateFileInfo updateFileInfo); } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java index 43f7789ff1754f4eb7a9350f915ed33641fbf7cf..44e6979a9282f94ad4394445162d2990738b72dd 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java @@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import java.nio.file.Files; import java.util.Optional; /** @@ -80,12 +81,12 @@ public class LocalUploadService implements UploadService { */ @SneakyThrows @Override - public InputStream download(UpdateFileInfo updateFileInfo, HttpServletResponse response){ + public InputStream download(UpdateFileInfo updateFileInfo){ String storePath = fileUploadProperties.getLocal().getLocalPath() + updateFileInfo.getFilePath(); File file = new File(storePath); if (!file.exists()){ throw new BizException("文件不存在"); } - return new FileInputStream(file); + return Files.newInputStream(file.toPath()); } } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java index 96a5080a19e1a43c7c73f9aa72a118fd482ebce6..965056e421d27d8ab4d30edb808ad158086d5b10 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java @@ -73,7 +73,7 @@ public class MongoUploadService implements UploadService { @SneakyThrows @Override - public InputStream download(UpdateFileInfo updateFileInfo, HttpServletResponse response) { + public InputStream download(UpdateFileInfo updateFileInfo) { Criteria criteria = Criteria.where("_id").is(new ObjectId(updateFileInfo.getExternalStorageId())); Query query = new Query(criteria); diff --git a/bootx-common-starters/common-starter-monitor/pom.xml b/bootx-common-starters/common-starter-monitor/pom.xml index b7dbc97c554fa3dd3f1d3897aa5ce32fe6576abd..c8df475829a07c9f8b70851f2524b345f5529ea4 100644 --- a/bootx-common-starters/common-starter-monitor/pom.xml +++ b/bootx-common-starters/common-starter-monitor/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 jar diff --git a/bootx-common-starters/common-starter-quartz/pom.xml b/bootx-common-starters/common-starter-quartz/pom.xml index 533d4456f9fd43be001b3debfe42920e5ccb6812..6d501c19470acec53127a1d7b9d4ba99f61af73c 100644 --- a/bootx-common-starters/common-starter-quartz/pom.xml +++ b/bootx-common-starters/common-starter-quartz/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-common-starters/common-starter-quartz/src/main/java/cn/bootx/starter/quartz/handler/JobLogAspectHandler.java b/bootx-common-starters/common-starter-quartz/src/main/java/cn/bootx/starter/quartz/handler/JobLogAspectHandler.java index ffa433b5ec8cf0c803a513f3f336eeac6050dccd..9b73ee871e8931646454f43484a0c1bf8a2c0657 100644 --- a/bootx-common-starters/common-starter-quartz/src/main/java/cn/bootx/starter/quartz/handler/JobLogAspectHandler.java +++ b/bootx-common-starters/common-starter-quartz/src/main/java/cn/bootx/starter/quartz/handler/JobLogAspectHandler.java @@ -1,8 +1,9 @@ package cn.bootx.starter.quartz.handler; +import cn.bootx.common.core.annotation.JobLog; +import cn.bootx.common.core.util.LocalDateTimeUtil; import cn.bootx.starter.quartz.core.entity.QuartzJobLog; import cn.bootx.starter.quartz.core.service.QuartzJobLogService; -import cn.hutool.core.date.LocalDateTimeUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; @@ -12,6 +13,7 @@ import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component; import java.time.LocalDateTime; +import java.util.Optional; /** * 定时任务日志切面 @@ -37,16 +39,21 @@ public class JobLogAspectHandler { @Around("logPointCut()") public Object doAfterReturning(ProceedingJoinPoint pjp) throws Throwable { Class clazz = pjp.getTarget().getClass(); + JobLog jobLog = clazz.getAnnotation(JobLog.class); LocalDateTime start = LocalDateTime.now(); try { Object result = pjp.proceed(); LocalDateTime end = LocalDateTime.now(); - this.addLog(clazz,start,end); - // 保存正常日志 + if (Optional.ofNullable(jobLog).map(JobLog::log).orElse(false)){ + // 保存正常日志 + this.addLog(clazz,start,end); + } return result; } catch (Throwable e) { - // 保存异常日志 - this.addErrLog(clazz, start, e.getMessage()); + if (Optional.ofNullable(jobLog).map(JobLog::errorLog).orElse(false)){ + // 保存异常日志 + this.addErrLog(clazz, start, e.getMessage()); + } throw e; } } diff --git a/bootx-common-starters/pom.xml b/bootx-common-starters/pom.xml index d06ddda977889620af8131d984ba55db3d8cb5a9..c253908c6036bc3120c648248ce0842f256944a3 100644 --- a/bootx-common-starters/pom.xml +++ b/bootx-common-starters/pom.xml @@ -5,7 +5,7 @@ bootx-platform cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-cache/pom.xml b/bootx-commons/common-cache/pom.xml index 5d6246bbe1447c390a0bd2766983dbc8d7c79a5b..f9f911c7428c093f6fe85465c44e3da2973021ac 100644 --- a/bootx-commons/common-cache/pom.xml +++ b/bootx-commons/common-cache/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-cache/src/main/java/cn/bootx/common/cache/CachingConfiguration.java b/bootx-commons/common-cache/src/main/java/cn/bootx/common/cache/CachingConfiguration.java index 896741e190556d73f7c266cbdc13204419d68ab9..d3454abe1d0cf73749e6388b99dce43cde9aed8f 100644 --- a/bootx-commons/common-cache/src/main/java/cn/bootx/common/cache/CachingConfiguration.java +++ b/bootx-commons/common-cache/src/main/java/cn/bootx/common/cache/CachingConfiguration.java @@ -33,11 +33,11 @@ import java.time.Duration; public class CachingConfiguration extends CachingConfigurerSupport { private final CachingProperties cachingProperties; - private final ObjectMapper redisObjectMapper; + private final ObjectMapper typeObjectMapper; - public CachingConfiguration(CachingProperties cachingProperties, @Qualifier("redisObjectMapper") ObjectMapper redisObjectMapper) { + public CachingConfiguration(CachingProperties cachingProperties, @Qualifier("typeObjectMapper") ObjectMapper typeObjectMapper) { this.cachingProperties = cachingProperties; - this.redisObjectMapper = redisObjectMapper; + this.typeObjectMapper = typeObjectMapper; } /** @@ -70,7 +70,7 @@ public class CachingConfiguration extends CachingConfigurerSupport { private RedisCacheConfiguration getRedisCacheConfigurationWithTtl(Duration duration) { // 序列化方式 Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); - jackson2JsonRedisSerializer.setObjectMapper(redisObjectMapper); + jackson2JsonRedisSerializer.setObjectMapper(typeObjectMapper); // redis缓存配置 return RedisCacheConfiguration diff --git a/bootx-commons/common-exception-handler/pom.xml b/bootx-commons/common-exception-handler/pom.xml index 109876dde8fa83d2e0f74615450aa8e3cfa0aedb..632a24f518de8ac7ce5c74659a66f4fe74e4e8f4 100644 --- a/bootx-commons/common-exception-handler/pom.xml +++ b/bootx-commons/common-exception-handler/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 common-exception-handler diff --git a/bootx-commons/common-header-holder/pom.xml b/bootx-commons/common-header-holder/pom.xml index a87a7d09bee10923d79ae77da4fa7de4b55128db..fdee722b07659fac78fb96fbd3c0cebe2f1e3d0d 100644 --- a/bootx-commons/common-header-holder/pom.xml +++ b/bootx-commons/common-header-holder/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-idempotency/pom.xml b/bootx-commons/common-idempotency/pom.xml index ef21839dfcba4cd2f3e503ae44efdeb252c45d52..e5b6d442603d2e9d024af25e0bfb766dffc26b0c 100644 --- a/bootx-commons/common-idempotency/pom.xml +++ b/bootx-commons/common-idempotency/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-jackson/pom.xml b/bootx-commons/common-jackson/pom.xml index a3a6ffad854afd7ff59017e1164f0777fcf651ac..ebe91954c3f01da029ee81f11a7b62a1ab42ccd5 100644 --- a/bootx-commons/common-jackson/pom.xml +++ b/bootx-commons/common-jackson/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/configuration/JacksonConfiguration.java b/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/configuration/JacksonConfiguration.java index fc1d0996c2a35fa7f3ad05655283694cf5747883..27717a8fa6bfa3e3b566c482528433bbed04b95e 100644 --- a/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/configuration/JacksonConfiguration.java +++ b/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/configuration/JacksonConfiguration.java @@ -2,12 +2,16 @@ package cn.bootx.common.jackson.configuration; import cn.bootx.common.jackson.jdk.Java8TimeModule; import cn.bootx.common.jackson.jdk.JavaLongTypeModule; +import cn.bootx.common.jackson.util.JacksonUtil; import cn.hutool.core.date.DatePattern; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -48,7 +52,7 @@ public class JacksonConfiguration { @Bean @Primary public ObjectMapper objectMapper() { - return new ObjectMapper() + ObjectMapper objectMapper = new ObjectMapper() //指定要序列化的域 .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY) // 不将日期写为时间戳 @@ -61,5 +65,25 @@ public class JacksonConfiguration { .registerModule(new Jdk8Module()) .registerModule(new JavaLongTypeModule()) .registerModule(new SimpleModule()); + JacksonUtil.setObjectMapper(objectMapper); + return objectMapper; + } + + + /** + * 序列化配置 ObjectMapper 对象 + * 会记录被序列化的类型信息, 反序列化时直接能反序列化回原始的对象类型 + */ + @Bean + public ObjectMapper typeObjectMapper(ObjectMapper objectMapper) { + // 对象映射器 + ObjectMapper copy = objectMapper.copy(); + // 序列化是记录被序列化的类型信息 + //指定序列化输入的类型为非最终类型,除了少数“自然”类型(字符串、布尔值、整数、双精度),它们可以从 JSON 正确推断; 以及所有非最终类型的数组 + copy.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.WRAPPER_ARRAY) + // null 值不序列化 + .setSerializationInclusion(JsonInclude.Include.NON_NULL); + JacksonUtil.setTypeObjectMapper(copy); + return copy; } } diff --git a/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtil.java b/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtil.java index 3b2b5785e623faaeedcedf7421115635549867e9..38e7b7e63eca431a064ca0dc5a3646990d7e0dcb 100644 --- a/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtil.java +++ b/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtil.java @@ -1,5 +1,6 @@ package cn.bootx.common.jackson.util; +import cn.bootx.common.core.exception.RepetitiveOperationException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -12,12 +13,25 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j public class JacksonUtil { + private static boolean objectMapperFlag; + private static boolean typeObjectMapperFlag; private static ObjectMapper objectMapper; + private static ObjectMapper typeObjectMapper; - static void setObjectMapper(ObjectMapper objectMapper){ + public static void setObjectMapper(ObjectMapper objectMapper){ + if (objectMapperFlag){ + throw new RepetitiveOperationException(); + } JacksonUtil.objectMapper = objectMapper; } + public static void setTypeObjectMapper(ObjectMapper typeObjectMapper){ + if (typeObjectMapperFlag){ + throw new RepetitiveOperationException(); + } + JacksonUtil.typeObjectMapper = typeObjectMapper; + } + /** * 对象序列化为json字符串,转换异常将被抛出 */ @@ -51,4 +65,28 @@ public class JacksonUtil { throw new RuntimeException("json反序列化失败"); } } + + + /** + * 对象序列化为json字符串,转换异常将被抛出(携带类型信息) + */ + public static String toTypeJson(Object o){ + try { + return typeObjectMapper.writeValueAsString(o); + } catch (JsonProcessingException e) { + throw new RuntimeException("json序列化失败"); + } + } + + /** + * JSON字符串转为实体类对象,转换异常将被抛出 (携带类型信息) + */ + public static T toTypeBean(String content, Class valueType){ + try { + return typeObjectMapper.readValue(content,valueType); + } catch (JsonProcessingException e) { + log.error(e.getMessage(),e); + throw new RuntimeException("json反序列化失败"); + } + } } diff --git a/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtilsConfiguration.java b/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtilsConfiguration.java deleted file mode 100644 index debaa26e44d729d35b151743dd2de7b6aad4e044..0000000000000000000000000000000000000000 --- a/bootx-commons/common-jackson/src/main/java/cn/bootx/common/jackson/util/JacksonUtilsConfiguration.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.common.jackson.util; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.context.annotation.Configuration; - -import javax.validation.constraints.NotNull; - -/** -* 设置JacksonUtil 的 om对象 -* @author xxm -* @date 2021/7/6 -*/ -@Configuration -public class JacksonUtilsConfiguration implements BeanFactoryPostProcessor { - - @Override - public void postProcessBeanFactory(@NotNull ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException { - ObjectMapper bean = configurableListableBeanFactory.getBean(ObjectMapper.class); - JacksonUtil.setObjectMapper(bean); - } -} diff --git a/bootx-commons/common-lock/pom.xml b/bootx-commons/common-lock/pom.xml index e4448bd8eb34ca7d1a005c5f31ffcd72106e9c3c..1f0a81f8267175329640b5da9512cb39c18d5995 100644 --- a/bootx-commons/common-lock/pom.xml +++ b/bootx-commons/common-lock/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-log/pom.xml b/bootx-commons/common-log/pom.xml index 077507d1c2fd72860a4907e8ec4c65701aacb433..f9bc14fec6209e764aa28842ce4aff2723b99614 100644 --- a/bootx-commons/common-log/pom.xml +++ b/bootx-commons/common-log/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-mongo/pom.xml b/bootx-commons/common-mongo/pom.xml index 28f7fb84ff3237f5ce4d766ae883990f3221c2b0..5df832813d932e793034a62dde13cc1f0ac85641 100644 --- a/bootx-commons/common-mongo/pom.xml +++ b/bootx-commons/common-mongo/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 common-mongo diff --git a/bootx-commons/common-mqtt/pom.xml b/bootx-commons/common-mqtt/pom.xml index c30b733f84b9660fa4cede81eacc44b2afbc83a6..beb0398501c14b79b669b2c35ad2dd1542b99123 100644 --- a/bootx-commons/common-mqtt/pom.xml +++ b/bootx-commons/common-mqtt/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-mybatis-plus/pom.xml b/bootx-commons/common-mybatis-plus/pom.xml index b6dde927cd90ffae792b07bcc882b91e01fe2219..6fefcb84e773c69044ae711493b853e37d596e63 100644 --- a/bootx-commons/common-mybatis-plus/pom.xml +++ b/bootx-commons/common-mybatis-plus/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 @@ -21,5 +21,9 @@ com.baomidou mybatis-plus-boot-starter + + cn.bootx.platform + common-jackson + \ No newline at end of file diff --git a/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/handler/JacksonListTypeHandler.java b/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/handler/JacksonListTypeHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..b453adce6c56f4c75af3f8d0ffe39ee22477a7f0 --- /dev/null +++ b/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/handler/JacksonListTypeHandler.java @@ -0,0 +1,39 @@ +package cn.bootx.common.mybatisplus.handler; + +import cn.bootx.common.jackson.util.JacksonUtil; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; + +/** +* Jackson 实现 JSON 字段类型处理器, 会记录对象属性类型, 通常用于被容器(List、Set、Map)包装的属性上 +* @author xxm +* @date 2022/7/11 +*/ +@Slf4j +@MappedTypes({Object.class}) +@MappedJdbcTypes(JdbcType.VARCHAR) +public class JacksonListTypeHandler extends AbstractJsonTypeHandler { + private final Class type; + + public JacksonListTypeHandler(Class type) { + if (log.isTraceEnabled()) { + log.trace("JacksonListTypeHandler(" + type + ")"); + } + Assert.notNull(type, "Type argument cannot be null"); + this.type = type; + } + + @Override + protected Object parse(String json) { + return JacksonUtil.toTypeBean(json,type); + } + + @Override + protected String toJson(Object obj) { + return JacksonUtil.toTypeJson(obj); + } +} diff --git a/bootx-commons/common-rabbitmq/pom.xml b/bootx-commons/common-rabbitmq/pom.xml index f78f6a4cc89a009daf638e07bf84ac774e43621f..8e4e7c3c9d993a3046061c128719d575b38d2c50 100644 --- a/bootx-commons/common-rabbitmq/pom.xml +++ b/bootx-commons/common-rabbitmq/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-rabbitmq/src/main/java/cn/bootx/common/rabbit/configuration/RabbitMqConfigurer.java b/bootx-commons/common-rabbitmq/src/main/java/cn/bootx/common/rabbit/configuration/RabbitMqConfigurer.java index e887dcb8a088910bb7925bebc3f430d6c41c569a..002575735d837c25ad859d6b9a8afa04fc11105d 100644 --- a/bootx-commons/common-rabbitmq/src/main/java/cn/bootx/common/rabbit/configuration/RabbitMqConfigurer.java +++ b/bootx-commons/common-rabbitmq/src/main/java/cn/bootx/common/rabbit/configuration/RabbitMqConfigurer.java @@ -20,7 +20,7 @@ import org.springframework.messaging.handler.annotation.support.DefaultMessageHa public class RabbitMqConfigurer { /** - * 添加自定义序列化 + * 注册 RabbitTemplate 对象, 使用默认序列化方式 */ @Bean public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory,ObjectMapper objectMapper) { @@ -31,7 +31,7 @@ public class RabbitMqConfigurer { } /** - * 添加自定义序列化 + * 添加默认消息序列化方式, 使用默认序列化方式 */ @Bean public DefaultMessageHandlerMethodFactory jsonHandlerMethodFactory(ObjectMapper objectMapper) { diff --git a/bootx-commons/common-redis-client/pom.xml b/bootx-commons/common-redis-client/pom.xml index 9cd4a511f8710b8b2e09669b5a526bb953e1ae57..2083752589bd643616217b4985f8206b778c44cb 100644 --- a/bootx-commons/common-redis-client/pom.xml +++ b/bootx-commons/common-redis-client/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/configuration/RedisAutoConfiguration.java b/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/configuration/RedisAutoConfiguration.java index 3e6c598edf08d1316478b1ec56112dd58b4132aa..7cb905209e3028d8559ca1f736f21786c05b209a 100644 --- a/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/configuration/RedisAutoConfiguration.java +++ b/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/configuration/RedisAutoConfiguration.java @@ -6,10 +6,7 @@ import cn.bootx.common.redis.code.RedisCode; import cn.bootx.common.redis.listener.RedisTopicReceiver; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; import lombok.RequiredArgsConstructor; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.springframework.beans.factory.annotation.Qualifier; @@ -61,11 +58,11 @@ public class RedisAutoConfiguration { @Bean @Primary public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory, - @Qualifier("redisObjectMapper") ObjectMapper redisObjectMapper){ + @Qualifier("typeObjectMapper") ObjectMapper typeObjectMapper){ // 配置key和value的序列化方式 StringRedisSerializer keySerializer = new StringRedisSerializer(); - RedisSerializer valueSerializer = new GenericJackson2JsonRedisSerializer(redisObjectMapper); + RedisSerializer valueSerializer = new GenericJackson2JsonRedisSerializer(typeObjectMapper); // 构建RedisTemplate RedisTemplate template = new RedisTemplate<>(); @@ -143,7 +140,7 @@ public class RedisAutoConfiguration { public RedisMessageListenerContainer redisMessageListenerContainer( RedisConnectionFactory redisConnectionFactory, RedisTopicReceiver redisTopicReceiver, - ObjectMapper redisObjectMapper + ObjectMapper typeObjectMapper ) { RedisMessageListenerContainer redisMessageListenerContainer = new RedisMessageListenerContainer(); redisMessageListenerContainer.setConnectionFactory(redisConnectionFactory); @@ -151,24 +148,8 @@ public class RedisAutoConfiguration { // 消息订阅配置 MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(redisTopicReceiver); // 设置序列化方式 - messageListenerAdapter.setSerializer(new GenericJackson2JsonRedisSerializer(redisObjectMapper)); + messageListenerAdapter.setSerializer(new GenericJackson2JsonRedisSerializer(typeObjectMapper)); redisMessageListenerContainer.addMessageListener(messageListenerAdapter,new PatternTopic(RedisCode.TOPIC_PATTERN_TOPIC)); return redisMessageListenerContainer; } - - /** - * redis序列化配置 ObjectMapper 对象 - * 会记录被序列化的类型信息, 反序列化时直接能反序列化回原始的对象类型 - */ - @Bean - public ObjectMapper redisObjectMapper() { - // 对象映射器 - ObjectMapper copy = objectMapper.copy(); - // 序列化是记录被序列化的类型信息 - //指定序列化输入的类型为非最终类型,除了少数“自然”类型(字符串、布尔值、整数、双精度),它们可以从 JSON 正确推断; 以及所有非最终类型的数组 - copy.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.WRAPPER_ARRAY) - // null 值不序列化 - .setSerializationInclusion(JsonInclude.Include.NON_NULL); - return copy; - } } diff --git a/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/listener/RedisTopicReceiver.java b/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/listener/RedisTopicReceiver.java index 5930de912847beb0434cab458d6b3e6426add764..a30f31c2e564a4a661d54b64cab8bba2759dfa12 100644 --- a/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/listener/RedisTopicReceiver.java +++ b/bootx-commons/common-redis-client/src/main/java/cn/bootx/common/redis/listener/RedisTopicReceiver.java @@ -25,7 +25,7 @@ public class RedisTopicReceiver implements MessageListener { private final ObjectMapper objectMapper; public RedisTopicReceiver(List redisTopicListeners, - @Qualifier("redisObjectMapper") ObjectMapper objectMapper) { + @Qualifier("typeObjectMapper") ObjectMapper objectMapper) { this.redisTopicListeners = redisTopicListeners; this.objectMapper = objectMapper; } diff --git a/bootx-commons/common-sequence/pom.xml b/bootx-commons/common-sequence/pom.xml index b28697c0adce9bd85de270faab54e4ea66d7b427..ce18ab55be389a0e2252169254c5aaa70210b74a 100644 --- a/bootx-commons/common-sequence/pom.xml +++ b/bootx-commons/common-sequence/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-spring/pom.xml b/bootx-commons/common-spring/pom.xml index 80387f77f6dcee980abd892c22730c05f9e8abda..21f5efa282ff7420bf6cfa5b6b2e3627a156cb5a 100644 --- a/bootx-commons/common-spring/pom.xml +++ b/bootx-commons/common-spring/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 @@ -26,6 +26,11 @@ com.alibaba transmittable-thread-local + + + org.springframework.retry + spring-retry + \ No newline at end of file diff --git a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/SpringConfigApplication.java b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/SpringConfigApplication.java index d84a1201edb5413b20aa789cb1543ec591d2140c..af171c60732af69f05b0bb6f6f2532a5dca5052c 100644 --- a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/SpringConfigApplication.java +++ b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/SpringConfigApplication.java @@ -1,7 +1,9 @@ package cn.bootx.common.spring; import org.springframework.context.annotation.ComponentScan; +import org.springframework.retry.annotation.EnableRetry; +@EnableRetry @ComponentScan public class SpringConfigApplication { } diff --git a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/aop/CountTimeAop.java b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/aop/CountTimeAop.java index 73fb35ebe9b6c2fffa837f5ead0ed4533e74f9c1..89905f0f4a14fa803306d5d3d7f1292b0667f987 100644 --- a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/aop/CountTimeAop.java +++ b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/aop/CountTimeAop.java @@ -1,6 +1,7 @@ package cn.bootx.common.spring.aop; import cn.bootx.common.core.annotation.CountTime; +import com.google.common.base.Stopwatch; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -8,6 +9,8 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + /** * 方法耗时工具类 @@ -21,12 +24,14 @@ public class CountTimeAop { @Around("@annotation(countTime)") public Object doAround(ProceedingJoinPoint pjp, CountTime countTime) throws Throwable { - long startTime = System.currentTimeMillis(); + //创建的时候就开始计时 + Stopwatch stopwatch = Stopwatch.createStarted(); Object obj = pjp.proceed(); - long endTime = System.currentTimeMillis(); MethodSignature signature = (MethodSignature) pjp.getSignature(); String methodName = signature.getDeclaringTypeName() + "." + signature.getName(); - log.info("方法 [{}] 花费时间:{}ms",methodName,(endTime-startTime)); + //停止计时,然后计算时长.单位为毫秒. + long elapsed = stopwatch.stop().elapsed(TimeUnit.MILLISECONDS); + log.info("方法 [{}] 花费时间:{}ms",methodName,(elapsed)); return obj; } diff --git a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/configuration/SpringExecutorConfiguration.java b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/configuration/SpringExecutorConfiguration.java index 46b80f868d9acfb12993677e3783f3d43656fa94..ac4c7aa76503fb41bea12bdc2969d4b963ebd195 100644 --- a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/configuration/SpringExecutorConfiguration.java +++ b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/configuration/SpringExecutorConfiguration.java @@ -52,6 +52,18 @@ public class SpringExecutorConfiguration { return TtlExecutors.getTtlExecutor(springRawExecutor); } + /** + * TTl包装后的线程执行器(线程极多, 用来处理一些非核心的异步任务) + */ + @Bean + public Executor bigExecutor() { + ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); + taskExecutor.setMaxPoolSize(9999); + taskExecutor.setQueueCapacity(10000); + taskExecutor.initialize(); + return TtlExecutors.getTtlExecutor(taskExecutor); + } + /** * TTl包装后的线程执行服务 */ diff --git a/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/exception/RetryableException.java b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/exception/RetryableException.java new file mode 100644 index 0000000000000000000000000000000000000000..3d61316217273dbf0c6c4af3c2b0e6f5d86a2942 --- /dev/null +++ b/bootx-commons/common-spring/src/main/java/cn/bootx/common/spring/exception/RetryableException.java @@ -0,0 +1,11 @@ +package cn.bootx.common.spring.exception; + +import cn.bootx.common.core.exception.BizException; + +/** +* 可重试异常,抛出这个异常进行重试 +* @author xxm +* @date 2022/7/10 +*/ +public class RetryableException extends BizException { +} diff --git a/bootx-commons/common-super-query/pom.xml b/bootx-commons/common-super-query/pom.xml index b0acbda4bd53235928b9194cbcac8f6023f8da7e..a166fde4ded697107c8b975508ea584d46cac684 100644 --- a/bootx-commons/common-super-query/pom.xml +++ b/bootx-commons/common-super-query/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-super-query/src/main/java/cn/bootx/common/query/generator/ParamValueTypeConvert.java b/bootx-commons/common-super-query/src/main/java/cn/bootx/common/query/generator/ParamValueTypeConvert.java index c06908a15e9a3c2a66244e71b6aefdfdce2da6e8..be57c2b5f5704998d7104b036bf8b7f1be316635 100644 --- a/bootx-commons/common-super-query/src/main/java/cn/bootx/common/query/generator/ParamValueTypeConvert.java +++ b/bootx-commons/common-super-query/src/main/java/cn/bootx/common/query/generator/ParamValueTypeConvert.java @@ -1,10 +1,10 @@ package cn.bootx.common.query.generator; import cn.bootx.common.core.exception.BizException; +import cn.bootx.common.core.util.LocalDateTimeUtil; import cn.bootx.common.query.code.ParamTypeEnum; import cn.bootx.common.query.entity.QueryParam; import cn.hutool.core.date.DatePattern; -import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.StrUtil; import java.util.Collection; diff --git a/bootx-commons/common-swagger/pom.xml b/bootx-commons/common-swagger/pom.xml index 560145096c184feb825a8b4ffda70bb6abc300e8..5d0778f2c2fdbd20275ebab65fc65677c7caa4cd 100644 --- a/bootx-commons/common-swagger/pom.xml +++ b/bootx-commons/common-swagger/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-websocket/pom.xml b/bootx-commons/common-websocket/pom.xml index 32afbaa22279adbf876ecf60b329715c11819d47..4efe8dcfd287b4695d01f11f2f8ac90c92fff790 100644 --- a/bootx-commons/common-websocket/pom.xml +++ b/bootx-commons/common-websocket/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/common-xxl-job/pom.xml b/bootx-commons/common-xxl-job/pom.xml index 15fe2dbd0edbac2d98bec4c087db4acb26d1cb75..7fd65fdea3a41a4496c9e22efd7142216e05612a 100644 --- a/bootx-commons/common-xxl-job/pom.xml +++ b/bootx-commons/common-xxl-job/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-commons/pom.xml b/bootx-commons/pom.xml index 0d6b45b77356e651ffd4b7627b0d7df4ba929916..73c58db29c3f53f3267607240cf0452b8000aa1b 100644 --- a/bootx-commons/pom.xml +++ b/bootx-commons/pom.xml @@ -7,7 +7,7 @@ cn.bootx.platform bootx-platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT bootx-commons diff --git a/bootx-demo/pom.xml b/bootx-demo/pom.xml index bd32b276067336fbf62168a1d1a64da7aacdff1f..efd16a9bcde653b96eaad091fddd800407c64e19 100644 --- a/bootx-demo/pom.xml +++ b/bootx-demo/pom.xml @@ -5,7 +5,7 @@ bootx-platform cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-demo/src/main/java/cn/bootx/demo/controller/TestController.java b/bootx-demo/src/main/java/cn/bootx/demo/controller/TestController.java index 678646db7598442cfcfcce753f2b048cf276b3c7..0c84597f684c2a392c1c400844fa29a1167ca10d 100644 --- a/bootx-demo/src/main/java/cn/bootx/demo/controller/TestController.java +++ b/bootx-demo/src/main/java/cn/bootx/demo/controller/TestController.java @@ -9,13 +9,18 @@ import cn.bootx.common.sequence.func.Sequence; import cn.bootx.common.sequence.impl.DefaultRangeSequence; import cn.bootx.common.sequence.range.SeqRangeConfig; import cn.bootx.common.sequence.range.SeqRangeManager; +import cn.bootx.common.spring.exception.RetryableException; import cn.bootx.common.websocket.entity.WsRes; import cn.bootx.common.websocket.entity.WsResult; import cn.bootx.common.websocket.service.UserWsNoticeService; +import cn.hutool.extra.spring.SpringUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.retry.annotation.Backoff; +import org.springframework.retry.annotation.Retryable; +import org.springframework.scheduling.annotation.Async; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -90,4 +95,23 @@ public class TestController { userWsNoticeService.sendMessageByUser(result,id); return Res.ok(); } + + @Operation(summary = "轮训测试") + @GetMapping("/rotationSync") + public ResResult rotationSync(){ + for (int i = 0; i < 20; i++) { + SpringUtil.getBean(getClass()).rotationSyncFun(String.valueOf(i)); + } + return Res.ok(); + } + + /** + * 轮训同步支付状态 + */ + @Retryable(value = RetryableException.class, maxAttempts = 20, backoff = @Backoff(value = 5000L)) + @Async("asyncExecutor") + public void rotationSyncFun(String i){ + log.info(i); + throw new RetryableException(); + } } diff --git a/bootx-modules/module-eshop/pom.xml b/bootx-modules/module-eshop/pom.xml index f283bcf439e2126d81a11ff29fb4540be30c0b8f..f4ad4dd9188ff0fe4b947ee60d698355a835c9ec 100644 --- a/bootx-modules/module-eshop/pom.xml +++ b/bootx-modules/module-eshop/pom.xml @@ -5,7 +5,7 @@ bootx-modules cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-modules/pom.xml b/bootx-modules/pom.xml index c9edf549e138c7839e28ce72634a59a7505f7d9f..def86eee845b5cda52b047bc75e9651b2dd8b37c 100644 --- a/bootx-modules/pom.xml +++ b/bootx-modules/pom.xml @@ -5,7 +5,7 @@ bootx-platform cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/pom.xml b/bootx-services/pom.xml index e53ce1d22a7c5ac03c396c9eef78e5b93585d130..f5cc86fe7626259c5e4a867933c95a8da4efae49 100644 --- a/bootx-services/pom.xml +++ b/bootx-services/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-baseapi/pom.xml b/bootx-services/service-baseapi/pom.xml index c8fa92113326ad2014be703fda821c6c5506a4a0..cd1b3541c5890a4184f4394112d7e1ce6043aaf5 100644 --- a/bootx-services/service-baseapi/pom.xml +++ b/bootx-services/service-baseapi/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-services - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/code/CachingCode.java b/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/code/CachingCode.java index b428a73b2419d5b59067cd52d65a92f50760462c..1660fef225663f19387c63a3db0240d705f8acd1 100644 --- a/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/code/CachingCode.java +++ b/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/code/CachingCode.java @@ -8,5 +8,5 @@ package cn.bootx.baseapi.code; public interface CachingCode { /** 参数缓存 */ - String SYSTEM_PARAM = "ba:system:param"; + String SYSTEM_PARAM = "base:system:param"; } diff --git a/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/core/parameter/dao/SystemParamManager.java b/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/core/parameter/dao/SystemParamManager.java index 0bfcbfe679df9fe956d7eba6046a7fa0fcd955f9..a09e398e20250e9d1dce50b322c7bef2b58cb8cf 100644 --- a/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/core/parameter/dao/SystemParamManager.java +++ b/bootx-services/service-baseapi/src/main/java/cn/bootx/baseapi/core/parameter/dao/SystemParamManager.java @@ -10,10 +10,15 @@ import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; +import java.io.Serializable; import java.util.Optional; +import static cn.bootx.baseapi.code.CachingCode.SYSTEM_PARAM; + /** * 系统参数 * @author xxm @@ -24,6 +29,26 @@ import java.util.Optional; @RequiredArgsConstructor public class SystemParamManager extends BaseManager { + @Override + @CacheEvict(value = SYSTEM_PARAM,allEntries = true) + public SystemParameter updateById(SystemParameter systemParameter) { + return super.updateById(systemParameter); + } + + @Override + @CacheEvict(value = SYSTEM_PARAM,allEntries = true) + public boolean deleteById(Serializable id) { + return super.deleteById(id); + } + + /** + * 根据键名获取键值 + */ + @Cacheable(value = SYSTEM_PARAM, key = "#key") + public Optional findByParamKey(String key) { + return this.findByField(SystemParameter::getParamKey,key); + } + /** * key重复检查 */ @@ -49,10 +74,4 @@ public class SystemParamManager extends BaseManager findByParamKey(String key) { - return this.findByField(SystemParameter::getParamKey,key); - } } diff --git a/bootx-services/service-goods/pom.xml b/bootx-services/service-goods/pom.xml index b3c5c8a026423a9caf04f88b4f46e63665e20b24..376e3936db0c978bbc6621281e3b92045fb77ae9 100644 --- a/bootx-services/service-goods/pom.xml +++ b/bootx-services/service-goods/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java index f55f0f59604d4dae63cab9bc3dfe10f0d879e993..a67b65944c8bb294324c2568a55b3875772bd863 100644 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java +++ b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java @@ -2,13 +2,11 @@ package cn.bootx.goods.core.category.entity; import cn.bootx.common.core.function.EntityBaseFunction; import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; +import cn.bootx.goods.core.category.convert.SpecificationConvert; import cn.bootx.goods.dto.category.SpecificationDto; import cn.bootx.goods.param.category.SpecificationParam; -import cn.bootx.goods.core.category.convert.SpecificationConvert; - - +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/bootx-services/service-iam/pom.xml b/bootx-services/service-iam/pom.xml index e2c8c04fb13e808fefece3264e5b5eb83489b709..0689697f4137bac85d6a0e6030a175f7126910c4 100644 --- a/bootx-services/service-iam/pom.xml +++ b/bootx-services/service-iam/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-services - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-notice/pom.xml b/bootx-services/service-notice/pom.xml index 136406cafdf61974c73b6b6b5193db64743832bd..44ce18e6051584d21e457eb9acba5832fe7e2b02 100644 --- a/bootx-services/service-notice/pom.xml +++ b/bootx-services/service-notice/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-office/pom.xml b/bootx-services/service-office/pom.xml index a72a1af259049c8e07d2174e379b65410e69e308..30b062aeca270220c4400d0150609d4b1f5c6636 100644 --- a/bootx-services/service-office/pom.xml +++ b/bootx-services/service-office/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-order/pom.xml b/bootx-services/service-order/pom.xml index 16a508fb241277f181ec6a5187e54aad50aed21e..8bab15db7574a7aafbf36d27766294a2cd5fece9 100644 --- a/bootx-services/service-order/pom.xml +++ b/bootx-services/service-order/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-services/service-payment/pom.xml b/bootx-services/service-payment/pom.xml index 45e09bd6bde95024aa1ad994d885bc34c855586a..68163ed6b7a63d1623d17cea7109e0339beb4f67 100644 --- a/bootx-services/service-payment/pom.xml +++ b/bootx-services/service-payment/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-services - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 @@ -59,6 +59,12 @@ ${IJPay.version} + + + com.github.binarywang + weixin-java-mp + + cn.bootx.platform @@ -72,6 +78,12 @@ common-starter-auth + + + cn.bootx.platform + common-starter-file + + cn.bootx.platform @@ -83,6 +95,14 @@ cn.bootx.platform common-rabbitmq + + + + cn.bootx.platform + common-starter-quartz + + + \ No newline at end of file diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/CachingCode.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/CachingCode.java new file mode 100644 index 0000000000000000000000000000000000000000..fcd8c2ab0cce6529db1f40c4cbf2586263ee4cb7 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/CachingCode.java @@ -0,0 +1,16 @@ +package cn.bootx.payment.code; + +/** +* 支付服务缓存 +* @author xxm +* @date 2022/7/11 +*/ +public interface CachingCode { + + /** 支付单(主键) */ + String PAYMENT_ID = "pay:payment:id"; + + /** 支付单(业务号码) */ + String PAYMENT_BUSINESS_ID = "pay:payment:business"; + +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/PaymentEventCode.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/PaymentEventCode.java index bfaf129b00cbd87f88952d2633105638b3987d39..4522c03163a6e60fb110cacfc3cde29bc1d5288b 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/PaymentEventCode.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/PaymentEventCode.java @@ -7,4 +7,13 @@ public interface PaymentEventCode { /** 支付完成 */ String PAY_COMPLETE = "pay.complete"; + + /** 支付取消 */ + String PAY_CANCEL = "pay.cancel"; + + /** 支付退款 */ + String PAY_REFUND = "pay.refund"; + + /** 支付单超时 */ + String PAYMENT_EXPIRED_TIME = "payment.expired:time"; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayModelExtraCode.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayModelExtraCode.java index d6afc166d573c106e8d574ee6f5df1c986e06d34..31c48af7a27a2aba2779f92e7b7e310fb0fdc725 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayModelExtraCode.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayModelExtraCode.java @@ -10,6 +10,9 @@ public interface PayModelExtraCode { /** 付款码 */ String AUTH_CODE = "authCode"; + /** openId */ + String OPEN_ID = "openId"; + /** 单张储值卡 */ String VOUCHER_NO = "voucherNo"; diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayStatusCode.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayStatusCode.java index e741c83733844316a9f2aebc5494332b2b0eb8f3..316ec91c3d9aced749366ded4615dadc4882a518 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayStatusCode.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PayStatusCode.java @@ -24,14 +24,15 @@ public interface PayStatusCode { int TRADE_REFUNDED = 5; /** - * 回调信息支付状态 0.失败 2.成功 + * 回调信息支付状态 0.失败 1.成功 */ int NOTIFY_TRADE_FAIL = 0; int NOTIFY_TRADE_SUCCESS = 1; - /** 回调处理状态 0.失败 1.成功 */ + /** 回调处理状态 */ int NOTIFY_PROCESS_FAIL = 0; int NOTIFY_PROCESS_SUCCESS = 1; + int NOTIFY_PROCESS_IGNORE = 2; /** 退款处理状态 0.失败 1.成功 */ int REFUND_PROCESS_FAIL = 0; diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PaySyncStatus.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PaySyncStatus.java index 28813cfbb0c82f91dda43e79b378ffe6789d7f9b..793f14ba291ffd117511adfca94bdee2206d64e4 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PaySyncStatus.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/pay/PaySyncStatus.java @@ -15,8 +15,10 @@ public interface PaySyncStatus { int WAIT_BUYER_PAY = 2; /** 3 已关闭 */ int TRADE_CLOSED = 3; - /** 4 查询不到订单 */ - int NOT_FOUND = 4; - /** 5 查询失败 */ - int FAIL = 5; + /** 4 已退款 */ + int TRADE_REFUND = 4; + /** 5 查询不到订单 */ + int NOT_FOUND = 5; + /** 4 查询失败 */ + int FAIL = 6; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/AliPayCode.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/AliPayCode.java index fe3c81d65b4a5e02edb22bcd8b9043a277a39183..adea944a9e432c750b9434fe5725376c2a21b810 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/AliPayCode.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/AliPayCode.java @@ -21,22 +21,22 @@ public interface AliPayCode { String QUICK_WAP_PAY = "QUICK_WAP_WAY"; /** APP支付必填 APP支付产品 */ String QUICK_MSECURITY_PAY = "QUICK_MSECURITY_PAY"; + /** 付款码支付 */ + String BAR_CODE = "bar_code"; // 响应字段 /** 支付状态 */ String TRADE_STATUS = "trade_status"; - /** 公用回传参数 */ String PASS_BACK_PARAMS = "passback_params"; - /** 对交易或商品的描述(在没有公用回传参数的时候, 这个作为公用回传参数) */ String BODY = "body"; - /** 外部订单号-paymentId */ String OUT_TRADE_NO = "out_trade_no"; - /** 支付宝流水号 */ String TRADE_NO = "trade_no"; + /** appId */ + String APP_ID = "app_id"; //交易状态说明 /** 交易创建,等待买家付款 */ diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/WeChatPayCode.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/WeChatPayCode.java index 79149fb255f86fac4eeceadbbc0d587c0f106f70..49a83056321518a3653fc3f0ab65f613386c075b 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/WeChatPayCode.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/code/paymodel/WeChatPayCode.java @@ -1,89 +1,78 @@ package cn.bootx.payment.code.paymodel; -/** -* 微信参数 -* @author xxm -* @date 2021/6/21 -*/ +/** + * 微信参数 + * @author xxm + * @date 2021/6/21 + */ public interface WeChatPayCode { - // 认证类型 - /** 公钥 */ - int AUTH_TYPE_KEY = 1; + // 版本 + String API_V2 = "api_v2"; + String API_V3 = "api_v3"; - /** 证书 */ - int AUTH_TYPE_CART = 2; - - /** - * 二维码链接 - */ + // 请求参数 + /** jsapi发起获取AuthCode时的重定向参数 */ + String JSAPI_REDIRECT_URL = "JsapiRedirectUrl"; + // 返回参数 + /** 二维码链接 */ String CODE_URL = "code_url"; - /** - * 支付跳转链接 - */ + /** 支付跳转链接 */ String MWEB_URL = "mweb_url"; - /** - * 预支付交易会话ID - */ - String PREPAY_ID = "prepayid"; + /** 预支付交易会话ID */ + String PREPAY_ID = "prepay_id"; - /** - * 返回状态码 - */ + /** 返回状态码 */ String RETURN_CODE = "return_code"; - /** - * 返回信息 - */ + /** 返回信息 */ String RETURN_MSG = "return_msg"; - /** - * 返回错误信息 - */ + /** 返回错误代码(例如付款码返回的支付中状态就在这里面) */ + String ERR_CODE = "err_code"; + + /** 返回错误信息 */ String ERR_CODE_DES = "err_code_des"; - /** - * 业务结果 - */ + /** 业务结果(部分结果不在这个参数里, 例如付款码的响应码) */ String RESULT_CODE = "result_code"; - /** - * 交易类型 - */ + /** 交易类型 */ String TRADE_TYPE = "trade_type"; - /** - * 交易状态 - */ + /** appid */ + String APPID = "appid"; + + /** 交易状态 */ String TRADE_STATE = "trade_state"; - /** - * 商户订单号 - */ + /** 商户订单号 */ String OUT_TRADE_NO = "out_trade_no"; - /** - * 商户订单号 - */ - String ATTACH = "attach"; + /** 微信交易单号 */ + String TRANSACTION_ID = "transaction_id"; // 交易状态 /** 支付成功 */ String TRADE_SUCCESS = "SUCCESS"; - /** 转入退款 */ + /** 支付失败 */ + String TRADE_FAIL = "FAIL"; + /** 退款 */ String TRADE_REFUND = "REFUND"; /** 未支付 */ String TRADE_NOTPAY = "NOTPAY"; /** 已关闭 */ String TRADE_CLOSED = "CLOSED"; + /** 已接收,等待扣款 */ + String TRADE_ACCEPT = "ACCEPT"; /** 已撤销(刷卡支付) */ String TRADE_REVOKED = "REVOKED"; - /** 用户支付中 */ + /** 用户支付中(刷卡支付) */ String TRADE_USERPAYING = "USERPAYING"; - /** 支付失败 */ + /** 支付失败(刷卡支付) */ String TRADE_PAYERROR = "PAYERROR"; - /** 已接收,等待扣款 */ - String TRADE_ACCEPT = "ACCEPT"; + + } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/configuration/PaymentRabbitMqConfiguration.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/configuration/PaymentRabbitMqConfiguration.java index 27faceeb612d30aca67ecf436ad965bbec0ecc6d..e73d7a56385d0c475ecf56436da27d83d2b3de04 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/configuration/PaymentRabbitMqConfiguration.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/configuration/PaymentRabbitMqConfiguration.java @@ -18,19 +18,57 @@ public class PaymentRabbitMqConfiguration { /** 支付完成队列 */ @Bean - public Queue payCompleted() { + public Queue payComplete() { return new Queue(PaymentEventCode.PAY_COMPLETE); } + /** 支付关闭/撤销队列 */ + @Bean + public Queue payCancel() { + return new Queue(PaymentEventCode.PAY_CANCEL); + } + /** 支付退款队列 */ + @Bean + public Queue payRefund() { + return new Queue(PaymentEventCode.PAY_REFUND); + } + /** 支付超时通知队列 */ + @Bean + public Queue paymentExpiredTime() { + return new Queue(PaymentEventCode.PAYMENT_EXPIRED_TIME); + } + /** 交换机 */ @Bean public DirectExchange paymentExchange() { return new DirectExchange(PaymentEventCode.EXCHANGE_PAYMENT); } + /** 绑定支付完成 */ @Bean - public Binding bindPayCompleted() { - return BindingBuilder.bind(payCompleted()) + public Binding bindPayComplete() { + return BindingBuilder.bind(payComplete()) .to(paymentExchange()) .with(PaymentEventCode.PAY_COMPLETE); } + /** 绑定支付关闭/撤销 */ + @Bean + public Binding bindPayCancel() { + return BindingBuilder.bind(payCancel()) + .to(paymentExchange()) + .with(PaymentEventCode.PAY_CANCEL); + } + /** 绑定支付退款 */ + @Bean + public Binding bindPayRefund() { + return BindingBuilder.bind(payRefund()) + .to(paymentExchange()) + .with(PaymentEventCode.PAY_REFUND); + } + /** 绑定支付超时通知 */ + @Bean + public Binding bindPaymentExpiredTime() { + return BindingBuilder.bind(paymentExpiredTime()) + .to(paymentExchange()) + .with(PaymentEventCode.PAYMENT_EXPIRED_TIME); + } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AggregateController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AggregateController.java index 015af47303f8d7cb98b38e7ae50abe292e0e0e4b..c275456baac9fab2e170cf992cf83abec3f547ff 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AggregateController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AggregateController.java @@ -1,5 +1,6 @@ package cn.bootx.payment.controller; +import cn.bootx.common.core.annotation.IgnoreAuth; import cn.bootx.common.core.rest.Res; import cn.bootx.common.core.rest.ResResult; import cn.bootx.payment.core.aggregate.service.AggregateService; @@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController; * @author xxm * @date 2022/3/6 */ +@IgnoreAuth @Tag(name = "聚合支付") @RestController @RequestMapping("/aggregate") diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AlipayConfigController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AlipayConfigController.java index 465046288bc3b64138b58a038f736627aa28feb0..62fa8807165e77e418ddd4507850a888b687baff 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AlipayConfigController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/AlipayConfigController.java @@ -29,14 +29,16 @@ public class AlipayConfigController { @Operation(summary = "添加") @PostMapping("/add") - public ResResult add(@RequestBody AlipayConfigParam param){ - return Res.ok(alipayConfigService.add(param)); + public ResResult add(@RequestBody AlipayConfigParam param){ + alipayConfigService.add(param); + return Res.ok(); } @Operation(summary = "更新") @PostMapping("/update") - public ResResult update(@RequestBody AlipayConfigParam param){ - return Res.ok(alipayConfigService.update(param)); + public ResResult update(@RequestBody AlipayConfigParam param){ + alipayConfigService.update(param); + return Res.ok(); } @Operation(summary = "启用指定的支付宝配置") diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/CashierController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/CashierController.java index 0098ba93792b04077a9bd712a15a2c01181a3aca..6786de94c0b9334f68f6b7e96bbec2333b38ae42 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/CashierController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/CashierController.java @@ -1,25 +1,29 @@ package cn.bootx.payment.controller; +import cn.bootx.common.core.annotation.IgnoreAuth; import cn.bootx.common.core.rest.Res; import cn.bootx.common.core.rest.ResResult; import cn.bootx.payment.core.cashier.service.CashierService; import cn.bootx.payment.dto.pay.PayResult; +import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; import cn.bootx.payment.param.cashier.CashierCombinationPayParam; import cn.bootx.payment.param.cashier.CashierSinglePayParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +import static org.springframework.http.HttpHeaders.USER_AGENT; /** -* -* @author xxm -* @date 2022/2/23 -*/ + * + * @author xxm + * @date 2022/2/23 + */ +@IgnoreAuth @Tag(name = "结算台") @RestController @RequestMapping("/cashier") @@ -27,7 +31,7 @@ import javax.servlet.http.HttpServletRequest; public class CashierController { private final CashierService cashierService; - @Operation(summary = "发起支付(单渠道)") + @Operation(summary = "发起支付(单渠道,包括聚合付款码方式)") @PostMapping("/singlePay") public ResResult singlePay(@RequestBody CashierSinglePayParam cashierSinglePayParam){ return Res.ok(cashierService.singlePay(cashierSinglePayParam)); @@ -39,15 +43,23 @@ public class CashierController { return Res.ok(cashierService.combinationPay(param)); } - @SneakyThrows @Operation(summary = "扫码聚合支付(单渠道)") @GetMapping("/aggregatePay") - public ModelAndView aggregatePay(String key, HttpServletRequest request){ - String ua = request.getHeader("User-Agent"); - String payBody = cashierService.aggregatePay(key, ua); - return new ModelAndView("redirect:"+payBody); + public ModelAndView aggregatePay(String key, @RequestHeader(USER_AGENT) String ua){ + try { + String url = cashierService.aggregatePay(key, ua); + return new ModelAndView("redirect:"+url); + } catch (PayUnsupportedMethodException e) { + return new ModelAndView("errorCashier"); + } } - - + @Operation(summary = "微信jsapi支付(回调)") + @GetMapping("/wxJsapiPay") + public ModelAndView wxJsapiPay(String code, String state){ + Map map = cashierService.wxJsapiPay(code, state); + // 跳转页面, 调起微信jsapi支付 + return new ModelAndView("wechatJsapiPay") + .addAllObjects(map); + } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayCallbackController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayCallbackController.java index 5a5dac667833010554b372f898f39bdfb2c1a27b..c1a2a397369f419014719dafbd978fd1a89d3185 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayCallbackController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayCallbackController.java @@ -1,5 +1,6 @@ package cn.bootx.payment.controller; +import cn.bootx.common.core.annotation.IgnoreAuth; import cn.bootx.payment.core.paymodel.alipay.service.AliPayCallbackService; import cn.bootx.payment.core.paymodel.wechat.service.WeChatPayCallbackService; import com.ijpay.alipay.AliPayApi; @@ -22,6 +23,7 @@ import java.util.Map; * @author xxm * @date 2021/2/27 */ +@IgnoreAuth @Slf4j @Tag(name ="支付回调") @RestController @@ -33,7 +35,7 @@ public class PayCallbackController { @SneakyThrows @Operation(summary = "支付宝回调") - @PostMapping("/aliPay") + @PostMapping("/alipay") public String aliPay(HttpServletRequest request){ Map stringStringMap = AliPayApi.toMap(request); return aliPayCallbackService.payCallback(stringStringMap); diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayController.java index 24c6038e8bfb7bbd91dbe2c39534273597128099..a0d712c6abe624838cd8e82ef5843fc96669ac34 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PayController.java @@ -7,12 +7,11 @@ import cn.bootx.payment.core.pay.service.PayRefundService; import cn.bootx.payment.core.pay.service.PayService; import cn.bootx.payment.core.pay.service.PaySyncService; import cn.bootx.payment.dto.pay.PayResult; -import cn.bootx.payment.dto.payment.PaymentDto; import cn.bootx.payment.param.pay.PayParam; import cn.bootx.payment.param.refund.RefundParam; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -55,8 +54,9 @@ public class PayController { @Operation(summary = "刷新指定业务id的支付单状态") @PostMapping("/syncByBusinessId") - public ResResult syncByBusinessId(@Parameter(description = "业务id") String businessId){ - return Res.ok(paySyncService.syncByBusinessId(businessId)); + public ResResult syncByBusinessId(@Parameter(description = "业务id") String businessId){ + paySyncService.syncByBusinessId(businessId); + return Res.ok(); } @Operation(summary = "退款") diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PaymentController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PaymentController.java index 31a30d23de9c11f24a1dad8c4e74d3e812671104..d6659c033a229a47998215d16e03fc4efa9a21f1 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PaymentController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/PaymentController.java @@ -1,5 +1,6 @@ package cn.bootx.payment.controller; +import cn.bootx.common.core.annotation.IgnoreAuth; import cn.bootx.common.core.rest.PageResult; import cn.bootx.common.core.rest.Res; import cn.bootx.common.core.rest.ResResult; @@ -52,23 +53,20 @@ public class PaymentController { return Res.ok(paymentQueryService.superPage(pageParam,queryParams)); } - @Operation(summary = "根据businessId获取列表") - @GetMapping("/findByBusinessId") - public ResResult> findByBusinessId(String businessId){ - return Res.ok(paymentQueryService.findByBusinessId(businessId)); - } - - @Operation(summary = "根据业务ID获取支付状态") + @IgnoreAuth + @Operation(summary = "根据业务ID获取支付状态`") @GetMapping("/findStatusByBusinessId") public ResResult findStatusByBusinessId(String businessId){ return Res.ok(paymentQueryService.findStatusByBusinessId(businessId)); } + @IgnoreAuth @Operation(summary = "根据businessId获取订单支付方式") @GetMapping("/findPayTypeInfoByBusinessId") public ResResult> findPayTypeInfoByBusinessId(String businessId){ return Res.ok(paymentQueryService.findPayTypeInfoByBusinessId(businessId)); } + @Operation(summary = "根据id获取订单支付方式") @GetMapping("/findPayTypeInfoById") public ResResult> findPayTypeInfoById(Long id){ diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/WeChatPayConfigController.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/WeChatPayConfigController.java index 28b230aac25f58ab1046abab2653262d8c0157b4..b074ad42071a554456423a60d02d60e6e4a1c6ab 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/WeChatPayConfigController.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/controller/WeChatPayConfigController.java @@ -7,6 +7,7 @@ import cn.bootx.common.core.rest.dto.KeyValue; import cn.bootx.common.core.rest.param.PageParam; import cn.bootx.payment.core.paymodel.wechat.service.WeChatPayConfigService; import cn.bootx.payment.dto.paymodel.wechat.WeChatPayConfigDto; +import cn.bootx.payment.param.paymodel.wechat.WeChatPayConfigParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; @@ -18,7 +19,7 @@ import java.util.List; * @author xxm * @date 2021/3/19 */ -@Tag(name ="微信支付") +@Tag(name ="微信支付配置") @RestController @RequestMapping("/wechat/pay") @AllArgsConstructor @@ -27,19 +28,21 @@ public class WeChatPayConfigController { @Operation(summary = "添加微信支付配置") @PostMapping("/add") - public ResResult add(@RequestBody WeChatPayConfigDto param){ - return Res.ok(weChatPayConfigService.add(param)); + public ResResult add(@RequestBody WeChatPayConfigParam param){ + weChatPayConfigService.add(param); + return Res.ok(); } @Operation(summary = "更新") @PostMapping("/update") - public ResResult update(@RequestBody WeChatPayConfigDto param){ - return Res.ok(weChatPayConfigService.update(param)); + public ResResult update(@RequestBody WeChatPayConfigParam param){ + weChatPayConfigService.update(param); + return Res.ok(); } @Operation(summary = "设置启用的微信支付配置") @PostMapping("/setUpActivity") - public ResResult setUpActivity(Long id){ + public ResResult setUpActivity(Long id){ weChatPayConfigService.setUpActivity(id); return Res.ok(); } @@ -53,8 +56,8 @@ public class WeChatPayConfigController { @Operation(summary = "分页") @GetMapping("/page") - public ResResult> page(PageParam pageParam){ - return Res.ok(weChatPayConfigService.page(pageParam)); + public ResResult> page(PageParam pageParam,WeChatPayConfigParam param){ + return Res.ok(weChatPayConfigService.page(pageParam,param)); } @Operation(summary = "根据Id查询") diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/aggregate/service/AggregateService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/aggregate/service/AggregateService.java index 0fe93a61e1fc9123db6aa4762f10cd896ad352c4..e7f0987124b99b35298a605b300c10788610e894 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/aggregate/service/AggregateService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/aggregate/service/AggregateService.java @@ -1,6 +1,5 @@ package cn.bootx.payment.core.aggregate.service; -import cn.bootx.common.core.exception.BizException; import cn.bootx.common.redis.RedisClient; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.core.aggregate.entity.AggregatePayInfo; @@ -13,6 +12,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import java.util.Optional; + /** * 聚合支付 * @author xxm @@ -35,10 +36,19 @@ public class AggregateService { .setTitle(param.getTitle()) .setBusinessId(param.getBusinessId()); String key = RandomUtil.randomString(10); - redisClient.setWithTimeout(PREFIX_KEY + key, JSONUtil.toJsonStr(aggregatePayInfo),2*60*1000); + redisClient.setWithTimeout(PREFIX_KEY + key, JSONUtil.toJsonStr(aggregatePayInfo),5*60*1000); return key; } + /** + * 获取聚合支付信息 + */ + public AggregatePayInfo getAggregateInfo(String key){ + String jsonStr = Optional.ofNullable(redisClient.get(PREFIX_KEY + key)) + .orElseThrow(() -> new PayFailureException("支付超时")); + return JSONUtil.toBean(jsonStr, AggregatePayInfo.class); + } + /** * 聚合付款码支付处理 */ diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/cashier/service/CashierService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/cashier/service/CashierService.java index d759a6f1b9b722e80d1a0350a247c74c1e3d558f..10fd8586fa62ddcbc4e17fd6cc81249f989027ea 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/cashier/service/CashierService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/cashier/service/CashierService.java @@ -1,28 +1,38 @@ package cn.bootx.payment.core.cashier.service; -import cn.bootx.common.core.entity.UserDetail; +import cn.bootx.baseapi.core.parameter.dao.SystemParamManager; +import cn.bootx.baseapi.core.parameter.entity.SystemParameter; import cn.bootx.common.core.util.BigDecimalUtil; -import cn.bootx.common.redis.RedisClient; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.code.pay.PayModelExtraCode; import cn.bootx.payment.code.pay.PayStatusCode; import cn.bootx.payment.code.pay.PayWayCode; +import cn.bootx.payment.code.paymodel.WeChatPayCode; import cn.bootx.payment.core.aggregate.entity.AggregatePayInfo; import cn.bootx.payment.core.aggregate.service.AggregateService; -import cn.bootx.payment.core.pay.PayModelUtil; import cn.bootx.payment.core.pay.service.PayService; +import cn.bootx.payment.core.paymodel.wechat.dao.WeChatPayConfigManager; +import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; import cn.bootx.payment.dto.pay.PayResult; import cn.bootx.payment.exception.payment.PayFailureException; +import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; import cn.bootx.payment.param.cashier.CashierCombinationPayParam; import cn.bootx.payment.param.cashier.CashierSinglePayParam; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.pay.PayParam; +import cn.bootx.payment.util.PayModelUtil; import cn.bootx.starter.auth.util.SecurityUtil; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.DesensitizedUtil; -import cn.hutool.json.JSONUtil; +import com.ijpay.core.enums.SignType; +import com.ijpay.core.kit.WxPayKit; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -39,17 +49,15 @@ import java.util.*; public class CashierService { private final PayService payService; private final AggregateService aggregateService; - private final RedisClient redisClient; - private final String PREFIX_KEY = "cashier:pay:aggregate:"; - - + private final WeChatPayConfigManager weChatPayConfigManager; + private final SystemParamManager systemParamManager; /** * 发起支付(单渠道支付) */ public PayResult singlePay(CashierSinglePayParam param){ - // 如果是聚合支付, 特殊处理 + // 如果是聚合支付,存在付款码时特殊处理(聚合扫码支付不用额外处理) if (Objects.equals(PayChannelCode.AGGREGATION,param.getPayChannel())){ int payChannel = aggregateService.getPayChannel(param.getAuthCode()); param.setPayChannel(payChannel); @@ -63,6 +71,7 @@ public class CashierService { // 处理附加参数 HashMap map = new HashMap<>(1); map.put(PayModelExtraCode.AUTH_CODE,param.getAuthCode()); + map.put(PayModelExtraCode.OPEN_ID,param.getOpenId()); map.put(PayModelExtraCode.VOUCHER_NO,param.getVoucherNo()); String extraParamsJson = PayModelUtil.buildExtraParamsJson(param.getPayChannel(), map); payModeParam.setExtraParamsJson(extraParamsJson); @@ -91,13 +100,13 @@ public class CashierService { cashierSinglePayParam.setPayChannel(PayChannelCode.ALI); } else if (ua.contains(PayChannelCode.UA_WECHAT_PAY)) { - cashierSinglePayParam.setPayChannel(PayChannelCode.WECHAT); + // 跳转微信授权页面, 调用jsapi进行支付 + return this.wxJsapiAuth(key); } else { - throw new PayFailureException("不支持的支付方式"); + throw new PayUnsupportedMethodException(); } - String jsonStr = Optional.ofNullable(redisClient.get(PREFIX_KEY + key)) - .orElseThrow(() -> new PayFailureException("支付超时")); - AggregatePayInfo aggregatePayInfo = JSONUtil.toBean(jsonStr, AggregatePayInfo.class); + + AggregatePayInfo aggregatePayInfo = aggregateService.getAggregateInfo(key); cashierSinglePayParam.setTitle(aggregatePayInfo.getTitle()) .setAmount(aggregatePayInfo.getAmount()) .setBusinessId(aggregatePayInfo.getBusinessId()); @@ -105,6 +114,60 @@ public class CashierService { return payResult.getAsyncPayInfo().getPayBody(); } + /** + * 微信jsapi支付 - 跳转到授权页面 + */ + private String wxJsapiAuth(String key){ + WeChatPayConfig config = weChatPayConfigManager.findActivity().orElseThrow(() -> new PayFailureException("未找到启用的微信支付配置")); + WxMpService wxMpService = getWxMpService(config.getAppId(), config.getAppSecret()); + // 回调地址为 结算台微信jsapi支付的回调地址 + SystemParameter systemParameter = systemParamManager.findByParamKey(WeChatPayCode.JSAPI_REDIRECT_URL) + .orElseThrow(() -> new PayFailureException("微信支付回调地址参数不存在")); + String url = systemParameter.getValue()+"cashier/wxJsapiPay"; + return wxMpService.getOAuth2Service().buildAuthorizationUrl(url, WxConsts.OAuth2Scope.SNSAPI_BASE, key); + } + + /** + * 微信jsapi支付 - 回调发起预支付, 同时调起微信页面jsapi支付 + * @param code 微信授权码, 用来获取id + * @param state 聚合支付参数记录的key + * @return 页面中调起jsapi支付的参数 + */ + @SneakyThrows + public Map wxJsapiPay(String code, String state) { + WeChatPayConfig config = weChatPayConfigManager.findActivity().orElseThrow(() -> new PayFailureException("未找到启用的微信支付配置")); + WxMpService wxMpService = this.getWxMpService(config.getAppId(), config.getAppSecret()); + WxOAuth2AccessToken accessToken = wxMpService.getOAuth2Service().getAccessToken(code); + String openId = accessToken.getOpenId(); + AggregatePayInfo aggregatePayInfo = aggregateService.getAggregateInfo(state); + // 构造微信API支付参数 + CashierSinglePayParam cashierSinglePayParam = new CashierSinglePayParam() + .setPayChannel(PayChannelCode.WECHAT) + .setPayWay(PayWayCode.JSAPI) + .setTitle(aggregatePayInfo.getTitle()) + .setAmount(aggregatePayInfo.getAmount()) + .setOpenId(openId) + .setBusinessId(aggregatePayInfo.getBusinessId()); + PayResult payResult = this.singlePay(cashierSinglePayParam); + + return WxPayKit.prepayIdCreateSign(payResult.getAsyncPayInfo().getPayBody(), + config.getAppId(), + config.getApiKeyV2(), + SignType.HMACSHA256); + } + + /** + * 获取微信公众号API的Service + */ + private WxMpService getWxMpService(String appId,String secret){ + WxMpService wxMpService = new WxMpServiceImpl(); + WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl(); + config.setAppId(appId); // 设置微信公众号的appid + config.setSecret(secret); // 设置微信公众号的app corpSecret + wxMpService.setWxMpConfigStorage(config); + return wxMpService; + } + /** * 组合支付 */ diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PayEventBuilder.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PayEventBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..6d7d457070abb61c616bf473e85bd3e9b04c1ed9 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PayEventBuilder.java @@ -0,0 +1,46 @@ +package cn.bootx.payment.core.pay.builder; + +import cn.bootx.payment.core.payment.entity.Payment; +import cn.bootx.payment.event.PayCancelEvent; +import cn.bootx.payment.event.PayCompleteEvent; +import cn.bootx.payment.event.PayRefundEvent; +import lombok.experimental.UtilityClass; + +/** +* 支付事件生成器 +* @author xxm +* @date 2022/7/11 +*/ +@UtilityClass +public class PayEventBuilder { + /** + * 支付完成 + */ + public PayCompleteEvent buildPayComplete(Payment payment) { + PayCompleteEvent event = new PayCompleteEvent() + .setPaymentId(payment.getId()) + .setBusinessId(payment.getBusinessId()); + return event; + } + + /** + * 支付撤销/关闭 + */ + public PayCancelEvent buildPayCancel(Payment payment){ + PayCancelEvent event = new PayCancelEvent() + .setPaymentId(payment.getId()) + .setBusinessId(payment.getBusinessId()); + return event; + } + + /** + * 支付退款 + */ + public PayRefundEvent buildPayRefund(Payment payment){ + PayRefundEvent event = new PayRefundEvent() + .setPaymentId(payment.getId()) + .setBusinessId(payment.getBusinessId()); + return event; + } + +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PaymentBuilder.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PaymentBuilder.java index d3b5f3bf76eb34486822bf01ee1cbc821e783424..cc6a16d951b77307474316de56f4f10da47d6295 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PaymentBuilder.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/builder/PaymentBuilder.java @@ -6,7 +6,6 @@ import cn.bootx.payment.code.pay.PayStatusCode; import cn.bootx.payment.core.pay.local.AsyncPayInfoLocal; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.dto.pay.PayResult; -import cn.bootx.payment.dto.pay.PaymentInfo; import cn.bootx.payment.dto.payment.PayChannelInfo; import cn.bootx.payment.dto.payment.RefundableInfo; import cn.bootx.payment.param.pay.PayModeParam; @@ -14,9 +13,7 @@ import cn.bootx.payment.param.pay.PayParam; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.extra.servlet.ServletUtil; -import cn.hutool.json.JSONUtil; import lombok.experimental.UtilityClass; -import org.springframework.beans.BeanUtils; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; @@ -57,8 +54,8 @@ public class PaymentBuilder { .reduce(BigDecimal::add) .orElse(BigDecimal.ZERO); // 支付通道信息 - payment.setPayChannelInfo(JSONUtil.toJsonStr(payTypeInfos)) - .setRefundableInfo(JSONUtil.toJsonStr(refundableInfos)) + payment.setPayChannelInfo(payTypeInfos) + .setRefundableInfo(refundableInfos) .setPayStatus(PayStatusCode.TRADE_PROGRESS) .setAmount(sumAmount) .setClientIp(ip) @@ -89,7 +86,7 @@ public class PaymentBuilder { public PayParam buildPayParamByPayment(Payment payment){ PayParam payParam = new PayParam(); // 恢复 payModeList - List payModeParams = payment.getPayChannelInfoList().stream() + List payModeParams = payment.getPayChannelInfo().stream() .map(payTypeInfo -> new PayModeParam() .setAmount(payTypeInfo.getAmount()) .setPayChannel(payTypeInfo.getPayChannel()) @@ -118,10 +115,9 @@ public class PaymentBuilder { // 异步支付信息 paymentResult.setAsyncPayChannel(payment.getAsyncPayChannel()) .setAsyncPayMode(payment.isAsyncPayMode()) - .setPayStatus(payment.getPayStatus()) - .setPayment(buildPaymentInfo(payment)); + .setPayStatus(payment.getPayStatus()); - List channelInfos = payment.getPayChannelInfoList(); + List channelInfos = payment.getPayChannelInfo(); // 设置异步支付参数 List moneyPayTypeInfos = channelInfos.stream() @@ -136,13 +132,4 @@ public class PaymentBuilder { } return paymentResult; } - - /** - * 构建PaymentInfo - */ - public PaymentInfo buildPaymentInfo(Payment payment){ - PaymentInfo paymentInfo = new PaymentInfo(); - BeanUtils.copyProperties(payment, paymentInfo); - return paymentInfo; - } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayCallbackStrategy.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayCallbackStrategy.java index 977930da733e9960db0be24facf12fc5d48cd97f..2b7adbecbc965694ad3c41f2cc09e5edf3b3d161 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayCallbackStrategy.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayCallbackStrategy.java @@ -41,7 +41,7 @@ public abstract class AbsPayCallbackStrategy { } // 去重处理 if (!this.duplicateChecker()){ - return null; + return this.getReturnMsg(); } // 调用统一回调处理 PayCallbackResult result = payCallbackService.callback(this.getPaymentId(), this.getTradeStatus(), params); @@ -64,7 +64,7 @@ public abstract class AbsPayCallbackStrategy { */ public boolean duplicateChecker(){ // 判断10秒内是否已经回调处理 - String key = "payment:callback:duplicate:" + ":" + this.getPaymentId(); + String key = "payment:callback:duplicate:" + this.getPaymentId(); return redisClient.setIfAbsent(key, "", 10*1000); } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayStrategy.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayStrategy.java index 13a8f96646caea05833a7ed4a26d01b6d99a4058..0ad60e304d76a450f404438c8ef5f64daf86eb8a 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayStrategy.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/func/AbsPayStrategy.java @@ -53,17 +53,10 @@ public abstract class AbsPayStrategy { } /** - * 支付前处理 - */ - public void doBeforePay() { - this.doBeforePayHandler(); - } - - /** - * 支付前对Payment的处理 + * 支付前对处理 * 包含必要的校验以及对Payment对象的创建和保存操作 */ - protected void doBeforePayHandler(){ + public void doBeforePayHandler(){ } /** diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/local/AsyncRefundLocal.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/local/AsyncRefundLocal.java index 15963dd58de06bbdf8427aed92fb8e89e0d9d976..f566380c525379623c11204f78c3c66a5c6380f5 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/local/AsyncRefundLocal.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/local/AsyncRefundLocal.java @@ -12,41 +12,41 @@ public final class AsyncRefundLocal { private static final ThreadLocal ERROR_MSG = new TransmittableThreadLocal<>(); private static final ThreadLocal ERROR_CODE = new TransmittableThreadLocal<>(); /** - * 设置 + * 设置 退款号 */ public static void set(String refundId) { THREAD_LOCAL.set(refundId); } /** - * 获取 + * 获取 退款号 */ public static String get() { return THREAD_LOCAL.get(); } /** - * 设置 + * 设置 错误内容 */ public static void setErrorMsg(String errorMsg) { ERROR_MSG.set(errorMsg); } /** - * 获取 + * 获取 错误内容 */ public static String getErrorMsg() { return ERROR_MSG.get(); } /** - * 设置 + * 设置 错误码 */ public static void setErrorCode(String errorCode) { ERROR_CODE.set(errorCode); } /** - * 获取 + * 获取 错误码 */ public static String getErrorCode() { return ERROR_CODE.get(); diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCallbackService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCallbackService.java index 1c52e649e733b73d6c5d44705fa058a193107583..119477febff4cc526a97fe5d810ec6c36422ce77 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCallbackService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCallbackService.java @@ -1,8 +1,10 @@ package cn.bootx.payment.core.pay.service; import cn.bootx.common.core.exception.ErrorCodeRuntimeException; +import cn.bootx.common.core.util.LocalDateTimeUtil; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.code.pay.PayStatusCode; +import cn.bootx.payment.core.pay.builder.PayEventBuilder; import cn.bootx.payment.core.pay.builder.PaymentBuilder; import cn.bootx.payment.core.pay.exception.BaseException; import cn.bootx.payment.core.pay.exception.ExceptionInfo; @@ -10,10 +12,8 @@ import cn.bootx.payment.core.pay.factory.PayStrategyFactory; import cn.bootx.payment.core.pay.func.AbsPayStrategy; import cn.bootx.payment.core.pay.func.PayStrategyConsumer; import cn.bootx.payment.core.pay.result.PayCallbackResult; -import cn.bootx.payment.core.payment.dao.PaymentManager; import cn.bootx.payment.core.payment.entity.Payment; -import cn.bootx.payment.dto.pay.PayResult; -import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; +import cn.bootx.payment.core.payment.service.PaymentService; import cn.bootx.payment.mq.PaymentEventSender; import cn.bootx.payment.param.pay.PayParam; import cn.hutool.core.collection.CollectionUtil; @@ -36,7 +36,7 @@ import java.util.stream.Collectors; @Service @RequiredArgsConstructor public class PayCallbackService { - private final PaymentManager paymentManager; + private final PaymentService paymentService; private final PaymentEventSender eventSender; /** @@ -46,61 +46,134 @@ public class PayCallbackService { */ public PayCallbackResult callback(Long paymentId, int tradeStatus, Map map){ - PayCallbackResult result = new PayCallbackResult() - .setCode(PayStatusCode.NOTIFY_PROCESS_SUCCESS); + // 获取payment和paymentParam数据 + Payment payment = paymentService.findById(paymentId) + .orElse(null); + + // 支付单不存在,记录回调记录 + if (Objects.isNull(payment)){ + return new PayCallbackResult().setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("支付单不存在,记录回调记录"); + } + + // 回调时间超出了支付单超时时间, 记录一下, 不做处理 + if (Objects.nonNull(payment.getExpiredTime())&& LocalDateTimeUtil.ge(LocalDateTime.now(),payment.getExpiredTime())){ + return new PayCallbackResult().setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("回调时间超出了支付单支付有效时间"); + } + // 成功状态 if (PayStatusCode.NOTIFY_TRADE_SUCCESS == tradeStatus){ - // 1. 获取payment和paymentParam数据 - Payment payment = paymentManager.findById(paymentId) - .orElse(null); - - // 支付单不存在,记录回调记录,后期处理 - if (Objects.isNull(payment)){ - return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) - .setMsg("支付单不存在,记录回调记录"); - } - - // payment已被取消,记录回调记录,后期处理 - if (!Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_PROGRESS)){ - return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) - .setMsg("支付单不是待支付状态,记录回调记录"); - } - - // 2.通过工厂生成对应的策略组 - PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment); - - List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); - if (CollectionUtil.isEmpty(paymentStrategyList)) { - throw new PayUnsupportedMethodException(); - } - - // 3.初始化支付的参数 - for (AbsPayStrategy paymentStrategy : paymentStrategyList) { - paymentStrategy.initPayParam(payment, payParam); - } - // 4.处理方法, 支付时只有一种payModel(异步支付), 失败时payment的所有payModel都会生效 - boolean handlerFlag = this.doHandler(payment, paymentStrategyList, (strategyList, paymentObj) -> { - // 执行异步支付方式的成功回调(不会有同步payModel) - strategyList.forEach(absPaymentStrategy -> absPaymentStrategy.doAsyncSuccessHandler(map)); - - // 修改payment支付状态为成功 - paymentObj.setPayStatus(PayStatusCode.TRADE_SUCCESS); - paymentObj.setPayTime(LocalDateTime.now()); - paymentManager.updateById(paymentObj); - }); - - if (handlerFlag) { - // 5. 发送成功事件 - PayResult paymentResult = PaymentBuilder.buildResultByPayment(payment); - // 发送成功事件 - eventSender.sendPaymentCompleted(paymentResult); - } else { - return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) - .setMsg("回调处理过程报错"); - } + return this.success(payment,map); + } else { + // 失败状态 + return this.fail(payment,map); + } + } + + /** + * 成功处理 + */ + private PayCallbackResult success(Payment payment, Map map){ + PayCallbackResult result = new PayCallbackResult() + .setCode(PayStatusCode.NOTIFY_PROCESS_SUCCESS); + + // payment已经被支付,不需要重复处理 + if (Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_SUCCESS)){ + return result.setCode(PayStatusCode.NOTIFY_PROCESS_IGNORE) + .setMsg("支付单已经是支付成功状态,不进行处理"); + } + + // payment已被取消,记录回调记录 + if (!Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_PROGRESS)){ + return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("支付单不是待支付状态,记录回调记录"); + } + + // 2.通过工厂生成对应的策略组 + PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment); + + List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); + if (CollectionUtil.isEmpty(paymentStrategyList)) { + return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("支付单数据非法,未找到对应的支付方式"); + } + + // 3.初始化支付的参数 + for (AbsPayStrategy paymentStrategy : paymentStrategyList) { + paymentStrategy.initPayParam(payment, payParam); + } + // 4.处理方法, 支付时只有一种payModel(异步支付), 失败时payment的所有payModel都会生效 + boolean handlerFlag = this.doHandler(payment, paymentStrategyList, (strategyList, paymentObj) -> { + // 执行异步支付方式的成功回调(不会有同步payModel) + strategyList.forEach(absPaymentStrategy -> absPaymentStrategy.doAsyncSuccessHandler(map)); + + // 修改payment支付状态为成功 + paymentObj.setPayStatus(PayStatusCode.TRADE_SUCCESS); + paymentObj.setPayTime(LocalDateTime.now()); + paymentService.updateById(paymentObj); + }); + + if (handlerFlag) { + // 5. 发送成功事件 + eventSender.sendPayComplete(PayEventBuilder.buildPayComplete(payment)); + } else { + return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("回调处理过程报错"); } return result; + } + + + /** + * 失败处理, 关闭并退款 按说这块不会发生 + */ + private PayCallbackResult fail(Payment payment, Map map) { + PayCallbackResult result = new PayCallbackResult() + .setCode(PayStatusCode.NOTIFY_PROCESS_SUCCESS); + // payment已被取消,记录回调记录,后期处理 + if (!Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_PROGRESS)){ + return result.setCode(PayStatusCode.NOTIFY_PROCESS_IGNORE) + .setMsg("支付单已经取消,记录回调记录"); + } + + // payment支付成功, 状态非法 + if (!Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_SUCCESS)){ + return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("支付单状态非法,支付网关状态为失败,但支付单状态为已完成"); + } + + // 2.通过工厂生成对应的策略组 + PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment); + List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); + if (CollectionUtil.isEmpty(paymentStrategyList)) { + return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("支付单数据非法,未找到对应的支付方式"); + } + // 3.初始化支付关闭的参数 + for (AbsPayStrategy paymentStrategy : paymentStrategyList) { + paymentStrategy.initPayParam(payment, payParam); + } + // 4.处理方法, 支付时只有一种payModel(异步支付), 失败时payment的所有payModel都会生效 + boolean handlerFlag = this.doHandler(payment, paymentStrategyList, (strategyList, paymentObj) -> { + // 执行异步支付方式的成功回调(不会有同步payModel) + strategyList.forEach(AbsPayStrategy::doCancelHandler); + + // 修改payment支付状态为成功 + paymentObj.setPayStatus(PayStatusCode.TRADE_CANCEL); + paymentService.updateById(paymentObj); + }); + + if (handlerFlag) { + // 5. 发送退款事件 + eventSender.sendPayRefund(PayEventBuilder.buildPayRefund(payment)); + } else { + return result.setCode(PayStatusCode.NOTIFY_PROCESS_FAIL) + .setMsg("回调处理过程报错"); + } + + return result; } /** @@ -110,15 +183,15 @@ public class PayCallbackService { * @param successCallback 成功操作 */ private boolean doHandler(Payment payment, - List strategyList, - PayStrategyConsumer, Payment> successCallback) { + List strategyList, + PayStrategyConsumer, Payment> successCallback) { try { // 1.获取异步支付方式,通过工厂生成对应的策略组 List syncPaymentStrategyList = strategyList.stream() .filter(paymentStrategy -> PayChannelCode.ASYNC_TYPE.contains(paymentStrategy.getType())) .collect(Collectors.toList()); - // 执行成功 + // 执行成功方法 successCallback.accept(syncPaymentStrategyList, payment); } catch (Exception e) { // error事件的处理 @@ -146,7 +219,7 @@ public class PayCallbackService { payment.setErrorCode(String.valueOf(exceptionInfo.getErrorCode())); payment.setErrorMsg(String.valueOf(exceptionInfo.getErrorMsg())); payment.setPayStatus(PayStatusCode.TRADE_FAIL); - paymentManager.updateById(payment); + paymentService.updateById(payment); // 调用失败处理 for (AbsPayStrategy paymentStrategy : strategyList) { diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCancelService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCancelService.java index 4d01624c54a15ad8ed99cdfc4686a47247e38567..914217d5ad26d3d636f7deef35e8e0b144726dc9 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCancelService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayCancelService.java @@ -1,15 +1,17 @@ package cn.bootx.payment.core.pay.service; import cn.bootx.payment.code.pay.PayStatusCode; +import cn.bootx.payment.core.pay.builder.PayEventBuilder; import cn.bootx.payment.core.pay.builder.PaymentBuilder; import cn.bootx.payment.core.pay.factory.PayStrategyFactory; import cn.bootx.payment.core.pay.func.AbsPayStrategy; import cn.bootx.payment.core.pay.func.PayStrategyConsumer; -import cn.bootx.payment.core.payment.dao.PaymentManager; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.core.payment.service.PaymentService; import cn.bootx.payment.exception.payment.PayFailureException; +import cn.bootx.payment.exception.payment.PayNotExistedException; import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; +import cn.bootx.payment.mq.PaymentEventSender; import cn.bootx.payment.param.pay.PayParam; import cn.hutool.core.collection.CollectionUtil; import lombok.RequiredArgsConstructor; @@ -17,8 +19,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Arrays; import java.util.List; -import java.util.Optional; + +import static cn.bootx.payment.code.pay.PayStatusCode.*; +import static cn.bootx.payment.code.pay.PayStatusCode.TRADE_REFUNDED; /** * 取消订单处理 @@ -29,16 +34,18 @@ import java.util.Optional; @Service @RequiredArgsConstructor public class PayCancelService { - private final PaymentManager paymentManager; private final PaymentService paymentService; + private final PaymentEventSender paymentEventSender; + /** * 根据业务id取消支付记录 */ @Transactional(rollbackFor = Exception.class) public void cancelByBusinessId(String businessId) { - Optional paymentOptional = Optional.ofNullable(paymentService.getAndCheckPaymentByBusinessId(businessId)); - paymentOptional.ifPresent(this::cancelPayment); + Payment payment = paymentService.findByBusinessId(businessId) + .orElseThrow(() -> new PayFailureException("未找到支付单")); + this.cancelPayment(payment); } @@ -47,9 +54,8 @@ public class PayCancelService { */ @Transactional(rollbackFor = Exception.class) public void cancelByPaymentId(Long paymentId){ - // 获取payment和paymentParam数据 - Payment payment = paymentManager.findById(paymentId) - .orElseThrow(() -> new PayFailureException("未找到payment")); + Payment payment = paymentService.findById(paymentId) + .orElseThrow(() -> new PayFailureException("未找到支付单")); this.cancelPayment(payment); } @@ -57,6 +63,11 @@ public class PayCancelService { * 取消支付记录 */ private void cancelPayment(Payment payment){ + // 状态检查, 成功/退款/退款中 不处理 + List trades = Arrays.asList(TRADE_SUCCESS,TRADE_REFUNDING,TRADE_REFUNDED); + if (trades.contains(payment.getPayStatus())) { + throw new PayFailureException("支付已完成, 无法撤销"); + } // 获取 paymentParam PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment);; @@ -78,8 +89,15 @@ public class PayCancelService { strategyList.forEach(AbsPayStrategy::doCancelHandler); // 取消订单 paymentObj.setPayStatus(PayStatusCode.TRADE_CANCEL); - paymentManager.updateById(paymentObj); + paymentService.updateById(paymentObj); }); + + // 4. 获取支付记录信息 + payment = paymentService.findById(payment.getId()) + .orElseThrow(PayNotExistedException::new); + + // 5. 发布撤销事件 + paymentEventSender.sendPayCancel(PayEventBuilder.buildPayCancel(payment)); } /** @@ -97,16 +115,8 @@ public class PayCancelService { successCallback.accept(strategyList, payment); } catch (Exception e) { // error事件的处理 - this.errorHandler(payment, strategyList, e); + log.warn("取消订单失败"); throw e; } } - - /** - * 对Error的处理 - */ - private void errorHandler(Payment payment, List strategyList, Exception e) { - // 待编写 - log.warn("取消订单失败"); - } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayExpiredTimeService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayExpiredTimeService.java new file mode 100644 index 0000000000000000000000000000000000000000..6e5418cac69b0d423526e1ea38059424abe98614 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayExpiredTimeService.java @@ -0,0 +1,179 @@ +package cn.bootx.payment.core.pay.service; + +import cn.bootx.payment.code.pay.PaySyncStatus; +import cn.bootx.payment.core.pay.builder.PayEventBuilder; +import cn.bootx.payment.core.pay.builder.PaymentBuilder; +import cn.bootx.payment.core.pay.factory.PayStrategyFactory; +import cn.bootx.payment.core.pay.func.AbsPayStrategy; +import cn.bootx.payment.core.pay.result.PaySyncResult; +import cn.bootx.payment.core.payment.entity.Payment; +import cn.bootx.payment.core.payment.service.PaymentService; +import cn.bootx.payment.exception.payment.PayFailureException; +import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; +import cn.bootx.payment.mq.PaymentEventSender; +import cn.bootx.payment.param.pay.PayModeParam; +import cn.bootx.payment.param.pay.PayParam; +import cn.bootx.payment.util.PayModelUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + +import static cn.bootx.payment.code.pay.PayStatusCode.*; + +/** + * 支付超时处理 + * @author xxm + * @date 2022/7/13 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class PayExpiredTimeService { + private final PaymentService paymentService; + + private final PaymentEventSender eventSender; + + /** + * 支付单超时支付单处理 + */ + @Async("bigExecutor") + @Transactional(rollbackFor = Exception.class) + public void expiredTime(Long paymentId){ + + Payment payment = paymentService.findById(paymentId) + .orElseThrow(() -> new PayFailureException("支付单未找到")); + // 只处理支付中 + if (!Objects.equals(payment.getPayStatus(),TRADE_PROGRESS)) { + return; + } + // 获取支付网关状态 + PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment); + // 1.获取支付方式,通过工厂生成对应的策略组 + List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); + if (CollUtil.isEmpty(paymentStrategyList)) { + throw new PayUnsupportedMethodException(); + } + + // 2.初始化支付的参数 + for (AbsPayStrategy paymentStrategy : paymentStrategyList) { + paymentStrategy.initPayParam(payment,payParam); + } + + // 3 拿到异步支付方法, 与支付网关进行同步 + PayModeParam asyncPayMode = PayModelUtil.getAsyncPayModeParam(payParam); + AbsPayStrategy syncPayStrategy = PayStrategyFactory.create(asyncPayMode); + syncPayStrategy.initPayParam(payment,payParam); + PaySyncResult paySyncResult = syncPayStrategy.doSyncPayStatusHandler(); + + // 4 对返回的支付网关各种状态进行处理 + int paySyncStatus = paySyncResult.getPaySyncStatus(); + switch (paySyncStatus){ + // 成功状态 + case PaySyncStatus.TRADE_SUCCESS:{ + this.paySuccess(payment,syncPayStrategy,paySyncResult); + break; + } + // 待付款/ 支付中 + case PaySyncStatus.WAIT_BUYER_PAY:{ + this.payCancel(payment,paymentStrategyList); + break; + } + // 超时关闭 和 网关没找到记录 + case PaySyncStatus.TRADE_CLOSED: + case PaySyncStatus.NOT_FOUND: { + this.payClose(payment,paymentStrategyList); + break; + } + // 交易退款 + case PaySyncStatus.TRADE_REFUND:{ + log.info("交易退款不需要关闭: {}",payment.getId()); + break; + } + // 调用出错 进行重试 + case PaySyncStatus.FAIL:{ + log.warn("支付状态同步接口调用出错"); + } + case PaySyncStatus.NOT_SYNC: + default:{ + log.error("支付超时代码有问题"); + } + } + } + + /** + * 如果支付网关是支付中状态, 关闭网关支付, 然后再关闭本地支付单, 排除退款 + */ + private void payCancel(Payment payment, List payStrategies){ + try { + // 异常情况, 不继续进行处理 + if (!this.check(payment)){ + return; + } + // 撤销和关闭支付单 + payStrategies.forEach(AbsPayStrategy::doCancelHandler); + payment.setPayStatus(TRADE_CANCEL); + paymentService.updateById(payment); + // 发送事件 + eventSender.sendPayCancel(PayEventBuilder.buildPayCancel(payment)); + } catch (Exception e) { + log.warn("支付状态同步后关闭支付单报错了",e); + } + } + + /** + * 如果支付网关是关闭或未找到, 关闭本地支付单 + */ + private void payClose(Payment payment, List absPayStrategies) { + try { + // 已关闭的不再进行关闭 + if (Objects.equals(payment.getPayStatus(), TRADE_CANCEL)){ + return; + } + // 退款状态则不进行更新 + if (Objects.equals(payment.getPayStatus(), TRADE_REFUNDED) + ||Objects.equals(payment.getPayStatus(), TRADE_REFUNDING)){ + return; + } + // 异常情况, 不继续进行处理 + if (!this.check(payment)){ + return; + } + // 关闭支付单 + absPayStrategies.forEach(AbsPayStrategy::doCloseHandler); + payment.setPayStatus(TRADE_CANCEL); + paymentService.updateById(payment); + // 发送事件 + eventSender.sendPayCancel(PayEventBuilder.buildPayCancel(payment)); + } catch (Exception e) { + log.warn("支付状态同步后关闭支付单报错了",e); + } + } + + /** + * 如果是支付网关是支付完成状态, 记录为异常支付单 + */ + private void paySuccess(Payment payment, AbsPayStrategy syncPayStrategy, PaySyncResult paySyncResult) { + // 修改payment支付状态为成功 + log.error("支付网关支付单已被支付, 需要线下处理: {}", payment.getId()); + } + + /** + * 校验状态, 处理在发起撤销与正式处理之间订单被完成的情况. 理论上不会发生 + */ + private boolean check(Payment payment){ + // 支付失败/撤销/退款不需要处理 + List trades = Arrays.asList(TRADE_FAIL, TRADE_CANCEL,TRADE_REFUNDING,TRADE_REFUNDED); + if (trades.contains(payment.getPayStatus())) { + log.info("订单在超时撤销期间发生了操作, 需要人工介入处理"); + return false; + } + return true; + } +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayRefundService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayRefundService.java index 3bf31dfd7ede83646e96c2d5d53c244daf1f9f9d..8fd43ff75bc7136c198fe67f09ba14a79dbe38a5 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayRefundService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayRefundService.java @@ -1,6 +1,5 @@ package cn.bootx.payment.core.pay.service; -import cn.bootx.common.core.entity.UserDetail; import cn.bootx.common.core.util.BigDecimalUtil; import cn.bootx.common.spring.util.WebServletUtil; import cn.bootx.payment.code.pay.PayStatusCode; @@ -25,10 +24,8 @@ import cn.bootx.payment.param.refund.RefundParam; import cn.bootx.starter.auth.util.SecurityUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.DesensitizedUtil; import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.spring.SpringUtil; -import cn.hutool.json.JSONUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -38,12 +35,11 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; +import static cn.bootx.payment.code.pay.PayStatusCode.*; + /** * 支付退款 * @author xxm @@ -62,8 +58,10 @@ public class PayRefundService { */ @Transactional(rollbackFor = Exception.class) public void refund(RefundParam refundParam) { - Optional paymentOptional = Optional.ofNullable(paymentService.getAndCheckPaymentByBusinessId(refundParam.getBusinessId())); - paymentOptional.ifPresent(payment -> this.refundPayment(payment,refundParam.getRefundModeParams())); + Payment payment = paymentService.findByBusinessId(refundParam.getBusinessId()) + .orElseThrow(() -> new PayFailureException("未找到支付单")); + + this.refundPayment(payment,refundParam.getRefundModeParams()); } /** @@ -71,26 +69,33 @@ public class PayRefundService { */ @Transactional(rollbackFor = Exception.class) public void refundByBusinessId(String businessId) { - Optional paymentOptional = Optional.ofNullable(paymentService.getAndCheckPaymentByBusinessId(businessId)); - paymentOptional.ifPresent(payment -> this.refundPayment(payment,payment.getRefundableInfoList().stream() - .map(o -> new RefundModeParam() - .setPayChannel(o.getPayChannel()) - .setAmount(o.getAmount())) - .collect(Collectors.toList()) - ) - ); + Payment payment = paymentService.findByBusinessId(businessId) + .orElseThrow(() -> new PayFailureException("未找到支付单")); + List refundModeParams = payment.getRefundableInfo().stream() + .map(o -> new RefundModeParam() + .setPayChannel(o.getPayChannel()) + .setAmount(o.getAmount())) + .collect(Collectors.toList()); + this.refundPayment(payment,refundModeParams); + } /** * 退款 */ private void refundPayment(Payment payment, List refundModeParams){ - // 删除退款金额为0的支付通道参数 + // 状态判断, 支付中/失败/撤销不处理 + List trades = Arrays.asList(TRADE_PROGRESS, TRADE_CANCEL,TRADE_FAIL); + if (trades.contains(payment.getPayStatus())) { + throw new PayFailureException("状态非法, 无法退款"); + } + + // 过滤退款金额为0的支付通道参数 refundModeParams.removeIf(refundModeParam -> BigDecimalUtil.compareTo(refundModeParam.getAmount(),BigDecimal.ZERO) == 0); // 获取 paymentParam PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment); // 退款参数检查 - this.payModeCheck(refundModeParams,payment.getRefundableInfoList()); + this.payModeCheck(refundModeParams,payment.getRefundableInfo()); // 1.获取退款参数方式,通过工厂生成对应的策略组 List payModeParams = refundModeParams.stream().map(RefundModeParam::toPayModeParam).collect(Collectors.toList()); @@ -155,8 +160,7 @@ public class PayRefundService { // 执行 successCallback.accept(strategyList, payment); } catch (Exception e) { - // error事件的处理 - this.errorHandler(payment, strategyList, e); + log.warn("退款失败"); throw e; } finally { // 清除 @@ -164,13 +168,6 @@ public class PayRefundService { } } - /** - * 对Error的处理 - */ - private void errorHandler(Payment payment, List strategyList, Exception e) { - log.warn("退款失败"); - } - /** * 支付方式检查 * @param refundModeParams 退款参数 @@ -207,7 +204,7 @@ public class PayRefundService { } /** - * 保存退款记录 + * 保存退款记录 成不成功都记录 */ @Transactional(propagation = Propagation.REQUIRES_NEW) public void saveRefund(Payment payment, BigDecimal amount, List refundModeParams){ @@ -216,7 +213,7 @@ public class PayRefundService { String ip = ServletUtil.getClientIP(request); RefundRecord refundRecord = new RefundRecord() .setRefundRequestNo(AsyncRefundLocal.get()) - .setRefundableInfo(JSONUtil.toJsonStr(refundableInfos)) + .setRefundableInfo(refundableInfos) .setAmount(amount) .setRefundableBalance(payment.getRefundableBalance()) .setClientIp(ip) diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayService.java index 6966d63827b7ee219070d2709a07633458534d52..7d8b4cfa04efe8fbe2878a88bd28dc1558e409b7 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayService.java @@ -1,13 +1,13 @@ package cn.bootx.payment.core.pay.service; +import cn.bootx.common.core.util.LocalDateTimeUtil; +import cn.bootx.common.core.util.ValidationUtil; import cn.bootx.payment.code.pay.PayChannelCode; -import cn.bootx.payment.code.pay.PayStatusCode; -import cn.bootx.payment.core.pay.PayModelUtil; +import cn.bootx.payment.core.pay.builder.PayEventBuilder; import cn.bootx.payment.core.pay.builder.PaymentBuilder; import cn.bootx.payment.core.pay.factory.PayStrategyFactory; import cn.bootx.payment.core.pay.func.AbsPayStrategy; import cn.bootx.payment.core.pay.func.PayStrategyConsumer; -import cn.bootx.payment.core.payment.dao.PaymentManager; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.core.payment.service.PaymentService; import cn.bootx.payment.dto.pay.PayResult; @@ -17,6 +17,7 @@ import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; import cn.bootx.payment.mq.PaymentEventSender; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.pay.PayParam; +import cn.bootx.payment.util.PayModelUtil; import cn.hutool.core.collection.CollectionUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -27,6 +28,8 @@ import java.time.LocalDateTime; import java.util.*; import java.util.function.Consumer; +import static cn.bootx.payment.code.pay.PayStatusCode.*; + /** * 支付流程 * @author xxm @@ -37,26 +40,25 @@ import java.util.function.Consumer; @RequiredArgsConstructor public class PayService { private final PaymentService paymentService; - private final PayValidationService payValidationService; - private final PaymentManager paymentManager; private final PaymentEventSender eventSender; /** * 支付方法(同步/异步/组合支付) * 同步支付:都只会在第一次执行中就完成支付,例如钱包、积分都是调用完就进行了扣减,完成了支付记录 - * 异步支付:例如支付宝、微信,发起支付后还需要跳转第三方平台进行支付,支付后进行回调支付中心,才完成支付记录 - * 组合支付:主要是混合了同步支付和异步支付,同时异步支付只能有一个,在支付时先对同步支付进行扣减,然后异步支付回调完成完成整个支付单 + * 异步支付:例如支付宝、微信,发起支付后还需要跳转第三方平台进行支付,支付后通常需要进行回调,之后才完成支付记录 + * 组合支付:主要是混合了同步支付和异步支付,同时异步支付只能有一个,在支付时先对同步支付进行扣减,然后异步支付回调结束后完成整个支付单 * 组合支付在非第一次支付的时候,只对新传入的异步支付PayMode进行处理,PayMode的价格使用第一次发起的价格,旧的同步支付如果传入后也不做处理, * Payment中PayModeList将会为 旧有的同步支付+新传入的异步支付方式(在具体支付实现中处理) */ @Transactional(rollbackFor = Exception.class) public PayResult pay(PayParam payParam) { - // 支付参数检查 - payValidationService.validationAsyncPayMode(payParam); + ValidationUtil.validateParam(payParam); + // 异步支付方法检查 + PayModelUtil.validationAsyncPayMode(payParam); // 获取并校验支付状态 - Payment payment = paymentService.getAndCheckPaymentByBusinessId(payParam.getBusinessId()); + Payment payment = this.getAndCheckPaymentByBusinessId(payParam.getBusinessId()); // 异步支付且非第一次支付 if (Objects.nonNull(payment) && payment.isAsyncPayMode()){ @@ -77,35 +79,68 @@ public class PayService { } // 1. 价格检测 - payValidationService.validationAmount(payParam.getPayModeList()); + PayModelUtil.validationAmount(payParam.getPayModeList()); // 2. 创建支付记录 payment = this.createPayment(payParam); // 3. 调用支付方法进行发起支付 - this.payMethod(payParam,payment); + this.payFirstMethod(payParam,payment); // 4. 获取支付记录信息 - payment = paymentManager.findById(payment.getId()) + payment = paymentService.findById(payment.getId()) .orElseThrow(PayNotExistedException::new); // 5. 返回支付结果 PayResult payResult = PaymentBuilder.buildResultByPayment(payment); // 如果是支付成功, 发送事件 - if (Objects.equals(payResult.getPayStatus(),PayStatusCode.TRADE_SUCCESS)){ - eventSender.sendPaymentCompleted(payResult); + if (Objects.equals(payResult.getPayStatus(), TRADE_SUCCESS)){ + eventSender.sendPayComplete(PayEventBuilder.buildPayComplete(payment)); } return payResult; } + /** + * 执行支付方法 (第一次支付) + */ + private void payFirstMethod(PayParam payParam, Payment payment){ + + // 1.获取支付方式,通过工厂生成对应的策略组 + List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); + if (CollectionUtil.isEmpty(paymentStrategyList)) { + throw new PayUnsupportedMethodException(); + } + + // 2.初始化支付的参数 + for (AbsPayStrategy paymentStrategy : paymentStrategyList) { + paymentStrategy.initPayParam(payment, payParam); + } + + // 3.支付前准备 + this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doBeforePayHandler, null); + + // 4.支付 + this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doPayHandler, (strategyList, paymentObj) -> { + // 发起支付成功进行的执行方法 + strategyList.forEach(AbsPayStrategy::doSuccessHandler); + // 所有支付方式都是同步时进行Payment处理 + if (PayModelUtil.isNotSync(payParam.getPayModeList())){ + // 修改payment支付状态为成功 + paymentObj.setPayStatus(TRADE_SUCCESS); + paymentObj.setPayTime(LocalDateTime.now()); + } + paymentService.updateById(paymentObj); + }); + } + /** * 异步支付执行(非第一次请求), 只执行异步支付策略, 报错不影响继续发起支付 */ private PayResult paySyncNotFirst(PayParam payParam, Payment payment){ // 0. 处理支付完成情况(完成/退款) - List trades = Arrays.asList(PayStatusCode.TRADE_SUCCESS, PayStatusCode.TRADE_REFUNDING, PayStatusCode.TRADE_REFUNDED); + List trades = Arrays.asList(TRADE_SUCCESS,TRADE_CANCEL,TRADE_REFUNDING, TRADE_REFUNDED); if (trades.contains(payment.getPayStatus())){ return PaymentBuilder.buildResultByPayment(payment); } @@ -120,55 +155,23 @@ public class PayService { paymentStrategy.initPayParam(payment, payParam); } // 3.支付前准备 - this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doBeforePay, null); + this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doBeforePayHandler, null); // 4. 发起支付 this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doPayHandler,(strategyList, paymentObj) -> { // 发起支付成功进行的执行方法 strategyList.forEach(AbsPayStrategy::doSuccessHandler); + paymentService.updateById(paymentObj); }); // 5. 获取支付记录信息 - payment = paymentManager.findById(payment.getId()) + payment = paymentService.findById(payment.getId()) .orElseThrow(PayNotExistedException::new); // 6. 组装返回参数 return PaymentBuilder.buildResultByPayment(payment); } - /** - * 执行支付方法 - */ - private void payMethod(PayParam payParam, Payment payment){ - - // 1.获取支付方式,通过工厂生成对应的策略组 - List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); - if (CollectionUtil.isEmpty(paymentStrategyList)) { - throw new PayUnsupportedMethodException(); - } - - // 2.初始化支付的参数 - for (AbsPayStrategy paymentStrategy : paymentStrategyList) { - paymentStrategy.initPayParam(payment, payParam); - } - - // 3.支付前准备 - this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doBeforePay, null); - - // 4.支付 - this.doHandler(payment, paymentStrategyList, AbsPayStrategy::doPayHandler, (strategyList, paymentObj) -> { - // 发起支付成功进行的执行方法 - strategyList.forEach(AbsPayStrategy::doSuccessHandler); - // 所有支付方式都是同步时进行Payment处理 - if (PayModelUtil.isNotSync(payParam.getPayModeList())){ - // 修改payment支付状态为成功 - paymentObj.setPayStatus(PayStatusCode.TRADE_SUCCESS); - paymentObj.setPayTime(LocalDateTime.now()); - } - paymentManager.updateById(paymentObj); - }); - } - /** * 执行策略中不同的handler @@ -187,7 +190,7 @@ public class PayService { strategyList.forEach(payMethod); // 执行操作成功的处理 - Optional.ofNullable(successMethod).ifPresent(function -> function.accept(strategyList, payment)); + Optional.ofNullable(successMethod).ifPresent(fun -> fun.accept(strategyList, payment)); } /** @@ -218,6 +221,33 @@ public class PayService { private Payment createPayment(PayParam payParam) { // 构建payment记录 并保存 Payment payment = PaymentBuilder.buildPayment(payParam); - return paymentManager.save(payment); + return paymentService.save(payment); + } + + /** + * 校验支付状态,支付成功则返回,支付失败则抛出对应的异常 + */ + private Payment getAndCheckPaymentByBusinessId(String businessId) { + // 根据订单查询支付记录 + Payment payment = paymentService.findByBusinessId(businessId) + .orElse(null); + if (Objects.nonNull(payment)) { + // 支付失败 + List trades = Arrays.asList(TRADE_FAIL, TRADE_CANCEL); + if (trades.contains(payment.getPayStatus())) { + throw new PayFailureException("支付失败或已经被撤销"); + } + // 退款状态 + trades = Arrays.asList(TRADE_REFUNDING, TRADE_REFUNDED); + if (trades.contains(payment.getPayStatus())) { + throw new PayFailureException("支付失败或已经被撤销"); + } + // 支付超时 + if (Objects.nonNull(payment.getExpiredTime())&& LocalDateTimeUtil.ge(LocalDateTime.now(),payment.getExpiredTime())){ + throw new PayFailureException("支付已超时"); + } + return payment; + } + return null; } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PaySyncService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PaySyncService.java index 9194d29610637a7488a6f4013c26abdb9c5e3121..773cd4cee323ac2df388ca28d8aefe6ad56b9b61 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PaySyncService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PaySyncService.java @@ -1,22 +1,20 @@ package cn.bootx.payment.core.pay.service; import cn.bootx.common.core.exception.BizException; -import cn.bootx.payment.code.pay.PayStatusCode; import cn.bootx.payment.code.pay.PaySyncStatus; -import cn.bootx.payment.core.pay.PayModelUtil; -import cn.bootx.payment.core.pay.result.PaySyncResult; +import cn.bootx.payment.core.pay.builder.PayEventBuilder; +import cn.bootx.payment.core.pay.builder.PaymentBuilder; import cn.bootx.payment.core.pay.factory.PayStrategyFactory; import cn.bootx.payment.core.pay.func.AbsPayStrategy; -import cn.bootx.payment.core.pay.func.PayStrategyConsumer; -import cn.bootx.payment.core.pay.builder.PaymentBuilder; -import cn.bootx.payment.core.payment.dao.PaymentManager; +import cn.bootx.payment.core.pay.result.PaySyncResult; import cn.bootx.payment.core.payment.entity.Payment; -import cn.bootx.payment.dto.pay.PayResult; -import cn.bootx.payment.dto.payment.PaymentDto; +import cn.bootx.payment.core.payment.service.PaymentService; +import cn.bootx.payment.exception.payment.PayFailureException; import cn.bootx.payment.exception.payment.PayUnsupportedMethodException; import cn.bootx.payment.mq.PaymentEventSender; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.pay.PayParam; +import cn.bootx.payment.util.PayModelUtil; import cn.hutool.core.collection.CollUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -26,6 +24,8 @@ import java.time.LocalDateTime; import java.util.List; import java.util.Objects; +import static cn.bootx.payment.code.pay.PayStatusCode.*; + /** * 未完成的异步支付单与支付网关进行对比 * @author xxm @@ -35,26 +35,36 @@ import java.util.Objects; @Service @RequiredArgsConstructor public class PaySyncService { - - private final PaymentManager paymentManager; + private final PaymentService paymentService; private final PaymentEventSender eventSender; + /** * 同步订单的支付状态 */ - public PaymentDto syncByBusinessId(String businessId){ - List payments = paymentManager.findByBusinessIdNoCancelDesc(businessId); - if (CollUtil.isEmpty(payments)){ - return null; + public void syncByPaymentId(Long id){ + Payment payment = paymentService.findById(id).orElse(null); + if (Objects.isNull(payment)){ + return ; } - Payment payment = payments.get(0); - return this.syncPayment(payment).toDto(); + this.syncPayment(payment); } /** - * 同步支付状态 + * 同步订单的支付状态 */ - private Payment syncPayment(Payment payment){ + public void syncByBusinessId(String businessId){ + Payment payment = paymentService.findByBusinessId(businessId).orElse(null); + if (Objects.isNull(payment)){ + return ; + } + this.syncPayment(payment); + } + + /** + * 同步支付状态 传入 payment 对象 + */ + public void syncPayment(Payment payment){ PayParam payParam = PaymentBuilder.buildPayParamByPayment(payment); // 1.获取支付方式,通过工厂生成对应的策略组 List paymentStrategyList = PayStrategyFactory.create(payParam.getPayModeList()); @@ -75,24 +85,28 @@ public class PaySyncService { int paySyncStatus = paySyncResult.getPaySyncStatus(); switch (paySyncStatus){ - // 支付成功 + // 支付成功 支付宝退款时也是支付成功状态, 除非支付完成 case PaySyncStatus.TRADE_SUCCESS:{ - // payment 变更为支付成功 this.paymentSuccess(payment,syncPayStrategy,paySyncResult); break; } - // 待付款 理论上不会出现, 不进行处理 + // 待付款/ 支付中 case PaySyncStatus.WAIT_BUYER_PAY:{ - log.warn("依然是代付款状态"); + log.info("依然是付款状态"); break; } - // 网关已经超时关闭 和 网关没找到记录 + // 订单已经关闭超时关闭 和 网关没找到记录, 支付宝退款完成也是这个状态 case PaySyncStatus.TRADE_CLOSED: case PaySyncStatus.NOT_FOUND: { // 判断下是否超时, 同时payment 变更为取消支付 this.paymentCancel(payment,paymentStrategyList); break; } + // 交易退款 支付宝没这个状态 + case PaySyncStatus.TRADE_REFUND:{ + this.paymentRefund(payment,syncPayStrategy,paySyncResult); + break; + } // 调用出错 case PaySyncStatus.FAIL:{ // 不进行处理 @@ -104,21 +118,8 @@ public class PaySyncService { throw new BizException("代码有问题"); } } - return payment; } - /** - * payment 变更为取消支付 - */ - private void paymentCancel(Payment payment, List absPayStrategies) { - // 关闭本地支付记录 - this.doHandler(payment,absPayStrategies,(strategyList, paymentObj) -> { - strategyList.forEach(AbsPayStrategy::doCloseHandler); - // 修改payment支付状态为取消 - payment.setPayStatus(PayStatusCode.TRADE_CANCEL); - paymentManager.updateById(payment); - }); - } /** * payment 变更为已支付 @@ -126,43 +127,55 @@ public class PaySyncService { private void paymentSuccess(Payment payment, AbsPayStrategy syncPayStrategy, PaySyncResult paySyncResult) { // 已支付不在重复处理 - if (Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_SUCCESS)){ + if (Objects.equals(payment.getPayStatus(), TRADE_SUCCESS)){ + return; + } + // 退款的不处理 + if (Objects.equals(payment.getPayStatus(), TRADE_REFUNDED) + ||Objects.equals(payment.getPayStatus(), TRADE_REFUNDING)){ return; } - syncPayStrategy.doAsyncSuccessHandler(paySyncResult.getMap()); // 修改payment支付状态为成功 - payment.setPayStatus(PayStatusCode.TRADE_SUCCESS); + syncPayStrategy.doAsyncSuccessHandler(paySyncResult.getMap()); + payment.setPayStatus(TRADE_SUCCESS); payment.setPayTime(LocalDateTime.now()); - paymentManager.updateById(payment); + paymentService.updateById(payment); // 发送成功事件 - PayResult payResult = PaymentBuilder.buildResultByPayment(payment); - eventSender.sendPaymentCompleted(payResult); + eventSender.sendPayComplete(PayEventBuilder.buildPayComplete(payment)); } /** - * 处理方法 - * @param payment 支付记录 - * @param strategyList 支付策略 - * @param callback 回调 + * payment 变更为取消支付 */ - private void doHandler(Payment payment, - List strategyList, - PayStrategyConsumer, Payment> callback) { + private void paymentCancel(Payment payment, List absPayStrategies) { try { - // 执行 - callback.accept(strategyList, payment); + // 已关闭的不再进行关闭 + if (Objects.equals(payment.getPayStatus(), TRADE_CANCEL)){ + return; + } + // 修改payment支付状态为取消, 退款状态则不进行更新 + if (Objects.equals(payment.getPayStatus(), TRADE_REFUNDED) + ||Objects.equals(payment.getPayStatus(), TRADE_REFUNDING)){ + return; + } + payment.setPayStatus(TRADE_CANCEL); + // 执行策略的关闭方法 + absPayStrategies.forEach(AbsPayStrategy::doCloseHandler); + paymentService.updateById(payment); + // 发送事件 + eventSender.sendPayCancel(PayEventBuilder.buildPayCancel(payment)); } catch (Exception e) { - // error事件的处理 - this.errorHandler(payment, strategyList, e); + log.warn("支付状态同步后关闭支付单报错了",e); + throw new PayFailureException("支付状态同步后关闭支付单报错了"); } } + /** - * 对Error的处理 + * payment 退款处理 TODO 需要考虑退款详情的合并处理 */ - private void errorHandler(Payment payment, List strategyList, Exception e) { - // 待编写 - log.warn("支付状态同步方法报错了"); + private void paymentRefund(Payment payment, AbsPayStrategy syncPayStrategy, PaySyncResult paySyncResult){ + } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayValidationService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayValidationService.java deleted file mode 100644 index abfdb59bf872e7ba75dc44c08caf8ce8511bd297..0000000000000000000000000000000000000000 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/service/PayValidationService.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.payment.core.pay.service; - -import cn.bootx.common.core.util.BigDecimalUtil; -import cn.bootx.payment.code.pay.PayChannelCode; -import cn.bootx.payment.exception.payment.PayAmountAbnormalException; -import cn.bootx.payment.exception.payment.PayFailureException; -import cn.bootx.payment.param.pay.PayModeParam; -import cn.bootx.payment.param.pay.PayParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.List; - -/** -* 支付时校验服务 -* @author xxm -* @date 2021/7/4 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class PayValidationService { - - /** - * 检查支付金额 - */ - public void validationAmount(List payModeList){ - for (PayModeParam payModeParam : payModeList) { - // 同时满足支付金额小于等于零 - if (BigDecimalUtil.compareTo(payModeParam.getAmount(), BigDecimal.ZERO) < 1){ - throw new PayAmountAbnormalException(); - } - } - } - - /** - * 检查异步支付方式 - */ - public void validationAsyncPayMode(PayParam payParam) { - // 组合支付时只允许有一个异步支付方式 - List payModeList = payParam.getPayModeList(); - - long asyncPayModeCount = payModeList.stream() - .map(PayModeParam::getPayChannel) - .filter(PayChannelCode.ASYNC_TYPE::contains) - .count(); - if (asyncPayModeCount>1){ - throw new PayFailureException("组合支付时只允许有一个异步支付方式"); - } - } -} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/AliPayStrategy.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/AliPayStrategy.java index f56fd631781ab83166767edc522e4bcc6b2346a6..1a9679f46d09f9bbb7bebf29bd8d1d2b2d65f512 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/AliPayStrategy.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/AliPayStrategy.java @@ -1,5 +1,6 @@ package cn.bootx.payment.core.pay.strategy; +import cn.bootx.common.core.exception.BizException; import cn.bootx.common.core.util.BigDecimalUtil; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.code.pay.PayChannelEnum; @@ -15,15 +16,20 @@ import cn.bootx.payment.exception.payment.PayAmountAbnormalException; import cn.bootx.payment.exception.payment.PayFailureException; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.paymodel.alipay.AliPayParam; +import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONException; import cn.hutool.json.JSONUtil; +import com.ijpay.alipay.AliPayApiConfig; +import com.ijpay.alipay.AliPayApiConfigKit; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.util.Map; +import java.util.Objects; import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE; @@ -80,7 +86,7 @@ public class AliPayStrategy extends AbsPayStrategy { if (StrUtil.isBlank(aliPayParam.getReturnUrl())){ aliPayParam.setReturnUrl(alipayConfig.getReturnUrl()); } - AlipayConfigService.initApiConfig(alipayConfig); + this.initAlipayConfig(); } /** @@ -176,6 +182,42 @@ public class AliPayStrategy extends AbsPayStrategy { // 检查并获取支付宝支付配置 this.alipayConfig = alipayConfigManager.findActivity() .orElseThrow(() -> new PayFailureException("支付配置不存在")); - AlipayConfigService.initApiConfig(this.alipayConfig); + this.initApiConfig(this.alipayConfig); + } + + /** + * 初始化IJPay 服务 + */ + @SneakyThrows + private void initApiConfig(AlipayConfig alipayConfig){ + + AliPayApiConfig aliPayApiConfig; + // 公钥 + if (Objects.equals(alipayConfig.getAuthType(), AliPayCode.AUTH_TYPE_KEY)){ + aliPayApiConfig = AliPayApiConfig.builder() + .setAppId(alipayConfig.getAppId()) + .setPrivateKey(alipayConfig.getPrivateKey()) + .setAliPayPublicKey(alipayConfig.getAlipayPublicKey()) + .setCharset(CharsetUtil.UTF_8) + .setServiceUrl(alipayConfig.getServerUrl()) + .setSignType(alipayConfig.getSignType()) + .build(); + } + // 证书 + else if (Objects.equals(alipayConfig.getAuthType(), AliPayCode.AUTH_TYPE_CART)){ + aliPayApiConfig = AliPayApiConfig.builder() + .setAppId(alipayConfig.getAppId()) + .setPrivateKey(alipayConfig.getPrivateKey()) + .setAppCertContent(alipayConfig.getAppCert()) + .setAliPayCertContent(alipayConfig.getAlipayCert()) + .setAliPayRootCertContent(alipayConfig.getAlipayRootCert()) + .setCharset(CharsetUtil.UTF_8) + .setServiceUrl(alipayConfig.getServerUrl()) + .setSignType(alipayConfig.getSignType()) + .buildByCertContent(); + } else { + throw new BizException("支付宝认证方式不可为空"); + } + AliPayApiConfigKit.setThreadLocalAliPayApiConfig(aliPayApiConfig); } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/WeChatPayStrategy.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/WeChatPayStrategy.java index 72083a1d2c6b39d12c3514b79679c86f65a009fa..653d497a7a6914fcd0ba9b90e97d13005452a7a4 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/WeChatPayStrategy.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/strategy/WeChatPayStrategy.java @@ -9,7 +9,9 @@ import cn.bootx.payment.core.pay.func.AbsPayStrategy; import cn.bootx.payment.core.pay.result.PaySyncResult; import cn.bootx.payment.core.payment.service.PaymentService; import cn.bootx.payment.core.paymodel.wechat.dao.WeChatPayConfigManager; +import cn.bootx.payment.core.paymodel.wechat.dao.WeChatPaymentManager; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; +import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayment; import cn.bootx.payment.core.paymodel.wechat.service.*; import cn.bootx.payment.exception.payment.PayAmountAbnormalException; import cn.bootx.payment.exception.payment.PayFailureException; @@ -41,6 +43,7 @@ public class WeChatPayStrategy extends AbsPayStrategy { private final WeChatPayConfigManager weChatPayConfigManager; private final WeChatPayService weChatPayService; private final WeChatPaymentService weChatPaymentService; + private final WeChatPaymentManager weChatPaymentManager; private final WeChatPayCancelService weChatPayCancelService; private final WeChatPaySyncService weChatPaySyncService; private final PaymentService paymentService; @@ -65,7 +68,6 @@ public class WeChatPayStrategy extends AbsPayStrategy { // 微信参数验证 String extraParamsJson = this.getPayMode().getExtraParamsJson(); if (StrUtil.isNotBlank(extraParamsJson)){ - this.weChatPayParam = JSONUtil.toBean(extraParamsJson, WeChatPayParam.class); } else { this.weChatPayParam = new WeChatPayParam(); @@ -83,7 +85,6 @@ public class WeChatPayStrategy extends AbsPayStrategy { // 检查并获取微信支付配置 this.initWeChatPayConfig(); weChatPayService.validation(this.getPayMode(),weChatPayConfig); - WeChatPayConfigService.initApiConfig(weChatPayConfig); } /** @@ -118,8 +119,8 @@ public class WeChatPayStrategy extends AbsPayStrategy { */ @Override public void doAsyncSuccessHandler(Map map) { - String tradeNo = map.get(WeChatPayCode.OUT_TRADE_NO); - weChatPaymentService.updateSyncSuccess(this.getPayment().getId(),this.getPayMode(),tradeNo); + String tradeNo = map.get(WeChatPayCode.TRANSACTION_ID); + weChatPaymentService.updateAsyncSuccess(this.getPayment().getId(),this.getPayMode(),tradeNo); } /** @@ -157,7 +158,10 @@ public class WeChatPayStrategy extends AbsPayStrategy { @Override public void doRefundHandler() { this.initWeChatPayConfig(); - weChatPaymentService.updatePayRefund(this.getPayment().getId(),this.getPayMode().getAmount()); + WeChatPayment weChatPayment = weChatPaymentManager.findByPaymentId(this.getPayment().getId()) + .orElseThrow(() -> new PayFailureException("微信支付记录不存在")); + weChatPayCancelService.refund(this.getPayment(),weChatPayment,this.getPayMode().getAmount(),this.weChatPayConfig); + weChatPaymentService.updatePayRefund(weChatPayment,this.getPayMode().getAmount()); paymentService.updateRefundSuccess(this.getPayment(),this.getPayMode().getAmount(), PayChannelEnum.WECHAT); } @@ -177,8 +181,7 @@ public class WeChatPayStrategy extends AbsPayStrategy { private void initWeChatPayConfig(){ // 检查并获取微信支付配置 this.weChatPayConfig = Optional.ofNullable(this.weChatPayConfig) - .orElse(weChatPayConfigManager.findEnable() + .orElse(weChatPayConfigManager.findActivity() .orElseThrow(() -> new PayFailureException("支付配置不存在"))); - WeChatPayConfigService.initApiConfig(weChatPayConfig);; } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentExpiredTimeRepository.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentExpiredTimeRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..626e9f0c3789b5b7f11c0bd13b0e8f4c3c706f3e --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentExpiredTimeRepository.java @@ -0,0 +1,50 @@ +package cn.bootx.payment.core.payment.dao; + +import cn.bootx.common.core.util.LocalDateTimeUtil; +import cn.bootx.common.redis.RedisClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Repository; + +import java.time.LocalDateTime; +import java.util.Set; + +/** +* 支付单过去处理 +* @author xxm +* @date 2022/7/12 +*/ +@Slf4j +@Repository +@RequiredArgsConstructor +public class PaymentExpiredTimeRepository { + + private static final String KEY = "pay:payment:expiredtime"; + + private final RedisClient redisClient; + + /** + * 根据 token 存储对应的 ExpiredTokenKey + */ + public void store(Long paymentId, LocalDateTime expiredTime) { + long time = LocalDateTimeUtil.timestamp(expiredTime); + redisClient.zadd(KEY, String.valueOf(paymentId), time); + } + + /** + * 获取所有已过期的ExpiredTokenKey + */ + public Set retrieveExpiredKeys(LocalDateTime expiredTime) { + long time = LocalDateTimeUtil.timestamp(expiredTime); + return redisClient.zrangeByScore(KEY, 0L, time); + } + + /** + * 删除指定的ExpiredTokenKey + */ + public void removeKeys(String... keys) { + if (keys != null && keys.length > 0) { + redisClient.zremByMembers(KEY, keys); + } + } +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentManager.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentManager.java index b883543f912dd095989cc0dd463b03f28c0eb227..4ffdf05c733659177485fa102fc163219c7c04ca 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentManager.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/dao/PaymentManager.java @@ -2,49 +2,55 @@ package cn.bootx.payment.core.payment.dao; import cn.bootx.common.core.rest.param.OrderParam; import cn.bootx.common.core.rest.param.PageParam; +import cn.bootx.common.mybatisplus.handler.MpBigFieldHandler; import cn.bootx.common.mybatisplus.impl.BaseManager; import cn.bootx.common.mybatisplus.util.MpUtil; import cn.bootx.common.query.entity.QueryParams; import cn.bootx.common.query.generator.QueryGenerator; -import cn.bootx.payment.code.pay.PayStatusCode; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.param.payment.PaymentQuery; -import cn.hutool.core.text.NamingCase; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.cache.annotation.Caching; import org.springframework.stereotype.Repository; +import java.io.Serializable; import java.util.List; import java.util.Objects; +import java.util.Optional; + +import static cn.bootx.payment.code.CachingCode.PAYMENT_BUSINESS_ID; +import static cn.bootx.payment.code.CachingCode.PAYMENT_ID; @Repository @RequiredArgsConstructor public class PaymentManager extends BaseManager { - /** - * 按业务ID顺序按创建时间Desc查找非取消的支付单 - */ - public List findByBusinessIdNoCancelDesc(String businessId) { - // "FROM Payment WHERE businessId = ?1 AND payStatus ?2 order by createTime description" + @Override + @Caching(evict = { + @CacheEvict(value = PAYMENT_ID,key = "#payment.id"), + @CacheEvict(value = PAYMENT_BUSINESS_ID,key = "#payment.businessId") + }) + public Payment updateById(Payment payment) { + return super.updateById(payment); + } - return lambdaQuery() - .eq(Payment::getBusinessId,businessId) - .notIn(Payment::getPayStatus,PayStatusCode.TRADE_CANCEL) - .orderByDesc(Payment::getId) - .list(); + @Override + @Cacheable(value = {PAYMENT_ID}, key = "#id") + public Optional findById(Serializable id) { + return super.findById(id); } /** - * 按业务ID顺序按创建时间Desc查找的支付单 + * 根据BusinessId查询 */ - public List findByBusinessIdDesc(String businessId) { - // "FROM Payment WHERE businessId = ?1 order by createTime description" - return lambdaQuery() - .eq(Payment::getBusinessId,businessId) - .orderByDesc(Payment::getId) - .list(); + @Cacheable(value = {PAYMENT_BUSINESS_ID}, key = "#businessId") + public Optional findByBusinessId(String businessId){ + return findByField(Payment::getBusinessId,businessId); } /** @@ -60,6 +66,7 @@ public class PaymentManager extends BaseManager { public Page page(PageParam pageParam, PaymentQuery param, OrderParam orderParam) { Page mpPage = MpUtil.getMpPage(pageParam, Payment.class); return query() + .select(Payment.class, MpBigFieldHandler::excludeBigField) .orderBy(Objects.nonNull(orderParam.getSortField()),orderParam.isAsc(), StrUtil.toUnderlineCase(orderParam.getSortField())) .like(Objects.nonNull(param.getPaymentId()), MpUtil.getColumnName(Payment::getId),param.getPaymentId()) .like(Objects.nonNull(param.getBusinessId()),MpUtil.getColumnName(Payment::getBusinessId),param.getBusinessId()) diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/entity/Payment.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/entity/Payment.java index ea2f8cca998720c7238d2bb27d89437fd0e203cf..5cba59a72eabef7703ea5d55f282df1985547cd6 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/entity/Payment.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/entity/Payment.java @@ -1,15 +1,15 @@ package cn.bootx.payment.core.payment.entity; +import cn.bootx.common.core.annotation.BigField; import cn.bootx.common.core.function.EntityBaseFunction; import cn.bootx.common.mybatisplus.base.MpBaseEntity; +import cn.bootx.common.mybatisplus.handler.JacksonListTypeHandler; import cn.bootx.payment.code.pay.PayStatusCode; import cn.bootx.payment.core.payment.convert.PaymentConvert; import cn.bootx.payment.dto.payment.PayChannelInfo; import cn.bootx.payment.dto.payment.PaymentDto; import cn.bootx.payment.dto.payment.RefundableInfo; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -18,7 +18,6 @@ import lombok.experimental.FieldNameConstants; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.List; /** @@ -30,7 +29,7 @@ import java.util.List; @Data @FieldNameConstants @Accessors(chain = true) -@TableName("pay_payment") +@TableName(value = "pay_payment",autoResultMap = true) public class Payment extends MpBaseEntity implements EntityBaseFunction { /** 关联的业务id */ @@ -67,17 +66,21 @@ public class Payment extends MpBaseEntity implements EntityBaseFunction payChannelInfo; /** * 退款信息列表 * @see cn.bootx.payment.dto.payment.RefundableInfo */ - private String refundableInfo; + @TableField(typeHandler = JacksonListTypeHandler.class) + @BigField + private List refundableInfo; /** * 支付状态 - * @see PayStatusCode + * @see PayStatusCode#TRADE_PROGRESS */ private Integer payStatus; @@ -87,7 +90,7 @@ public class Payment extends MpBaseEntity implements EntityBaseFunction getPayChannelInfoList(){ - if (StrUtil.isNotBlank(this.payChannelInfo)){ - JSONArray array = JSONUtil.parseArray(this.payChannelInfo); - return JSONUtil.toList(array, PayChannelInfo.class); - } - return new ArrayList<>(0); - } - - /** - * 获取可退款信息列表 - */ - public List getRefundableInfoList(){ - if (StrUtil.isNotBlank(this.refundableInfo)){ - JSONArray array = JSONUtil.parseArray(this.refundableInfo); - return JSONUtil.toList(array, RefundableInfo.class); - } - return new ArrayList<>(0); - } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentQueryService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentQueryService.java index 050f50962ad6dec442841d8a573faea73d1995a9..0bf8f430609266c2863fb615d91cb4efb1693241 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentQueryService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentQueryService.java @@ -11,7 +11,6 @@ import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.dto.payment.PayChannelInfo; import cn.bootx.payment.dto.payment.PaymentDto; import cn.bootx.payment.param.payment.PaymentQuery; -import cn.hutool.core.collection.CollectionUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -40,36 +39,21 @@ public class PaymentQueryService { .orElseThrow(DataNotExistException::new); } - /** - * 根据业务ID获取成功记录 - */ - public List findByBusinessId(String businessId){ - return paymentManager.findByBusinessIdDesc(businessId).stream() - .map(Payment::toDto) - .collect(Collectors.toList()); - } - /** * 根据业务ID获取支付状态 */ public Integer findStatusByBusinessId(String businessId){ - // 根据订单查询支付记录 - List payments = paymentManager.findByBusinessIdNoCancelDesc(businessId); - if (!CollectionUtil.isEmpty(payments)) { - Payment payment = payments.get(0); - return payment.getPayStatus(); - } - return -1; + return paymentManager.findByBusinessId(businessId) + .map(Payment::getPayStatus) + .orElse(-1); } /** * 根据businessId获取订单支付方式 */ public List findPayTypeInfoByBusinessId(String businessId){ - List payments = paymentManager.findByBusinessIdDesc(businessId); - return payments.stream() - .findFirst() - .map(Payment::getPayChannelInfoList) + return paymentManager.findByBusinessId(businessId) + .map(Payment::getPayChannelInfo) .orElse(new ArrayList<>(1)); } @@ -78,7 +62,7 @@ public class PaymentQueryService { */ public List findPayTypeInfoById(Long id){ return paymentManager.findById(id) - .map(Payment::getPayChannelInfoList) + .map(Payment::getPayChannelInfo) .orElse(new ArrayList<>(1)); } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentService.java index 192fe939aafc0b1b285ddeafda49878f5f7e1132..d47774a14478ae4e2c7c02e42c9cd0504cb6ec7c 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/payment/service/PaymentService.java @@ -1,21 +1,29 @@ package cn.bootx.payment.core.payment.service; +import cn.bootx.common.core.util.LocalDateTimeUtil; +import cn.bootx.common.spring.exception.RetryableException; import cn.bootx.payment.code.pay.PayChannelEnum; -import cn.bootx.payment.code.pay.PayStatusCode; +import cn.bootx.payment.core.payment.dao.PaymentExpiredTimeRepository; import cn.bootx.payment.core.payment.dao.PaymentManager; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.dto.payment.RefundableInfo; import cn.bootx.payment.exception.payment.PayFailureException; -import cn.bootx.payment.exception.payment.PayIsProcessingException; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.json.JSONUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.retry.annotation.Retryable; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import java.util.Arrays; import java.util.List; +import java.util.Objects; +import java.util.Optional; + +import static cn.bootx.payment.code.pay.PayStatusCode.*; /** * 支付记录 @@ -27,39 +35,45 @@ import java.util.List; @RequiredArgsConstructor public class PaymentService { private final PaymentManager paymentManager; + private final PaymentExpiredTimeRepository expiredTimeRepository; /** - * 校验支付状态,支付成功则返回,支付失败/支付进行中则抛出对应的异常 + * 保存 */ - public Payment getAndCheckPaymentByBusinessId(String businessId) { - - // 根据订单查询支付记录 - List payments = paymentManager.findByBusinessIdNoCancelDesc(businessId); - if (!CollectionUtil.isEmpty(payments)) { - Payment payment = payments.get(0); + public Payment save(Payment payment){ + return paymentManager.save(payment); + } - // 支付中 (非异步支付方式下) - if (payment.getPayStatus() == PayStatusCode.TRADE_PROGRESS) { - throw new PayIsProcessingException(); - } + /** + * 更新支付记录 + */ + public Payment updateById(Payment payment) { + // 超时注册 + this.registerExpiredTime(payment); + return paymentManager.updateById(payment); + } - // 支付失败 - List trades = Arrays.asList(PayStatusCode.TRADE_FAIL, PayStatusCode.TRADE_CANCEL); - if (trades.contains(payment.getPayStatus())) { - throw new PayFailureException("支付失败或已经被撤销"); - } + /** + * 根据id查询 + */ + public Optional findById(Serializable id) { + return paymentManager.findById(id); + } - return payment; - } - return null; + /** + * 根据BusinessId查询 + */ + public Optional findByBusinessId(String businessId){ + return paymentManager.findByBusinessId(businessId); } + /** - * 退款成功处理, 更新可退款信息 + * 退款成功处理, 更新可退款信息 不进行持久化 */ public void updateRefundSuccess(Payment payment, BigDecimal amount, PayChannelEnum payChannelEnum){ // 删除旧有的退款记录, 替换退款完的新的 - List refundableInfos = payment.getRefundableInfoList(); + List refundableInfos = payment.getRefundableInfo(); RefundableInfo refundableInfo = refundableInfos.stream() .filter(o -> o.getPayChannel() == payChannelEnum.getNo()) .findFirst() @@ -67,7 +81,27 @@ public class PaymentService { refundableInfos.remove(refundableInfo); refundableInfo.setAmount(refundableInfo.getAmount().subtract(amount)); refundableInfos.add(refundableInfo); - payment.setRefundableInfo(JSONUtil.toJsonStr(refundableInfos)); + payment.setRefundableInfo(refundableInfos); + } + + /** + * 支付单超时关闭事件注册, 失败重试3次, 间隔一秒 + */ + @Async("bigExecutor") + @Retryable(value = RetryableException.class) + public void registerExpiredTime(Payment payment){ + LocalDateTime expiredTime = payment.getExpiredTime(); + // 支付中且有超时时间才会注册超时关闭时间 + if (Objects.equals(payment.getPayStatus(),TRADE_PROGRESS)&&Objects.nonNull(expiredTime)){ + try { + // 将过期时间添加到redis中, 往后延时一分钟 + expiredTime = LocalDateTimeUtil.offset(expiredTime, 1, ChronoUnit.MINUTES); + expiredTimeRepository.store(payment.getId(),expiredTime); + } catch (Exception e){ + log.error("注册支付单超时关闭失败"); + throw new RetryableException(); + } + } } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/dao/AlipayConfigManager.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/dao/AlipayConfigManager.java index d64ce1d374f5ab763412120c45eccea18111483f..b902b36573cb19c52b739ec13ac700c9b00f3582 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/dao/AlipayConfigManager.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/dao/AlipayConfigManager.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; +import java.util.Objects; import java.util.Optional; /** @@ -21,14 +22,27 @@ import java.util.Optional; @Repository @RequiredArgsConstructor public class AlipayConfigManager extends BaseManager { + private Optional alipayConfig; + + @Override + public AlipayConfig updateById(AlipayConfig alipayConfig) { + this.clearCache(); + return super.updateById(alipayConfig); + } /** * 获取启用的支付宝配置 */ public Optional findActivity(){ - return findByField(AlipayConfig::getActivity,Boolean.TRUE); + if (Objects.isNull(alipayConfig)){ + alipayConfig = findByField(AlipayConfig::getActivity, Boolean.TRUE); + } + return alipayConfig; } + /** + * 分页 + */ public Page page(PageParam pageParam, AlipayConfigQuery param) { Page mpPage = MpUtil.getMpPage(pageParam, AlipayConfig.class); return lambdaQuery() @@ -38,10 +52,20 @@ public class AlipayConfigManager extends BaseManager params = PARAMS.get(); String callReq = JSONUtil.toJsonStr(params); - String appId = params.get("app_id"); + String appId = params.get(AliPayCode.APP_ID); if (StrUtil.isBlank(appId)) { - log.warn("支付宝回调报文 appId 为空 {}", callReq); + log.error("支付宝回调报文 appId 为空 {}", callReq); return false; } AlipayConfig alipayConfig = alipayConfigManager.findActivity().orElseThrow(DataNotExistException::new); if (alipayConfig == null) { - log.warn("支付宝回调报文 appId 不合法 {}", callReq); + log.error("支付宝支付配置不存在: {}", callReq); return false; } @@ -95,5 +95,4 @@ public class AliPayCallbackService extends AbsPayCallbackStrategy { public String getReturnMsg() { return "success"; } - } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayCancelService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayCancelService.java index 9fb90ca5886ab8c55c0e9277afa0d8d9afb41548..422b928c9c9b6e85197b9bc8fbec9aafbc3e36fd 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayCancelService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayCancelService.java @@ -1,11 +1,11 @@ package cn.bootx.payment.core.paymodel.alipay.service; +import cn.bootx.common.spring.exception.RetryableException; import cn.bootx.payment.code.paymodel.AliPayCode; import cn.bootx.payment.core.pay.local.AsyncRefundLocal; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.exception.payment.PayFailureException; import cn.hutool.core.util.IdUtil; -import cn.hutool.json.JSONUtil; import com.alipay.api.AlipayApiException; import com.alipay.api.domain.AlipayTradeCancelModel; import com.alipay.api.domain.AlipayTradeRefundModel; @@ -14,6 +14,7 @@ import com.alipay.api.response.AlipayTradeRefundResponse; import com.ijpay.alipay.AliPayApi; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -32,6 +33,7 @@ public class AliPayCancelService { /** * 关闭支付 */ + @Retryable(value = RetryableException.class) public void cancelRemote(Payment payment){ // 只有部分需要调用支付宝网关进行关闭 AlipayTradeCancelModel model = new AlipayTradeCancelModel(); @@ -39,7 +41,6 @@ public class AliPayCancelService { try { AlipayTradeCancelResponse response = AliPayApi.tradeCancelToResponse(model); - log.info(JSONUtil.toJsonStr(response)); if (!Objects.equals(AliPayCode.SUCCESS,response.getCode())){ log.error("网关返回撤销失败: {}",response.getSubMsg()); throw new PayFailureException(response.getSubMsg()); @@ -63,7 +64,6 @@ public class AliPayCancelService { refundModel.setOutRequestNo(AsyncRefundLocal.get()); try { AlipayTradeRefundResponse response = AliPayApi.tradeRefundToResponse(refundModel); - log.info(JSONUtil.toJsonStr(response)); if (!Objects.equals(AliPayCode.SUCCESS,response.getCode())){ AsyncRefundLocal.setErrorMsg(response.getSubMsg()); AsyncRefundLocal.setErrorCode(response.getCode()); diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayQueryService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayQueryService.java deleted file mode 100644 index ad3aa99d678c799201870926df30ddaac563655c..0000000000000000000000000000000000000000 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayQueryService.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.bootx.payment.core.paymodel.alipay.service; - -import cn.bootx.payment.core.paymodel.alipay.dao.AlipayConfigManager; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** -* 支付宝查询服务 -* @author xxm -* @date 2021/4/20 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class AliPayQueryService { - private final AlipayConfigManager alipayConfigManager; - - -} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayService.java index 0dcc5d84c7740638d4fb8197f1d3af4c0f061f67..b6a2a304285f206b14c0fb0ec73fc1b350ddf07e 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPayService.java @@ -12,6 +12,7 @@ import cn.bootx.payment.dto.pay.AsyncPayInfo; import cn.bootx.payment.exception.payment.PayFailureException; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.paymodel.alipay.AliPayParam; +import cn.bootx.payment.util.PayModelUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.Method; import com.alipay.api.AlipayApiException; @@ -32,6 +33,9 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import static cn.bootx.payment.code.paymodel.AliPayCode.BAR_CODE; +import static cn.bootx.payment.code.paymodel.AliPayCode.QUICK_MSECURITY_PAY; + /** * 支付宝支付service * @author xxm @@ -63,6 +67,8 @@ public class AliPayService { */ public void pay(BigDecimal amount, Payment payment, AliPayParam aliPayParam, PayModeParam payModeParam, AlipayConfig alipayConfig){ String payBody = null; + // 线程存储 + AsyncPayInfo asyncPayInfo = Optional.ofNullable(AsyncPayInfoLocal.get()).orElse(new AsyncPayInfo()); // wap支付 if (payModeParam.getPayWay()== PayWayCode.WAP){ payBody = this.wapPay(amount, payment,alipayConfig,aliPayParam); @@ -81,18 +87,15 @@ public class AliPayService { } // 付款码支付 else if (payModeParam.getPayWay() == PayWayCode.BARCODE){ - this.barCode(amount, payment,aliPayParam, alipayConfig); - } - - // payBody到线程存储 - if (StrUtil.isNotBlank(payBody)) { - AsyncPayInfo asyncPayInfo = new AsyncPayInfo() - .setPayBody(payBody); - AsyncPayInfoLocal.set(asyncPayInfo); + String tradeNo = this.barCode(amount, payment,aliPayParam, alipayConfig); + asyncPayInfo.setExpiredTime(false) + .setTradeNo(tradeNo); } + // 通常是发起支付的参数 + asyncPayInfo.setPayBody(payBody); + AsyncPayInfoLocal.set(asyncPayInfo); } - /** * wap支付 */ @@ -103,7 +106,8 @@ public class AliPayService { model.setOutTradeNo(String.valueOf(payment.getId())); model.setTotalAmount(amount.toPlainString()); // 过期时间 - model.setTimeoutExpress(alipayConfig.getExpireTime()); + model.setTimeoutExpress(PayModelUtil.getAliExpiredTime(alipayConfig.getExpireTime())); + payment.setExpiredTime(PayModelUtil.getPaymentExpiredTime(alipayConfig.getExpireTime())); model.setProductCode(AliPayCode.QUICK_WAP_PAY); model.setQuitUrl(aliPayParam.getReturnUrl()); @@ -130,9 +134,11 @@ public class AliPayService { AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); model.setSubject(payment.getTitle()); + model.setProductCode(QUICK_MSECURITY_PAY); model.setOutTradeNo(String.valueOf(payment.getId())); // 过期时间 - model.setTimeoutExpress(alipayConfig.getExpireTime()); + model.setTimeoutExpress(PayModelUtil.getAliExpiredTime(alipayConfig.getExpireTime())); + payment.setExpiredTime(PayModelUtil.getPaymentExpiredTime(alipayConfig.getExpireTime())); model.setTotalAmount(amount.toPlainString()); try { @@ -154,7 +160,9 @@ public class AliPayService { model.setSubject(payment.getTitle()); model.setOutTradeNo(String.valueOf(payment.getId())); - model.setTimeoutExpress(alipayConfig.getExpireTime()); + // 过期时间 + model.setTimeoutExpress(PayModelUtil.getAliExpiredTime(alipayConfig.getExpireTime())); + payment.setExpiredTime(PayModelUtil.getPaymentExpiredTime(alipayConfig.getExpireTime())); model.setTotalAmount(amount.toPlainString()); // 目前仅支持FAST_INSTANT_TRADE_PAY model.setProductCode(AliPayCode.FAST_INSTANT_TRADE_PAY); @@ -183,7 +191,8 @@ public class AliPayService { model.setTotalAmount(amount.toPlainString()); // 过期时间 - model.setTimeoutExpress(alipayConfig.getExpireTime()); + model.setTimeoutExpress(PayModelUtil.getAliExpiredTime(alipayConfig.getExpireTime())); + payment.setExpiredTime(PayModelUtil.getPaymentExpiredTime(alipayConfig.getExpireTime())); try { AlipayTradePrecreateResponse response = AliPayApi.tradePrecreatePayToResponse(model, alipayConfig.getNotifyUrl()); @@ -198,16 +207,17 @@ public class AliPayService { /** * 付款码支付 */ - public void barCode(BigDecimal amount, Payment payment, AliPayParam aliPayParam, AlipayConfig alipayConfig) { + public String barCode(BigDecimal amount, Payment payment, AliPayParam aliPayParam, AlipayConfig alipayConfig) { AlipayTradePayModel model = new AlipayTradePayModel(); model.setSubject(payment.getTitle()); model.setOutTradeNo(String.valueOf(payment.getId())); - model.setScene("bar_code"); + model.setScene(BAR_CODE); model.setAuthCode(aliPayParam.getAuthCode()); // 过期时间 - model.setTimeoutExpress(alipayConfig.getExpireTime()); + model.setTimeoutExpress(PayModelUtil.getAliExpiredTime(alipayConfig.getExpireTime())); + payment.setExpiredTime(PayModelUtil.getPaymentExpiredTime(alipayConfig.getExpireTime())); model.setTotalAmount(amount.toPlainString()); try { @@ -217,7 +227,7 @@ public class AliPayService { if (Objects.equals(response.getCode(),AliPayCode.SUCCESS)) { payment.setPayStatus(PayStatusCode.TRADE_SUCCESS) .setPayTime(LocalDateTime.now()); - return; + return response.getTradeNo(); } // 非支付中响应码, 进行错误处理 if (!Objects.equals(response.getCode(),AliPayCode.INPROCESS)){ @@ -227,6 +237,7 @@ public class AliPayService { log.error("主动扫码支付失败", e); throw new PayFailureException("主动扫码支付失败"); } + return null; } /** diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPaymentService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPaymentService.java index eeb51a53a5955bfc15c0e897f3fb94593206ef00..051d5d15b10dcc396036f21ef1a9228c90821815 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPaymentService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AliPaymentService.java @@ -3,15 +3,16 @@ package cn.bootx.payment.core.paymodel.alipay.service; import cn.bootx.common.core.util.BigDecimalUtil; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.code.pay.PayStatusCode; +import cn.bootx.payment.core.pay.local.AsyncPayInfoLocal; import cn.bootx.payment.core.payment.dao.PaymentManager; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.core.paymodel.alipay.dao.AliPaymentManager; import cn.bootx.payment.core.paymodel.alipay.entity.AliPayment; +import cn.bootx.payment.dto.pay.AsyncPayInfo; import cn.bootx.payment.dto.payment.PayChannelInfo; import cn.bootx.payment.dto.payment.RefundableInfo; import cn.bootx.payment.exception.payment.PayFailureException; import cn.bootx.payment.param.pay.PayModeParam; -import cn.hutool.json.JSONUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; +import java.util.Objects; import java.util.Optional; /** @@ -38,12 +40,11 @@ public class AliPaymentService { * 更新 payment 中 异步支付类型信息 */ public void updatePaySuccess(Payment payment, PayModeParam payModeParam) { + AsyncPayInfo asyncPayInfo = AsyncPayInfoLocal.get(); payment.setAsyncPayMode(true) .setAsyncPayChannel(PayChannelCode.ALI); - // TODO 设置超时时间 - - List payTypeInfos = payment.getPayChannelInfoList(); - List refundableInfos = payment.getRefundableInfoList(); + List payTypeInfos = payment.getPayChannelInfo(); + List refundableInfos = payment.getRefundableInfo(); // 清除已有的异步支付类型信息 payTypeInfos.removeIf(payTypeInfo -> PayChannelCode.ASYNC_TYPE.contains(payTypeInfo.getPayChannel())); refundableInfos.removeIf(payTypeInfo -> PayChannelCode.ASYNC_TYPE.contains(payTypeInfo.getPayChannel())); @@ -53,23 +54,32 @@ public class AliPaymentService { .setPayWay(payModeParam.getPayWay()) .setAmount(payModeParam.getAmount()) .setExtraParamsJson(payModeParam.getExtraParamsJson())); - payment.setPayChannelInfo(JSONUtil.toJsonStr(payTypeInfos)); + payment.setPayChannelInfo(payTypeInfos); // 更新支付宝可退款类型信息 refundableInfos.add(new RefundableInfo() .setPayChannel(PayChannelCode.ALI) .setAmount(payModeParam.getAmount())); - payment.setRefundableInfo(JSONUtil.toJsonStr(refundableInfos)); + payment.setRefundableInfo(refundableInfos); + // 如果支付完成(付款码情况) 调用 updateSyncSuccess 创建支付宝支付记录 + if (Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_SUCCESS)){ + this.createAliPayment(payment,payModeParam,asyncPayInfo.getTradeNo()); + } } /** * 更新异步支付记录成功状态, 并创建支付宝支付记录 */ public void updateAsyncSuccess(Long id, PayModeParam payModeParam, String tradeNo) { - // 更新支付记录 Payment payment = paymentManager.findById(id) .orElseThrow(() -> new PayFailureException("支付记录不存在")); + } + + /** + * 创建支付宝支付记录 + */ + private void createAliPayment(Payment payment, PayModeParam payModeParam, String tradeNo){ // 创建支付宝支付记录 AliPayment aliPayment = new AliPayment(); aliPayment.setTradeNo(tradeNo) diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipayConfigService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipayConfigService.java index 1cda73ccd1e89a427d3d3f492ea23c1a2065efc8..9df85d771939baadcc8558288a84444c8418c85d 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipayConfigService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipayConfigService.java @@ -1,12 +1,10 @@ package cn.bootx.payment.core.paymodel.alipay.service; -import cn.bootx.common.core.exception.BizException; import cn.bootx.common.core.exception.DataNotExistException; import cn.bootx.common.core.rest.PageResult; import cn.bootx.common.core.rest.dto.KeyValue; import cn.bootx.common.core.rest.param.PageParam; import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.payment.code.paymodel.AliPayCode; import cn.bootx.payment.code.paymodel.AliPayWay; import cn.bootx.payment.core.paymodel.alipay.dao.AlipayConfigManager; import cn.bootx.payment.core.paymodel.alipay.entity.AlipayConfig; @@ -17,11 +15,7 @@ import cn.bootx.payment.param.paymodel.alipay.AlipayConfigQuery; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.CharsetUtil; -import com.ijpay.alipay.AliPayApiConfig; -import com.ijpay.alipay.AliPayApiConfigKit; import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -45,12 +39,11 @@ public class AlipayConfigService { * 添加支付宝配置 */ @Transactional(rollbackFor = Exception.class) - public AlipayConfigDto add(AlipayConfigParam param){ + public void add(AlipayConfigParam param){ AlipayConfig alipayConfig = AlipayConfig.init(param); alipayConfig.setActivity(false) .setState(1); - AlipayConfig save = alipayConfigManager.save(alipayConfig); - return save.toDto(); + alipayConfigManager.save(alipayConfig); } /** @@ -84,7 +77,7 @@ public class AlipayConfigService { * 修改 */ @Transactional(rollbackFor = Exception.class) - public AlipayConfigDto update(AlipayConfigParam param){ + public void update(AlipayConfigParam param){ AlipayConfig alipayConfig = alipayConfigManager.findById(param.getId()) .orElseThrow(DataNotExistException::new); BeanUtil.copyProperties(param,alipayConfig, CopyOptions.create().ignoreNullValue()); @@ -94,7 +87,7 @@ public class AlipayConfigService { } else { alipayConfig.setPayWays(null); } - return alipayConfigManager.updateById(alipayConfig).toDto(); + alipayConfigManager.updateById(alipayConfig); } /** @@ -122,40 +115,4 @@ public class AlipayConfigService { .collect(Collectors.toList()); } - /** - * 移到工具类中 - */ - @SneakyThrows - public static void initApiConfig(AlipayConfig alipayConfig){ - - AliPayApiConfig aliPayApiConfig; - // 公钥 - if (Objects.equals(alipayConfig.getAuthType(), AliPayCode.AUTH_TYPE_KEY)){ - aliPayApiConfig = AliPayApiConfig.builder() - .setAppId(alipayConfig.getAppId()) - .setPrivateKey(alipayConfig.getPrivateKey()) - .setAliPayPublicKey(alipayConfig.getAlipayPublicKey()) - .setCharset(CharsetUtil.UTF_8) - .setServiceUrl(alipayConfig.getServerUrl()) - .setSignType(alipayConfig.getSignType()) - .build(); - } - // 证书 - else if (Objects.equals(alipayConfig.getAuthType(), AliPayCode.AUTH_TYPE_CART)){ - aliPayApiConfig = AliPayApiConfig.builder() - .setAppId(alipayConfig.getAppId()) - .setPrivateKey(alipayConfig.getPrivateKey()) - .setAppCertContent(alipayConfig.getAppCert()) - .setAliPayCertContent(alipayConfig.getAlipayCert()) - .setAliPayRootCertContent(alipayConfig.getAlipayRootCert()) - .setCharset(CharsetUtil.UTF_8) - .setServiceUrl(alipayConfig.getServerUrl()) - .setSignType(alipayConfig.getSignType()) - .buildByCertContent(); - } else { - throw new BizException("支付宝认证方式不可为空"); - } - - AliPayApiConfigKit.setThreadLocalAliPayApiConfig(aliPayApiConfig); - } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipaySyncService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipaySyncService.java index 7a875f567ea9844c95998d074881a5bc242b869c..453e00a2c6efb1ed227a075fcb14a8d509670662 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipaySyncService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/alipay/service/AlipaySyncService.java @@ -41,6 +41,7 @@ public class AlipaySyncService { try { AlipayTradeQueryModel queryModel = new AlipayTradeQueryModel(); queryModel.setOutTradeNo(String.valueOf(payment.getId())); + // 查询退款参数 AlipayTradeQueryResponse response = AliPayApi.tradeQueryToResponse(queryModel); String tradeStatus = response.getTradeStatus(); @@ -65,6 +66,7 @@ public class AlipaySyncService { if (Objects.equals(response.getSubCode(),AliPayCode.ACQ_TRADE_NOT_EXIST)){ return paySyncResult.setPaySyncStatus(PaySyncStatus.NOT_FOUND); } + // 退款 支付宝查不到 } catch (AlipayApiException e) { log.error("查询订单失败:",e); diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/voucher/service/VoucherPayService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/voucher/service/VoucherPayService.java index 85ee1b42e820ab445b4ec5363400bbe9a07a2a36..db4850eb5f508e85fa88aae814760d12fc421420 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/voucher/service/VoucherPayService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/voucher/service/VoucherPayService.java @@ -1,6 +1,5 @@ package cn.bootx.payment.core.paymodel.voucher.service; -import cn.bootx.common.core.exception.BizException; import cn.bootx.common.core.exception.DataNotExistException; import cn.bootx.common.core.util.BigDecimalUtil; import cn.bootx.common.core.util.LocalDateTimeUtil; @@ -27,6 +26,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -66,9 +66,7 @@ public class VoucherPayService { if (vouchers.size() != cardNoList.size()) { throw new PayFailureException("储值卡支付参数错误"); } - // 判断有效期 - boolean timeCheck = vouchers.stream() - .allMatch(voucher -> LocalDateTimeUtil.between(LocalDateTime.now(), voucher.getStartTime(), voucher.getEndTime())); + boolean timeCheck = this.check(vouchers); if (!timeCheck) { throw new PayFailureException("储值卡不再有效期内"); } @@ -84,10 +82,9 @@ public class VoucherPayService { } /** - * 支付 + * 支付 TODO 有期限的在前面, 同样有期限到期时间短的在前面, 同样到期日金额小的在前面 */ public void pay(BigDecimal amount, Payment payment, List vouchers) { - // 排序,金额小的在前 TODO 有期限的在前面, 同样有期限到期时间短的在前面, 同样到期日金额小的在前面 vouchers.sort((o1, o2) -> BigDecimalUtil.compareTo(o1.getBalance(), o2.getBalance())); List voucherLogs = new ArrayList<>(); @@ -149,10 +146,10 @@ public class VoucherPayService { } /** - * 退款 退到使用的第一个卡上 + * 退款 TODO 延长卡的有效期, */ public void refund(Long paymentId, BigDecimal amount){ - VoucherPayment voucherPayment = voucherPaymentManager.findByPaymentId(paymentId).orElseThrow(() -> new BizException("储值卡支付记录不存在")); + VoucherPayment voucherPayment = voucherPaymentManager.findByPaymentId(paymentId).orElseThrow(() -> new PayFailureException("储值卡支付记录不存在")); Long voucherId = Long.valueOf(voucherPayment.getVoucherIds().split(",")[0]); Voucher voucher = voucherManager.findById(voucherId).orElseThrow(DataNotExistException::new); @@ -170,4 +167,13 @@ public class VoucherPayService { voucherLogManager.save(log); } + /** + * 卡信息检查 + */ + private boolean check(List vouchers){ + // 判断有效期 + return vouchers.stream() + .filter(voucher -> !Objects.equals(voucher.getEnduring(),true)) + .allMatch(voucher -> LocalDateTimeUtil.between(LocalDateTime.now(), voucher.getStartTime(), voucher.getEndTime())); + } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/convert/WeChatConvert.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/convert/WeChatConvert.java index 21758142ea3d441b672fcdc240b25dc4f1ae2a0f..e191a49cda26b36f77e90fa4b87f36264eb54534 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/convert/WeChatConvert.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/convert/WeChatConvert.java @@ -4,8 +4,8 @@ import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayment; import cn.bootx.payment.dto.paymodel.wechat.WeChatPayConfigDto; import cn.bootx.payment.dto.paymodel.wechat.WeChatPaymentDto; +import cn.bootx.payment.param.paymodel.wechat.WeChatPayConfigParam; import org.mapstruct.Mapper; -import org.mapstruct.Mappings; import org.mapstruct.factory.Mappers; /** @@ -17,7 +17,7 @@ import org.mapstruct.factory.Mappers; public interface WeChatConvert { WeChatConvert CONVERT = Mappers.getMapper(WeChatConvert.class); - WeChatPayConfig convert(WeChatPayConfigDto in); + WeChatPayConfig convert(WeChatPayConfigParam in); WeChatPayConfigDto convert(WeChatPayConfig in); diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/dao/WeChatPayConfigManager.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/dao/WeChatPayConfigManager.java index 206370d5555c9edd734ac8c01add0c7a22b74667..6d9e9669a9fcf45f1c2623feec07508133625280 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/dao/WeChatPayConfigManager.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/dao/WeChatPayConfigManager.java @@ -2,13 +2,17 @@ package cn.bootx.payment.core.paymodel.wechat.dao; import cn.bootx.common.core.rest.param.PageParam; import cn.bootx.common.mybatisplus.base.MpBaseEntity; +import cn.bootx.common.mybatisplus.handler.MpBigFieldHandler; import cn.bootx.common.mybatisplus.impl.BaseManager; import cn.bootx.common.mybatisplus.util.MpUtil; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; +import cn.bootx.payment.param.paymodel.wechat.WeChatPayConfigParam; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; +import java.util.Objects; import java.util.Optional; /** @@ -19,27 +23,45 @@ import java.util.Optional; @Repository @RequiredArgsConstructor public class WeChatPayConfigManager extends BaseManager { + private Optional weChatPayConfig; /** - * 获取启用的支付宝配置 + * 获取启用的微信配置 */ - public Optional findEnable(){ - return findByField(WeChatPayConfig::getActivity,Boolean.TRUE); + public Optional findActivity(){ + if (Objects.isNull(weChatPayConfig)){ + weChatPayConfig = findByField(WeChatPayConfig::getActivity, Boolean.TRUE); + } + return weChatPayConfig; } - public Optional findByAppId(String appId) { - return findByField(WeChatPayConfig::getAppId,appId); + /** + * 分页 + */ + public Page page(PageParam pageParam, WeChatPayConfigParam param) { + Page mpPage = MpUtil.getMpPage(pageParam, WeChatPayConfig.class); + return lambdaQuery() + .select(WeChatPayConfig.class, MpBigFieldHandler::excludeBigField) + .like(StrUtil.isNotBlank(param.getName()), WeChatPayConfig::getName,param.getName()) + .like(StrUtil.isNotBlank(param.getAppId()),WeChatPayConfig::getAppId,param.getAppId()) + .like(StrUtil.isNotBlank(param.getAppId()),WeChatPayConfig::getMchId,param.getMchId()) + .orderByDesc(MpBaseEntity::getId) + .page(mpPage); } + /** + * 清除所有的被启用的 + */ public void removeAllActivity() { + this.clearCache(); lambdaUpdate().eq(WeChatPayConfig::getActivity,Boolean.TRUE) .set(WeChatPayConfig::getActivity,Boolean.FALSE); } - public Page page(PageParam pageParam) { - Page mpPage = MpUtil.getMpPage(pageParam, WeChatPayConfig.class); - return lambdaQuery() - .orderByDesc(MpBaseEntity::getId) - .page(mpPage); + /** + * 清除缓存 + */ + public void clearCache(){ + weChatPayConfig = null; } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/entity/WeChatPayConfig.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/entity/WeChatPayConfig.java index f500dc481301547a9ed1ab0e525a9512c05fb095..07fb05f9e16fd8eebfc0d7f933d45988224c8ede 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/entity/WeChatPayConfig.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/entity/WeChatPayConfig.java @@ -1,11 +1,16 @@ package cn.bootx.payment.core.paymodel.wechat.entity; +import cn.bootx.common.core.annotation.BigField; +import cn.bootx.common.core.annotation.EncryptionField; import cn.bootx.common.core.function.EntityBaseFunction; import cn.bootx.common.mybatisplus.base.MpBaseEntity; import cn.bootx.payment.core.paymodel.wechat.convert.WeChatConvert; import cn.bootx.payment.dto.paymodel.wechat.WeChatPayConfigDto; +import cn.bootx.payment.param.paymodel.wechat.WeChatPayConfigParam; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -24,53 +29,63 @@ public class WeChatPayConfig extends MpBaseEntity implements EntityBaseFunction< /** 名称 */ private String name; - /** 备注 */ - private String remark; - /** 微信应用appId */ - private String appId; /** 微信商户号 */ private String mchId; + /** 微信应用appId */ + private String appId; + /** - * 认证方式 - * @see cn.bootx.payment.code.paymodel.WeChatPayCode + * api版本 + * @see cn.bootx.payment.code.paymodel.WeChatPayCode#API_V2 */ - private Integer authType; - /** 微信服务商应用编号 */ - private String slAppId; - /** 微信服务商商户号 */ - private String slMchId; - /** 同 apiKey 后续版本会舍弃 */ - private String partnerKey; - /** 商户平台「API安全」中的 API 密钥 */ - private String apiKey; + private String apiVersion; + /** 商户平台「API安全」中的 APIv2 密钥 */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + @EncryptionField + private String apiKeyV2; /** 商户平台「API安全」中的 APIv3 密钥 */ - private String apiKey3; + @TableField(updateStrategy = FieldStrategy.IGNORED) + @EncryptionField + private String apiKeyV3; + /** APPID对应的接口密码,用于获取微信公众号jsapi支付时使用 */ + @EncryptionField + private String appSecret; + + /** API 证书中的 p12 文件存储的 id */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + @EncryptionField + private Long p12; + /** API 证书中的 cert.pem 证书*/ + @TableField(updateStrategy = FieldStrategy.IGNORED) + @BigField + @EncryptionField + private String certPem; + /** API 证书中的 key.pem 私钥*/ + @TableField(updateStrategy = FieldStrategy.IGNORED) + @BigField + @EncryptionField + private String keyPem; + /** 应用域名,回调中会使用此参数 */ private String domain; /** 服务器异步通知页面路径 通知url必须为直接可访问的url,不能携带参数。公网域名必须为https */ private String notifyUrl; /** 页面跳转同步通知页面路径 */ private String returnUrl; - /** - * API 证书中的 p12 - */ - private String certPath; - /** - * API 证书中的 key.pem - */ - private String keyPemPath; - /** - * API 证书中的 cert.pem - */ - private String certPemPath; + /** 是否沙箱环境 */ private boolean sandbox; + /** 超时时间(分钟) */ + private Integer expireTime; /** 可用支付方式 */ + @TableField(updateStrategy = FieldStrategy.IGNORED) private String payWays; /** 是否启用 */ private Boolean activity; /** 状态 */ private Integer state; + /** 备注 */ + private String remark; @Override public WeChatPayConfigDto toDto() { @@ -81,10 +96,10 @@ public class WeChatPayConfig extends MpBaseEntity implements EntityBaseFunction< return convert; } - public static WeChatPayConfig init(WeChatPayConfigDto dto){ - WeChatPayConfig convert = WeChatConvert.CONVERT.convert(dto); - if (CollUtil.isNotEmpty(dto.getPayWayList())){ - convert.setPayWays(String.join(",", dto.getPayWayList())); + public static WeChatPayConfig init(WeChatPayConfigParam in){ + WeChatPayConfig convert = WeChatConvert.CONVERT.convert(in); + if (CollUtil.isNotEmpty(in.getPayWayList())){ + convert.setPayWays(String.join(",", in.getPayWayList())); } return convert; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCallbackService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCallbackService.java index 7d94e5346cdabb16a402069b2bd381e09b6db660..970e9fe6a29fa6420c2d3989d7e6e5394f30f662 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCallbackService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCallbackService.java @@ -20,6 +20,8 @@ import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.Map; +import static cn.bootx.payment.code.paymodel.WeChatPayCode.APPID; + /** * 微信支付回调 * @author xxm @@ -71,19 +73,19 @@ public class WeChatPayCallbackService extends AbsPayCallbackStrategy { Map params = PARAMS.get(); String callReq = JSONUtil.toJsonStr(params); log.info("微信发起回调 报文: {}", callReq); - String appId = params.get("appid"); + String appId = params.get(APPID); if (StrUtil.isBlank(appId)) { log.warn("微信回调报文 appId 为空 {}", callReq); return false; } - - WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findByAppId(appId).orElseThrow(DataNotExistException::new); + // + WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findActivity().orElseThrow(DataNotExistException::new); if (weChatPayConfig == null) { - log.warn("微信回调报文 appId 不合法 {}", callReq); + log.warn("微信支付配置不存在: {}", callReq); return false; } - return WxPayKit.verifyNotify(params, weChatPayConfig.getApiKey(), SignType.HMACSHA256); + return WxPayKit.verifyNotify(params, weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCancelService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCancelService.java index 47e79d50733d1ac974f7665a322833f480309282..2cfd23016de8cf2f54ed01b8481268dfa0a4a67b 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCancelService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayCancelService.java @@ -1,24 +1,32 @@ package cn.bootx.payment.core.paymodel.wechat.service; -import cn.bootx.common.core.exception.BizException; +import cn.bootx.common.spring.exception.RetryableException; import cn.bootx.payment.code.paymodel.WeChatPayCode; +import cn.bootx.payment.core.pay.local.AsyncRefundLocal; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; +import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayment; +import cn.bootx.payment.exception.payment.PayFailureException; +import cn.bootx.starter.file.service.FileUploadService; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.ijpay.core.enums.SignType; import com.ijpay.core.kit.WxPayKit; import com.ijpay.wxpay.WxPayApi; -import com.ijpay.wxpay.WxPayApiConfig; -import com.ijpay.wxpay.WxPayApiConfigKit; import com.ijpay.wxpay.model.CloseOrderModel; +import com.ijpay.wxpay.model.RefundModel; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; +import java.io.ByteArrayInputStream; +import java.math.BigDecimal; import java.util.Map; +import java.util.Optional; /** - * 微信支付撤销 + * 微信支付关闭和退款 * @author xxm * @date 2021/6/21 */ @@ -26,21 +34,55 @@ import java.util.Map; @Service @RequiredArgsConstructor public class WeChatPayCancelService { + private final FileUploadService uploadService; /** * 关闭支付 */ + @Retryable(value = RetryableException.class) public void cancelRemote(Payment payment, WeChatPayConfig weChatPayConfig) { // 只有部分需要调用微信网关进行关闭 - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); Map params = CloseOrderModel.builder() - .appid(wxPayApiConfig.getAppId()) - .mch_id(wxPayApiConfig.getMchId()) + .appid(weChatPayConfig.getAppId()) + .mch_id(weChatPayConfig.getMchId()) .out_trade_no(String.valueOf(payment.getId())) .nonce_str(WxPayKit.generateStr()) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); String xmlResult = WxPayApi.closeOrder(params); Map result = WxPayKit.xmlToMap(xmlResult); + this.verifyErrorMsg(result); + } + + /** + * 退款 + */ + public void refund(Payment payment, WeChatPayment weChatPayment, BigDecimal amount, WeChatPayConfig weChatPayConfig) { + String totalFee = weChatPayment.getAmount().multiply(BigDecimal.valueOf(100)).toBigInteger().toString(); + String refundFee = amount.multiply(BigDecimal.valueOf(100)).toBigInteger().toString(); + // 设置退款号 + AsyncRefundLocal.set(IdUtil.getSnowflakeNextIdStr()); + Map params = RefundModel.builder() + .appid(weChatPayConfig.getAppId()) + .mch_id(weChatPayConfig.getMchId()) + .out_trade_no(String.valueOf(payment.getId())) + .out_refund_no(AsyncRefundLocal.get()) + .total_fee(totalFee) + .refund_fee(refundFee) + .nonce_str(WxPayKit.generateStr()) + .build() + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); + // 获取证书文件流 + byte[] fileBytes = uploadService.getFileBytes(weChatPayConfig.getP12()); + ByteArrayInputStream inputStream = new ByteArrayInputStream(fileBytes); + // 证书密码为 微信商户号 + String xmlResult = WxPayApi.orderRefund(false, params, inputStream, weChatPayConfig.getMchId()); + Map result = WxPayKit.xmlToMap(xmlResult); + this.verifyErrorMsg(result); + } + /** + * 验证错误信息 + */ + private void verifyErrorMsg(Map result){ String returnCode = result.get(WeChatPayCode.RETURN_CODE); String resultCode = result.get(WeChatPayCode.RESULT_CODE); if (!WxPayKit.codeIsOk(returnCode)||!WxPayKit.codeIsOk(resultCode)) { @@ -48,8 +90,10 @@ public class WeChatPayCancelService { if (StrUtil.isBlank(errorMsg)){ errorMsg = result.get(WeChatPayCode.RETURN_MSG); } - log.error("关闭订单失败 {}", errorMsg); - throw new BizException(errorMsg); + log.error("订单退款/关闭失败 {}", errorMsg); + AsyncRefundLocal.setErrorMsg(errorMsg); + AsyncRefundLocal.setErrorCode(Optional.ofNullable(resultCode).orElse(returnCode)); + throw new PayFailureException(errorMsg); } } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayConfigService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayConfigService.java index 809410f08b89871873932d62a2d9e5e76b11fa6f..2fcb8eb3d4ed8bc7a001f3fba3d08a465c823769 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayConfigService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayConfigService.java @@ -1,21 +1,19 @@ package cn.bootx.payment.core.paymodel.wechat.service; -import cn.bootx.common.core.exception.BizException; import cn.bootx.common.core.exception.DataNotExistException; import cn.bootx.common.core.rest.PageResult; import cn.bootx.common.core.rest.dto.KeyValue; import cn.bootx.common.core.rest.param.PageParam; import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.payment.code.paymodel.WeChatPayCode; import cn.bootx.payment.code.paymodel.WeChatPayWay; import cn.bootx.payment.core.paymodel.wechat.dao.WeChatPayConfigManager; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; import cn.bootx.payment.dto.paymodel.wechat.WeChatPayConfigDto; +import cn.bootx.payment.exception.payment.PayFailureException; +import cn.bootx.payment.param.paymodel.wechat.WeChatPayConfigParam; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; -import com.ijpay.wxpay.WxPayApiConfig; -import com.ijpay.wxpay.WxPayApiConfigKit; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -40,19 +38,20 @@ public class WeChatPayConfigService { * 添加微信支付配置 */ @Transactional(rollbackFor = Exception.class) - public WeChatPayConfigDto add(WeChatPayConfigDto param){ + public void add(WeChatPayConfigParam param){ WeChatPayConfig weChatPayConfig = WeChatPayConfig.init(param); - WeChatPayConfig save = weChatPayConfigManager.save(weChatPayConfig); - return save.toDto(); + weChatPayConfig.setActivity(false); + weChatPayConfigManager.save(weChatPayConfig); } /** * 修改 */ @Transactional(rollbackFor = Exception.class) - public WeChatPayConfigDto update(WeChatPayConfigDto param){ + public void update(WeChatPayConfigParam param){ WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findById(param.getId()) - .orElseThrow(() -> new BizException("微信支付配置不存在")); + .orElseThrow(() -> new PayFailureException("微信支付配置不存在")); + param.setActivity(null); BeanUtil.copyProperties(param,weChatPayConfig, CopyOptions.create().ignoreNullValue()); // 支付方式 if (CollUtil.isNotEmpty(param.getPayWayList())){ @@ -60,14 +59,14 @@ public class WeChatPayConfigService { } else { weChatPayConfig.setPayWays(null); } - return weChatPayConfigManager.updateById(weChatPayConfig).toDto(); + weChatPayConfigManager.updateById(weChatPayConfig); } /** * 分页 */ - public PageResult page(PageParam pageParam){ - return MpUtil.convert2DtoPageResult(weChatPayConfigManager.page(pageParam)); + public PageResult page(PageParam pageParam,WeChatPayConfigParam param){ + return MpUtil.convert2DtoPageResult(weChatPayConfigManager.page(pageParam,param)); } /** @@ -75,7 +74,7 @@ public class WeChatPayConfigService { */ @Transactional(rollbackFor = Exception.class) public void setUpActivity(Long id){ - WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findById(id).orElseThrow(() -> new BizException("微信支付配置不存在")); + WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findById(id).orElseThrow(() -> new PayFailureException("微信支付配置不存在")); if (Objects.equals(weChatPayConfig.getActivity(),Boolean.TRUE)){ return; } @@ -89,7 +88,7 @@ public class WeChatPayConfigService { */ @Transactional(rollbackFor = Exception.class) public void clearActivity(Long id){ - WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findById(id).orElseThrow(() -> new BizException("微信支付配置不存在")); + WeChatPayConfig weChatPayConfig = weChatPayConfigManager.findById(id).orElseThrow(() -> new PayFailureException("微信支付配置不存在")); if (Objects.equals(weChatPayConfig.getActivity(),Boolean.TRUE)){ return; } @@ -116,34 +115,4 @@ public class WeChatPayConfigService { .collect(Collectors.toList()); } - /** - * 初始化 - */ - public static void initApiConfig(WeChatPayConfig weChatPayConfig) { - WxPayApiConfig wxPayApiConfig; - // 公钥方式 - if (Objects.equals(weChatPayConfig.getAuthType(), WeChatPayCode.AUTH_TYPE_KEY)){ - wxPayApiConfig = WxPayApiConfig.builder() - .appId(weChatPayConfig.getAppId()) - .mchId(weChatPayConfig.getMchId()) - .apiKey(weChatPayConfig.getApiKey()) - .certPath(weChatPayConfig.getCertPath()) - .domain(weChatPayConfig.getDomain()) - .build(); - } - // 证书 - else if (Objects.equals(weChatPayConfig.getAuthType(), WeChatPayCode.AUTH_TYPE_CART)){ - wxPayApiConfig = WxPayApiConfig.builder() - .appId(weChatPayConfig.getAppId()) - .mchId(weChatPayConfig.getMchId()) - .apiKey(weChatPayConfig.getApiKey()) - .certPath(weChatPayConfig.getCertPath()) - .keyPemPath(weChatPayConfig.getDomain()) - .build(); - } else { - throw new BizException("微信支付认证类型配置不存在"); - } - WxPayApiConfigKit.setThreadLocalWxPayApiConfig(wxPayApiConfig); - } - } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayService.java index 9d0dd930a4b2ac61d2b727cb05c16a07e6a2411b..99f03dc98a2af58b4cbb993f3c30cc7cd3508cb5 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPayService.java @@ -1,35 +1,45 @@ package cn.bootx.payment.core.paymodel.wechat.service; -import cn.bootx.common.core.exception.BizException; +import cn.bootx.common.core.util.LocalDateTimeUtil; +import cn.bootx.common.spring.exception.RetryableException; import cn.bootx.payment.code.pay.PayStatusCode; import cn.bootx.payment.code.pay.PayWayCode; import cn.bootx.payment.code.pay.PayWayEnum; import cn.bootx.payment.code.paymodel.WeChatPayCode; import cn.bootx.payment.code.paymodel.WeChatPayWay; import cn.bootx.payment.core.pay.local.AsyncPayInfoLocal; +import cn.bootx.payment.core.pay.result.PaySyncResult; +import cn.bootx.payment.core.pay.service.PaySyncService; import cn.bootx.payment.core.payment.entity.Payment; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; import cn.bootx.payment.dto.pay.AsyncPayInfo; +import cn.bootx.payment.exception.payment.PayFailureException; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.paymodel.wechat.WeChatPayParam; +import cn.bootx.payment.util.PayModelUtil; +import cn.hutool.core.date.DatePattern; import cn.hutool.core.net.NetUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; import com.ijpay.core.enums.SignType; import com.ijpay.core.enums.TradeType; import com.ijpay.core.kit.WxPayKit; import com.ijpay.wxpay.WxPayApi; -import com.ijpay.wxpay.WxPayApiConfig; -import com.ijpay.wxpay.WxPayApiConfigKit; import com.ijpay.wxpay.model.MicroPayModel; import com.ijpay.wxpay.model.UnifiedOrderModel; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.retry.annotation.Backoff; +import org.springframework.retry.annotation.Retryable; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; +import static cn.bootx.payment.code.pay.PaySyncStatus.WAIT_BUYER_PAY; + /** * 微信支付 * @author xxm @@ -39,6 +49,8 @@ import java.util.*; @Service @RequiredArgsConstructor public class WeChatPayService { + private final PaySyncService paySyncService; + private final WeChatPaySyncService weChatPaySyncService; /** * 校验 @@ -50,9 +62,9 @@ public class WeChatPayService { .orElse(new ArrayList<>(1)); PayWayEnum payWayEnum = Optional.ofNullable(WeChatPayWay.findByNo(payModeParam.getPayWay())) - .orElseThrow(() -> new BizException("非法的微信支付类型")); + .orElseThrow(() -> new PayFailureException("非法的微信支付类型")); if (!payWays.contains(payWayEnum.getCode())) { - throw new BizException("该微信支付方式不可用"); + throw new PayFailureException("该微信支付方式不可用"); } } @@ -60,46 +72,44 @@ public class WeChatPayService { * 支付 */ public void pay(BigDecimal amount, Payment payment, WeChatPayParam weChatPayParam, PayModeParam payModeParam, WeChatPayConfig weChatPayConfig){ - + // 微信传入的是分, 将元转换为分 + String totalFee = String.valueOf(amount.multiply(new BigDecimal(100)).longValue()); + AsyncPayInfo asyncPayInfo = Optional.ofNullable(AsyncPayInfoLocal.get()).orElse(new AsyncPayInfo()); String payBody = null; // wap支付 if (payModeParam.getPayWay() == PayWayCode.WAP){ - payBody = this.wapPay(amount, payment,weChatPayConfig); + payBody = this.wapPay(totalFee, payment,weChatPayConfig); } - // 程序支付 + // APP支付 else if (payModeParam.getPayWay() == PayWayCode.APP){ - payBody = this.appPay(amount, payment, weChatPayConfig); + payBody = this.appPay(totalFee, payment, weChatPayConfig); } // 微信公众号支付或者小程序支付 else if (payModeParam.getPayWay() == PayWayCode.JSAPI){ - payBody = this.jsPay(amount, payment,weChatPayParam.getOpenId(), weChatPayConfig); + payBody = this.jsPay(totalFee, payment,weChatPayParam.getOpenId(), weChatPayConfig); } // 二维码支付 else if (payModeParam.getPayWay() == PayWayCode.QRCODE){ - payBody = this.qrCodePay(amount, payment, weChatPayConfig); + payBody = this.qrCodePay(totalFee, payment, weChatPayConfig); } // 付款码支付 else if (payModeParam.getPayWay() == PayWayCode.BARCODE){ - this.barCode(amount, payment, weChatPayParam.getAuthCode(),weChatPayParam, weChatPayConfig); - } - // payBody到线程存储 - if (StrUtil.isNotBlank(payBody)) { - AsyncPayInfo asyncPayInfo = new AsyncPayInfo() - .setPayBody(payBody); - AsyncPayInfoLocal.set(asyncPayInfo); + String tradeNo = this.barCode(totalFee, payment, weChatPayParam.getAuthCode(), weChatPayConfig); + asyncPayInfo.setTradeNo(tradeNo) + .setExpiredTime(false); } - + asyncPayInfo.setPayBody(payBody); + AsyncPayInfoLocal.set(asyncPayInfo); } /** * wap支付 */ - private String wapPay(BigDecimal amount, Payment payment, WeChatPayConfig weChatPayConfig) { - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); + private String wapPay(String amount, Payment payment, WeChatPayConfig weChatPayConfig) { Map params = this.buildParams(amount,payment,weChatPayConfig,TradeType.MWEB.getTradeType()) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); String xmlResult = WxPayApi.pushOrder(false, params); Map result = WxPayKit.xmlToMap(xmlResult); @@ -110,11 +120,10 @@ public class WeChatPayService { /** * 程序支付 */ - private String appPay(BigDecimal amount, Payment payment, WeChatPayConfig weChatPayConfig) { - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); + private String appPay(String amount, Payment payment, WeChatPayConfig weChatPayConfig) { Map params = this.buildParams(amount,payment,weChatPayConfig,TradeType.APP.getTradeType()) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); String xmlResult = WxPayApi.pushOrder(false, params); Map result = WxPayKit.xmlToMap(xmlResult); @@ -126,12 +135,11 @@ public class WeChatPayService { /** * 微信公众号支付或者小程序支付 */ - private String jsPay(BigDecimal amount, Payment payment, String openId, WeChatPayConfig weChatPayConfig) { - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); + private String jsPay(String amount, Payment payment, String openId, WeChatPayConfig weChatPayConfig) { Map params = this.buildParams(amount,payment,weChatPayConfig,TradeType.JSAPI.getTradeType()) .openid(openId) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); String xmlResult = WxPayApi.pushOrder(false, params); Map result = WxPayKit.xmlToMap(xmlResult); @@ -142,12 +150,11 @@ public class WeChatPayService { /** * 二维码支付 */ - private String qrCodePay(BigDecimal amount, Payment payment, WeChatPayConfig weChatPayConfig) { + private String qrCodePay(String amount, Payment payment, WeChatPayConfig weChatPayConfig) { - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); Map params = this.buildParams(amount,payment,weChatPayConfig,TradeType.NATIVE.getTradeType()) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); String xmlResult = WxPayApi.pushOrder(false, params); Map result = WxPayKit.xmlToMap(xmlResult); @@ -156,54 +163,81 @@ public class WeChatPayService { } /** - * 条形码支付 + * 付款码支付 */ - private void barCode(BigDecimal amount, Payment payment, String authCode, WeChatPayParam weChatPayParam, WeChatPayConfig weChatPayConfig) { - String totalFee = String.valueOf(amount.multiply(new BigDecimal(100)).longValue()); - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); + private String barCode(String amount, Payment payment, String authCode, WeChatPayConfig weChatPayConfig) { Map params = MicroPayModel .builder() - .appid(wxPayApiConfig.getAppId()) - .mch_id(wxPayApiConfig.getMchId()) + .appid(weChatPayConfig.getAppId()) + .mch_id(weChatPayConfig.getMchId()) .nonce_str(WxPayKit.generateStr()) .body(payment.getTitle()) .auth_code(authCode) .out_trade_no(String.valueOf(payment.getId())) - .total_fee(totalFee) + .total_fee(amount) .spbill_create_ip(NetUtil.getLocalhostStr()) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); - String xmlResult = WxPayApi.pushOrder(false, params); + String xmlResult = WxPayApi.microPay(false, params); Map result = WxPayKit.xmlToMap(xmlResult); - this.verifyErrorMsg(result); - String tradeType = result.get(WeChatPayCode.TRADE_TYPE); + + String returnCode = result.get(WeChatPayCode.RETURN_CODE); + // 支付失败 + if (!WxPayKit.codeIsOk(returnCode)){ + String errorMsg = result.get(WeChatPayCode.ERR_CODE_DES); + throw new PayFailureException(errorMsg); + } + + String resultCode = result.get(WeChatPayCode.RESULT_CODE); + String errCode = result.get(WeChatPayCode.ERR_CODE); // 支付成功处理 - if (Objects.equals(result.get(WeChatPayCode.TRADE_STATE), WeChatPayCode.TRADE_SUCCESS)) { + if (Objects.equals(resultCode, WeChatPayCode.TRADE_SUCCESS)) { payment.setPayStatus(PayStatusCode.TRADE_SUCCESS) .setPayTime(LocalDateTime.now()); - return; + return result.get(WeChatPayCode.TRANSACTION_ID); } + // 支付中, 发起轮训同步 + if (Objects.equals(resultCode, WeChatPayCode.TRADE_FAIL)&& + Objects.equals(errCode, WeChatPayCode.TRADE_USERPAYING)) { + SpringUtil.getBean(this.getClass()).rotationSync(payment,weChatPayConfig); + return result.get(WeChatPayCode.TRANSACTION_ID); + } + + // 支付撤销 + if (Objects.equals(resultCode, WeChatPayCode.TRADE_REVOKED)){ + throw new PayFailureException("用户已撤销支付"); + } + + // 支付失败 + if (Objects.equals(resultCode, WeChatPayCode.TRADE_PAYERROR)|| + Objects.equals(resultCode, WeChatPayCode.TRADE_FAIL)) { + String errorMsg = result.get(WeChatPayCode.ERR_CODE_DES); + throw new PayFailureException(errorMsg); + } + return null; } /** * 构建参数 */ - private UnifiedOrderModel.UnifiedOrderModelBuilder buildParams(BigDecimal amount, + private UnifiedOrderModel.UnifiedOrderModelBuilder buildParams(String amount, Payment payment, WeChatPayConfig weChatPayConfig, String tradeType){ - String totalFee = String.valueOf(amount.multiply(new BigDecimal(100)).longValue()); - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); - + // 过期时间 + payment.setExpiredTime(PayModelUtil.getPaymentExpiredTime(weChatPayConfig.getExpireTime())); return UnifiedOrderModel .builder() - .appid(wxPayApiConfig.getAppId()) - .mch_id(wxPayApiConfig.getMchId()) + .appid(weChatPayConfig.getAppId()) + .mch_id(weChatPayConfig.getMchId()) .nonce_str(WxPayKit.generateStr()) + .time_start(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN)) + // 反正v2版本的超时时间无效 + .time_expire(PayModelUtil.getWxExpiredTime(weChatPayConfig.getExpireTime())) .body(payment.getTitle()) .out_trade_no(String.valueOf(payment.getId())) - .total_fee(totalFee) + .total_fee(amount) .spbill_create_ip(NetUtil.getLocalhostStr()) .notify_url(weChatPayConfig.getNotifyUrl()) .trade_type(tradeType); @@ -222,7 +256,22 @@ public class WeChatPayService { errorMsg = result.get(WeChatPayCode.RETURN_MSG); } log.error("支付失败 {}", errorMsg); - throw new BizException(errorMsg); + throw new PayFailureException(errorMsg); + } + } + + /** + * 重试同步支付状态, 最多10次, 30秒不操作微信会自动关闭 + */ + @Async("bigExecutor") + @Retryable(value = RetryableException.class, maxAttempts = 10, backoff = @Backoff(value = 5000L)) + public void rotationSync(Payment payment, WeChatPayConfig weChatPayConfig){ + PaySyncResult paySyncResult = weChatPaySyncService.syncPayStatus(payment.getId(), weChatPayConfig); + // 不为支付中状态后, 调用系统同步更新状态, 支付状态则继续重试 + if (Objects.equals(WAIT_BUYER_PAY,paySyncResult.getPaySyncStatus())){ + throw new RetryableException(); + } else{ + paySyncService.syncPayment(payment); } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaySyncService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaySyncService.java index c6d01fe3a97711d9742670587fb435455ad67171..54bfaeb77b7617e14201c362466c306d9b2cd1af 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaySyncService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaySyncService.java @@ -3,19 +3,15 @@ package cn.bootx.payment.core.paymodel.wechat.service; import cn.bootx.payment.code.pay.PaySyncStatus; import cn.bootx.payment.code.paymodel.WeChatPayCode; import cn.bootx.payment.core.pay.result.PaySyncResult; -import cn.bootx.payment.core.paymodel.wechat.dao.WeChatPayConfigManager; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayConfig; import com.ijpay.core.enums.SignType; import com.ijpay.core.kit.WxPayKit; import com.ijpay.wxpay.WxPayApi; -import com.ijpay.wxpay.WxPayApiConfig; -import com.ijpay.wxpay.WxPayApiConfigKit; import com.ijpay.wxpay.model.UnifiedOrderModel; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -28,23 +24,21 @@ import java.util.Objects; @Service @RequiredArgsConstructor public class WeChatPaySyncService { - private final WeChatPayConfigManager weChatPayConfigManager; /** * 同步查询 */ public PaySyncResult syncPayStatus(Long paymentId, WeChatPayConfig weChatPayConfig) { - WxPayApiConfig wxPayApiConfig = WxPayApiConfigKit.getWxPayApiConfig(); PaySyncResult paySyncResult = new PaySyncResult() .setPaySyncStatus(PaySyncStatus.FAIL); Map params = UnifiedOrderModel .builder() - .appid(wxPayApiConfig.getAppId()) - .mch_id(wxPayApiConfig.getMchId()) + .appid(weChatPayConfig.getAppId()) + .mch_id(weChatPayConfig.getMchId()) .nonce_str(WxPayKit.generateStr()) .out_trade_no(String.valueOf(paymentId)) .build() - .createSign(wxPayApiConfig.getApiKey(), SignType.HMACSHA256); + .createSign(weChatPayConfig.getApiKeyV2(), SignType.HMACSHA256); try { String xmlResult = WxPayApi.orderQuery(params); Map result = WxPayKit.xmlToMap(xmlResult); @@ -59,17 +53,12 @@ public class WeChatPaySyncService { log.warn("疑似未查询到订单:{}",result); return paySyncResult.setPaySyncStatus(PaySyncStatus.NOT_FOUND); } - String tradeStatus = result.get(WeChatPayCode.TRADE_STATE); - String outTradeNo = result.get(WeChatPayCode.OUT_TRADE_NO); - // 支付完成 if (Objects.equals(tradeStatus, WeChatPayCode.TRADE_SUCCESS) ||Objects.equals(tradeStatus, WeChatPayCode.TRADE_ACCEPT)){ - HashMap map = new HashMap<>(1); - map.put(WeChatPayCode.OUT_TRADE_NO,outTradeNo); return paySyncResult.setPaySyncStatus(PaySyncStatus.TRADE_SUCCESS) - .setMap(map); + .setMap(result); } // 待支付 if (Objects.equals(tradeStatus, WeChatPayCode.TRADE_NOTPAY) @@ -77,6 +66,10 @@ public class WeChatPaySyncService { return paySyncResult.setPaySyncStatus(PaySyncStatus.WAIT_BUYER_PAY); } + // 已退款/退款中 + if (Objects.equals(tradeStatus, WeChatPayCode.TRADE_REFUND)){ + return paySyncResult.setPaySyncStatus(PaySyncStatus.TRADE_REFUND); + } // 已关闭 if (Objects.equals(tradeStatus, WeChatPayCode.TRADE_CLOSED) || Objects.equals(tradeStatus, WeChatPayCode.TRADE_REVOKED) diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaymentService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaymentService.java index 70184ec793c32e0242cb5fe0775821b6f44bbe58..af017ff6cee97c45b45483fd487cb493aae26bbe 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaymentService.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatPaymentService.java @@ -4,14 +4,15 @@ import cn.bootx.common.core.exception.BizException; import cn.bootx.common.core.util.BigDecimalUtil; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.code.pay.PayStatusCode; -import cn.bootx.payment.core.payment.dao.PaymentManager; +import cn.bootx.payment.core.pay.local.AsyncPayInfoLocal; import cn.bootx.payment.core.payment.entity.Payment; +import cn.bootx.payment.core.payment.service.PaymentService; import cn.bootx.payment.core.paymodel.wechat.dao.WeChatPaymentManager; import cn.bootx.payment.core.paymodel.wechat.entity.WeChatPayment; +import cn.bootx.payment.dto.pay.AsyncPayInfo; import cn.bootx.payment.dto.payment.PayChannelInfo; import cn.bootx.payment.dto.payment.RefundableInfo; import cn.bootx.payment.param.pay.PayModeParam; -import cn.hutool.json.JSONUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; +import java.util.Objects; import java.util.Optional; /** @@ -30,7 +32,7 @@ import java.util.Optional; @Service @RequiredArgsConstructor public class WeChatPaymentService { - private final PaymentManager paymentManager; + private final PaymentService paymentService; private final WeChatPaymentManager weChatPaymentManager; /** @@ -38,11 +40,12 @@ public class WeChatPaymentService { * 更新 payment 中 异步支付类型信息 */ public void updatePaySuccess(Payment payment, PayModeParam payModeParam){ + AsyncPayInfo asyncPayInfo = AsyncPayInfoLocal.get(); payment.setAsyncPayMode(true) .setAsyncPayChannel(PayChannelCode.WECHAT); - List payTypeInfos = payment.getPayChannelInfoList(); - List refundableInfos = payment.getRefundableInfoList(); + List payTypeInfos = payment.getPayChannelInfo(); + List refundableInfos = payment.getRefundableInfo(); // 清除已有的异步支付类型信息 payTypeInfos.removeIf(payTypeInfo -> PayChannelCode.ASYNC_TYPE.contains(payTypeInfo.getPayChannel())); refundableInfos.removeIf(payTypeInfo -> PayChannelCode.ASYNC_TYPE.contains(payTypeInfo.getPayChannel())); @@ -52,34 +55,44 @@ public class WeChatPaymentService { .setPayWay(payModeParam.getPayWay()) .setAmount(payModeParam.getAmount()) .setExtraParamsJson(payModeParam.getExtraParamsJson())); - payment.setPayChannelInfo(JSONUtil.toJsonStr(payTypeInfos)); + payment.setPayChannelInfo(payTypeInfos); // 更新微信可退款类型信息 refundableInfos.add(new RefundableInfo() .setPayChannel(PayChannelCode.WECHAT) .setAmount(payModeParam.getAmount())); - payment.setRefundableInfo(JSONUtil.toJsonStr(payTypeInfos)) - .setRefundableInfo(JSONUtil.toJsonStr(refundableInfos)); - paymentManager.updateById(payment); + payment.setRefundableInfo(refundableInfos); + // 如果支付完成(付款码情况) 调用 updateSyncSuccess 创建微信支付记录 + if (Objects.equals(payment.getPayStatus(),PayStatusCode.TRADE_SUCCESS)){ + this.createWeChatPayment(payment,payModeParam,asyncPayInfo.getTradeNo()); + } } /** - * 更新支付记录成功状态, 并创建微信支付记录 + * 异步支付成功, 更新支付记录成功状态, 并创建微信支付记录 */ - public void updateSyncSuccess(Long id, PayModeParam payModeParam, String tradeNo) { - // 更新支付记录 - Payment payment = paymentManager.findById(id) + public void updateAsyncSuccess(Long id, PayModeParam payModeParam, String tradeNo) { + Payment payment = paymentService.findById(id) .orElseThrow(() -> new BizException("支付记录不存在")); + this.createWeChatPayment(payment,payModeParam,tradeNo); + } + + + /** + * 更新支付记录成功状态, 并创建微信支付记录 + */ + private void createWeChatPayment(Payment payment, PayModeParam payModeParam, String tradeNo) { - // 创建支付宝支付记录 + // 创建微信支付记录 WeChatPayment wechatPayment = new WeChatPayment(); wechatPayment.setTradeNo(tradeNo) .setPaymentId(payment.getId()) .setAmount(payModeParam.getAmount()) + .setRefundableBalance(payModeParam.getAmount()) .setBusinessId(payment.getBusinessId()) .setUserId(payment.getUserId()) .setPayStatus(PayStatusCode.TRADE_SUCCESS) .setPayTime(LocalDateTime.now()); - weChatPaymentManager.updateById(wechatPayment); + weChatPaymentManager.save(wechatPayment); } /** @@ -97,17 +110,14 @@ public class WeChatPaymentService { /** * 更新退款 */ - public void updatePayRefund(Long paymentId, BigDecimal amount) { - Optional weChatPayment = weChatPaymentManager.findByPaymentId(paymentId); - weChatPayment.ifPresent(payment -> { - BigDecimal refundableBalance = payment.getRefundableBalance().subtract(amount); - payment.setRefundableBalance(refundableBalance); - if (BigDecimalUtil.compareTo(refundableBalance, BigDecimal.ZERO)==0){ - payment.setPayStatus(PayStatusCode.TRADE_REFUNDED); - } else { - payment.setPayStatus(PayStatusCode.TRADE_REFUNDING); - } - weChatPaymentManager.updateById(payment); - }); + public void updatePayRefund(WeChatPayment weChatPayment, BigDecimal amount) { + BigDecimal refundableBalance = weChatPayment.getRefundableBalance().subtract(amount); + weChatPayment.setRefundableBalance(refundableBalance); + if (BigDecimalUtil.compareTo(refundableBalance, BigDecimal.ZERO)==0){ + weChatPayment.setPayStatus(PayStatusCode.TRADE_REFUNDED); + } else { + weChatPayment.setPayStatus(PayStatusCode.TRADE_REFUNDING); + } + weChatPaymentManager.updateById(weChatPayment); } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatQueryService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatQueryService.java deleted file mode 100644 index c388ff95a175473577da0257a64957c131d518c0..0000000000000000000000000000000000000000 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/paymodel/wechat/service/WeChatQueryService.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bootx.payment.core.paymodel.wechat.service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** -* 微信支付查询 -* @author xxm -* @date 2021/6/22 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class WeChatQueryService { -} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/refund/entity/RefundRecord.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/refund/entity/RefundRecord.java index 6edd4937025dcbe9ffb46bd22af86ce8b245d2e3..902d866144e96bfa945d4ba4042382473d410a53 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/refund/entity/RefundRecord.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/refund/entity/RefundRecord.java @@ -2,12 +2,11 @@ package cn.bootx.payment.core.refund.entity; import cn.bootx.common.core.function.EntityBaseFunction; import cn.bootx.common.mybatisplus.base.MpBaseEntity; +import cn.bootx.common.mybatisplus.handler.JacksonListTypeHandler; import cn.bootx.payment.core.refund.convert.RefundConvert; import cn.bootx.payment.dto.payment.RefundableInfo; import cn.bootx.payment.dto.refund.RefundRecordDto; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; @@ -15,7 +14,6 @@ import lombok.experimental.Accessors; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.List; /** @@ -26,7 +24,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) @Data @Accessors(chain = true) -@TableName("pay_refund_record") +@TableName(value = "pay_refund_record",autoResultMap = true) public class RefundRecord extends MpBaseEntity implements EntityBaseFunction{ /** 支付单号 */ @@ -44,7 +42,7 @@ public class RefundRecord extends MpBaseEntity implements EntityBaseFunction refundableInfo; /** * 退款状态 - * @see cn.bootx.payment.code.pay.PayStatusCode + * @see cn.bootx.payment.code.pay.PayStatusCode#REFUND_PROCESS_FAIL */ private int refundStatus; @@ -73,17 +71,6 @@ public class RefundRecord extends MpBaseEntity implements EntityBaseFunction getRefundableInfoList(){ - if (StrUtil.isNotBlank(this.refundableInfo)){ - JSONArray array = JSONUtil.parseArray(this.refundableInfo); - return JSONUtil.toList(array, RefundableInfo.class); - } - return new ArrayList<>(0); - } - @Override public RefundRecordDto toDto() { return RefundConvert.CONVERT.convert(this); diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/AsyncPayInfo.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/AsyncPayInfo.java index 502b2cdb754a08b279442fc0e2cd01ecf3022374..5fe57d1b69e30b38e8fc488b9ffffd6fdd7f59f1 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/AsyncPayInfo.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/AsyncPayInfo.java @@ -12,9 +12,16 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -@Schema(title = "异步支付") +@Schema(title = "异步支付线程信息") public class AsyncPayInfo implements Serializable { + private static final long serialVersionUID = 8239742916705144905L; - /** 支付参数体 */ + /** 支付参数体(通常用于发起支付的参数) */ private String payBody; + + /** 第三方支付平台订单号(付款码支付直接成功时会出现) */ + private String tradeNo; + + /** 是否记录超时时间,默认记录 */ + private boolean expiredTime = true; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PayResult.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PayResult.java index dffee7305d1c6e07c391cf5147cc4972e19b6194..2408993371f787d4af25f900d6108f3810b5fa53 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PayResult.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PayResult.java @@ -1,7 +1,6 @@ package cn.bootx.payment.dto.pay; -import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; @@ -26,10 +25,6 @@ public class PayResult implements Serializable { @Schema(description= "异步支付通道") private Integer asyncPayChannel; - /** 主支付记录 */ - @JsonIgnore - private PaymentInfo payment; - /** * @see cn.bootx.payment.code.pay.PayStatusCode#TRADE_PROGRESS */ diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PaymentInfo.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PaymentInfo.java deleted file mode 100644 index 6e570858438ab15f6ffbecd1b1100944cf62563f..0000000000000000000000000000000000000000 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/pay/PaymentInfo.java +++ /dev/null @@ -1,76 +0,0 @@ -package cn.bootx.payment.dto.pay; - -import cn.bootx.payment.dto.payment.PayChannelInfo; -import cn.bootx.payment.dto.payment.RefundableInfo; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 支付信息 - * @author xxm - * @date 2022/5/6 - */ -@Data -@Accessors(chain = true) -@Schema(title = "支付信息") -public class PaymentInfo { - - @Schema(description= "用户ID") - private Long userId; - - @Schema(description= "关联的业务id") - private String businessId; - - @Schema(description= "标题") - private String title; - - @Schema(description= "描述") - private String description; - - @Schema(description= "是否是异步支付") - private boolean asyncPayMode; - - /** - * @see cn.bootx.payment.code.pay.PayChannelCode - */ - @Schema(description= "异步支付通道") - private Integer asyncPayChannel; - - /** - * @see cn.bootx.payment.code.pay.PayStatusCode - */ - @Schema(description= "支付状态") - private int payStatus; - - @Schema(description= "金额") - private BigDecimal amount; - - @Schema(description= "可退款余额") - private BigDecimal refundableBalance; - - @Schema(description= "错误码") - private String errorCode; - - @Schema(description= "错误信息") - private String errorMsg; - - @Schema(description= "支付通道信息") - private List payChannelInfo; - - @Schema(description= "可退款信息列表") - private List refundableInfo; - - @Schema(description= "支付时间") - private LocalDateTime payTime; - - @Schema(description= "支付终端ip") - private String clientIp; - - @Schema(description= "过期时间") - private LocalDateTime expiredTime; -} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/payment/PaymentDto.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/payment/PaymentDto.java index 61e5286a990bfac17f1864d7c6a59c248a24a94e..cca3b0c1c4db7bd8ab5b517af7e49319df7e7f24 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/payment/PaymentDto.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/payment/PaymentDto.java @@ -1,9 +1,6 @@ package cn.bootx.payment.dto.payment; import cn.bootx.common.core.rest.dto.BaseDto; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONUtil; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -12,7 +9,6 @@ import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.List; /** @@ -70,13 +66,13 @@ public class PaymentDto extends BaseDto implements Serializable { * @see PayChannelInfo */ @Schema(description= "支付通道信息") - private String payChannelInfo; + private List payChannelInfo; /** - * @see cn.bootx.payment.dto.payment.RefundableInfo + * @see RefundableInfo */ @Schema(description= "可退款信息列表") - private String refundableInfo; + private List refundableInfo; @Schema(description= "支付时间") private LocalDateTime payTime; @@ -86,25 +82,5 @@ public class PaymentDto extends BaseDto implements Serializable { @Schema(description= "过期时间") private LocalDateTime expiredTime; - /** - * 获取支付通道 - */ - public List getPayChannelInfoList(){ - if (StrUtil.isNotBlank(this.payChannelInfo)){ - JSONArray array = JSONUtil.parseArray(this.payChannelInfo); - return JSONUtil.toList(array, PayChannelInfo.class); - } - return new ArrayList<>(0); - } - /** - * 获取可退款信息列表 - */ - public List getRefundableInfoList(){ - if (StrUtil.isNotBlank(this.refundableInfo)){ - JSONArray array = JSONUtil.parseArray(this.refundableInfo); - return JSONUtil.toList(array, RefundableInfo.class); - } - return new ArrayList<>(0); - } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/alipay/AlipayConfigDto.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/alipay/AlipayConfigDto.java index d0c56c4e612a934bfa211c3038596cb5347fd0f9..3d2047c88f0d54ee539920ded35c2994305c0dc7 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/alipay/AlipayConfigDto.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/alipay/AlipayConfigDto.java @@ -22,63 +22,63 @@ import java.util.List; public class AlipayConfigDto extends BaseDto implements Serializable { private static final long serialVersionUID = 6641158663606363171L; - /** 名称 */ + @Schema(description = "名称") private String name; - /** 支付宝商户appId */ + @Schema(description = "支付宝商户appId") @SensitiveInfo(value = SensitiveType.OTHER) private String appId; - /** 服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 */ + @Schema(description = "服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问") private String notifyUrl; - /** 页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址 */ + @Schema(description = "页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址") private String returnUrl; - /** 请求网关地址 */ + @Schema(description = "请求网关地址") private String serverUrl; - /** 认证类型 证书/公钥 */ + @Schema(description = "认证类型 证书/公钥") private Integer authType; - /** 签名类型 */ + @Schema(description = "签名类型") private String signType; - /** 支付宝公钥 */ + @Schema(description = "支付宝公钥") @SensitiveInfo(value = SensitiveType.OTHER, front = 15) private String alipayPublicKey; - /** 私钥 */ + @Schema(description = "私钥") @SensitiveInfo(value = SensitiveType.OTHER, front = 15) private String privateKey; - /** 应用公钥证书 */ + @Schema(description = "应用公钥证书") @SensitiveInfo(value = SensitiveType.OTHER, front = 15) private String appCert; - /** 支付宝公钥证书文件 */ + @Schema(description = "支付宝公钥证书文件") @SensitiveInfo(value = SensitiveType.OTHER, front = 15) private String alipayCert; - /** 支付宝CA根证书文件 */ + @Schema(description = "支付宝CA根证书文件") @SensitiveInfo(value = SensitiveType.OTHER, front = 15) private String alipayRootCert; - /** 超时配置 */ - private String expireTime; + @Schema(description = "超时配置") + private Integer expireTime; - /** 可用支付方式 */ + @Schema(description = "可用支付方式") private List payWayList; - /** 是否沙箱环境 */ + @Schema(description = "是否沙箱环境") private boolean sandbox; - /** 是否启用 */ + @Schema(description = "是否启用") private Boolean activity; - /** 状态 */ + @Schema(description = "状态") private Integer state; - /** 备注 */ + @Schema(description = "备注") private String remark; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/wechat/WeChatPayConfigDto.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/wechat/WeChatPayConfigDto.java index 694a9f8fcdb335fe25bc7a1a97ad1f0b3d227a39..18a05823f8c76a446bb5d6a7d94a48c181e70a29 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/wechat/WeChatPayConfigDto.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/paymodel/wechat/WeChatPayConfigDto.java @@ -1,6 +1,8 @@ package cn.bootx.payment.dto.paymodel.wechat; +import cn.bootx.common.core.enums.SensitiveType; import cn.bootx.common.core.rest.dto.BaseDto; +import cn.bootx.starter.data.perm.sensitive.SensitiveInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -19,44 +21,56 @@ import java.util.List; @Schema(title = "微信支付配置") public class WeChatPayConfigDto extends BaseDto implements Serializable { - @Schema(description= "名称") + @Schema(description = "名称") private String name; - @Schema(description= "备注") - private String remark; - @Schema(description= "微信应用Id") - private String appId; - @Schema(description= "微信商户号") + @Schema(description = "微信商户号") + @SensitiveInfo(value = SensitiveType.OTHER) private String mchId; - @Schema(description= "微信服务商应用编号") - private String slAppId; - @Schema(description= "微信服务商商户号") - private String slMchId; - @Schema(description= "同 apiKey 后续版本会舍弃") - private String partnerKey; - @Schema(description= "商户平台「API安全」中的 API 密钥") - private String apiKey; - @Schema(description= "商户平台「API安全」中的 APIv3 密钥") - private String apiKey3; - @Schema(description= "应用域名,回调中会使用此参数") + @Schema(description = "微信应用appId") + @SensitiveInfo(value = SensitiveType.OTHER) + private String appId; + + /** + * @see cn.bootx.payment.code.paymodel.WeChatPayCode#API_V2 + */ + @Schema(description = "api版本") + private String apiVersion; + @Schema(description = "商户平台「API安全」中的 APIv2 密钥") + @SensitiveInfo(value = SensitiveType.OTHER) + private String apiKeyV2; + @Schema(description = "商户平台「API安全」中的 APIv3 密钥") + @SensitiveInfo(value = SensitiveType.OTHER) + private String apiKeyV3; + @Schema(description = "APPID对应的接口密码,用于获取接口调用凭证access_token时使用") + @SensitiveInfo(value = SensitiveType.OTHER) + private String appSecret; + + @Schema(description = "API 证书中的 p12 文件id") + private Long p12; + @Schema(description = "API 证书中的 cert.pem 证书") + @SensitiveInfo(value = SensitiveType.OTHER, front = 15) + private String certPem; + @Schema(description = "API 证书中的 key.pem 私钥") + @SensitiveInfo(value = SensitiveType.OTHER, front = 15) + private String keyPem; + + @Schema(description = "应用域名,回调中会使用此参数") private String domain; - @Schema(description= "服务器异步通知页面路径") + @Schema(description = "服务器异步通知页面路径 通知url必须为直接可访问的url,不能携带参数。公网域名必须为https ") private String notifyUrl; - @Schema(description= "页面跳转同步通知页面路径") + @Schema(description = "页面跳转同步通知页面路径") private String returnUrl; - @Schema(description= "API 证书中的 p12") - private String certPath; - @Schema(description= "API 证书中的 key.pem") - private String keyPemPath; - @Schema(description= "API 证书中的 cert.pem") - private String certPemPath; - @Schema(description= "是否沙箱环境") + + @Schema(description = "是否沙箱环境") private boolean sandbox; - @Schema(description= "可用支付方式") - private String payWays; + @Schema(description = "超时时间(分钟)") + private Integer expireTime; @Schema(description= "可用支付方式") private List payWayList; - @Schema(description= "是否启用") + @Schema(description = "是否启用") private Boolean activity; - @Schema(description= "状态") + @Schema(description = "状态") private Integer state; + @Schema(description = "备注") + private String remark; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/refund/RefundRecordDto.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/refund/RefundRecordDto.java index 0faccab084590a81d93a14b64908fae4c08763dc..7d6c77f207833196d9b9b93b7bf706bd208797a6 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/refund/RefundRecordDto.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/dto/refund/RefundRecordDto.java @@ -2,9 +2,6 @@ package cn.bootx.payment.dto.refund; import cn.bootx.common.core.rest.dto.BaseDto; import cn.bootx.payment.dto.payment.RefundableInfo; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONUtil; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -12,7 +9,6 @@ import lombok.experimental.Accessors; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.List; /** @@ -52,14 +48,12 @@ public class RefundRecordDto extends BaseDto { @Schema(description = "退款时间") private LocalDateTime refundTime; - /** - * @see RefundableInfo - */ + @Schema(description = "退款信息列表") - private String refundableInfo; + private List refundableInfo; /** - * @see cn.bootx.payment.code.pay.PayStatusCode + * @see cn.bootx.payment.code.pay.PayStatusCode#REFUND_PROCESS_FAIL */ @Schema(description = "退款状态") private int refundStatus; @@ -69,15 +63,4 @@ public class RefundRecordDto extends BaseDto { @Schema(description = "错误信息") private String errorMsg; - - /** - * 获取可退款信息列表 - */ - public List getRefundableInfoList(){ - if (StrUtil.isNotBlank(this.refundableInfo)){ - JSONArray array = JSONUtil.parseArray(this.refundableInfo); - return JSONUtil.toList(array, RefundableInfo.class); - } - return new ArrayList<>(0); - } } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayCancelEvent.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayCancelEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..45237f74531c01b8823f49d7899d7c33b5411e42 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayCancelEvent.java @@ -0,0 +1,19 @@ +package cn.bootx.payment.event; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** +* 支付撤销事件 +* @author xxm +* @date 2022/7/11 +*/ +@Data +@Accessors(chain = true) +public class PayCancelEvent { + /** 支付单ID */ + private Long paymentId; + + /** 业务单号 */ + private String businessId; +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayCompleteEvent.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayCompleteEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..8d2212633bb2546f11ba44a56322af8fca7b7b9a --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayCompleteEvent.java @@ -0,0 +1,19 @@ +package cn.bootx.payment.event; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** +* 支付完成事件 +* @author xxm +* @date 2022/7/11 +*/ +@Data +@Accessors(chain = true) +public class PayCompleteEvent { + /** 支付单ID */ + private Long paymentId; + + /** 业务单号 */ + private String businessId; +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayRefundEvent.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayRefundEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..550f6156b73ac5ca168cdd20120c7a3ec66e05a5 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/event/PayRefundEvent.java @@ -0,0 +1,19 @@ +package cn.bootx.payment.event; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** +* 支付退款事件 +* @author xxm +* @date 2022/7/11 +*/ +@Data +@Accessors(chain = true) +public class PayRefundEvent { + /** 支付单ID */ + private Long paymentId; + + /** 业务单号 */ + private String businessId; +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentEventSender.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentEventSender.java index e45cd39c016cf566751369c0dae8a5248c63c1b0..7cc2034f0993491198d0d5cdbd270ec948eea850 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentEventSender.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentEventSender.java @@ -1,10 +1,14 @@ package cn.bootx.payment.mq; import cn.bootx.payment.code.PaymentEventCode; -import cn.bootx.payment.dto.pay.PayResult; +import cn.bootx.payment.event.PayCancelEvent; +import cn.bootx.payment.event.PayCompleteEvent; +import cn.bootx.payment.event.PayRefundEvent; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.retry.annotation.Retryable; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; /** @@ -18,14 +22,57 @@ import org.springframework.stereotype.Component; public class PaymentEventSender { private final RabbitTemplate rabbitTemplate; + /** * 支付完成 事件发布 */ - public void sendPaymentCompleted(PayResult event) { + @Async("bigExecutor") + @Retryable(value = Exception.class) + public void sendPayComplete(PayCompleteEvent event) { rabbitTemplate.convertAndSend( PaymentEventCode.EXCHANGE_PAYMENT, PaymentEventCode.PAY_COMPLETE, event ); } + + /** + * 支付撤销/关闭 事件发布 + */ + @Async("bigExecutor") + @Retryable(value = Exception.class) + public void sendPayCancel(PayCancelEvent event){ + rabbitTemplate.convertAndSend( + PaymentEventCode.EXCHANGE_PAYMENT, + PaymentEventCode.PAY_CANCEL, + event + ); + } + + /** + * 支付退款 事件发布 + */ + @Async("bigExecutor") + @Retryable(value = Exception.class) + public void sendPayRefund(PayRefundEvent event){ + rabbitTemplate.convertAndSend( + PaymentEventCode.EXCHANGE_PAYMENT, + PaymentEventCode.PAY_REFUND, + event + ); + } + /** + * 支付单超时 事件发布 + */ + @Async("bigExecutor") + @Retryable(value = Exception.class) + public void sendPaymentExpiredTime(Long paymentId){ + rabbitTemplate.convertAndSend( + PaymentEventCode.EXCHANGE_PAYMENT, + PaymentEventCode.PAYMENT_EXPIRED_TIME, + paymentId + ); + } + + } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentMessageListener.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentMessageListener.java index a617bc4667dc7dd9600b09598cd2fcf0fd79aeae..c56033b1cd2d97214bb1cfcaf28189d646e9e8e1 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentMessageListener.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/mq/PaymentMessageListener.java @@ -1,7 +1,10 @@ package cn.bootx.payment.mq; import cn.bootx.payment.code.PaymentEventCode; -import cn.bootx.payment.dto.pay.PayResult; +import cn.bootx.payment.core.pay.service.PayExpiredTimeService; +import cn.bootx.payment.event.PayCancelEvent; +import cn.bootx.payment.event.PayCompleteEvent; +import cn.bootx.payment.event.PayRefundEvent; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.rabbit.annotation.RabbitListener; @@ -16,12 +19,38 @@ import org.springframework.stereotype.Component; @Component @RequiredArgsConstructor public class PaymentMessageListener { + private final PayExpiredTimeService payExpiredTimeService; + + /** + * 支付超时事件处理 + */ + @RabbitListener(queues = PaymentEventCode.PAYMENT_EXPIRED_TIME) + public void PaymentExpiredTime(Long paymentId){ + payExpiredTimeService.expiredTime(paymentId); + } /** * 支付成功 */ @RabbitListener(queues = PaymentEventCode.PAY_COMPLETE) - public void payCancel(PayResult payResult) { - log.info("支付完成事件:{}",payResult); + public void payCancel(PayCompleteEvent event) { + log.info("支付完成事件:{}",event); } + + /** + * 支付撤销/关闭 + */ + @RabbitListener(queues = PaymentEventCode.PAY_CANCEL) + public void payCancel(PayCancelEvent event) { + log.info("支付撤销/关闭事件:{}",event); + } + + /** + * 支付退款 + */ + @RabbitListener(queues = PaymentEventCode.PAY_REFUND) + public void payCancel(PayRefundEvent event) { + log.info("支付退款事件:{}",event); + } + } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/cashier/CashierSinglePayParam.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/cashier/CashierSinglePayParam.java index 38f7210d078693f67d60398be4ad064eb5f01a92..18063c57885d506b34c082ecde44286a61ed0c5f 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/cashier/CashierSinglePayParam.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/cashier/CashierSinglePayParam.java @@ -22,6 +22,9 @@ public class CashierSinglePayParam { @Schema(description = "金额") private BigDecimal amount; + @Schema(description = "openId") + private String openId; + @Schema(description = "支付通道") private Integer payChannel; diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/pay/PayParam.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/pay/PayParam.java index ef7125abf9d5840c293d1d8c3132151a57e4f16c..41be82f685dee1882314dbd69989a934450a1a91 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/pay/PayParam.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/pay/PayParam.java @@ -1,13 +1,16 @@ package cn.bootx.payment.param.pay; import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema;; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.util.List; +; + /** * @author xxm * @date 2020/12/9 @@ -22,14 +25,18 @@ public class PayParam implements Serializable { private Long userId; @Schema(description= "业务ID") + @NotEmpty(message = "业务ID不可为空") private String businessId; @Schema(description= "支付标题") + @NotEmpty(message = "支付标题不可为空") private String title; @Schema(description= "支付描述") private String description; - @Schema(description= "支付信息",required = true) + @Schema(description= "支付信息参数",required = true) + @NotEmpty(message = "支付信息参数不可为空") + @Valid private List payModeList; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/alipay/AlipayConfigParam.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/alipay/AlipayConfigParam.java index febbd7fcf6c229151b4cb6e29d5b0ca1dd06ce11..dbe03ab0e4a7f0a9c317bd7e5cf0bf82dd1eb0b2 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/alipay/AlipayConfigParam.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/alipay/AlipayConfigParam.java @@ -16,56 +16,57 @@ import java.util.List; @Schema(title = "支付宝配置参数") public class AlipayConfigParam implements Serializable { + @Schema(description = "主键") private Long id; - /** 名称 */ + @Schema(description = "名称") private String name; - /** 支付宝商户appId */ + @Schema(description = "支付宝商户appId") private String appId; - /** 服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 */ + @Schema(description = "服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问") private String notifyUrl; - /** 页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址 */ + @Schema(description = "页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址") private String returnUrl; - /** 请求网关地址 */ + @Schema(description = "请求网关地址") private String serverUrl; - /** 认证类型 证书/公钥 */ + @Schema(description = "认证类型 证书/公钥") private Integer authType; - /** 签名类型 */ + @Schema(description = "签名类型") public String signType; - /** 支付宝公钥 */ + @Schema(description = "支付宝公钥") public String alipayPublicKey; - /** 私钥 */ + @Schema(description = "私钥") private String privateKey; - /** 应用公钥证书 */ + @Schema(description = "应用公钥证书") private String appCert; - /** 支付宝公钥证书文件 */ + @Schema(description = "支付宝公钥证书文件") private String alipayCert; - /** 支付宝CA根证书文件 */ + @Schema(description = "支付宝CA根证书文件") private String alipayRootCert; - /** 超时配置 */ - private String expireTime; + @Schema(description = "超时配置") + private Integer expireTime; - /** 可用支付方式 */ + @Schema(description = "可用支付方式") private List payWayList; - /** 是否沙箱环境 */ + @Schema(description = "是否沙箱环境") private boolean sandbox; - /** 状态 */ + @Schema(description = "状态") private Integer state; - /** 备注 */ + @Schema(description = "备注") private String remark; } diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/wechat/WeChatPayConfigParam.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/wechat/WeChatPayConfigParam.java new file mode 100644 index 0000000000000000000000000000000000000000..ddfca4501042cbdc781e264983811df8d9ae66c9 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/paymodel/wechat/WeChatPayConfigParam.java @@ -0,0 +1,65 @@ +package cn.bootx.payment.param.paymodel.wechat; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 微信支付配置参数 + * @author xxm + * @date 2022/7/7 + */ +@Data +@Accessors(chain = true) +@Schema(title = "微信支付配置参数") +public class WeChatPayConfigParam { + @Schema(description = "主键") + private Long id; + @Schema(description = "名称") + private String name; + @Schema(description = "微信商户号") + private String mchId; + @Schema(description = "微信应用appId") + private String appId; + + /** + * @see cn.bootx.payment.code.paymodel.WeChatPayCode#API_V2 + */ + @Schema(description = "api版本") + private String apiVersion; + @Schema(description = "商户平台「API安全」中的 APIv2 密钥") + private String apiKeyV2; + @Schema(description = "商户平台「API安全」中的 APIv3 密钥") + private String apiKeyV3; + @Schema(description = "APPID对应的接口密码,用于获取接口调用凭证access_token时使用") + private String appSecret; + + @Schema(description = "API 证书中的 p12 文件id") + private Long p12; + @Schema(description = "API 证书中的 cert.pem 证书") + private String certPem; + @Schema(description = "API 证书中的 key.pem 私钥") + private String keyPem; + + @Schema(description = "应用域名,回调中会使用此参数") + private String domain; + @Schema(description = "服务器异步通知页面路径 通知url必须为直接可访问的url,不能携带参数。公网域名必须为https ") + private String notifyUrl; + @Schema(description = "页面跳转同步通知页面路径") + private String returnUrl; + + @Schema(description = "是否沙箱环境") + private boolean sandbox; + @Schema(description = "超时时间(分钟)") + private Integer expireTime; + @Schema(description= "可用支付方式") + private List payWayList; + @Schema(description = "是否启用") + private Boolean activity; + @Schema(description = "状态") + private Integer state; + @Schema(description = "备注") + private String remark; +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/refund/RefundParam.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/refund/RefundParam.java index 7fee1e826fba07929797fb6dabaccca66745273a..67a9b096bf78f1cd253430bbc0d72faffd8221c4 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/refund/RefundParam.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/param/refund/RefundParam.java @@ -1,6 +1,5 @@ package cn.bootx.payment.param.refund; -import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; @@ -17,12 +16,6 @@ import java.util.List; @Schema(title = "退款参数") public class RefundParam { - - @Schema(description = "支付id",hidden = true) - @Deprecated - @JsonIgnore - private String paymentId; - @Schema(description = "业务id") private String businessId; diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/task/PayExpiredTimeTask.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/task/PayExpiredTimeTask.java new file mode 100644 index 0000000000000000000000000000000000000000..ab62c14559abd4cf5fcfd19c7b7da9e842b35c69 --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/task/PayExpiredTimeTask.java @@ -0,0 +1,25 @@ +package cn.bootx.payment.task; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.quartz.*; +import org.springframework.stereotype.Component; + +/** +* 超时支付单任务撤销(2-5秒轮训一次) +* @author xxm +* @date 2022/7/12 +*/ +@Slf4j +@Component +@DisallowConcurrentExecution +@PersistJobDataAfterExecution +@RequiredArgsConstructor +public class PayExpiredTimeTask implements Job { + private final PayExpiredTimeTaskService payExpiredTimeTaskService; + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + payExpiredTimeTaskService. sync(); + } +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/task/PayExpiredTimeTaskService.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/task/PayExpiredTimeTaskService.java new file mode 100644 index 0000000000000000000000000000000000000000..bc2f7df99f249c93c773a6b48fbfd1ce1e9597cd --- /dev/null +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/task/PayExpiredTimeTaskService.java @@ -0,0 +1,38 @@ +package cn.bootx.payment.task; + +import cn.bootx.common.core.util.CollUtil; +import cn.bootx.payment.core.payment.dao.PaymentExpiredTimeRepository; +import cn.bootx.payment.mq.PaymentEventSender; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 支付超时任务撤销消息注册 + * @author xxm + * @date 2022/7/12 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class PayExpiredTimeTaskService { + private final PaymentExpiredTimeRepository expiredTimeRepository; + private final PaymentEventSender paymentEventSender; + + /** + * 定时查询, 如果有过时的发送到消息队列 + */ + public void sync(){ + List paymentIds = expiredTimeRepository.retrieveExpiredKeys(LocalDateTime.now()).stream() + .map(Long::valueOf) + .collect(Collectors.toList()); + if (CollUtil.isNotEmpty(paymentIds)){ + expiredTimeRepository.removeKeys(paymentIds.stream().map(String::valueOf).toArray(String[]::new)); + paymentIds.forEach(paymentEventSender::sendPaymentExpiredTime); + } + } +} diff --git a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/PayModelUtil.java b/bootx-services/service-payment/src/main/java/cn/bootx/payment/util/PayModelUtil.java similarity index 54% rename from bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/PayModelUtil.java rename to bootx-services/service-payment/src/main/java/cn/bootx/payment/util/PayModelUtil.java index 787f33d01797dce02b4e757592c174d49e0bb9af..3bf28555c610de4ee1c14f3f7067479a78d50ee9 100644 --- a/bootx-services/service-payment/src/main/java/cn/bootx/payment/core/pay/PayModelUtil.java +++ b/bootx-services/service-payment/src/main/java/cn/bootx/payment/util/PayModelUtil.java @@ -1,18 +1,25 @@ -package cn.bootx.payment.core.pay; +package cn.bootx.payment.util; +import cn.bootx.common.core.util.BigDecimalUtil; +import cn.bootx.common.core.util.LocalDateTimeUtil; import cn.bootx.payment.code.pay.PayChannelCode; import cn.bootx.payment.code.pay.PayChannelEnum; import cn.bootx.payment.code.pay.PayModelExtraCode; +import cn.bootx.payment.exception.payment.PayAmountAbnormalException; import cn.bootx.payment.exception.payment.PayFailureException; import cn.bootx.payment.param.pay.PayModeParam; import cn.bootx.payment.param.pay.PayParam; import cn.bootx.payment.param.paymodel.alipay.AliPayParam; import cn.bootx.payment.param.paymodel.voucher.VoucherPayParam; import cn.bootx.payment.param.paymodel.wechat.WeChatPayParam; +import cn.hutool.core.date.DatePattern; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import lombok.experimental.UtilityClass; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -20,11 +27,33 @@ import java.util.Map; /** * 支付方式工具类 * @author xxm - * @date 2021/4/21 + * @date 2022/7/12 */ @UtilityClass public class PayModelUtil { + /** + * 获取支付宝的过期时间 + */ + public String getAliExpiredTime(Integer minute){ + return minute + "m"; + } + + /** + * 获取微信的过期时间 + */ + public String getWxExpiredTime(Integer minute) { + LocalDateTime time = LocalDateTimeUtil.offset(LocalDateTime.now(), minute, ChronoUnit.MINUTES); + return LocalDateTimeUtil.format(time, DatePattern.PURE_DATETIME_PATTERN); + } + + /** + * 获取支付单的超时时间 + */ + public LocalDateTime getPaymentExpiredTime(Integer minute){ + return LocalDateTimeUtil.offset(LocalDateTime.now(), minute, ChronoUnit.MINUTES); + } + /** * 判断是否有异步支付 */ @@ -59,6 +88,7 @@ public class PayModelUtil { } case WECHAT:{ return JSONUtil.toJsonStr(new WeChatPayParam() + .setOpenId(map.get(PayModelExtraCode.OPEN_ID)) .setAuthCode(map.get(PayModelExtraCode.AUTH_CODE))); } case VOUCHER:{ @@ -67,7 +97,7 @@ public class PayModelUtil { if (StrUtil.isNotBlank(voucherNo)){ list.add(voucherNo); } - return JSONUtil.toJsonStr(new VoucherPayParam().setCardNoList(list)); + return JSONUtil.toJsonStr(new VoucherPayParam().setCardNoList(list)); } default:{ return null; @@ -75,4 +105,32 @@ public class PayModelUtil { } } + /** + * 检查支付金额 + */ + public void validationAmount(List payModeList){ + for (PayModeParam payModeParam : payModeList) { + // 同时满足支付金额小于等于零 + if (BigDecimalUtil.compareTo(payModeParam.getAmount(), BigDecimal.ZERO) < 1){ + throw new PayAmountAbnormalException(); + } + } + } + + /** + * 检查异步支付方式 + */ + public void validationAsyncPayMode(PayParam payParam) { + // 组合支付时只允许有一个异步支付方式 + List payModeList = payParam.getPayModeList(); + + long asyncPayModeCount = payModeList.stream() + .map(PayModeParam::getPayChannel) + .filter(PayChannelCode.ASYNC_TYPE::contains) + .count(); + if (asyncPayModeCount>1){ + throw new PayFailureException("组合支付时只允许有一个异步支付方式"); + } + } + } diff --git a/bootx-services/service-payment/src/main/resources/templates/errorCashier.html b/bootx-services/service-payment/src/main/resources/templates/errorCashier.html new file mode 100644 index 0000000000000000000000000000000000000000..3e4433e5ad7b37dc64d08bd1a86231cacef84b10 --- /dev/null +++ b/bootx-services/service-payment/src/main/resources/templates/errorCashier.html @@ -0,0 +1,10 @@ + + + + + 请使用微信或支付宝扫码打开 + + +

请使用微信或支付宝扫码打开!

+ + \ No newline at end of file diff --git a/bootx-services/service-payment/src/main/resources/templates/wechatJsapiPay.html b/bootx-services/service-payment/src/main/resources/templates/wechatJsapiPay.html new file mode 100644 index 0000000000000000000000000000000000000000..6020e41450e6790316f4f13113376b2c7d2e987d --- /dev/null +++ b/bootx-services/service-payment/src/main/resources/templates/wechatJsapiPay.html @@ -0,0 +1,47 @@ + + + + + 微信支付 + + +

+
+

+ + + \ No newline at end of file diff --git a/bootx-services/service-sales/pom.xml b/bootx-services/service-sales/pom.xml index cb299b9e6880b369f5aea4c3b369edb0144cce60..338e821e9a133595677595099f42d893540dda58 100644 --- a/bootx-services/service-sales/pom.xml +++ b/bootx-services/service-sales/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 diff --git a/bootx-start/pom.xml b/bootx-start/pom.xml index 2fe87733d1c016052150a4f5c20673847ac3ec55..b04349e3ce97721fcc527cc1a1eb87d8fa3bba3e 100644 --- a/bootx-start/pom.xml +++ b/bootx-start/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-platform - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 4.0.0 bootx-start diff --git a/bootx-start/src/main/resources/application-dev.yml b/bootx-start/src/main/resources/application-dev.yml index 0d202482dc7674d41389fb8e36f5d1505b5dfda2..f0e0f4d539f4a3ac95991aa37ba5a865c9d33304 100644 --- a/bootx-start/src/main/resources/application-dev.yml +++ b/bootx-start/src/main/resources/application-dev.yml @@ -16,6 +16,7 @@ spring: port: 6379 database: 1 rabbitmq: + virtual-host: bootx-platform host: 127.0.0.1 port: 5672 username: guest @@ -93,6 +94,9 @@ bootx: "[自定义starter组件]": cn.bootx.starter # 缓存 cache: + # 默认超时时间 30分钟 + default-ttl: 1800 + # 对Key设置超时间 keys-ttl: "[iam:user:path]" : 5200 "[iam:ignore:path]" : 5200 @@ -121,7 +125,7 @@ bootx: - '/css/**' - '/error' - '/favicon.ico' -# - '/**' + - '/**' # 第三方登录 third-login: ding-talk: diff --git a/bootx-start/src/main/resources/db/migration/V1.1.0_220714__bate5.sql b/bootx-start/src/main/resources/db/migration/V1.1.0_220714__bate5.sql new file mode 100644 index 0000000000000000000000000000000000000000..2146d24c57ecfcb41eec50ecdb08156033333b9e --- /dev/null +++ b/bootx-start/src/main/resources/db/migration/V1.1.0_220714__bate5.sql @@ -0,0 +1,84 @@ +SET FOREIGN_KEY_CHECKS=0; + +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `expire_time` int(10) NOT NULL COMMENT '超时配置' AFTER `sandbox`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `state`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `creator`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `create_time`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `last_modifier`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `version` int(11) NOT NULL COMMENT '版本' AFTER `last_modified_time`; +ALTER TABLE `pay_alipay_config` MODIFY COLUMN `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除' AFTER `version`; + +ALTER TABLE `pay_payment` MODIFY COLUMN `business_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务id' AFTER `user_id`; +ALTER TABLE `pay_payment` MODIFY COLUMN `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题' AFTER `business_id`; +ALTER TABLE `pay_payment` MODIFY COLUMN `description` varchar(240) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述' AFTER `title`; +ALTER TABLE `pay_payment` ADD UNIQUE INDEX `uniq_business_id`(`business_id`) USING BTREE COMMENT '业务编号id, 唯一ID'; + +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `api_version` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务商应用编号' AFTER `mch_id`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `api_key_v2` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv2 密钥' AFTER `api_version`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `api_key_v3` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户平台「API安全」中的 APIv3 密钥' AFTER `api_key_v2`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `app_secret` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'APPID对应的接口密码,用于获取接口调用凭证access_token时使用' AFTER `api_key_v3`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `p12` bigint(20) NULL DEFAULT NULL COMMENT 'p12的文件id' AFTER `app_secret`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `cert_pem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'API 证书中的 cert.pem' AFTER `p12`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `key_pem` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'API 证书中的 key.pem' AFTER `cert_pem`; +ALTER TABLE `pay_wechat_pay_config` ADD COLUMN `expire_time` int(10) NOT NULL COMMENT '超时配置' AFTER `sandbox`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `id` bigint(20) NOT NULL COMMENT '主键' FIRST; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称' AFTER `id`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `app_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信应用AppId' AFTER `name`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `mch_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商户号' AFTER `app_id`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `pay_ways` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支持的支付类型' AFTER `return_url`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注' AFTER `state`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `remark`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `creator`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `create_time`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `last_modifier`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `version` int(11) NOT NULL COMMENT '版本' AFTER `last_modified_time`; +ALTER TABLE `pay_wechat_pay_config` MODIFY COLUMN `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除' AFTER `version`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `sl_app_id`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `api_key`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `api_key3`; + +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `sl_mch_id`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `auth_type`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `cert_path`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `cert_pem_path`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `key_pem_path`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `partner_key`; +ALTER TABLE `pay_wechat_pay_config` DROP COLUMN `is_default`; + +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人' AFTER `pay_time`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间' AFTER `creator`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人' AFTER `create_time`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间' AFTER `last_modifier`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `version` int(11) NOT NULL COMMENT '版本' AFTER `last_modified_time`; +ALTER TABLE `pay_wechat_payment` MODIFY COLUMN `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除' AFTER `version`; +ALTER TABLE `pay_wechat_payment` DROP COLUMN `tid`; + +INSERT INTO `base_dict` VALUES (1546757092010078208, 'PayNotifyProcess', '支付回调处理状态', '支付服务', '成功/忽略/失败', 1399985191002447872, '2022-07-12 15:23:23', 1399985191002447872, '2022-07-12 15:23:53', 0, 1); + +INSERT INTO `base_dict_item` VALUES (1546757293592522752, 1546757092010078208, 'PayNotifyProcess', '0', '失败', 0.00, '', 1399985191002447872, '2022-07-12 15:24:11', 1399985191002447872, '2022-07-12 15:24:11', 0, 0); +INSERT INTO `base_dict_item` VALUES (1546757327901929472, 1546757092010078208, 'PayNotifyProcess', '1', '成功', -1.00, '', 1399985191002447872, '2022-07-12 15:24:19', 1399985191002447872, '2022-07-12 15:31:38', 0, 2); +INSERT INTO `base_dict_item` VALUES (1546757375637303296, 1546757092010078208, 'PayNotifyProcess', '2', '忽略', 0.00, '', 1399985191002447872, '2022-07-12 15:24:30', 1399985191002447872, '2022-07-12 15:24:30', 0, 0); + +INSERT INTO `base_param` VALUES (1545765299880448000, '服务器地址', 'ServerUrl', 'http://127.0.0.1:9999', 1, b'1', '', 1399985191002447872, '2022-07-09 21:42:21', 1399985191002447872, '2022-07-09 21:42:21', 0, 0); +INSERT INTO `base_param` VALUES (1547511252795912192, '微信jsapi支付回调服务地址', 'JsapiRedirectUrl', 'http://127.0.0.1/api/', 1, b'1', '', 1414143554414059520, '2022-07-14 17:20:09', 1414143554414059520, '2022-07-14 17:20:09', 0, 0); +UPDATE `base_param` SET `value` = 'http://127.0.0.1/api/' WHERE `id` = 1500338438182789120; + +INSERT INTO `iam_perm_menu` VALUES (1544952211901218816, 'admin', 1546850918849249280, '支付结算台演示', 'CashierDemo', NULL, b'0', '', b'0', b'0', '', NULL, '/cashier', '', 0, 1, NULL, b'0', b'1', b'0', b'0', NULL, 1399985191002447872, '2022-07-07 15:51:26', 1399985191002447872, '2022-07-12 21:36:34', 2, 0); +INSERT INTO `iam_perm_menu` VALUES (1546850918849249280, 'admin', 1495968302034210816, '支付演示', 'DemoPay', NULL, b'0', '', b'0', b'0', 'RouteView', NULL, '/demo/pay', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2022-07-12 21:36:13', 1399985191002447872, '2022-07-12 21:36:13', 0, 0); + +UPDATE `iam_perm_menu` SET `client_code` = 'admin', `parent_id` = 1546850918849249280, `title` = '收银台', `name` = 'PayCashier', `perm_code` = '', `effect` = b'0', `icon` = '', `hidden` = b'0', `hide_children_in_menu` = b'0', `component` = 'payment/cashier/Cashier', `component_name` = NULL, `path` = '/demo/pay/cashier', `redirect` = '', `sort_no` = -1, `menu_type` = 1, `leaf` = NULL, `keep_alive` = b'1', `target_outside` = b'0', `hidden_header_content` = b'0', `admin` = b'0', `remark` = NULL, `creator` = 1399985191002447872, `create_time` = '2021-10-20 22:05:26', `last_modifier` = 1399985191002447872, `last_modified_time` = '2022-07-12 21:37:22', `version` = 3, `deleted` = 0 WHERE `id` = 1450825488577544192; +UPDATE `iam_perm_menu` SET `client_code` = 'admin', `parent_id` = 1546850918849249280, `title` = '组合支付', `name` = 'CombinationCashier', `perm_code` = NULL, `effect` = b'0', `icon` = '', `hidden` = b'0', `hide_children_in_menu` = b'0', `component` = 'payment/combination/CombinationCashier', `component_name` = NULL, `path` = '/demo/pay/combination', `redirect` = '', `sort_no` = -0.5, `menu_type` = 1, `leaf` = NULL, `keep_alive` = b'1', `target_outside` = b'0', `hidden_header_content` = b'0', `admin` = b'0', `remark` = NULL, `creator` = 1399985191002447872, `create_time` = '2022-03-10 17:07:56', `last_modifier` = 1399985191002447872, `last_modified_time` = '2022-07-12 21:37:59', `version` = 4, `deleted` = 0 WHERE `id` = 1501847310319972352; + +UPDATE `iam_user_expand_info` SET `sex` = 1, `birthday` = '1996-12-01', `avatar` = '1495331905770315776', `last_login_time` = '2022-07-12 15:20:44', `current_login_time` = '2022-07-12 21:35:26', `initial_password` = b'0', `last_change_password_time` = '2022-06-19 21:25:00', `creator` = 1, `create_time` = '2021-06-02 15:04:15', `last_modifier` = 0, `last_modified_time` = '2022-07-12 21:35:26', `version` = 273, `deleted` = 0 WHERE `id` = 1399985191002447872; + +INSERT INTO `qrtz_cron_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '0/5 * * * * ? *', 'Asia/Shanghai'); + +INSERT INTO `qrtz_fired_triggers` VALUES ('quartzScheduler', 'NON_CLUSTERED1657763850994', '1546857070483939328', 'DEFAULT', 'NON_CLUSTERED', 1657767410672, 1657767415000, 5, 'ACQUIRED', NULL, NULL, '0', '0'); + +INSERT INTO `qrtz_job_details` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', NULL, 'cn.bootx.payment.task.PayExpiredTimeTask', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C77080000001000000001740009706172616D65746572707800); + +INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '1546857070483939328', 'DEFAULT', NULL, 1657767415000, 1657767410000, 5, 'ACQUIRED', 'CRON', 1657634445000, 0, NULL, 0, ''); + +INSERT INTO `starter_quartz_job` VALUES (1546857070483939328, '支付单超时检测', 'cn.bootx.payment.task.PayExpiredTimeTask', '0/5 * * * * ? *', NULL, 1, '检测超时的支付单, 超时后发送超时事件', 1399985191002447872, '2022-07-12 22:00:39', 1399985191002447872, '2022-07-12 22:00:45', 1, 0); + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/pom.xml b/pom.xml index 16f21853d331b8c5f0822e2b5973c909a931f808..a7347c1a53c45a39ca65ca44e382cc3acd46144f 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ cn.bootx.platform bootx-platform pom - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT bootx-common-core @@ -33,7 +33,7 @@ 1.8 - 1.1.0-beta-4-SNAPSHOT + 1.1.0-beta-5-SNAPSHOT 5.8.1 6.1.6