1:优化商户管理页面BUG

2:优化应用关闭页面
3:完成支付订单CURD 以及单元测试
4:将 Element UI 从 2.15.0 升级至 2.15.6
This commit is contained in:
chen quan 2021-12-08 19:21:24 +08:00
parent f108d478a8
commit 98dfa48ced
41 changed files with 2808 additions and 516 deletions

View File

@ -1,40 +1,174 @@
-- 商户状态 status
INSERT INTO `sys_dict_type` ( `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( '商户状态', 'pay_merchant_status', 0, '商户的启用于停用状态', '1', '2021-11-03 11:29:04', '1', '2021-11-03 11:29:04', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('商户状态', 'pay_merchant_status', 0, '商户的启用于停用状态', '1', '2021-11-03 11:29:04', '1', '2021-11-03 11:29:04', b'0');
INSERT INTO `sys_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 1, '启用', '0', 'pay_merchant_status', 0, '商户启用', '1', '2021-11-03 11:30:52', '1', '2021-11-03 11:31:15', b'0');
INSERT INTO `sys_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 2, '停用', '1', 'pay_merchant_status', 0, '商户停用', '1', '2021-11-03 11:31:05', '1', '2021-11-03 11:31:05', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '启用', '0', 'pay_merchant_status', 0, '商户启用', '1', '2021-11-03 11:30:52', '1', '2021-11-03 11:31:15', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '停用', '1', 'pay_merchant_status', 0, '商户停用', '1', '2021-11-03 11:31:05', '1', '2021-11-03 11:31:05', b'0');
-- 支付应用状态 status
INSERT INTO `sys_dict_type` ( `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('支付应用状态', 'pay_app_status', 0, '支付应用的启停状态', '1', '2021-11-06 19:41:50', '1', '2021-11-06 19:41:50', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付应用状态', 'pay_app_status', 0, '支付应用的启停状态', '1', '2021-11-06 19:41:50', '1', '2021-11-06 19:41:50', b'0');
INSERT INTO `sys_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 1, '开启', '0', 'pay_app_status', 0, NULL, '1', '2021-11-06 19:42:10', '1', '2021-11-06 19:42:10', b'0');
INSERT INTO `sys_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 2, '关闭', '1', 'pay_app_status', 0, NULL, '1', '2021-11-06 19:42:17', '1', '2021-11-06 19:42:17', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '开启', '0', 'pay_app_status', 0, NULL, '1', '2021-11-06 19:42:10', '1', '2021-11-06 19:42:10', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '关闭', '1', 'pay_app_status', 0, NULL, '1', '2021-11-06 19:42:17', '1', '2021-11-06 19:42:17', b'0');
-- 支付渠道状态 status
INSERT INTO `sys_dict_type` ( `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( '支付渠道状态', 'pay_channel_status', 0, '支付渠道的启停状态', '1', '2021-11-08 16:47:21', '1', '2021-11-08 16:47:21', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付渠道状态', 'pay_channel_status', 0, '支付渠道的启停状态', '1', '2021-11-08 16:47:21', '1', '2021-11-08 16:47:21', b'0');
INSERT INTO `sys_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 1, '开启', '0', 'pay_channel_status', 0, '开启', '1', '2021-11-08 16:47:45', '1', '2021-11-08 16:47:45', b'0');
INSERT INTO `sys_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 2, '关闭', '1', 'pay_channel_status', 0, '关闭', '1', '2021-11-08 16:47:52', '1', '2021-11-08 16:47:52', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '开启', '0', 'pay_channel_status', 0, '开启', '1', '2021-11-08 16:47:45', '1', '2021-11-08 16:47:45', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '关闭', '1', 'pay_channel_status', 0, '关闭', '1', '2021-11-08 16:47:52', '1', '2021-11-08 16:47:52', b'0');
-- 微信渠道版本控制
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('支付渠道微信版本', 'pay_channel_wechat_version', 0, '支付渠道微信版本', '1', '2021-11-08 17:00:26', '1', '2021-11-08 17:00:26', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付渠道微信版本', 'pay_channel_wechat_version', 0, '支付渠道微信版本', '1', '2021-11-08 17:00:26', '1', '2021-11-08 17:00:26',
b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 'v2', 'v2', 'pay_channel_wechat_version', 0, 'v2版本', '1', '2021-11-08 17:00:58', '1', '2021-11-08 17:00:58', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, 'v3', 'v3', 'pay_channel_wechat_version', 0, 'v3版本', '1', '2021-11-08 17:01:07', '1', '2021-11-08 17:01:07', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, 'v2', 'v2', 'pay_channel_wechat_version', 0, 'v2版本', '1', '2021-11-08 17:00:58', '1', '2021-11-08 17:00:58',
b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, 'v3', 'v3', 'pay_channel_wechat_version', 0, 'v3版本', '1', '2021-11-08 17:01:07', '1', '2021-11-08 17:01:07',
b'0');
-- 支付渠道支付宝算法类型
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('支付渠道支付宝算法类型', 'pay_channel_alipay_sign_type', 0, '支付渠道支付宝算法类型', '1', '2021-11-18 15:39:09', '1', '2021-11-18 15:39:09', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 'RSA2', 'RSA2', 'pay_channel_alipay_sign_type', 0, 'RSA2', '1', '2021-11-18 15:39:29', '1', '2021-11-18 15:39:29', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付渠道支付宝算法类型', 'pay_channel_alipay_sign_type', 0, '支付渠道支付宝算法类型', '1', '2021-11-18 15:39:09', '1',
'2021-11-18 15:39:09', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, 'RSA2', 'RSA2', 'pay_channel_alipay_sign_type', 0, 'RSA2', '1', '2021-11-18 15:39:29', '1',
'2021-11-18 15:39:29', b'0');
-- 支付渠道支付宝公钥类型
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('支付渠道支付宝公钥类型', 'pay_channel_alipay_mode', 0, '支付渠道支付宝公钥类型', '1', '2021-11-18 15:44:28', '1', '2021-11-18 15:44:28', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '公钥模式', '1', 'pay_channel_alipay_mode', 0, '公钥模式privateKey + alipayPublicKey', '1', '2021-11-18 15:45:23', '1', '2021-11-18 15:45:23', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, '证书模式', '2', 'pay_channel_alipay_mode', 0, '证书模式appCertContent + alipayPublicCertContent + rootCertContent', '1', '2021-11-18 15:45:40', '1', '2021-11-18 15:45:40', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付渠道支付宝公钥类型', 'pay_channel_alipay_mode', 0, '支付渠道支付宝公钥类型', '1', '2021-11-18 15:44:28', '1',
'2021-11-18 15:44:28', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '公钥模式', '1', 'pay_channel_alipay_mode', 0, '公钥模式privateKey + alipayPublicKey', '1', '2021-11-18 15:45:23',
'1', '2021-11-18 15:45:23', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '证书模式', '2', 'pay_channel_alipay_mode', 0, '证书模式appCertContent + alipayPublicCertContent + rootCertContent',
'1', '2021-11-18 15:45:40', '1', '2021-11-18 15:45:40', b'0');
-- 支付宝网关地址
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('支付宝网关地址', 'pay_channel_alipay_server_type', 0, '支付宝网关地址', '1', '2021-11-18 16:58:55', '1', '2021-11-18 17:01:34', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '线上', 'https://openapi.alipay.com/gateway.do', 'pay_channel_alipay_server_type', 0, '网关地址 - 线上', '1', '2021-11-18 16:59:32', '1', '2021-11-21 17:37:29', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, '沙箱', 'https://openapi.alipaydev.com/gateway.do', 'pay_channel_alipay_server_type', 0, '网关地址 - 沙箱', '1', '2021-11-18 16:59:48', '1', '2021-11-21 17:37:39', b'0');
INSERT INTO `sys_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付宝网关地址', 'pay_channel_alipay_server_type', 0, '支付宝网关地址', '1', '2021-11-18 16:58:55', '1',
'2021-11-18 17:01:34', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '线上', 'https://openapi.alipay.com/gateway.do', 'pay_channel_alipay_server_type', 0, '网关地址 - 线上', '1',
'2021-11-18 16:59:32', '1', '2021-11-21 17:37:29', b'0');
INSERT INTO `sys_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '沙箱', 'https://openapi.alipaydev.com/gateway.do', 'pay_channel_alipay_server_type', 0, '网关地址 - 沙箱', '1',
'2021-11-18 16:59:48', '1', '2021-11-21 17:37:39', b'0');
-- 支付渠道编码类型
INSERT INTO `sys_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付渠道编码类型', 'pay_channel_code_type', 0, '支付渠道的编码', '1', '2021-12-03 10:35:08', '1', '2021-12-03 10:35:08',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '微信 JSAPI 支付', 'wx_pub', 'pay_channel_code_type', 0, '微信 JSAPI公众号 支付', '1', '2021-12-03 10:40:24', '1',
'2021-12-04 16:41:00', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '微信小程序支付', 'wx_lite', 'pay_channel_code_type', 0, '微信小程序支付', '1', '2021-12-03 10:41:06', '1',
'2021-12-03 10:41:06', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (3, '微信 App 支付', 'wx_app', 'pay_channel_code_type', 0, '微信 App 支付', '1', '2021-12-03 10:41:20', '1',
'2021-12-03 10:41:20', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (4, '支付宝 PC 网站支付', 'alipay_pc', 'pay_channel_code_type', 0, '支付宝 PC 网站支付', '1', '2021-12-03 10:42:09', '1',
'2021-12-03 10:42:09', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (5, '支付宝 Wap 网站支付', 'alipay_wap', 'pay_channel_code_type', 0, '支付宝 Wap 网站支付', '1', '2021-12-03 10:42:26', '1',
'2021-12-03 10:42:26', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (6, '支付宝App 支付', 'alipay_app', 'pay_channel_code_type', 0, '支付宝App 支付', '1', '2021-12-03 10:42:55', '1',
'2021-12-03 10:42:55', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (7, '支付宝扫码支付', 'alipay_qr', 'pay_channel_code_type', 0, '支付宝扫码支付', '1', '2021-12-03 10:43:10', '1',
'2021-12-03 10:43:10', b'0');
-- 支付订单回调状态
INSERT INTO `sys_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付订单回调状态', 'pay_order_notify_status', 0, '支付订单回调状态', '1', '2021-12-03 10:53:29', '1', '2021-12-03 10:53:29',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '通知成功', '10', 'pay_order_notify_status', 0, '通知成功', '1', '2021-12-03 11:02:41', '1', '2021-12-03 11:02:41',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '通知失败', '20', 'pay_order_notify_status', 0, '通知失败', '1', '2021-12-03 11:02:59', '1', '2021-12-03 11:02:59',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (3, '未通知', '0', 'pay_order_notify_status', 0, '未通知', '1', '2021-12-03 11:03:10', '1', '2021-12-03 11:03:10',
b'0');
-- 支付订单状态
INSERT INTO `sys_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付订单状态', 'pay_order_status', 0, '支付订单状态', '1', '2021-12-03 11:17:50', '1', '2021-12-03 11:17:50', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '支付成功', '10', 'pay_order_status', 0, '支付成功', '1', '2021-12-03 11:18:29', '1', '2021-12-03 11:28:32', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '支付关闭', '20', 'pay_order_status', 0, '支付关闭', '1', '2021-12-03 11:18:42', '1', '2021-12-03 11:28:34', b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (3, '未支付', '0', 'pay_order_status', 0, '未支付', '1', '2021-12-03 11:18:18', '1', '2021-12-03 11:28:36', b'0');
-- 支付订单退款状态
INSERT INTO `sys_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`,
`deleted`)
VALUES ('支付订单退款状态', 'pay_order_refund_status', 0, '支付订单退款状态', '1', '2021-12-03 11:27:31', '1', '2021-12-03 11:27:31',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (1, '未退款', '0', 'pay_order_refund_status', 0, '未退款', '1', '2021-12-03 11:30:35', '1', '2021-12-03 11:34:05',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (2, '部分退款', '10', 'pay_order_refund_status', 0, '部分退款', '1', '2021-12-03 11:30:44', '1', '2021-12-03 11:34:10',
b'0');
INSERT INTO `sys_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `remark`, `creator`, `create_time`,
`updater`, `update_time`, `deleted`)
VALUES (3, '全部退款', '20', 'pay_order_refund_status', 0, '全部退款', '1', '2021-12-03 11:30:52', '1', '2021-12-03 11:34:14',
b'0');

30
sql/pay-order-menu.sql Normal file
View File

@ -0,0 +1,30 @@
-- 菜单 SQL
INSERT INTO `sys_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`,
`path`, `icon`, `component`, `status`)
VALUES ('支付订单管理', '', 2, 0, ${table.parentMenuId},
'order', '', 'pay/order/index', 0);
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
INSERT INTO `sys_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`,
`path`, `icon`, `component`, `status`)
VALUES ('支付订单查询', 'pay:order:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO `sys_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`,
`path`, `icon`, `component`, `status`)
VALUES ('支付订单创建', 'pay:order:create', 3, 2, @parentId,
'', '', '', 0);
INSERT INTO `sys_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`,
`path`, `icon`, `component`, `status`)
VALUES ('支付订单更新', 'pay:order:update', 3, 3, @parentId,
'', '', '', 0);
INSERT INTO `sys_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`,
`path`, `icon`, `component`, `status`)
VALUES ('支付订单删除', 'pay:order:delete', 3, 4, @parentId,
'', '', '', 0);
INSERT INTO `sys_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`,
`path`, `icon`, `component`, `status`)
VALUES ('支付订单导出', 'pay:order:export', 3, 5, @parentId,
'', '', '', 0);

View File

@ -18,13 +18,11 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@ -170,6 +168,14 @@ public class PayAppController {
ExcelUtils.write(response, "支付应用信息.xls", "数据", PayAppExcelVO.class, datas);
}
@GetMapping("/list-merchant-id")
@ApiOperation("根据商户 ID 查询支付应用信息")
@ApiImplicitParam(name = "merchantId", value = "商户ID", required = true, example = "1", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
public CommonResult<List<PayAppRespVO>> getMerchantListByName(@RequestParam String merchantId) {
List<PayAppDO> appListDO = appService.getListByMerchantId(merchantId);
return success(PayAppConvert.INSTANCE.convertList(appListDO));
}
}

View File

@ -77,9 +77,9 @@ public class PayMerchantController {
@GetMapping("/list-name")
@ApiOperation("根据商户名称获得支付商户信息列表")
@ApiImplicitParam(name = "name", value = "商户名称", required = true, example = "芋道", dataTypeClass = Long.class)
@ApiImplicitParam(name = "name", value = "商户名称", example = "芋道", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
public CommonResult<List<PayMerchantRespVO>> getMerchantListByName(@RequestParam("name") String name) {
public CommonResult<List<PayMerchantRespVO>> getMerchantListByName(@RequestParam(required = false) String name) {
List<PayMerchantDO> merchantListDO = merchantService.getMerchantListByName(name);
return success(PayMerchantConvert.INSTANCE.convertList(merchantListDO));
}

View File

@ -1,8 +1,12 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.merchant.vo;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
@ApiModel("支付商户信息 Response VO")
@Data
@ -16,4 +20,11 @@ public class PayMerchantRespVO extends PayMerchantBaseVO {
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 商户号
* 例如说M233666999
* 只有新增时插入不允许修改
*/
private String no;
}

View File

@ -0,0 +1,187 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.*;
import cn.iocoder.yudao.adminserver.modules.pay.convert.order.PayOrderConvert;
import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService;
import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderExtensionService;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
/**
* 支付订单 controller 组件
*
* @author aquan
*/
@Api(tags = "支付订单")
@RestController
@RequestMapping("/pay/order")
@Validated
public class PayOrderController {
/**
* 订单 service 组件
*/
@Resource
private PayOrderService orderService;
/**
* 订单扩展 service 组件
*/
@Resource
private PayOrderExtensionService orderExtensionService;
/**
* 商户 service 组件
*/
@Resource
private PayMerchantService merchantService;
/**
* 应用 service 组件
*/
@Resource
private PayAppService appService;
@GetMapping("/get")
@ApiOperation("获得支付订单")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('pay:order:query')")
public CommonResult<PayOrderDetailsRespVO> getOrder(@RequestParam("id") Long id) {
PayOrderDO order = orderService.getOrder(id);
if (ObjectUtil.isNull(order)) {
return success(new PayOrderDetailsRespVO());
}
PayMerchantDO merchantDO = merchantService.getMerchant(order.getMerchantId());
PayAppDO appDO = appService.getApp(order.getAppId());
PayChannelEnum channelEnum = PayChannelEnum.getByCode(order.getChannelCode());
PayOrderDetailsRespVO respVO = PayOrderConvert.INSTANCE.orderDetailConvert(order);
respVO.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
respVO.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
respVO.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
PayOrderExtensionDO extensionDO = orderExtensionService.getOrderExtension(order.getSuccessExtensionId());
if (ObjectUtil.isNotNull(extensionDO)) {
respVO.setPayOrderExtension(PayOrderConvert.INSTANCE.orderDetailExtensionConvert(extensionDO));
}
return success(respVO);
}
@GetMapping("/list")
@ApiOperation("获得支付订单列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('pay:order:query')")
public CommonResult<List<PayOrderRespVO>> getOrderList(@RequestParam("ids") Collection<Long> ids) {
List<PayOrderDO> list = orderService.getOrderList(ids);
return success(PayOrderConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@ApiOperation("获得支付订单分页")
@PreAuthorize("@ss.hasPermission('pay:order:query')")
public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) {
PageResult<PayOrderDO> pageResult = orderService.getOrderPage(pageVO);
if (CollectionUtil.isEmpty(pageResult.getList())) {
return success(new PageResult<>(pageResult.getTotal()));
}
// 处理商户ID数据
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getMerchantId));
// 处理应用ID数据
Map<Long, PayAppDO> appMap = appService.getAppMap(
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getAppId));
List<PayOrderPageItemRespVO> pageList = new ArrayList<>(pageResult.getList().size());
pageResult.getList().forEach(c -> {
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
PayAppDO appDO = appMap.get(c.getAppId());
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
PayOrderPageItemRespVO orderItem = PayOrderConvert.INSTANCE.pageConvertItemPage(c);
orderItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
orderItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
orderItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
pageList.add(orderItem);
});
return success(new PageResult<>(pageList, pageResult.getTotal()));
}
@GetMapping("/export-excel")
@ApiOperation("导出支付订单Excel")
@PreAuthorize("@ss.hasPermission('pay:order:export')")
@OperateLog(type = EXPORT)
public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<PayOrderDO> list = orderService.getOrderList(exportReqVO);
if (CollectionUtil.isEmpty(list)) {
ExcelUtils.write(response, "支付订单.xls", "数据",
PayOrderExcelVO.class, new ArrayList<>());
}
// 处理商户ID数据
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
CollectionUtils.convertList(list, PayOrderDO::getMerchantId));
// 处理应用ID数据
Map<Long, PayAppDO> appMap = appService.getAppMap(
CollectionUtils.convertList(list, PayOrderDO::getAppId));
// 处理扩展订单数据
Map<Long, PayOrderExtensionDO> orderExtensionMap = orderExtensionService
.getOrderExtensionMap(CollectionUtils.convertList(list, PayOrderDO::getSuccessExtensionId));
List<PayOrderExcelVO> excelDatum = new ArrayList<>(list.size());
list.forEach(c -> {
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
PayAppDO appDO = appMap.get(c.getAppId());
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
PayOrderExtensionDO orderExtensionDO = orderExtensionMap.get(c.getSuccessExtensionId());
PayOrderExcelVO excelItem = PayOrderConvert.INSTANCE.excelConvert(c);
excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
excelItem.setNo(ObjectUtil.isNotNull(orderExtensionDO) ? orderExtensionDO.getNo() : "");
excelDatum.add(excelItem);
});
// 导出 Excel
ExcelUtils.write(response, "支付订单.xls", "数据", PayOrderExcelVO.class, excelDatum);
}
}

View File

@ -0,0 +1,108 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 支付订单
* Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*
* @author aquan
*/
@Data
public class PayOrderBaseVO {
@ApiModelProperty(value = "商户编号", required = true)
@NotNull(message = "商户编号不能为空")
private Long merchantId;
@ApiModelProperty(value = "应用编号", required = true)
@NotNull(message = "应用编号不能为空")
private Long appId;
@ApiModelProperty(value = "渠道编号")
private Long channelId;
@ApiModelProperty(value = "渠道编码")
private String channelCode;
@ApiModelProperty(value = "商户订单编号", required = true)
@NotNull(message = "商户订单编号不能为空")
private String merchantOrderId;
@ApiModelProperty(value = "商品标题", required = true)
@NotNull(message = "商品标题不能为空")
private String subject;
@ApiModelProperty(value = "商品描述", required = true)
@NotNull(message = "商品描述不能为空")
private String body;
@ApiModelProperty(value = "异步通知地址", required = true)
@NotNull(message = "异步通知地址不能为空")
private String notifyUrl;
@ApiModelProperty(value = "通知商户支付结果的回调状态", required = true)
@NotNull(message = "通知商户支付结果的回调状态不能为空")
private Integer notifyStatus;
@ApiModelProperty(value = "支付金额,单位:分", required = true)
@NotNull(message = "支付金额,单位:分不能为空")
private Long amount;
@ApiModelProperty(value = "渠道手续费,单位:百分比")
private Double channelFeeRate;
@ApiModelProperty(value = "渠道手续金额,单位:分")
private Long channelFeeAmount;
@ApiModelProperty(value = "支付状态", required = true)
@NotNull(message = "支付状态不能为空")
private Integer status;
@ApiModelProperty(value = "用户 IP", required = true)
@NotNull(message = "用户 IP不能为空")
private String userIp;
@ApiModelProperty(value = "订单失效时间", required = true)
@NotNull(message = "订单失效时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date expireTime;
@ApiModelProperty(value = "订单支付成功时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date successTime;
@ApiModelProperty(value = "订单支付通知时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date notifyTime;
@ApiModelProperty(value = "支付成功的订单拓展单编号")
private Long successExtensionId;
@ApiModelProperty(value = "退款状态", required = true)
@NotNull(message = "退款状态不能为空")
private Integer refundStatus;
@ApiModelProperty(value = "退款次数", required = true)
@NotNull(message = "退款次数不能为空")
private Integer refundTimes;
@ApiModelProperty(value = "退款总金额,单位:分", required = true)
@NotNull(message = "退款总金额,单位:分不能为空")
private Long refundAmount;
@ApiModelProperty(value = "渠道用户编号")
private String channelUserId;
@ApiModelProperty(value = "渠道订单号")
private String channelOrderNo;
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
/**
* 支付订单详细信息由支付订单和支付订单扩展信息组成
*
* @author aquan
*/
@ApiModel("支付订单详细信息 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PayOrderDetailsRespVO extends PayOrderBaseVO {
@ApiModelProperty(value = "支付订单编号")
private Long id;
@ApiModelProperty(value = "商户名称")
private String merchantName;
@ApiModelProperty(value = "应用名称")
private String appName;
@ApiModelProperty(value = "渠道编号名称")
private String channelCodeName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 支付订单扩展
*/
private PayOrderExtension payOrderExtension;
@Data
@ApiModel("支付订单扩展")
public static class PayOrderExtension {
@ApiModelProperty(value = "支付订单号")
private String no;
@ApiModelProperty(value = "支付渠道的额外参数")
private String channelExtras;
@ApiModelProperty(value = "支付异步通知的内容")
private String channelNotifyData;
}
}

View File

@ -0,0 +1,91 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import cn.iocoder.yudao.adminserver.modules.system.enums.SysDictTypeConstants;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.Date;
/**
* 支付订单Excel VO
*
* @author aquan
*/
@Data
public class PayOrderExcelVO {
@ExcelProperty("支付订单编号")
private Long id;
@ExcelProperty(value = "商户名称")
private String merchantName;
@ExcelProperty(value = "应用名称")
private String appName;
@ExcelProperty("商品标题")
private String subject;
@ExcelProperty("商户订单编号")
private String merchantOrderId;
@ExcelProperty("渠道订单号")
private String channelOrderNo;
@ExcelProperty(value = "支付订单号")
private String no;
@ExcelProperty("支付金额,单位:元")
private String amount;
@ExcelProperty("渠道手续金额,单位:元")
private String channelFeeAmount;
@ExcelProperty("渠道手续费,单位:百分比")
private String channelFeeRate;
@DictFormat(SysDictTypeConstants.PAY_ORDER_STATUS)
@ExcelProperty(value = "支付状态", converter = DictConvert.class)
private Integer status;
@DictFormat(SysDictTypeConstants.PAY_ORDER_NOTIFY_STATUS)
@ExcelProperty(value = "通知商户支付结果的回调状态", converter = DictConvert.class)
private Integer notifyStatus;
@ExcelProperty("异步通知地址")
private String notifyUrl;
@ExcelProperty("创建时间")
private Date createTime;
@ExcelProperty("订单支付成功时间")
private Date successTime;
@ExcelProperty("订单失效时间")
private Date expireTime;
@ExcelProperty("订单支付通知时间")
private Date notifyTime;
@ExcelProperty(value = "渠道编号名称")
private String channelCodeName;
@ExcelProperty("用户 IP")
private String userIp;
@DictFormat(SysDictTypeConstants.PAY_ORDER_REFUND_STATUS)
@ExcelProperty(value = "退款状态", converter = DictConvert.class)
private Integer refundStatus;
@ExcelProperty("退款次数")
private Integer refundTimes;
@ExcelProperty("退款总金额,单位:元")
private String refundAmount;
@ExcelProperty("商品描述")
private String body;
}

View File

@ -0,0 +1,112 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 支付订单 Excel 导出 Request VO
* @author aquan
*/
@ApiModel(value = "支付订单 Excel 导出 Request VO", description = "参数和 PayOrderPageReqVO 是一致的")
@Data
public class PayOrderExportReqVO {
@ApiModelProperty(value = "商户编号")
private Long merchantId;
@ApiModelProperty(value = "应用编号")
private Long appId;
@ApiModelProperty(value = "渠道编号")
private Long channelId;
@ApiModelProperty(value = "渠道编码")
private String channelCode;
@ApiModelProperty(value = "商户订单编号")
private String merchantOrderId;
@ApiModelProperty(value = "商品标题")
private String subject;
@ApiModelProperty(value = "商品描述")
private String body;
@ApiModelProperty(value = "异步通知地址")
private String notifyUrl;
@ApiModelProperty(value = "通知商户支付结果的回调状态")
private Integer notifyStatus;
@ApiModelProperty(value = "支付金额,单位:分")
private Long amount;
@ApiModelProperty(value = "渠道手续费,单位:百分比")
private Double channelFeeRate;
@ApiModelProperty(value = "渠道手续金额,单位:分")
private Long channelFeeAmount;
@ApiModelProperty(value = "支付状态")
private Integer status;
@ApiModelProperty(value = "用户 IP")
private String userIp;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始订单失效时间")
private Date beginExpireTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束订单失效时间")
private Date endExpireTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始订单支付成功时间")
private Date beginSuccessTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束订单支付成功时间")
private Date endSuccessTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始订单支付通知时间")
private Date beginNotifyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束订单支付通知时间")
private Date endNotifyTime;
@ApiModelProperty(value = "支付成功的订单拓展单编号")
private Long successExtensionId;
@ApiModelProperty(value = "退款状态")
private Integer refundStatus;
@ApiModelProperty(value = "退款次数")
private Integer refundTimes;
@ApiModelProperty(value = "退款总金额,单位:分")
private Long refundAmount;
@ApiModelProperty(value = "渠道用户编号")
private String channelUserId;
@ApiModelProperty(value = "渠道订单号")
private String channelOrderNo;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}

View File

@ -0,0 +1,41 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
/**
* 支付订单分页 Request VO
*
* @author aquan
*/
@ApiModel("支付订单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PayOrderPageItemRespVO extends PayOrderBaseVO {
@ApiModelProperty(value = "支付订单编号", required = true)
private Long id;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
@ApiModelProperty(value = "商户名称")
private String merchantName;
@ApiModelProperty(value = "应用名称")
private String appName;
@ApiModelProperty(value = "渠道名称")
private String channelCodeName;
@ApiModelProperty(value = "支付订单号")
private String no;
}

View File

@ -0,0 +1,118 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 支付订单分页 Request VO
*
* @author aquan
*/
@ApiModel("支付订单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PayOrderPageReqVO extends PageParam {
@ApiModelProperty(value = "商户编号")
private Long merchantId;
@ApiModelProperty(value = "应用编号")
private Long appId;
@ApiModelProperty(value = "渠道编号")
private Long channelId;
@ApiModelProperty(value = "渠道编码")
private String channelCode;
@ApiModelProperty(value = "商户订单编号")
private String merchantOrderId;
@ApiModelProperty(value = "商品标题")
private String subject;
@ApiModelProperty(value = "商品描述")
private String body;
@ApiModelProperty(value = "异步通知地址")
private String notifyUrl;
@ApiModelProperty(value = "通知商户支付结果的回调状态")
private Integer notifyStatus;
@ApiModelProperty(value = "支付金额,单位:分")
private Long amount;
@ApiModelProperty(value = "渠道手续费,单位:百分比")
private Double channelFeeRate;
@ApiModelProperty(value = "渠道手续金额,单位:分")
private Long channelFeeAmount;
@ApiModelProperty(value = "支付状态")
private Integer status;
@ApiModelProperty(value = "用户 IP")
private String userIp;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始订单失效时间")
private Date beginExpireTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束订单失效时间")
private Date endExpireTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始订单支付成功时间")
private Date beginSuccessTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束订单支付成功时间")
private Date endSuccessTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始订单支付通知时间")
private Date beginNotifyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束订单支付通知时间")
private Date endNotifyTime;
@ApiModelProperty(value = "支付成功的订单拓展单编号")
private Long successExtensionId;
@ApiModelProperty(value = "退款状态")
private Integer refundStatus;
@ApiModelProperty(value = "退款次数")
private Integer refundTimes;
@ApiModelProperty(value = "退款总金额,单位:分")
private Long refundAmount;
@ApiModelProperty(value = "渠道用户编号")
private String channelUserId;
@ApiModelProperty(value = "渠道订单号")
private String channelOrderNo;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
/**
* 支付订单 Response VO
*
* @author aquan
*/
@ApiModel("支付订单 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PayOrderRespVO extends PayOrderBaseVO {
@ApiModelProperty(value = "支付订单编号", required = true)
private Long id;
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}

View File

@ -0,0 +1,107 @@
package cn.iocoder.yudao.adminserver.modules.pay.convert.order;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.*;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
/**
* 支付订单 Convert
*
* @author aquan
*/
@Mapper
public interface PayOrderConvert {
PayOrderConvert INSTANCE = Mappers.getMapper(PayOrderConvert.class);
PayOrderRespVO convert(PayOrderDO bean);
/**
* 订单DO 转换为 详细订单 RespVO
*
* @param bean 订单DO
* @return 详细订单 RespVO
*/
PayOrderDetailsRespVO orderDetailConvert(PayOrderDO bean);
/**
* 订单扩展DO 转换为 详细订单扩展 RespVO
*
* @param bean 订单扩展DO
* @return 详细订单扩展 RespVO
*/
@Mappings({
@Mapping(target = "channelExtras"
, expression = "java(bean.getChannelExtras() != null ? bean.getChannelExtras().toString():null)")
})
PayOrderDetailsRespVO.PayOrderExtension orderDetailExtensionConvert(PayOrderExtensionDO bean);
List<PayOrderRespVO> convertList(List<PayOrderDO> list);
PageResult<PayOrderRespVO> convertPage(PageResult<PayOrderDO> page);
List<PayOrderExcelVO> convertList02(List<PayOrderDO> list);
/**
* 订单DO转自定义分页对象
*
* @param bean 订单DO
* @return 分页对象
*/
PayOrderPageItemRespVO pageConvertItemPage(PayOrderDO bean);
/**
* 订单DO 订单导出excel VO
*
* @param bean 订单 DO
* @return 订单导出excel VO
*/
default PayOrderExcelVO excelConvert(PayOrderDO bean) {
if (bean == null) {
return null;
}
PayOrderExcelVO payOrderExcelVO = new PayOrderExcelVO();
payOrderExcelVO.setId(bean.getId());
payOrderExcelVO.setSubject(bean.getSubject());
payOrderExcelVO.setMerchantOrderId(bean.getMerchantOrderId());
payOrderExcelVO.setChannelOrderNo(bean.getChannelOrderNo());
payOrderExcelVO.setStatus(bean.getStatus());
payOrderExcelVO.setNotifyStatus(bean.getNotifyStatus());
payOrderExcelVO.setNotifyUrl(bean.getNotifyUrl());
payOrderExcelVO.setCreateTime(bean.getCreateTime());
payOrderExcelVO.setSuccessTime(bean.getSuccessTime());
payOrderExcelVO.setExpireTime(bean.getExpireTime());
payOrderExcelVO.setNotifyTime(bean.getNotifyTime());
payOrderExcelVO.setUserIp(bean.getUserIp());
payOrderExcelVO.setRefundStatus(bean.getRefundStatus());
payOrderExcelVO.setRefundTimes(bean.getRefundTimes());
payOrderExcelVO.setBody(bean.getBody());
BigDecimal multiple = new BigDecimal(100);
payOrderExcelVO.setAmount(BigDecimal.valueOf(bean.getAmount())
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
payOrderExcelVO.setChannelFeeAmount(BigDecimal.valueOf(bean.getChannelFeeAmount())
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
payOrderExcelVO.setChannelFeeRate(java.math.BigDecimal.valueOf(bean.getChannelFeeRate())
.multiply(multiple).toString());
payOrderExcelVO.setRefundAmount(BigDecimal.valueOf(bean.getRefundAmount())
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
return payOrderExcelVO;
}
}

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.Collection;
@ -14,11 +15,18 @@ import java.util.List;
/**
* 支付应用信息 Mapper
*
* @author 芋艿
* @author aquan
*/
@Mapper
public interface PayAppMapper extends BaseMapperX<PayAppDO> {
/**
* 分页查询
*
* @param reqVO 支付应用信息分页查询条件
* @param merchantIds 商户 ID 集合
* @return 支付应用信息
*/
default PageResult<PayAppDO> selectPage(PayAppPageReqVO reqVO, Collection<Long> merchantIds) {
return selectPage(reqVO, new QueryWrapperX<PayAppDO>()
.likeIfPresent("name", reqVO.getName())
@ -31,6 +39,13 @@ public interface PayAppMapper extends BaseMapperX<PayAppDO> {
.orderByDesc("id"));
}
/**
* 列表查询
*
* @param reqVO 支付应用信息 Excel 导出查询条件
* @param merchantIds 商户 ID 集合
* @return 支付应用信息
*/
default List<PayAppDO> selectList(PayAppExportReqVO reqVO, Collection<Long> merchantIds) {
return selectList(new QueryWrapperX<PayAppDO>()
.likeIfPresent("name", reqVO.getName())
@ -43,4 +58,14 @@ public interface PayAppMapper extends BaseMapperX<PayAppDO> {
.orderByDesc("id"));
}
/**
* 根据 商户 ID 查询支付应用信息
* @param merchantId 商户 ID
* @return 支付应用信息列表
*/
default List<PayAppDO> getListByMerchantId(String merchantId){
return selectList(new LambdaQueryWrapper<PayAppDO>()
.select(PayAppDO::getId, PayAppDO::getName)
.eq(PayAppDO::getMerchantId, merchantId));
}
}

View File

@ -6,8 +6,6 @@ import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerch
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -49,6 +47,7 @@ public interface PayMerchantMapper extends BaseMapperX<PayMerchantDO> {
* @return 商户集合
*/
default List<PayMerchantDO> getMerchantListByName(String merchantName) {
return this.selectList(new LambdaQueryWrapper<PayMerchantDO>().like(PayMerchantDO::getName, merchantName));
return this.selectList(new QueryWrapperX<PayMerchantDO>()
.likeIfPresent("name", merchantName));
}
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
/**
* 支付订单 Mapper
*
* @author aquan
*/
@Mapper
public interface PayOrderExtensionMapper extends BaseMapperX<PayOrderExtensionDO> {
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 支付订单
* Mapper
*
* @author 芋艿
*/
@Mapper
public interface PayOrderMapper extends BaseMapperX<PayOrderDO> {
default PageResult<PayOrderDO> selectPage(PayOrderPageReqVO reqVO) {
return selectPage(reqVO, new QueryWrapperX<PayOrderDO>()
.eqIfPresent("merchant_id", reqVO.getMerchantId())
.eqIfPresent("app_id", reqVO.getAppId())
.eqIfPresent("channel_id", reqVO.getChannelId())
.eqIfPresent("channel_code", reqVO.getChannelCode())
.likeIfPresent("merchant_order_id", reqVO.getMerchantOrderId())
.eqIfPresent("notify_status", reqVO.getNotifyStatus())
.eqIfPresent("status", reqVO.getStatus())
.eqIfPresent("refund_status", reqVO.getRefundStatus())
.likeIfPresent("channel_order_no", reqVO.getChannelOrderNo())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc("id"));
}
default List<PayOrderDO> selectList(PayOrderExportReqVO reqVO) {
return selectList(new QueryWrapperX<PayOrderDO>()
.eqIfPresent("merchant_id", reqVO.getMerchantId())
.eqIfPresent("app_id", reqVO.getAppId())
.eqIfPresent("channel_id", reqVO.getChannelId())
.eqIfPresent("channel_code", reqVO.getChannelCode())
.likeIfPresent("merchant_order_id", reqVO.getMerchantOrderId())
.eqIfPresent("notify_status", reqVO.getNotifyStatus())
.eqIfPresent("status", reqVO.getStatus())
.eqIfPresent("refund_status", reqVO.getRefundStatus())
.likeIfPresent("channel_order_no", reqVO.getChannelOrderNo())
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc("id"));
}
}

View File

@ -1,12 +1,17 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.app;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.*;
import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppCreateReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppPageReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.app.vo.PayAppUpdateReqVO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.web.multipart.MultipartFile;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 支付应用信息 Service 接口
@ -77,5 +82,22 @@ public interface PayAppService {
*/
void updateAppStatus(Long id, Integer status);
/**
* 根据商户 ID 获得支付应用信息列表,
*
* @param merchantId 商户 ID
* @return 支付应用信息列表
*/
List<PayAppDO> getListByMerchantId(String merchantId);
/**
* 获得指定编号的商户 Map
*
* @param appIdList 应用编号集合
* @return 商户 Map
*/
default Map<Long, PayAppDO> getAppMap(Collection<Long> appIdList) {
List<PayAppDO> list = this.getAppList(appIdList);
return CollectionUtils.convertMap(list, PayAppDO::getId);
}
}

View File

@ -10,7 +10,6 @@ import cn.iocoder.yudao.adminserver.modules.pay.convert.app.PayAppConvert;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.app.PayAppMapper;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.merchant.PayMerchantMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.app.PayAppService;
import cn.iocoder.yudao.adminserver.modules.pay.service.merchant.PayMerchantService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayMerchantDO;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
@ -22,7 +21,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.*;
import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.*;
import static cn.iocoder.yudao.coreservice.modules.pay.enums.PayErrorCodeCoreConstants.PAY_APP_NOT_FOUND;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@ -134,6 +133,16 @@ public class PayAppServiceImpl implements PayAppService {
appMapper.updateById(app);
}
/**
* 根据商户 ID 获得支付应用信息列表,
*
* @param merchantId 商户 ID
* @return 支付应用信息列表
*/
@Override
public List<PayAppDO> getListByMerchantId(String merchantId) {
return appMapper.getListByMerchantId(merchantId);
}
/**
* 检查商户是否存在

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 支付订单 Service 接口
*
* @author aquan
*/
public interface PayOrderExtensionService {
/**
* 获得支付订单
*
* @param id 编号
* @return 支付订单
*/
PayOrderExtensionDO getOrderExtension(Long id);
/**
* 获得支付订单
* 列表
*
* @param ids 编号
* @return 支付订单
* 列表
*/
List<PayOrderExtensionDO> getOrderExtensionList(Collection<Long> ids);
/**
* 根据订单成功的 扩展订单ID 查询所有的扩展订单转 map 返回
*
* @param successExtensionIdList 订单 ID 集合
* @return 订单扩展 map 集合
*/
default Map<Long, PayOrderExtensionDO> getOrderExtensionMap(Collection<Long> successExtensionIdList) {
List<PayOrderExtensionDO> list = this.getOrderExtensionList(successExtensionIdList);
return CollectionUtils.convertMap(list, PayOrderExtensionDO::getId);
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.util.Collection;
import java.util.List;
/**
* 支付订单
* Service 接口
*
* @author aquan
*/
public interface PayOrderService {
/**
* 获得支付订单
*
* @param id 编号
* @return 支付订单
*/
PayOrderDO getOrder(Long id);
/**
* 获得支付订单
* 列表
*
* @param ids 编号
* @return 支付订单
* 列表
*/
List<PayOrderDO> getOrderList(Collection<Long> ids);
/**
* 获得支付订单
* 分页
*
* @param pageReqVO 分页查询
* @return 支付订单
* 分页
*/
PageResult<PayOrderDO> getOrderPage(PayOrderPageReqVO pageReqVO);
/**
* 获得支付订单
* 列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 支付订单
* 列表
*/
List<PayOrderDO> getOrderList(PayOrderExportReqVO exportReqVO);
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderExtensionMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderExtensionService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderExtensionDO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
/**
* 支付订单 Service 实现类
*
* @author aquan
*/
@Service
@Validated
public class PayOrderExtensionServiceImpl implements PayOrderExtensionService {
@Resource
private PayOrderExtensionMapper orderExtensionMapper;
@Override
public PayOrderExtensionDO getOrderExtension(Long id) {
return orderExtensionMapper.selectById(id);
}
@Override
public List<PayOrderExtensionDO> getOrderExtensionList(Collection<Long> ids) {
return orderExtensionMapper.selectBatchIds(ids);
}
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order.impl;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.PayOrderService;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
/**
* 支付订单 Service 实现类
*
* @author aquan
*/
@Service
@Validated
public class PayOrderServiceImpl implements PayOrderService {
@Resource
private PayOrderMapper orderMapper;
@Override
public PayOrderDO getOrder(Long id) {
return orderMapper.selectById(id);
}
@Override
public List<PayOrderDO> getOrderList(Collection<Long> ids) {
return orderMapper.selectBatchIds(ids);
}
@Override
public PageResult<PayOrderDO> getOrderPage(PayOrderPageReqVO pageReqVO) {
return orderMapper.selectPage(pageReqVO);
}
@Override
public List<PayOrderDO> getOrderList(PayOrderExportReqVO exportReqVO) {
return orderMapper.selectList(exportReqVO);
}
}

View File

@ -22,4 +22,19 @@ public interface SysDictTypeConstants {
String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态
String SMS_RECEIVE_STATUS = "sys_sms_receive_status"; // 短信接收状态
/**
* 支付-订单-订单状态
*/
String PAY_ORDER_STATUS = "pay_order_status";
/**
* 支付-订单-订单回调商户状态
*/
String PAY_ORDER_NOTIFY_STATUS = "pay_order_notify_status";
/**
* 支付-订单-订单退款状态
*/
String PAY_ORDER_REFUND_STATUS = "pay_order_refund_status";
}

View File

@ -0,0 +1,196 @@
package cn.iocoder.yudao.adminserver.modules.pay.service.order;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.adminserver.BaseDbUnitTest;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderExportReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.PayOrderPageReqVO;
import cn.iocoder.yudao.adminserver.modules.pay.dal.mysql.order.PayOrderMapper;
import cn.iocoder.yudao.adminserver.modules.pay.service.order.impl.PayOrderServiceImpl;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderNotifyStatusEnum;
import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayOrderStatusEnum;
import cn.iocoder.yudao.coreservice.modules.pay.enums.order.PayRefundTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* {@link PayOrderServiceImpl} 的单元测试类
*
* @author 芋艿
*/
@Import(PayOrderServiceImpl.class)
public class PayOrderServiceTest extends BaseDbUnitTest {
@Resource
private PayOrderServiceImpl orderService;
@Resource
private PayOrderMapper orderMapper;
public String generateNo() {
return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999);
}
@Test // TODO 请修改 null 为需要的值
public void testGetOrderPage() {
String merchantOrderId = generateNo();
String channelOrderId = generateNo();
// mock 数据
PayOrderDO dbOrder = randomPojo(PayOrderDO.class, o -> { // 等会查询到
o.setMerchantId(1L);
o.setAppId(1L);
o.setChannelId(1L);
o.setChannelCode(PayChannelEnum.WX_PUB.getCode());
o.setMerchantOrderId(merchantOrderId);
o.setSubject("灿灿子的炸弹猫");
o.setBody("斌斌子送给灿灿子的炸弹猫");
o.setNotifyUrl("https://hc.com/lbh");
o.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
o.setAmount(10000L);
o.setChannelFeeRate(0.01);
o.setChannelFeeAmount(1L);
o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
o.setUserIp("127.0.0.1");
o.setCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
o.setExpireTime(DateUtils.buildTime(2018, 1, 1, 10, 30, 0));
o.setSuccessTime(DateUtils.buildTime(2018, 1, 1, 10, 10, 2));
o.setNotifyTime(DateUtils.buildTime(2018, 1, 1, 10, 10, 15));
o.setSuccessExtensionId(1L);
o.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
o.setRefundTimes(0);
o.setRefundAmount(0L);
o.setChannelUserId("1008611");
o.setChannelOrderNo(channelOrderId);
o.setUpdateTime(DateUtils.buildTime(2018, 1, 1, 10, 10, 15));
});
orderMapper.insert(dbOrder);
// 测试 merchantId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setMerchantId(2L)));
// 测试 appId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setAppId(2L)));
// 测试 channelId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setChannelId(2L)));
// 测试 channelCode 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode())));
// 测试 merchantOrderId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setMerchantOrderId(generateNo())));
// 测试 notifyStatus 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus())));
// 测试 status 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus())));
// 测试 refundStatus 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setRefundStatus(PayRefundTypeEnum.ALL.getStatus())));
// 测试 createTime 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setCreateTime(DateUtils.buildTime(2019, 1, 1, 10, 10,
1))));
// 准备参数
PayOrderPageReqVO reqVO = new PayOrderPageReqVO();
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setChannelId(1L);
reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode());
reqVO.setMerchantOrderId(merchantOrderId);
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
reqVO.setBeginCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
reqVO.setEndCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
// 调用
PageResult<PayOrderDO> pageResult = orderService.getOrderPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbOrder, pageResult.getList().get(0));
// assertEquals(0, dbOrder.getUpdateTime().compareTo(pageResult.getList().get(0).getUpdateTime()));
}
@Test // TODO 请修改 null 为需要的值
public void testGetOrderList() {
// mock 数据
String merchantOrderId = generateNo();
String channelOrderId = generateNo();
PayOrderDO dbOrder = randomPojo(PayOrderDO.class, o -> { // 等会查询到
o.setMerchantId(1L);
o.setAppId(1L);
o.setChannelId(1L);
o.setChannelCode(PayChannelEnum.WX_PUB.getCode());
o.setMerchantOrderId(merchantOrderId);
o.setSubject("灿灿子的炸弹猫");
o.setBody("斌斌子送给灿灿子的炸弹猫");
o.setNotifyUrl("https://hc.com/lbh");
o.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
o.setAmount(10000L);
o.setChannelFeeRate(0.01);
o.setChannelFeeAmount(1L);
o.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
o.setUserIp("127.0.0.1");
o.setCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
o.setExpireTime(DateUtils.buildTime(2018, 1, 1, 10, 30, 0));
o.setSuccessTime(DateUtils.buildTime(2018, 1, 1, 10, 10, 2));
o.setNotifyTime(DateUtils.buildTime(2018, 1, 1, 10, 10, 15));
o.setSuccessExtensionId(1L);
o.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
o.setRefundTimes(0);
o.setRefundAmount(0L);
o.setChannelUserId("1008611");
o.setChannelOrderNo(channelOrderId);
o.setUpdateTime(DateUtils.buildTime(2018, 1, 1, 10, 10, 15));
});
orderMapper.insert(dbOrder);
// 测试 merchantId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setMerchantId(2L)));
// 测试 appId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setAppId(2L)));
// 测试 channelId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setChannelId(2L)));
// 测试 channelCode 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setChannelCode(PayChannelEnum.ALIPAY_APP.getCode())));
// 测试 merchantOrderId 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setMerchantOrderId(generateNo())));
// 测试 notifyStatus 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setNotifyStatus(PayOrderNotifyStatusEnum.FAILURE.getStatus())));
// 测试 status 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setStatus(PayOrderStatusEnum.CLOSED.getStatus())));
// 测试 refundStatus 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setRefundStatus(PayRefundTypeEnum.ALL.getStatus())));
// 测试 createTime 不匹配
orderMapper.insert(ObjectUtils.clone(dbOrder, o -> o.setCreateTime(DateUtils.buildTime(2019, 1, 1, 10, 10,
1))));
// 准备参数
PayOrderExportReqVO reqVO = new PayOrderExportReqVO();
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setChannelId(1L);
reqVO.setChannelCode(PayChannelEnum.WX_PUB.getCode());
reqVO.setMerchantOrderId(merchantOrderId);
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
reqVO.setBeginCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
reqVO.setEndCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
// 调用
List<PayOrderDO> list = orderService.getOrderList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbOrder, list.get(0));
}
}

View File

@ -28,4 +28,5 @@ DELETE FROM "sys_social_user";
-- pay 开头的 DB
DELETE FROM pay_merchant;
DELETE FROM pay_app;
DELETE FROM pay_channel
DELETE FROM pay_channel;
delete from pay_order;

View File

@ -1,6 +1,7 @@
-- inf 开头的 DB
CREATE TABLE IF NOT EXISTS "inf_config" (
CREATE TABLE IF NOT EXISTS "inf_config"
(
"id" int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"group" varchar(50) NOT NULL,
"type" tinyint NOT NULL,
@ -17,7 +18,8 @@ CREATE TABLE IF NOT EXISTS "inf_config" (
PRIMARY KEY ("id")
) COMMENT '参数配置表';
CREATE TABLE IF NOT EXISTS "inf_file" (
CREATE TABLE IF NOT EXISTS "inf_file"
(
"id" varchar(188) NOT NULL,
"type" varchar(63) DEFAULT NULL,
"content" blob NOT NULL,
@ -29,7 +31,8 @@ CREATE TABLE IF NOT EXISTS "inf_file" (
PRIMARY KEY ("id")
) COMMENT '文件表';
CREATE TABLE IF NOT EXISTS "inf_job" (
CREATE TABLE IF NOT EXISTS "inf_job"
(
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号',
"name" varchar(32) NOT NULL COMMENT '任务名称',
"status" tinyint(4) NOT NULL COMMENT '任务状态',
@ -45,9 +48,10 @@ CREATE TABLE IF NOT EXISTS "inf_job" (
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
"deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除',
PRIMARY KEY ("id")
) COMMENT='定时任务表';
) COMMENT ='定时任务表';
CREATE TABLE IF NOT EXISTS "inf_job_log" (
CREATE TABLE IF NOT EXISTS "inf_job_log"
(
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号',
"job_id" bigint(20) NOT NULL COMMENT '任务编号',
"handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
@ -64,11 +68,12 @@ CREATE TABLE IF NOT EXISTS "inf_job_log" (
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
"deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除',
PRIMARY KEY ("id")
)COMMENT='定时任务日志表';
) COMMENT ='定时任务日志表';
-- sys 开头的 DB
CREATE TABLE IF NOT EXISTS "sys_dept" (
CREATE TABLE IF NOT EXISTS "sys_dept"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar(30) NOT NULL DEFAULT '',
"parent_id" bigint NOT NULL DEFAULT '0',
@ -85,7 +90,8 @@ CREATE TABLE IF NOT EXISTS "sys_dept" (
PRIMARY KEY ("id")
) COMMENT '部门表';
CREATE TABLE IF NOT EXISTS "sys_dict_data" (
CREATE TABLE IF NOT EXISTS "sys_dict_data"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"sort" int NOT NULL DEFAULT '0',
"label" varchar(100) NOT NULL DEFAULT '',
@ -101,7 +107,8 @@ CREATE TABLE IF NOT EXISTS "sys_dict_data" (
PRIMARY KEY ("id")
) COMMENT '字典数据表';
CREATE TABLE IF NOT EXISTS "sys_role" (
CREATE TABLE IF NOT EXISTS "sys_role"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar(30) NOT NULL,
"code" varchar(100) NOT NULL,
@ -119,7 +126,8 @@ CREATE TABLE IF NOT EXISTS "sys_role" (
PRIMARY KEY ("id")
) COMMENT '角色信息表';
CREATE TABLE IF NOT EXISTS "sys_role_menu" (
CREATE TABLE IF NOT EXISTS "sys_role_menu"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"role_id" bigint NOT NULL,
"menu_id" bigint NOT NULL,
@ -131,7 +139,8 @@ CREATE TABLE IF NOT EXISTS "sys_role_menu" (
PRIMARY KEY ("id")
) COMMENT '角色和菜单关联表';
CREATE TABLE IF NOT EXISTS "sys_menu" (
CREATE TABLE IF NOT EXISTS "sys_menu"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar(50) NOT NULL,
"permission" varchar(100) NOT NULL DEFAULT '',
@ -150,7 +159,8 @@ CREATE TABLE IF NOT EXISTS "sys_menu" (
PRIMARY KEY ("id")
) COMMENT '菜单权限表';
CREATE TABLE IF NOT EXISTS "sys_user_role" (
CREATE TABLE IF NOT EXISTS "sys_user_role"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"user_id" bigint NOT NULL,
"role_id" bigint NOT NULL,
@ -162,7 +172,8 @@ CREATE TABLE IF NOT EXISTS "sys_user_role" (
PRIMARY KEY ("id")
) COMMENT '用户和角色关联表';
CREATE TABLE IF NOT EXISTS "sys_dict_type" (
CREATE TABLE IF NOT EXISTS "sys_dict_type"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar(100) NOT NULL DEFAULT '',
"type" varchar(100) NOT NULL DEFAULT '',
@ -176,7 +187,8 @@ CREATE TABLE IF NOT EXISTS "sys_dict_type" (
PRIMARY KEY ("id")
) COMMENT '字典类型表';
CREATE TABLE IF NOT EXISTS `sys_user_session` (
CREATE TABLE IF NOT EXISTS `sys_user_session`
(
`id` varchar(32) NOT NULL,
`user_id` bigint DEFAULT NULL,
"user_type" tinyint NOT NULL,
@ -186,13 +198,14 @@ CREATE TABLE IF NOT EXISTS `sys_user_session` (
`session_timeout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"creator" varchar(64) DEFAULT '',
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updater` varchar(64) DEFAULT '' ,
`updater` varchar(64) DEFAULT '',
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY (`id`)
) COMMENT '用户在线 Session';
CREATE TABLE IF NOT EXISTS "sys_post" (
CREATE TABLE IF NOT EXISTS "sys_post"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"code" varchar(64) NOT NULL,
"name" varchar(50) NOT NULL,
@ -207,7 +220,8 @@ CREATE TABLE IF NOT EXISTS "sys_post" (
PRIMARY KEY ("id")
) COMMENT '岗位信息表';
CREATE TABLE IF NOT EXISTS "sys_notice" (
CREATE TABLE IF NOT EXISTS "sys_notice"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"title" varchar(50) NOT NULL COMMENT '公告标题',
"content" text NOT NULL COMMENT '公告内容',
@ -218,10 +232,11 @@ CREATE TABLE IF NOT EXISTS "sys_notice" (
"updater" varchar(64) DEFAULT '' COMMENT '更新者',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
"deleted" bit NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY("id")
PRIMARY KEY ("id")
) COMMENT '通知公告表';
CREATE TABLE IF NOT EXISTS `sys_login_log` (
CREATE TABLE IF NOT EXISTS `sys_login_log`
(
`id` bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
`log_type` bigint(4) NOT NULL,
"user_id" bigint not null default '0',
@ -239,7 +254,8 @@ CREATE TABLE IF NOT EXISTS `sys_login_log` (
PRIMARY KEY (`id`)
) COMMENT ='系统访问记录';
CREATE TABLE IF NOT EXISTS `sys_operate_log` (
CREATE TABLE IF NOT EXISTS `sys_operate_log`
(
`id` bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
`trace_id` varchar(64) NOT NULL DEFAULT '',
`user_id` bigint(20) NOT NULL,
@ -267,7 +283,8 @@ CREATE TABLE IF NOT EXISTS `sys_operate_log` (
PRIMARY KEY (`id`)
) COMMENT ='操作日志记录';
CREATE TABLE IF NOT EXISTS "sys_user" (
CREATE TABLE IF NOT EXISTS "sys_user"
(
"id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
"username" varchar(30) not null,
"password" varchar(100) not null default '',
@ -290,7 +307,8 @@ CREATE TABLE IF NOT EXISTS "sys_user" (
primary key ("id")
) comment '用户信息表';
CREATE TABLE IF NOT EXISTS "inf_api_access_log" (
CREATE TABLE IF NOT EXISTS "inf_api_access_log"
(
"id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
"trace_id" varchar(64) not null default '',
"user_id" bigint not null default '0',
@ -314,7 +332,8 @@ CREATE TABLE IF NOT EXISTS "inf_api_access_log" (
primary key ("id")
) COMMENT 'API 访问日志表';
CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
CREATE TABLE IF NOT EXISTS "inf_api_error_log"
(
"id" integer not null GENERATED BY DEFAULT AS IDENTITY,
"trace_id" varchar(64) not null,
"user_id" bigint not null default '0',
@ -345,7 +364,8 @@ CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
primary key ("id")
) COMMENT '系统异常日志';
CREATE TABLE IF NOT EXISTS "sys_sms_channel" (
CREATE TABLE IF NOT EXISTS "sys_sms_channel"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"signature" varchar(10) NOT NULL,
"code" varchar(63) NOT NULL,
@ -362,7 +382,8 @@ CREATE TABLE IF NOT EXISTS "sys_sms_channel" (
PRIMARY KEY ("id")
) COMMENT '短信渠道';
CREATE TABLE IF NOT EXISTS "sys_sms_template" (
CREATE TABLE IF NOT EXISTS "sys_sms_template"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"type" tinyint NOT NULL,
"status" tinyint NOT NULL,
@ -382,7 +403,8 @@ CREATE TABLE IF NOT EXISTS "sys_sms_template" (
PRIMARY KEY ("id")
) COMMENT '短信模板';
CREATE TABLE IF NOT EXISTS "sys_sms_log" (
CREATE TABLE IF NOT EXISTS "sys_sms_log"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"channel_id" bigint NOT NULL,
"channel_code" varchar(63) NOT NULL,
@ -415,7 +437,8 @@ CREATE TABLE IF NOT EXISTS "sys_sms_log" (
PRIMARY KEY ("id")
) COMMENT '短信日志';
CREATE TABLE IF NOT EXISTS "sys_error_code" (
CREATE TABLE IF NOT EXISTS "sys_error_code"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"type" tinyint NOT NULL DEFAULT '0',
"application_name" varchar(50) NOT NULL,
@ -430,7 +453,8 @@ CREATE TABLE IF NOT EXISTS "sys_error_code" (
PRIMARY KEY ("id")
) COMMENT '错误码表';
CREATE TABLE IF NOT EXISTS "sys_social_user" (
CREATE TABLE IF NOT EXISTS "sys_social_user"
(
"id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"user_id" bigint NOT NULL,
"user_type" tinyint NOT NULL DEFAULT '0',
@ -450,7 +474,8 @@ CREATE TABLE IF NOT EXISTS "sys_social_user" (
PRIMARY KEY ("id")
) COMMENT '社交用户';
CREATE TABLE IF NOT EXISTS "pay_merchant" (
CREATE TABLE IF NOT EXISTS "pay_merchant"
(
"id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"no" varchar(32) NOT NULL,
"name" varchar(64) NOT NULL,
@ -458,43 +483,82 @@ CREATE TABLE IF NOT EXISTS "pay_merchant" (
"status" tinyint NOT NULL,
"remark" varchar(255) DEFAULT NULL,
"creator" varchar(64) DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit(1) NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '支付商户信息';
CREATE TABLE IF NOT EXISTS "pay_app" (
CREATE TABLE IF NOT EXISTS "pay_app"
(
"id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar(64) NOT NULL,
"status" tinyint NOT NULL,
"remark" varchar(255) DEFAULT NULL,
`pay_notify_url` varchar(1024) NOT NULL,
`refund_notify_url`varchar(1024) NOT NULL,
`merchant_id`bigint(20) NOT NULL,
`refund_notify_url` varchar(1024) NOT NULL,
`merchant_id` bigint(20) NOT NULL,
"creator" varchar(64) DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit(1) NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT = '支付应用信息';
CREATE TABLE "pay_channel" (
CREATE TABLE "pay_channel"
(
"id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"code" varchar(32) NOT NULL ,
"status" tinyint(4) NOT NULL ,
"remark" varchar(255) DEFAULT NULL ,
"fee_rate" double NOT NULL DEFAULT 0 ,
"merchant_id" bigint(20) NOT NULL ,
"app_id" bigint(20) NOT NULL ,
"config" varchar(10240) NOT NULL ,
"creator" varchar(64) NULL DEFAULT '' ,
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
"updater" varchar(64) NULL DEFAULT '' ,
"code" varchar(32) NOT NULL,
"status" tinyint(4) NOT NULL,
"remark" varchar(255) DEFAULT NULL,
"fee_rate" double NOT NULL DEFAULT 0,
"merchant_id" bigint(20) NOT NULL,
"app_id" bigint(20) NOT NULL,
"config" varchar(10240) NOT NULL,
"creator" varchar(64) NULL DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) NULL DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit(1) NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT = '支付渠道';
CREATE TABLE `pay_order`
(
"id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
`merchant_id` bigint(20) NOT NULL,
`app_id` bigint(20) NOT NULL,
`channel_id` bigint(20) DEFAULT NULL,
`channel_code` varchar(32) DEFAULT NULL,
`merchant_order_id` varchar(64) NOT NULL,
`subject` varchar(32) NOT NULL,
`body` varchar(128) NOT NULL,
`notify_url` varchar(1024) NOT NULL,
`notify_status` tinyint(4) NOT NULL,
`amount` bigint(20) NOT NULL,
`channel_fee_rate` double DEFAULT 0,
`channel_fee_amount` bigint(20) DEFAULT 0,
`status` tinyint(4) NOT NULL,
`user_ip` varchar(50) NOT NULL,
`expire_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`success_time` datetime(0) DEFAULT CURRENT_TIMESTAMP,
`notify_time` datetime(0) DEFAULT CURRENT_TIMESTAMP,
`success_extension_id` bigint(20) DEFAULT NULL COMMENT '支付成功的订单拓展单编号',
`refund_status` tinyint(4) NOT NULL,
`refund_times` tinyint(4) NOT NULL,
`refund_amount` bigint(20) NOT NULL,
`channel_user_id` varchar(255) DEFAULT NULL,
`channel_order_no` varchar(64) DEFAULT NULL,
`creator` varchar(64) DEFAULT '',
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updater` varchar(64) DEFAULT '' ,
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT = '支付订单';

View File

@ -42,7 +42,7 @@
"clipboard": "2.0.6",
"core-js": "3.8.1",
"echarts": "4.9.0",
"element-ui": "2.15.0",
"element-ui": "^2.15.6",
"file-saver": "2.0.4",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",

View File

@ -65,3 +65,14 @@ export function exportAppExcel(query) {
responseType: 'blob'
})
}
// 根据商ID称搜索应用列表
export function getAppListByMerchantId(merchantId) {
return request({
url: '/pay/app/list-merchant-id',
params:{
merchantId:merchantId
},
method: 'get'
})
}

View File

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 创建支付订单
export function createOrder(data) {
return request({
url: '/pay/order/create',
method: 'post',
data: data
})
}
// 更新支付订单
export function updateOrder(data) {
return request({
url: '/pay/order/update',
method: 'put',
data: data
})
}
// 删除支付订单
export function deleteOrder(id) {
return request({
url: '/pay/order/delete?id=' + id,
method: 'delete'
})
}
// 获得支付订单
export function getOrder(id) {
return request({
url: '/pay/order/get?id=' + id,
method: 'get'
})
}
// 获得支付订单分页
export function getOrderPage(query) {
return request({
url: '/pay/order/page',
method: 'get',
params: query
})
}
// 导出支付订单 Excel
export function exportOrderExcel(query) {
return request({
url: '/pay/order/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1638429990011" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1233" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css">@font-face { font-family: element-icons; src: url("chrome-extension://moombeodfomdpjnpocobemoiaemednkg/fonts/element-icons.woff") format("woff"), url("chrome-extension://moombeodfomdpjnpocobemoiaemednkg/fonts/element-icons.ttf ") format("truetype"); }
</style></defs><path d="M459.954135 607.201246l233.733369 0c14.352893 0 25.941835-11.088546 25.941835-24.798802 0-13.623275-11.587919-24.710798-25.941835-24.710798l-233.733369 0c-14.352893 0-25.986861 11.087523-25.986861 24.710798C433.967274 596.1127 445.601242 607.201246 459.954135 607.201246zM382.017088 824.38673l287.564391-0.272199 0-0.633427c9.370415-1.494027 16.660448-9.233292 16.660448-19.053961 0-9.773598-7.290033-17.693987-16.660448-19.23304l0-0.633427L369.500007 784.560676c-27.275203 0-51.949162-38.46915-51.949162-65.214281l0-415.585113c0.181125-1.041726 0.633427-1.992377 0.633427-3.123131 0-10.997472-8.985652-20.00359-20.032242-20.00359-11.023054 0-20.010753 9.007141-20.010753 20.00359l0 418.708244C278.1423 773.383102 327.080895 824.38673 382.017088 824.38673zM693.687504 89.925079c-3.235694 0-311.669392-0.814552-311.669392-0.814552-51.2922 0-96.314603 39.10053-102.108562 88.294952-0.181125 1.085728-0.656963 2.036379-0.656963 3.168156 0 0.091074 0.023536 0.135076 0.023536 0.181125 0 0.046049-0.023536 0.090051-0.023536 0.181125l0.067538 0c0.181125 10.860349 9.031701 19.685341 19.942191 19.685341 10.933003 0 19.762089-8.824993 19.964704-19.685341l0.226151 0c6.043646-24.664749 27.027563-52.04433 50.04786-52.04433l284.755416 0c-0.406253 60.461023 0 118.435413 0 118.435413 0 54.531987 35.991726 91.642187 91.358731 91.642187 0 0 40.133046 0 90.428545 0l0 380.37724c0.338714 44.261063-33.70259 65.757656-62.180178 65.214281l0 0.272199c-10.229992 0.723477-18.425651 9.188266-18.425651 19.594267 0 10.454096 8.195659 18.736736 18.425651 19.417235l0 0.271176c0.248663 0 0.49835-0.091074 0.74599-0.091074 0.184195 0 0.340761 0.091074 0.522909 0.091074 0.971118 0 1.811252-0.407276 2.739391-0.544399 52.287877-3.755534 97.580432-52.314483 97.580432-104.22476L875.452267 299.777551 693.687504 89.925079zM745.615177 299.777551c-27.684526 0-51.927673-51.411927-51.927673-78.69941 0 0 0-27.606755 0-78.656431l0-0.045025 129.839137 157.400866L745.615177 299.777551zM459.954135 483.471246l233.733369 0c14.352893 0 25.941835-11.041474 25.941835-24.708751 0-13.667278-11.587919-24.7548-25.941835-24.7548l-233.733369 0c-14.352893 0-25.986861 11.087523-25.986861 24.7548C433.967274 472.430796 445.601242 483.471246 459.954135 483.471246zM716.709847 841.356216c-8.53335 0-15.32708 6.246261-17.113773 14.256702l-0.475837-0.045025c-21.73093 44.171012-40.426735 34.032094-62.294788 34.032094L252.179998 889.599987c-27.27725 0-64.466244-38.512129-64.466244-65.213257L187.713754 322.314847c0-24.800849 29.857005-58.606793 55.954383-63.403029l0-0.543376c10.571776-0.543376 19.082614-9.142218 19.082614-19.86749 0-10.68127-8.510838-19.279089-19.082614-19.777439l0-0.226151c-0.181125 0.044002-0.339738 0.091074-0.51984 0.091074-0.158612 0-0.272199-0.091074-0.429789-0.091074-1.245364 0-2.353604 0.497327-3.553942 0.724501-50.703799 5.203512-90.860381 52.134381-90.860381 103.092983l0 502.07086c0 54.034661 48.938596 105.038288 103.875812 105.038288l389.558343 0c47.104831 0 78.254272-17.198707 90.542132-61.683874 1.358951-2.533706 2.330068-5.250584 2.330068-8.326643C734.611565 849.546759 726.601124 841.356216 716.709847 841.356216z" p-id="1234"></path></svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -91,6 +91,9 @@ export const SysUserSocialTypeEnum = {
}
}
/**
* 支付渠道枚举
*/
export const PayChannelEnum = {
WX_PUB: {
"code": "wx_pub",
@ -122,7 +125,65 @@ export const PayChannelEnum = {
},
}
/**
* 支付类型枚举
*/
export const PayType = {
WECHAT: "WECHAT",
ALIPAY: "ALIPAY"
}
/**
* 支付订单状态枚举
*/
export const payOrderStatusEnum = {
WAITING: {
status: 0,
name: '未支付'
},
SUCCESS: {
status: 10,
name: '已支付'
},
CLOSED: {
status: 20,
name: '未支付'
}
}
/**
* 支付订单回调状态枚举
*/
export const payOrderNotifyStatusEnum = {
NO: {
status: 0,
name: '未通知'
},
SUCCESS: {
status: 10,
name: '通知成功'
},
FAILURE: {
status: 20,
name: '通知失败'
}
}
/**
* 支付订单退款状态枚举
*/
export const payOrderRefundStatusEnum = {
NO: {
status: 0,
name: '未退款'
},
SOME: {
status: 10,
name: '部分退款'
},
ALL: {
status: 20,
name: '全部退款'
}
}

View File

@ -45,6 +45,14 @@ export const DICT_TYPE = {
PAY_CHANNEL_ALIPAY_MODE:'pay_channel_alipay_mode',
// 支付宝网关地址
PAY_CHANNEL_ALIPAY_SERVER_TYPE:'pay_channel_alipay_server_type',
// 支付渠道编码类型
PAY_CHANNEL_CODE_TYPE: 'pay_channel_code_type',
// 商户支付订单回调状态
PAY_ORDER_NOTIFY_STATUS: 'pay_order_notify_status',
// 商户支付订单状态
PAY_ORDER_STATUS: 'pay_order_status',
// 商户支付订单退款状态
PAY_ORDER_REFUND_STATUS: 'pay_order_refund_status',
}
/**

View File

@ -37,7 +37,9 @@ export function parseTime(time, pattern) {
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
@ -58,7 +60,7 @@ export function addDateRange(params, dateRange, propName) {
const search = params;
search.params = {};
if (null != dateRange && '' !== dateRange) {
if (typeof(propName) === "undefined") {
if (typeof (propName) === "undefined") {
search["beginTime"] = dateRange[0];
search["endTime"] = dateRange[1];
} else {
@ -98,7 +100,7 @@ export function addBeginAndEndTime(params, dateRange, propName) {
return params;
}
// 回显数据字典
// 回显数据字典 原若依所保留,请使用 dict.js 中的新方法
export function selectDictLabel(datas, value) {
var actions = [];
Object.keys(datas).some((key) => {
@ -188,7 +190,9 @@ export function handleTree(data, id, parentId, children, rootId) {
id = id || 'id'
parentId = parentId || 'parentId'
children = children || 'children'
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0
rootId = rootId || Math.min.apply(Math, data.map(item => {
return item[parentId]
})) || 0
//对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data))
//循环所有项
@ -203,3 +207,22 @@ export function handleTree(data, id, parentId, children, rootId) {
});
return treeData !== '' ? treeData : data;
}
/**
* 获取当前时间
* @param timeStr 时分秒 字符串 格式为 xx:xx:xx
*/
export function getNowDateTime(timeStr) {
let now = new Date();
let year = now.getFullYear(); //得到年份
let month = (now.getMonth() + 1).toString().padStart(2, "0"); //得到月份
let day = now.getDate().toString().padStart(2, "0"); //得到日期
if (timeStr != null) {
return `${year}-${month}-${day} ${timeStr}`;
}
let hours = now.getHours().toString().padStart(2, "0") // 得到小时;
let minutes = now.getMinutes().toString().padStart(2, "0") // 得到分钟;
let seconds = now.getSeconds().toString().padStart(2, "0") // 得到秒;
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

View File

@ -195,7 +195,6 @@
:value="item.id">
</el-option>
</el-select>
<!-- <el-input v-model="form.merchantId" placeholder="请输入商户编号"/>-->
</el-form-item>
<el-form-item label="开启状态" prop="status">
<el-radio-group v-model="form.status">
@ -221,7 +220,6 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<wechat-channel-form :transferParam="channelParam"></wechat-channel-form>
<ali-pay-channel-form :transferParam="channelParam"></ali-pay-channel-form>
</div>
@ -312,6 +310,7 @@ export default {
},
created() {
this.getList();
this.handleGetMerchantListByName(null);
},
methods: {
/** 查询列表 */

View File

@ -170,6 +170,7 @@ export default {
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getMerchantPage(params).then(response => {
console.log(response.data);
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;

View File

@ -0,0 +1,518 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="所属商户" prop="merchantId">
<el-select
v-model="queryParams.merchantId"
clearable
@clear="()=>{queryParams.merchantId = null}"
filterable
remote
reserve-keyword
placeholder="请选择所属商户"
@change="handleGetAppListByMerchantId"
:remote-method="handleGetMerchantListByName"
:loading="merchantLoading">
<el-option
v-for="item in merchantList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="应用编号" prop="appId">
<el-select
clearable
v-model="queryParams.appId"
filterable
placeholder="请选择应用信息">
<el-option
v-for="item in appList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="渠道编码" prop="channelCode">
<el-select v-model="queryParams.channelCode" placeholder="请输入渠道编码" clearable
size="small" @clear="()=>{queryParams.channelCode = null}">
<el-option v-for="dict in payChannelCodeDictDatum" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="商户订单编号" prop="merchantOrderId">
<el-input v-model="queryParams.merchantOrderId" placeholder="请输入商户订单编号" clearable size="small"
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="渠道订单号" prop="channelOrderNo">
<el-input v-model="queryParams.channelOrderNo" placeholder="请输入渠道订单号" clearable size="small"
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="支付状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择支付状态" clearable size="small">
<el-option v-for="dict in payOrderDictDatum" :key="parseInt(dict.value)"
:label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="退款状态" prop="refundStatus">
<el-select v-model="queryParams.refundStatus" placeholder="请选择退款状态" clearable size="small">
<el-option v-for="dict in payOrderRefundDictDatum" :key="parseInt(dict.value)"
:label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="回调商户状态" prop="notifyStatus">
<el-select v-model="queryParams.notifyStatus" placeholder="请选择订单回调商户状态" clearable size="small">
<el-option v-for="dict in payOrderNotifyDictDatum" :key="parseInt(dict.value)"
:label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRangeCreateTime" size="small" style="width: 350px"
value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="-"
:default-time="['00:00:00','23:59:59']" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['pay:order:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="订单编号" align="center" prop="id" width="80"/>
<el-table-column label="商户名称" align="center" prop="merchantName" width="120"/>
<el-table-column label="应用名称" align="center" prop="appName" width="120"/>
<el-table-column label="渠道名称" align="center" prop="channelCodeName" width="130"/>
<el-table-column label="商户订单编号" align="center" prop="merchantOrderId" width="140"/>
<el-table-column label="渠道订单号" align="center" prop="channelOrderNo" width="140"/>
<el-table-column label="商品标题" align="center" prop="subject" width="180" :show-overflow-tooltip="true"/>
<el-table-column label="支付金额" align="center" prop="amount" width="100">
<template slot-scope="scope">
{{ parseFloat(scope.row.amount / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="手续金额" align="center" prop="channelFeeAmount" width="100">
<template slot-scope="scope">
{{ parseFloat(scope.row.channelFeeAmount / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="退款金额" align="center" prop="refundAmount" width="100">
<template slot-scope="scope">
{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="支付状态" align="center" prop="status">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_STATUS, scope.row.status) }}</span>
</template>
</el-table-column>
<el-table-column label="退款状态" align="center" prop="refundStatus">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_REFUND_STATUS, scope.row.refundStatus) }}</span>
</template>
</el-table-column>
<el-table-column label="回调状态" align="center" prop="notifyStatus" width="100">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS, scope.row.notifyStatus) }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="支付时间" align="center" prop="successTime" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.successTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-search" @click="handleQueryDetails(scope.row)"
v-hasPermi="['pay:order:query']">查看详情
</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['pay:order:update']">修改-->
<!-- </el-button>-->
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['pay:order:delete']">删除-->
<!-- </el-button>-->
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog title="订单详情" :visible.sync="open" width="50%">
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="商户名称">{{ orderDetail.merchantName }}</el-descriptions-item>
<el-descriptions-item label="应用名称">{{ orderDetail.appName }}</el-descriptions-item>
<el-descriptions-item label="商品名称">{{ orderDetail.subject }}</el-descriptions-item>
</el-descriptions>
<el-divider></el-divider>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="商户订单号">
<el-tag size="small">{{ orderDetail.merchantOrderId }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="渠道订单号">
<el-tag class="tag-purple" size="small">{{ orderDetail.channelOrderNo }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="支付订单号">
<el-tag v-if="orderDetail.payOrderExtension.no !== ''" class="tag-pink" size="small">
{{ orderDetail.payOrderExtension.no }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="金额">
<el-tag type="success" size="small">{{ parseFloat(orderDetail.amount / 100, 2) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="手续费">
<el-tag type="warning" size="small">{{ parseFloat(orderDetail.channelFeeAmount / 100, 2) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="手续费比例">
{{ parseFloat(orderDetail.channelFeeRate / 100, 2) }}%
</el-descriptions-item>
<el-descriptions-item label="支付状态">
<el-tag :type="statusType" size="small">
{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_STATUS, orderDetail.status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="回调状态">
<el-tag :type="notifyStatusType" size="small">
{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS, orderDetail.notifyStatus) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="回调地址">{{ orderDetail.notifyUrl }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ parseTime(orderDetail.createTime) }}</el-descriptions-item>
<el-descriptions-item label="支付时间">{{ parseTime(orderDetail.successTime) }}</el-descriptions-item>
<el-descriptions-item label="失效时间">{{ parseTime(orderDetail.expireTime) }}</el-descriptions-item>
<el-descriptions-item label="通知时间">{{ parseTime(orderDetail.notifyTime) }}</el-descriptions-item>
</el-descriptions>
<el-divider></el-divider>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="支付渠道">{{ orderDetail.channelCodeName }}</el-descriptions-item>
<el-descriptions-item label="支付IP">{{ orderDetail.userIp }}</el-descriptions-item>
<el-descriptions-item label="退款状态">
<el-tag :type="refundStatusType" size="small">
{{ getDictDataLabel(DICT_TYPE.PAY_ORDER_REFUND_STATUS, orderDetail.refundStatus) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="退款次数">{{ orderDetail.refundTimes }}</el-descriptions-item>
<el-descriptions-item label="退款金额">
<el-tag type="warning">
{{ parseFloat(orderDetail.refundAmount / 100, 2) }}
</el-tag>
</el-descriptions-item>
</el-descriptions>
<el-divider></el-divider>
<el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
<el-descriptions-item label="商品描述">
{{ orderDetail.body }}
</el-descriptions-item>
<el-descriptions-item label="支付通道额外扩展参数">
{{ orderDetail.payOrderExtension.channelExtras }}
</el-descriptions-item>
<el-descriptions-item label="支付通道异步回调内容">
{{ orderDetail.payOrderExtension.channelNotifyData }}
</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</template>
<script>
import {getOrder, getOrderPage, exportOrderExcel} from "@/api/pay/order";
import {getMerchantListByName} from "@/api/pay/merchant";
import {getAppListByMerchantId} from "@/api/pay/app";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import {payOrderNotifyStatusEnum, payOrderRefundStatusEnum, payOrderStatusEnum} from "@/utils/constants";
import { getNowDateTime} from "@/utils/ruoyi";
const defaultOrderDetail = {
merchantName: '',
appName: '',
channelCodeName: '',
subject: '',
merchantOrderId: null,
channelOrderNo: '',
body: '',
amount: null,
channelFeeRate: null,
channelFeeAmount: null,
userIp: '',
status: null,
notifyUrl: '',
notifyStatus: null,
refundStatus: null,
refundTimes: '',
refundAmount: null,
createTime: '',
successTime: '',
notifyTime: '',
expireTime: '',
payOrderExtension: {
channelExtras: '',
channelNotifyData: '',
no: ''
}
};
export default {
name: "Order",
components: {},
data() {
return {
//
loading: true,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
dateRangeExpireTime: [],
dateRangeSuccessTime: [],
dateRangeNotifyTime: [],
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
merchantId: null,
appId: null,
channelId: null,
channelCode: null,
merchantOrderId: null,
subject: null,
body: null,
notifyUrl: null,
notifyStatus: null,
amount: null,
channelFeeRate: null,
channelFeeAmount: null,
status: null,
userIp: null,
successExtensionId: null,
refundStatus: null,
refundTimes: null,
refundAmount: null,
channelUserId: null,
channelOrderNo: null,
},
//
merchantLoading: false,
//
merchantList: null,
//
appList: null,
//
payChannelCodeDictDatum: getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE),
//
payOrderNotifyDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS),
//
payOrderDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_STATUS),
// 退
payOrderRefundDictDatum: getDictDatas(DICT_TYPE.PAY_ORDER_REFUND_STATUS),
orderDetail: JSON.parse(JSON.stringify(defaultOrderDetail)),
// el-tagtype
statusType: '',
// el-tagtype
notifyStatusType: '',
// el-tag退type
refundStatusType: '',
};
},
created() {
//
this.initTime();
this.getList();
this.handleGetMerchantListByName(null);
},
methods: {
initTime(){
this.dateRangeCreateTime = [getNowDateTime("00:00:00"), getNowDateTime("23:59:59")];
},
/** 查询列表 */
getList() {
//
let oneMonthTime = 31 * 24 * 3600 * 1000;
if (this.dateRangeCreateTime == null){
this.initTime();
} else {
let minDateTime = new Date(this.dateRangeCreateTime[0]).getTime();
let maxDateTime = new Date(this.dateRangeCreateTime[1]).getTime()
if (maxDateTime - minDateTime > oneMonthTime) {
this.$message.error('时间范围最大为 31 天!');
return false;
}
}
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeExpireTime, 'expireTime');
this.addBeginAndEndTime(params, this.dateRangeSuccessTime, 'successTime');
this.addBeginAndEndTime(params, this.dateRangeNotifyTime, 'notifyTime');
this.addDateRange(params, this.dateRangeCreateTime, 'CreateTime');
//
getOrderPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeSuccessTime = [];
this.dateRangeNotifyTime = [];
this.dateRangeExpireTime = [];
this.resetForm("queryForm");
this.initTime();
this.handleQuery();
},
/**
* 查看订单详情
*/
handleQueryDetails(row) {
this.orderDetail = JSON.parse(JSON.stringify(defaultOrderDetail));
getOrder(row.id).then(response => {
this.orderDetail = response.data;
if (response.data.payOrderExtension === null) {
this.orderDetail.payOrderExtension = Object.assign(defaultOrderDetail.payOrderExtension, {});
}
switch (this.orderDetail.status) {
case payOrderStatusEnum.WAITING.status:
this.statusType = "info";
break;
case payOrderStatusEnum.SUCCESS.status:
this.statusType = "success";
break;
case payOrderStatusEnum.CLOSED.status:
this.statusType = "danger";
break;
}
switch (this.orderDetail.notifyStatus) {
case payOrderNotifyStatusEnum.NO.status:
this.notifyStatusType = "info";
break;
case payOrderNotifyStatusEnum.SUCCESS.status:
this.notifyStatusType = "success";
break;
case payOrderNotifyStatusEnum.FAILURE.status:
this.notifyStatusType = "danger";
break;
}
switch (this.orderDetail.refundStatus) {
case payOrderRefundStatusEnum.NO.status:
this.refundStatusType = "success";
break;
case payOrderRefundStatusEnum.SOME.status:
this.refundStatusType = "warning";
break;
case payOrderRefundStatusEnum.ALL.status:
this.refundStatusType = "danger";
break;
}
this.open = true;
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeExpireTime, 'expireTime');
this.addBeginAndEndTime(params, this.dateRangeSuccessTime, 'successTime');
this.addBeginAndEndTime(params, this.dateRangeNotifyTime, 'notifyTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
this.$confirm('是否确认导出所有支付订单数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportOrderExcel(params);
}).then(response => {
this.downloadExcel(response, '支付订单.xls');
})
},
/**
* 根据商户名称模糊匹配商户信息
* @param name 商户名称
*/
handleGetMerchantListByName(name) {
getMerchantListByName(name).then(response => {
this.merchantList = response.data;
this.merchantLoading = false;
});
},
/**
* 根据商户 ID 查询支付应用信息
*/
handleGetAppListByMerchantId() {
this.queryParams.appId = null;
getAppListByMerchantId(this.queryParams.merchantId).then(response => {
this.appList = response.data;
});
}
}
};
</script>
<style>
.desc-label {
font-weight: bold;
}
.tag-purple {
color: #722ed1;
background: #f9f0ff;
border-color: #d3adf7;
}
.tag-cyan {
color: #13c2c2;
background: #e6fffb;
border-color: #87e8de;
}
.tag-pink {
color: #eb2f96;
background: #fff0f6;
border-color: #ffadd2;
}
</style>

View File

@ -16,7 +16,7 @@ import java.util.Map;
*
* @author 芋道源码
*/
@TableName("pay_order_extension")
@TableName(value = "pay_order_extension",autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.coreservice.modules.pay.service.order.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.coreservice.modules.pay.convert.order.PayOrderCoreConvert;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayAppDO;
import cn.iocoder.yudao.coreservice.modules.pay.dal.dataobject.merchant.PayChannelDO;
@ -18,7 +17,6 @@ import cn.iocoder.yudao.coreservice.modules.pay.service.merchant.PayChannelCoreS
import cn.iocoder.yudao.coreservice.modules.pay.service.notify.PayNotifyCoreService;
import cn.iocoder.yudao.coreservice.modules.pay.service.notify.dto.PayNotifyTaskCreateReqDTO;
import cn.iocoder.yudao.coreservice.modules.pay.service.order.PayOrderCoreService;
import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderCreateReqDTO;
import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitReqDTO;
import cn.iocoder.yudao.coreservice.modules.pay.service.order.dto.PayOrderSubmitRespDTO;
@ -98,6 +96,7 @@ public class PayOrderCoreServiceImpl implements PayOrderCoreService {
// 订单相关字段
order.setStatus(PayOrderStatusEnum.WAITING.getStatus());
// 退款相关字段
// todo @芋艿 创建支付的订单的退款状态枚举是不是有问题应该是 PayRefundTypeEnum 您这填写的是 PayOrderNotifyStatusEnum 回调状态枚举
order.setRefundStatus(PayOrderNotifyStatusEnum.NO.getStatus())
.setRefundTimes(0).setRefundAmount(0L);
payOrderCoreMapper.insert(order);