mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 17:40:05 +08:00
Merge remote-tracking branch 'yudao/feature/mall_product' into feature/mall_product
This commit is contained in:
commit
9cbd0fec1c
@ -1,230 +0,0 @@
|
|||||||
-- 菜单 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status, component_name
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分设置管理', '', 2, 0, 2162,
|
|
||||||
'config', '', 'point/config/index', 0, 'PointConfig'
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
|
||||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 按钮 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分设置查询', 'point:config:query', 3, 1, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分设置创建', 'point:config:create', 3, 2, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分设置更新', 'point:config:update', 3, 3, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分设置删除', 'point:config:delete', 3, 4, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分设置导出', 'point:config:export', 3, 5, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 菜单 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status, component_name
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分签到规则管理', '', 2, 0, 2162,
|
|
||||||
'sign-in-config', '', 'point/signInConfig/index', 0, 'SignInConfig'
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
|
||||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 按钮 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分签到规则查询', 'point:sign-in-config:query', 3, 1, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分签到规则创建', 'point:sign-in-config:create', 3, 2, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分签到规则更新', 'point:sign-in-config:update', 3, 3, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分签到规则删除', 'point:sign-in-config:delete', 3, 4, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'积分签到规则导出', 'point:sign-in-config:export', 3, 5, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
-- 菜单 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status, component_name
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户积分记录管理', '', 2, 0, 2162,
|
|
||||||
'record', '', 'point/record/index', 0, 'PointRecord'
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
|
||||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 按钮 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户积分记录查询', 'point:record:query', 3, 1, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户积分记录创建', 'point:record:create', 3, 2, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户积分记录更新', 'point:record:update', 3, 3, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户积分记录删除', 'point:record:delete', 3, 4, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户积分记录导出', 'point:record:export', 3, 5, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 菜单 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status, component_name
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户签到积分管理', '', 2, 0, 2162,
|
|
||||||
'sign-in-record', '', 'point/signInRecord/index', 0, 'SignInRecord'
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
|
||||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 按钮 SQL
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户签到积分查询', 'point:sign-in-record:query', 3, 1, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户签到积分创建', 'point:sign-in-record:create', 3, 2, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户签到积分更新', 'point:sign-in-record:update', 3, 3, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户签到积分删除', 'point:sign-in-record:delete', 3, 4, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
INSERT INTO system_menu(
|
|
||||||
name, permission, type, sort, parent_id,
|
|
||||||
path, icon, component, status
|
|
||||||
)
|
|
||||||
VALUES (
|
|
||||||
'用户签到积分导出', 'point:sign-in-record:export', 3, 5, @parentId,
|
|
||||||
'', '', '', 0
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
@ -1,555 +0,0 @@
|
|||||||
/*
|
|
||||||
Navicat Premium Data Transfer
|
|
||||||
|
|
||||||
Source Server : 127.0.0.1 MySQL
|
|
||||||
Source Server Type : MySQL
|
|
||||||
Source Server Version : 80026
|
|
||||||
Source Host : localhost:3306
|
|
||||||
Source Schema : ruoyi-vue-pro
|
|
||||||
|
|
||||||
Target Server Type : MySQL
|
|
||||||
Target Server Version : 80026
|
|
||||||
File Encoding : 65001
|
|
||||||
|
|
||||||
Date: 01/08/2022 23:01:36
|
|
||||||
*/
|
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for market_activity
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `market_activity`;
|
|
||||||
CREATE TABLE `market_activity` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动编号',
|
|
||||||
`title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '活动标题',
|
|
||||||
`activity_type` tinyint NOT NULL COMMENT '活动类型',
|
|
||||||
`status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态',
|
|
||||||
`start_time` datetime NOT NULL COMMENT '开始时间',
|
|
||||||
`end_time` datetime NOT NULL COMMENT '结束时间',
|
|
||||||
`invalid_time` datetime NULL DEFAULT NULL COMMENT '失效时间',
|
|
||||||
`delete_time` datetime NULL DEFAULT NULL COMMENT '删除时间',
|
|
||||||
`time_limited_discount` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储',
|
|
||||||
`full_privilege` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '促销活动';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of market_activity
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for market_banner
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `market_banner`;
|
|
||||||
CREATE TABLE `market_banner` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Banner编号',
|
|
||||||
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'Banner标题',
|
|
||||||
`pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片URL',
|
|
||||||
`status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态',
|
|
||||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '跳转地址',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
`sort` tinyint NULL DEFAULT NULL COMMENT '排序',
|
|
||||||
`memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Banner管理';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of market_banner
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for member_address
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `member_address`;
|
|
||||||
CREATE TABLE `member_address` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '收件地址编号',
|
|
||||||
`user_id` bigint NOT NULL COMMENT '用户编号',
|
|
||||||
`name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件人名称',
|
|
||||||
`mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '手机号',
|
|
||||||
`area_id` bigint NOT NULL COMMENT '地区编码',
|
|
||||||
`post_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '邮编',
|
|
||||||
`detail_address` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件详细地址',
|
|
||||||
`defaulted` bit(1) NOT NULL COMMENT '是否默认',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
|
||||||
INDEX `idx_userId`(`user_id` ASC) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of member_address
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `post_code`, `detail_address`, `defaulted`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 1, 'yunai', '15601691300', 610632, '200000', '芋道源码 233 号 666 室', b'1', '1', '2022-08-01 22:46:35', '1', '2022-08-01 22:46:35', b'0', 1);
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_brand
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_brand`;
|
|
||||||
CREATE TABLE `product_brand` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '品牌编号',
|
|
||||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌名称',
|
|
||||||
`pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌图片',
|
|
||||||
`sort` int NULL DEFAULT 0 COMMENT '品牌排序',
|
|
||||||
`description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '品牌描述',
|
|
||||||
`status` tinyint NOT NULL COMMENT '状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品品牌';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of product_brand
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_brand` (`id`, `name`, `pic_url`, `sort`, `description`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '苹果', 'http://test.yudao.iocoder.cn/e3726713fa56db5717c78c011762fcc7a251db12735c3581470638b8e1fa17e2.jpeg', 0, '是上市', 0, '1', '2022-07-30 22:12:18', '1', '2022-07-30 22:13:55', b'0', 1);
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_category
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_category`;
|
|
||||||
CREATE TABLE `product_category` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类编号',
|
|
||||||
`parent_id` bigint NOT NULL COMMENT '父分类编号',
|
|
||||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '分类名称',
|
|
||||||
`pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '移动端分类图',
|
|
||||||
`big_pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PC 端分类图',
|
|
||||||
`sort` int DEFAULT '0' COMMENT '分类排序',
|
|
||||||
`status` tinyint NOT NULL COMMENT '开启状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of product_category
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 0, '电脑办公', 'http://test.yudao.iocoder.cn/122d548e1b3cd5dec72fe8075c6977a70f9cc13541a684ab3685f1b5df42f6bd.jpeg', '', 300, 0, '1', '2022-07-30 16:36:35', '1', '2022-07-30 20:27:16', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, 1, '笔记本', 'http://test.yudao.iocoder.cn/72713ac7b947600a019a18786ed0e6562e8692e253dbd35110a0a85c2469bbec.jpg', '', 310, 0, '1', '2022-07-30 16:38:09', '1', '2022-07-30 16:38:09', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3, 1, '游戏本', 'http://test.yudao.iocoder.cn/287c50dd9f5f575f57329a0c57b2095be6d1aeba83867b905fe549f54a296feb.jpg', '', 312, 0, '1', '2022-07-30 16:39:09', '1', '2022-07-30 20:26:59', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (4, 0, '手机', 'http://test.yudao.iocoder.cn/e1b63900c78dbb661b3e383960cee5cfea7e1dd2fb22cff2e317ff025faaf8b2.jpeg', '', 313, 0, '1', '2022-07-30 16:40:00', '1', '2022-07-30 16:40:09', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, 4, '5G手机', 'http://test.yudao.iocoder.cn/3af6557ac7def6423f046f5b2e920b644793420b466959aaa996a2e19068bbde.jpeg', '', 314, 0, '1', '2022-07-30 16:43:00', '1', '2022-07-30 16:43:00', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (6, 4, '游戏手机', 'http://test.yudao.iocoder.cn/964fe9ccd1710d64ede261dc36d231918a017641986c15293c367f9f66d94d05.jpeg', '', 315, 0, '1', '2022-07-30 16:43:44', '1', '2022-07-30 16:43:44', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (7, 5, '厉害的 5G 手机', 'http://test.yudao.iocoder.cn/b287122f277838e8de368769b96217918605743bc45f3a29bda3cc7359dc66e1.png', '', '123', 0, '1', '2022-07-30 20:38:09', '1', '2022-07-30 20:38:09', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (15, 0, '服装鞋包', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/a23f732db55e6adbc608f4b6cf2b0ab50db6d9147af0ee267a315805a596e175.jpg', '', 100, 0, '1', '2023-04-25 16:57:05', '1', '2023-04-25 17:08:26', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (16, 15, '时尚女装', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/aa8d5c44ac0390ab398bae0dc8883575e3cb57594f9ed00248febe8e3d7484d1.png', '', 200, 0, '1', '2023-04-25 17:09:00', '1', '2023-04-25 17:09:00', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (17, 15, '精品男装', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/b0c166c0846fa2280b4a02431e2ac2e2363f2d2a6b608598f34b067a5ccf1245.png', '', 100, 0, '1', '2023-04-25 17:09:33', '1', '2023-04-25 17:09:33', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (18, 15, '箱包', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/8682928caa2a5a49b380ac93059adc435099873cdf646084f31cea79d5c27f40.png', '', 80, 0, '1', '2023-04-25 17:09:51', '1', '2023-04-25 17:09:51', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (19, 15, '西服', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c202fa79f2fbe188cfdf40b107c7eca89c548a5c4b0047e26b7a6445c470615a.jpg', '', 0, 0, '1', '2023-04-25 17:10:15', '1', '2023-04-25 17:10:15', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (20, 15, '配饰', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/51bf43fcad0b947f5fa377356fb7034b47223fdbcec241d50e6e60a9be498730.jpg', '', 0, 0, '1', '2023-04-25 17:10:56', '1', '2023-04-25 17:10:56', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 15, '美妆工具', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c3cd6735cf157c218bc32ece312fd90cb2130c437dc9ec61d4030681d6ba4efb.png', '', 0, 0, '1', '2023-04-25 17:11:15', '1', '2023-04-25 17:11:24', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (22, 0, '网络盒子', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/74656bb8bc988c0419e0dbc613eda24a03956b950452b3565527301a5782db3a.png', '', 50, 0, '1', '2023-04-25 17:12:13', '1', '2023-04-25 17:12:13', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 22, '尿裤湿巾', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/20162f22d8f6b427f0d6f1678c9fbb7bf0c1b70768bdc86101bee8b5e13bec5a.jpeg', '', 0, 0, '1', '2023-04-25 17:12:42', '1', '2023-04-25 17:12:42', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 15, '宠物主粮', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/383729ba05711c400f9e44db11a63603af0fdbc99e58cd7b40e9296ca4e0510e.jpg', '', 0, 0, '1', '2023-04-25 17:13:09', '1', '2023-04-25 17:13:09', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (25, 0, '家电电器', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/c8a34dc2688fd4d2c95b5f49888865db1c88fd3bde153e3f7f0bcd4ff9971c96.png', '', 50, 0, '1', '2023-04-25 17:13:43', '1', '2023-04-25 17:13:43', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (26, 25, '封口/封杯机', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/1c0c208cfcf871c146006d97f95ae4fcd14d8a2deb3eabe3696367af61cb5e69.png', '', 60, 0, '1', '2023-04-25 17:14:39', '1', '2023-04-25 17:14:39', b'0', 1);
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`product_category` (`id`, `parent_id`, `name`, `pic_url`, `big_pic_url`, `sort`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (27, 25, '空调', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/d578e1e60b2dc3efe70643d25a8b2150dabfecd658fdb2fafcdb786d525f66d1.png', 'http://127.0.0.1:48080/admin-api/infra/file/4/get/34ed55f822ad25ab445e6b396dcd61a7d119882ef19f85f0e24742911d896959.jpeg', 60, 0, '1', '2023-04-25 17:15:12', '1', '2023-04-25 17:17:04', b'0', 1);
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_property
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_property`;
|
|
||||||
CREATE TABLE `product_property` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格名称',
|
|
||||||
`status` tinyint DEFAULT NULL COMMENT '状态: 0 开启 ,1 禁用',
|
|
||||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
|
||||||
KEY `idx_name` (`name`(32)) USING BTREE COMMENT '规格名称索引'
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格名称';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of product_property
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_property_value
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_property_value`;
|
|
||||||
CREATE TABLE `product_property_value` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`property_id` bigint DEFAULT NULL COMMENT '规格键id',
|
|
||||||
`name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '规格值名字',
|
|
||||||
`status` tinyint DEFAULT NULL COMMENT '状态: 1 开启 ,2 禁用',
|
|
||||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格值';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of product_property_value
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_sku
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_sku`;
|
|
||||||
CREATE TABLE `product_sku` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
|
||||||
`spu_id` bigint NOT NULL COMMENT 'spu编号',
|
|
||||||
`properties` varchar(512) DEFAULT NULL COMMENT '属性数组,JSON 格式 [{propertId: , valueId: }, {propertId: , valueId: }]',
|
|
||||||
`price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位:分',
|
|
||||||
`market_price` int DEFAULT NULL COMMENT '市场价,单位:分',
|
|
||||||
`cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分',
|
|
||||||
`bar_code` varchar(64) DEFAULT NULL COMMENT 'SKU 的条形码',
|
|
||||||
`pic_url` varchar(256) NOT NULL COMMENT '图片地址',
|
|
||||||
`stock` int DEFAULT NULL COMMENT '库存',
|
|
||||||
`weight` double DEFAULT NULL COMMENT '商品重量,单位:kg 千克',
|
|
||||||
`volume` double DEFAULT NULL COMMENT '商品体积,单位:m^3 平米',
|
|
||||||
`sub_commission_first_price` int DEFAULT NULL COMMENT '一级分销的佣金,单位:分',
|
|
||||||
`sub_commission_second_price` int DEFAULT NULL COMMENT '二级分销的佣金,单位:分',
|
|
||||||
`sales_count` int DEFAULT NULL COMMENT '商品销量',
|
|
||||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`creator` varchar(64) DEFAULT NULL COMMENT '创建人',
|
|
||||||
`updater` double(64,0) DEFAULT NULL COMMENT '更新人',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='商品sku';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of product_sku
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_spu
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_spu`;
|
|
||||||
CREATE TABLE `product_spu` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品 SPU 编号,自增',
|
|
||||||
`name` varchar(128) NOT NULL COMMENT '商品名称',
|
|
||||||
`keyword` varchar(256) DEFAULT NULL COMMENT '关键字',
|
|
||||||
`introduction` varchar(256) COMMENT '商品简介',
|
|
||||||
`description` text COMMENT '商品详情',
|
|
||||||
`bar_code` varchar(64) DEFAULT NULL COMMENT '条形码',
|
|
||||||
`category_id` bigint NOT NULL COMMENT '商品分类编号',
|
|
||||||
`brand_id` int DEFAULT NULL COMMENT '商品品牌编号',
|
|
||||||
`pic_url` varchar(256) NOT NULL COMMENT '商品封面图',
|
|
||||||
`slider_pic_urls` varchar(2000) DEFAULT '' COMMENT '商品轮播图地址\n 数组,以逗号分隔\n 最多上传15张',
|
|
||||||
`video_url` varchar(256) DEFAULT NULL COMMENT '商品视频',
|
|
||||||
`unit` tinyint NOT NULL COMMENT '单位',
|
|
||||||
`sort` int NOT NULL DEFAULT '0' COMMENT '排序字段',
|
|
||||||
`status` tinyint NOT NULL COMMENT '商品状态: 0 上架(开启) 1 下架(禁用)-1 回收',
|
|
||||||
`spec_type` bit(1) DEFAULT NULL COMMENT '规格类型:0 单规格 1 多规格',
|
|
||||||
`price` int NOT NULL DEFAULT '-1' COMMENT '商品价格,单位使用:分',
|
|
||||||
`market_price` int DEFAULT NULL COMMENT '市场价,单位使用:分',
|
|
||||||
`cost_price` int NOT NULL DEFAULT '-1' COMMENT '成本价,单位: 分',
|
|
||||||
`stock` int NOT NULL DEFAULT '0' COMMENT '库存',
|
|
||||||
`delivery_template_id` bigint NOT NULL COMMENT '物流配置模板编号',
|
|
||||||
`recommend_hot` bit(1) DEFAULT NULL COMMENT '是否热卖推荐: 0 默认 1 热卖',
|
|
||||||
`recommend_benefit` bit(1) DEFAULT NULL COMMENT '是否优惠推荐: 0 默认 1 优选',
|
|
||||||
`recommend_best` bit(1) DEFAULT NULL COMMENT '是否精品推荐: 0 默认 1 精品',
|
|
||||||
`recommend_new` bit(1) DEFAULT NULL COMMENT '是否新品推荐: 0 默认 1 新品',
|
|
||||||
`recommend_good` bit(1) DEFAULT NULL COMMENT '是否优品推荐',
|
|
||||||
`give_integral` int NOT NULL COMMENT '赠送积分',
|
|
||||||
`give_coupon_template_ids` varchar(512) DEFAULT '' COMMENT '赠送的优惠劵编号的数组',
|
|
||||||
`sub_commission_type` bit(1) DEFAULT NULL COMMENT '分销类型',
|
|
||||||
`activity_orders` varchar(16) NOT NULL DEFAULT '' COMMENT '活动显示排序0=默认, 1=秒杀,2=砍价,3=拼团',
|
|
||||||
`sales_count` int DEFAULT '0' COMMENT '商品销量',
|
|
||||||
`virtual_sales_count` int DEFAULT '0' COMMENT '虚拟销量',
|
|
||||||
`browse_count` int DEFAULT '0' COMMENT '商品点击量',
|
|
||||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`creator` varchar(64) DEFAULT NULL COMMENT '创建人',
|
|
||||||
`updater` varchar(64) DEFAULT NULL COMMENT '更新人',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='商品spu';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for product_favorite
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `product_favorite`;
|
|
||||||
CREATE TABLE `product_favorite` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
|
||||||
`spu_id` bigint NOT NULL COMMENT '商品 SPU 编号',
|
|
||||||
`user_id` bigint NOT NULL COMMENT '用户id',
|
|
||||||
`type` int(10) NOT NULL DEFAULT 1 COMMENT '类型1:收藏 2:点赞',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='商品收藏表';
|
|
||||||
|
|
||||||
-- Table structure for trade_delivery_express_template
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `trade_delivery_express_template`;
|
|
||||||
CREATE TABLE `trade_delivery_express_template` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`name` varchar(64) NOT NULL COMMENT '模板名称',
|
|
||||||
`charge_mode` tinyint NOT NULL COMMENT '配送计费方式',
|
|
||||||
`sort` int NOT NULL DEFAULT 0 COMMENT '排序',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='快递运费模板';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for trade_delivery_express_template_free
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `trade_delivery_express_template_free`;
|
|
||||||
CREATE TABLE `trade_delivery_express_template_free` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`template_id` bigint NOT NULL COMMENT '快递运费模板编号',
|
|
||||||
`area_ids` varchar(100) NOT NULL COMMENT '包邮区域 ids',
|
|
||||||
`free_price` int NOT NULL COMMENT '包邮金额,单位:分',
|
|
||||||
`free_count` int NOT NULL DEFAULT 0 COMMENT '包邮件数,',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='快递运费模板包邮配置';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for trade_delivery_express_template_charge
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `trade_delivery_express_template_charge`;
|
|
||||||
CREATE TABLE `trade_delivery_express_template_charge` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
|
||||||
`template_id` bigint NOT NULL COMMENT '快递运费模板编号',
|
|
||||||
`area_ids` varchar(100) NOT NULL COMMENT '配送区域 ids',
|
|
||||||
`charge_mode` tinyint NOT NULL COMMENT '配送计费方式',
|
|
||||||
`start_count` double NOT NULL COMMENT '首件数量',
|
|
||||||
`start_price` int NOT NULL COMMENT '起步价,单位:分',
|
|
||||||
`extra_count` double NOT NULL COMMENT '续件数量',
|
|
||||||
`extra_price` int NOT NULL COMMENT '额外价,单位:分',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='快递运费模板计费配置';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for trade_delivery_pick_up_store
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `trade_delivery_pick_up_store`;
|
|
||||||
CREATE TABLE `trade_delivery_pick_up_store` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`name` varchar(64) NOT NULL COMMENT '门店名称',
|
|
||||||
`introduction` varchar(256) COMMENT '门店简介',
|
|
||||||
`phone` varchar(16) NOT NULL COMMENT '门店手机',
|
|
||||||
`area_id` int NOT NULL COMMENT '区域编号',
|
|
||||||
`detail_address` varchar(256) NOT NULL COMMENT '门店详细地址',
|
|
||||||
`logo` varchar(256) NOT NULL COMMENT '门店 logo',
|
|
||||||
`opening_time` time NOT NULL COMMENT '营业开始时间',
|
|
||||||
`closing_time` time NOT NULL COMMENT '营业结束时间',
|
|
||||||
`latitude` double NOT NULL COMMENT '纬度',
|
|
||||||
`longitude` double NOT NULL COMMENT '经度',
|
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '门店状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='自提门店';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for trade_delivery_pick_up_store_staff
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `trade_delivery_pick_up_store_staff`;
|
|
||||||
CREATE TABLE `trade_delivery_pick_up_store_staff` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
|
||||||
store_id bigint NOT NULL COMMENT '自提门店编号',
|
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='自提门店店员';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for trade_delivery_express
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `trade_delivery_express`;
|
|
||||||
CREATE TABLE `trade_delivery_express` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`code` varchar(64) NOT NULL COMMENT '快递公司编码',
|
|
||||||
`name` varchar(64) NOT NULL COMMENT '快递公司名称',
|
|
||||||
`logo` varchar(256) COMMENT '快递公司 logo',
|
|
||||||
`sort` int NOT NULL DEFAULT 0 COMMENT '排序',
|
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='快递公司';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 页面装修表
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `promotion_decorate_component`;
|
|
||||||
CREATE TABLE `promotion_decorate_component` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`page_id` int NOT NULL COMMENT '所属页面id',
|
|
||||||
`code` varchar(64) NOT NULL COMMENT '组件编码',
|
|
||||||
`value` json NOT NULL COMMENT '组件值:json 格式。包含配置和数据',
|
|
||||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB COMMENT='页面装修表';
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, '商品中心', '', 1, 60, 0, '/product', 'merchant', NULL, 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:26:19', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, '商品分类', '', 2, 2, 2000, 'category', 'dict', 'mall/product/category/index', 0, b'1', b'1', '', '2022-07-29 15:53:53', '1', '2022-07-30 22:23:37', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, '分类查询', 'product:category:query', 3, 1, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, '分类创建', 'product:category:create', 3, 2, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, '分类更新', 'product:category:update', 3, 3, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, '分类删除', 'product:category:delete', 3, 4, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-29 15:53:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2007, '分类导出', 'product:category:export', 3, 5, 2002, '', '', '', 0, b'1', b'1', '', '2022-07-29 15:53:53', '', '2022-07-30 13:52:13', b'1');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, '商品品牌', '', 2, 1, 2000, 'brand', 'dashboard', 'mall/product/brand/index', 0, b'1', b'1', '', '2022-07-30 13:52:44', '1', '2022-07-30 22:23:43', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, '品牌查询', 'product:brand:query', 3, 1, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, '品牌创建', 'product:brand:create', 3, 2, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, '品牌更新', 'product:brand:update', 3, 3, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, '品牌删除', 'product:brand:delete', 3, 4, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 13:52:44', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2013, '品牌导出', 'product:brand:export', 3, 5, 2008, '', '', '', 0, b'1', b'1', '', '2022-07-30 13:52:44', '', '2022-07-30 14:15:00', b'1');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, '商品管理', '', 2, 0, 2000, 'spu', 'link', 'mall/product/spu/index', 0, b'1', b'1', '', '2022-07-30 14:22:58', '1', '2022-07-30 22:26:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, '商品查询', 'product:spu:query', 3, 1, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, '商品创建', 'product:spu:create', 3, 2, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, '商品更新', 'product:spu:update', 3, 3, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品删除', 'product:spu:delete', 3, 4, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, '商品导出', 'product:spu:export', 3, 5, 2014, '', '', '', 0, b'1', b'1', '', '2022-07-30 14:22:58', '', '2022-07-30 14:22:58', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, '规格管理', '', 2, 3, 2000, 'property', '', 'mall/product/property/index', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, '规格查询', 'product:property:query', 3, 1, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2024, '规格导出', 'product:property:export', 3, 5, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 1, 2000, 'brand', '', 'mall/market/banner/index', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, '配送管理', '', 1, 0, 2072, 'delivery', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:18:02', '1', '2023-05-18 09:48:48', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, '快递发货', '', 1, 0, 2164, 'express', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:22:06', '1', '2023-05-18 09:22:06', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, '门店自提', '', 1, 1, 2164, 'pick-up', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:23:14', '1', '2023-05-18 09:23:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, '快递公司', '', 2, 0, 2165, 'express', '', 'mall/trade/delivery/express/index', 'Express', 0, b'1', b'1', b'1', '1', '2023-05-18 09:27:21', '1', '2023-05-18 22:11:14', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, '快递公司查询', 'trade:delivery:express:query', 3, 1, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, '快递公司创建', 'trade:delivery:express:create', 3, 2, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, '快递公司更新', 'trade:delivery:express:update', 3, 3, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, '快递公司删除', 'trade:delivery:express:delete', 3, 4, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, '快递公司导出', 'trade:delivery:express:export', 3, 5, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, '快递运费模板导出', 'trade:delivery:express-template:export', 3, 5, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, '快递运费模板删除', 'trade:delivery:express-template:delete', 3, 4, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2176, '快递运费模板更新', 'trade:delivery:express-template:update', 3, 3, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, '快递运费模板创建', 'trade:delivery:express-template:create', 3, 2, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, '快递运费模板查询', 'trade:delivery:express-template:query', 3, 1, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, '运费模版', 'trade:delivery:express-template:query', 2, 1, 2165, 'express-template', '', 'mall/trade/delivery/expressTemplate/index', 'ExpressTemplate', 0, b'1', b'1', b'1', '1', '2023-05-20 06:48:10', '1', '2023-05-20 06:48:29', b'0');
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 字典管理,添加商品单位字典 product_unit
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '商品单位', 'product_unit', 0, '', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '个', 1, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '件', 2, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '盒', 3, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '袋', 4, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '箱', 5, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '套', 6, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '包', 7, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '双', 8, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '卷', 9, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 数字字典,快递计费方式
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '快递计费方式', 'trade_delivery_express_charge_mode', 0, '用于商城交易模块配送管理', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0');
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- 门店管理 菜单
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2179, '门店管理', '', 2, 1, 2166, 'pick-up-store', '', 'mall/trade/delivery/pickUpStore/index', 'PickUpStore', 0, b'1', b'1', b'1', '1', '2023-05-25 10:50:00', '1', '2023-05-25 10:50:00', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2180, '自提门店查询', 'trade:delivery:pick-up-store:query', 3, 1, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2181, '自提门店创建', 'trade:delivery:pick-up-store:create', 3, 2, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2182, '自提门店更新', 'trade:delivery:pick-up-store:update', 3, 3, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2183, '自提门店删除', 'trade:delivery:pick-up-store:delete', 3, 4, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
|
|
||||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2184, '自提门店导出', 'trade:delivery:pick-up-store:export', 3, 5, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
|
|
||||||
COMMIT;
|
|
@ -875,294 +875,6 @@ CREATE TABLE `member_user` (
|
|||||||
BEGIN;
|
BEGIN;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_app
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_app`;
|
|
||||||
CREATE TABLE `pay_app` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '应用编号',
|
|
||||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用名',
|
|
||||||
`status` tinyint NOT NULL COMMENT '开启状态',
|
|
||||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`pay_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付结果的回调地址',
|
|
||||||
`refund_notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款结果的回调地址',
|
|
||||||
`merchant_id` bigint NOT NULL COMMENT '商户编号',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付应用信息';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_app
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_channel
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_channel`;
|
|
||||||
CREATE TABLE `pay_channel` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '商户编号',
|
|
||||||
`code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
|
|
||||||
`status` tinyint NOT NULL COMMENT '开启状态',
|
|
||||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`fee_rate` double NOT NULL DEFAULT 0 COMMENT '渠道费率,单位:百分比',
|
|
||||||
`merchant_id` bigint NOT NULL COMMENT '商户编号',
|
|
||||||
`app_id` bigint NOT NULL COMMENT '应用编号',
|
|
||||||
`config` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付渠道\n';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_channel
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_demo_order
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_demo_order`;
|
|
||||||
CREATE TABLE `pay_demo_order` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号',
|
|
||||||
`user_id` bigint UNSIGNED NOT NULL COMMENT '用户编号',
|
|
||||||
`spu_id` bigint NOT NULL COMMENT '商品编号',
|
|
||||||
`spu_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '商品名字',
|
|
||||||
`price` int NOT NULL COMMENT '价格,单位:分',
|
|
||||||
`payed` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]',
|
|
||||||
`pay_order_id` bigint NULL DEFAULT NULL COMMENT '支付订单编号',
|
|
||||||
`pay_channel_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '支付成功的支付渠道',
|
|
||||||
`pay_time` datetime NULL DEFAULT NULL COMMENT '订单支付时间',
|
|
||||||
`pay_refund_id` bigint NULL DEFAULT NULL COMMENT '退款订单编号',
|
|
||||||
`refund_price` int NOT NULL DEFAULT 0 COMMENT '退款金额,单位:分',
|
|
||||||
`refund_time` datetime NULL DEFAULT NULL COMMENT '退款时间',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '示例订单\n';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_demo_order
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_merchant
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_merchant`;
|
|
||||||
CREATE TABLE `pay_merchant` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '商户编号',
|
|
||||||
`no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户号',
|
|
||||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户全称',
|
|
||||||
`short_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户简称',
|
|
||||||
`status` tinyint NOT NULL COMMENT '开启状态',
|
|
||||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付商户信息';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_merchant
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_notify_log
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_notify_log`;
|
|
||||||
CREATE TABLE `pay_notify_log` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志编号',
|
|
||||||
`task_id` bigint NOT NULL COMMENT '通知任务编号',
|
|
||||||
`notify_times` tinyint NOT NULL COMMENT '第几次被通知',
|
|
||||||
`response` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '请求参数',
|
|
||||||
`status` tinyint NOT NULL COMMENT '通知状态',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 371964 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付通知 App 的日志';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_notify_log
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_notify_task
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_notify_task`;
|
|
||||||
CREATE TABLE `pay_notify_task` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号',
|
|
||||||
`merchant_id` bigint NOT NULL COMMENT '商户编号',
|
|
||||||
`app_id` bigint NOT NULL COMMENT '应用编号',
|
|
||||||
`type` tinyint NOT NULL COMMENT '通知类型',
|
|
||||||
`data_id` bigint NOT NULL COMMENT '数据编号',
|
|
||||||
`status` tinyint NOT NULL COMMENT '通知状态',
|
|
||||||
`merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号',
|
|
||||||
`next_notify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '下一次通知时间',
|
|
||||||
`last_execute_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后一次执行时间',
|
|
||||||
`notify_times` tinyint NOT NULL COMMENT '当前通知次数',
|
|
||||||
`max_notify_times` tinyint NOT NULL COMMENT '最大可通知次数',
|
|
||||||
`notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知地址',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 151 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商户支付、退款等的通知\n';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_notify_task
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_order
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_order`;
|
|
||||||
CREATE TABLE `pay_order` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付订单编号',
|
|
||||||
`merchant_id` bigint NOT NULL COMMENT '商户编号',
|
|
||||||
`app_id` bigint NOT NULL COMMENT '应用编号',
|
|
||||||
`channel_id` bigint NULL DEFAULT NULL COMMENT '渠道编号',
|
|
||||||
`channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道编码',
|
|
||||||
`merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号',
|
|
||||||
`subject` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品标题',
|
|
||||||
`body` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品描述',
|
|
||||||
`notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知地址',
|
|
||||||
`notify_status` tinyint NOT NULL COMMENT '通知商户支付结果的回调状态',
|
|
||||||
`amount` bigint NOT NULL COMMENT '支付金额,单位:分',
|
|
||||||
`channel_fee_rate` double NULL DEFAULT 0 COMMENT '渠道手续费,单位:百分比',
|
|
||||||
`channel_fee_amount` bigint NULL DEFAULT 0 COMMENT '渠道手续金额,单位:分',
|
|
||||||
`status` tinyint NOT NULL COMMENT '支付状态',
|
|
||||||
`user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP',
|
|
||||||
`expire_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单失效时间',
|
|
||||||
`success_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单支付成功时间',
|
|
||||||
`notify_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '订单支付通知时间',
|
|
||||||
`success_extension_id` bigint NULL DEFAULT NULL COMMENT '支付成功的订单拓展单编号',
|
|
||||||
`refund_status` tinyint NOT NULL COMMENT '退款状态',
|
|
||||||
`refund_times` tinyint NOT NULL COMMENT '退款次数',
|
|
||||||
`refund_amount` bigint NOT NULL COMMENT '退款总金额,单位:分',
|
|
||||||
`channel_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道用户编号',
|
|
||||||
`channel_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道订单号',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 171 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付订单\n';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_order
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_order_extension
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_order_extension`;
|
|
||||||
CREATE TABLE `pay_order_extension` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付订单编号',
|
|
||||||
`no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付订单号',
|
|
||||||
`order_id` bigint NOT NULL COMMENT '支付订单编号',
|
|
||||||
`channel_id` bigint NOT NULL COMMENT '渠道编号',
|
|
||||||
`channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
|
|
||||||
`user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP',
|
|
||||||
`status` tinyint NOT NULL COMMENT '支付状态',
|
|
||||||
`channel_extras` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道的额外参数',
|
|
||||||
`channel_notify_data` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道异步通知的内容',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 383 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付订单\n';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_order_extension
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for pay_refund
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS `pay_refund`;
|
|
||||||
CREATE TABLE `pay_refund` (
|
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付退款编号',
|
|
||||||
`merchant_id` bigint NOT NULL COMMENT '商户编号',
|
|
||||||
`app_id` bigint NOT NULL COMMENT '应用编号',
|
|
||||||
`channel_id` bigint NOT NULL COMMENT '渠道编号',
|
|
||||||
`channel_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道编码',
|
|
||||||
`order_id` bigint NOT NULL COMMENT '支付订单编号 pay_order 表id',
|
|
||||||
`trade_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易订单号 pay_extension 表no 字段',
|
|
||||||
`merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户订单编号(商户系统生成)',
|
|
||||||
`merchant_refund_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户退款订单号(商户系统生成)',
|
|
||||||
`notify_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '异步通知商户地址',
|
|
||||||
`notify_status` tinyint NOT NULL COMMENT '通知商户退款结果的回调状态',
|
|
||||||
`status` tinyint NOT NULL COMMENT '退款状态',
|
|
||||||
`type` tinyint NOT NULL COMMENT '退款类型(部分退款,全部退款)',
|
|
||||||
`pay_amount` bigint NOT NULL COMMENT '支付金额,单位分',
|
|
||||||
`refund_amount` bigint NOT NULL COMMENT '退款金额,单位分',
|
|
||||||
`reason` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '退款原因',
|
|
||||||
`user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户 IP',
|
|
||||||
`channel_order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道订单号,pay_order 中的channel_order_no 对应',
|
|
||||||
`channel_refund_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道退款单号,渠道返回',
|
|
||||||
`channel_error_code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误码',
|
|
||||||
`channel_error_msg` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '渠道调用报错时,错误信息',
|
|
||||||
`channel_extras` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付渠道的额外参数',
|
|
||||||
`expire_time` datetime NULL DEFAULT NULL COMMENT '退款失效时间',
|
|
||||||
`success_time` datetime NULL DEFAULT NULL COMMENT '退款成功时间',
|
|
||||||
`notify_time` datetime NULL DEFAULT NULL COMMENT '退款通知时间',
|
|
||||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
|
||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '退款订单';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of pay_refund
|
|
||||||
-- ----------------------------
|
|
||||||
BEGIN;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for system_dept
|
-- Table structure for system_dept
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.common.exception.util;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
|
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -80,6 +81,10 @@ public class ServiceExceptionUtil {
|
|||||||
return new ServiceException(code, message);
|
return new ServiceException(code, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ServiceException invalidParamException(String messagePattern, Object... params) {
|
||||||
|
return exception0(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), messagePattern, params);
|
||||||
|
}
|
||||||
|
|
||||||
// ========== 格式化方法 ==========
|
// ========== 格式化方法 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,14 +35,4 @@ public class PayOrderNotifyRespDTO {
|
|||||||
*/
|
*/
|
||||||
private LocalDateTime successTime;
|
private LocalDateTime successTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO @jason 结合其他的渠道定义成枚举,
|
|
||||||
*
|
|
||||||
* alipay
|
|
||||||
* TRADE_CLOSED,未付款交易超时关闭,或支付完成后全额退款。
|
|
||||||
* TRADE_SUCCESS, 交易支付成功
|
|
||||||
* TRADE_FINISHED 交易结束,不可退款。
|
|
||||||
*/
|
|
||||||
private String tradeStatus;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.dto.notify;
|
package cn.iocoder.yudao.framework.pay.core.client.dto.notify;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.refund.PayNotifyRefundStatusEnum;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.dto.order;
|
package cn.iocoder.yudao.framework.pay.core.client.dto.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
import org.hibernate.validator.constraints.URL;
|
import org.hibernate.validator.constraints.URL;
|
||||||
@ -8,7 +8,6 @@ import org.hibernate.validator.constraints.URL;
|
|||||||
import javax.validation.constraints.DecimalMin;
|
import javax.validation.constraints.DecimalMin;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.awt.*;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -85,7 +84,7 @@ public class PayOrderUnifiedReqDTO {
|
|||||||
*
|
*
|
||||||
* 如果不传递,则每个支付渠道使用默认的方式
|
* 如果不传递,则每个支付渠道使用默认的方式
|
||||||
*
|
*
|
||||||
* 枚举 {@link PayDisplayModeEnum}
|
* 枚举 {@link PayOrderDisplayModeEnum}
|
||||||
*/
|
*/
|
||||||
private String displayMode;
|
private String displayMode;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.dto.order;
|
package cn.iocoder.yudao.framework.pay.core.client.dto.order;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,6 +14,8 @@ public class PayOrderUnifiedRespDTO {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 展示模式
|
* 展示模式
|
||||||
|
*
|
||||||
|
* 枚举 {@link PayOrderDisplayModeEnum} 类
|
||||||
*/
|
*/
|
||||||
private String displayMode;
|
private String displayMode;
|
||||||
/**
|
/**
|
||||||
@ -20,4 +23,20 @@ public class PayOrderUnifiedRespDTO {
|
|||||||
*/
|
*/
|
||||||
private String displayContent;
|
private String displayContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link PayOrderStatusRespEnum} 类
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
public PayOrderUnifiedRespDTO(String displayMode, String displayContent) {
|
||||||
|
this(displayMode, displayContent, PayOrderStatusRespEnum.WAITING.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayOrderUnifiedRespDTO(String displayMode, String displayContent, Integer status) {
|
||||||
|
this.displayMode = displayMode;
|
||||||
|
this.displayContent = displayContent;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.dto.refund;
|
package cn.iocoder.yudao.framework.pay.core.client.dto.refund;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelRefundRespEnum;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.exception;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付系统异常 Exception
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class PayException extends RuntimeException {
|
||||||
|
|
||||||
|
public PayException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,23 +1,18 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl;
|
package cn.iocoder.yudao.framework.pay.core.client.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClient;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
import com.alipay.api.AlipayResponse;import lombok.extern.slf4j.Slf4j;
|
import cn.iocoder.yudao.framework.pay.core.client.exception.PayException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.validation.Validation;
|
import javax.validation.Validation;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER;
|
|
||||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_MS_FORMATTER;
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.PAY_EXCEPTION;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付客户端的抽象类,提供模板方法,减少子类的冗余代码
|
* 支付客户端的抽象类,提供模板方法,减少子类的冗余代码
|
||||||
@ -78,16 +73,19 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
@Override
|
@Override
|
||||||
public final PayOrderUnifiedRespDTO unifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
public final PayOrderUnifiedRespDTO unifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
||||||
Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO);
|
Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO);
|
||||||
// 执行短信发送
|
// 执行统一下单
|
||||||
PayOrderUnifiedRespDTO result;
|
PayOrderUnifiedRespDTO resp;
|
||||||
try {
|
try {
|
||||||
result = doUnifiedOrder(reqDTO);
|
resp = doUnifiedOrder(reqDTO);
|
||||||
|
} catch (ServiceException ex) {
|
||||||
|
// 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
// 打印异常日志
|
// 系统异常,则包装成 PayException 异常抛出
|
||||||
log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), ex);
|
log.error("[unifiedRefund][request({}) 发起支付异常]", toJsonString(reqDTO), ex);
|
||||||
throw buildException(ex);
|
throw buildException(ex);
|
||||||
}
|
}
|
||||||
return result;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO)
|
protected abstract PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO)
|
||||||
@ -95,12 +93,17 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PayRefundUnifiedRespDTO unifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
public PayRefundUnifiedRespDTO unifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
||||||
|
Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO);
|
||||||
|
// 执行统一退款
|
||||||
PayRefundUnifiedRespDTO resp;
|
PayRefundUnifiedRespDTO resp;
|
||||||
try {
|
try {
|
||||||
resp = doUnifiedRefund(reqDTO);
|
resp = doUnifiedRefund(reqDTO);
|
||||||
|
} catch (ServiceException ex) {
|
||||||
|
// 业务异常,都是实现类已经翻译,所以直接抛出即可
|
||||||
|
throw ex;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
// 记录异常日志
|
// 系统异常,则包装成 PayException 异常抛出
|
||||||
log.error("[unifiedRefund][request({}) 发起退款失败]", toJsonString(reqDTO), ex);
|
log.error("[unifiedRefund][request({}) 发起退款异常]", toJsonString(reqDTO), ex);
|
||||||
throw buildException(ex);
|
throw buildException(ex);
|
||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
@ -110,32 +113,11 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
|
|
||||||
// ========== 各种工具方法 ==========
|
// ========== 各种工具方法 ==========
|
||||||
|
|
||||||
private RuntimeException buildException(Throwable ex) {
|
private PayException buildException(Throwable ex) {
|
||||||
if (ex instanceof RuntimeException) {
|
if (ex instanceof PayException) {
|
||||||
return (RuntimeException) ex;
|
return (PayException) ex;
|
||||||
}
|
}
|
||||||
throw new RuntimeException(ex);
|
throw new PayException(ex);
|
||||||
}
|
|
||||||
|
|
||||||
protected void validateSuccess(AlipayResponse response) {
|
|
||||||
if (response.isSuccess()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw exception0(PAY_EXCEPTION.getCode(), response.getSubMsg());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String formatAmount(Integer amount) {
|
|
||||||
return String.valueOf(amount / 100.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String formatTime(LocalDateTime time) {
|
|
||||||
// "yyyy-MM-dd HH:mm:ss"
|
|
||||||
return LocalDateTimeUtil.format(time, NORM_DATETIME_FORMATTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected LocalDateTime parseTime(String str) {
|
|
||||||
// "yyyy-MM-dd HH:mm:ss"
|
|
||||||
return LocalDateTimeUtil.parse(str, NORM_DATETIME_FORMATTER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,8 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient;
|
|||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.*;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXLitePayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.*;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXNativePayClient;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -58,12 +55,15 @@ public class PayClientFactoryImpl implements PayClientFactory {
|
|||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(channelCode);
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(channelCode);
|
||||||
Assert.notNull(channelEnum, String.format("支付渠道(%s) 为空", channelEnum));
|
Assert.notNull(channelEnum, String.format("支付渠道(%s) 为空", channelEnum));
|
||||||
// 创建客户端
|
// 创建客户端
|
||||||
// TODO @芋艿 WX_LITE WX_APP 如果不添加在 项目启动的时候去初始化会报错无法启动。所以我手动加了两个,具体需要你来配
|
|
||||||
switch (channelEnum) {
|
switch (channelEnum) {
|
||||||
case WX_PUB: return (AbstractPayClient<Config>) new WXPubPayClient(channelId, (WXPayClientConfig) config);
|
// 微信支付
|
||||||
case WX_LITE: return (AbstractPayClient<Config>) new WXLitePayClient(channelId, (WXPayClientConfig) config); //微信小程序请求支付
|
case WX_PUB: return (AbstractPayClient<Config>) new WxPubPayClient(channelId, (WxPayClientConfig) config);
|
||||||
case WX_APP: return (AbstractPayClient<Config>) new WXPubPayClient(channelId, (WXPayClientConfig) config);
|
case WX_LITE: return (AbstractPayClient<Config>) new WxLitePayClient(channelId, (WxPayClientConfig) config);
|
||||||
case WX_NATIVE: return (AbstractPayClient<Config>) new WXNativePayClient(channelId, (WXPayClientConfig) config);
|
case WX_APP: return (AbstractPayClient<Config>) new WxAppPayClient(channelId, (WxPayClientConfig) config);
|
||||||
|
case WX_BAR: return (AbstractPayClient<Config>) new WxBarPayClient(channelId, (WxPayClientConfig) config);
|
||||||
|
case WX_NATIVE: return (AbstractPayClient<Config>) new WxNativePayClient(channelId, (WxPayClientConfig) config);
|
||||||
|
case WX_H5: return (AbstractPayClient<Config>) new WxH5PayClient(channelId, (WxPayClientConfig) config);
|
||||||
|
// 支付宝支付
|
||||||
case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
case ALIPAY_QR: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_QR: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
case ALIPAY_APP: return (AbstractPayClient<Config>) new AlipayAppPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_APP: return (AbstractPayClient<Config>) new AlipayAppPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.refund.PayNotifyRefundStatusEnum;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.*;
|
||||||
import com.alipay.api.AlipayConfig;
|
|
||||||
import com.alipay.api.DefaultAlipayClient;
|
|
||||||
import com.alipay.api.domain.AlipayTradeRefundModel;
|
import com.alipay.api.domain.AlipayTradeRefundModel;
|
||||||
import com.alipay.api.internal.util.AlipaySignature;
|
import com.alipay.api.internal.util.AlipaySignature;
|
||||||
import com.alipay.api.request.AlipayTradeRefundRequest;
|
import com.alipay.api.request.AlipayTradeRefundRequest;
|
||||||
@ -20,21 +20,25 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
|
import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.ORDER_UNIFIED_ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付宝抽象类, 实现支付宝统一的接口。如退款
|
* 支付宝抽象类,实现支付宝统一的接口、以及部分实现(退款)
|
||||||
*
|
*
|
||||||
* @author jason
|
* @author jason
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayClientConfig> {
|
public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPayClientConfig> {
|
||||||
|
|
||||||
protected DefaultAlipayClient client;
|
protected DefaultAlipayClient client;
|
||||||
|
|
||||||
public AbstractAlipayClient(Long channelId, String channelCode, AlipayPayClientConfig config) {
|
public AbstractAlipayPayClient(Long channelId, String channelCode, AlipayPayClientConfig config) {
|
||||||
super(channelId, channelCode, config);
|
super(channelId, channelCode, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +62,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl
|
|||||||
model.setOutTradeNo(reqDTO.getPayTradeNo());
|
model.setOutTradeNo(reqDTO.getPayTradeNo());
|
||||||
|
|
||||||
model.setOutRequestNo(reqDTO.getMerchantRefundId());
|
model.setOutRequestNo(reqDTO.getMerchantRefundId());
|
||||||
model.setRefundAmount(formatAmount(reqDTO.getAmount()).toString());
|
model.setRefundAmount(formatAmount(reqDTO.getAmount()));
|
||||||
model.setRefundReason(reqDTO.getReason());
|
model.setRefundReason(reqDTO.getReason());
|
||||||
|
|
||||||
AlipayTradeRefundRequest refundRequest = new AlipayTradeRefundRequest();
|
AlipayTradeRefundRequest refundRequest = new AlipayTradeRefundRequest();
|
||||||
@ -106,10 +110,43 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
// 2.2 支付的情况
|
// 2.2 支付的情况
|
||||||
return PayOrderNotifyRespDTO.builder().orderExtensionNo(bodyObj.get("out_trade_no"))
|
return PayOrderNotifyRespDTO.builder()
|
||||||
.channelOrderNo(bodyObj.get("trade_no")).channelUserId(bodyObj.get("seller_id"))
|
.orderExtensionNo(bodyObj.get("out_trade_no"))
|
||||||
.tradeStatus(bodyObj.get("trade_status")).successTime(parseTime(params.get("notify_time")))
|
.channelOrderNo(bodyObj.get("trade_no"))
|
||||||
|
.channelUserId(bodyObj.get("seller_id"))
|
||||||
|
.successTime(parseTime(params.get("notify_time")))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========== 各种工具方法 ==========
|
||||||
|
|
||||||
|
protected String formatAmount(Integer amount) {
|
||||||
|
return String.valueOf(amount / 100.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String formatTime(LocalDateTime time) {
|
||||||
|
return LocalDateTimeUtil.format(time, NORM_DATETIME_FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LocalDateTime parseTime(String str) {
|
||||||
|
return LocalDateTimeUtil.parse(str, NORM_DATETIME_FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验支付宝统一下单的响应
|
||||||
|
*
|
||||||
|
* 如果校验不通过,则抛出 {@link cn.iocoder.yudao.framework.common.exception.ServiceException} 异常
|
||||||
|
*
|
||||||
|
* @param request 请求
|
||||||
|
* @param response 响应
|
||||||
|
*/
|
||||||
|
protected void validateUnifiedOrderResponse(Object request, AlipayResponse response) {
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.error("[validateUnifiedOrderResponse][发起支付失败,request({}),response({})]",
|
||||||
|
JsonUtils.toJsonString(request), JsonUtils.toJsonString(response));
|
||||||
|
throw exception0(ORDER_UNIFIED_ERROR.getCode(), response.getSubMsg());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.domain.AlipayTradeAppPayModel;
|
import com.alipay.api.domain.AlipayTradeAppPayModel;
|
||||||
import com.alipay.api.request.AlipayTradeAppPayRequest;
|
import com.alipay.api.request.AlipayTradeAppPayRequest;
|
||||||
@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AlipayAppPayClient extends AbstractAlipayClient {
|
public class AlipayAppPayClient extends AbstractAlipayPayClient {
|
||||||
|
|
||||||
public AlipayAppPayClient(Long channelId, AlipayPayClientConfig config) {
|
public AlipayAppPayClient(Long channelId, AlipayPayClientConfig config) {
|
||||||
super(channelId, PayChannelEnum.ALIPAY_APP.getCode(), config);
|
super(channelId, PayChannelEnum.ALIPAY_APP.getCode(), config);
|
||||||
@ -38,7 +38,7 @@ public class AlipayAppPayClient extends AbstractAlipayClient {
|
|||||||
model.setProductCode(" QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品
|
model.setProductCode(" QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品
|
||||||
// ② 个性化的参数【无】
|
// ② 个性化的参数【无】
|
||||||
// ③ 支付宝扫码支付只有一种展示
|
// ③ 支付宝扫码支付只有一种展示
|
||||||
String displayMode = PayDisplayModeEnum.APP.getMode();
|
String displayMode = PayOrderDisplayModeEnum.APP.getMode();
|
||||||
|
|
||||||
// 1.2 构建 AlipayTradePrecreateRequest 请求
|
// 1.2 构建 AlipayTradePrecreateRequest 请求
|
||||||
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
|
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
|
||||||
@ -49,9 +49,8 @@ public class AlipayAppPayClient extends AbstractAlipayClient {
|
|||||||
// 2.1 执行请求
|
// 2.1 执行请求
|
||||||
AlipayTradeAppPayResponse response = client.execute(request);
|
AlipayTradeAppPayResponse response = client.execute(request);
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
validateSuccess(response);
|
validateUnifiedOrderResponse(request, response);
|
||||||
return new PayOrderUnifiedRespDTO()
|
return new PayOrderUnifiedRespDTO(displayMode, "");
|
||||||
.setDisplayMode(displayMode).setDisplayContent("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.domain.AlipayTradePayModel;
|
import com.alipay.api.domain.AlipayTradePayModel;
|
||||||
import com.alipay.api.request.AlipayTradePayRequest;
|
import com.alipay.api.request.AlipayTradePayRequest;
|
||||||
@ -13,7 +13,6 @@ import com.alipay.api.response.AlipayTradePayResponse;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
|
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,7 +23,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AlipayBarPayClient extends AbstractAlipayClient {
|
public class AlipayBarPayClient extends AbstractAlipayPayClient {
|
||||||
|
|
||||||
public AlipayBarPayClient(Long channelId, AlipayPayClientConfig config) {
|
public AlipayBarPayClient(Long channelId, AlipayPayClientConfig config) {
|
||||||
super(channelId, PayChannelEnum.ALIPAY_BAR.getCode(), config);
|
super(channelId, PayChannelEnum.ALIPAY_BAR.getCode(), config);
|
||||||
@ -48,7 +47,7 @@ public class AlipayBarPayClient extends AbstractAlipayClient {
|
|||||||
// ② 个性化的参数
|
// ② 个性化的参数
|
||||||
model.setAuthCode(authCode);
|
model.setAuthCode(authCode);
|
||||||
// ③ 支付宝条码支付只有一种展示
|
// ③ 支付宝条码支付只有一种展示
|
||||||
String displayMode = PayDisplayModeEnum.BAR_CODE.getMode();
|
String displayMode = PayOrderDisplayModeEnum.BAR_CODE.getMode();
|
||||||
|
|
||||||
// 1.2 构建 AlipayTradePayRequest 请求
|
// 1.2 构建 AlipayTradePayRequest 请求
|
||||||
AlipayTradePayRequest request = new AlipayTradePayRequest();
|
AlipayTradePayRequest request = new AlipayTradePayRequest();
|
||||||
@ -59,8 +58,8 @@ public class AlipayBarPayClient extends AbstractAlipayClient {
|
|||||||
// 2.1 执行请求
|
// 2.1 执行请求
|
||||||
AlipayTradePayResponse response = client.execute(request);
|
AlipayTradePayResponse response = client.execute(request);
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
validateSuccess(response);
|
validateUnifiedOrderResponse(request, response);
|
||||||
return new PayOrderUnifiedRespDTO()
|
return new PayOrderUnifiedRespDTO(displayMode, "");
|
||||||
.setDisplayMode(displayMode).setDisplayContent("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ import javax.validation.constraints.NotBlank;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
// TODO 芋艿:参数校验
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付宝的 PayClientConfig 实现类
|
* 支付宝的 PayClientConfig 实现类
|
||||||
* 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性
|
* 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性
|
||||||
@ -111,7 +109,9 @@ public class AlipayPayClientConfig implements PayClientConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<ConstraintViolation<PayClientConfig>> verifyParam(Validator validator) {
|
public Set<ConstraintViolation<PayClientConfig>> verifyParam(Validator validator) {
|
||||||
|
// TODO 芋艿:参数校验
|
||||||
return validator.validate(this,
|
return validator.validate(this,
|
||||||
MODE_PUBLIC_KEY.equals(this.getMode()) ? ModePublicKey.class : ModeCertificate.class);
|
MODE_PUBLIC_KEY.equals(this.getMode()) ? ModePublicKey.class : ModeCertificate.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.http.Method;
|
import cn.hutool.http.Method;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.domain.AlipayTradePagePayModel;
|
import com.alipay.api.domain.AlipayTradePagePayModel;
|
||||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
@ -22,7 +22,7 @@ import java.util.Objects;
|
|||||||
* @author XGD
|
* @author XGD
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AlipayPcPayClient extends AbstractAlipayClient {
|
public class AlipayPcPayClient extends AbstractAlipayPayClient {
|
||||||
|
|
||||||
public AlipayPcPayClient(Long channelId, AlipayPayClientConfig config) {
|
public AlipayPcPayClient(Long channelId, AlipayPayClientConfig config) {
|
||||||
super(channelId, PayChannelEnum.ALIPAY_PC.getCode(), config);
|
super(channelId, PayChannelEnum.ALIPAY_PC.getCode(), config);
|
||||||
@ -44,7 +44,7 @@ public class AlipayPcPayClient extends AbstractAlipayClient {
|
|||||||
model.setQrPayMode("2"); // 跳转模式 - 订单码,效果参见:https://help.pingxx.com/article/1137360/
|
model.setQrPayMode("2"); // 跳转模式 - 订单码,效果参见:https://help.pingxx.com/article/1137360/
|
||||||
// ③ 支付宝 PC 支付有两种展示模式:FORM、URL
|
// ③ 支付宝 PC 支付有两种展示模式:FORM、URL
|
||||||
String displayMode = ObjectUtil.defaultIfNull(reqDTO.getDisplayMode(),
|
String displayMode = ObjectUtil.defaultIfNull(reqDTO.getDisplayMode(),
|
||||||
PayDisplayModeEnum.URL.getMode());
|
PayOrderDisplayModeEnum.URL.getMode());
|
||||||
|
|
||||||
// 1.2 构建 AlipayTradePagePayRequest 请求
|
// 1.2 构建 AlipayTradePagePayRequest 请求
|
||||||
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||||
@ -54,16 +54,14 @@ public class AlipayPcPayClient extends AbstractAlipayClient {
|
|||||||
|
|
||||||
// 2.1 执行请求
|
// 2.1 执行请求
|
||||||
AlipayTradePagePayResponse response;
|
AlipayTradePagePayResponse response;
|
||||||
if (Objects.equals(displayMode, PayDisplayModeEnum.FORM.getMode())) {
|
if (Objects.equals(displayMode, PayOrderDisplayModeEnum.FORM.getMode())) {
|
||||||
response = client.pageExecute(request, Method.POST.name()); // 需要特殊使用 POST 请求
|
response = client.pageExecute(request, Method.POST.name()); // 需要特殊使用 POST 请求
|
||||||
} else {
|
} else {
|
||||||
response = client.pageExecute(request, Method.GET.name());
|
response = client.pageExecute(request, Method.GET.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
validateSuccess(response);
|
validateUnifiedOrderResponse(request, response);
|
||||||
return new PayOrderUnifiedRespDTO().setDisplayMode(displayMode)
|
return new PayOrderUnifiedRespDTO(displayMode, response.getBody());
|
||||||
.setDisplayContent(response.getBody());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.domain.AlipayTradePrecreateModel;
|
import com.alipay.api.domain.AlipayTradePrecreateModel;
|
||||||
import com.alipay.api.request.AlipayTradePrecreateRequest;
|
import com.alipay.api.request.AlipayTradePrecreateRequest;
|
||||||
@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AlipayQrPayClient extends AbstractAlipayClient {
|
public class AlipayQrPayClient extends AbstractAlipayPayClient {
|
||||||
|
|
||||||
public AlipayQrPayClient(Long channelId, AlipayPayClientConfig config) {
|
public AlipayQrPayClient(Long channelId, AlipayPayClientConfig config) {
|
||||||
super(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config);
|
super(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config);
|
||||||
@ -36,7 +36,7 @@ public class AlipayQrPayClient extends AbstractAlipayClient {
|
|||||||
model.setProductCode("FACE_TO_FACE_PAYMENT"); // 销售产品码. 目前扫码支付场景下仅支持 FACE_TO_FACE_PAYMENT
|
model.setProductCode("FACE_TO_FACE_PAYMENT"); // 销售产品码. 目前扫码支付场景下仅支持 FACE_TO_FACE_PAYMENT
|
||||||
// ② 个性化的参数【无】
|
// ② 个性化的参数【无】
|
||||||
// ③ 支付宝扫码支付只有一种展示,考虑到前端可能希望二维码扫描后,手机打开
|
// ③ 支付宝扫码支付只有一种展示,考虑到前端可能希望二维码扫描后,手机打开
|
||||||
String displayMode = PayDisplayModeEnum.QR_CODE.getMode();
|
String displayMode = PayOrderDisplayModeEnum.QR_CODE.getMode();
|
||||||
|
|
||||||
// 1.2 构建 AlipayTradePrecreateRequest 请求
|
// 1.2 构建 AlipayTradePrecreateRequest 请求
|
||||||
AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
|
AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
|
||||||
@ -47,8 +47,8 @@ public class AlipayQrPayClient extends AbstractAlipayClient {
|
|||||||
// 2.1 执行请求
|
// 2.1 执行请求
|
||||||
AlipayTradePrecreateResponse response = client.execute(request);
|
AlipayTradePrecreateResponse response = client.execute(request);
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
validateSuccess(response);
|
validateUnifiedOrderResponse(request, response);
|
||||||
return new PayOrderUnifiedRespDTO()
|
return new PayOrderUnifiedRespDTO(displayMode, response.getQrCode());
|
||||||
.setDisplayMode(displayMode).setDisplayContent(response.getQrCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
|||||||
import cn.hutool.http.Method;
|
import cn.hutool.http.Method;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayDisplayModeEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.domain.AlipayTradeWapPayModel;
|
import com.alipay.api.domain.AlipayTradeWapPayModel;
|
||||||
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
||||||
@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AlipayWapPayClient extends AbstractAlipayClient {
|
public class AlipayWapPayClient extends AbstractAlipayPayClient {
|
||||||
|
|
||||||
public AlipayWapPayClient(Long channelId, AlipayPayClientConfig config) {
|
public AlipayWapPayClient(Long channelId, AlipayPayClientConfig config) {
|
||||||
super(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config);
|
super(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config);
|
||||||
@ -37,7 +37,7 @@ public class AlipayWapPayClient extends AbstractAlipayClient {
|
|||||||
model.setProductCode("QUICK_WAP_PAY"); // 销售产品码. 目前 Wap 支付场景下仅支持 QUICK_WAP_PAY
|
model.setProductCode("QUICK_WAP_PAY"); // 销售产品码. 目前 Wap 支付场景下仅支持 QUICK_WAP_PAY
|
||||||
// ② 个性化的参数【无】
|
// ② 个性化的参数【无】
|
||||||
// ③ 支付宝 Wap 支付只有一种展示:URL
|
// ③ 支付宝 Wap 支付只有一种展示:URL
|
||||||
String displayMode = PayDisplayModeEnum.URL.getMode();
|
String displayMode = PayOrderDisplayModeEnum.URL.getMode();
|
||||||
|
|
||||||
// 1.2 构建 AlipayTradeWapPayRequest 请求
|
// 1.2 构建 AlipayTradeWapPayRequest 请求
|
||||||
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
|
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
|
||||||
@ -50,9 +50,8 @@ public class AlipayWapPayClient extends AbstractAlipayClient {
|
|||||||
AlipayTradeWapPayResponse response = client.pageExecute(request, Method.GET.name());
|
AlipayTradeWapPayResponse response = client.pageExecute(request, Method.GET.name());
|
||||||
|
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
validateSuccess(response);
|
validateUnifiedOrderResponse(request, response);
|
||||||
return new PayOrderUnifiedRespDTO()
|
return new PayOrderUnifiedRespDTO(displayMode, response.getBody());
|
||||||
.setDisplayMode(displayMode).setDisplayContent(response.getBody());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,198 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.date.TemporalAccessorUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants;
|
||||||
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||||
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
||||||
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
import com.github.binarywang.wxpay.service.WxPayService;
|
||||||
|
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
|
||||||
|
import static cn.hutool.core.date.DatePattern.UTC_WITH_XXX_OFFSET_PATTERN;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付抽象类,实现微信统一的接口、以及部分实现(退款)
|
||||||
|
*
|
||||||
|
* @author 遇到源码
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public abstract class AbstractWxPayClient extends AbstractPayClient<WxPayClientConfig> {
|
||||||
|
|
||||||
|
protected WxPayService client;
|
||||||
|
|
||||||
|
public AbstractWxPayClient(Long channelId, String channelCode, WxPayClientConfig config) {
|
||||||
|
super(channelId, channelCode, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化 client 客户端
|
||||||
|
*
|
||||||
|
* @param tradeType 交易类型
|
||||||
|
*/
|
||||||
|
protected void doInit(String tradeType) {
|
||||||
|
// 创建 config 配置
|
||||||
|
WxPayConfig payConfig = new WxPayConfig();
|
||||||
|
BeanUtil.copyProperties(config, payConfig, "keyContent");
|
||||||
|
payConfig.setTradeType(tradeType);
|
||||||
|
if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
|
||||||
|
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
||||||
|
payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
|
||||||
|
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
||||||
|
payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建 client 客户端
|
||||||
|
client = new WxPayServiceImpl();
|
||||||
|
client.setConfig(payConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) throws Exception {
|
||||||
|
try {
|
||||||
|
switch (config.getApiVersion()) {
|
||||||
|
case WxPayClientConfig.API_VERSION_V2:
|
||||||
|
return doUnifiedOrderV2(reqDTO);
|
||||||
|
case WxPayClientConfig.API_VERSION_V3:
|
||||||
|
return doUnifiedOrderV3(reqDTO);
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
||||||
|
}
|
||||||
|
} catch (WxPayException e) {
|
||||||
|
throw buildUnifiedOrderException(reqDTO, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【V2】调用支付渠道,统一下单
|
||||||
|
*
|
||||||
|
* @param reqDTO 下单信息
|
||||||
|
* @return 各支付渠道的返回结果
|
||||||
|
*/
|
||||||
|
protected abstract PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO)
|
||||||
|
throws WxPayException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【V3】调用支付渠道,统一下单
|
||||||
|
*
|
||||||
|
* @param reqDTO 下单信息
|
||||||
|
* @return 各支付渠道的返回结果
|
||||||
|
*/
|
||||||
|
protected abstract PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO)
|
||||||
|
throws WxPayException;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object parseNotify(PayNotifyReqDTO rawNotify) {
|
||||||
|
log.info("[parseNotify][微信支付回调 data 数据: {}]", rawNotify.getBody());
|
||||||
|
try {
|
||||||
|
// 微信支付 v2 回调结果处理
|
||||||
|
switch (config.getApiVersion()) {
|
||||||
|
case WxPayClientConfig.API_VERSION_V2:
|
||||||
|
return parseOrderNotifyV2(rawNotify);
|
||||||
|
case WxPayClientConfig.API_VERSION_V3:
|
||||||
|
return parseOrderNotifyV3(rawNotify);
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
||||||
|
}
|
||||||
|
} catch (WxPayException e) {
|
||||||
|
log.error("[parseNotify][rawNotify({}) 解析失败]", toJsonString(rawNotify), e);
|
||||||
|
// throw buildPayException(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
// TODO 芋艿:缺一个异常翻译
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
|
||||||
|
WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
|
||||||
|
Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
|
||||||
|
// 转换结果
|
||||||
|
return PayOrderNotifyRespDTO
|
||||||
|
.builder()
|
||||||
|
.orderExtensionNo(notifyResult.getOutTradeNo())
|
||||||
|
.channelOrderNo(notifyResult.getTransactionId())
|
||||||
|
.channelUserId(notifyResult.getOpenid())
|
||||||
|
.successTime(parseDateV2(notifyResult.getTimeEnd()))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
|
||||||
|
WxPayOrderNotifyV3Result notifyResult = client.parseOrderNotifyV3Result(data.getBody(), null);
|
||||||
|
WxPayOrderNotifyV3Result.DecryptNotifyResult result = notifyResult.getResult();
|
||||||
|
// 转换结果
|
||||||
|
Assert.isTrue(Objects.equals(notifyResult.getResult().getTradeState(), "SUCCESS"),
|
||||||
|
"支付结果非 SUCCESS");
|
||||||
|
return PayOrderNotifyRespDTO.builder()
|
||||||
|
.orderExtensionNo(result.getOutTradeNo())
|
||||||
|
.channelOrderNo(result.getTradeState())
|
||||||
|
.channelUserId(result.getPayer() != null ? result.getPayer().getOpenid() : null)
|
||||||
|
.successTime(parseDateV3(result.getSuccessTime()))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 各种工具方法 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建统一下单的异常
|
||||||
|
*
|
||||||
|
* 目的:将参数不正确等异常,转换成 {@link cn.iocoder.yudao.framework.common.exception.ServiceException} 业务异常
|
||||||
|
*
|
||||||
|
* @param reqDTO 请求
|
||||||
|
* @param e 微信的支付异常
|
||||||
|
* @return 转换后的异常
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static Exception buildUnifiedOrderException(PayOrderUnifiedReqDTO reqDTO, WxPayException e) {
|
||||||
|
// 情况一:业务结果为 FAIL
|
||||||
|
if (Objects.equals(e.getResultCode(), "FAIL")) {
|
||||||
|
log.error("[buildUnifiedOrderException][request({}) 发起支付失败]", toJsonString(reqDTO), e);
|
||||||
|
if (Objects.equals(e.getErrCode(), "PARAM_ERROR")) {
|
||||||
|
throw invalidParamException(e.getErrCodeDes());
|
||||||
|
}
|
||||||
|
throw exception(PayFrameworkErrorCodeConstants.ORDER_UNIFIED_ERROR, e.getErrCodeDes());
|
||||||
|
}
|
||||||
|
// 情况二:状态码结果为 FAIL
|
||||||
|
if (Objects.equals(e.getReturnCode(), "FAIL")) {
|
||||||
|
throw exception(PayFrameworkErrorCodeConstants.ORDER_UNIFIED_ERROR, e.getReturnMsg());
|
||||||
|
}
|
||||||
|
// 情况三:系统异常,这里暂时不打,交给上层的 AbstractPayClient 统一打
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String formatDateV2(LocalDateTime time) {
|
||||||
|
return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), PURE_DATETIME_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
static LocalDateTime parseDateV2(String time) {
|
||||||
|
return LocalDateTimeUtil.parse(time, PURE_DATETIME_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String formatDateV3(LocalDateTime time) {
|
||||||
|
return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), UTC_WITH_XXX_OFFSET_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
static LocalDateTime parseDateV3(String time) {
|
||||||
|
return LocalDateTimeUtil.parse(time, UTC_WITH_XXX_OFFSET_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
|
||||||
|
// TODO 芋艿:未实现
|
||||||
|
public class WxAppPayClient extends AbstractWxPayClient {
|
||||||
|
|
||||||
|
public WxAppPayClient(Long channelId, WxPayClientConfig config) {
|
||||||
|
super(channelId, PayChannelEnum.WX_APP.getCode(), config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doInit() {
|
||||||
|
super.doInit(WxPayConstants.TradeType.APP);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum;
|
||||||
|
import com.github.binarywang.wxpay.bean.request.WxPayMicropayRequest;
|
||||||
|
import com.github.binarywang.wxpay.bean.result.WxPayMicropayResult;
|
||||||
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付【付款码支付】的 PayClient 实现类
|
||||||
|
*
|
||||||
|
* 文档:<a href="https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1">付款码支付</a>
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WxBarPayClient extends AbstractWxPayClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信付款码的过期时间
|
||||||
|
*/
|
||||||
|
private static final Duration AUTH_CODE_EXPIRE = Duration.ofMinutes(3);
|
||||||
|
|
||||||
|
public WxBarPayClient(Long channelId, WxPayClientConfig config) {
|
||||||
|
super(channelId, PayChannelEnum.WX_BAR.getCode(), config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doInit() {
|
||||||
|
super.doInit(WxPayConstants.TradeType.MICROPAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
// 由于付款码需要不断轮询,所以需要在较短的时间完成支付
|
||||||
|
LocalDateTime expireTime = LocalDateTimeUtils.addTime(AUTH_CODE_EXPIRE);
|
||||||
|
if (expireTime.isAfter(reqDTO.getExpireTime())) {
|
||||||
|
expireTime = reqDTO.getExpireTime();
|
||||||
|
}
|
||||||
|
// 构建 WxPayMicropayRequest 对象
|
||||||
|
WxPayMicropayRequest request = WxPayMicropayRequest.newBuilder()
|
||||||
|
.outTradeNo(reqDTO.getMerchantOrderId())
|
||||||
|
.body(reqDTO.getSubject())
|
||||||
|
.detail(reqDTO.getBody())
|
||||||
|
.totalFee(reqDTO.getAmount()) // 单位分
|
||||||
|
.timeExpire(formatDateV2(expireTime))
|
||||||
|
.spbillCreateIp(reqDTO.getUserIp())
|
||||||
|
.authCode(getAuthCode(reqDTO))
|
||||||
|
.build();
|
||||||
|
// 执行请求,重试直到失败(过期),或者成功
|
||||||
|
for (int i = 1; i < Byte.MAX_VALUE; i++) {
|
||||||
|
try {
|
||||||
|
WxPayMicropayResult response = client.micropay(request);
|
||||||
|
// 支付成功(例如说,用户输入了密码)
|
||||||
|
return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.BAR_CODE.getMode(),
|
||||||
|
JsonUtils.toJsonString(response),
|
||||||
|
PayOrderStatusRespEnum.SUCCESS.getStatus());
|
||||||
|
} catch (WxPayException ex) {
|
||||||
|
// 如果不满足这 3 种任一的,则直接抛出 WxPayException 异常,不仅需处理
|
||||||
|
// 1. SYSTEMERROR:接口返回错误:请立即调用被扫订单结果查询API,查询当前订单状态,并根据订单的状态决定下一步的操作。
|
||||||
|
// 2. USERPAYING:用户支付中,需要输入密码:等待 5 秒,然后调用被扫订单结果查询 API,查询当前订单的不同状态,决定下一步的操作。
|
||||||
|
// 3. BANKERROR:银行系统异常:请立即调用被扫订单结果查询 API,查询当前订单的不同状态,决定下一步的操作。
|
||||||
|
if (!StrUtil.equalsAny(ex.getErrCode(), "SYSTEMERROR", "USERPAYING", "BANKERROR")) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
// 等待 5 秒,继续下一轮重新发起支付
|
||||||
|
log.info("[doUnifiedOrderV2][发起微信 Bar 支付第({})失败,等待下一轮重试,请求({}),响应({})]", i,
|
||||||
|
JsonUtils.toJsonString(request), ex.getMessage());
|
||||||
|
ThreadUtil.sleep(5, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("微信 Bar 支付,重试多次失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
return doUnifiedOrderV2(reqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 各种工具方法 ==========
|
||||||
|
|
||||||
|
static String getAuthCode(PayOrderUnifiedReqDTO reqDTO) {
|
||||||
|
String authCode = MapUtil.getStr(reqDTO.getChannelExtras(), "authCode");
|
||||||
|
if (StrUtil.isEmpty(authCode)) {
|
||||||
|
throw invalidParamException("支付请求的 authCode 不能为空!");
|
||||||
|
}
|
||||||
|
return authCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
|
||||||
|
// TODO 芋艿:未实现
|
||||||
|
public class WxH5PayClient extends AbstractWxPayClient {
|
||||||
|
|
||||||
|
public WxH5PayClient(Long channelId, WxPayClientConfig config) {
|
||||||
|
super(channelId, PayChannelEnum.WX_H5.getCode(), config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doInit() {
|
||||||
|
super.doInit(WxPayConstants.TradeType.MWEB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付【小程序】的 PayClient 实现类
|
||||||
|
*
|
||||||
|
* 由于公众号和小程序的微信支付逻辑一致,所以直接进行继承
|
||||||
|
*
|
||||||
|
* 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_1.shtml">JSAPI 下单</>
|
||||||
|
*
|
||||||
|
* @author zwy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WxLitePayClient extends WxPubPayClient {
|
||||||
|
|
||||||
|
public WxLitePayClient(Long channelId, WxPayClientConfig config) {
|
||||||
|
super(channelId, PayChannelEnum.WX_LITE.getCode(), config);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
|
import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
|
||||||
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||||
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
|
||||||
|
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
|
||||||
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付【Native 二维码】的 PayClient 实现类
|
||||||
|
*
|
||||||
|
* 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml">Native 下单</a>
|
||||||
|
*
|
||||||
|
* @author zwy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WxNativePayClient extends AbstractWxPayClient {
|
||||||
|
|
||||||
|
public WxNativePayClient(Long channelId, WxPayClientConfig config) {
|
||||||
|
super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doInit() {
|
||||||
|
super.doInit(WxPayConstants.TradeType.NATIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
// 构建 WxPayUnifiedOrderRequest 对象
|
||||||
|
WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
|
||||||
|
.outTradeNo(reqDTO.getMerchantOrderId())
|
||||||
|
.body(reqDTO.getSubject())
|
||||||
|
.detail(reqDTO.getBody())
|
||||||
|
.totalFee(reqDTO.getAmount()) // 单位分
|
||||||
|
.productId(reqDTO.getMerchantOrderId())
|
||||||
|
.timeExpire(formatDateV2(reqDTO.getExpireTime()))
|
||||||
|
.spbillCreateIp(reqDTO.getUserIp())
|
||||||
|
.notifyUrl(reqDTO.getNotifyUrl())
|
||||||
|
.build();
|
||||||
|
// 执行请求
|
||||||
|
WxPayNativeOrderResult response = client.createOrder(request);
|
||||||
|
|
||||||
|
// 转换结果
|
||||||
|
return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.QR_CODE_URL.getMode(),
|
||||||
|
response.getCodeUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
// 构建 WxPayUnifiedOrderRequest 对象
|
||||||
|
WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
|
||||||
|
request.setOutTradeNo(reqDTO.getMerchantOrderId());
|
||||||
|
request.setDescription(reqDTO.getBody());
|
||||||
|
request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount())); // 单位分
|
||||||
|
request.setTimeExpire(formatDateV3(reqDTO.getExpireTime()));
|
||||||
|
request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
|
||||||
|
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
||||||
|
// 执行请求
|
||||||
|
WxPayNativeOrderResult response = client.createOrderV3(TradeTypeEnum.NATIVE, request);
|
||||||
|
|
||||||
|
// 转换结果
|
||||||
|
return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.QR_CODE_URL.getMode(),
|
||||||
|
response.getCodeUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
||||||
@ -18,23 +18,26 @@ import java.util.Set;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class WXPayClientConfig implements PayClientConfig {
|
public class WxPayClientConfig implements PayClientConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 版本 - V2
|
* API 版本 - V2
|
||||||
* https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_1
|
*
|
||||||
|
* <a href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_1">V2 协议说明</a>
|
||||||
*/
|
*/
|
||||||
public static final String API_VERSION_V2 = "v2";
|
public static final String API_VERSION_V2 = "v2";
|
||||||
/**
|
/**
|
||||||
* API 版本 - V3
|
* API 版本 - V3
|
||||||
* https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay-1.shtml
|
*
|
||||||
|
* <a href="https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay-1.shtml">V3 协议说明</a>
|
||||||
*/
|
*/
|
||||||
public static final String API_VERSION_V3 = "v3";
|
public static final String API_VERSION_V3 = "v3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公众号或者小程序的 appid
|
* 公众号或者小程序的 appid
|
||||||
|
*
|
||||||
|
* 只有公众号或小程序需要该字段
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "APPID 不能为空", groups = {V2.class, V3.class})
|
|
||||||
private String appId;
|
private String appId;
|
||||||
/**
|
/**
|
||||||
* 商户号
|
* 商户号
|
@ -0,0 +1,102 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.weixin;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
||||||
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||||
|
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
|
||||||
|
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
|
||||||
|
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
|
||||||
|
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
||||||
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.invalidParamException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付(公众号)的 PayClient 实现类
|
||||||
|
*
|
||||||
|
* 文档:<a href="https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml">JSAPI 下单</>
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WxPubPayClient extends AbstractWxPayClient {
|
||||||
|
|
||||||
|
public WxPubPayClient(Long channelId, WxPayClientConfig config) {
|
||||||
|
super(channelId, PayChannelEnum.WX_PUB.getCode(), config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WxPubPayClient(Long channelId, String channelCode, WxPayClientConfig config) {
|
||||||
|
super(channelId, channelCode, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doInit() {
|
||||||
|
super.doInit(WxPayConstants.TradeType.JSAPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
// 构建 WxPayUnifiedOrderRequest 对象
|
||||||
|
WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
|
||||||
|
.outTradeNo(reqDTO.getMerchantOrderId())
|
||||||
|
.body(reqDTO.getSubject())
|
||||||
|
.detail(reqDTO.getBody())
|
||||||
|
.totalFee(reqDTO.getAmount()) // 单位分
|
||||||
|
.timeExpire(formatDateV2(reqDTO.getExpireTime()))
|
||||||
|
.spbillCreateIp(reqDTO.getUserIp())
|
||||||
|
.openid(getOpenid(reqDTO))
|
||||||
|
.notifyUrl(reqDTO.getNotifyUrl())
|
||||||
|
.build();
|
||||||
|
// 执行请求
|
||||||
|
WxPayMpOrderResult response = client.createOrder(request);
|
||||||
|
|
||||||
|
// 转换结果
|
||||||
|
return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.CUSTOM.getMode(),
|
||||||
|
JsonUtils.toJsonString(response));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayOrderUnifiedRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
||||||
|
// 构建 WxPayUnifiedOrderRequest 对象
|
||||||
|
WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
|
||||||
|
request.setOutTradeNo(reqDTO.getMerchantOrderId());
|
||||||
|
request.setDescription(reqDTO.getSubject());
|
||||||
|
request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount())); // 单位分
|
||||||
|
request.setTimeExpire(formatDateV3(reqDTO.getExpireTime()));
|
||||||
|
request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO)));
|
||||||
|
request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
|
||||||
|
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
||||||
|
// 执行请求
|
||||||
|
WxPayUnifiedOrderV3Result.JsapiResult response = client.createOrderV3(TradeTypeEnum.JSAPI, request);
|
||||||
|
|
||||||
|
// 转换结果
|
||||||
|
return new PayOrderUnifiedRespDTO(PayOrderDisplayModeEnum.CUSTOM.getMode(),
|
||||||
|
JsonUtils.toJsonString(response));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
||||||
|
// TODO 需要实现
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 各种工具方法 ==========
|
||||||
|
|
||||||
|
static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
|
||||||
|
String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
|
||||||
|
if (StrUtil.isEmpty(openid)) {
|
||||||
|
throw invalidParamException("支付请求的 openid 不能为空!");
|
||||||
|
}
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,198 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
|
||||||
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
||||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
||||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
|
|
||||||
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
|
|
||||||
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
|
|
||||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
||||||
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
|
||||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
||||||
import com.github.binarywang.wxpay.service.WxPayService;
|
|
||||||
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信小程序下支付
|
|
||||||
*
|
|
||||||
* @author zwy
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class WXLitePayClient extends AbstractPayClient<WXPayClientConfig> {
|
|
||||||
|
|
||||||
private WxPayService client;
|
|
||||||
|
|
||||||
public WXLitePayClient(Long channelId, WXPayClientConfig config) {
|
|
||||||
super(channelId, PayChannelEnum.WX_LITE.getCode(), config);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doInit() {
|
|
||||||
WxPayConfig payConfig = new WxPayConfig();
|
|
||||||
BeanUtil.copyProperties(config, payConfig, "privateKeyContent","privateCertContent");
|
|
||||||
payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式
|
|
||||||
// if (StrUtil.isNotEmpty(config.getKeyContent())) {
|
|
||||||
// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8));
|
|
||||||
// }
|
|
||||||
if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
|
|
||||||
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
|
||||||
payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
|
|
||||||
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
|
||||||
payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
|
|
||||||
}
|
|
||||||
// 真实客户端
|
|
||||||
this.client = new WxPayServiceImpl();
|
|
||||||
client.setConfig(payConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
// WxPayMpOrderResult response;
|
|
||||||
// try {
|
|
||||||
// switch (config.getApiVersion()) {
|
|
||||||
// case WXPayClientConfig.API_VERSION_V2:
|
|
||||||
// response = this.unifiedOrderV2(reqDTO);
|
|
||||||
// break;
|
|
||||||
// case WXPayClientConfig.API_VERSION_V3:
|
|
||||||
// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
|
|
||||||
// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
|
|
||||||
// response = new WxPayMpOrderResult();
|
|
||||||
// BeanUtil.copyProperties(responseV3, response, true);
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
|
||||||
// }
|
|
||||||
// } catch (WxPayException e) {
|
|
||||||
// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
|
|
||||||
// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
|
|
||||||
// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
|
|
||||||
// }
|
|
||||||
// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
|
||||||
// 构建 WxPayUnifiedOrderRequest 对象
|
|
||||||
WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
|
|
||||||
.outTradeNo(reqDTO.getMerchantOrderId())
|
|
||||||
.body(reqDTO.getBody())
|
|
||||||
.totalFee(reqDTO.getAmount().intValue()) // 单位分
|
|
||||||
.timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyyMMddHHmmss")) // v2的时间格式
|
|
||||||
.spbillCreateIp(reqDTO.getUserIp())
|
|
||||||
.openid(getOpenid(reqDTO))
|
|
||||||
.notifyUrl(reqDTO.getNotifyUrl())
|
|
||||||
.build();
|
|
||||||
// 执行请求
|
|
||||||
return client.createOrder(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private WxPayUnifiedOrderV3Result.JsapiResult unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
|
||||||
// 构建 WxPayUnifiedOrderRequest 对象
|
|
||||||
WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
|
|
||||||
request.setOutTradeNo(reqDTO.getMerchantOrderId());
|
|
||||||
|
|
||||||
request.setDescription(reqDTO.getBody());
|
|
||||||
request.setAmount(new WxPayUnifiedOrderV3Request
|
|
||||||
.Amount()
|
|
||||||
.setTotal(reqDTO
|
|
||||||
.getAmount()
|
|
||||||
.intValue())); // 单位分
|
|
||||||
request.setTimeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式
|
|
||||||
request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO)));
|
|
||||||
request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
|
|
||||||
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
|
||||||
// 执行请求
|
|
||||||
return client.createOrderV3(TradeTypeEnum.JSAPI, request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
|
|
||||||
String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
|
|
||||||
if (StrUtil.isEmpty(openid)) {
|
|
||||||
throw new IllegalArgumentException("支付请求的 openid 不能为空!");
|
|
||||||
}
|
|
||||||
return openid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 微信支付回调 分 v2 和v3 的处理方式
|
|
||||||
*
|
|
||||||
* @param data 通知结果
|
|
||||||
* @return 支付回调对象
|
|
||||||
* @throws WxPayException 微信异常类
|
|
||||||
*/
|
|
||||||
// @Override
|
|
||||||
public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
log.info("[parseOrderNotify][微信支付回调data数据:{}]", data.getBody());
|
|
||||||
// 微信支付 v2 回调结果处理
|
|
||||||
switch (config.getApiVersion()) {
|
|
||||||
case WXPayClientConfig.API_VERSION_V2:
|
|
||||||
return parseOrderNotifyV2(data);
|
|
||||||
case WXPayClientConfig.API_VERSION_V3:
|
|
||||||
return parseOrderNotifyV3(data);
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null);
|
|
||||||
WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult();
|
|
||||||
// 转换结果
|
|
||||||
Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"),
|
|
||||||
"支付结果非 SUCCESS");
|
|
||||||
|
|
||||||
return PayOrderNotifyRespDTO
|
|
||||||
.builder()
|
|
||||||
.orderExtensionNo(result.getOutTradeNo())
|
|
||||||
.channelOrderNo(result.getTransactionId())
|
|
||||||
.channelUserId(result.getPayer().getOpenid())
|
|
||||||
.successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX"))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
|
|
||||||
Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
|
|
||||||
// 转换结果
|
|
||||||
return PayOrderNotifyRespDTO
|
|
||||||
.builder()
|
|
||||||
.orderExtensionNo(notifyResult.getOutTradeNo())
|
|
||||||
.channelOrderNo(notifyResult.getTransactionId())
|
|
||||||
.channelUserId(notifyResult.getOpenid())
|
|
||||||
.successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
|
||||||
//TODO 需要实现
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,181 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
|
||||||
import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
|
|
||||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
||||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
|
|
||||||
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
|
|
||||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
||||||
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
|
||||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
||||||
import com.github.binarywang.wxpay.service.WxPayService;
|
|
||||||
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信 App 支付
|
|
||||||
*
|
|
||||||
* @author zwy
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class WXNativePayClient extends AbstractPayClient<WXPayClientConfig> {
|
|
||||||
|
|
||||||
private WxPayService client;
|
|
||||||
|
|
||||||
public WXNativePayClient(Long channelId, WXPayClientConfig config) {
|
|
||||||
super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doInit() {
|
|
||||||
WxPayConfig payConfig = new WxPayConfig();
|
|
||||||
BeanUtil.copyProperties(config, payConfig, "keyContent");
|
|
||||||
payConfig.setTradeType(WxPayConstants.TradeType.NATIVE); // 设置使用 native 支付方式
|
|
||||||
// if (StrUtil.isNotEmpty(config.getKeyContent())) {
|
|
||||||
// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8));
|
|
||||||
// }
|
|
||||||
if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
|
|
||||||
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
|
||||||
payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
|
|
||||||
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
|
||||||
payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
|
|
||||||
}
|
|
||||||
// 真实客户端
|
|
||||||
this.client = new WxPayServiceImpl();
|
|
||||||
client.setConfig(payConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
// // 这里原生的返回的是支付的 url 所以直接使用string接收
|
|
||||||
// // "invokeResponse": "weixin://wxpay/bizpayurl?pr=EGYAem7zz"
|
|
||||||
// String responseV3;
|
|
||||||
// try {
|
|
||||||
// switch (config.getApiVersion()) {
|
|
||||||
// case WXPayClientConfig.API_VERSION_V2:
|
|
||||||
// responseV3 = unifiedOrderV2(reqDTO).getCodeUrl();
|
|
||||||
// break;
|
|
||||||
// case WXPayClientConfig.API_VERSION_V3:
|
|
||||||
// responseV3 = this.unifiedOrderV3(reqDTO);
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
|
||||||
// }
|
|
||||||
// } catch (WxPayException e) {
|
|
||||||
// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
|
|
||||||
// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
|
|
||||||
// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
|
|
||||||
// }
|
|
||||||
// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, responseV3, codeMapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
private WxPayNativeOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
|
||||||
//前端
|
|
||||||
String tradeType = reqDTO.getChannelExtras().get("trade_type");
|
|
||||||
// 构建 WxPayUnifiedOrderRequest 对象
|
|
||||||
WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest
|
|
||||||
.newBuilder()
|
|
||||||
.outTradeNo(reqDTO.getMerchantOrderId())
|
|
||||||
.body(reqDTO.getBody())
|
|
||||||
.totalFee(reqDTO.getAmount().intValue()) // 单位分
|
|
||||||
.timeExpire(DateUtil.format(Date.from(reqDTO.getExpireTime().atZone(ZoneId.systemDefault()).toInstant()), "yyyy-MM-dd'T'HH:mm:ssXXX"))
|
|
||||||
.spbillCreateIp(reqDTO.getUserIp())
|
|
||||||
.notifyUrl(reqDTO.getNotifyUrl())
|
|
||||||
.productId(tradeType)
|
|
||||||
.build();
|
|
||||||
// 执行请求
|
|
||||||
return client.createOrder(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
|
||||||
// 构建 WxPayUnifiedOrderRequest 对象
|
|
||||||
WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
|
|
||||||
request.setOutTradeNo(reqDTO.getMerchantOrderId());
|
|
||||||
request.setDescription(reqDTO.getBody());
|
|
||||||
request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount().intValue())); // 单位分
|
|
||||||
request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
|
|
||||||
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
|
||||||
// 执行请求
|
|
||||||
return client.createOrderV3(TradeTypeEnum.NATIVE, request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 微信支付回调 分v2 和v3 的处理方式
|
|
||||||
*
|
|
||||||
* @param data 通知结果
|
|
||||||
* @return 支付回调对象
|
|
||||||
* @throws WxPayException 微信异常类
|
|
||||||
*/
|
|
||||||
// @Override
|
|
||||||
public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
log.info("微信支付回调data数据:{}", data.getBody());
|
|
||||||
// 微信支付 v2 回调结果处理
|
|
||||||
switch (config.getApiVersion()) {
|
|
||||||
case WXPayClientConfig.API_VERSION_V2:
|
|
||||||
return parseOrderNotifyV2(data);
|
|
||||||
case WXPayClientConfig.API_VERSION_V3:
|
|
||||||
return parseOrderNotifyV3(data);
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null);
|
|
||||||
WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult();
|
|
||||||
// 转换结果
|
|
||||||
Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"),
|
|
||||||
"支付结果非 SUCCESS");
|
|
||||||
return PayOrderNotifyRespDTO
|
|
||||||
.builder()
|
|
||||||
.orderExtensionNo(result.getOutTradeNo())
|
|
||||||
.channelOrderNo(result.getTradeState())
|
|
||||||
.successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX"))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
|
|
||||||
Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
|
|
||||||
// 转换结果
|
|
||||||
return PayOrderNotifyRespDTO
|
|
||||||
.builder()
|
|
||||||
.orderExtensionNo(notifyResult.getOutTradeNo())
|
|
||||||
.channelOrderNo(notifyResult.getTransactionId())
|
|
||||||
.channelUserId(notifyResult.getOpenid())
|
|
||||||
.successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
|
||||||
// TODO 需要实现
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,196 +0,0 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
||||||
import cn.hutool.core.date.TemporalAccessorUtil;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
||||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result;
|
|
||||||
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
||||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
||||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request;
|
|
||||||
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
|
|
||||||
import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum;
|
|
||||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
||||||
import com.github.binarywang.wxpay.constant.WxPayConstants;
|
|
||||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
|
||||||
import com.github.binarywang.wxpay.service.WxPayService;
|
|
||||||
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信支付(公众号)的 PayClient 实现类
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> {
|
|
||||||
|
|
||||||
private WxPayService client;
|
|
||||||
|
|
||||||
public WXPubPayClient(Long channelId, WXPayClientConfig config) {
|
|
||||||
super(channelId, PayChannelEnum.WX_PUB.getCode(), config);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doInit() {
|
|
||||||
WxPayConfig payConfig = new WxPayConfig();
|
|
||||||
BeanUtil.copyProperties(config, payConfig, "keyContent");
|
|
||||||
payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式
|
|
||||||
// if (StrUtil.isNotEmpty(config.getKeyContent())) {
|
|
||||||
// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8));
|
|
||||||
// }
|
|
||||||
if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) {
|
|
||||||
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
|
||||||
payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(config.getPrivateCertContent())) {
|
|
||||||
// weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决
|
|
||||||
payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath());
|
|
||||||
}
|
|
||||||
// 真实客户端
|
|
||||||
this.client = new WxPayServiceImpl();
|
|
||||||
client.setConfig(payConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
//
|
|
||||||
// WxPayMpOrderResult response;
|
|
||||||
// try {
|
|
||||||
// switch (config.getApiVersion()) {
|
|
||||||
// case WXPayClientConfig.API_VERSION_V2:
|
|
||||||
// response = this.unifiedOrderV2(reqDTO);
|
|
||||||
// break;
|
|
||||||
// case WXPayClientConfig.API_VERSION_V3:
|
|
||||||
// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
|
|
||||||
// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
|
|
||||||
// response = new WxPayMpOrderResult();
|
|
||||||
// BeanUtil.copyProperties(responseV3, response, true);
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
|
||||||
// }
|
|
||||||
// } catch (WxPayException e) {
|
|
||||||
// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
|
|
||||||
// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
|
|
||||||
// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping);
|
|
||||||
// }
|
|
||||||
// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
|
||||||
// 构建 WxPayUnifiedOrderRequest 对象
|
|
||||||
WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder()
|
|
||||||
.outTradeNo(reqDTO.getMerchantOrderId())
|
|
||||||
.body(reqDTO.getBody())
|
|
||||||
.totalFee(reqDTO.getAmount()) // 单位分
|
|
||||||
.timeExpire(formatDate(reqDTO.getExpireTime()))
|
|
||||||
.spbillCreateIp(reqDTO.getUserIp())
|
|
||||||
.openid(getOpenid(reqDTO))
|
|
||||||
.notifyUrl(reqDTO.getNotifyUrl())
|
|
||||||
.build();
|
|
||||||
// 执行请求
|
|
||||||
return client.createOrder(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private WxPayUnifiedOrderV3Result.JsapiResult unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
|
|
||||||
// 构建 WxPayUnifiedOrderRequest 对象
|
|
||||||
WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request();
|
|
||||||
request.setOutTradeNo(reqDTO.getMerchantOrderId());
|
|
||||||
request.setDescription(reqDTO.getBody());
|
|
||||||
request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount())); // 单位分
|
|
||||||
request.setTimeExpire(formatDate(reqDTO.getExpireTime()));
|
|
||||||
request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO)));
|
|
||||||
request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp()));
|
|
||||||
request.setNotifyUrl(reqDTO.getNotifyUrl());
|
|
||||||
// 执行请求
|
|
||||||
return client.createOrderV3(TradeTypeEnum.JSAPI, request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) {
|
|
||||||
String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid");
|
|
||||||
if (StrUtil.isEmpty(openid)) {
|
|
||||||
throw new IllegalArgumentException("支付请求的 openid 不能为空!");
|
|
||||||
}
|
|
||||||
return openid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 微信支付回调 分v2 和v3 的处理方式
|
|
||||||
*
|
|
||||||
* @param data 通知结果
|
|
||||||
* @return 支付回调对象
|
|
||||||
* @throws WxPayException 微信异常类
|
|
||||||
*/
|
|
||||||
// @Override
|
|
||||||
public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
log.info("[parseOrderNotify][微信支付回调data数据: {}]", data.getBody());
|
|
||||||
// 微信支付 v2 回调结果处理
|
|
||||||
switch (config.getApiVersion()) {
|
|
||||||
case WXPayClientConfig.API_VERSION_V2:
|
|
||||||
return parseOrderNotifyV2(data);
|
|
||||||
case WXPayClientConfig.API_VERSION_V3:
|
|
||||||
return parseOrderNotifyV3(data);
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null);
|
|
||||||
WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult();
|
|
||||||
// 转换结果
|
|
||||||
Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"),
|
|
||||||
"支付结果非 SUCCESS");
|
|
||||||
return PayOrderNotifyRespDTO
|
|
||||||
.builder()
|
|
||||||
.orderExtensionNo(result.getOutTradeNo())
|
|
||||||
.channelOrderNo(result.getTradeState())
|
|
||||||
.successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX"))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyReqDTO data) throws WxPayException {
|
|
||||||
WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody());
|
|
||||||
Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS");
|
|
||||||
// 转换结果
|
|
||||||
return PayOrderNotifyRespDTO
|
|
||||||
.builder()
|
|
||||||
.orderExtensionNo(notifyResult.getOutTradeNo())
|
|
||||||
.channelOrderNo(notifyResult.getTransactionId())
|
|
||||||
.channelUserId(notifyResult.getOpenid())
|
|
||||||
.successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
|
|
||||||
// TODO 需要实现
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String formatDate(LocalDateTime time) {
|
|
||||||
return TemporalAccessorUtil.format(time.atZone(ZoneId.systemDefault()), "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -11,19 +11,6 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|||||||
*/
|
*/
|
||||||
public interface PayFrameworkErrorCodeConstants {
|
public interface PayFrameworkErrorCodeConstants {
|
||||||
|
|
||||||
ErrorCode PAY_UNKNOWN = new ErrorCode(2002000000, "未知错误,需要解析");
|
ErrorCode ORDER_UNIFIED_ERROR = new ErrorCode(2002000000, "发起支付失败,原因:{}");
|
||||||
|
|
||||||
// ========== 配置相关相关 2002000100 ==========
|
|
||||||
// todo 芋艿:如下的错误码,怎么处理掉
|
|
||||||
ErrorCode PAY_CONFIG_APP_ID_ERROR = new ErrorCode(2002000100, "支付渠道 AppId 不正确");
|
|
||||||
ErrorCode PAY_CONFIG_SIGN_ERROR = new ErrorCode(2002000100, "签名错误"); // 例如说,微信支付,配置错了 mchId 或者 mchKey
|
|
||||||
|
|
||||||
|
|
||||||
// ========== 其它相关 2002000900 开头 ==========
|
|
||||||
// todo 芋艿:如下的错误码,怎么处理掉
|
|
||||||
ErrorCode PAY_OPENID_ERROR = new ErrorCode(2002000900, "无效的 openid"); // 例如说,微信 openid 未授权过
|
|
||||||
ErrorCode PAY_PARAM_MISSING = new ErrorCode(2002000901, "请求参数缺失"); // 例如说,支付少传了金额
|
|
||||||
|
|
||||||
ErrorCode PAY_EXCEPTION = new ErrorCode(2002000999, "调用异常");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.enums;
|
package cn.iocoder.yudao.framework.pay.core.enums.channel;
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付渠道的编码的枚举
|
* 支付渠道的编码的枚举
|
||||||
* 枚举值
|
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@ -17,10 +16,12 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum PayChannelEnum {
|
public enum PayChannelEnum {
|
||||||
|
|
||||||
WX_PUB("wx_pub", "微信 JSAPI 支付", WXPayClientConfig.class), // 公众号网页
|
WX_PUB("wx_pub", "微信 JSAPI 支付", WxPayClientConfig.class), // 公众号网页
|
||||||
WX_LITE("wx_lite", "微信小程序支付", WXPayClientConfig.class),
|
WX_LITE("wx_lite", "微信小程序支付", WxPayClientConfig.class),
|
||||||
WX_APP("wx_app", "微信 App 支付", WXPayClientConfig.class),
|
WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class),
|
||||||
WX_NATIVE("wx_native", "微信 native 支付", WXPayClientConfig.class),
|
WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class),
|
||||||
|
WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class),
|
||||||
|
WX_H5("wx_h5", "微信 H5 支付", WxPayClientConfig.class),
|
||||||
|
|
||||||
ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class),
|
ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class),
|
||||||
ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class),
|
ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class),
|
||||||
@ -30,8 +31,8 @@ public enum PayChannelEnum {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 编码
|
* 编码
|
||||||
* <p>
|
*
|
||||||
* 参考 https://www.pingxx.com/api/支付渠道属性值.html
|
* 参考 <a href="https://www.pingxx.com/api/支付渠道属性值.html">支付渠道属性值</a>
|
||||||
*/
|
*/
|
||||||
private final String code;
|
private final String code;
|
||||||
/**
|
/**
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.enums;
|
package cn.iocoder.yudao.framework.pay.core.enums.order;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -10,15 +10,16 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum PayDisplayModeEnum {
|
public enum PayOrderDisplayModeEnum {
|
||||||
|
|
||||||
URL("url"), // Redirect 跳转链接的方式
|
URL("url"), // Redirect 跳转链接的方式
|
||||||
IFRAME("iframe"), // IFrame 内嵌链接的方式
|
IFRAME("iframe"), // IFrame 内嵌链接的方式【目前暂时用不到】
|
||||||
FORM("form"), // HTML 表单提交
|
FORM("form"), // HTML 表单提交
|
||||||
QR_CODE("qr_code"), // 二维码的文字内容
|
QR_CODE("qr_code"), // 二维码的文字内容
|
||||||
QR_CODE_URL("qr_code_url"), // 二维码的图片链接
|
QR_CODE_URL("qr_code_url"), // 二维码的图片链接
|
||||||
BAR_CODE("bar_code"), // 条形码
|
BAR_CODE("bar_code"), // 条形码
|
||||||
APP("app"), // 应用
|
APP("app"), // 应用【目前暂时用不到】
|
||||||
|
CUSTOM("custom"), // 自定义:每种支付方式,做个性化处理;例如说,微信公众号支付时,调用 JSAPI 接口
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.framework.pay.core.enums.order;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道的支付状态枚举
|
||||||
|
*
|
||||||
|
* @author 遇到源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayOrderStatusRespEnum {
|
||||||
|
|
||||||
|
WAITING(0, "未支付"),
|
||||||
|
SUCCESS(10, "支付成功"),
|
||||||
|
CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款
|
||||||
|
;
|
||||||
|
|
||||||
|
private final Integer status;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.enums;
|
package cn.iocoder.yudao.framework.pay.core.enums.refund;
|
||||||
|
|
||||||
|
// TODO 芋艿:看看能不能去掉
|
||||||
/**
|
/**
|
||||||
* 退款通知, 统一的渠道退款状态
|
* 退款通知, 统一的渠道退款状态
|
||||||
*
|
*
|
@ -1,16 +1,16 @@
|
|||||||
package cn.iocoder.yudao.framework.pay.core.enums;
|
package cn.iocoder.yudao.framework.pay.core.enums.refund;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渠道统一的退款返回结果
|
* 渠道的退款状态枚举
|
||||||
*
|
*
|
||||||
* @author jason
|
* @author jason
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum PayChannelRefundRespEnum {
|
public enum PayRefundRespEnum {
|
||||||
|
|
||||||
SUCCESS(1, "退款成功"),
|
SUCCESS(1, "退款成功"),
|
||||||
FAILURE(2, "退款失败"),
|
FAILURE(2, "退款失败"),
|
@ -2,17 +2,14 @@ package cn.iocoder.yudao.framework.pay.core.client.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClient;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient;
|
import cn.iocoder.yudao.framework.pay.core.client.impl.weixin.WxPubPayClient;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import com.alipay.api.response.AlipayTradePrecreateResponse;
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -30,15 +27,15 @@ public class PayClientFactoryImplIntegrationTest {
|
|||||||
private final PayClientFactoryImpl payClientFactory = new PayClientFactoryImpl();
|
private final PayClientFactoryImpl payClientFactory = new PayClientFactoryImpl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link WXPubPayClient} 的 V2 版本
|
* {@link WxPubPayClient} 的 V2 版本
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePayClient_WX_PUB_V2() {
|
public void testCreatePayClient_WX_PUB_V2() {
|
||||||
// 创建配置
|
// 创建配置
|
||||||
WXPayClientConfig config = new WXPayClientConfig();
|
WxPayClientConfig config = new WxPayClientConfig();
|
||||||
config.setAppId("wx041349c6f39b268b");
|
config.setAppId("wx041349c6f39b268b");
|
||||||
config.setMchId("1545083881");
|
config.setMchId("1545083881");
|
||||||
config.setApiVersion(WXPayClientConfig.API_VERSION_V2);
|
config.setApiVersion(WxPayClientConfig.API_VERSION_V2);
|
||||||
config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p");
|
config.setMchKey("0alL64UDQdlCwiKZ73ib7ypaIjMns06p");
|
||||||
// 创建客户端
|
// 创建客户端
|
||||||
Long channelId = RandomUtil.randomLong();
|
Long channelId = RandomUtil.randomLong();
|
||||||
@ -51,15 +48,15 @@ public class PayClientFactoryImplIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link WXPubPayClient} 的 V3 版本
|
* {@link WxPubPayClient} 的 V3 版本
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePayClient_WX_PUB_V3() throws FileNotFoundException {
|
public void testCreatePayClient_WX_PUB_V3() throws FileNotFoundException {
|
||||||
// 创建配置
|
// 创建配置
|
||||||
WXPayClientConfig config = new WXPayClientConfig();
|
WxPayClientConfig config = new WxPayClientConfig();
|
||||||
config.setAppId("wx041349c6f39b268b");
|
config.setAppId("wx041349c6f39b268b");
|
||||||
config.setMchId("1545083881");
|
config.setMchId("1545083881");
|
||||||
config.setApiVersion(WXPayClientConfig.API_VERSION_V3);
|
config.setApiVersion(WxPayClientConfig.API_VERSION_V3);
|
||||||
config.setPrivateKeyContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_key.pem")));
|
config.setPrivateKeyContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_key.pem")));
|
||||||
config.setPrivateCertContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem")));
|
config.setPrivateCertContent(IoUtil.readUtf8(new FileInputStream("/Users/yunai/Downloads/wx_pay/apiclient_cert.pem")));
|
||||||
config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase");
|
config.setApiV3Key("joerVi8y5DJ3o4ttA0o1uH47Xz1u2Ase");
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
|
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
<artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Web 相关 -->
|
<!-- Web 相关 -->
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
### 请求 /login 接口 => 成功
|
|
||||||
GET {{userServerUrl}}/wx/mp/get-jsapi-ticket
|
|
@ -125,6 +125,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
|||||||
@Override
|
@Override
|
||||||
public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) {
|
public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) {
|
||||||
// 获得对应的手机号信息
|
// 获得对应的手机号信息
|
||||||
|
// TODO @芋艿:需要弱化微信小程序的依赖,通过 system 获取手机号
|
||||||
WxMaPhoneNumberInfo phoneNumberInfo;
|
WxMaPhoneNumberInfo phoneNumberInfo;
|
||||||
try {
|
try {
|
||||||
phoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(reqVO.getPhoneCode());
|
phoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(reqVO.getPhoneCode());
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.pay.enums;
|
package cn.iocoder.yudao.module.pay.enums;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,21 +20,15 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在");
|
ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在");
|
||||||
ErrorCode CHANNEL_NOT_EXISTS = new ErrorCode(1007001003, "支付渠道不存在");
|
ErrorCode CHANNEL_NOT_EXISTS = new ErrorCode(1007001003, "支付渠道不存在");
|
||||||
ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001005, "已存在相同的渠道");
|
ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001005, "已存在相同的渠道");
|
||||||
ErrorCode CHANNEL_WECHAT_VERSION_2_MCH_KEY_IS_NULL = new ErrorCode(1007001006,"微信渠道v2版本中商户密钥不可为空");
|
|
||||||
ErrorCode CHANNEL_WECHAT_VERSION_3_PRIVATE_KEY_IS_NULL = new ErrorCode(1007001007,"微信渠道v3版本apiclient_key.pem不可为空");
|
|
||||||
ErrorCode CHANNEL_WECHAT_VERSION_3_CERT_KEY_IS_NULL = new ErrorCode(1007001008,"微信渠道v3版本中apiclient_cert.pem不可为空");
|
|
||||||
ErrorCode PAY_CHANNEL_NOTIFY_VERIFY_FAILED = new ErrorCode(1007001009, "渠道通知校验失败");
|
|
||||||
|
|
||||||
// ========== ORDER 模块 1007002000 ==========
|
// ========== ORDER 模块 1007002000 ==========
|
||||||
ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
|
ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
|
||||||
ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
|
ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
|
||||||
ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付");
|
ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付");
|
||||||
ErrorCode PAY_ORDER_ERROR_USER = new ErrorCode(1007002003, "支付订单用户不正确");
|
|
||||||
|
|
||||||
// ========== ORDER 模块(拓展单) 1007003000 ==========
|
// ========== ORDER 模块(拓展单) 1007003000 ==========
|
||||||
ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
||||||
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
|
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
|
||||||
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007003002, "支付订单不处于已支付");
|
|
||||||
|
|
||||||
// ========== 支付模块(退款) 1007006000 ==========
|
// ========== 支付模块(退款) 1007006000 ==========
|
||||||
ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额");
|
ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额");
|
||||||
|
@ -17,7 +17,7 @@ public enum PayOrderStatusEnum implements IntArrayValuable {
|
|||||||
|
|
||||||
WAITING(0, "未支付"),
|
WAITING(0, "未支付"),
|
||||||
SUCCESS(10, "支付成功"),
|
SUCCESS(10, "支付成功"),
|
||||||
CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款 TODO 芋艿:需要优化下
|
CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款
|
||||||
;
|
;
|
||||||
|
|
||||||
private final Integer status;
|
private final Integer status;
|
||||||
|
@ -1,36 +1,29 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant;
|
package cn.iocoder.yudao.module.pay.controller.admin.app;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.*;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.*;
|
|
||||||
import cn.iocoder.yudao.module.pay.convert.app.PayAppConvert;
|
import cn.iocoder.yudao.module.pay.convert.app.PayAppConvert;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
import cn.iocoder.yudao.module.pay.service.app.PayAppService;
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayAppService;
|
import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Tag(name = "管理后台 - 支付应用信息")
|
@Tag(name = "管理后台 - 支付应用信息")
|
||||||
@ -43,8 +36,6 @@ public class PayAppController {
|
|||||||
private PayAppService appService;
|
private PayAppService appService;
|
||||||
@Resource
|
@Resource
|
||||||
private PayChannelService channelService;
|
private PayChannelService channelService;
|
||||||
@Resource
|
|
||||||
private PayMerchantService merchantService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建支付应用信息")
|
@Operation(summary = "创建支付应用信息")
|
||||||
@ -112,17 +103,11 @@ public class PayAppController {
|
|||||||
// TODO @aquan:可以基于 appId 简历一个 multiMap。这样下面,直接 get 到之后,CollUtil buildSet 即可
|
// TODO @aquan:可以基于 appId 简历一个 multiMap。这样下面,直接 get 到之后,CollUtil buildSet 即可
|
||||||
Iterator<PayChannelDO> iterator = channels.iterator();
|
Iterator<PayChannelDO> iterator = channels.iterator();
|
||||||
|
|
||||||
// 得到所有的商户信息
|
|
||||||
Collection<Long> merchantIds = CollectionUtils.convertList(pageResult.getList(), PayAppDO::getMerchantId);
|
|
||||||
Map<Long, PayMerchantDO> deptMap = merchantService.getMerchantMap(merchantIds);
|
|
||||||
|
|
||||||
// 利用反射将渠道数据复制到返回的数据结构中去
|
// 利用反射将渠道数据复制到返回的数据结构中去
|
||||||
List<PayAppPageItemRespVO> appList = new ArrayList<>(pageResult.getList().size());
|
List<PayAppPageItemRespVO> appList = new ArrayList<>(pageResult.getList().size());
|
||||||
pageResult.getList().forEach(app -> {
|
pageResult.getList().forEach(app -> {
|
||||||
// 写入应用信息的数据
|
// 写入应用信息的数据
|
||||||
PayAppPageItemRespVO respVO = PayAppConvert.INSTANCE.pageConvert(app);
|
PayAppPageItemRespVO respVO = PayAppConvert.INSTANCE.pageConvert(app);
|
||||||
// 写入商户的数据
|
|
||||||
respVO.setPayMerchant(PayAppConvert.INSTANCE.convert(deptMap.get(app.getMerchantId())));
|
|
||||||
// 写入支付渠道信息的数据
|
// 写入支付渠道信息的数据
|
||||||
Set<String> channelCodes = new HashSet<>(PayChannelEnum.values().length);
|
Set<String> channelCodes = new HashSet<>(PayChannelEnum.values().length);
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@ -139,25 +124,4 @@ public class PayAppController {
|
|||||||
return success(new PageResult<>(appList, pageResult.getTotal()));
|
return success(new PageResult<>(appList, pageResult.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@Operation(summary = "导出支付应用信息 Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:app:export')")
|
|
||||||
@OperateLog(type = EXPORT)
|
|
||||||
public void exportAppExcel(@Valid PayAppExportReqVO exportReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
List<PayAppDO> list = appService.getAppList(exportReqVO);
|
|
||||||
// 导出 Excel
|
|
||||||
List<PayAppExcelVO> datas = PayAppConvert.INSTANCE.convertList02(list);
|
|
||||||
ExcelUtils.write(response, "支付应用信息.xls", "数据", PayAppExcelVO.class, datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list-merchant-id")
|
|
||||||
@Operation(summary = "根据商户 ID 查询支付应用信息")
|
|
||||||
@Parameter(name = "merchantId", description = "商户ID", required = true, example = "1")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
|
||||||
public CommonResult<List<PayAppRespVO>> getMerchantListByName(@RequestParam Long merchantId) {
|
|
||||||
List<PayAppDO> appListDO = appService.getListByMerchantId(merchantId);
|
|
||||||
return success(PayAppConvert.INSTANCE.convertList(appListDO));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@ -29,8 +29,4 @@ public class PayAppBaseVO {
|
|||||||
@NotNull(message = "退款结果的回调地址不能为空")
|
@NotNull(message = "退款结果的回调地址不能为空")
|
||||||
private String refundNotifyUrl;
|
private String refundNotifyUrl;
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户编号不能为空")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -20,25 +20,7 @@ public class PayAppPageItemRespVO extends PayAppBaseVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
@Schema(description = "渠道编码集合", requiredMode = Schema.RequiredMode.REQUIRED, example = "[alipay_pc, alipay_wap]")
|
||||||
* 所属商户
|
|
||||||
*/
|
|
||||||
private PayMerchant payMerchant;
|
|
||||||
|
|
||||||
@Schema(description = "商户")
|
|
||||||
@Data
|
|
||||||
public static class PayMerchant {
|
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "商户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Schema(description = "渠道编码集合", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_pc,alipay_wap...")
|
|
||||||
private Set<String> channelCodes;
|
private Set<String> channelCodes;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,10 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@ -29,9 +32,6 @@ public class PayAppPageReqVO extends PageParam {
|
|||||||
@Schema(description = "退款结果的回调地址")
|
@Schema(description = "退款结果的回调地址")
|
||||||
private String refundNotifyUrl;
|
private String refundNotifyUrl;
|
||||||
|
|
||||||
@Schema(description = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -1,30 +1,29 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant;
|
package cn.iocoder.yudao.module.pay.controller.admin.channel;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.*;
|
|
||||||
import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayChannelService;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelPageReqVO;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelRespVO;
|
||||||
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.pay.convert.channel.PayChannelConvert;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 支付渠道")
|
@Tag(name = "管理后台 - 支付渠道")
|
||||||
@RestController
|
@RestController
|
||||||
@ -68,16 +67,6 @@ public class PayChannelController {
|
|||||||
return success(PayChannelConvert.INSTANCE.convert(channel));
|
return success(PayChannelConvert.INSTANCE.convert(channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@Operation(summary = "获得支付渠道列表")
|
|
||||||
@Parameter(name = "ids", description = "编号列表",
|
|
||||||
required = true, example = "1024,2048")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
|
||||||
public CommonResult<List<PayChannelRespVO>> getChannelList(@RequestParam("ids") Collection<Long> ids) {
|
|
||||||
List<PayChannelDO> list = channelService.getChannelList(ids);
|
|
||||||
return success(PayChannelConvert.INSTANCE.convertList(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得支付渠道分页")
|
@Operation(summary = "获得支付渠道分页")
|
||||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||||
@ -86,33 +75,17 @@ public class PayChannelController {
|
|||||||
return success(PayChannelConvert.INSTANCE.convertPage(pageResult));
|
return success(PayChannelConvert.INSTANCE.convertPage(pageResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
// TODO 芋艿:需要 review 下实现
|
||||||
@Operation(summary = "导出支付渠道Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:channel:export')")
|
|
||||||
@OperateLog(type = EXPORT)
|
|
||||||
public void exportChannelExcel(@Valid PayChannelExportReqVO exportReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
List<PayChannelDO> list = channelService.getChannelList(exportReqVO);
|
|
||||||
// 导出 Excel
|
|
||||||
List<PayChannelExcelVO> datas = PayChannelConvert.INSTANCE.convertList02(list);
|
|
||||||
ExcelUtils.write(response, "支付渠道.xls", "数据", PayChannelExcelVO.class, datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get-channel")
|
@GetMapping("/get-channel")
|
||||||
@Operation(summary = "根据条件查询微信支付渠道")
|
@Operation(summary = "根据条件查询微信支付渠道")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@Parameter(name = "merchantId", description = "商户编号",
|
@Parameter(name = "appId", description = "应用编号", required = true, example = "1"),
|
||||||
required = true, example = "1"),
|
@Parameter(name = "code", description = "支付渠道编码", required = true, example = "wx_pub")
|
||||||
@Parameter(name = "appId", description = "应用编号",
|
|
||||||
required = true, example = "1"),
|
|
||||||
@Parameter(name = "code", description = "支付渠道编码",
|
|
||||||
required = true, example = "wx_pub")
|
|
||||||
})
|
})
|
||||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||||
public CommonResult<PayChannelRespVO> getChannel(
|
public CommonResult<PayChannelRespVO> getChannel(@RequestParam Long appId, @RequestParam String code) {
|
||||||
@RequestParam Long merchantId, @RequestParam Long appId, @RequestParam String code) {
|
|
||||||
// 獲取渠道
|
// 獲取渠道
|
||||||
PayChannelDO channel = channelService.getChannelByConditions(merchantId, appId, code);
|
PayChannelDO channel = channelService.getChannelByConditions(appId, code);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
return success(new PayChannelRespVO());
|
return success(new PayChannelRespVO());
|
||||||
}
|
}
|
||||||
@ -121,4 +94,12 @@ public class PayChannelController {
|
|||||||
return success(respVo);
|
return success(respVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-enable-code-list")
|
||||||
|
@Operation(summary = "获得指定应用的开启的支付渠道编码列表")
|
||||||
|
@Parameter(name = "appId", description = "应用编号", required = true, example = "1")
|
||||||
|
public CommonResult<Set<String>> getEnableChannelCodeList(@RequestParam("appId") Long appId) {
|
||||||
|
List<PayChannelDO> channels = channelService.getEnableChannelList(appId);
|
||||||
|
return success(convertSet(channels, PayChannelDO::getCode));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
||||||
@ -25,10 +25,6 @@ public class PayChannelBaseVO {
|
|||||||
@NotNull(message = "渠道费率,单位:百分比不能为空")
|
@NotNull(message = "渠道费率,单位:百分比不能为空")
|
||||||
private Double feeRate;
|
private Double feeRate;
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户编号不能为空")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "应用编号不能为空")
|
@NotNull(message = "应用编号不能为空")
|
||||||
private Long appId;
|
private Long appId;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -1,10 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@ -26,9 +29,6 @@ public class PayChannelPageReqVO extends PageParam {
|
|||||||
@Schema(description = "渠道费率,单位:百分比")
|
@Schema(description = "渠道费率,单位:百分比")
|
||||||
private Double feeRate;
|
private Double feeRate;
|
||||||
|
|
||||||
@Schema(description = "商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号")
|
@Schema(description = "应用编号")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.*;
|
@ -1,116 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.*;
|
|
||||||
import cn.iocoder.yudao.module.pay.convert.merchant.PayMerchantConvert;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
|
|
||||||
@Tag(name = "支付商户信息")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/pay/merchant")
|
|
||||||
@Validated
|
|
||||||
public class PayMerchantController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private PayMerchantService merchantService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@Operation(summary = "创建支付商户信息")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:create')")
|
|
||||||
public CommonResult<Long> createMerchant(@Valid @RequestBody PayMerchantCreateReqVO createReqVO) {
|
|
||||||
return success(merchantService.createMerchant(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@Operation(summary = "更新支付商户信息")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:update')")
|
|
||||||
public CommonResult<Boolean> updateMerchant(@Valid @RequestBody PayMerchantUpdateReqVO updateReqVO) {
|
|
||||||
merchantService.updateMerchant(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update-status")
|
|
||||||
@Operation(summary = "修改支付商户状态")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:update')")
|
|
||||||
public CommonResult<Boolean> updateMerchantStatus(@Valid @RequestBody PayMerchantUpdateStatusReqVO reqVO) {
|
|
||||||
merchantService.updateMerchantStatus(reqVO.getId(), reqVO.getStatus());
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@Operation(summary = "删除支付商户信息")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:delete')")
|
|
||||||
public CommonResult<Boolean> deleteMerchant(@RequestParam("id") Long id) {
|
|
||||||
merchantService.deleteMerchant(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
|
||||||
@Operation(summary = "获得支付商户信息")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
|
||||||
public CommonResult<PayMerchantRespVO> getMerchant(@RequestParam("id") Long id) {
|
|
||||||
PayMerchantDO merchant = merchantService.getMerchant(id);
|
|
||||||
return success(PayMerchantConvert.INSTANCE.convert(merchant));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list-by-name")
|
|
||||||
@Operation(summary = "根据商户名称获得支付商户信息列表")
|
|
||||||
@Parameter(name = "name", description = "商户名称", example = "芋道")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
|
||||||
public CommonResult<List<PayMerchantRespVO>> getMerchantListByName(@RequestParam(required = false) String name) {
|
|
||||||
List<PayMerchantDO> merchantListDO = merchantService.getMerchantListByName(name);
|
|
||||||
return success(PayMerchantConvert.INSTANCE.convertList(merchantListDO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@Operation(summary = "获得支付商户信息列表")
|
|
||||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
|
||||||
public CommonResult<List<PayMerchantRespVO>> getMerchantList(@RequestParam("ids") Collection<Long> ids) {
|
|
||||||
List<PayMerchantDO> list = merchantService.getMerchantList(ids);
|
|
||||||
return success(PayMerchantConvert.INSTANCE.convertList(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
|
||||||
@Operation(summary = "获得支付商户信息分页")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
|
||||||
public CommonResult<PageResult<PayMerchantRespVO>> getMerchantPage(@Valid PayMerchantPageReqVO pageVO) {
|
|
||||||
PageResult<PayMerchantDO> pageResult = merchantService.getMerchantPage(pageVO);
|
|
||||||
return success(PayMerchantConvert.INSTANCE.convertPage(pageResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@Operation(summary = "导出支付商户信息 Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('pay:merchant:export')")
|
|
||||||
@OperateLog(type = EXPORT)
|
|
||||||
public void exportMerchantExcel(@Valid PayMerchantExportReqVO exportReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
List<PayMerchantDO> list = merchantService.getMerchantList(exportReqVO);
|
|
||||||
// 导出 Excel
|
|
||||||
List<PayMerchantExcelVO> datas = PayMerchantConvert.INSTANCE.convertList02(list);
|
|
||||||
ExcelUtils.write(response, "支付商户信息.xls", "数据", PayMerchantExcelVO.class, datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付应用信息 Excel VO
|
|
||||||
*
|
|
||||||
* @author 芋艿
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PayAppExcelVO {
|
|
||||||
|
|
||||||
@ExcelProperty("应用编号")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ExcelProperty("应用名")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ExcelProperty("开启状态")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@ExcelProperty("备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@ExcelProperty("支付结果的回调地址")
|
|
||||||
private String payNotifyUrl;
|
|
||||||
|
|
||||||
@ExcelProperty("退款结果的回调地址")
|
|
||||||
private String refundNotifyUrl;
|
|
||||||
|
|
||||||
@ExcelProperty("商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付应用信息 Excel 导出 Request VO,参数和 PayAppPageReqVO 是一致的")
|
|
||||||
@Data
|
|
||||||
public class PayAppExportReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "应用名")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "开启状态")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@Schema(description = "支付结果的回调地址")
|
|
||||||
private String payNotifyUrl;
|
|
||||||
|
|
||||||
@Schema(description = "退款结果的回调地址")
|
|
||||||
private String refundNotifyUrl;
|
|
||||||
|
|
||||||
@Schema(description = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付渠道 Excel VO
|
|
||||||
*
|
|
||||||
* @author 芋艿
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PayChannelExcelVO {
|
|
||||||
|
|
||||||
@ExcelProperty("商户编号")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ExcelProperty("渠道编码")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@ExcelProperty("开启状态")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@ExcelProperty("备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@ExcelProperty("渠道费率,单位:百分比")
|
|
||||||
private Double feeRate;
|
|
||||||
|
|
||||||
@ExcelProperty("商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@ExcelProperty("应用编号")
|
|
||||||
private Long appId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* todo @芋艿 mapStruct 存在转换问题
|
|
||||||
* java: Can't map property "PayClientConfig payChannelDO.config" to "String payChannelExcelVO.config".
|
|
||||||
* Consider to declare/implement a mapping method: "String map(PayClientConfig value)".
|
|
||||||
*/
|
|
||||||
/// @ExcelProperty("支付渠道配置")
|
|
||||||
/// private String config;
|
|
||||||
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付渠道 Excel 导出 Request VO,参数和 PayChannelPageReqVO 是一致的")
|
|
||||||
@Data
|
|
||||||
public class PayChannelExportReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "渠道编码")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@Schema(description = "开启状态")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@Schema(description = "渠道费率,单位:百分比")
|
|
||||||
private Double feeRate;
|
|
||||||
|
|
||||||
@Schema(description = "商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号")
|
|
||||||
private Long appId;
|
|
||||||
|
|
||||||
@Schema(description = "支付渠道配置")
|
|
||||||
private String config;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付商户信息 Base VO,提供给添加、修改、详细的子 VO 使用
|
|
||||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PayMerchantBaseVO {
|
|
||||||
|
|
||||||
@Schema(description = "商户全称", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户全称不能为空")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "商户简称", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户简称不能为空")
|
|
||||||
private String shortName;
|
|
||||||
|
|
||||||
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "开启状态不能为空")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付商户信息创建 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class PayMerchantCreateReqVO extends PayMerchantBaseVO {
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
|
|
||||||
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.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付商户信息 Excel VO
|
|
||||||
*
|
|
||||||
* @author 芋艿
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PayMerchantExcelVO {
|
|
||||||
|
|
||||||
@ExcelProperty("商户编号")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ExcelProperty("商户号")
|
|
||||||
private String no;
|
|
||||||
|
|
||||||
@ExcelProperty("商户全称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ExcelProperty("商户简称")
|
|
||||||
private String shortName;
|
|
||||||
|
|
||||||
@ExcelProperty(value = "开启状态",converter = DictConvert.class)
|
|
||||||
@DictFormat("sys_common_status")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@ExcelProperty("备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付商户信息 Excel 导出 Request VO,参数和 PayMerchantPageReqVO 是一致的")
|
|
||||||
@Data
|
|
||||||
public class PayMerchantExportReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "商户号")
|
|
||||||
private String no;
|
|
||||||
|
|
||||||
@Schema(description = "商户全称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "商户简称")
|
|
||||||
private String shortName;
|
|
||||||
|
|
||||||
@Schema(description = "开启状态")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付商户信息分页 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class PayMerchantPageReqVO extends PageParam {
|
|
||||||
|
|
||||||
@Schema(description = "商户号")
|
|
||||||
private String no;
|
|
||||||
|
|
||||||
@Schema(description = "商户全称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "商户简称")
|
|
||||||
private String shortName;
|
|
||||||
|
|
||||||
@Schema(description = "开启状态")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付商户信息 Response VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class PayMerchantRespVO extends PayMerchantBaseVO {
|
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@Schema(description = "商户号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M233666999")
|
|
||||||
private String no;
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付商户信息更新 Request VO")
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class PayMerchantUpdateReqVO extends PayMerchantBaseVO {
|
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户编号不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 商户更新状态 Request VO")
|
|
||||||
@Data
|
|
||||||
public class PayMerchantUpdateStatusReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
|
||||||
@NotNull(message = "商户编号不能为空")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "状态,见 SysCommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
@NotNull(message = "状态不能为空")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
}
|
|
@ -7,15 +7,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*;
|
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*;
|
||||||
import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert;
|
import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayAppService;
|
import cn.iocoder.yudao.module.pay.service.app.PayAppService;
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderExtensionService;
|
import cn.iocoder.yudao.module.pay.service.order.PayOrderExtensionService;
|
||||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -48,8 +46,6 @@ public class PayOrderController {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayOrderExtensionService orderExtensionService;
|
private PayOrderExtensionService orderExtensionService;
|
||||||
@Resource
|
@Resource
|
||||||
private PayMerchantService merchantService;
|
|
||||||
@Resource
|
|
||||||
private PayAppService appService;
|
private PayAppService appService;
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@ -71,13 +67,11 @@ public class PayOrderController {
|
|||||||
return success(new PayOrderDetailsRespVO());
|
return success(new PayOrderDetailsRespVO());
|
||||||
}
|
}
|
||||||
|
|
||||||
PayMerchantDO merchantDO = merchantService.getMerchant(order.getMerchantId());
|
|
||||||
PayAppDO appDO = appService.getApp(order.getAppId());
|
PayAppDO appDO = appService.getApp(order.getAppId());
|
||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(order.getChannelCode());
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(order.getChannelCode());
|
||||||
|
|
||||||
// TODO @aquan:文案,都是前端 format;
|
// TODO @aquan:文案,都是前端 format;
|
||||||
PayOrderDetailsRespVO respVO = PayOrderConvert.INSTANCE.orderDetailConvert(order);
|
PayOrderDetailsRespVO respVO = PayOrderConvert.INSTANCE.orderDetailConvert(order);
|
||||||
respVO.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
|
||||||
respVO.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
respVO.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||||
respVO.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
respVO.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||||
|
|
||||||
@ -105,21 +99,16 @@ public class PayOrderController {
|
|||||||
return success(new PageResult<>(pageResult.getTotal()));
|
return success(new PageResult<>(pageResult.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理商户ID数据
|
|
||||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
|
||||||
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getMerchantId));
|
|
||||||
// 处理应用ID数据
|
// 处理应用ID数据
|
||||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||||
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getAppId));
|
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getAppId));
|
||||||
|
|
||||||
List<PayOrderPageItemRespVO> pageList = new ArrayList<>(pageResult.getList().size());
|
List<PayOrderPageItemRespVO> pageList = new ArrayList<>(pageResult.getList().size());
|
||||||
pageResult.getList().forEach(c -> {
|
pageResult.getList().forEach(c -> {
|
||||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
|
||||||
PayAppDO appDO = appMap.get(c.getAppId());
|
PayAppDO appDO = appMap.get(c.getAppId());
|
||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||||
|
|
||||||
PayOrderPageItemRespVO orderItem = PayOrderConvert.INSTANCE.pageConvertItemPage(c);
|
PayOrderPageItemRespVO orderItem = PayOrderConvert.INSTANCE.pageConvertItemPage(c);
|
||||||
orderItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
|
||||||
orderItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
orderItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||||
orderItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
orderItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||||
pageList.add(orderItem);
|
pageList.add(orderItem);
|
||||||
@ -133,16 +122,12 @@ public class PayOrderController {
|
|||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO,
|
public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO);
|
List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO);
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
ExcelUtils.write(response, "支付订单.xls", "数据",
|
ExcelUtils.write(response, "支付订单.xls", "数据",
|
||||||
PayOrderExcelVO.class, new ArrayList<>());
|
PayOrderExcelVO.class, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理商户ID数据
|
|
||||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
|
||||||
CollectionUtils.convertList(list, PayOrderDO::getMerchantId));
|
|
||||||
// 处理应用ID数据
|
// 处理应用ID数据
|
||||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||||
CollectionUtils.convertList(list, PayOrderDO::getAppId));
|
CollectionUtils.convertList(list, PayOrderDO::getAppId));
|
||||||
@ -152,13 +137,11 @@ public class PayOrderController {
|
|||||||
|
|
||||||
List<PayOrderExcelVO> excelDatum = new ArrayList<>(list.size());
|
List<PayOrderExcelVO> excelDatum = new ArrayList<>(list.size());
|
||||||
list.forEach(c -> {
|
list.forEach(c -> {
|
||||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
|
||||||
PayAppDO appDO = appMap.get(c.getAppId());
|
PayAppDO appDO = appMap.get(c.getAppId());
|
||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||||
PayOrderExtensionDO orderExtensionDO = orderExtensionMap.get(c.getSuccessExtensionId());
|
PayOrderExtensionDO orderExtensionDO = orderExtensionMap.get(c.getSuccessExtensionId());
|
||||||
|
|
||||||
PayOrderExcelVO excelItem = PayOrderConvert.INSTANCE.excelConvert(c);
|
PayOrderExcelVO excelItem = PayOrderConvert.INSTANCE.excelConvert(c);
|
||||||
excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
|
||||||
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||||
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||||
excelItem.setNo(ObjectUtil.isNotNull(orderExtensionDO) ? orderExtensionDO.getNo() : "");
|
excelItem.setNo(ObjectUtil.isNotNull(orderExtensionDO) ? orderExtensionDO.getNo() : "");
|
||||||
|
@ -17,10 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@Data
|
@Data
|
||||||
public class PayOrderBaseVO {
|
public class PayOrderBaseVO {
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户编号不能为空")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "应用编号不能为空")
|
@NotNull(message = "应用编号不能为空")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
@ -16,9 +16,6 @@ public class PayOrderDetailsRespVO extends PayOrderBaseVO {
|
|||||||
@Schema(description = "支付订单编号")
|
@Schema(description = "支付订单编号")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@Schema(description = "应用名称")
|
@Schema(description = "应用名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ public class PayOrderExcelVO {
|
|||||||
@ExcelProperty("支付订单编号")
|
@ExcelProperty("支付订单编号")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ExcelProperty(value = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@ExcelProperty(value = "应用名称")
|
@ExcelProperty(value = "应用名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@Data
|
@Data
|
||||||
public class PayOrderExportReqVO {
|
public class PayOrderExportReqVO {
|
||||||
|
|
||||||
@Schema(description = "商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号")
|
@Schema(description = "应用编号")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ public class PayOrderPageItemRespVO extends PayOrderBaseVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@Schema(description = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@Schema(description = "应用名称")
|
@Schema(description = "应用名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class PayOrderPageReqVO extends PageParam {
|
public class PayOrderPageReqVO extends PageParam {
|
||||||
|
|
||||||
@Schema(description = "商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号")
|
@Schema(description = "应用编号")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
|
@ -4,12 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*;
|
import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.*;
|
||||||
import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert;
|
import cn.iocoder.yudao.module.pay.convert.refund.PayRefundConvert;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayAppService;
|
import cn.iocoder.yudao.module.pay.service.app.PayAppService;
|
||||||
import cn.iocoder.yudao.module.pay.service.merchant.PayMerchantService;
|
|
||||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||||
import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
|
import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
@ -17,7 +15,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -48,8 +46,6 @@ public class PayRefundController {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayRefundService refundService;
|
private PayRefundService refundService;
|
||||||
@Resource
|
@Resource
|
||||||
private PayMerchantService merchantService;
|
|
||||||
@Resource
|
|
||||||
private PayAppService appService;
|
private PayAppService appService;
|
||||||
@Resource
|
@Resource
|
||||||
private PayOrderService orderService;
|
private PayOrderService orderService;
|
||||||
@ -64,13 +60,11 @@ public class PayRefundController {
|
|||||||
return success(new PayRefundDetailsRespVO());
|
return success(new PayRefundDetailsRespVO());
|
||||||
}
|
}
|
||||||
|
|
||||||
PayMerchantDO merchantDO = merchantService.getMerchant(refund.getMerchantId());
|
|
||||||
PayAppDO appDO = appService.getApp(refund.getAppId());
|
PayAppDO appDO = appService.getApp(refund.getAppId());
|
||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(refund.getChannelCode());
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(refund.getChannelCode());
|
||||||
PayOrderDO orderDO = orderService.getOrder(refund.getOrderId());
|
PayOrderDO orderDO = orderService.getOrder(refund.getOrderId());
|
||||||
|
|
||||||
PayRefundDetailsRespVO refundDetail = PayRefundConvert.INSTANCE.refundDetailConvert(refund);
|
PayRefundDetailsRespVO refundDetail = PayRefundConvert.INSTANCE.refundDetailConvert(refund);
|
||||||
refundDetail.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
|
||||||
refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||||
refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||||
refundDetail.setSubject(orderDO.getSubject());
|
refundDetail.setSubject(orderDO.getSubject());
|
||||||
@ -87,21 +81,16 @@ public class PayRefundController {
|
|||||||
return success(new PageResult<>(pageResult.getTotal()));
|
return success(new PageResult<>(pageResult.getTotal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理商户ID数据
|
|
||||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
|
||||||
CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getMerchantId));
|
|
||||||
// 处理应用ID数据
|
// 处理应用ID数据
|
||||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||||
CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId));
|
CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId));
|
||||||
List<PayRefundPageItemRespVO> list = new ArrayList<>(pageResult.getList().size());
|
List<PayRefundPageItemRespVO> list = new ArrayList<>(pageResult.getList().size());
|
||||||
pageResult.getList().forEach(c -> {
|
pageResult.getList().forEach(c -> {
|
||||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
|
||||||
PayAppDO appDO = appMap.get(c.getAppId());
|
PayAppDO appDO = appMap.get(c.getAppId());
|
||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||||
|
|
||||||
PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c);
|
PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c);
|
||||||
|
|
||||||
item.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
|
||||||
item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||||
item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||||
list.add(item);
|
list.add(item);
|
||||||
@ -123,9 +112,6 @@ public class PayRefundController {
|
|||||||
PayRefundExcelVO.class, new ArrayList<>());
|
PayRefundExcelVO.class, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理商户ID数据
|
|
||||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
|
||||||
CollectionUtils.convertList(list, PayRefundDO::getMerchantId));
|
|
||||||
// 处理应用ID数据
|
// 处理应用ID数据
|
||||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||||
CollectionUtils.convertList(list, PayRefundDO::getAppId));
|
CollectionUtils.convertList(list, PayRefundDO::getAppId));
|
||||||
@ -136,12 +122,10 @@ public class PayRefundController {
|
|||||||
CollectionUtils.convertList(list, PayRefundDO::getOrderId));
|
CollectionUtils.convertList(list, PayRefundDO::getOrderId));
|
||||||
|
|
||||||
list.forEach(c -> {
|
list.forEach(c -> {
|
||||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
|
||||||
PayAppDO appDO = appMap.get(c.getAppId());
|
PayAppDO appDO = appMap.get(c.getAppId());
|
||||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||||
|
|
||||||
PayRefundExcelVO excelItem = PayRefundConvert.INSTANCE.excelConvert(c);
|
PayRefundExcelVO excelItem = PayRefundConvert.INSTANCE.excelConvert(c);
|
||||||
excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
|
||||||
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||||
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||||
excelItem.setSubject(orderMap.get(c.getOrderId()).getSubject());
|
excelItem.setSubject(orderMap.get(c.getOrderId()).getSubject());
|
||||||
|
@ -15,10 +15,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@Data
|
@Data
|
||||||
public class PayRefundBaseVO {
|
public class PayRefundBaseVO {
|
||||||
|
|
||||||
@Schema(description = "商户编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "商户编号不能为空")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "应用编号不能为空")
|
@NotNull(message = "应用编号不能为空")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
@ -17,9 +17,6 @@ public class PayRefundDetailsRespVO extends PayRefundBaseVO {
|
|||||||
@Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "支付退款编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@Schema(description = "应用名称")
|
@Schema(description = "应用名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@ -22,9 +22,6 @@ public class PayRefundExcelVO {
|
|||||||
@ExcelProperty("商品名称")
|
@ExcelProperty("商品名称")
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
@ExcelProperty(value = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@ExcelProperty(value = "应用名称")
|
@ExcelProperty(value = "应用名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@Data
|
@Data
|
||||||
public class PayRefundExportReqVO {
|
public class PayRefundExportReqVO {
|
||||||
|
|
||||||
@Schema(description = "商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号")
|
@Schema(description = "应用编号")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
|
@ -16,9 +16,6 @@ public class PayRefundPageItemRespVO extends PayRefundBaseVO {
|
|||||||
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "商户名称")
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@Schema(description = "应用名称")
|
@Schema(description = "应用名称")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class PayRefundPageReqVO extends PageParam {
|
public class PayRefundPageReqVO extends PageParam {
|
||||||
|
|
||||||
@Schema(description = "商户编号")
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
@Schema(description = "应用编号")
|
@Schema(description = "应用编号")
|
||||||
private Long appId;
|
private Long appId;
|
||||||
|
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.yudao.module.pay.controller.app.channel;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
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 java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
@Tag(name = "用户 App - 支付渠道")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pay/channel")
|
||||||
|
@Validated
|
||||||
|
public class AppPayChannelController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PayChannelService channelService;
|
||||||
|
|
||||||
|
@GetMapping("/get-enable-code-list")
|
||||||
|
@Operation(summary = "获得指定应用的开启的支付渠道编码列表")
|
||||||
|
@Parameter(name = "appId", description = "应用编号", required = true, example = "1")
|
||||||
|
public CommonResult<Set<String>> getEnableChannelCodeList(@RequestParam("appId") Long appId) {
|
||||||
|
List<PayChannelDO> channels = channelService.getEnableChannelList(appId);
|
||||||
|
return success(convertSet(channels, PayChannelDO::getCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
### /pay/create 提交支付订单
|
### /pay/create 提交支付订单【alipay_pc】
|
||||||
POST {{appApi}}/pay/order/submit
|
POST {{appApi}}/pay/order/submit
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Authorization: Bearer {{appToken}}
|
Authorization: Bearer {{appToken}}
|
||||||
@ -8,3 +8,56 @@ tenant-id: {{appTenentId}}
|
|||||||
"id": 174,
|
"id": 174,
|
||||||
"channelCode": "alipay_pc"
|
"channelCode": "alipay_pc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### /pay/create 提交支付订单【wx_bar】
|
||||||
|
POST {{appApi}}/pay/order/submit
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 202,
|
||||||
|
"channelCode": "wx_bar",
|
||||||
|
"channelExtras": {
|
||||||
|
"authCode": "132990241553789274"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### /pay/create 提交支付订单【wx_pub】
|
||||||
|
POST {{appApi}}/pay/order/submit
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 202,
|
||||||
|
"channelCode": "wx_pub",
|
||||||
|
"channelExtras": {
|
||||||
|
"openid": "ockUAwIZ-0OeMZl9ogcZ4ILrGba0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### /pay/create 提交支付订单【wx_lite】
|
||||||
|
POST {{appApi}}/pay/order/submit
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 202,
|
||||||
|
"channelCode": "wx_lite",
|
||||||
|
"channelExtras": {
|
||||||
|
"openid": "oLefc4g5GjKWHJjLjMSXB3wX0fD0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
### /pay/create 提交支付订单【wx_native】
|
||||||
|
POST {{appApi}}/pay/order/submit
|
||||||
|
Content-Type: application/json
|
||||||
|
Authorization: Bearer {{appToken}}
|
||||||
|
tenant-id: {{appTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 202,
|
||||||
|
"channelCode": "wx_native"
|
||||||
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package cn.iocoder.yudao.module.pay.convert.app;
|
package cn.iocoder.yudao.module.pay.convert.app;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.*;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageItemRespVO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppRespVO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付应用信息 Convert
|
* 支付应用信息 Convert
|
||||||
*
|
*
|
||||||
@ -22,8 +23,6 @@ public interface PayAppConvert {
|
|||||||
|
|
||||||
PayAppPageItemRespVO pageConvert (PayAppDO bean);
|
PayAppPageItemRespVO pageConvert (PayAppDO bean);
|
||||||
|
|
||||||
PayAppPageItemRespVO.PayMerchant convert(PayMerchantDO bean);
|
|
||||||
|
|
||||||
PayAppDO convert(PayAppCreateReqVO bean);
|
PayAppDO convert(PayAppCreateReqVO bean);
|
||||||
|
|
||||||
PayAppDO convert(PayAppUpdateReqVO bean);
|
PayAppDO convert(PayAppUpdateReqVO bean);
|
||||||
@ -34,6 +33,4 @@ public interface PayAppConvert {
|
|||||||
|
|
||||||
PageResult<PayAppRespVO> convertPage(PageResult<PayAppDO> page);
|
PageResult<PayAppRespVO> convertPage(PageResult<PayAppDO> page);
|
||||||
|
|
||||||
List<PayAppExcelVO> convertList02(List<PayAppDO> list);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.pay.convert.channel;
|
package cn.iocoder.yudao.module.pay.convert.channel;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO;
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelRespVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExcelVO;
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelRespVO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -27,12 +23,6 @@ public interface PayChannelConvert {
|
|||||||
@Mapping(target = "config",expression = "java(cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString(bean.getConfig()))")
|
@Mapping(target = "config",expression = "java(cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString(bean.getConfig()))")
|
||||||
PayChannelRespVO convert(PayChannelDO bean);
|
PayChannelRespVO convert(PayChannelDO bean);
|
||||||
|
|
||||||
List<PayChannelRespVO> convertList(List<PayChannelDO> list);
|
|
||||||
|
|
||||||
PageResult<PayChannelRespVO> convertPage(PageResult<PayChannelDO> page);
|
PageResult<PayChannelRespVO> convertPage(PageResult<PayChannelDO> page);
|
||||||
|
|
||||||
List<PayChannelExcelVO> convertList02(List<PayChannelDO> list);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.convert.merchant;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExcelVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantRespVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PayMerchantConvert {
|
|
||||||
|
|
||||||
PayMerchantConvert INSTANCE = Mappers.getMapper(PayMerchantConvert.class);
|
|
||||||
|
|
||||||
PayMerchantDO convert(PayMerchantCreateReqVO bean);
|
|
||||||
|
|
||||||
PayMerchantDO convert(PayMerchantUpdateReqVO bean);
|
|
||||||
|
|
||||||
PayMerchantRespVO convert(PayMerchantDO bean);
|
|
||||||
|
|
||||||
List<PayMerchantRespVO> convertList(List<PayMerchantDO> list);
|
|
||||||
|
|
||||||
PageResult<PayMerchantRespVO> convertPage(PageResult<PayMerchantDO> page);
|
|
||||||
|
|
||||||
List<PayMerchantExcelVO> convertList02(List<PayMerchantDO> list);
|
|
||||||
|
|
||||||
}
|
|
@ -94,7 +94,7 @@ public interface PayOrderConvert {
|
|||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp);
|
PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp);
|
||||||
|
|
||||||
PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO);
|
PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO, String userIp);
|
||||||
|
|
||||||
PayOrderSubmitRespVO convert(PayOrderUnifiedRespDTO bean);
|
PayOrderSubmitRespVO convert(PayOrderUnifiedRespDTO bean);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.merchant;
|
package cn.iocoder.yudao.module.pay.dal.dataobject.app;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
@ -54,11 +54,4 @@ public class PayAppDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String refundNotifyUrl;
|
private String refundNotifyUrl;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户编号
|
|
||||||
*
|
|
||||||
* 关联 {@link PayMerchantDO#getId()}
|
|
||||||
*/
|
|
||||||
private Long merchantId;
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,9 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.merchant;
|
package cn.iocoder.yudao.module.pay.dal.dataobject.channel;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@ -53,12 +54,6 @@ public class PayChannelDO extends TenantBaseDO {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户编号
|
|
||||||
*
|
|
||||||
* 关联 {@link PayMerchantDO#getId()}
|
|
||||||
*/
|
|
||||||
private Long merchantId;
|
|
||||||
/**
|
/**
|
||||||
* 应用编号
|
* 应用编号
|
||||||
*
|
*
|
@ -1,54 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.merchant;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付商户信息 DO
|
|
||||||
* 目前暂时没有特别的用途,主要为未来多商户提供基础。
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@TableName("pay_merchant")
|
|
||||||
@KeySequence("pay_merchant_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class PayMerchantDO extends BaseDO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户编号,数据库自增
|
|
||||||
*/
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 商户号
|
|
||||||
* 例如说,M233666999
|
|
||||||
* 只有新增时插入,不允许修改
|
|
||||||
*/
|
|
||||||
private String no;
|
|
||||||
/**
|
|
||||||
* 商户全称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 商户简称
|
|
||||||
*/
|
|
||||||
private String shortName;
|
|
||||||
/**
|
|
||||||
* 状态
|
|
||||||
*
|
|
||||||
* 枚举 {@link CommonStatusEnum}
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
}
|
|
@ -1,12 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.notify;
|
package cn.iocoder.yudao.module.pay.dal.dataobject.notify;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum;
|
import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum;
|
||||||
import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum;
|
import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -42,12 +41,6 @@ public class PayNotifyTaskDO extends BaseDO {
|
|||||||
* 编号,自增
|
* 编号,自增
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
|
||||||
* 商户编号
|
|
||||||
*
|
|
||||||
* 关联 {@link PayMerchantDO#getId()}
|
|
||||||
*/
|
|
||||||
private Long merchantId;
|
|
||||||
/**
|
/**
|
||||||
* 应用编号
|
* 应用编号
|
||||||
*
|
*
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.order;
|
package cn.iocoder.yudao.module.pay.dal.dataobject.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
|
||||||
import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum;
|
|
||||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
|
|
||||||
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@ -33,12 +32,6 @@ public class PayOrderDO extends BaseDO {
|
|||||||
* 订单编号,数据库自增
|
* 订单编号,数据库自增
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
|
||||||
* 商户编号
|
|
||||||
*
|
|
||||||
* 关联 {@link PayMerchantDO#getId()}
|
|
||||||
*/
|
|
||||||
private Long merchantId;
|
|
||||||
/**
|
/**
|
||||||
* 应用编号
|
* 应用编号
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.order;
|
package cn.iocoder.yudao.module.pay.dal.dataobject.order;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.dataobject.refund;
|
package cn.iocoder.yudao.module.pay.dal.dataobject.refund;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
||||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
|
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@ -39,12 +38,6 @@ public class PayRefundDO extends BaseDO {
|
|||||||
@TableId
|
@TableId
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户编号
|
|
||||||
*
|
|
||||||
* 关联 {@link PayMerchantDO#getId()}
|
|
||||||
*/
|
|
||||||
private Long merchantId;
|
|
||||||
/**
|
/**
|
||||||
* 应用编号
|
* 应用编号
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.pay.dal.mysql.app;
|
||||||
|
|
||||||
|
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 cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PayAppMapper extends BaseMapperX<PayAppDO> {
|
||||||
|
|
||||||
|
default PageResult<PayAppDO> selectPage(PayAppPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new QueryWrapperX<PayAppDO>()
|
||||||
|
.likeIfPresent("name", reqVO.getName())
|
||||||
|
.eqIfPresent("status", reqVO.getStatus())
|
||||||
|
.eqIfPresent("remark", reqVO.getRemark())
|
||||||
|
.eqIfPresent("pay_notify_url", reqVO.getPayNotifyUrl())
|
||||||
|
.eqIfPresent("refund_notify_url", reqVO.getRefundNotifyUrl())
|
||||||
|
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
||||||
|
.orderByDesc("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.mysql.merchant;
|
package cn.iocoder.yudao.module.pay.dal.mysql.channel;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelExportReqVO;
|
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelPageReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.channel.PayChannelPageReqVO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayChannelDO;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@ -25,51 +25,21 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> {
|
|||||||
.eqIfPresent("status", reqVO.getStatus())
|
.eqIfPresent("status", reqVO.getStatus())
|
||||||
.eqIfPresent("remark", reqVO.getRemark())
|
.eqIfPresent("remark", reqVO.getRemark())
|
||||||
.eqIfPresent("fee_rate", reqVO.getFeeRate())
|
.eqIfPresent("fee_rate", reqVO.getFeeRate())
|
||||||
.eqIfPresent("merchant_id", reqVO.getMerchantId())
|
|
||||||
.eqIfPresent("app_id", reqVO.getAppId())
|
.eqIfPresent("app_id", reqVO.getAppId())
|
||||||
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
||||||
.orderByDesc("id"));
|
.orderByDesc("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<PayChannelDO> selectList(PayChannelExportReqVO reqVO) {
|
|
||||||
return selectList(new QueryWrapperX<PayChannelDO>()
|
|
||||||
.eqIfPresent("code", reqVO.getCode())
|
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
|
||||||
.eqIfPresent("remark", reqVO.getRemark())
|
|
||||||
.eqIfPresent("fee_rate", reqVO.getFeeRate())
|
|
||||||
.eqIfPresent("merchant_id", reqVO.getMerchantId())
|
|
||||||
.eqIfPresent("app_id", reqVO.getAppId())
|
|
||||||
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
|
||||||
.orderByDesc("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据条件获取渠道数量
|
|
||||||
*
|
|
||||||
* @param merchantId 商户编号
|
|
||||||
* @param appid 应用编号
|
|
||||||
* @param code 渠道编码
|
|
||||||
* @return 数量
|
|
||||||
*/
|
|
||||||
default Integer selectCount(Long merchantId, Long appid, String code) {
|
|
||||||
return this.selectCount(new QueryWrapper<PayChannelDO>().lambda()
|
|
||||||
.eq(PayChannelDO::getMerchantId, merchantId)
|
|
||||||
.eq(PayChannelDO::getAppId, appid)
|
|
||||||
.eq(PayChannelDO::getCode, code)).intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件获取渠道
|
* 根据条件获取渠道
|
||||||
*
|
*
|
||||||
* @param merchantId 商户编号
|
* @param appId 应用编号
|
||||||
* @param appI 应用编号
|
|
||||||
* @param code 渠道编码
|
* @param code 渠道编码
|
||||||
* @return 数量
|
* @return 数量
|
||||||
*/
|
*/
|
||||||
default PayChannelDO selectOne(Long merchantId, Long appI, String code) {
|
default PayChannelDO selectOne(Long appId, String code) {
|
||||||
return this.selectOne((new QueryWrapper<PayChannelDO>().lambda()
|
return this.selectOne((new QueryWrapper<PayChannelDO>().lambda()
|
||||||
.eq(PayChannelDO::getMerchantId, merchantId)
|
.eq(PayChannelDO::getAppId, appId)
|
||||||
.eq(PayChannelDO::getAppId, appI)
|
|
||||||
.eq(PayChannelDO::getCode, code)
|
.eq(PayChannelDO::getCode, code)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -86,4 +56,10 @@ public interface PayChannelMapper extends BaseMapperX<PayChannelDO> {
|
|||||||
.in(PayChannelDO::getAppId, appIds));
|
.in(PayChannelDO::getAppId, appIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<PayChannelDO> selectListByAppId(Long appId, Integer status) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<PayChannelDO>()
|
||||||
|
.eq(PayChannelDO::getAppId, appId)
|
||||||
|
.eq(PayChannelDO::getStatus, status));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,53 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.mysql.merchant;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppExportReqVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.app.PayAppPageReqVO;
|
|
||||||
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 cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayAppDO;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PayAppMapper extends BaseMapperX<PayAppDO> {
|
|
||||||
|
|
||||||
default PageResult<PayAppDO> selectPage(PayAppPageReqVO reqVO, Collection<Long> merchantIds) {
|
|
||||||
return selectPage(reqVO, new QueryWrapperX<PayAppDO>()
|
|
||||||
.likeIfPresent("name", reqVO.getName())
|
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
|
||||||
.eqIfPresent("remark", reqVO.getRemark())
|
|
||||||
.eqIfPresent("pay_notify_url", reqVO.getPayNotifyUrl())
|
|
||||||
.eqIfPresent("refund_notify_url", reqVO.getRefundNotifyUrl())
|
|
||||||
.inIfPresent("merchant_id", merchantIds)
|
|
||||||
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
|
||||||
.orderByDesc("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<PayAppDO> selectList(PayAppExportReqVO reqVO, Collection<Long> merchantIds) {
|
|
||||||
return selectList(new QueryWrapperX<PayAppDO>()
|
|
||||||
.likeIfPresent("name", reqVO.getName())
|
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
|
||||||
.eqIfPresent("remark", reqVO.getRemark())
|
|
||||||
.eqIfPresent("pay_notify_url", reqVO.getPayNotifyUrl())
|
|
||||||
.eqIfPresent("refund_notify_url", reqVO.getRefundNotifyUrl())
|
|
||||||
.inIfPresent("merchant_id", merchantIds)
|
|
||||||
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
|
||||||
.orderByDesc("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<PayAppDO> getListByMerchantId(Long merchantId) {
|
|
||||||
return selectList(new LambdaQueryWrapper<PayAppDO>()
|
|
||||||
.select(PayAppDO::getId, PayAppDO::getName)
|
|
||||||
.eq(PayAppDO::getMerchantId, merchantId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO @aquan:方法名补充 ByMerchantId
|
|
||||||
default Long selectCount(Long merchantId) {
|
|
||||||
return selectCount(new LambdaQueryWrapper<PayAppDO>().eq(PayAppDO::getMerchantId, merchantId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.pay.dal.mysql.merchant;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExportReqVO;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.merchant.vo.merchant.PayMerchantPageReqVO;
|
|
||||||
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 cn.iocoder.yudao.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface PayMerchantMapper extends BaseMapperX<PayMerchantDO> {
|
|
||||||
|
|
||||||
default PageResult<PayMerchantDO> selectPage(PayMerchantPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new QueryWrapperX<PayMerchantDO>()
|
|
||||||
.likeIfPresent("no", reqVO.getNo())
|
|
||||||
.likeIfPresent("name", reqVO.getName())
|
|
||||||
.likeIfPresent("short_name", reqVO.getShortName())
|
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
|
||||||
.eqIfPresent("remark", reqVO.getRemark())
|
|
||||||
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
|
||||||
.orderByDesc("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<PayMerchantDO> selectList(PayMerchantExportReqVO reqVO) {
|
|
||||||
return selectList(new QueryWrapperX<PayMerchantDO>()
|
|
||||||
.likeIfPresent("no", reqVO.getNo())
|
|
||||||
.likeIfPresent("name", reqVO.getName())
|
|
||||||
.likeIfPresent("short_name", reqVO.getShortName())
|
|
||||||
.eqIfPresent("status", reqVO.getStatus())
|
|
||||||
.eqIfPresent("remark", reqVO.getRemark())
|
|
||||||
.betweenIfPresent("create_time", reqVO.getCreateTime())
|
|
||||||
.orderByDesc("id"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据商户名称模糊查询商户集合
|
|
||||||
*
|
|
||||||
* @param merchantName 商户名称
|
|
||||||
* @return 商户集合
|
|
||||||
*/
|
|
||||||
default List<PayMerchantDO> getMerchantListByName(String merchantName) {
|
|
||||||
return this.selectList(new QueryWrapperX<PayMerchantDO>()
|
|
||||||
.likeIfPresent("name", merchantName));
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user