mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
commit
50598ea29c
@ -91,6 +91,7 @@
|
|||||||
| 🚀 | 租户套餐 | 配置租户套餐,自定每个租户的菜单、操作、按钮的权限 |
|
| 🚀 | 租户套餐 | 配置租户套餐,自定每个租户的菜单、操作、按钮的权限 |
|
||||||
| | 字典管理 | 对系统中经常使用的一些较为固定的数据进行维护 |
|
| | 字典管理 | 对系统中经常使用的一些较为固定的数据进行维护 |
|
||||||
| 🚀 | 短信管理 | 短信渠道、短息模板、短信日志,对接阿里云、腾讯云等主流短信平台 |
|
| 🚀 | 短信管理 | 短信渠道、短息模板、短信日志,对接阿里云、腾讯云等主流短信平台 |
|
||||||
|
| 🚀 | 邮件管理 | 邮箱账号、邮件模版、邮件发送日志,支持所有邮件平台 |
|
||||||
| 🚀 | 操作日志 | 系统正常操作日志记录和查询,集成 Swagger 生成日志内容 |
|
| 🚀 | 操作日志 | 系统正常操作日志记录和查询,集成 Swagger 生成日志内容 |
|
||||||
| ⭐️ | 登录日志 | 系统登录日志记录查询,包含登录异常 |
|
| ⭐️ | 登录日志 | 系统登录日志记录查询,包含登录异常 |
|
||||||
| 🚀 | 错误码管理 | 系统所有错误码的管理,可在线修改错误提示,无需重启服务 |
|
| 🚀 | 错误码管理 | 系统所有错误码的管理,可在线修改错误提示,无需重启服务 |
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Target Server Version : 80026
|
Target Server Version : 80026
|
||||||
File Encoding : 65001
|
File Encoding : 65001
|
||||||
|
|
||||||
Date: 17/01/2023 23:47:35
|
Date: 27/01/2023 20:57:31
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
@ -300,7 +300,7 @@ CREATE TABLE `bpm_form` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的表单定义';
|
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的表单定义';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_form
|
-- Records of bpm_form
|
||||||
@ -329,7 +329,7 @@ CREATE TABLE `bpm_oa_leave` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 33 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OA 请假申请表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OA 请假申请表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_oa_leave
|
-- Records of bpm_oa_leave
|
||||||
@ -359,7 +359,7 @@ CREATE TABLE `bpm_process_definition_ext` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 135 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 流程定义的拓展表\n';
|
) ENGINE = InnoDB AUTO_INCREMENT = 140 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 流程定义的拓展表\n';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_process_definition_ext
|
-- Records of bpm_process_definition_ext
|
||||||
@ -389,7 +389,7 @@ CREATE TABLE `bpm_process_instance_ext` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 290 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程实例的拓展';
|
) ENGINE = InnoDB AUTO_INCREMENT = 295 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程实例的拓展';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_process_instance_ext
|
-- Records of bpm_process_instance_ext
|
||||||
@ -415,7 +415,7 @@ CREATE TABLE `bpm_task_assign_rule` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 265 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 任务规则表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 274 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 任务规则表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_task_assign_rule
|
-- Records of bpm_task_assign_rule
|
||||||
@ -444,7 +444,7 @@ CREATE TABLE `bpm_task_ext` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 341 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程任务的拓展表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 350 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程任务的拓展表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_task_ext
|
-- Records of bpm_task_ext
|
||||||
@ -469,7 +469,7 @@ CREATE TABLE `bpm_user_group` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 111 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户组';
|
) ENGINE = InnoDB AUTO_INCREMENT = 113 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户组';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of bpm_user_group
|
-- Records of bpm_user_group
|
||||||
@ -546,7 +546,7 @@ CREATE TABLE `infra_api_error_log` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 931 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
|
) ENGINE = InnoDB AUTO_INCREMENT = 949 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of infra_api_error_log
|
-- Records of infra_api_error_log
|
||||||
@ -584,7 +584,7 @@ CREATE TABLE `infra_codegen_column` (
|
|||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1533 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义';
|
) ENGINE = InnoDB AUTO_INCREMENT = 1582 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of infra_codegen_column
|
-- Records of infra_codegen_column
|
||||||
@ -616,7 +616,7 @@ CREATE TABLE `infra_codegen_table` (
|
|||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 119 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义';
|
) ENGINE = InnoDB AUTO_INCREMENT = 122 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of infra_codegen_table
|
-- Records of infra_codegen_table
|
||||||
@ -699,7 +699,7 @@ CREATE TABLE `infra_file` (
|
|||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 355 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 356 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of infra_file
|
-- Records of infra_file
|
||||||
@ -1191,7 +1191,7 @@ CREATE TABLE `system_dict_data` (
|
|||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1213 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 1227 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_dict_data
|
-- Records of system_dict_data
|
||||||
@ -1391,6 +1391,10 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
|
|||||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1220, 8, '地理位置', 'location', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 地理位置', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:23:51', b'0');
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1220, 8, '地理位置', 'location', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 地理位置', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:23:51', b'0');
|
||||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1221, 9, '链接', 'link', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 链接', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0');
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1221, 9, '链接', 'link', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 链接', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0');
|
||||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1222, 10, '事件', 'event', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 事件', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0');
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1222, 10, '事件', 'event', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 事件', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0');
|
||||||
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1223, 0, '初始化', '0', 'system_mail_send_status', 0, 'primary', '', '邮件发送状态 - 初始化\n', '1', '2023-01-26 09:53:49', '1', '2023-01-26 16:36:14', b'0');
|
||||||
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1224, 10, '发送成功', '10', 'system_mail_send_status', 0, 'success', '', '邮件发送状态 - 发送成功', '1', '2023-01-26 09:54:28', '1', '2023-01-26 16:36:22', b'0');
|
||||||
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1225, 20, '发送失败', '20', 'system_mail_send_status', 0, 'danger', '', '邮件发送状态 - 发送失败', '1', '2023-01-26 09:54:50', '1', '2023-01-26 16:36:26', b'0');
|
||||||
|
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1226, 30, '不发送', '30', 'system_mail_send_status', 0, 'info', '', '邮件发送状态 - 不发送', '1', '2023-01-26 09:55:06', '1', '2023-01-26 16:36:36', b'0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -1411,7 +1415,7 @@ CREATE TABLE `system_dict_type` (
|
|||||||
`deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间',
|
`deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE INDEX `dict_type`(`type` ASC) USING BTREE
|
UNIQUE INDEX `dict_type`(`type` ASC) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 165 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 167 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_dict_type
|
-- Records of system_dict_type
|
||||||
@ -1474,6 +1478,7 @@ INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creat
|
|||||||
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (163, '交易订单项的售后状态', 'trade_order_item_after_sale_status', 0, '交易订单项的售后状态', '1', '2022-12-10 20:58:08', '1', '2022-12-10 20:58:08', b'0', NULL);
|
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (163, '交易订单项的售后状态', 'trade_order_item_after_sale_status', 0, '交易订单项的售后状态', '1', '2022-12-10 20:58:08', '1', '2022-12-10 20:58:08', b'0', NULL);
|
||||||
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (164, '公众号自动回复的请求关键字匹配模式', 'mp_auto_reply_request_match', 0, '公众号自动回复的请求关键字匹配模式', '1', '2023-01-16 23:29:56', '1', '2023-01-16 23:29:56', b'0', '1970-01-01 00:00:00');
|
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (164, '公众号自动回复的请求关键字匹配模式', 'mp_auto_reply_request_match', 0, '公众号自动回复的请求关键字匹配模式', '1', '2023-01-16 23:29:56', '1', '2023-01-16 23:29:56', b'0', '1970-01-01 00:00:00');
|
||||||
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (165, '公众号的消息类型', 'mp_message_type', 0, '公众号的消息类型', '1', '2023-01-17 22:17:09', '1', '2023-01-17 22:17:09', b'0', '1970-01-01 00:00:00');
|
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (165, '公众号的消息类型', 'mp_message_type', 0, '公众号的消息类型', '1', '2023-01-17 22:17:09', '1', '2023-01-17 22:17:09', b'0', '1970-01-01 00:00:00');
|
||||||
|
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (166, '邮件发送状态', 'system_mail_send_status', 0, '邮件发送状态', '1', '2023-01-26 09:53:13', '1', '2023-01-26 09:53:13', b'0', '1970-01-01 00:00:00');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -1522,7 +1527,7 @@ CREATE TABLE `system_login_log` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1963 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
|
) ENGINE = InnoDB AUTO_INCREMENT = 1980 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_login_log
|
-- Records of system_login_log
|
||||||
@ -1530,6 +1535,102 @@ CREATE TABLE `system_login_log` (
|
|||||||
BEGIN;
|
BEGIN;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for system_mail_account
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `system_mail_account`;
|
||||||
|
CREATE TABLE `system_mail_account` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮箱',
|
||||||
|
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名',
|
||||||
|
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码',
|
||||||
|
`host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'SMTP 服务器域名',
|
||||||
|
`port` int NOT NULL COMMENT 'SMTP 服务器端口',
|
||||||
|
`ssl_enable` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否开启 SSL',
|
||||||
|
`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 '是否删除',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮箱账号表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of system_mail_account
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `system_mail_account` (`id`, `mail`, `username`, `password`, `host`, `port`, `ssl_enable`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '7684413@qq.com', '7684413@qq.com', '123457', '127.0.0.1', 8080, b'0', '1', '2023-01-25 17:39:52', '1', '2023-01-26 22:59:04', b'0');
|
||||||
|
INSERT INTO `system_mail_account` (`id`, `mail`, `username`, `password`, `host`, `port`, `ssl_enable`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, 'ydym_test@163.com', 'ydym_test@163.com', 'WBZTEINMIFVRYSOE', 'smtp.163.com', 465, b'1', '1', '2023-01-26 01:26:03', '1', '2023-01-26 01:26:03', b'0');
|
||||||
|
INSERT INTO `system_mail_account` (`id`, `mail`, `username`, `password`, `host`, `port`, `ssl_enable`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3, '76854114@qq.com', '3335', '11234', 'yunai1.cn', 466, b'0', '1', '2023-01-27 15:06:38', '1', '2023-01-27 07:08:36', b'1');
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for system_mail_log
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `system_mail_log`;
|
||||||
|
CREATE TABLE `system_mail_log` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`user_id` bigint NULL DEFAULT NULL COMMENT '用户编号',
|
||||||
|
`user_type` tinyint NULL DEFAULT NULL COMMENT '用户类型',
|
||||||
|
`to_mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '接收邮箱地址',
|
||||||
|
`account_id` bigint NOT NULL COMMENT '邮箱账号编号',
|
||||||
|
`from_mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送邮箱地址',
|
||||||
|
`template_id` bigint NOT NULL COMMENT '模板编号',
|
||||||
|
`template_code` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板编码',
|
||||||
|
`template_nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '模版发送人名称',
|
||||||
|
`template_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮件标题',
|
||||||
|
`template_content` varchar(10240) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮件内容',
|
||||||
|
`template_params` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮件参数',
|
||||||
|
`send_status` tinyint NOT NULL DEFAULT 0 COMMENT '发送状态',
|
||||||
|
`send_time` datetime NULL DEFAULT NULL COMMENT '发送时间',
|
||||||
|
`send_message_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送返回的消息 ID',
|
||||||
|
`send_exception` 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 '是否删除',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 354 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件日志表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of system_mail_log
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for system_mail_template
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `system_mail_template`;
|
||||||
|
CREATE TABLE `system_mail_template` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`name` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板名称',
|
||||||
|
`code` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板编码',
|
||||||
|
`account_id` bigint NOT NULL COMMENT '发送的邮箱账号编号',
|
||||||
|
`nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送人名称',
|
||||||
|
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板标题',
|
||||||
|
`content` varchar(10240) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板内容',
|
||||||
|
`params` varchar(255) 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 '是否删除',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件模版表';
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of system_mail_template
|
||||||
|
-- ----------------------------
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO `system_mail_template` (`id`, `name`, `code`, `account_id`, `nickname`, `title`, `content`, `params`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (13, '后台用户短信登录', 'admin-sms-login', 1, '奥特曼', '你猜我猜', '<p>您的验证码是{code},名字是{name}</p>', '[\"code\",\"name\"]', 0, '3', '1', '2021-10-11 08:10:00', '1', '2023-01-26 23:22:05', b'0');
|
||||||
|
INSERT INTO `system_mail_template` (`id`, `name`, `code`, `account_id`, `nickname`, `title`, `content`, `params`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (14, '测试模版', 'test_01', 2, '芋艿', '一个标题', '<p>你是 {key01} 吗?</p><p><br></p><p>是的话,赶紧 {key02} 一下!</p>', '[\"key01\",\"key02\"]', 0, NULL, '1', '2023-01-26 01:27:40', '1', '2023-01-27 10:32:16', b'0');
|
||||||
|
INSERT INTO `system_mail_template` (`id`, `name`, `code`, `account_id`, `nickname`, `title`, `content`, `params`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, '3', '2', 2, '7', '4', '<p>45</p>', '[]', 1, '80', '1', '2023-01-27 15:50:35', '1', '2023-01-27 16:34:49', b'0');
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for system_menu
|
-- Table structure for system_menu
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -1553,7 +1654,7 @@ CREATE TABLE `system_menu` (
|
|||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 2125 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 2144 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_menu
|
-- Records of system_menu
|
||||||
@ -1776,7 +1877,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
|
|||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1250, '敏感词更新', 'system:sensitive-word:update', 3, 3, 1247, '', '', '', 0, b'1', b'1', '', '2022-04-07 16:55:03', '', '2022-04-20 17:03:10', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1250, '敏感词更新', 'system:sensitive-word:update', 3, 3, 1247, '', '', '', 0, b'1', b'1', '', '2022-04-07 16:55:03', '', '2022-04-20 17:03:10', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1251, '敏感词删除', 'system:sensitive-word:delete', 3, 4, 1247, '', '', '', 0, b'1', b'1', '', '2022-04-07 16:55:03', '', '2022-04-20 17:03:10', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1251, '敏感词删除', 'system:sensitive-word:delete', 3, 4, 1247, '', '', '', 0, b'1', b'1', '', '2022-04-07 16:55:03', '', '2022-04-20 17:03:10', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1252, '敏感词导出', 'system:sensitive-word:export', 3, 5, 1247, '', '', '', 0, b'1', b'1', '', '2022-04-07 16:55:03', '', '2022-04-20 17:03:10', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1252, '敏感词导出', 'system:sensitive-word:export', 3, 5, 1247, '', '', '', 0, b'1', b'1', '', '2022-04-07 16:55:03', '', '2022-04-20 17:03:10', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1254, '作者动态', '', 1, 0, 0, 'https://www.iocoder.cn', 'people', NULL, 0, b'1', b'1', '1', '2022-04-23 01:03:15', '1', '2022-06-22 13:35:05', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1254, '作者动态', '', 1, 0, 0, 'https://www.iocoder.cn', 'people', NULL, 0, b'1', b'1', '1', '2022-04-23 01:03:15', '1', '2023-01-25 20:05:55', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1255, '数据源配置', '', 2, 1, 2, 'data-source-config', 'rate', 'infra/dataSourceConfig/index', 0, b'1', b'1', '', '2022-04-27 14:37:32', '1', '2022-04-27 22:42:06', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1255, '数据源配置', '', 2, 1, 2, 'data-source-config', 'rate', 'infra/dataSourceConfig/index', 0, b'1', b'1', '', '2022-04-27 14:37:32', '1', '2022-04-27 22:42:06', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1256, '数据源配置查询', 'infra:data-source-config:query', 3, 1, 1255, '', '', '', 0, b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1256, '数据源配置查询', 'infra:data-source-config:query', 3, 1, 1255, '', '', '', 0, b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1257, '数据源配置创建', 'infra:data-source-config:create', 3, 2, 1255, '', '', '', 0, b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1257, '数据源配置创建', 'infra:data-source-config:create', 3, 2, 1255, '', '', '', 0, b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0');
|
||||||
@ -1908,6 +2009,20 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
|
|||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2127, '删除菜单', 'mp:menu:delete', 3, 2, 2119, '', '', '', 0, b'1', b'1', '1', '2023-01-17 23:06:16', '1', '2023-01-17 23:06:16', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2127, '删除菜单', 'mp:menu:delete', 3, 2, 2119, '', '', '', 0, b'1', b'1', '1', '2023-01-17 23:06:16', '1', '2023-01-17 23:06:16', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2128, '查询消息', 'mp:message:query', 3, 0, 2103, '', '', '', 0, b'1', b'1', '1', '2023-01-17 23:07:14', '1', '2023-01-17 23:07:14', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2128, '查询消息', 'mp:message:query', 3, 0, 2103, '', '', '', 0, b'1', b'1', '1', '2023-01-17 23:07:14', '1', '2023-01-17 23:07:14', b'0');
|
||||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2129, '发送消息', 'mp:message:send', 3, 1, 2103, '', '', '', 0, b'1', b'1', '1', '2023-01-17 23:07:26', '1', '2023-01-17 23:07:26', b'0');
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2129, '发送消息', 'mp:message:send', 3, 1, 2103, '', '', '', 0, b'1', b'1', '1', '2023-01-17 23:07:26', '1', '2023-01-17 23:07:26', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2130, '邮箱管理', '', 2, 11, 1, 'mail', 'email', NULL, 0, b'1', b'1', '1', '2023-01-25 17:27:44', '1', '2023-01-25 17:27:44', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2131, '邮箱账号', '', 2, 0, 2130, 'mail-account', 'user', 'system/mail/account/index', 0, b'1', b'1', '', '2023-01-25 09:33:48', '1', '2023-01-26 16:37:37', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2132, '账号查询', 'system:mail-account:query', 3, 1, 2131, '', '', '', 0, b'1', b'1', '', '2023-01-25 09:33:48', '', '2023-01-25 09:33:48', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2133, '账号创建', 'system:mail-account:create', 3, 2, 2131, '', '', '', 0, b'1', b'1', '', '2023-01-25 09:33:48', '', '2023-01-25 09:33:48', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2134, '账号更新', 'system:mail-account:update', 3, 3, 2131, '', '', '', 0, b'1', b'1', '', '2023-01-25 09:33:48', '', '2023-01-25 09:33:48', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2135, '账号删除', 'system:mail-account:delete', 3, 4, 2131, '', '', '', 0, b'1', b'1', '', '2023-01-25 09:33:48', '', '2023-01-25 09:33:48', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2136, '邮件模版', '', 2, 0, 2130, 'mail-template', 'education', 'system/mail/template/index', 0, b'1', b'1', '', '2023-01-25 12:05:31', '1', '2023-01-26 16:38:35', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2137, '模版查询', 'system:mail-template:query', 3, 1, 2136, '', '', '', 0, b'1', b'1', '', '2023-01-25 12:05:31', '', '2023-01-25 12:05:31', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2138, '模版创建', 'system:mail-template:create', 3, 2, 2136, '', '', '', 0, b'1', b'1', '', '2023-01-25 12:05:31', '', '2023-01-25 12:05:31', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2139, '模版更新', 'system:mail-template:update', 3, 3, 2136, '', '', '', 0, b'1', b'1', '', '2023-01-25 12:05:31', '', '2023-01-25 12:05:31', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2140, '模版删除', 'system:mail-template:delete', 3, 4, 2136, '', '', '', 0, b'1', b'1', '', '2023-01-25 12:05:31', '', '2023-01-25 12:05:31', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2141, '邮件记录', '', 2, 0, 2130, 'mail-log', 'log', 'system/mail/log/index', 0, b'1', b'1', '', '2023-01-26 02:16:50', '1', '2023-01-26 16:38:27', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2142, '日志查询', 'system:mail-log:query', 3, 1, 2141, '', '', '', 0, b'1', b'1', '', '2023-01-26 02:16:50', '', '2023-01-26 02:16:50', b'0');
|
||||||
|
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2143, '发送测试邮件', 'system:mail-template:send-mail', 3, 5, 2136, '', '', '', 0, b'1', b'1', '1', '2023-01-26 23:29:15', '1', '2023-01-26 23:29:15', b'0');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -1958,7 +2073,7 @@ CREATE TABLE `system_oauth2_access_token` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1083 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
|
) ENGINE = InnoDB AUTO_INCREMENT = 1214 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_oauth2_access_token
|
-- Records of system_oauth2_access_token
|
||||||
@ -2080,7 +2195,7 @@ CREATE TABLE `system_oauth2_refresh_token` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 571 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌';
|
) ENGINE = InnoDB AUTO_INCREMENT = 588 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_oauth2_refresh_token
|
-- Records of system_oauth2_refresh_token
|
||||||
@ -2120,7 +2235,7 @@ CREATE TABLE `system_operate_log` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 4018 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录';
|
) ENGINE = InnoDB AUTO_INCREMENT = 4177 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_operate_log
|
-- Records of system_operate_log
|
||||||
@ -2212,7 +2327,7 @@ CREATE TABLE `system_role_menu` (
|
|||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 1991 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色和菜单关联表';
|
) ENGINE = InnoDB AUTO_INCREMENT = 2185 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色和菜单关联表';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_role_menu
|
-- Records of system_role_menu
|
||||||
@ -2628,6 +2743,194 @@ INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_t
|
|||||||
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1988, 118, 1018, '1', '2022-12-30 11:47:52', '1', '2022-12-30 11:47:52', b'0', 129);
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1988, 118, 1018, '1', '2022-12-30 11:47:52', '1', '2022-12-30 11:47:52', b'0', 129);
|
||||||
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1989, 118, 1019, '1', '2022-12-30 11:47:52', '1', '2022-12-30 11:47:52', b'0', 129);
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1989, 118, 1019, '1', '2022-12-30 11:47:52', '1', '2022-12-30 11:47:52', b'0', 129);
|
||||||
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1990, 118, 1020, '1', '2022-12-30 11:47:52', '1', '2022-12-30 11:47:52', b'0', 129);
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1990, 118, 1020, '1', '2022-12-30 11:47:52', '1', '2022-12-30 11:47:52', b'0', 129);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1991, 2, 1024, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1992, 2, 1025, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1993, 2, 1026, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1994, 2, 1027, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1995, 2, 1028, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1996, 2, 1029, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1997, 2, 1030, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1998, 2, 1031, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1999, 2, 1032, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2000, 2, 1033, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2001, 2, 1034, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2002, 2, 1035, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2003, 2, 1036, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2004, 2, 1037, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2005, 2, 1038, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2006, 2, 1039, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2007, 2, 1040, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2008, 2, 1042, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2009, 2, 1043, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2010, 2, 1045, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2011, 2, 1046, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2012, 2, 1048, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2013, 2, 1050, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2014, 2, 1051, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2015, 2, 1052, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2016, 2, 1053, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2017, 2, 1054, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2018, 2, 1056, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2019, 2, 1057, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2020, 2, 1058, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2021, 2, 2083, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2022, 2, 1059, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2023, 2, 1060, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2024, 2, 1063, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2025, 2, 1064, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2026, 2, 1065, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2027, 2, 1066, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2028, 2, 1067, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2029, 2, 1070, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2030, 2, 1071, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2031, 2, 1072, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2032, 2, 1073, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2033, 2, 1074, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2034, 2, 1075, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2035, 2, 1076, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2036, 2, 1082, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2037, 2, 1085, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2038, 2, 1086, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2039, 2, 1087, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2040, 2, 1088, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2041, 2, 1089, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2042, 2, 1091, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2043, 2, 1092, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2044, 2, 1095, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2045, 2, 1096, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2046, 2, 1097, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2047, 2, 1098, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2048, 2, 1101, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2049, 2, 1102, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2050, 2, 1103, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2051, 2, 1104, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2052, 2, 1105, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2053, 2, 1106, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2054, 2, 1108, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2055, 2, 1109, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2056, 2, 1111, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2057, 2, 1112, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2058, 2, 1113, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2059, 2, 1114, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2060, 2, 1115, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2061, 2, 1127, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2062, 2, 1128, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2063, 2, 1129, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2064, 2, 1130, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2065, 2, 1131, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2066, 2, 1132, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2067, 2, 1133, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2068, 2, 1134, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2069, 2, 1135, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2070, 2, 1136, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2071, 2, 1137, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2072, 2, 114, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2073, 2, 1139, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2074, 2, 115, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2075, 2, 1140, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2076, 2, 116, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2077, 2, 1141, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2078, 2, 1142, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2079, 2, 1143, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2080, 2, 1150, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2081, 2, 1161, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2082, 2, 1162, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2083, 2, 1163, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2084, 2, 1164, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2085, 2, 1165, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2086, 2, 1166, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2087, 2, 1173, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2088, 2, 1174, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2089, 2, 1175, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2090, 2, 1176, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2091, 2, 1177, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2092, 2, 1178, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2093, 2, 1179, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2094, 2, 1180, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2095, 2, 1181, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2096, 2, 1182, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2097, 2, 1183, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2098, 2, 1184, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2099, 2, 1226, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2100, 2, 1227, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2101, 2, 1228, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2102, 2, 1229, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2103, 2, 1237, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2104, 2, 1238, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2105, 2, 1239, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2106, 2, 1240, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2107, 2, 1241, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2108, 2, 1242, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2109, 2, 1243, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2110, 2, 1247, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2111, 2, 1248, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2112, 2, 1249, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2113, 2, 1250, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2114, 2, 1251, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2115, 2, 1252, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2116, 2, 1254, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2117, 2, 1255, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2118, 2, 1256, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2119, 2, 1257, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2120, 2, 1258, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2121, 2, 1259, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2122, 2, 1260, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2123, 2, 1261, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2124, 2, 1263, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2125, 2, 1264, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2126, 2, 1265, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2127, 2, 1266, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2128, 2, 1267, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2129, 2, 1001, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2130, 2, 1002, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2131, 2, 1003, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2132, 2, 1004, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2133, 2, 1005, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2134, 2, 1006, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2135, 2, 1007, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2136, 2, 1008, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2137, 2, 1009, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2138, 2, 1010, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2139, 2, 1011, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2140, 2, 1012, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2141, 2, 1013, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2142, 2, 1014, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2143, 2, 1015, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2144, 2, 1016, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2145, 2, 1017, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2146, 2, 1018, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2147, 2, 1019, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2148, 2, 1020, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2149, 2, 1021, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2150, 2, 1022, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2151, 2, 1023, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2152, 2, 1281, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2153, 2, 1282, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2154, 2, 2000, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2155, 2, 2002, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2156, 2, 2003, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2157, 2, 2004, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2158, 2, 2005, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2159, 2, 2006, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2160, 2, 2008, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2161, 2, 2009, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2162, 2, 2010, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2163, 2, 2011, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2164, 2, 2012, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2170, 2, 2019, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2171, 2, 2020, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2172, 2, 2021, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2173, 2, 2022, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2174, 2, 2023, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2175, 2, 2025, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2177, 2, 2027, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2178, 2, 2028, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2179, 2, 2029, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2180, 2, 2014, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2181, 2, 2015, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2182, 2, 2016, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2183, 2, 2017, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0', 1);
|
||||||
|
INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2184, 2, 2018, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0', 1);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@ -2752,7 +3055,7 @@ CREATE TABLE `system_sms_log` (
|
|||||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB AUTO_INCREMENT = 339 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
|
) ENGINE = InnoDB AUTO_INCREMENT = 347 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of system_sms_log
|
-- Records of system_sms_log
|
||||||
@ -3050,7 +3353,7 @@ CREATE TABLE `system_users` (
|
|||||||
-- Records of system_users
|
-- Records of system_users
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '127.0.0.1', '2023-01-17 12:33:07', 'admin', '2021-01-05 17:03:47', NULL, '2023-01-17 12:33:07', b'0', 1);
|
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-01-27 14:31:00', 'admin', '2021-01-05 17:03:47', NULL, '2023-01-27 14:31:00', b'0', 1);
|
||||||
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1);
|
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1);
|
||||||
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1);
|
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1);
|
||||||
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$GP8zvqHB//TekuzYZSBYAuBQJiNq1.fxQVDYJ.uBCOnWCtDVKE4H6', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '127.0.0.1', '2022-05-28 15:43:17', '', '2021-01-21 02:13:53', NULL, '2022-07-09 09:00:33', b'0', 1);
|
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$GP8zvqHB//TekuzYZSBYAuBQJiNq1.fxQVDYJ.uBCOnWCtDVKE4H6', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '127.0.0.1', '2022-05-28 15:43:17', '', '2021-01-21 02:13:53', NULL, '2022-07-09 09:00:33', b'0', 1);
|
||||||
|
@ -41,6 +41,11 @@ public class LocalDateTimeUtils {
|
|||||||
return LocalDateTime.of(year, mouth, day, 0, 0, 0);
|
return LocalDateTime.of(year, mouth, day, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime[] buildBetweenTime(int year1, int mouth1, int day1,
|
||||||
|
int year2, int mouth2, int day2) {
|
||||||
|
return new LocalDateTime[]{buildTime(year1, mouth1, day1), buildTime(year2, mouth2, day2)};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断当前时间是否在该时间范围内
|
* 判断当前时间是否在该时间范围内
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,10 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import uk.co.jemos.podam.api.PodamFactory;
|
import uk.co.jemos.podam.api.PodamFactory;
|
||||||
import uk.co.jemos.podam.api.PodamFactoryImpl;
|
import uk.co.jemos.podam.api.PodamFactoryImpl;
|
||||||
|
import uk.co.jemos.podam.common.AttributeStrategy;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -95,6 +98,10 @@ public class RandomUtils {
|
|||||||
return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
|
return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String randomEmail() {
|
||||||
|
return randomString() + "@qq.com";
|
||||||
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public static <T> T randomPojo(Class<T> clazz, Consumer<T>... consumers) {
|
public static <T> T randomPojo(Class<T> clazz, Consumer<T>... consumers) {
|
||||||
T pojo = PODAM_FACTORY.manufacturePojo(clazz);
|
T pojo = PODAM_FACTORY.manufacturePojo(clazz);
|
||||||
|
@ -79,7 +79,7 @@ public class TestDemoServiceImpl implements TestDemoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO) {
|
public PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO) {
|
||||||
// testDemoMapper.selectList2();
|
testDemoMapper.selectList2();
|
||||||
return testDemoMapper.selectPage(pageReqVO);
|
return testDemoMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱发送 API 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface MailSendApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条邮箱给 Admin 用户
|
||||||
|
*
|
||||||
|
* 在 mail 为空时,使用 userId 加载对应 Admin 的邮箱
|
||||||
|
*
|
||||||
|
* @param reqDTO 发送请求
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
Long sendSingleMailToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条邮箱给 Member 用户
|
||||||
|
*
|
||||||
|
* 在 mail 为空时,使用 userId 加载对应 Member 的邮箱
|
||||||
|
*
|
||||||
|
* @param reqDTO 发送请求
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
Long sendSingleMailToMember(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.mail.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件发送 Request DTO
|
||||||
|
*
|
||||||
|
* @author wangjingqi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MailSendSingleToUserReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@Email
|
||||||
|
private String mail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模板编号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "邮件模板编号不能为空")
|
||||||
|
private String templateCode;
|
||||||
|
/**
|
||||||
|
* 邮件模板参数
|
||||||
|
*/
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
}
|
@ -141,4 +141,16 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在");
|
ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在");
|
||||||
ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022001, "code 已过期");
|
ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022001, "code 已过期");
|
||||||
|
|
||||||
|
// ========== 邮箱账号 1002023000 ==========
|
||||||
|
ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002023000, "邮箱账号不存在");
|
||||||
|
ErrorCode MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002023001, "无法删除,该邮箱账号还有邮件模板");
|
||||||
|
|
||||||
|
// ========== 邮件模版 1002024000 ==========
|
||||||
|
ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002024000, "邮件模版不存在");
|
||||||
|
ErrorCode MAIL_TEMPLATE_CODE_EXISTS = new ErrorCode(1002024001, "邮件模版 code({}) 已存在");
|
||||||
|
|
||||||
|
// ========== 邮件发送 1002025000 ==========
|
||||||
|
ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
|
||||||
|
ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1002025000, "邮箱不存在");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.enums.mail;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件的发送状态枚举
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022/4/10 13:39
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum MailSendStatusEnum {
|
||||||
|
|
||||||
|
INIT(0), // 初始化
|
||||||
|
SUCCESS(10), // 发送成功
|
||||||
|
FAILURE(20), // 发送失败
|
||||||
|
IGNORE(30), // 忽略,即不发送
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int status;
|
||||||
|
|
||||||
|
}
|
@ -106,6 +106,10 @@
|
|||||||
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
|
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailSendService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件发送 API 实现类
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MailSendApiImpl implements MailSendApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailSendService mailSendService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMailToAdmin(MailSendSingleToUserReqDTO reqDTO) {
|
||||||
|
return mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(),
|
||||||
|
reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMailToMember(MailSendSingleToUserReqDTO reqDTO) {
|
||||||
|
return mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(),
|
||||||
|
reqDTO.getTemplateCode(), reqDTO.getTemplateParams());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.*;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Api(tags = "管理后台 - 邮箱账号")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/mail-account")
|
||||||
|
public class MailAccountController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailAccountService mailAccountService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@ApiOperation("创建邮箱账号")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-account:create')")
|
||||||
|
public CommonResult<Long> createMailAccount(@Valid @RequestBody MailAccountCreateReqVO createReqVO) {
|
||||||
|
return success(mailAccountService.createMailAccount(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("修改邮箱账号")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-account:update')")
|
||||||
|
public CommonResult<Boolean> updateMailAccount(@Valid @RequestBody MailAccountUpdateReqVO updateReqVO) {
|
||||||
|
mailAccountService.updateMailAccount(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@ApiOperation("删除邮箱账号")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-account:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMailAccount(@RequestParam Long id) {
|
||||||
|
mailAccountService.deleteMailAccount(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得邮箱账号")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-account:get')")
|
||||||
|
public CommonResult<MailAccountRespVO> getMailAccount(@RequestParam("id") Long id) {
|
||||||
|
MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id);
|
||||||
|
return success(MailAccountConvert.INSTANCE.convert(mailAccountDO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得邮箱账号分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-account:query')")
|
||||||
|
public CommonResult<PageResult<MailAccountBaseVO>> getMailAccountPage(@Valid MailAccountPageReqVO pageReqVO) {
|
||||||
|
PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO);
|
||||||
|
return success(MailAccountConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@ApiOperation(value = "获得邮箱账号精简列表")
|
||||||
|
public CommonResult<List<MailAccountSimpleRespVO>> getSimpleMailAccountList() {
|
||||||
|
List<MailAccountDO> list = mailAccountService.getMailAccountList();
|
||||||
|
return success(MailAccountConvert.INSTANCE.convertList02(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailLogConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
@Api(tags = "管理后台 - 邮件日志")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/mail-log")
|
||||||
|
public class MailLogController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailLogService mailLogService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得邮箱日志分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-log:query')")
|
||||||
|
public CommonResult<PageResult<MailLogRespVO>> getMailLogPage(@Valid MailLogPageReqVO pageVO) {
|
||||||
|
PageResult<MailLogDO> pageResult = mailLogService.getMailLogPage(pageVO);
|
||||||
|
return success(MailLogConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得邮箱日志")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-log:query')")
|
||||||
|
public CommonResult<MailLogRespVO> getMailTemplate(@RequestParam("id") Long id) {
|
||||||
|
MailLogDO mailLogDO = mailLogService.getMailLog(id);
|
||||||
|
return success(MailLogConvert.INSTANCE.convert(mailLogDO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
### 请求 /system/mail-template/send-mail 接口 => 成功
|
||||||
|
POST {{baseUrl}}/system/mail-template/send-mail
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
Content-Type: application/json
|
||||||
|
tenant-id: {{adminTenentId}}
|
||||||
|
|
||||||
|
{
|
||||||
|
"templateCode": "test_01",
|
||||||
|
"mail": "7685413@qq.com",
|
||||||
|
"templateParams": {
|
||||||
|
"key01": "value01",
|
||||||
|
"key02": "value02"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.*;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSendReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailSendService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailTemplateService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Api(tags = "管理后台 - 邮件模版")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/mail-template")
|
||||||
|
public class MailTemplateController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailTemplateService mailTempleService;
|
||||||
|
@Resource
|
||||||
|
private MailSendService mailSendService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@ApiOperation("创建邮件模版")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-template:create')")
|
||||||
|
public CommonResult<Long> createMailTemplate(@Valid @RequestBody MailTemplateCreateReqVO createReqVO){
|
||||||
|
return success(mailTempleService.createMailTemplate(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("修改邮件模版")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-template:update')")
|
||||||
|
public CommonResult<Boolean> updateMailTemplate(@Valid @RequestBody MailTemplateUpdateReqVO updateReqVO){
|
||||||
|
mailTempleService.updateMailTemplate(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@ApiOperation("删除邮件模版")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-template:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMailTemplate(@RequestParam("id") Long id) {
|
||||||
|
mailTempleService.deleteMailTemplate(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得邮件模版")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-template:get')")
|
||||||
|
public CommonResult<MailTemplateRespVO> getMailTemplate(@RequestParam("id") Long id) {
|
||||||
|
MailTemplateDO mailTemplateDO = mailTempleService.getMailTemplate(id);
|
||||||
|
return success(MailTemplateConvert.INSTANCE.convert(mailTemplateDO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得邮件模版分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-template:query')")
|
||||||
|
public CommonResult<PageResult<MailTemplateRespVO>> getMailTemplatePage(@Valid MailTemplatePageReqVO pageReqVO) {
|
||||||
|
PageResult<MailTemplateDO> pageResult = mailTempleService.getMailTemplatePage(pageReqVO);
|
||||||
|
return success(MailTemplateConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@ApiOperation(value = "获得邮件模版精简列表")
|
||||||
|
public CommonResult<List<MailTemplateSimpleRespVO>> getSimpleTemplateList() {
|
||||||
|
List<MailTemplateDO> list = mailTempleService.getMailTemplateList();
|
||||||
|
return success(MailTemplateConvert.INSTANCE.convertList02(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/send-mail")
|
||||||
|
@ApiOperation("发送短信")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-template:send-mail')")
|
||||||
|
public CommonResult<Long> sendMail(@Valid @RequestBody MailTemplateSendReqVO sendReqVO) {
|
||||||
|
return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), null,
|
||||||
|
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MailAccountBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱", required = true, example = "yudaoyuanma@123.com")
|
||||||
|
@NotNull(message = "邮箱不能为空")
|
||||||
|
@Email(message = "必须是 Email 格式")
|
||||||
|
private String mail;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户名", required = true, example = "yudao")
|
||||||
|
@NotNull(message = "用户名不能为空")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "密码", required = true, example = "123456")
|
||||||
|
@NotNull(message = "密码必填")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SMTP 服务器域名", required = true, example = "www.iocoder.cn")
|
||||||
|
@NotNull(message = "SMTP 服务器域名不能为空")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "SMTP 服务器端口", required = true, example = "80")
|
||||||
|
@NotNull(message = "SMTP 服务器端口不能为空")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否开启 ssl", required = true, example = "true")
|
||||||
|
@NotNull(message = "是否开启 ssl 必填")
|
||||||
|
private Boolean sslEnable;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮箱账号创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailAccountCreateReqVO extends MailAccountBaseVO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮箱账号分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailAccountPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱", required = true, example = "yudaoyuanma@123.com")
|
||||||
|
private String mail;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户名" , required = true , example = "yudao")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮箱账号 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailAccountRespVO extends MailAccountBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮箱账号的精简 Response VO")
|
||||||
|
@Data
|
||||||
|
public class MailAccountSimpleRespVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱", required = true, example = "768541388@qq.com")
|
||||||
|
private String mail;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮箱账号修改 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailAccountUpdateReqVO extends MailAccountBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件日志 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MailLogBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编号", example = "30883")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户类型", example = "2", notes = "参见 UserTypeEnum 枚举")
|
||||||
|
private Byte userType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收邮箱地址", required = true, example = "76854@qq.com")
|
||||||
|
@NotNull(message = "接收邮箱地址不能为空")
|
||||||
|
private String toMail;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱账号编号", required = true, example = "18107")
|
||||||
|
@NotNull(message = "邮箱账号编号不能为空")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送邮箱地址", required = true, example = "85757@qq.com")
|
||||||
|
@NotNull(message = "发送邮箱地址不能为空")
|
||||||
|
private String fromMail;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编号", required = true, example = "5678")
|
||||||
|
@NotNull(message = "模板编号不能为空")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编码", required = true, example = "test_01")
|
||||||
|
@NotNull(message = "模板编码不能为空")
|
||||||
|
private String templateCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版发送人名称", example = "李四")
|
||||||
|
private String templateNickname;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮件标题", required = true, example = "测试标题")
|
||||||
|
@NotNull(message = "邮件标题不能为空")
|
||||||
|
private String templateTitle;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮件内容", required = true, example = "测试内容")
|
||||||
|
@NotNull(message = "邮件内容不能为空")
|
||||||
|
private String templateContent;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮件参数", required = true)
|
||||||
|
@NotNull(message = "邮件参数不能为空")
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态", required = true, example = "1", notes = "参见 MailSendStatusEnum 枚举")
|
||||||
|
@NotNull(message = "发送状态不能为空")
|
||||||
|
private Byte sendStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime sendTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送返回的消息 ID", example = "28568")
|
||||||
|
private String sendMessageId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送异常")
|
||||||
|
private String sendException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮箱日志分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailLogPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编号", example = "30883")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户类型", example = "2", notes = "参见 UserTypeEnum 枚举")
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收邮箱地址", example = "76854@qq.com", notes = "模糊匹配")
|
||||||
|
private String toMail;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱账号编号", example = "18107")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编号", example = "5678")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态", example = "1", notes = "参见 MailSendStatusEnum 枚举")
|
||||||
|
private Integer sendStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] sendTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件日志 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailLogRespVO extends MailLogBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "31020")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MailTemplateBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版名称", required = true, example = "测试名字")
|
||||||
|
@NotNull(message = "名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版编号", required = true, example = "test")
|
||||||
|
@NotNull(message = "模版编号不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送的邮箱账号编号", required = true, example = "1")
|
||||||
|
@NotNull(message = "发送的邮箱账号编号不能为空")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送人名称", example = "芋头")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标题", required = true, example = "注册成功")
|
||||||
|
@NotEmpty(message = "标题不能为空")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容", required = true, example = "你好,注册成功啦")
|
||||||
|
@NotEmpty(message = "内容不能为空")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注", example = "奥特曼")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件模版创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailTemplateCreateReqVO extends MailTemplateBaseVO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件模版分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailTemplatePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态", example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标识", example = "code_1024", notes = "模糊匹配")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称", example = "芋头", notes = "模糊匹配")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "账号编号", example = "2048")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件末班 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailTemplateRespVO extends MailTemplateBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "参数数组", example = "name,code")
|
||||||
|
private List<String> params;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件发送 Req VO")
|
||||||
|
@Data
|
||||||
|
public class MailTemplateSendReqVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收邮箱", required = true, example = "7685413@qq.com")
|
||||||
|
@NotEmpty(message = "接收邮箱不能为空")
|
||||||
|
private String mail;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编码", required = true, example = "test_01")
|
||||||
|
@NotNull(message = "模板编码不能为空")
|
||||||
|
private String templateCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板参数")
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件模版的精简 Response VO")
|
||||||
|
@Data
|
||||||
|
public class MailTemplateSimpleRespVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版名字", required = true, example = "哒哒哒")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 邮件模版修改 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class MailTemplateUpdateReqVO extends MailTemplateBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.convert.mail;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.mail.MailAccount;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.*;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailAccountConvert {
|
||||||
|
|
||||||
|
MailAccountConvert INSTANCE = Mappers.getMapper(MailAccountConvert.class);
|
||||||
|
|
||||||
|
MailAccountDO convert(MailAccountCreateReqVO bean);
|
||||||
|
|
||||||
|
MailAccountDO convert(MailAccountUpdateReqVO bean);
|
||||||
|
|
||||||
|
MailAccountRespVO convert(MailAccountDO bean);
|
||||||
|
|
||||||
|
PageResult<MailAccountBaseVO> convertPage(PageResult<MailAccountDO> pageResult);
|
||||||
|
|
||||||
|
List<MailAccountSimpleRespVO> convertList02(List<MailAccountDO> list);
|
||||||
|
|
||||||
|
default MailAccount convert(MailAccountDO account, String nickname) {
|
||||||
|
String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail();
|
||||||
|
return new MailAccount().setFrom(from).setAuth(true)
|
||||||
|
.setUser(account.getUsername()).setPass(account.getPassword())
|
||||||
|
.setHost(account.getHost()).setPort(account.getPort()).setSslEnable(account.getSslEnable());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.convert.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailLogConvert {
|
||||||
|
|
||||||
|
MailLogConvert INSTANCE = Mappers.getMapper(MailLogConvert.class);
|
||||||
|
|
||||||
|
PageResult<MailLogRespVO> convertPage(PageResult<MailLogDO> pageResult);
|
||||||
|
|
||||||
|
MailLogRespVO convert(MailLogDO bean);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.convert.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.*;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailTemplateConvert {
|
||||||
|
|
||||||
|
MailTemplateConvert INSTANCE = Mappers.getMapper(MailTemplateConvert.class);
|
||||||
|
|
||||||
|
MailTemplateDO convert(MailTemplateUpdateReqVO bean);
|
||||||
|
|
||||||
|
MailTemplateDO convert(MailTemplateCreateReqVO bean);
|
||||||
|
|
||||||
|
MailTemplateRespVO convert(MailTemplateDO bean);
|
||||||
|
|
||||||
|
PageResult<MailTemplateRespVO> convertPage(PageResult<MailTemplateDO> pageResult);
|
||||||
|
|
||||||
|
List<MailTemplateSimpleRespVO> convertList02(List<MailTemplateDO> list);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号 DO
|
||||||
|
*
|
||||||
|
* 用途:配置发送邮箱的账号
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@TableName(value = "system_mail_account", autoResultMap = true)
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class MailAccountDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String mail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* SMTP 服务器域名
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
/**
|
||||||
|
* SMTP 服务器端口
|
||||||
|
*/
|
||||||
|
private Integer port;
|
||||||
|
/**
|
||||||
|
* 是否开启 SSL
|
||||||
|
*/
|
||||||
|
private Boolean sslEnable;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱日志 DO
|
||||||
|
* 记录每一次邮件的发送
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@TableName(value = "system_mail_log", autoResultMap = true)
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MailLogDO extends BaseDO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志编号,自增
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编码
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户类型
|
||||||
|
*
|
||||||
|
* 枚举 {@link UserTypeEnum}
|
||||||
|
*/
|
||||||
|
private Integer userType;
|
||||||
|
/**
|
||||||
|
* 接收邮箱地址
|
||||||
|
*/
|
||||||
|
private String toMail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号编号
|
||||||
|
*
|
||||||
|
* 关联 {@link MailAccountDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long accountId;
|
||||||
|
/**
|
||||||
|
* 发送邮箱地址
|
||||||
|
*
|
||||||
|
* 冗余 {@link MailAccountDO#getMail()}
|
||||||
|
*/
|
||||||
|
private String fromMail;
|
||||||
|
|
||||||
|
// ========= 模板相关字段 =========
|
||||||
|
/**
|
||||||
|
* 模版编号
|
||||||
|
*
|
||||||
|
* 关联 {@link MailTemplateDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long templateId;
|
||||||
|
/**
|
||||||
|
* 模版编码
|
||||||
|
*
|
||||||
|
* 冗余 {@link MailTemplateDO#getCode()}
|
||||||
|
*/
|
||||||
|
private String templateCode;
|
||||||
|
/**
|
||||||
|
* 模版发送人名称
|
||||||
|
*
|
||||||
|
* 冗余 {@link MailTemplateDO#getNickname()}
|
||||||
|
*/
|
||||||
|
private String templateNickname;
|
||||||
|
/**
|
||||||
|
* 模版标题
|
||||||
|
*/
|
||||||
|
private String templateTitle;
|
||||||
|
/**
|
||||||
|
* 模版内容
|
||||||
|
*
|
||||||
|
* 基于 {@link MailTemplateDO#getContent()} 格式化后的内容
|
||||||
|
*/
|
||||||
|
private String templateContent;
|
||||||
|
/**
|
||||||
|
* 模版参数
|
||||||
|
*
|
||||||
|
* 基于 {@link MailTemplateDO#getParams()} 输入后的参数
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
// ========= 发送相关字段 =========
|
||||||
|
/**
|
||||||
|
* 发送状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link MailSendStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer sendStatus;
|
||||||
|
/**
|
||||||
|
* 发送时间
|
||||||
|
*/
|
||||||
|
private Date sendTime;
|
||||||
|
/**
|
||||||
|
* 发送返回的消息 ID
|
||||||
|
*/
|
||||||
|
private String sendMessageId;
|
||||||
|
/**
|
||||||
|
* 发送异常
|
||||||
|
*/
|
||||||
|
private String sendException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版 DO
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@TableName(value = "system_mail_template", autoResultMap = true)
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class MailTemplateDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 模版名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 模版编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 发送的邮箱账号编号
|
||||||
|
*
|
||||||
|
* 关联 {@link MailAccountDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送人名称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 参数数组(自动根据内容生成)
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
|
private List<String> params;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link CommonStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||||
|
|
||||||
|
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.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailAccountMapper extends BaseMapperX<MailAccountDO> {
|
||||||
|
|
||||||
|
default PageResult<MailAccountDO> selectPage(MailAccountPageReqVO pageReqVO) {
|
||||||
|
return selectPage(pageReqVO, new LambdaQueryWrapperX<MailAccountDO>()
|
||||||
|
.likeIfPresent(MailAccountDO::getMail, pageReqVO.getMail())
|
||||||
|
.likeIfPresent(MailAccountDO::getUsername , pageReqVO.getUsername()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||||
|
|
||||||
|
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.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailLogMapper extends BaseMapperX<MailLogDO> {
|
||||||
|
|
||||||
|
default PageResult<MailLogDO> selectPage(MailLogPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<MailLogDO>()
|
||||||
|
.eqIfPresent(MailLogDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(MailLogDO::getUserType, reqVO.getUserType())
|
||||||
|
.likeIfPresent(MailLogDO::getToMail, reqVO.getToMail())
|
||||||
|
.eqIfPresent(MailLogDO::getAccountId, reqVO.getAccountId())
|
||||||
|
.eqIfPresent(MailLogDO::getTemplateId, reqVO.getTemplateId())
|
||||||
|
.eqIfPresent(MailLogDO::getSendStatus, reqVO.getSendStatus())
|
||||||
|
.betweenIfPresent(MailLogDO::getSendTime, reqVO.getSendTime())
|
||||||
|
.orderByDesc(MailLogDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||||
|
|
||||||
|
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.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailTemplateMapper extends BaseMapperX<MailTemplateDO> {
|
||||||
|
|
||||||
|
default PageResult<MailTemplateDO> selectPage(MailTemplatePageReqVO pageReqVO){
|
||||||
|
return selectPage(pageReqVO , new LambdaQueryWrapperX<MailTemplateDO>()
|
||||||
|
.eqIfPresent(MailTemplateDO::getStatus, pageReqVO.getStatus())
|
||||||
|
.likeIfPresent(MailTemplateDO::getCode, pageReqVO.getCode())
|
||||||
|
.likeIfPresent(MailTemplateDO::getName, pageReqVO.getName())
|
||||||
|
.eqIfPresent(MailTemplateDO::getAccountId, pageReqVO.getAccountId())
|
||||||
|
.betweenIfPresent(MailTemplateDO::getCreateTime, pageReqVO.getCreateTime()));
|
||||||
|
}
|
||||||
|
|
||||||
|
default Long selectCountByAccountId(Long accountId) {
|
||||||
|
return selectCount(MailTemplateDO::getAccountId, accountId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default MailTemplateDO selectByCode(String code) {
|
||||||
|
return selectOne(MailTemplateDO::getCode, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.consumer.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailAccountRefreshMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailTemplateService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对 {@link MailAccountRefreshMessage} 的消费者
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class MailAccountRefreshConsumer extends AbstractChannelMessageListener<MailAccountRefreshMessage> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailAccountService mailAccountService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(MailAccountRefreshMessage message) {
|
||||||
|
log.info("[onMessage][收到 Mail Account 刷新信息]");
|
||||||
|
mailAccountService.initLocalCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,17 +2,29 @@ package cn.iocoder.yudao.module.system.mq.consumer.mail;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
|
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
|
||||||
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage;
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailSendService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
// TODO 芋艿:这个暂未实现
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对 {@link MailSendMessage} 的消费者
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MailSendConsumer extends AbstractStreamMessageListener<MailSendMessage> {
|
public class MailSendConsumer extends AbstractStreamMessageListener<MailSendMessage> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailSendService mailSendService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(MailSendMessage message) {
|
public void onMessage(MailSendMessage message) {
|
||||||
log.info("[onMessage][消息内容({})]", message);
|
log.info("[onMessage][消息内容({})]", message);
|
||||||
|
mailSendService.doSendMail(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.consumer.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailTemplateService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对 {@link MailTemplateRefreshMessage} 的消费者
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class MailTemplateRefreshConsumer extends AbstractChannelMessageListener<MailTemplateRefreshMessage> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailTemplateService mailTemplateService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(MailTemplateRefreshMessage message) {
|
||||||
|
log.info("[onMessage][收到 Mail Template 刷新信息]");
|
||||||
|
mailTemplateService.initLocalCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.message.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号的数据刷新 Message
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class MailAccountRefreshMessage extends AbstractChannelMessage {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getChannel() {
|
||||||
|
return "system.mail-account.refresh";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱发送消息
|
* 邮箱发送消息
|
||||||
@ -17,28 +17,35 @@ import java.util.Map;
|
|||||||
public class MailSendMessage extends AbstractStreamMessage {
|
public class MailSendMessage extends AbstractStreamMessage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱地址
|
* 邮件日志编号
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "邮箱地址不能为空")
|
@NotNull(message = "邮件日志编号不能为空")
|
||||||
private String address;
|
private Long logId;
|
||||||
/**
|
/**
|
||||||
* 短信模板编号
|
* 接收邮件地址
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "短信模板编号不能为空")
|
@NotNull(message = "接收邮件地址不能为空")
|
||||||
private String templateCode;
|
private String mail;
|
||||||
/**
|
/**
|
||||||
* 短信模板参数
|
* 邮件账号编号
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> templateParams;
|
@NotNull(message = "邮件账号编号不能为空")
|
||||||
|
private Long accountId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户编号,允许空
|
* 邮件发件人
|
||||||
*/
|
*/
|
||||||
private Integer userId;
|
private String nickname;
|
||||||
/**
|
/**
|
||||||
* 用户类型,允许空
|
* 邮件标题
|
||||||
*/
|
*/
|
||||||
private Integer userType;
|
@NotEmpty(message = "邮件标题不能为空")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* 邮件内容
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "邮件内容不能为空")
|
||||||
|
private String content;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStreamKey() {
|
public String getStreamKey() {
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.message.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱模板的数据刷新 Message
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class MailTemplateRefreshMessage extends AbstractChannelMessage {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getChannel() {
|
||||||
|
return "system.mail-template.refresh";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.mq.producer.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailAccountRefreshMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mail 邮件相关消息的 Producer
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2021/4/19 13:33
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class MailProducer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisMQTemplate redisMQTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送 {@link MailTemplateRefreshMessage} 消息
|
||||||
|
*/
|
||||||
|
public void sendMailTemplateRefreshMessage() {
|
||||||
|
MailTemplateRefreshMessage message = new MailTemplateRefreshMessage();
|
||||||
|
redisMQTemplate.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送 {@link MailAccountRefreshMessage} 消息
|
||||||
|
*/
|
||||||
|
public void sendMailAccountRefreshMessage() {
|
||||||
|
MailAccountRefreshMessage message = new MailAccountRefreshMessage();
|
||||||
|
redisMQTemplate.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送 {@link MailSendMessage} 消息
|
||||||
|
*
|
||||||
|
* @param sendLogId 发送日志编码
|
||||||
|
* @param mail 接收邮件地址
|
||||||
|
* @param accountId 邮件账号编号
|
||||||
|
* @param nickname 邮件发件人
|
||||||
|
* @param title 邮件标题
|
||||||
|
* @param content 邮件内容
|
||||||
|
*/
|
||||||
|
public void sendMailSendMessage(Long sendLogId, String mail, Long accountId,
|
||||||
|
String nickname, String title, String content) {
|
||||||
|
MailSendMessage message = new MailSendMessage()
|
||||||
|
.setLogId(sendLogId).setMail(mail).setAccountId(accountId)
|
||||||
|
.setNickname(nickname).setTitle(title).setContent(content);
|
||||||
|
redisMQTemplate.send(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号 Service 接口
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
public interface MailAccountService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化邮箱账号的本地缓存
|
||||||
|
*/
|
||||||
|
void initLocalCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从缓存中获取邮箱账号
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 邮箱账号
|
||||||
|
*/
|
||||||
|
MailAccountDO getMailAccountFromCache(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建邮箱账号
|
||||||
|
*
|
||||||
|
* @param createReqVO 邮箱账号信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMailAccount(@Valid MailAccountCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改邮箱账号
|
||||||
|
*
|
||||||
|
* @param updateReqVO 邮箱账号信息
|
||||||
|
*/
|
||||||
|
void updateMailAccount(@Valid MailAccountUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除邮箱账号
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMailAccount(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取邮箱账号信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 邮箱账号信息
|
||||||
|
*/
|
||||||
|
MailAccountDO getMailAccount(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取邮箱账号分页信息
|
||||||
|
*
|
||||||
|
* @param pageReqVO 邮箱账号分页参数
|
||||||
|
* @return 邮箱账号分页信息
|
||||||
|
*/
|
||||||
|
PageResult<MailAccountDO> getMailAccountPage(MailAccountPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取邮箱数组信息
|
||||||
|
*
|
||||||
|
* @return 邮箱账号信息数组
|
||||||
|
*/
|
||||||
|
List<MailAccountDO> getMailAccountList();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号 Service 实现类
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class MailAccountServiceImpl implements MailAccountService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailAccountMapper mailAccountMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailTemplateService mailTemplateService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailProducer mailProducer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱账号缓存
|
||||||
|
* key:邮箱账号编码 {@link MailAccountDO#getId()}
|
||||||
|
*
|
||||||
|
* 这里声明 volatile 修饰的原因是,每次刷新时,直接修改指向
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private volatile Map<Long, MailAccountDO> mailAccountCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PostConstruct
|
||||||
|
public void initLocalCache() {
|
||||||
|
// 第一步:查询数据
|
||||||
|
List<MailAccountDO> accounts = mailAccountMapper.selectList();
|
||||||
|
log.info("[initLocalCache][缓存邮箱账号,数量:{}]", accounts.size());
|
||||||
|
|
||||||
|
// 第二步:构建缓存
|
||||||
|
mailAccountCache = convertMap(accounts, MailAccountDO::getId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MailAccountDO getMailAccountFromCache(Long id) {
|
||||||
|
return mailAccountCache.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMailAccount(MailAccountCreateReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MailAccountDO account = MailAccountConvert.INSTANCE.convert(createReqVO);
|
||||||
|
mailAccountMapper.insert(account);
|
||||||
|
|
||||||
|
// 发送刷新消息
|
||||||
|
mailProducer.sendMailAccountRefreshMessage();
|
||||||
|
return account.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMailAccount(MailAccountUpdateReqVO updateReqVO) {
|
||||||
|
// 校验是否存在
|
||||||
|
validateMailAccountExists(updateReqVO.getId());
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
MailAccountDO updateObj = MailAccountConvert.INSTANCE.convert(updateReqVO);
|
||||||
|
mailAccountMapper.updateById(updateObj);
|
||||||
|
// 发送刷新消息
|
||||||
|
mailProducer.sendMailAccountRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMailAccount(Long id) {
|
||||||
|
// 校验是否存在账号
|
||||||
|
validateMailAccountExists(id);
|
||||||
|
// 校验是否存在关联模版
|
||||||
|
if (mailTemplateService.countByAccountId(id) > 0) {
|
||||||
|
throw exception(MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
mailAccountMapper.deleteById(id);
|
||||||
|
// 发送刷新消息
|
||||||
|
mailProducer.sendMailAccountRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMailAccountExists(Long id) {
|
||||||
|
if (mailAccountMapper.selectById(id) == null) {
|
||||||
|
throw exception(MAIL_ACCOUNT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MailAccountDO getMailAccount(Long id) {
|
||||||
|
return mailAccountMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MailAccountDO> getMailAccountPage(MailAccountPageReqVO pageReqVO) {
|
||||||
|
return mailAccountMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MailAccountDO> getMailAccountList() {
|
||||||
|
return mailAccountMapper.selectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件日志 Service 接口
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
public interface MailLogService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件日志分页
|
||||||
|
*
|
||||||
|
* @param pageVO 分页参数
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定编号的邮件日志
|
||||||
|
*
|
||||||
|
* @param id 日志编号
|
||||||
|
* @return 邮件日志
|
||||||
|
*/
|
||||||
|
MailLogDO getMailLog(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建邮件日志
|
||||||
|
*
|
||||||
|
* @param userId 用户编码
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param toMail 收件人邮件
|
||||||
|
* @param account 邮件账号信息
|
||||||
|
* @param template 模版信息
|
||||||
|
* @param templateContent 模版内容
|
||||||
|
* @param templateParams 模版参数
|
||||||
|
* @param isSend 是否发送成功
|
||||||
|
* @return 日志编号
|
||||||
|
*/
|
||||||
|
Long createMailLog(Long userId,Integer userType, String toMail,
|
||||||
|
MailAccountDO account, MailTemplateDO template ,
|
||||||
|
String templateContent, Map<String, Object> templateParams, Boolean isSend);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新邮件发送结果
|
||||||
|
*
|
||||||
|
* @param logId 日志编号
|
||||||
|
* @param messageId 发送后的消息编号
|
||||||
|
* @param exception 发送异常
|
||||||
|
*/
|
||||||
|
void updateMailSendResult(Long logId, String messageId, Exception exception);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailLogMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件日志 Service 实现类
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MailLogServiceImpl implements MailLogService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailLogMapper mailLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO) {
|
||||||
|
return mailLogMapper.selectPage(pageVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MailLogDO getMailLog(Long id) {
|
||||||
|
return mailLogMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMailLog(Long userId, Integer userType, String toMail,
|
||||||
|
MailAccountDO account, MailTemplateDO template,
|
||||||
|
String templateContent, Map<String, Object> templateParams, Boolean isSend) {
|
||||||
|
MailLogDO.MailLogDOBuilder logDOBuilder = MailLogDO.builder();
|
||||||
|
// 根据是否要发送,设置状态
|
||||||
|
logDOBuilder.sendStatus(Objects.equals(isSend, true) ? MailSendStatusEnum.INIT.getStatus()
|
||||||
|
: MailSendStatusEnum.IGNORE.getStatus())
|
||||||
|
// 用户信息
|
||||||
|
.userId(userId).userType(userType).toMail(toMail)
|
||||||
|
.accountId(account.getId()).fromMail(account.getMail())
|
||||||
|
// 模板相关字段
|
||||||
|
.templateId(template.getId()).templateCode(template.getCode()).templateNickname(template.getNickname())
|
||||||
|
.templateTitle(template.getTitle()).templateContent(templateContent).templateParams(templateParams);
|
||||||
|
|
||||||
|
// 插入数据库
|
||||||
|
MailLogDO logDO = logDOBuilder.build();
|
||||||
|
mailLogMapper.insert(logDO);
|
||||||
|
return logDO.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMailSendResult(Long logId, String messageId, Exception exception) {
|
||||||
|
// 1. 成功
|
||||||
|
if (exception == null) {
|
||||||
|
mailLogMapper.updateById(new MailLogDO().setId(logId).setSendTime(new Date())
|
||||||
|
.setSendStatus(MailSendStatusEnum.SUCCESS.getStatus()).setSendMessageId(messageId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 2. 失败
|
||||||
|
mailLogMapper.updateById(new MailLogDO().setId(logId).setSendTime(new Date())
|
||||||
|
.setSendStatus(MailSendStatusEnum.FAILURE.getStatus()).setSendException(getRootCauseMessage(exception)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件发送 Service 接口
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
public interface MailSendService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条邮件给管理后台的用户
|
||||||
|
*
|
||||||
|
* @param mail 邮箱
|
||||||
|
* @param userId 用户编码
|
||||||
|
* @param templateCode 邮件模版编码
|
||||||
|
* @param templateParams 邮件模版参数
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
Long sendSingleMailToAdmin(String mail, Long userId,
|
||||||
|
String templateCode, Map<String, Object> templateParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条邮件给用户 APP 的用户
|
||||||
|
*
|
||||||
|
* @param mail 邮箱
|
||||||
|
* @param userId 用户编码
|
||||||
|
* @param templateCode 邮件模版编码
|
||||||
|
* @param templateParams 邮件模版参数
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
Long sendSingleMailToMember(String mail, Long userId,
|
||||||
|
String templateCode, Map<String, Object> templateParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送单条邮件给用户
|
||||||
|
*
|
||||||
|
* @param mail 邮箱
|
||||||
|
* @param userId 用户编码
|
||||||
|
* @param userType 用户类型
|
||||||
|
* @param templateCode 邮件模版编码
|
||||||
|
* @param templateParams 邮件模版参数
|
||||||
|
* @return 发送日志编号
|
||||||
|
*/
|
||||||
|
Long sendSingleMail(String mail, Long userId, Integer userType,
|
||||||
|
String templateCode, Map<String, Object> templateParams);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行真正的邮件发送
|
||||||
|
* 注意,该方法仅仅提供给 MQ Consumer 使用
|
||||||
|
*
|
||||||
|
* @param message 邮件
|
||||||
|
*/
|
||||||
|
void doSendMail(MailSendMessage message);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,172 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.extra.mail.MailAccount;
|
||||||
|
import cn.hutool.extra.mail.MailUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
|
||||||
|
import cn.iocoder.yudao.module.system.service.member.MemberService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱模版 服务实现类
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class MailSendServiceImpl implements MailSendService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserService adminUserService;
|
||||||
|
@Resource
|
||||||
|
private MemberService memberService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailAccountService mailAccountService;
|
||||||
|
@Resource
|
||||||
|
private MailTemplateService mailTemplateService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailLogService mailLogService;
|
||||||
|
@Resource
|
||||||
|
private MailProducer mailProducer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMailToAdmin(String mail, Long userId,
|
||||||
|
String templateCode, Map<String, Object> templateParams) {
|
||||||
|
// 如果 mail 为空,则加载用户编号对应的邮箱
|
||||||
|
if (StrUtil.isEmpty(mail)) {
|
||||||
|
AdminUserDO user = adminUserService.getUser(userId);
|
||||||
|
if (user != null) {
|
||||||
|
mail = user.getEmail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 执行发送
|
||||||
|
return sendSingleMail(mail, userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMailToMember(String mail, Long userId,
|
||||||
|
String templateCode, Map<String, Object> templateParams) {
|
||||||
|
// 如果 mail 为空,则加载用户编号对应的邮箱
|
||||||
|
if (StrUtil.isEmpty(mail)) {
|
||||||
|
mail = memberService.getMemberUserEmail(userId);
|
||||||
|
}
|
||||||
|
// 执行发送
|
||||||
|
return sendSingleMail(mail, userId, UserTypeEnum.MEMBER.getValue(), templateCode, templateParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long sendSingleMail(String mail, Long userId, Integer userType,
|
||||||
|
String templateCode, Map<String, Object> templateParams) {
|
||||||
|
// 校验邮箱模版是否合法
|
||||||
|
MailTemplateDO template = checkMailTemplateValid(templateCode);
|
||||||
|
// 校验邮箱账号是否合法
|
||||||
|
MailAccountDO account = checkMailAccountValid(template.getAccountId());
|
||||||
|
|
||||||
|
// 校验邮箱是否存在
|
||||||
|
mail = checkMail(mail);
|
||||||
|
// 构建有序的模板参数。为什么放在这个位置,是提前保证模板参数的正确性,而不是到了插入发送日志
|
||||||
|
List<KeyValue<String, Object>> newTemplateParams = buildTemplateParams(template, templateParams);
|
||||||
|
|
||||||
|
// 创建发送日志。如果模板被禁用,则不发送短信,只记录日志
|
||||||
|
Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus());
|
||||||
|
String content = mailTemplateService.formatMailTemplateContent(template.getContent(), templateParams);
|
||||||
|
Long sendLogId = mailLogService.createMailLog(userId, userType, mail,
|
||||||
|
account, template, content, templateParams, isSend);
|
||||||
|
// 发送 MQ 消息,异步执行发送短信
|
||||||
|
if (isSend) {
|
||||||
|
mailProducer.sendMailSendMessage(sendLogId, mail, account.getId(),
|
||||||
|
template.getNickname(), template.getTitle(), content);
|
||||||
|
}
|
||||||
|
return sendLogId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSendMail(MailSendMessage message) {
|
||||||
|
// 1. 创建发送账号
|
||||||
|
MailAccountDO account = checkMailAccountValid(message.getAccountId());
|
||||||
|
MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname());
|
||||||
|
// 2. 发送邮件
|
||||||
|
try {
|
||||||
|
String messageId = MailUtil.send(mailAccount, message.getMail(),
|
||||||
|
message.getTitle(), message.getContent(),true);
|
||||||
|
// 3. 更新结果(成功)
|
||||||
|
mailLogService.updateMailSendResult(message.getLogId(), messageId, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 3. 更新结果(异常)
|
||||||
|
mailLogService.updateMailSendResult(message.getLogId(), null, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public MailTemplateDO checkMailTemplateValid(String templateCode) {
|
||||||
|
// 获得邮件模板。考虑到效率,从缓存中获取
|
||||||
|
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
||||||
|
// 邮件模板不存在
|
||||||
|
if (template == null) {
|
||||||
|
throw exception(MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public MailAccountDO checkMailAccountValid(Long accountId) {
|
||||||
|
// 获得邮箱账号。考虑到效率,从缓存中获取
|
||||||
|
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
||||||
|
// 邮箱账号不存在
|
||||||
|
if (account == null) {
|
||||||
|
throw exception(MAIL_ACCOUNT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public String checkMail(String mail) {
|
||||||
|
if (StrUtil.isEmpty(mail)) {
|
||||||
|
throw exception(MAIL_SEND_MAIL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
return mail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将参数模板,处理成有序的 KeyValue 数组
|
||||||
|
*
|
||||||
|
* @param template 邮箱模板
|
||||||
|
* @param templateParams 原始参数
|
||||||
|
* @return 处理后的参数
|
||||||
|
*/
|
||||||
|
@VisibleForTesting
|
||||||
|
public List<KeyValue<String, Object>> buildTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) {
|
||||||
|
return template.getParams().stream().map(key -> {
|
||||||
|
Object value = templateParams.get(key);
|
||||||
|
if (value == null) {
|
||||||
|
throw exception(MAIL_SEND_TEMPLATE_PARAM_MISS, key);
|
||||||
|
}
|
||||||
|
return new KeyValue<>(key, value);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版 Service 接口
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
public interface MailTemplateService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化邮件模版的本地缓存
|
||||||
|
*/
|
||||||
|
void initLocalCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版创建
|
||||||
|
*
|
||||||
|
* @param createReqVO 邮件信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMailTemplate(@Valid MailTemplateCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版修改
|
||||||
|
*
|
||||||
|
* @param updateReqVO 邮件信息
|
||||||
|
*/
|
||||||
|
void updateMailTemplate(@Valid MailTemplateUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版删除
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMailTemplate(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取邮件模版
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 邮件模版
|
||||||
|
*/
|
||||||
|
MailTemplateDO getMailTemplate(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取邮件模版分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 模版信息
|
||||||
|
* @return 邮件模版分页信息
|
||||||
|
*/
|
||||||
|
PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取邮件模板数组
|
||||||
|
*
|
||||||
|
* @return 模版数组
|
||||||
|
*/
|
||||||
|
List<MailTemplateDO> getMailTemplateList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从缓存中获取邮件模版
|
||||||
|
*
|
||||||
|
* @param code 模板编码
|
||||||
|
* @return 邮件模板
|
||||||
|
*/
|
||||||
|
MailTemplateDO getMailTemplateByCodeFromCache(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模版内容合成
|
||||||
|
*
|
||||||
|
* @param content 邮件模版
|
||||||
|
* @param params 合成参数
|
||||||
|
* @return 格式化后的内容
|
||||||
|
*/
|
||||||
|
String formatMailTemplateContent(String content, Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定邮件账号下的邮件模板数量
|
||||||
|
*
|
||||||
|
* @param accountId 账号编号
|
||||||
|
* @return 数量
|
||||||
|
*/
|
||||||
|
long countByAccountId(Long accountId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,163 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjUtil;
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailTemplateMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱模版 Service 实现类
|
||||||
|
*
|
||||||
|
* @author wangjingyi
|
||||||
|
* @since 2022-03-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class MailTemplateServiceImpl implements MailTemplateService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正则表达式,匹配 {} 中的变量
|
||||||
|
*/
|
||||||
|
private static final Pattern PATTERN_PARAMS = Pattern.compile("\\{(.*?)}");
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailTemplateMapper mailTemplateMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailProducer mailProducer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮件模板缓存
|
||||||
|
* key:邮件模版标识 {@link MailTemplateDO#getCode()}
|
||||||
|
*
|
||||||
|
* 这里声明 volatile 修饰的原因是,每次刷新时,直接修改指向
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private volatile Map<String, MailTemplateDO> mailTemplateCache;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PostConstruct
|
||||||
|
public void initLocalCache() {
|
||||||
|
// 第一步:查询数据
|
||||||
|
List<MailTemplateDO> templates = mailTemplateMapper.selectList();
|
||||||
|
log.info("[initLocalCache][缓存邮件模版,数量:{}]", templates.size());
|
||||||
|
|
||||||
|
// 第二步:构建缓存
|
||||||
|
mailTemplateCache = convertMap(templates, MailTemplateDO::getCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMailTemplate(MailTemplateCreateReqVO createReqVO) {
|
||||||
|
// 校验 code 是否唯一
|
||||||
|
validateCodeUnique(null, createReqVO.getCode());
|
||||||
|
|
||||||
|
// 插入
|
||||||
|
MailTemplateDO template = MailTemplateConvert.INSTANCE.convert(createReqVO)
|
||||||
|
.setParams(parseTemplateContentParams(createReqVO.getContent()));
|
||||||
|
mailTemplateMapper.insert(template);
|
||||||
|
// 发送刷新消息
|
||||||
|
mailProducer.sendMailTemplateRefreshMessage();
|
||||||
|
return template.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMailTemplate(@Valid MailTemplateUpdateReqVO updateReqVO) {
|
||||||
|
// 校验是否存在
|
||||||
|
validateMailTemplateExists(updateReqVO.getId());
|
||||||
|
// 校验 code 是否唯一
|
||||||
|
validateCodeUnique(updateReqVO.getId(),updateReqVO.getCode());
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
MailTemplateDO updateObj = MailTemplateConvert.INSTANCE.convert(updateReqVO)
|
||||||
|
.setParams(parseTemplateContentParams(updateReqVO.getContent()));
|
||||||
|
mailTemplateMapper.updateById(updateObj);
|
||||||
|
// 发送刷新消息
|
||||||
|
mailProducer.sendMailTemplateRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public void validateCodeUnique(Long id, String code) {
|
||||||
|
MailTemplateDO template = mailTemplateMapper.selectByCode(code);
|
||||||
|
if (template == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 存在 template 记录的情况下
|
||||||
|
if (id == null // 新增时,说明重复
|
||||||
|
|| ObjUtil.notEqual(id, template.getId())) { // 更新时,如果 id 不一致,说明重复
|
||||||
|
throw exception(MAIL_TEMPLATE_CODE_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMailTemplate(Long id) {
|
||||||
|
// 校验是否存在
|
||||||
|
validateMailTemplateExists(id);
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
mailTemplateMapper.deleteById(id);
|
||||||
|
// 发送刷新消息
|
||||||
|
mailProducer.sendMailTemplateRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMailTemplateExists(Long id) {
|
||||||
|
if (mailTemplateMapper.selectById(id) == null) {
|
||||||
|
throw exception(MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MailTemplateDO getMailTemplate(Long id) {return mailTemplateMapper.selectById(id);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO) {
|
||||||
|
return mailTemplateMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MailTemplateDO> getMailTemplateList() {return mailTemplateMapper.selectList();}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MailTemplateDO getMailTemplateByCodeFromCache(String code) {
|
||||||
|
return mailTemplateCache.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatMailTemplateContent(String content, Map<String, Object> params) {
|
||||||
|
return StrUtil.format(content, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public List<String> parseTemplateContentParams(String content) {
|
||||||
|
return ReUtil.findAllGroup1(PATTERN_PARAMS, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long countByAccountId(Long accountId) {
|
||||||
|
return mailTemplateMapper.selectCountByAccountId(accountId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -15,4 +15,12 @@ public interface MemberService {
|
|||||||
*/
|
*/
|
||||||
String getMemberUserMobile(Long id);
|
String getMemberUserMobile(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会员用户的邮箱
|
||||||
|
*
|
||||||
|
* @param id 会员用户编号
|
||||||
|
* @return 邮箱
|
||||||
|
*/
|
||||||
|
String getMemberUserEmail(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,29 @@ public class MemberServiceImpl implements MemberService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMemberUserMobile(Long id) {
|
public String getMemberUserMobile(Long id) {
|
||||||
if (id == null) {
|
Object user = getMemberUser(id);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Object user = ReflectUtil.invoke(getMemberUserApi(), "getUser", id);
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ReflectUtil.invoke(user, "getMobile");
|
return ReflectUtil.invoke(user, "getMobile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMemberUserEmail(Long id) {
|
||||||
|
Object user = getMemberUser(id);
|
||||||
|
if (user == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ReflectUtil.invoke(user, "getEmail");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object getMemberUser(Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ReflectUtil.invoke(getMemberUserApi(), "getUser", id);
|
||||||
|
}
|
||||||
|
|
||||||
private Object getMemberUserApi() {
|
private Object getMemberUserApi() {
|
||||||
if (memberUserApi == null) {
|
if (memberUserApi == null) {
|
||||||
memberUserApi = SpringUtil.getBean(ClassUtil.loadClass(String.format("%s.module.member.api.user.MemberUserApi", basePackage)));
|
memberUserApi = SpringUtil.getBean(ClassUtil.loadClass(String.format("%s.module.member.api.user.MemberUserApi", basePackage)));
|
||||||
|
@ -81,7 +81,7 @@ public class SmsChannelServiceImpl implements SmsChannelService {
|
|||||||
public void deleteSmsChannel(Long id) {
|
public void deleteSmsChannel(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateSmsChannelExists(id);
|
this.validateSmsChannelExists(id);
|
||||||
// 校验是否有字典数据
|
// 校验是否有在使用该账号的模版
|
||||||
if (smsTemplateService.countByChannelId(id) > 0) {
|
if (smsTemplateService.countByChannelId(id) > 0) {
|
||||||
throw exception(SMS_CHANNEL_HAS_CHILDREN);
|
throw exception(SMS_CHANNEL_HAS_CHILDREN);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
|||||||
* 短信模板 Service 实现类
|
* 短信模板 Service 实现类
|
||||||
*
|
*
|
||||||
* @author zzf
|
* @author zzf
|
||||||
* @date 2021/1/25 9:25
|
* @since 2021/1/25 9:25
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -0,0 +1,154 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link MailAccountServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Import(MailAccountServiceImpl.class)
|
||||||
|
public class MailAccountServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailAccountServiceImpl mailAccountService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailAccountMapper mailAccountMapper;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MailTemplateService mailTemplateService;
|
||||||
|
@MockBean
|
||||||
|
private MailProducer mailProducer;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInitLocalCache() {
|
||||||
|
MailAccountDO accountDO1 = randomPojo(MailAccountDO.class);
|
||||||
|
mailAccountMapper.insert(accountDO1);
|
||||||
|
MailAccountDO accountDO02 = randomPojo(MailAccountDO.class);
|
||||||
|
mailAccountMapper.insert(accountDO02);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailAccountService.initLocalCache();
|
||||||
|
// 断言 mailAccountCache 缓存
|
||||||
|
Map<Long, MailAccountDO> mailAccountCache = mailAccountService.getMailAccountCache();
|
||||||
|
assertPojoEquals(accountDO1, mailAccountCache.get(accountDO1.getId()));
|
||||||
|
assertPojoEquals(accountDO02, mailAccountCache.get(accountDO02.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateMailAccount_success() {
|
||||||
|
// 准备参数
|
||||||
|
MailAccountCreateReqVO reqVO = randomPojo(MailAccountCreateReqVO.class, o -> o.setMail(randomEmail()));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long mailAccountId = mailAccountService.createMailAccount(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(mailAccountId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
MailAccountDO mailAccount = mailAccountMapper.selectById(mailAccountId);
|
||||||
|
assertPojoEquals(reqVO, mailAccount);
|
||||||
|
verify(mailProducer).sendMailAccountRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateMailAccount_success() {
|
||||||
|
// mock 数据
|
||||||
|
MailAccountDO dbMailAccount = randomPojo(MailAccountDO.class);
|
||||||
|
mailAccountMapper.insert(dbMailAccount);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
MailAccountUpdateReqVO reqVO = randomPojo(MailAccountUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbMailAccount.getId()); // 设置更新的 ID
|
||||||
|
o.setMail(randomEmail());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailAccountService.updateMailAccount(reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
MailAccountDO mailAccount = mailAccountMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, mailAccount);
|
||||||
|
verify(mailProducer).sendMailAccountRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateMailAccount_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
MailAccountUpdateReqVO reqVO = randomPojo(MailAccountUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> mailAccountService.updateMailAccount(reqVO), MAIL_ACCOUNT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteMailAccount_success() {
|
||||||
|
// mock 数据
|
||||||
|
MailAccountDO dbMailAccount = randomPojo(MailAccountDO.class);
|
||||||
|
mailAccountMapper.insert(dbMailAccount);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbMailAccount.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailAccountService.deleteMailAccount(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(mailAccountMapper.selectById(id));
|
||||||
|
verify(mailProducer).sendMailAccountRefreshMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteMailAccount_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> mailAccountService.deleteMailAccount(id), MAIL_ACCOUNT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetMailAccountPage() {
|
||||||
|
// mock 数据
|
||||||
|
MailAccountDO dbMailAccount = randomPojo(MailAccountDO.class, o -> { // 等会查询到
|
||||||
|
o.setMail("768@qq.com");
|
||||||
|
o.setUsername("yunai");
|
||||||
|
});
|
||||||
|
mailAccountMapper.insert(dbMailAccount);
|
||||||
|
// 测试 mail 不匹配
|
||||||
|
mailAccountMapper.insert(cloneIgnoreId(dbMailAccount, o -> o.setMail("788@qq.com")));
|
||||||
|
// 测试 username 不匹配
|
||||||
|
mailAccountMapper.insert(cloneIgnoreId(dbMailAccount, o -> o.setUsername("tudou")));
|
||||||
|
// 准备参数
|
||||||
|
MailAccountPageReqVO reqVO = new MailAccountPageReqVO();
|
||||||
|
reqVO.setMail("768");
|
||||||
|
reqVO.setUsername("yu");
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbMailAccount, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,169 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailLogMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link MailLogServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Import(MailLogServiceImpl.class)
|
||||||
|
public class MailLogServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailLogServiceImpl mailLogService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailLogMapper mailLogMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateMailLog() {
|
||||||
|
// 准备参数
|
||||||
|
Long userId = randomLongId();
|
||||||
|
Integer userType = randomEle(UserTypeEnum.values()).getValue();
|
||||||
|
String toMail = randomEmail();
|
||||||
|
MailAccountDO account = randomPojo(MailAccountDO.class);
|
||||||
|
MailTemplateDO template = randomPojo(MailTemplateDO.class);
|
||||||
|
String templateContent = randomString();
|
||||||
|
Map<String, Object> templateParams = randomTemplateParams();
|
||||||
|
Boolean isSend = true;
|
||||||
|
// mock 方法
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long logId = mailLogService.createMailLog(userId, userType, toMail, account, template, templateContent, templateParams, isSend);
|
||||||
|
// 断言
|
||||||
|
MailLogDO log = mailLogMapper.selectById(logId);
|
||||||
|
assertNotNull(log);
|
||||||
|
assertEquals(MailSendStatusEnum.INIT.getStatus(), log.getSendStatus());
|
||||||
|
assertEquals(userId, log.getUserId());
|
||||||
|
assertEquals(userType, log.getUserType());
|
||||||
|
assertEquals(toMail, log.getToMail());
|
||||||
|
assertEquals(account.getId(), log.getAccountId());
|
||||||
|
assertEquals(account.getMail(), log.getFromMail());
|
||||||
|
assertEquals(template.getId(), log.getTemplateId());
|
||||||
|
assertEquals(template.getCode(), log.getTemplateCode());
|
||||||
|
assertEquals(template.getNickname(), log.getTemplateNickname());
|
||||||
|
assertEquals(template.getTitle(), log.getTemplateTitle());
|
||||||
|
assertEquals(templateContent, log.getTemplateContent());
|
||||||
|
assertEquals(templateParams, log.getTemplateParams());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateMailSendResult_success() {
|
||||||
|
// mock 数据
|
||||||
|
MailLogDO log = randomPojo(MailLogDO.class, o -> {
|
||||||
|
o.setSendStatus(MailSendStatusEnum.INIT.getStatus());
|
||||||
|
o.setSendTime(null).setSendMessageId(null).setSendException(null)
|
||||||
|
.setTemplateParams(randomTemplateParams());
|
||||||
|
});
|
||||||
|
mailLogMapper.insert(log);
|
||||||
|
// 准备参数
|
||||||
|
Long logId = log.getId();
|
||||||
|
String messageId = randomString();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailLogService.updateMailSendResult(logId, messageId, null);
|
||||||
|
// 断言
|
||||||
|
MailLogDO dbLog = mailLogMapper.selectById(logId);
|
||||||
|
assertEquals(MailSendStatusEnum.SUCCESS.getStatus(), dbLog.getSendStatus());
|
||||||
|
assertNotNull(dbLog.getSendTime());
|
||||||
|
assertEquals(messageId, dbLog.getSendMessageId());
|
||||||
|
assertNull(dbLog.getSendException());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateMailSendResult_exception() {
|
||||||
|
// mock 数据
|
||||||
|
MailLogDO log = randomPojo(MailLogDO.class, o -> {
|
||||||
|
o.setSendStatus(MailSendStatusEnum.INIT.getStatus());
|
||||||
|
o.setSendTime(null).setSendMessageId(null).setSendException(null)
|
||||||
|
.setTemplateParams(randomTemplateParams());
|
||||||
|
});
|
||||||
|
mailLogMapper.insert(log);
|
||||||
|
// 准备参数
|
||||||
|
Long logId = log.getId();
|
||||||
|
Exception exception = new NullPointerException("测试异常");
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailLogService.updateMailSendResult(logId, null, exception);
|
||||||
|
// 断言
|
||||||
|
MailLogDO dbLog = mailLogMapper.selectById(logId);
|
||||||
|
assertEquals(MailSendStatusEnum.FAILURE.getStatus(), dbLog.getSendStatus());
|
||||||
|
assertNotNull(dbLog.getSendTime());
|
||||||
|
assertNull(dbLog.getSendMessageId());
|
||||||
|
assertEquals("NullPointerException: 测试异常", dbLog.getSendException());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetMailLogPage() {
|
||||||
|
// mock 数据
|
||||||
|
MailLogDO dbMailLog = randomPojo(MailLogDO.class, o -> { // 等会查询到
|
||||||
|
o.setUserId(1L);
|
||||||
|
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
|
o.setToMail("768@qq.com");
|
||||||
|
o.setAccountId(10L);
|
||||||
|
o.setTemplateId(100L);
|
||||||
|
o.setSendStatus(MailSendStatusEnum.INIT.getStatus());
|
||||||
|
o.setSendTime(buildTime(2023, 2, 10));
|
||||||
|
o.setTemplateParams(randomTemplateParams());
|
||||||
|
});
|
||||||
|
mailLogMapper.insert(dbMailLog);
|
||||||
|
// 测试 userId 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setUserId(2L)));
|
||||||
|
// 测试 userType 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||||
|
// 测试 toMail 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setToMail("788@.qq.com")));
|
||||||
|
// 测试 accountId 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setAccountId(11L)));
|
||||||
|
// 测试 templateId 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setTemplateId(101L)));
|
||||||
|
// 测试 sendStatus 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setSendStatus(MailSendStatusEnum.SUCCESS.getStatus())));
|
||||||
|
// 测试 sendTime 不匹配
|
||||||
|
mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setSendTime(buildTime(2023, 3, 10))));
|
||||||
|
// 准备参数
|
||||||
|
MailLogPageReqVO reqVO = new MailLogPageReqVO();
|
||||||
|
reqVO.setUserId(1L);
|
||||||
|
reqVO.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||||
|
reqVO.setToMail("768");
|
||||||
|
reqVO.setAccountId(10L);
|
||||||
|
reqVO.setTemplateId(100L);
|
||||||
|
reqVO.setSendStatus(MailSendStatusEnum.INIT.getStatus());
|
||||||
|
reqVO.setSendTime((buildBetweenTime(2023, 2, 1, 2023, 2, 15)));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<MailLogDO> pageResult = mailLogService.getMailLogPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbMailLog, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, Object> randomTemplateParams() {
|
||||||
|
return MapUtil.<String, Object>builder().put(randomString(), randomString())
|
||||||
|
.put(randomString(), randomString()).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,170 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.extra.mail.MailAccount;
|
||||||
|
import cn.hutool.extra.mail.MailUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
|
||||||
|
import org.assertj.core.util.Lists;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
class MailSendServiceImplTest extends BaseMockitoUnitTest {
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
private MailSendServiceImpl mailSendService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private MailAccountService mailAccountService;
|
||||||
|
@Mock
|
||||||
|
private MailTemplateService mailTemplateService;
|
||||||
|
@Mock
|
||||||
|
private MailLogService mailLogService;
|
||||||
|
@Mock
|
||||||
|
private MailProducer mailProducer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于快速测试你的邮箱账号是否正常
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@Disabled
|
||||||
|
public void testDemo() {
|
||||||
|
MailAccount mailAccount = new MailAccount()
|
||||||
|
// .setFrom("奥特曼 <ydym_test@163.com>")
|
||||||
|
.setFrom("ydym_test@163.com") // 邮箱地址
|
||||||
|
.setHost("smtp.163.com").setPort(465).setSslEnable(true) // SMTP 服务器
|
||||||
|
.setAuth(true).setUser("ydym_test@163.com").setPass("WBZTEINMIFVRYSOE"); // 登录账号密码
|
||||||
|
String messageId = MailUtil.send(mailAccount, "7685413@qq.com", "主题", "内容", false);
|
||||||
|
System.out.println("发送结果:" + messageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送成功,当短信模板开启时
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSendSingleMail_successWhenMailTemplateEnable() {
|
||||||
|
// 准备参数
|
||||||
|
String mail = randomEmail();
|
||||||
|
Long userId = randomLongId();
|
||||||
|
Integer userType = randomEle(UserTypeEnum.values()).getValue();
|
||||||
|
String templateCode = randomString();
|
||||||
|
Map<String, Object> templateParams = MapUtil.<String, Object>builder().put("code", "1234")
|
||||||
|
.put("op", "login").build();
|
||||||
|
// mock MailTemplateService 的方法
|
||||||
|
MailTemplateDO template = randomPojo(MailTemplateDO.class, o -> {
|
||||||
|
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
o.setContent("验证码为{code}, 操作为{op}");
|
||||||
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
|
});
|
||||||
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String content = randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
|
.thenReturn(content);
|
||||||
|
// mock MailAccountService 的方法
|
||||||
|
MailAccountDO account = randomPojo(MailAccountDO.class);
|
||||||
|
when(mailAccountService.getMailAccountFromCache(eq(template.getAccountId()))).thenReturn(account);
|
||||||
|
// mock MailLogService 的方法
|
||||||
|
Long mailLogId = randomLongId();
|
||||||
|
when(mailLogService.createMailLog(eq(userId), eq(userType), eq(mail),
|
||||||
|
eq(account), eq(template), eq(content), eq(templateParams), eq(true))).thenReturn(mailLogId);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long resultMailLogId = mailSendService.sendSingleMail(mail, userId, userType, templateCode, templateParams);
|
||||||
|
// 断言
|
||||||
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
|
// 断言调用
|
||||||
|
verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail),
|
||||||
|
eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送成功,当短信模板关闭时
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSendSingleMail_successWhenSmsTemplateDisable() {
|
||||||
|
// 准备参数
|
||||||
|
String mail = randomEmail();
|
||||||
|
Long userId = randomLongId();
|
||||||
|
Integer userType = randomEle(UserTypeEnum.values()).getValue();
|
||||||
|
String templateCode = randomString();
|
||||||
|
Map<String, Object> templateParams = MapUtil.<String, Object>builder().put("code", "1234")
|
||||||
|
.put("op", "login").build();
|
||||||
|
// mock MailTemplateService 的方法
|
||||||
|
MailTemplateDO template = randomPojo(MailTemplateDO.class, o -> {
|
||||||
|
o.setStatus(CommonStatusEnum.DISABLE.getStatus());
|
||||||
|
o.setContent("验证码为{code}, 操作为{op}");
|
||||||
|
o.setParams(Lists.newArrayList("code", "op"));
|
||||||
|
});
|
||||||
|
when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template);
|
||||||
|
String content = randomString();
|
||||||
|
when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams)))
|
||||||
|
.thenReturn(content);
|
||||||
|
// mock MailAccountService 的方法
|
||||||
|
MailAccountDO account = randomPojo(MailAccountDO.class);
|
||||||
|
when(mailAccountService.getMailAccountFromCache(eq(template.getAccountId()))).thenReturn(account);
|
||||||
|
// mock MailLogService 的方法
|
||||||
|
Long mailLogId = randomLongId();
|
||||||
|
when(mailLogService.createMailLog(eq(userId), eq(userType), eq(mail),
|
||||||
|
eq(account), eq(template), eq(content), eq(templateParams), eq(false))).thenReturn(mailLogId);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long resultMailLogId = mailSendService.sendSingleMail(mail, userId, userType, templateCode, templateParams);
|
||||||
|
// 断言
|
||||||
|
assertEquals(mailLogId, resultMailLogId);
|
||||||
|
// 断言调用
|
||||||
|
verify(mailProducer, times(0)).sendMailSendMessage(anyLong(), anyString(),
|
||||||
|
anyLong(), anyString(), anyString(), anyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCheckMailTemplateValid_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
String templateCode = randomString();
|
||||||
|
// mock 方法
|
||||||
|
|
||||||
|
// 调用,并断言异常
|
||||||
|
assertServiceException(() -> mailSendService.checkMailTemplateValid(templateCode),
|
||||||
|
MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBuildTemplateParams_paramMiss() {
|
||||||
|
// 准备参数
|
||||||
|
MailTemplateDO template = randomPojo(MailTemplateDO.class,
|
||||||
|
o -> o.setParams(Lists.newArrayList("code")));
|
||||||
|
Map<String, Object> templateParams = new HashMap<>();
|
||||||
|
// mock 方法
|
||||||
|
|
||||||
|
// 调用,并断言异常
|
||||||
|
assertServiceException(() -> mailSendService.buildTemplateParams(template, templateParams),
|
||||||
|
MAIL_SEND_TEMPLATE_PARAM_MISS, "code");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCheckMail_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
// mock 方法
|
||||||
|
|
||||||
|
// 调用,并断言异常
|
||||||
|
assertServiceException(() -> mailSendService.checkMail(null),
|
||||||
|
MAIL_SEND_MAIL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,163 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailTemplateMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link MailTemplateServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Import(MailTemplateServiceImpl.class)
|
||||||
|
public class MailTemplateServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailTemplateServiceImpl mailTemplateService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MailTemplateMapper mailTemplateMapper;
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private MailProducer mailProducer;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInitLocalCache() {
|
||||||
|
MailTemplateDO templateDO01 = randomPojo(MailTemplateDO.class);
|
||||||
|
mailTemplateMapper.insert(templateDO01);
|
||||||
|
MailTemplateDO templateDO02 = randomPojo(MailTemplateDO.class);
|
||||||
|
mailTemplateMapper.insert(templateDO02);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailTemplateService.initLocalCache();
|
||||||
|
// 断言 mailTemplateCache 缓存
|
||||||
|
Map<String, MailTemplateDO> mailTemplateCache = mailTemplateService.getMailTemplateCache();
|
||||||
|
assertPojoEquals(templateDO01, mailTemplateCache.get(templateDO01.getCode()));
|
||||||
|
assertPojoEquals(templateDO02, mailTemplateCache.get(templateDO02.getCode()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateMailTemplate_success() {
|
||||||
|
// 准备参数
|
||||||
|
MailTemplateCreateReqVO reqVO = randomPojo(MailTemplateCreateReqVO.class);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long mailTemplateId = mailTemplateService.createMailTemplate(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(mailTemplateId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
MailTemplateDO mailTemplate = mailTemplateMapper.selectById(mailTemplateId);
|
||||||
|
assertPojoEquals(reqVO, mailTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateMailTemplate_success() {
|
||||||
|
// mock 数据
|
||||||
|
MailTemplateDO dbMailTemplate = randomPojo(MailTemplateDO.class);
|
||||||
|
mailTemplateMapper.insert(dbMailTemplate);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
MailTemplateUpdateReqVO reqVO = randomPojo(MailTemplateUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbMailTemplate.getId()); // 设置更新的 ID
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailTemplateService.updateMailTemplate(reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
MailTemplateDO mailTemplate = mailTemplateMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, mailTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateMailTemplate_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
MailTemplateUpdateReqVO reqVO = randomPojo(MailTemplateUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> mailTemplateService.updateMailTemplate(reqVO), MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteMailTemplate_success() {
|
||||||
|
// mock 数据
|
||||||
|
MailTemplateDO dbMailTemplate = randomPojo(MailTemplateDO.class);
|
||||||
|
mailTemplateMapper.insert(dbMailTemplate);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbMailTemplate.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
mailTemplateService.deleteMailTemplate(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(mailTemplateMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteMailTemplate_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> mailTemplateService.deleteMailTemplate(id), MAIL_TEMPLATE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetMailTemplatePage() {
|
||||||
|
// mock 数据
|
||||||
|
MailTemplateDO dbMailTemplate = randomPojo(MailTemplateDO.class, o -> { // 等会查询到
|
||||||
|
o.setName("源码");
|
||||||
|
o.setCode("test_01");
|
||||||
|
o.setAccountId(1L);
|
||||||
|
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
o.setCreateTime(buildTime(2023, 2, 3));
|
||||||
|
});
|
||||||
|
mailTemplateMapper.insert(dbMailTemplate);
|
||||||
|
// 测试 name 不匹配
|
||||||
|
mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setName("芋道")));
|
||||||
|
// 测试 code 不匹配
|
||||||
|
mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setCode("test_02")));
|
||||||
|
// 测试 accountId 不匹配
|
||||||
|
mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setAccountId(2L)));
|
||||||
|
// 测试 status 不匹配
|
||||||
|
mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setCreateTime(buildTime(2023, 1, 5))));
|
||||||
|
// 准备参数
|
||||||
|
MailTemplatePageReqVO reqVO = new MailTemplatePageReqVO();
|
||||||
|
reqVO.setName("源");
|
||||||
|
reqVO.setCode("est_01");
|
||||||
|
reqVO.setAccountId(1L);
|
||||||
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 5));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<MailTemplateDO> pageResult = mailTemplateService.getMailTemplatePage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbMailTemplate, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -235,7 +235,6 @@ public class SmsLogServiceTest extends BaseDbUnitTest {
|
|||||||
return randomPojo(SmsLogDO.class, ArrayUtils.append(consumer, consumers));
|
return randomPojo(SmsLogDO.class, ArrayUtils.append(consumer, consumers));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Map<String, Object> randomTemplateParams() {
|
private static Map<String, Object> randomTemplateParams() {
|
||||||
return MapUtil.<String, Object>builder().put(randomString(), randomString())
|
return MapUtil.<String, Object>builder().put(randomString(), randomString())
|
||||||
.put(randomString(), randomString()).build();
|
.put(randomString(), randomString()).build();
|
||||||
|
@ -25,3 +25,6 @@ DELETE FROM "system_oauth2_approve";
|
|||||||
DELETE FROM "system_oauth2_access_token";
|
DELETE FROM "system_oauth2_access_token";
|
||||||
DELETE FROM "system_oauth2_refresh_token";
|
DELETE FROM "system_oauth2_refresh_token";
|
||||||
DELETE FROM "system_oauth2_code";
|
DELETE FROM "system_oauth2_code";
|
||||||
|
DELETE FROM "system_mail_account";
|
||||||
|
DELETE FROM "system_mail_template";
|
||||||
|
DELETE FROM "system_mail_log";
|
||||||
|
@ -566,3 +566,63 @@ CREATE TABLE IF NOT EXISTS "system_oauth2_code" (
|
|||||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
) COMMENT 'OAuth2 刷新令牌';
|
) COMMENT 'OAuth2 刷新令牌';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "system_mail_account" (
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"mail" varchar NOT NULL,
|
||||||
|
"username" varchar NOT NULL,
|
||||||
|
"password" varchar NOT NULL,
|
||||||
|
"host" varchar NOT NULL,
|
||||||
|
"port" int NOT NULL,
|
||||||
|
"ssl_enable" bit NOT NULL,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '邮箱账号表';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "system_mail_template" (
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"code" varchar NOT NULL,
|
||||||
|
"account_id" bigint NOT NULL,
|
||||||
|
"nickname" varchar,
|
||||||
|
"title" varchar NOT NULL,
|
||||||
|
"content" varchar NOT NULL,
|
||||||
|
"params" varchar NOT NULL,
|
||||||
|
"status" varchar NOT NULL,
|
||||||
|
"remark" varchar,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '邮件模版表';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "system_mail_log" (
|
||||||
|
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
"user_id" bigint,
|
||||||
|
"user_type" varchar,
|
||||||
|
"to_mail" varchar NOT NULL,
|
||||||
|
"account_id" bigint NOT NULL,
|
||||||
|
"from_mail" varchar NOT NULL,
|
||||||
|
"template_id" bigint NOT NULL,
|
||||||
|
"template_code" varchar NOT NULL,
|
||||||
|
"template_nickname" varchar,
|
||||||
|
"template_title" varchar NOT NULL,
|
||||||
|
"template_content" varchar NOT NULL,
|
||||||
|
"template_params" varchar NOT NULL,
|
||||||
|
"send_status" varchar NOT NULL,
|
||||||
|
"send_time" datetime,
|
||||||
|
"send_message_id" varchar,
|
||||||
|
"send_exception" varchar,
|
||||||
|
"creator" varchar DEFAULT '',
|
||||||
|
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updater" varchar DEFAULT '',
|
||||||
|
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY ("id")
|
||||||
|
) COMMENT '邮件日志表';
|
||||||
|
@ -138,6 +138,9 @@ yudao:
|
|||||||
- system_sms_log
|
- system_sms_log
|
||||||
- system_sensitive_word
|
- system_sensitive_word
|
||||||
- system_oauth2_client
|
- system_oauth2_client
|
||||||
|
- system_mail_account
|
||||||
|
- system_mail_template
|
||||||
|
- system_mail_log
|
||||||
- infra_codegen_column
|
- infra_codegen_column
|
||||||
- infra_codegen_table
|
- infra_codegen_table
|
||||||
- infra_test_demo
|
- infra_test_demo
|
||||||
|
46
yudao-ui-admin-vue3/src/api/system/mail/account/index.ts
Normal file
46
yudao-ui-admin-vue3/src/api/system/mail/account/index.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface MailAccountVO {
|
||||||
|
id: number
|
||||||
|
mail: string
|
||||||
|
username: string
|
||||||
|
password: string
|
||||||
|
host: string
|
||||||
|
port: number
|
||||||
|
sslEnable: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MailAccountPageReqVO extends PageParam {
|
||||||
|
mail?: string
|
||||||
|
username?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询邮箱账号列表
|
||||||
|
export const getMailAccountPageApi = async (params: MailAccountPageReqVO) => {
|
||||||
|
return await request.get({ url: '/system/mail-account/page', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询邮箱账号详情
|
||||||
|
export const getMailAccountApi = async (id: number) => {
|
||||||
|
return await request.get({ url: '/system/mail-account/get?id=' + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增邮箱账号
|
||||||
|
export const createMailAccountApi = async (data: MailAccountVO) => {
|
||||||
|
return await request.post({ url: '/system/mail-account/create', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改邮箱账号
|
||||||
|
export const updateMailAccountApi = async (data: MailAccountVO) => {
|
||||||
|
return await request.put({ url: '/system/mail-account/update', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除邮箱账号
|
||||||
|
export const deleteMailAccountApi = async (id: number) => {
|
||||||
|
return await request.delete({ url: '/system/mail-account/delete?id=' + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得邮箱账号精简列表
|
||||||
|
export const getSimpleMailAccounts = async () => {
|
||||||
|
return request.get({ url: '/system/mail-account/list-all-simple' })
|
||||||
|
}
|
40
yudao-ui-admin-vue3/src/api/system/mail/log/index.ts
Normal file
40
yudao-ui-admin-vue3/src/api/system/mail/log/index.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface MailLogVO {
|
||||||
|
id: number
|
||||||
|
userId: number
|
||||||
|
userType: number
|
||||||
|
toMail: string
|
||||||
|
accountId: number
|
||||||
|
fromMail: string
|
||||||
|
templateId: number
|
||||||
|
templateCode: string
|
||||||
|
templateNickname: string
|
||||||
|
templateTitle: string
|
||||||
|
templateContent: string
|
||||||
|
templateParams: string
|
||||||
|
sendStatus: number
|
||||||
|
sendTime: Date
|
||||||
|
sendMessageId: string
|
||||||
|
sendException: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MailLogPageReqVO extends PageParam {
|
||||||
|
userId?: number
|
||||||
|
userType?: number
|
||||||
|
toMail?: string
|
||||||
|
accountId?: number
|
||||||
|
templateId?: number
|
||||||
|
sendStatus?: number
|
||||||
|
sendTime?: Date[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询邮件日志列表
|
||||||
|
export const getMailLogPageApi = async (params: MailLogPageReqVO) => {
|
||||||
|
return await request.get({ url: '/system/mail-log/page', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询邮件日志详情
|
||||||
|
export const getMailLogApi = async (id: number) => {
|
||||||
|
return await request.get({ url: '/system/mail-log/get?id=' + id })
|
||||||
|
}
|
58
yudao-ui-admin-vue3/src/api/system/mail/template/index.ts
Normal file
58
yudao-ui-admin-vue3/src/api/system/mail/template/index.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface MailTemplateVO {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
code: string
|
||||||
|
accountId: number
|
||||||
|
nickname: string
|
||||||
|
title: string
|
||||||
|
content: string
|
||||||
|
params: string
|
||||||
|
status: number
|
||||||
|
remark: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MailTemplatePageReqVO extends PageParam {
|
||||||
|
name?: string
|
||||||
|
code?: string
|
||||||
|
accountId?: number
|
||||||
|
status?: number
|
||||||
|
createTime?: Date[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MailSmsReqVO {
|
||||||
|
mail: string
|
||||||
|
templateCode: string
|
||||||
|
templateParams: Map<String, Object>
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询邮件模版列表
|
||||||
|
export const getMailTemplatePageApi = async (params: MailTemplatePageReqVO) => {
|
||||||
|
return await request.get({ url: '/system/mail-template/page', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询邮件模版详情
|
||||||
|
export const getMailTemplateApi = async (id: number) => {
|
||||||
|
return await request.get({ url: '/system/mail-template/get?id=' + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增邮件模版
|
||||||
|
export const createMailTemplateApi = async (data: MailTemplateVO) => {
|
||||||
|
return await request.post({ url: '/system/mail-template/create', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改邮件模版
|
||||||
|
export const updateMailTemplateApi = async (data: MailTemplateVO) => {
|
||||||
|
return await request.put({ url: '/system/mail-template/update', data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除邮件模版
|
||||||
|
export const deleteMailTemplateApi = async (id: number) => {
|
||||||
|
return await request.delete({ url: '/system/mail-template/delete?id=' + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送邮件
|
||||||
|
export const sendMailApi = (data: MailSmsReqVO) => {
|
||||||
|
return request.post({ url: '/system/mail-template/send-mail', data })
|
||||||
|
}
|
@ -90,6 +90,7 @@ export enum DICT_TYPE {
|
|||||||
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
|
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
|
||||||
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
|
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
|
||||||
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
|
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
|
||||||
|
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
|
||||||
|
|
||||||
// ========== INFRA 模块 ==========
|
// ========== INFRA 模块 ==========
|
||||||
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
|
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
|
|
||||||
|
// 表单校验
|
||||||
|
export const rules = reactive({
|
||||||
|
mail: [required],
|
||||||
|
username: [required],
|
||||||
|
password: [required],
|
||||||
|
host: [required],
|
||||||
|
port: [required],
|
||||||
|
sslEnable: [required]
|
||||||
|
})
|
||||||
|
|
||||||
|
// CrudSchema
|
||||||
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id', // 默认的主键 ID
|
||||||
|
primaryTitle: '编号',
|
||||||
|
primaryType: 'id',
|
||||||
|
action: true,
|
||||||
|
actionWidth: '200', // 3 个按钮默认 200,如有删减对应增减即可
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '邮箱',
|
||||||
|
field: 'mail',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户名',
|
||||||
|
field: 'username',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '密码',
|
||||||
|
field: 'password',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'SMTP 服务器域名',
|
||||||
|
field: 'host'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'SMTP 服务器端口',
|
||||||
|
field: 'port',
|
||||||
|
form: {
|
||||||
|
component: 'InputNumber',
|
||||||
|
value: 465
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否开启 SSL',
|
||||||
|
field: 'sslEnable',
|
||||||
|
dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
|
||||||
|
dictClass: 'boolean'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
isForm: false,
|
||||||
|
formatter: 'formatDate',
|
||||||
|
table: {
|
||||||
|
width: 180
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
151
yudao-ui-admin-vue3/src/views/system/mail/account/index.vue
Normal file
151
yudao-ui-admin-vue3/src/views/system/mail/account/index.vue
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 列表 -->
|
||||||
|
<XTable @register="registerTable">
|
||||||
|
<template #toolbar_buttons>
|
||||||
|
<!-- 操作:新增 -->
|
||||||
|
<XButton
|
||||||
|
type="primary"
|
||||||
|
preIcon="ep:zoom-in"
|
||||||
|
:title="t('action.add')"
|
||||||
|
v-hasPermi="['system:mail-account:create']"
|
||||||
|
@click="handleCreate()"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #actionbtns_default="{ row }">
|
||||||
|
<!-- 操作:修改 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:edit"
|
||||||
|
:title="t('action.edit')"
|
||||||
|
v-hasPermi="['system:mail-account:update']"
|
||||||
|
@click="handleUpdate(row.id)"
|
||||||
|
/>
|
||||||
|
<!-- 操作:详情 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:view"
|
||||||
|
:title="t('action.detail')"
|
||||||
|
v-hasPermi="['system:mail-account:query']"
|
||||||
|
@click="handleDetail(row.id)"
|
||||||
|
/>
|
||||||
|
<!-- 操作:删除 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:delete"
|
||||||
|
:title="t('action.del')"
|
||||||
|
v-hasPermi="['system:mail-account:delete']"
|
||||||
|
@click="deleteData(row.id)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</XTable>
|
||||||
|
</ContentWrap>
|
||||||
|
<!-- 弹窗 -->
|
||||||
|
<XModal id="mailAccountModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
|
||||||
|
<!-- 表单:添加/修改 -->
|
||||||
|
<Form
|
||||||
|
ref="formRef"
|
||||||
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
|
:schema="allSchemas.formSchema"
|
||||||
|
:rules="rules"
|
||||||
|
/>
|
||||||
|
<!-- 表单:详情 -->
|
||||||
|
<Descriptions
|
||||||
|
v-if="actionType === 'detail'"
|
||||||
|
:schema="allSchemas.detailSchema"
|
||||||
|
:data="detailData"
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<!-- 按钮:保存 -->
|
||||||
|
<XButton
|
||||||
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
|
type="primary"
|
||||||
|
:title="t('action.save')"
|
||||||
|
:loading="actionLoading"
|
||||||
|
@click="submitForm()"
|
||||||
|
/>
|
||||||
|
<!-- 按钮:关闭 -->
|
||||||
|
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
|
||||||
|
</template>
|
||||||
|
</XModal>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts" name="MailAccount">
|
||||||
|
import { FormExpose } from '@/components/Form'
|
||||||
|
// 业务相关的 import
|
||||||
|
import { rules, allSchemas } from './account.data'
|
||||||
|
import * as MailAccountApi from '@/api/system/mail/account'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
// 列表相关的变量
|
||||||
|
const [registerTable, { reload, deleteData }] = useXTable({
|
||||||
|
allSchemas: allSchemas,
|
||||||
|
getListApi: MailAccountApi.getMailAccountPageApi,
|
||||||
|
deleteApi: MailAccountApi.deleteMailAccountApi
|
||||||
|
})
|
||||||
|
|
||||||
|
// 弹窗相关的变量
|
||||||
|
const modelVisible = ref(false) // 是否显示弹出层
|
||||||
|
const modelTitle = ref('edit') // 弹出层标题
|
||||||
|
const modelLoading = ref(false) // 弹出层loading
|
||||||
|
const actionType = ref('') // 操作按钮的类型
|
||||||
|
const actionLoading = ref(false) // 按钮 Loading
|
||||||
|
const formRef = ref<FormExpose>() // 表单 Ref
|
||||||
|
const detailData = ref() // 详情 Ref
|
||||||
|
|
||||||
|
// 设置标题
|
||||||
|
const setDialogTile = (type: string) => {
|
||||||
|
modelLoading.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
actionType.value = type
|
||||||
|
modelVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增操作
|
||||||
|
const handleCreate = () => {
|
||||||
|
setDialogTile('create')
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改操作
|
||||||
|
const handleUpdate = async (rowId: number) => {
|
||||||
|
setDialogTile('update')
|
||||||
|
// 设置数据
|
||||||
|
const res = await MailAccountApi.getMailAccountApi(rowId)
|
||||||
|
unref(formRef)?.setValues(res)
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情操作
|
||||||
|
const handleDetail = async (rowId: number) => {
|
||||||
|
setDialogTile('detail')
|
||||||
|
const res = await MailAccountApi.getMailAccountApi(rowId)
|
||||||
|
detailData.value = res
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交按钮
|
||||||
|
const submitForm = async () => {
|
||||||
|
const elForm = unref(formRef)?.getElFormRef()
|
||||||
|
if (!elForm) return
|
||||||
|
elForm.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
actionLoading.value = true
|
||||||
|
// 提交请求
|
||||||
|
try {
|
||||||
|
const data = unref(formRef)?.formModel as MailAccountApi.MailAccountVO
|
||||||
|
if (actionType.value === 'create') {
|
||||||
|
await MailAccountApi.createMailAccountApi(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await MailAccountApi.updateMailAccountApi(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
} finally {
|
||||||
|
actionLoading.value = false
|
||||||
|
// 刷新列表
|
||||||
|
await reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
96
yudao-ui-admin-vue3/src/views/system/mail/log/index.vue
Normal file
96
yudao-ui-admin-vue3/src/views/system/mail/log/index.vue
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 列表 -->
|
||||||
|
<XTable @register="registerTable">
|
||||||
|
<template #accountId_search>
|
||||||
|
<el-select v-model="queryParams.accountId">
|
||||||
|
<el-option :key="undefined" label="全部" :value="undefined" />
|
||||||
|
<el-option
|
||||||
|
v-for="item in accountOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.mail"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
<template #toMail_default="{ row }">
|
||||||
|
<div>{{ row.toMail }}</div>
|
||||||
|
<div v-if="row.userType && row.userId">
|
||||||
|
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />{{ '(' + row.userId + ')' }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #actionbtns_default="{ row }">
|
||||||
|
<!-- 操作:详情 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:view"
|
||||||
|
:title="t('action.detail')"
|
||||||
|
v-hasPermi="['system:mail-log:query']"
|
||||||
|
@click="handleDetail(row.id)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</XTable>
|
||||||
|
</ContentWrap>
|
||||||
|
<!-- 弹窗 -->
|
||||||
|
<XModal id="mailLogModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
|
||||||
|
<!-- 表单:详情 -->
|
||||||
|
<Descriptions
|
||||||
|
v-if="actionType === 'detail'"
|
||||||
|
:schema="allSchemas.detailSchema"
|
||||||
|
:data="detailData"
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<!-- 按钮:关闭 -->
|
||||||
|
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
|
||||||
|
</template>
|
||||||
|
</XModal>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts" name="MailLog">
|
||||||
|
// 业务相关的 import
|
||||||
|
import { allSchemas } from './log.data'
|
||||||
|
import * as MailLogApi from '@/api/system/mail/log'
|
||||||
|
import * as MailAccountApi from '@/api/system/mail/account'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
// 列表相关的变量
|
||||||
|
const queryParams = reactive({
|
||||||
|
accountId: null
|
||||||
|
})
|
||||||
|
const [registerTable] = useXTable({
|
||||||
|
allSchemas: allSchemas,
|
||||||
|
params: queryParams,
|
||||||
|
getListApi: MailLogApi.getMailLogPageApi
|
||||||
|
})
|
||||||
|
const accountOptions = ref([]) // 账号下拉选项
|
||||||
|
|
||||||
|
// 弹窗相关的变量
|
||||||
|
const modelVisible = ref(false) // 是否显示弹出层
|
||||||
|
const modelTitle = ref('edit') // 弹出层标题
|
||||||
|
const modelLoading = ref(false) // 弹出层loading
|
||||||
|
const actionType = ref('') // 操作按钮的类型
|
||||||
|
const actionLoading = ref(false) // 按钮 Loading
|
||||||
|
const detailData = ref() // 详情 Ref
|
||||||
|
|
||||||
|
// 设置标题
|
||||||
|
const setDialogTile = (type: string) => {
|
||||||
|
modelLoading.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
actionType.value = type
|
||||||
|
modelVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情操作
|
||||||
|
const handleDetail = async (rowId: number) => {
|
||||||
|
setDialogTile('detail')
|
||||||
|
const res = await MailLogApi.getMailLogApi(rowId)
|
||||||
|
detailData.value = res
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 初始化 ==========
|
||||||
|
onMounted(() => {
|
||||||
|
MailAccountApi.getSimpleMailAccounts().then((data) => {
|
||||||
|
accountOptions.value = data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
121
yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts
Normal file
121
yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
|
|
||||||
|
// CrudSchema
|
||||||
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id',
|
||||||
|
primaryTitle: '编号',
|
||||||
|
primaryType: 'id',
|
||||||
|
action: true,
|
||||||
|
actionWidth: '70',
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '发送时间',
|
||||||
|
field: 'sendTime',
|
||||||
|
table: {
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
formatter: 'formatDate',
|
||||||
|
search: {
|
||||||
|
show: true,
|
||||||
|
itemRender: {
|
||||||
|
name: 'XDataTimePicker'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '接收邮箱',
|
||||||
|
field: 'toMail',
|
||||||
|
isSearch: true,
|
||||||
|
table: {
|
||||||
|
width: 180,
|
||||||
|
slots: {
|
||||||
|
default: 'toMail_default'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户编号',
|
||||||
|
field: 'userId',
|
||||||
|
isSearch: true,
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户类型',
|
||||||
|
field: 'userType',
|
||||||
|
dictType: DICT_TYPE.USER_TYPE,
|
||||||
|
dictClass: 'number',
|
||||||
|
isSearch: true,
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '邮件标题',
|
||||||
|
field: 'templateTitle'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '邮件内容',
|
||||||
|
field: 'templateContent',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '邮箱参数',
|
||||||
|
field: 'templateParams',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发送状态',
|
||||||
|
field: 'sendStatus',
|
||||||
|
dictType: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS,
|
||||||
|
dictClass: 'string',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '邮箱账号',
|
||||||
|
field: 'accountId',
|
||||||
|
isSearch: true,
|
||||||
|
isTable: false,
|
||||||
|
search: {
|
||||||
|
slots: {
|
||||||
|
default: 'accountId_search'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发送邮箱地址',
|
||||||
|
field: 'fromMail',
|
||||||
|
table: {
|
||||||
|
title: '邮箱账号'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '模板编号',
|
||||||
|
field: 'templateId',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '模板编码',
|
||||||
|
field: 'templateCode',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '模版发送人名称',
|
||||||
|
field: 'templateNickname',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发送返回的消息编号',
|
||||||
|
field: 'sendMessageId',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发送异常',
|
||||||
|
field: 'sendException',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
isTable: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
273
yudao-ui-admin-vue3/src/views/system/mail/template/index.vue
Normal file
273
yudao-ui-admin-vue3/src/views/system/mail/template/index.vue
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 列表 -->
|
||||||
|
<XTable @register="registerTable">
|
||||||
|
<template #accountId_search>
|
||||||
|
<el-select v-model="queryParams.accountId">
|
||||||
|
<el-option :key="undefined" label="全部" :value="undefined" />
|
||||||
|
<el-option
|
||||||
|
v-for="item in accountOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.mail"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
<template #toolbar_buttons>
|
||||||
|
<!-- 操作:新增 -->
|
||||||
|
<XButton
|
||||||
|
type="primary"
|
||||||
|
preIcon="ep:zoom-in"
|
||||||
|
:title="t('action.add')"
|
||||||
|
v-hasPermi="['system:mail-template:create']"
|
||||||
|
@click="handleCreate()"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #accountId_default="{ row }">
|
||||||
|
<span>{{ accountOptions.find((account) => account.id === row.accountId)?.mail }}</span>
|
||||||
|
</template>
|
||||||
|
<template #actionbtns_default="{ row }">
|
||||||
|
<!-- 操作:测试短信 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:cpu"
|
||||||
|
:title="t('action.test')"
|
||||||
|
v-hasPermi="['system:mail-template:send-mail']"
|
||||||
|
@click="handleSendMail(row)"
|
||||||
|
/>
|
||||||
|
<!-- 操作:修改 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:edit"
|
||||||
|
:title="t('action.edit')"
|
||||||
|
v-hasPermi="['system:mail-template:update']"
|
||||||
|
@click="handleUpdate(row.id)"
|
||||||
|
/>
|
||||||
|
<!-- 操作:详情 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:view"
|
||||||
|
:title="t('action.detail')"
|
||||||
|
v-hasPermi="['system:mail-template:query']"
|
||||||
|
@click="handleDetail(row.id)"
|
||||||
|
/>
|
||||||
|
<!-- 操作:删除 -->
|
||||||
|
<XTextButton
|
||||||
|
preIcon="ep:delete"
|
||||||
|
:title="t('action.del')"
|
||||||
|
v-hasPermi="['system:mail-template:delete']"
|
||||||
|
@click="deleteData(row.id)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</XTable>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 添加/修改/详情的弹窗 -->
|
||||||
|
<XModal id="mailTemplateModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
|
||||||
|
<!-- 表单:添加/修改 -->
|
||||||
|
<Form
|
||||||
|
ref="formRef"
|
||||||
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
|
:schema="allSchemas.formSchema"
|
||||||
|
:rules="rules"
|
||||||
|
>
|
||||||
|
<template #accountId="form">
|
||||||
|
<el-select v-model="form.accountId">
|
||||||
|
<el-option
|
||||||
|
v-for="item in accountOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.mail"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</Form>
|
||||||
|
<!-- 表单:详情 -->
|
||||||
|
<Descriptions
|
||||||
|
v-if="actionType === 'detail'"
|
||||||
|
:schema="allSchemas.detailSchema"
|
||||||
|
:data="detailData"
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<!-- 按钮:保存 -->
|
||||||
|
<XButton
|
||||||
|
v-if="['create', 'update'].includes(actionType)"
|
||||||
|
type="primary"
|
||||||
|
:title="t('action.save')"
|
||||||
|
:loading="actionLoading"
|
||||||
|
@click="submitForm()"
|
||||||
|
/>
|
||||||
|
<!-- 按钮:关闭 -->
|
||||||
|
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
|
||||||
|
</template>
|
||||||
|
</XModal>
|
||||||
|
|
||||||
|
<!-- 测试邮件的弹窗 -->
|
||||||
|
<XModal id="sendTest" v-model="sendVisible" title="测试">
|
||||||
|
<el-form :model="sendForm" :rules="sendRules" label-width="200px" label-position="top">
|
||||||
|
<el-form-item label="模板内容" prop="content">
|
||||||
|
<Editor :model-value="sendForm.content" readonly height="150px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="收件邮箱" prop="mail">
|
||||||
|
<el-input v-model="sendForm.mail" placeholder="请输入收件邮箱" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-for="param in sendForm.params"
|
||||||
|
:key="param"
|
||||||
|
:label="'参数 {' + param + '}'"
|
||||||
|
:prop="'templateParams.' + param"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="sendForm.templateParams[param]"
|
||||||
|
:placeholder="'请输入 ' + param + ' 参数'"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<template #footer>
|
||||||
|
<XButton
|
||||||
|
type="primary"
|
||||||
|
:title="t('action.test')"
|
||||||
|
:loading="actionLoading"
|
||||||
|
@click="sendTest()"
|
||||||
|
/>
|
||||||
|
<XButton :title="t('dialog.close')" @click="sendVisible = false" />
|
||||||
|
</template>
|
||||||
|
</XModal>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts" name="MailTemplate">
|
||||||
|
import { FormExpose } from '@/components/Form'
|
||||||
|
// 业务相关的 import
|
||||||
|
import { rules, allSchemas } from './template.data'
|
||||||
|
import * as MailTemplateApi from '@/api/system/mail/template'
|
||||||
|
import * as MailAccountApi from '@/api/system/mail/account'
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
// 列表相关的变量
|
||||||
|
const queryParams = reactive({
|
||||||
|
accountId: null
|
||||||
|
})
|
||||||
|
const [registerTable, { reload, deleteData }] = useXTable({
|
||||||
|
allSchemas: allSchemas,
|
||||||
|
params: queryParams,
|
||||||
|
getListApi: MailTemplateApi.getMailTemplatePageApi,
|
||||||
|
deleteApi: MailTemplateApi.deleteMailTemplateApi
|
||||||
|
})
|
||||||
|
const accountOptions = ref([]) // 账号下拉选项
|
||||||
|
|
||||||
|
// 弹窗相关的变量
|
||||||
|
const modelVisible = ref(false) // 是否显示弹出层
|
||||||
|
const modelTitle = ref('edit') // 弹出层标题
|
||||||
|
const modelLoading = ref(false) // 弹出层loading
|
||||||
|
const actionType = ref('') // 操作按钮的类型
|
||||||
|
const actionLoading = ref(false) // 按钮 Loading
|
||||||
|
const formRef = ref<FormExpose>() // 表单 Ref
|
||||||
|
const detailData = ref() // 详情 Ref
|
||||||
|
|
||||||
|
// 设置标题
|
||||||
|
const setDialogTile = (type: string) => {
|
||||||
|
modelLoading.value = true
|
||||||
|
modelTitle.value = t('action.' + type)
|
||||||
|
actionType.value = type
|
||||||
|
modelVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增操作
|
||||||
|
const handleCreate = () => {
|
||||||
|
setDialogTile('create')
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改操作
|
||||||
|
const handleUpdate = async (rowId: number) => {
|
||||||
|
setDialogTile('update')
|
||||||
|
// 设置数据
|
||||||
|
const res = await MailTemplateApi.getMailTemplateApi(rowId)
|
||||||
|
unref(formRef)?.setValues(res)
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 详情操作
|
||||||
|
const handleDetail = async (rowId: number) => {
|
||||||
|
setDialogTile('detail')
|
||||||
|
const res = await MailTemplateApi.getMailTemplateApi(rowId)
|
||||||
|
detailData.value = res
|
||||||
|
modelLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交按钮
|
||||||
|
const submitForm = async () => {
|
||||||
|
const elForm = unref(formRef)?.getElFormRef()
|
||||||
|
if (!elForm) return
|
||||||
|
elForm.validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
actionLoading.value = true
|
||||||
|
// 提交请求
|
||||||
|
try {
|
||||||
|
const data = unref(formRef)?.formModel as MailTemplateApi.MailTemplateVO
|
||||||
|
if (actionType.value === 'create') {
|
||||||
|
await MailTemplateApi.createMailTemplateApi(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await MailTemplateApi.updateMailTemplateApi(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
modelVisible.value = false
|
||||||
|
} finally {
|
||||||
|
actionLoading.value = false
|
||||||
|
// 刷新列表
|
||||||
|
await reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 测试相关 ==========
|
||||||
|
const sendForm = ref({
|
||||||
|
content: '',
|
||||||
|
params: {},
|
||||||
|
mail: '',
|
||||||
|
templateCode: '',
|
||||||
|
templateParams: {}
|
||||||
|
})
|
||||||
|
const sendRules = ref({
|
||||||
|
mail: [{ required: true, message: '邮箱不能为空', trigger: 'blur' }],
|
||||||
|
templateCode: [{ required: true, message: '模版编号不能为空', trigger: 'blur' }],
|
||||||
|
templateParams: {}
|
||||||
|
})
|
||||||
|
const sendVisible = ref(false)
|
||||||
|
|
||||||
|
const handleSendMail = (row: any) => {
|
||||||
|
sendForm.value.content = row.content
|
||||||
|
sendForm.value.params = row.params
|
||||||
|
sendForm.value.templateCode = row.code
|
||||||
|
sendForm.value.templateParams = row.params.reduce(function (obj, item) {
|
||||||
|
obj[item] = undefined
|
||||||
|
return obj
|
||||||
|
}, {})
|
||||||
|
sendRules.value.templateParams = row.params.reduce(function (obj, item) {
|
||||||
|
obj[item] = { required: true, message: '参数 ' + item + ' 不能为空', trigger: 'change' }
|
||||||
|
return obj
|
||||||
|
}, {})
|
||||||
|
sendVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendTest = async () => {
|
||||||
|
const data: MailTemplateApi.MailSmsReqVO = {
|
||||||
|
mail: sendForm.value.mail,
|
||||||
|
templateCode: sendForm.value.templateCode,
|
||||||
|
templateParams: sendForm.value.templateParams as unknown as Map<string, Object>
|
||||||
|
}
|
||||||
|
const res = await MailTemplateApi.sendMailApi(data)
|
||||||
|
if (res) {
|
||||||
|
message.success('提交发送成功!发送结果,见发送日志编号:' + res)
|
||||||
|
}
|
||||||
|
sendVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 初始化 ==========
|
||||||
|
onMounted(() => {
|
||||||
|
MailAccountApi.getSimpleMailAccounts().then((data) => {
|
||||||
|
accountOptions.value = data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
@ -0,0 +1,98 @@
|
|||||||
|
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
|
|
||||||
|
// 表单校验
|
||||||
|
export const rules = reactive({
|
||||||
|
name: [required],
|
||||||
|
code: [required],
|
||||||
|
accountId: [required],
|
||||||
|
title: [required],
|
||||||
|
content: [required],
|
||||||
|
params: [required],
|
||||||
|
status: [required]
|
||||||
|
})
|
||||||
|
|
||||||
|
// CrudSchema
|
||||||
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id', // 默认的主键ID
|
||||||
|
primaryTitle: '编号', // 默认显示的值
|
||||||
|
primaryType: null,
|
||||||
|
action: true,
|
||||||
|
actionWidth: '260',
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '模板编码',
|
||||||
|
field: 'code',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '模板名称',
|
||||||
|
field: 'name',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '模板标题',
|
||||||
|
field: 'title'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '模板内容',
|
||||||
|
field: 'content',
|
||||||
|
form: {
|
||||||
|
component: 'Editor',
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
componentProps: {
|
||||||
|
valueHtml: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '邮箱账号',
|
||||||
|
field: 'accountId',
|
||||||
|
isSearch: true,
|
||||||
|
table: {
|
||||||
|
width: 200,
|
||||||
|
slots: {
|
||||||
|
default: 'accountId_default'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
slots: {
|
||||||
|
default: 'accountId_search'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发送人名称',
|
||||||
|
field: 'nickname'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '开启状态',
|
||||||
|
field: 'status',
|
||||||
|
isSearch: true,
|
||||||
|
dictType: DICT_TYPE.COMMON_STATUS,
|
||||||
|
dictClass: 'number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
field: 'remark',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
isForm: false,
|
||||||
|
formatter: 'formatDate',
|
||||||
|
table: {
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
show: true,
|
||||||
|
itemRender: {
|
||||||
|
name: 'XDataTimePicker'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
@ -197,7 +197,7 @@ const sendSmsForm = ref({
|
|||||||
})
|
})
|
||||||
const sendSmsRules = ref({
|
const sendSmsRules = ref({
|
||||||
mobile: [{ required: true, message: '手机不能为空', trigger: 'blur' }],
|
mobile: [{ required: true, message: '手机不能为空', trigger: 'blur' }],
|
||||||
templateCode: [{ required: true, message: '手机不能为空', trigger: 'blur' }],
|
templateCode: [{ required: true, message: '模版编号不能为空', trigger: 'blur' }],
|
||||||
templateParams: {}
|
templateParams: {}
|
||||||
})
|
})
|
||||||
const sendVisible = ref(false)
|
const sendVisible = ref(false)
|
||||||
@ -225,7 +225,7 @@ const sendSmsTest = async () => {
|
|||||||
}
|
}
|
||||||
const res = await SmsTemplateApi.sendSmsApi(data)
|
const res = await SmsTemplateApi.sendSmsApi(data)
|
||||||
if (res) {
|
if (res) {
|
||||||
message.success('发送成功')
|
message.success('提交发送成功!发送结果,见发送日志编号:' + res)
|
||||||
}
|
}
|
||||||
sendVisible.value = false
|
sendVisible.value = false
|
||||||
}
|
}
|
||||||
|
52
yudao-ui-admin/src/api/system/mail/account.js
Executable file
52
yudao-ui-admin/src/api/system/mail/account.js
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建邮箱账号
|
||||||
|
export function createMailAccount(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-account/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新邮箱账号
|
||||||
|
export function updateMailAccount(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-account/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除邮箱账号
|
||||||
|
export function deleteMailAccount(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-account/delete?id=' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得邮箱账号
|
||||||
|
export function getMailAccount(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-account/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得邮箱账号分页
|
||||||
|
export function getMailAccountPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-account/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取邮箱账号的精简信息列表
|
||||||
|
export function getSimpleMailAccountList() {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-account/list-all-simple',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
18
yudao-ui-admin/src/api/system/mail/log.js
Executable file
18
yudao-ui-admin/src/api/system/mail/log.js
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 获得邮件日志
|
||||||
|
export function getMailLog(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-log/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得邮件日志分页
|
||||||
|
export function getMailLogPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-log/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
53
yudao-ui-admin/src/api/system/mail/template.js
Executable file
53
yudao-ui-admin/src/api/system/mail/template.js
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建邮件模版
|
||||||
|
export function createMailTemplate(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-template/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新邮件模版
|
||||||
|
export function updateMailTemplate(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-template/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除邮件模版
|
||||||
|
export function deleteMailTemplate(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-template/delete?id=' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得邮件模版
|
||||||
|
export function getMailTemplate(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-template/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得邮件模版分页
|
||||||
|
export function getMailTemplatePage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-template/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送测试邮件
|
||||||
|
export function sendMail(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/mail-template/send-mail',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
@ -43,7 +43,7 @@ export function getSmsTemplatePage(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建短信模板
|
// 发送测试短信
|
||||||
export function sendSms(data) {
|
export function sendSms(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/sms-template/send-sms',
|
url: '/system/sms-template/send-sms',
|
||||||
|
@ -25,6 +25,7 @@ export const DICT_TYPE = {
|
|||||||
SYSTEM_SMS_RECEIVE_STATUS: 'system_sms_receive_status',
|
SYSTEM_SMS_RECEIVE_STATUS: 'system_sms_receive_status',
|
||||||
SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type',
|
SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type',
|
||||||
SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type',
|
SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type',
|
||||||
|
SYSTEM_MAIL_SEND_STATUS: 'system_mail_send_status',
|
||||||
|
|
||||||
// ========== INFRA 模块 ==========
|
// ========== INFRA 模块 ==========
|
||||||
INFRA_BOOLEAN_STRING: 'infra_boolean_string',
|
INFRA_BOOLEAN_STRING: 'infra_boolean_string',
|
||||||
|
225
yudao-ui-admin/src/views/system/mail/account/index.vue
Executable file
225
yudao-ui-admin/src/views/system/mail/account/index.vue
Executable file
@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="邮箱" prop="mail">
|
||||||
|
<el-input v-model="queryParams.mail" placeholder="请输入邮箱" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户名" prop="username">
|
||||||
|
<el-input v-model="queryParams.username" placeholder="请输入用户名" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:mail-account:create']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="邮箱" align="center" prop="mail" />
|
||||||
|
<el-table-column label="用户名" align="center" prop="username" />
|
||||||
|
<el-table-column label="SMTP 服务器域名" align="center" prop="host" />
|
||||||
|
<el-table-column label="SMTP 服务器端口" align="center" prop="port" />
|
||||||
|
<el-table-column label="是否开启 SSL" align="center" prop="sslEnable">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.sslEnable" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:mail-account:update']">修改</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:mail-account:delete']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||||
|
<el-form-item label="邮箱" prop="mail">
|
||||||
|
<el-input v-model="form.mail" placeholder="请输入邮箱" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户名" prop="username">
|
||||||
|
<el-input v-model="form.username" placeholder="请输入用户名,一般和邮箱一致" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" prop="password">
|
||||||
|
<el-input v-model="form.password" placeholder="请输入密码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="SMTP 服务器域名" prop="host">
|
||||||
|
<el-input v-model="form.host" placeholder="请输入 SMTP 服务器域名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="SMTP 服务器端口" prop="port">
|
||||||
|
<el-input v-model="form.port" placeholder="请输入 SMTP 服务器端口" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否开启 SSL" prop="sslEnable">
|
||||||
|
<el-radio-group v-model="form.sslEnable">
|
||||||
|
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)"
|
||||||
|
:key="dict.value" :label="dict.value === 'true'">{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { createMailAccount, updateMailAccount, deleteMailAccount, getMailAccount, getMailAccountPage } from "@/api/system/mail/account";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MailAccount",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 邮箱账号列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
mail: null,
|
||||||
|
username: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
mail: [{ required: true, message: "邮箱不能为空", trigger: "blur" }],
|
||||||
|
username: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
|
||||||
|
password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
|
||||||
|
host: [{ required: true, message: "SMTP 服务器域名不能为空", trigger: "blur" }],
|
||||||
|
port: [{ required: true, message: "SMTP 服务器端口不能为空", trigger: "blur" }],
|
||||||
|
sslEnable: [{ required: true, message: "是否开启 SSL不能为空", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getMailAccountPage(this.queryParams).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
mail: undefined,
|
||||||
|
username: undefined,
|
||||||
|
password: undefined,
|
||||||
|
host: undefined,
|
||||||
|
port: undefined,
|
||||||
|
sslEnable: true,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加邮箱账号";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id;
|
||||||
|
getMailAccount(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改邮箱账号";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateMailAccount(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
createMailAccount(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id;
|
||||||
|
this.$modal.confirm('是否确认删除邮箱账号编号为"' + id + '"的数据项?').then(function() {
|
||||||
|
return deleteMailAccount(id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
226
yudao-ui-admin/src/views/system/mail/log/index.vue
Executable file
226
yudao-ui-admin/src/views/system/mail/log/index.vue
Executable file
@ -0,0 +1,226 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="接收邮箱" prop="toMail">
|
||||||
|
<el-input v-model="queryParams.toMail" placeholder="请输入接收邮箱" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="邮箱账号" prop="accountId">
|
||||||
|
<el-select v-model="queryParams.accountId" placeholder="请输入邮箱账号" clearable>
|
||||||
|
<el-option v-for="account in accountOptions" :key="account.id" :value="account.id" :label="account.mail" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编号" prop="templateId">
|
||||||
|
<el-input v-model="queryParams.templateId" placeholder="请输入模板编号" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送状态" prop="sendStatus">
|
||||||
|
<el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_MAIL_SEND_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送时间" prop="sendTime">
|
||||||
|
<el-date-picker v-model="queryParams.sendTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||||
|
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户编号" prop="userId">
|
||||||
|
<el-input v-model="queryParams.userId" placeholder="请输入用户编号" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户类型" prop="userType">
|
||||||
|
<el-select v-model="queryParams.userType" placeholder="请选择用户类型" clearable>
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.USER_TYPE)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="发送时间" align="center" prop="sendTime" width="180">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>{{ parseTime(scope.row.sendTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="接收邮箱" align="center" prop="toMail" width="200">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<div>{{ scope.row.toMail }}</div>
|
||||||
|
<div v-if="scope.row.userType && scope.row.userId">
|
||||||
|
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType"/>{{ '(' + scope.row.userId + ')' }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="邮件标题" align="center" prop="templateTitle" />
|
||||||
|
<el-table-column label="发送状态" align="center" prop="sendStatus">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.SYSTEM_MAIL_SEND_STATUS" :value="scope.row.sendStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="邮箱账号" align="center" prop="fromMail" />
|
||||||
|
<el-table-column label="模板编号" align="center" prop="templateId" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)"
|
||||||
|
v-hasPermi="['system:mail-log:query']">详细</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 邮件日志详细-->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="700px" v-dialogDrag append-to-body>
|
||||||
|
<el-form ref="form" :model="form" label-width="160px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="日志主键:">{{ form.id }}</el-form-item>
|
||||||
|
<el-form-item label="用户编号:">{{ form.userId }}</el-form-item>
|
||||||
|
<el-form-item label="用户类型:">
|
||||||
|
<dict-tag :type="DICT_TYPE.USER_TYPE" :value="form.userType"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="接收邮箱地址:">{{ form.toMail }}</el-form-item>
|
||||||
|
<el-form-item label="邮箱账号编号:">{{ form.accountId }}</el-form-item>
|
||||||
|
<el-form-item label="发送邮箱地址:">{{ form.fromMail }}</el-form-item>
|
||||||
|
<el-form-item label="模板编号:">{{ form.templateId }}</el-form-item>
|
||||||
|
<el-form-item label="模板编码:">{{ form.templateCode }}</el-form-item>
|
||||||
|
<el-form-item label="模版发送人名称:">{{ form.templateNickname }}</el-form-item>
|
||||||
|
<el-form-item label="邮件标题:">{{ form.templateTitle }}</el-form-item>
|
||||||
|
<el-form-item label="邮件内容:">
|
||||||
|
<editor v-model="form.templateContent" :min-height="192" read-only />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="邮件参数:">{{ form.templateParams }}</el-form-item>
|
||||||
|
<el-form-item label="发送状态:">
|
||||||
|
<dict-tag :type="DICT_TYPE.SYSTEM_MAIL_SEND_STATUS" :value="form.sendStatus" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送时间:">{{ parseTime(form.sendTime) }}</el-form-item>
|
||||||
|
<el-form-item label="发送返回的消息编号:">{{ form.sendMessageId }}</el-form-item>
|
||||||
|
<el-form-item label="发送异常:">{{ form.sendException }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="open = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getMailLog, getMailLogPage } from "@/api/system/mail/log";
|
||||||
|
import Editor from '@/components/Editor';
|
||||||
|
import { getSimpleMailAccountList } from "@/api/system/mail/account";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MailLog",
|
||||||
|
components: {
|
||||||
|
Editor,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 导出遮罩层
|
||||||
|
exportLoading: false,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 邮件日志列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userId: null,
|
||||||
|
userType: null,
|
||||||
|
toMail: null,
|
||||||
|
accountId: null,
|
||||||
|
templateId: null,
|
||||||
|
sendStatus: null,
|
||||||
|
sendTime: [],
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 邮箱账号
|
||||||
|
accountOptions: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
// 获得邮箱账号列表
|
||||||
|
getSimpleMailAccountList().then(response => {
|
||||||
|
this.accountOptions = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getMailLogPage(this.queryParams).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
userType: undefined,
|
||||||
|
toMail: undefined,
|
||||||
|
accountId: undefined,
|
||||||
|
fromMail: undefined,
|
||||||
|
templateId: undefined,
|
||||||
|
templateCode: undefined,
|
||||||
|
templateNickname: undefined,
|
||||||
|
templateTitle: undefined,
|
||||||
|
templateContent: undefined,
|
||||||
|
templateParams: undefined,
|
||||||
|
sendStatus: undefined,
|
||||||
|
sendTime: undefined,
|
||||||
|
sendMessageId: undefined,
|
||||||
|
sendException: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 详细按钮操作 */
|
||||||
|
handleView(row) {
|
||||||
|
this.open = true;
|
||||||
|
this.form = row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
349
yudao-ui-admin/src/views/system/mail/template/index.vue
Executable file
349
yudao-ui-admin/src/views/system/mail/template/index.vue
Executable file
@ -0,0 +1,349 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" />
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="模板名称" prop="name">
|
||||||
|
<el-input v-model="queryParams.name" placeholder="请输入模板名称" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编码" prop="code">
|
||||||
|
<el-input v-model="queryParams.code" placeholder="请输入模板编码" clearable @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="邮箱账号" prop="accountId">
|
||||||
|
<el-select v-model="queryParams.accountId" placeholder="请输入邮箱账号" clearable>
|
||||||
|
<el-option v-for="account in accountOptions" :key="account.id" :value="account.id" :label="account.mail" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开启状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择开启状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||||
|
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:mail-template:create']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="模板编码" align="center" prop="code" />
|
||||||
|
<el-table-column label="模板名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="模板标题" align="center" prop="title" />
|
||||||
|
<el-table-column label="模板内容" align="center" prop="content" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="邮箱账号" align="center" prop="accountId" width="200">
|
||||||
|
<template v-slot="scope">
|
||||||
|
{{ accountOptions.find(account => account.id === scope.row.accountId)?.mail }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="发送人名称" align="center" prop="nickname" />
|
||||||
|
<el-table-column label="开启状态" align="center" prop="status">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-share" @click="handleSend(scope.row)"
|
||||||
|
v-hasPermi="['system:mail-template:send-mail']">测试</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:mail-template:update']">修改</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:mail-template:delete']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="600px" v-dialogDrag append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="模板名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编码" prop="code">
|
||||||
|
<el-input v-model="form.code" placeholder="请输入模板编码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="邮箱账号" prop="accountId">
|
||||||
|
<el-select v-model="form.accountId" placeholder="请输入邮箱账号">
|
||||||
|
<el-option v-for="account in accountOptions" :key="account.id" :value="account.id" :label="account.mail" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送人名称" prop="nickname">
|
||||||
|
<el-input v-model="form.nickname" placeholder="请输入发送人名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板标题" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入模板标题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板内容">
|
||||||
|
<editor v-model="form.content" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开启状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 对话框(发送邮件) -->
|
||||||
|
<el-dialog title="测试发送邮件" :visible.sync="sendOpen" width="500px" append-to-body>
|
||||||
|
<el-form ref="sendForm" :model="sendForm" :rules="sendRules" label-width="140px">
|
||||||
|
<el-form-item label="模板内容" prop="content">
|
||||||
|
<editor v-model="sendForm.content" :min-height="192" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="收件邮箱" prop="mail">
|
||||||
|
<el-input v-model="sendForm.mail" placeholder="请输入收件邮箱" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-for="param in sendForm.params" :key="param" :label="'参数 {' + param + '}'" :prop="'templateParams.' + param">
|
||||||
|
<el-input v-model="sendForm.templateParams[param]" :placeholder="'请输入 ' + param + ' 参数'" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitSendForm">确 定</el-button>
|
||||||
|
<el-button @click="cancelSend">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { createMailTemplate, updateMailTemplate, deleteMailTemplate, getMailTemplate, getMailTemplatePage, sendMail } from "@/api/system/mail/template";
|
||||||
|
import Editor from '@/components/Editor';
|
||||||
|
import { CommonStatusEnum } from "@/utils/constants";
|
||||||
|
import { getSimpleMailAccountList } from "@/api/system/mail/account";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MailTemplate",
|
||||||
|
components: {
|
||||||
|
Editor,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 邮件模版列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
code: null,
|
||||||
|
accountId: null,
|
||||||
|
status: null,
|
||||||
|
createTime: [],
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: "模板名称不能为空", trigger: "blur" }],
|
||||||
|
code: [{ required: true, message: "模板编码不能为空", trigger: "blur" }],
|
||||||
|
accountId: [{ required: true, message: "邮箱账号不能为空", trigger: "blur" }],
|
||||||
|
title: [{ required: true, message: "模板标题不能为空", trigger: "blur" }],
|
||||||
|
content: [{ required: true, message: "模板内容不能为空", trigger: "blur" }],
|
||||||
|
status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
// 邮箱账号
|
||||||
|
accountOptions: [],
|
||||||
|
|
||||||
|
// 发送邮箱
|
||||||
|
sendOpen: false,
|
||||||
|
sendForm: {
|
||||||
|
params: [], // 模板的参数列表
|
||||||
|
},
|
||||||
|
sendRules: {
|
||||||
|
mail: [{ required: true, message: "收件邮箱不能为空", trigger: "blur" }],
|
||||||
|
templateCode: [{ required: true, message: "模版编码不能为空", trigger: "blur" }],
|
||||||
|
templateParams: { }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
// 获得邮箱账号列表
|
||||||
|
getSimpleMailAccountList().then(response => {
|
||||||
|
this.accountOptions = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 执行查询
|
||||||
|
getMailTemplatePage(this.queryParams).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
code: undefined,
|
||||||
|
accountId: undefined,
|
||||||
|
nickname: undefined,
|
||||||
|
title: undefined,
|
||||||
|
content: undefined,
|
||||||
|
status: CommonStatusEnum.ENABLE,
|
||||||
|
remark: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加邮件模版";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id;
|
||||||
|
getMailTemplate(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改邮件模版";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateMailTemplate(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
createMailTemplate(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id;
|
||||||
|
this.$modal.confirm('是否确认删除邮件模版编号为"' + id + '"的数据项?').then(function() {
|
||||||
|
return deleteMailTemplate(id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 发送短息按钮 */
|
||||||
|
handleSend(row) {
|
||||||
|
this.resetSend(row);
|
||||||
|
// 设置参数
|
||||||
|
this.sendForm.content = row.content;
|
||||||
|
this.sendForm.params = row.params;
|
||||||
|
this.sendForm.templateCode = row.code;
|
||||||
|
this.sendForm.templateParams = row.params.reduce(function(obj, item) {
|
||||||
|
obj[item] = undefined;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
// 根据 row 重置 rules
|
||||||
|
this.sendRules.templateParams = row.params.reduce(function(obj, item) {
|
||||||
|
obj[item] = { required: true, message: '参数 ' + item + " 不能为空", trigger: "change" };
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
// 设置打开
|
||||||
|
this.sendOpen = true;
|
||||||
|
},
|
||||||
|
/** 重置发送邮箱的表单 */
|
||||||
|
resetSend() {
|
||||||
|
// 根据 row 重置表单
|
||||||
|
this.sendForm = {
|
||||||
|
content: undefined,
|
||||||
|
params: undefined,
|
||||||
|
mail: undefined,
|
||||||
|
templateCode: undefined,
|
||||||
|
templateParams: {}
|
||||||
|
};
|
||||||
|
this.resetForm("sendForm");
|
||||||
|
},
|
||||||
|
/** 取消发送邮箱 */
|
||||||
|
cancelSend() {
|
||||||
|
this.sendOpen = false;
|
||||||
|
this.resetSend();
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitSendForm() {
|
||||||
|
this.$refs["sendForm"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
sendMail(this.sendForm).then(response => {
|
||||||
|
this.$modal.msgSuccess("提交发送成功!发送结果,见发送日志编号:" + response.data);
|
||||||
|
this.sendOpen = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -94,7 +94,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)"
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)"
|
||||||
v-hasPermi="['system:sms-log:query']">详细</el-button>
|
v-hasPermi="['system:sms-log:query']">详细</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -216,7 +216,7 @@ export default {
|
|||||||
},
|
},
|
||||||
sendSmsRules: {
|
sendSmsRules: {
|
||||||
mobile: [{ required: true, message: "手机不能为空", trigger: "blur" }],
|
mobile: [{ required: true, message: "手机不能为空", trigger: "blur" }],
|
||||||
templateCode: [{ required: true, message: "手机不能为空", trigger: "blur" }],
|
templateCode: [{ required: true, message: "模版编码不能为空", trigger: "blur" }],
|
||||||
templateParams: { }
|
templateParams: { }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user