Commit 50598ea29c4009424ea4b290c4dc43721a777001
Committed by
Gitee
!385 增加邮件功能
Merge pull request !385 from 芋道源码/feature/mail-1.6.1
Showing
88 changed files
with
5253 additions
and
49 deletions
README.md
| ... | ... | @@ -91,6 +91,7 @@ |
| 91 | 91 | | 🚀 | 租户套餐 | 配置租户套餐,自定每个租户的菜单、操作、按钮的权限 | |
| 92 | 92 | | | 字典管理 | 对系统中经常使用的一些较为固定的数据进行维护 | |
| 93 | 93 | | 🚀 | 短信管理 | 短信渠道、短息模板、短信日志,对接阿里云、腾讯云等主流短信平台 | |
| 94 | +| 🚀 | 邮件管理 | 邮箱账号、邮件模版、邮件发送日志,支持所有邮件平台 | | |
| 94 | 95 | | 🚀 | 操作日志 | 系统正常操作日志记录和查询,集成 Swagger 生成日志内容 | |
| 95 | 96 | | ⭐️ | 登录日志 | 系统登录日志记录查询,包含登录异常 | |
| 96 | 97 | | 🚀 | 错误码管理 | 系统所有错误码的管理,可在线修改错误提示,无需重启服务 | | ... | ... |
sql/mysql/ruoyi-vue-pro.sql
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | Target Server Version : 80026 |
| 12 | 12 | File Encoding : 65001 |
| 13 | 13 | |
| 14 | - Date: 17/01/2023 23:47:35 | |
| 14 | + Date: 27/01/2023 20:57:31 | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | SET NAMES utf8mb4; |
| ... | ... | @@ -300,7 +300,7 @@ CREATE TABLE `bpm_form` ( |
| 300 | 300 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 301 | 301 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 302 | 302 | PRIMARY KEY (`id`) USING BTREE |
| 303 | -) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的表单定义'; | |
| 303 | +) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的表单定义'; | |
| 304 | 304 | |
| 305 | 305 | -- ---------------------------- |
| 306 | 306 | -- Records of bpm_form |
| ... | ... | @@ -329,7 +329,7 @@ CREATE TABLE `bpm_oa_leave` ( |
| 329 | 329 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 330 | 330 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 331 | 331 | PRIMARY KEY (`id`) USING BTREE |
| 332 | -) ENGINE = InnoDB AUTO_INCREMENT = 33 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OA 请假申请表'; | |
| 332 | +) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OA 请假申请表'; | |
| 333 | 333 | |
| 334 | 334 | -- ---------------------------- |
| 335 | 335 | -- Records of bpm_oa_leave |
| ... | ... | @@ -359,7 +359,7 @@ CREATE TABLE `bpm_process_definition_ext` ( |
| 359 | 359 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 360 | 360 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 361 | 361 | PRIMARY KEY (`id`) USING BTREE |
| 362 | -) ENGINE = InnoDB AUTO_INCREMENT = 135 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 流程定义的拓展表\n'; | |
| 362 | +) ENGINE = InnoDB AUTO_INCREMENT = 140 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 流程定义的拓展表\n'; | |
| 363 | 363 | |
| 364 | 364 | -- ---------------------------- |
| 365 | 365 | -- Records of bpm_process_definition_ext |
| ... | ... | @@ -389,7 +389,7 @@ CREATE TABLE `bpm_process_instance_ext` ( |
| 389 | 389 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 390 | 390 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 391 | 391 | PRIMARY KEY (`id`) USING BTREE |
| 392 | -) ENGINE = InnoDB AUTO_INCREMENT = 290 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程实例的拓展'; | |
| 392 | +) ENGINE = InnoDB AUTO_INCREMENT = 295 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程实例的拓展'; | |
| 393 | 393 | |
| 394 | 394 | -- ---------------------------- |
| 395 | 395 | -- Records of bpm_process_instance_ext |
| ... | ... | @@ -415,7 +415,7 @@ CREATE TABLE `bpm_task_assign_rule` ( |
| 415 | 415 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 416 | 416 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 417 | 417 | PRIMARY KEY (`id`) USING BTREE |
| 418 | -) ENGINE = InnoDB AUTO_INCREMENT = 265 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 任务规则表'; | |
| 418 | +) ENGINE = InnoDB AUTO_INCREMENT = 274 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Bpm 任务规则表'; | |
| 419 | 419 | |
| 420 | 420 | -- ---------------------------- |
| 421 | 421 | -- Records of bpm_task_assign_rule |
| ... | ... | @@ -444,7 +444,7 @@ CREATE TABLE `bpm_task_ext` ( |
| 444 | 444 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 445 | 445 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 446 | 446 | PRIMARY KEY (`id`) USING BTREE |
| 447 | -) ENGINE = InnoDB AUTO_INCREMENT = 341 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程任务的拓展表'; | |
| 447 | +) ENGINE = InnoDB AUTO_INCREMENT = 350 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '工作流的流程任务的拓展表'; | |
| 448 | 448 | |
| 449 | 449 | -- ---------------------------- |
| 450 | 450 | -- Records of bpm_task_ext |
| ... | ... | @@ -469,7 +469,7 @@ CREATE TABLE `bpm_user_group` ( |
| 469 | 469 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 470 | 470 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 471 | 471 | PRIMARY KEY (`id`) USING BTREE |
| 472 | -) ENGINE = InnoDB AUTO_INCREMENT = 111 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户组'; | |
| 472 | +) ENGINE = InnoDB AUTO_INCREMENT = 113 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户组'; | |
| 473 | 473 | |
| 474 | 474 | -- ---------------------------- |
| 475 | 475 | -- Records of bpm_user_group |
| ... | ... | @@ -546,7 +546,7 @@ CREATE TABLE `infra_api_error_log` ( |
| 546 | 546 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 547 | 547 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 548 | 548 | PRIMARY KEY (`id`) USING BTREE |
| 549 | -) ENGINE = InnoDB AUTO_INCREMENT = 931 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; | |
| 549 | +) ENGINE = InnoDB AUTO_INCREMENT = 949 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志'; | |
| 550 | 550 | |
| 551 | 551 | -- ---------------------------- |
| 552 | 552 | -- Records of infra_api_error_log |
| ... | ... | @@ -584,7 +584,7 @@ CREATE TABLE `infra_codegen_column` ( |
| 584 | 584 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 585 | 585 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 586 | 586 | PRIMARY KEY (`id`) USING BTREE |
| 587 | -) ENGINE = InnoDB AUTO_INCREMENT = 1533 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; | |
| 587 | +) ENGINE = InnoDB AUTO_INCREMENT = 1582 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义'; | |
| 588 | 588 | |
| 589 | 589 | -- ---------------------------- |
| 590 | 590 | -- Records of infra_codegen_column |
| ... | ... | @@ -616,7 +616,7 @@ CREATE TABLE `infra_codegen_table` ( |
| 616 | 616 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 617 | 617 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 618 | 618 | PRIMARY KEY (`id`) USING BTREE |
| 619 | -) ENGINE = InnoDB AUTO_INCREMENT = 119 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; | |
| 619 | +) ENGINE = InnoDB AUTO_INCREMENT = 122 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义'; | |
| 620 | 620 | |
| 621 | 621 | -- ---------------------------- |
| 622 | 622 | -- Records of infra_codegen_table |
| ... | ... | @@ -699,7 +699,7 @@ CREATE TABLE `infra_file` ( |
| 699 | 699 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 700 | 700 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 701 | 701 | PRIMARY KEY (`id`) USING BTREE |
| 702 | -) ENGINE = InnoDB AUTO_INCREMENT = 355 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; | |
| 702 | +) ENGINE = InnoDB AUTO_INCREMENT = 356 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表'; | |
| 703 | 703 | |
| 704 | 704 | -- ---------------------------- |
| 705 | 705 | -- Records of infra_file |
| ... | ... | @@ -1191,7 +1191,7 @@ CREATE TABLE `system_dict_data` ( |
| 1191 | 1191 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1192 | 1192 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1193 | 1193 | PRIMARY KEY (`id`) USING BTREE |
| 1194 | -) ENGINE = InnoDB AUTO_INCREMENT = 1213 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表'; | |
| 1194 | +) ENGINE = InnoDB AUTO_INCREMENT = 1227 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表'; | |
| 1195 | 1195 | |
| 1196 | 1196 | -- ---------------------------- |
| 1197 | 1197 | -- Records of system_dict_data |
| ... | ... | @@ -1391,6 +1391,10 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st |
| 1391 | 1391 | 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'); |
| 1392 | 1392 | 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'); |
| 1393 | 1393 | 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'); |
| 1394 | +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'); | |
| 1395 | +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'); | |
| 1396 | +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'); | |
| 1397 | +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'); | |
| 1394 | 1398 | COMMIT; |
| 1395 | 1399 | |
| 1396 | 1400 | -- ---------------------------- |
| ... | ... | @@ -1411,7 +1415,7 @@ CREATE TABLE `system_dict_type` ( |
| 1411 | 1415 | `deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间', |
| 1412 | 1416 | PRIMARY KEY (`id`) USING BTREE, |
| 1413 | 1417 | UNIQUE INDEX `dict_type`(`type` ASC) USING BTREE |
| 1414 | -) ENGINE = InnoDB AUTO_INCREMENT = 165 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表'; | |
| 1418 | +) ENGINE = InnoDB AUTO_INCREMENT = 167 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表'; | |
| 1415 | 1419 | |
| 1416 | 1420 | -- ---------------------------- |
| 1417 | 1421 | -- Records of system_dict_type |
| ... | ... | @@ -1474,6 +1478,7 @@ INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creat |
| 1474 | 1478 | 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); |
| 1475 | 1479 | 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'); |
| 1476 | 1480 | 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'); |
| 1481 | +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'); | |
| 1477 | 1482 | COMMIT; |
| 1478 | 1483 | |
| 1479 | 1484 | -- ---------------------------- |
| ... | ... | @@ -1522,7 +1527,7 @@ CREATE TABLE `system_login_log` ( |
| 1522 | 1527 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1523 | 1528 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 1524 | 1529 | PRIMARY KEY (`id`) USING BTREE |
| 1525 | -) ENGINE = InnoDB AUTO_INCREMENT = 1963 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; | |
| 1530 | +) ENGINE = InnoDB AUTO_INCREMENT = 1980 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录'; | |
| 1526 | 1531 | |
| 1527 | 1532 | -- ---------------------------- |
| 1528 | 1533 | -- Records of system_login_log |
| ... | ... | @@ -1531,6 +1536,102 @@ BEGIN; |
| 1531 | 1536 | COMMIT; |
| 1532 | 1537 | |
| 1533 | 1538 | -- ---------------------------- |
| 1539 | +-- Table structure for system_mail_account | |
| 1540 | +-- ---------------------------- | |
| 1541 | +DROP TABLE IF EXISTS `system_mail_account`; | |
| 1542 | +CREATE TABLE `system_mail_account` ( | |
| 1543 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', | |
| 1544 | + `mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮箱', | |
| 1545 | + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名', | |
| 1546 | + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码', | |
| 1547 | + `host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'SMTP 服务器域名', | |
| 1548 | + `port` int NOT NULL COMMENT 'SMTP 服务器端口', | |
| 1549 | + `ssl_enable` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否开启 SSL', | |
| 1550 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 1551 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1552 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 1553 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1554 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 1555 | + PRIMARY KEY (`id`) USING BTREE | |
| 1556 | +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮箱账号表'; | |
| 1557 | + | |
| 1558 | +-- ---------------------------- | |
| 1559 | +-- Records of system_mail_account | |
| 1560 | +-- ---------------------------- | |
| 1561 | +BEGIN; | |
| 1562 | +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'); | |
| 1563 | +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'); | |
| 1564 | +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'); | |
| 1565 | +COMMIT; | |
| 1566 | + | |
| 1567 | +-- ---------------------------- | |
| 1568 | +-- Table structure for system_mail_log | |
| 1569 | +-- ---------------------------- | |
| 1570 | +DROP TABLE IF EXISTS `system_mail_log`; | |
| 1571 | +CREATE TABLE `system_mail_log` ( | |
| 1572 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | |
| 1573 | + `user_id` bigint NULL DEFAULT NULL COMMENT '用户编号', | |
| 1574 | + `user_type` tinyint NULL DEFAULT NULL COMMENT '用户类型', | |
| 1575 | + `to_mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '接收邮箱地址', | |
| 1576 | + `account_id` bigint NOT NULL COMMENT '邮箱账号编号', | |
| 1577 | + `from_mail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送邮箱地址', | |
| 1578 | + `template_id` bigint NOT NULL COMMENT '模板编号', | |
| 1579 | + `template_code` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板编码', | |
| 1580 | + `template_nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '模版发送人名称', | |
| 1581 | + `template_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮件标题', | |
| 1582 | + `template_content` varchar(10240) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮件内容', | |
| 1583 | + `template_params` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮件参数', | |
| 1584 | + `send_status` tinyint NOT NULL DEFAULT 0 COMMENT '发送状态', | |
| 1585 | + `send_time` datetime NULL DEFAULT NULL COMMENT '发送时间', | |
| 1586 | + `send_message_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送返回的消息 ID', | |
| 1587 | + `send_exception` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送异常', | |
| 1588 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 1589 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1590 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 1591 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1592 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 1593 | + PRIMARY KEY (`id`) USING BTREE | |
| 1594 | +) ENGINE = InnoDB AUTO_INCREMENT = 354 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件日志表'; | |
| 1595 | + | |
| 1596 | +-- ---------------------------- | |
| 1597 | +-- Records of system_mail_log | |
| 1598 | +-- ---------------------------- | |
| 1599 | +BEGIN; | |
| 1600 | +COMMIT; | |
| 1601 | + | |
| 1602 | +-- ---------------------------- | |
| 1603 | +-- Table structure for system_mail_template | |
| 1604 | +-- ---------------------------- | |
| 1605 | +DROP TABLE IF EXISTS `system_mail_template`; | |
| 1606 | +CREATE TABLE `system_mail_template` ( | |
| 1607 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | |
| 1608 | + `name` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板名称', | |
| 1609 | + `code` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板编码', | |
| 1610 | + `account_id` bigint NOT NULL COMMENT '发送的邮箱账号编号', | |
| 1611 | + `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '发送人名称', | |
| 1612 | + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板标题', | |
| 1613 | + `content` varchar(10240) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板内容', | |
| 1614 | + `params` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '参数数组', | |
| 1615 | + `status` tinyint NOT NULL COMMENT '开启状态', | |
| 1616 | + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注', | |
| 1617 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 1618 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 1619 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 1620 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 1621 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 1622 | + PRIMARY KEY (`id`) USING BTREE | |
| 1623 | +) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '邮件模版表'; | |
| 1624 | + | |
| 1625 | +-- ---------------------------- | |
| 1626 | +-- Records of system_mail_template | |
| 1627 | +-- ---------------------------- | |
| 1628 | +BEGIN; | |
| 1629 | +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'); | |
| 1630 | +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'); | |
| 1631 | +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'); | |
| 1632 | +COMMIT; | |
| 1633 | + | |
| 1634 | +-- ---------------------------- | |
| 1534 | 1635 | -- Table structure for system_menu |
| 1535 | 1636 | -- ---------------------------- |
| 1536 | 1637 | DROP TABLE IF EXISTS `system_menu`; |
| ... | ... | @@ -1553,7 +1654,7 @@ CREATE TABLE `system_menu` ( |
| 1553 | 1654 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 1554 | 1655 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1555 | 1656 | PRIMARY KEY (`id`) USING BTREE |
| 1556 | -) ENGINE = InnoDB AUTO_INCREMENT = 2125 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; | |
| 1657 | +) ENGINE = InnoDB AUTO_INCREMENT = 2144 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表'; | |
| 1557 | 1658 | |
| 1558 | 1659 | -- ---------------------------- |
| 1559 | 1660 | -- Records of system_menu |
| ... | ... | @@ -1776,7 +1877,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i |
| 1776 | 1877 | 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'); |
| 1777 | 1878 | 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'); |
| 1778 | 1879 | 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'); |
| 1779 | -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'); | |
| 1880 | +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'); | |
| 1780 | 1881 | 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'); |
| 1781 | 1882 | 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'); |
| 1782 | 1883 | 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 |
| 1908 | 2009 | 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'); |
| 1909 | 2010 | 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'); |
| 1910 | 2011 | 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'); |
| 2012 | +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'); | |
| 2013 | +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'); | |
| 2014 | +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'); | |
| 2015 | +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'); | |
| 2016 | +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'); | |
| 2017 | +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'); | |
| 2018 | +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'); | |
| 2019 | +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'); | |
| 2020 | +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'); | |
| 2021 | +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'); | |
| 2022 | +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'); | |
| 2023 | +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'); | |
| 2024 | +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'); | |
| 2025 | +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'); | |
| 1911 | 2026 | COMMIT; |
| 1912 | 2027 | |
| 1913 | 2028 | -- ---------------------------- |
| ... | ... | @@ -1958,7 +2073,7 @@ CREATE TABLE `system_oauth2_access_token` ( |
| 1958 | 2073 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 1959 | 2074 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 1960 | 2075 | PRIMARY KEY (`id`) USING BTREE |
| 1961 | -) ENGINE = InnoDB AUTO_INCREMENT = 1083 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; | |
| 2076 | +) ENGINE = InnoDB AUTO_INCREMENT = 1214 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌'; | |
| 1962 | 2077 | |
| 1963 | 2078 | -- ---------------------------- |
| 1964 | 2079 | -- Records of system_oauth2_access_token |
| ... | ... | @@ -2080,7 +2195,7 @@ CREATE TABLE `system_oauth2_refresh_token` ( |
| 2080 | 2195 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2081 | 2196 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2082 | 2197 | PRIMARY KEY (`id`) USING BTREE |
| 2083 | -) ENGINE = InnoDB AUTO_INCREMENT = 571 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; | |
| 2198 | +) ENGINE = InnoDB AUTO_INCREMENT = 588 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌'; | |
| 2084 | 2199 | |
| 2085 | 2200 | -- ---------------------------- |
| 2086 | 2201 | -- Records of system_oauth2_refresh_token |
| ... | ... | @@ -2120,7 +2235,7 @@ CREATE TABLE `system_operate_log` ( |
| 2120 | 2235 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2121 | 2236 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2122 | 2237 | PRIMARY KEY (`id`) USING BTREE |
| 2123 | -) ENGINE = InnoDB AUTO_INCREMENT = 4018 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录'; | |
| 2238 | +) ENGINE = InnoDB AUTO_INCREMENT = 4177 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录'; | |
| 2124 | 2239 | |
| 2125 | 2240 | -- ---------------------------- |
| 2126 | 2241 | -- Records of system_operate_log |
| ... | ... | @@ -2212,7 +2327,7 @@ CREATE TABLE `system_role_menu` ( |
| 2212 | 2327 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2213 | 2328 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 2214 | 2329 | PRIMARY KEY (`id`) USING BTREE |
| 2215 | -) ENGINE = InnoDB AUTO_INCREMENT = 1991 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色和菜单关联表'; | |
| 2330 | +) ENGINE = InnoDB AUTO_INCREMENT = 2185 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '角色和菜单关联表'; | |
| 2216 | 2331 | |
| 2217 | 2332 | -- ---------------------------- |
| 2218 | 2333 | -- Records of system_role_menu |
| ... | ... | @@ -2628,6 +2743,194 @@ INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_t |
| 2628 | 2743 | 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); |
| 2629 | 2744 | 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); |
| 2630 | 2745 | 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); |
| 2746 | +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); | |
| 2747 | +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); | |
| 2748 | +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); | |
| 2749 | +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); | |
| 2750 | +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); | |
| 2751 | +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); | |
| 2752 | +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); | |
| 2753 | +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); | |
| 2754 | +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); | |
| 2755 | +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); | |
| 2756 | +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); | |
| 2757 | +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); | |
| 2758 | +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); | |
| 2759 | +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); | |
| 2760 | +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); | |
| 2761 | +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); | |
| 2762 | +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); | |
| 2763 | +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); | |
| 2764 | +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); | |
| 2765 | +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); | |
| 2766 | +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); | |
| 2767 | +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); | |
| 2768 | +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); | |
| 2769 | +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); | |
| 2770 | +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); | |
| 2771 | +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); | |
| 2772 | +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); | |
| 2773 | +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); | |
| 2774 | +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); | |
| 2775 | +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); | |
| 2776 | +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); | |
| 2777 | +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); | |
| 2778 | +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); | |
| 2779 | +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); | |
| 2780 | +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); | |
| 2781 | +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); | |
| 2782 | +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); | |
| 2783 | +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); | |
| 2784 | +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); | |
| 2785 | +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); | |
| 2786 | +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); | |
| 2787 | +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); | |
| 2788 | +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); | |
| 2789 | +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); | |
| 2790 | +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); | |
| 2791 | +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); | |
| 2792 | +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); | |
| 2793 | +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); | |
| 2794 | +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); | |
| 2795 | +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); | |
| 2796 | +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); | |
| 2797 | +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); | |
| 2798 | +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); | |
| 2799 | +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); | |
| 2800 | +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); | |
| 2801 | +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); | |
| 2802 | +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); | |
| 2803 | +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); | |
| 2804 | +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); | |
| 2805 | +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); | |
| 2806 | +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); | |
| 2807 | +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); | |
| 2808 | +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); | |
| 2809 | +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); | |
| 2810 | +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); | |
| 2811 | +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); | |
| 2812 | +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); | |
| 2813 | +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); | |
| 2814 | +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); | |
| 2815 | +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); | |
| 2816 | +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); | |
| 2817 | +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); | |
| 2818 | +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); | |
| 2819 | +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); | |
| 2820 | +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); | |
| 2821 | +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); | |
| 2822 | +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); | |
| 2823 | +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); | |
| 2824 | +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); | |
| 2825 | +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); | |
| 2826 | +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); | |
| 2827 | +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); | |
| 2828 | +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); | |
| 2829 | +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); | |
| 2830 | +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); | |
| 2831 | +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); | |
| 2832 | +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); | |
| 2833 | +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); | |
| 2834 | +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); | |
| 2835 | +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); | |
| 2836 | +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); | |
| 2837 | +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); | |
| 2838 | +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); | |
| 2839 | +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); | |
| 2840 | +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); | |
| 2841 | +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); | |
| 2842 | +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); | |
| 2843 | +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); | |
| 2844 | +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); | |
| 2845 | +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); | |
| 2846 | +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); | |
| 2847 | +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); | |
| 2848 | +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); | |
| 2849 | +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); | |
| 2850 | +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); | |
| 2851 | +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); | |
| 2852 | +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); | |
| 2853 | +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); | |
| 2854 | +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); | |
| 2855 | +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); | |
| 2856 | +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); | |
| 2857 | +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); | |
| 2858 | +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); | |
| 2859 | +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); | |
| 2860 | +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); | |
| 2861 | +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); | |
| 2862 | +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); | |
| 2863 | +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); | |
| 2864 | +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); | |
| 2865 | +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); | |
| 2866 | +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); | |
| 2867 | +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); | |
| 2868 | +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); | |
| 2869 | +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); | |
| 2870 | +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); | |
| 2871 | +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); | |
| 2872 | +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); | |
| 2873 | +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); | |
| 2874 | +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); | |
| 2875 | +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); | |
| 2876 | +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); | |
| 2877 | +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); | |
| 2878 | +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); | |
| 2879 | +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); | |
| 2880 | +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); | |
| 2881 | +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); | |
| 2882 | +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); | |
| 2883 | +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); | |
| 2884 | +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); | |
| 2885 | +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); | |
| 2886 | +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); | |
| 2887 | +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); | |
| 2888 | +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); | |
| 2889 | +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); | |
| 2890 | +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); | |
| 2891 | +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); | |
| 2892 | +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); | |
| 2893 | +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); | |
| 2894 | +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); | |
| 2895 | +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); | |
| 2896 | +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); | |
| 2897 | +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); | |
| 2898 | +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); | |
| 2899 | +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); | |
| 2900 | +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); | |
| 2901 | +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); | |
| 2902 | +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); | |
| 2903 | +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); | |
| 2904 | +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); | |
| 2905 | +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); | |
| 2906 | +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); | |
| 2907 | +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); | |
| 2908 | +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); | |
| 2909 | +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); | |
| 2910 | +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); | |
| 2911 | +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); | |
| 2912 | +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); | |
| 2913 | +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); | |
| 2914 | +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); | |
| 2915 | +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); | |
| 2916 | +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); | |
| 2917 | +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); | |
| 2918 | +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); | |
| 2919 | +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); | |
| 2920 | +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); | |
| 2921 | +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); | |
| 2922 | +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); | |
| 2923 | +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); | |
| 2924 | +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); | |
| 2925 | +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); | |
| 2926 | +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); | |
| 2927 | +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); | |
| 2928 | +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); | |
| 2929 | +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); | |
| 2930 | +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); | |
| 2931 | +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); | |
| 2932 | +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); | |
| 2933 | +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); | |
| 2631 | 2934 | COMMIT; |
| 2632 | 2935 | |
| 2633 | 2936 | -- ---------------------------- |
| ... | ... | @@ -2752,7 +3055,7 @@ CREATE TABLE `system_sms_log` ( |
| 2752 | 3055 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 2753 | 3056 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2754 | 3057 | PRIMARY KEY (`id`) USING BTREE |
| 2755 | -) ENGINE = InnoDB AUTO_INCREMENT = 339 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; | |
| 3058 | +) ENGINE = InnoDB AUTO_INCREMENT = 347 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志'; | |
| 2756 | 3059 | |
| 2757 | 3060 | -- ---------------------------- |
| 2758 | 3061 | -- Records of system_sms_log |
| ... | ... | @@ -3050,7 +3353,7 @@ CREATE TABLE `system_users` ( |
| 3050 | 3353 | -- Records of system_users |
| 3051 | 3354 | -- ---------------------------- |
| 3052 | 3355 | BEGIN; |
| 3053 | -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); | |
| 3356 | +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); | |
| 3054 | 3357 | 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); |
| 3055 | 3358 | 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); |
| 3056 | 3359 | 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); | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| ... | ... | @@ -41,6 +41,11 @@ public class LocalDateTimeUtils { |
| 41 | 41 | return LocalDateTime.of(year, mouth, day, 0, 0, 0); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + public static LocalDateTime[] buildBetweenTime(int year1, int mouth1, int day1, | |
| 45 | + int year2, int mouth2, int day2) { | |
| 46 | + return new LocalDateTime[]{buildTime(year1, mouth1, day1), buildTime(year2, mouth2, day2)}; | |
| 47 | + } | |
| 48 | + | |
| 44 | 49 | /** |
| 45 | 50 | * 判断当前时间是否在该时间范围内 |
| 46 | 51 | * | ... | ... |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
| ... | ... | @@ -7,7 +7,10 @@ import cn.hutool.core.util.StrUtil; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 8 | 8 | import uk.co.jemos.podam.api.PodamFactory; |
| 9 | 9 | import uk.co.jemos.podam.api.PodamFactoryImpl; |
| 10 | +import uk.co.jemos.podam.common.AttributeStrategy; | |
| 10 | 11 | |
| 12 | +import javax.validation.constraints.Email; | |
| 13 | +import java.lang.annotation.Annotation; | |
| 11 | 14 | import java.lang.reflect.Type; |
| 12 | 15 | import java.time.LocalDateTime; |
| 13 | 16 | import java.util.Arrays; |
| ... | ... | @@ -95,6 +98,10 @@ public class RandomUtils { |
| 95 | 98 | return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus(); |
| 96 | 99 | } |
| 97 | 100 | |
| 101 | + public static String randomEmail() { | |
| 102 | + return randomString() + "@qq.com"; | |
| 103 | + } | |
| 104 | + | |
| 98 | 105 | @SafeVarargs |
| 99 | 106 | public static <T> T randomPojo(Class<T> clazz, Consumer<T>... consumers) { |
| 100 | 107 | T pojo = PODAM_FACTORY.manufacturePojo(clazz); | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/test/TestDemoServiceImpl.java
| ... | ... | @@ -79,7 +79,7 @@ public class TestDemoServiceImpl implements TestDemoService { |
| 79 | 79 | |
| 80 | 80 | @Override |
| 81 | 81 | public PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO) { |
| 82 | -// testDemoMapper.selectList2(); | |
| 82 | + testDemoMapper.selectList2(); | |
| 83 | 83 | return testDemoMapper.selectPage(pageReqVO); |
| 84 | 84 | } |
| 85 | 85 | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/mail/MailSendApi.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO; | |
| 4 | + | |
| 5 | +import javax.validation.Valid; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 邮箱发送 API 接口 | |
| 9 | + * | |
| 10 | + * @author 芋道源码 | |
| 11 | + */ | |
| 12 | +public interface MailSendApi { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * 发送单条邮箱给 Admin 用户 | |
| 16 | + * | |
| 17 | + * 在 mail 为空时,使用 userId 加载对应 Admin 的邮箱 | |
| 18 | + * | |
| 19 | + * @param reqDTO 发送请求 | |
| 20 | + * @return 发送日志编号 | |
| 21 | + */ | |
| 22 | + Long sendSingleMailToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 发送单条邮箱给 Member 用户 | |
| 26 | + * | |
| 27 | + * 在 mail 为空时,使用 userId 加载对应 Member 的邮箱 | |
| 28 | + * | |
| 29 | + * @param reqDTO 发送请求 | |
| 30 | + * @return 发送日志编号 | |
| 31 | + */ | |
| 32 | + Long sendSingleMailToMember(@Valid MailSendSingleToUserReqDTO reqDTO); | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/mail/dto/MailSendSingleToUserReqDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.mail.dto; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | + | |
| 5 | +import javax.validation.constraints.Email; | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 邮件发送 Request DTO | |
| 11 | + * | |
| 12 | + * @author wangjingqi | |
| 13 | + */ | |
| 14 | +@Data | |
| 15 | +public class MailSendSingleToUserReqDTO { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 用户编号 | |
| 19 | + */ | |
| 20 | + private Long userId; | |
| 21 | + /** | |
| 22 | + * 邮箱 | |
| 23 | + */ | |
| 24 | ||
| 25 | + private String mail; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 邮件模板编号 | |
| 29 | + */ | |
| 30 | + @NotNull(message = "邮件模板编号不能为空") | |
| 31 | + private String templateCode; | |
| 32 | + /** | |
| 33 | + * 邮件模板参数 | |
| 34 | + */ | |
| 35 | + private Map<String, Object> templateParams; | |
| 36 | + | |
| 37 | +} | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
| ... | ... | @@ -141,4 +141,16 @@ public interface ErrorCodeConstants { |
| 141 | 141 | ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在"); |
| 142 | 142 | ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022001, "code 已过期"); |
| 143 | 143 | |
| 144 | + // ========== 邮箱账号 1002023000 ========== | |
| 145 | + ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002023000, "邮箱账号不存在"); | |
| 146 | + ErrorCode MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002023001, "无法删除,该邮箱账号还有邮件模板"); | |
| 147 | + | |
| 148 | + // ========== 邮件模版 1002024000 ========== | |
| 149 | + ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002024000, "邮件模版不存在"); | |
| 150 | + ErrorCode MAIL_TEMPLATE_CODE_EXISTS = new ErrorCode(1002024001, "邮件模版 code({}) 已存在"); | |
| 151 | + | |
| 152 | + // ========== 邮件发送 1002025000 ========== | |
| 153 | + ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失"); | |
| 154 | + ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1002025000, "邮箱不存在"); | |
| 155 | + | |
| 144 | 156 | } | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/mail/MailSendStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.enums.mail; | |
| 2 | + | |
| 3 | +import lombok.AllArgsConstructor; | |
| 4 | +import lombok.Getter; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 邮件的发送状态枚举 | |
| 8 | + * | |
| 9 | + * @author wangjingyi | |
| 10 | + * @since 2022/4/10 13:39 | |
| 11 | + */ | |
| 12 | +@Getter | |
| 13 | +@AllArgsConstructor | |
| 14 | +public enum MailSendStatusEnum { | |
| 15 | + | |
| 16 | + INIT(0), // 初始化 | |
| 17 | + SUCCESS(10), // 发送成功 | |
| 18 | + FAILURE(20), // 发送失败 | |
| 19 | + IGNORE(30), // 忽略,即不发送 | |
| 20 | + ; | |
| 21 | + | |
| 22 | + private final int status; | |
| 23 | + | |
| 24 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/pom.xml
| ... | ... | @@ -106,6 +106,10 @@ |
| 106 | 106 | <artifactId>yudao-spring-boot-starter-captcha</artifactId> |
| 107 | 107 | </dependency> |
| 108 | 108 | |
| 109 | + <dependency> | |
| 110 | + <groupId>org.springframework.boot</groupId> | |
| 111 | + <artifactId>spring-boot-starter-mail</artifactId> | |
| 112 | + </dependency> | |
| 109 | 113 | </dependencies> |
| 110 | 114 | |
| 111 | 115 | </project> | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/mail/MailSendApiImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO; | |
| 4 | +import cn.iocoder.yudao.module.system.service.mail.MailSendService; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | +import org.springframework.validation.annotation.Validated; | |
| 7 | + | |
| 8 | +import javax.annotation.Resource; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 邮件发送 API 实现类 | |
| 12 | + * | |
| 13 | + * @author wangjingyi | |
| 14 | + */ | |
| 15 | +@Service | |
| 16 | +@Validated | |
| 17 | +public class MailSendApiImpl implements MailSendApi { | |
| 18 | + | |
| 19 | + @Resource | |
| 20 | + private MailSendService mailSendService; | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public Long sendSingleMailToAdmin(MailSendSingleToUserReqDTO reqDTO) { | |
| 24 | + return mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(), | |
| 25 | + reqDTO.getTemplateCode(), reqDTO.getTemplateParams()); | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public Long sendSingleMailToMember(MailSendSingleToUserReqDTO reqDTO) { | |
| 30 | + return mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(), | |
| 31 | + reqDTO.getTemplateCode(), reqDTO.getTemplateParams()); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail; | |
| 2 | + | |
| 3 | + | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.*; | |
| 7 | +import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 9 | +import cn.iocoder.yudao.module.system.service.mail.MailAccountService; | |
| 10 | +import io.swagger.annotations.Api; | |
| 11 | +import io.swagger.annotations.ApiImplicitParam; | |
| 12 | +import io.swagger.annotations.ApiOperation; | |
| 13 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 14 | +import org.springframework.web.bind.annotation.*; | |
| 15 | + | |
| 16 | +import javax.annotation.Resource; | |
| 17 | +import javax.validation.Valid; | |
| 18 | +import java.util.Comparator; | |
| 19 | +import java.util.List; | |
| 20 | + | |
| 21 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +@Api(tags = "管理后台 - 邮箱账号") | |
| 24 | +@RestController | |
| 25 | +@RequestMapping("/system/mail-account") | |
| 26 | +public class MailAccountController { | |
| 27 | + | |
| 28 | + @Resource | |
| 29 | + private MailAccountService mailAccountService; | |
| 30 | + | |
| 31 | + @PostMapping("/create") | |
| 32 | + @ApiOperation("创建邮箱账号") | |
| 33 | + @PreAuthorize("@ss.hasPermission('system:mail-account:create')") | |
| 34 | + public CommonResult<Long> createMailAccount(@Valid @RequestBody MailAccountCreateReqVO createReqVO) { | |
| 35 | + return success(mailAccountService.createMailAccount(createReqVO)); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @PutMapping("/update") | |
| 39 | + @ApiOperation("修改邮箱账号") | |
| 40 | + @PreAuthorize("@ss.hasPermission('system:mail-account:update')") | |
| 41 | + public CommonResult<Boolean> updateMailAccount(@Valid @RequestBody MailAccountUpdateReqVO updateReqVO) { | |
| 42 | + mailAccountService.updateMailAccount(updateReqVO); | |
| 43 | + return success(true); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @DeleteMapping("/delete") | |
| 47 | + @ApiOperation("删除邮箱账号") | |
| 48 | + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) | |
| 49 | + @PreAuthorize("@ss.hasPermission('system:mail-account:delete')") | |
| 50 | + public CommonResult<Boolean> deleteMailAccount(@RequestParam Long id) { | |
| 51 | + mailAccountService.deleteMailAccount(id); | |
| 52 | + return success(true); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @GetMapping("/get") | |
| 56 | + @ApiOperation("获得邮箱账号") | |
| 57 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | |
| 58 | + @PreAuthorize("@ss.hasPermission('system:mail-account:get')") | |
| 59 | + public CommonResult<MailAccountRespVO> getMailAccount(@RequestParam("id") Long id) { | |
| 60 | + MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id); | |
| 61 | + return success(MailAccountConvert.INSTANCE.convert(mailAccountDO)); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @GetMapping("/page") | |
| 65 | + @ApiOperation("获得邮箱账号分页") | |
| 66 | + @PreAuthorize("@ss.hasPermission('system:mail-account:query')") | |
| 67 | + public CommonResult<PageResult<MailAccountBaseVO>> getMailAccountPage(@Valid MailAccountPageReqVO pageReqVO) { | |
| 68 | + PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO); | |
| 69 | + return success(MailAccountConvert.INSTANCE.convertPage(pageResult)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @GetMapping("/list-all-simple") | |
| 73 | + @ApiOperation(value = "获得邮箱账号精简列表") | |
| 74 | + public CommonResult<List<MailAccountSimpleRespVO>> getSimpleMailAccountList() { | |
| 75 | + List<MailAccountDO> list = mailAccountService.getMailAccountList(); | |
| 76 | + return success(MailAccountConvert.INSTANCE.convertList02(list)); | |
| 77 | + } | |
| 78 | + | |
| 79 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail; | |
| 2 | + | |
| 3 | + | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO; | |
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateRespVO; | |
| 9 | +import cn.iocoder.yudao.module.system.convert.mail.MailLogConvert; | |
| 10 | +import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | |
| 12 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 13 | +import cn.iocoder.yudao.module.system.service.mail.MailLogService; | |
| 14 | +import io.swagger.annotations.Api; | |
| 15 | +import io.swagger.annotations.ApiImplicitParam; | |
| 16 | +import io.swagger.annotations.ApiOperation; | |
| 17 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 18 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 19 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 20 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 21 | +import org.springframework.web.bind.annotation.RestController; | |
| 22 | + | |
| 23 | +import javax.annotation.Resource; | |
| 24 | +import javax.validation.Valid; | |
| 25 | + | |
| 26 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 27 | + | |
| 28 | + | |
| 29 | +@Api(tags = "管理后台 - 邮件日志") | |
| 30 | +@RestController | |
| 31 | +@RequestMapping("/system/mail-log") | |
| 32 | +public class MailLogController { | |
| 33 | + | |
| 34 | + @Resource | |
| 35 | + private MailLogService mailLogService; | |
| 36 | + | |
| 37 | + @GetMapping("/page") | |
| 38 | + @ApiOperation("获得邮箱日志分页") | |
| 39 | + @PreAuthorize("@ss.hasPermission('system:mail-log:query')") | |
| 40 | + public CommonResult<PageResult<MailLogRespVO>> getMailLogPage(@Valid MailLogPageReqVO pageVO) { | |
| 41 | + PageResult<MailLogDO> pageResult = mailLogService.getMailLogPage(pageVO); | |
| 42 | + return success(MailLogConvert.INSTANCE.convertPage(pageResult)); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @GetMapping("/get") | |
| 46 | + @ApiOperation("获得邮箱日志") | |
| 47 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | |
| 48 | + @PreAuthorize("@ss.hasPermission('system:mail-log:query')") | |
| 49 | + public CommonResult<MailLogRespVO> getMailTemplate(@RequestParam("id") Long id) { | |
| 50 | + MailLogDO mailLogDO = mailLogService.getMailLog(id); | |
| 51 | + return success(MailLogConvert.INSTANCE.convert(mailLogDO)); | |
| 52 | + } | |
| 53 | + | |
| 54 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTemplateController.http
0 → 100644
| 1 | +### 请求 /system/mail-template/send-mail 接口 => 成功 | |
| 2 | +POST {{baseUrl}}/system/mail-template/send-mail | |
| 3 | +Authorization: Bearer {{token}} | |
| 4 | +Content-Type: application/json | |
| 5 | +tenant-id: {{adminTenentId}} | |
| 6 | + | |
| 7 | +{ | |
| 8 | + "templateCode": "test_01", | |
| 9 | + "mail": "7685413@qq.com", | |
| 10 | + "templateParams": { | |
| 11 | + "key01": "value01", | |
| 12 | + "key02": "value02" | |
| 13 | + } | |
| 14 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTemplateController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.*; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSendReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 9 | +import cn.iocoder.yudao.module.system.service.mail.MailSendService; | |
| 10 | +import cn.iocoder.yudao.module.system.service.mail.MailTemplateService; | |
| 11 | +import io.swagger.annotations.Api; | |
| 12 | +import io.swagger.annotations.ApiImplicitParam; | |
| 13 | +import io.swagger.annotations.ApiOperation; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.web.bind.annotation.*; | |
| 16 | + | |
| 17 | +import javax.annotation.Resource; | |
| 18 | +import javax.validation.Valid; | |
| 19 | +import java.util.List; | |
| 20 | + | |
| 21 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +@Api(tags = "管理后台 - 邮件模版") | |
| 24 | +@RestController | |
| 25 | +@RequestMapping("/system/mail-template") | |
| 26 | +public class MailTemplateController { | |
| 27 | + | |
| 28 | + @Resource | |
| 29 | + private MailTemplateService mailTempleService; | |
| 30 | + @Resource | |
| 31 | + private MailSendService mailSendService; | |
| 32 | + | |
| 33 | + @PostMapping("/create") | |
| 34 | + @ApiOperation("创建邮件模版") | |
| 35 | + @PreAuthorize("@ss.hasPermission('system:mail-template:create')") | |
| 36 | + public CommonResult<Long> createMailTemplate(@Valid @RequestBody MailTemplateCreateReqVO createReqVO){ | |
| 37 | + return success(mailTempleService.createMailTemplate(createReqVO)); | |
| 38 | + } | |
| 39 | + | |
| 40 | + @PutMapping("/update") | |
| 41 | + @ApiOperation("修改邮件模版") | |
| 42 | + @PreAuthorize("@ss.hasPermission('system:mail-template:update')") | |
| 43 | + public CommonResult<Boolean> updateMailTemplate(@Valid @RequestBody MailTemplateUpdateReqVO updateReqVO){ | |
| 44 | + mailTempleService.updateMailTemplate(updateReqVO); | |
| 45 | + return success(true); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @DeleteMapping("/delete") | |
| 49 | + @ApiOperation("删除邮件模版") | |
| 50 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | |
| 51 | + @PreAuthorize("@ss.hasPermission('system:mail-template:delete')") | |
| 52 | + public CommonResult<Boolean> deleteMailTemplate(@RequestParam("id") Long id) { | |
| 53 | + mailTempleService.deleteMailTemplate(id); | |
| 54 | + return success(true); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @GetMapping("/get") | |
| 58 | + @ApiOperation("获得邮件模版") | |
| 59 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | |
| 60 | + @PreAuthorize("@ss.hasPermission('system:mail-template:get')") | |
| 61 | + public CommonResult<MailTemplateRespVO> getMailTemplate(@RequestParam("id") Long id) { | |
| 62 | + MailTemplateDO mailTemplateDO = mailTempleService.getMailTemplate(id); | |
| 63 | + return success(MailTemplateConvert.INSTANCE.convert(mailTemplateDO)); | |
| 64 | + } | |
| 65 | + | |
| 66 | + @GetMapping("/page") | |
| 67 | + @ApiOperation("获得邮件模版分页") | |
| 68 | + @PreAuthorize("@ss.hasPermission('system:mail-template:query')") | |
| 69 | + public CommonResult<PageResult<MailTemplateRespVO>> getMailTemplatePage(@Valid MailTemplatePageReqVO pageReqVO) { | |
| 70 | + PageResult<MailTemplateDO> pageResult = mailTempleService.getMailTemplatePage(pageReqVO); | |
| 71 | + return success(MailTemplateConvert.INSTANCE.convertPage(pageResult)); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/list-all-simple") | |
| 75 | + @ApiOperation(value = "获得邮件模版精简列表") | |
| 76 | + public CommonResult<List<MailTemplateSimpleRespVO>> getSimpleTemplateList() { | |
| 77 | + List<MailTemplateDO> list = mailTempleService.getMailTemplateList(); | |
| 78 | + return success(MailTemplateConvert.INSTANCE.convertList02(list)); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @PostMapping("/send-mail") | |
| 82 | + @ApiOperation("发送短信") | |
| 83 | + @PreAuthorize("@ss.hasPermission('system:mail-template:send-mail')") | |
| 84 | + public CommonResult<Long> sendMail(@Valid @RequestBody MailTemplateSendReqVO sendReqVO) { | |
| 85 | + return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), null, | |
| 86 | + sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); | |
| 87 | + } | |
| 88 | + | |
| 89 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModelProperty; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.Email; | |
| 7 | +import javax.validation.constraints.NotNull; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 邮箱账号 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 11 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 12 | + */ | |
| 13 | +@Data | |
| 14 | +public class MailAccountBaseVO { | |
| 15 | + | |
| 16 | + @ApiModelProperty(value = "邮箱", required = true, example = "yudaoyuanma@123.com") | |
| 17 | + @NotNull(message = "邮箱不能为空") | |
| 18 | + @Email(message = "必须是 Email 格式") | |
| 19 | + private String mail; | |
| 20 | + | |
| 21 | + @ApiModelProperty(value = "用户名", required = true, example = "yudao") | |
| 22 | + @NotNull(message = "用户名不能为空") | |
| 23 | + private String username; | |
| 24 | + | |
| 25 | + @ApiModelProperty(value = "密码", required = true, example = "123456") | |
| 26 | + @NotNull(message = "密码必填") | |
| 27 | + private String password; | |
| 28 | + | |
| 29 | + @ApiModelProperty(value = "SMTP 服务器域名", required = true, example = "www.iocoder.cn") | |
| 30 | + @NotNull(message = "SMTP 服务器域名不能为空") | |
| 31 | + private String host; | |
| 32 | + | |
| 33 | + @ApiModelProperty(value = "SMTP 服务器端口", required = true, example = "80") | |
| 34 | + @NotNull(message = "SMTP 服务器端口不能为空") | |
| 35 | + private Integer port; | |
| 36 | + | |
| 37 | + @ApiModelProperty(value = "是否开启 ssl", required = true, example = "true") | |
| 38 | + @NotNull(message = "是否开启 ssl 必填") | |
| 39 | + private Boolean sslEnable; | |
| 40 | + | |
| 41 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +import javax.validation.constraints.NotNull; | |
| 10 | + | |
| 11 | +@ApiModel("管理后台 - 邮箱账号创建 Request VO") | |
| 12 | +@Data | |
| 13 | +@EqualsAndHashCode(callSuper = true) | |
| 14 | +@ToString(callSuper = true) | |
| 15 | +public class MailAccountCreateReqVO extends MailAccountBaseVO { | |
| 16 | + | |
| 17 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.annotations.ApiModel; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.ToString; | |
| 9 | + | |
| 10 | +@ApiModel("管理后台 - 邮箱账号分页 Request VO") | |
| 11 | +@Data | |
| 12 | +@EqualsAndHashCode(callSuper = true) | |
| 13 | +@ToString(callSuper = true) | |
| 14 | +public class MailAccountPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @ApiModelProperty(value = "邮箱", required = true, example = "yudaoyuanma@123.com") | |
| 17 | + private String mail; | |
| 18 | + | |
| 19 | + @ApiModelProperty(value = "用户名" , required = true , example = "yudao") | |
| 20 | + private String username; | |
| 21 | + | |
| 22 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +import javax.validation.constraints.NotNull; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | + | |
| 12 | +@ApiModel("管理后台 - 邮箱账号 Response VO") | |
| 13 | +@Data | |
| 14 | +@EqualsAndHashCode(callSuper = true) | |
| 15 | +@ToString(callSuper = true) | |
| 16 | +public class MailAccountRespVO extends MailAccountBaseVO { | |
| 17 | + | |
| 18 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | |
| 19 | + @NotNull(message = "编号不能为空") | |
| 20 | + private Long id; | |
| 21 | + | |
| 22 | + @ApiModelProperty(value = "创建时间", required = true) | |
| 23 | + private LocalDateTime createTime; | |
| 24 | + | |
| 25 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountSimpleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +@ApiModel("管理后台 - 邮箱账号的精简 Response VO") | |
| 8 | +@Data | |
| 9 | +public class MailAccountSimpleRespVO { | |
| 10 | + | |
| 11 | + @ApiModelProperty(value = "邮箱编号", required = true, example = "1024") | |
| 12 | + private Long id; | |
| 13 | + | |
| 14 | + @ApiModelProperty(value = "邮箱", required = true, example = "768541388@qq.com") | |
| 15 | + private String mail; | |
| 16 | + | |
| 17 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +import javax.validation.constraints.NotNull; | |
| 10 | + | |
| 11 | +@ApiModel("管理后台 - 邮箱账号修改 Request VO") | |
| 12 | +@Data | |
| 13 | +@EqualsAndHashCode(callSuper = true) | |
| 14 | +@ToString(callSuper = true) | |
| 15 | +public class MailAccountUpdateReqVO extends MailAccountBaseVO { | |
| 16 | + | |
| 17 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | |
| 18 | + @NotNull(message = "编号不能为空") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogBaseVO.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import io.swagger.annotations.*; | |
| 9 | +import javax.validation.constraints.*; | |
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 11 | + | |
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | + | |
| 14 | +/** | |
| 15 | +* 邮件日志 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 16 | +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 17 | +*/ | |
| 18 | +@Data | |
| 19 | +public class MailLogBaseVO { | |
| 20 | + | |
| 21 | + @ApiModelProperty(value = "用户编号", example = "30883") | |
| 22 | + private Long userId; | |
| 23 | + | |
| 24 | + @ApiModelProperty(value = "用户类型", example = "2", notes = "参见 UserTypeEnum 枚举") | |
| 25 | + private Byte userType; | |
| 26 | + | |
| 27 | + @ApiModelProperty(value = "接收邮箱地址", required = true, example = "76854@qq.com") | |
| 28 | + @NotNull(message = "接收邮箱地址不能为空") | |
| 29 | + private String toMail; | |
| 30 | + | |
| 31 | + @ApiModelProperty(value = "邮箱账号编号", required = true, example = "18107") | |
| 32 | + @NotNull(message = "邮箱账号编号不能为空") | |
| 33 | + private Long accountId; | |
| 34 | + | |
| 35 | + @ApiModelProperty(value = "发送邮箱地址", required = true, example = "85757@qq.com") | |
| 36 | + @NotNull(message = "发送邮箱地址不能为空") | |
| 37 | + private String fromMail; | |
| 38 | + | |
| 39 | + @ApiModelProperty(value = "模板编号", required = true, example = "5678") | |
| 40 | + @NotNull(message = "模板编号不能为空") | |
| 41 | + private Long templateId; | |
| 42 | + | |
| 43 | + @ApiModelProperty(value = "模板编码", required = true, example = "test_01") | |
| 44 | + @NotNull(message = "模板编码不能为空") | |
| 45 | + private String templateCode; | |
| 46 | + | |
| 47 | + @ApiModelProperty(value = "模版发送人名称", example = "李四") | |
| 48 | + private String templateNickname; | |
| 49 | + | |
| 50 | + @ApiModelProperty(value = "邮件标题", required = true, example = "测试标题") | |
| 51 | + @NotNull(message = "邮件标题不能为空") | |
| 52 | + private String templateTitle; | |
| 53 | + | |
| 54 | + @ApiModelProperty(value = "邮件内容", required = true, example = "测试内容") | |
| 55 | + @NotNull(message = "邮件内容不能为空") | |
| 56 | + private String templateContent; | |
| 57 | + | |
| 58 | + @ApiModelProperty(value = "邮件参数", required = true) | |
| 59 | + @NotNull(message = "邮件参数不能为空") | |
| 60 | + private Map<String, Object> templateParams; | |
| 61 | + | |
| 62 | + @ApiModelProperty(value = "发送状态", required = true, example = "1", notes = "参见 MailSendStatusEnum 枚举") | |
| 63 | + @NotNull(message = "发送状态不能为空") | |
| 64 | + private Byte sendStatus; | |
| 65 | + | |
| 66 | + @ApiModelProperty(value = "发送时间") | |
| 67 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 68 | + private LocalDateTime sendTime; | |
| 69 | + | |
| 70 | + @ApiModelProperty(value = "发送返回的消息 ID", example = "28568") | |
| 71 | + private String sendMessageId; | |
| 72 | + | |
| 73 | + @ApiModelProperty(value = "发送异常") | |
| 74 | + private String sendException; | |
| 75 | + | |
| 76 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.annotations.ApiModel; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.ToString; | |
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | + | |
| 11 | +import java.sql.Timestamp; | |
| 12 | +import java.time.LocalDateTime; | |
| 13 | + | |
| 14 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 15 | + | |
| 16 | +@ApiModel("管理后台 - 邮箱日志分页 Request VO") | |
| 17 | +@Data | |
| 18 | +@EqualsAndHashCode(callSuper = true) | |
| 19 | +@ToString(callSuper = true) | |
| 20 | +public class MailLogPageReqVO extends PageParam { | |
| 21 | + | |
| 22 | + @ApiModelProperty(value = "用户编号", example = "30883") | |
| 23 | + private Long userId; | |
| 24 | + | |
| 25 | + @ApiModelProperty(value = "用户类型", example = "2", notes = "参见 UserTypeEnum 枚举") | |
| 26 | + private Integer userType; | |
| 27 | + | |
| 28 | + @ApiModelProperty(value = "接收邮箱地址", example = "76854@qq.com", notes = "模糊匹配") | |
| 29 | + private String toMail; | |
| 30 | + | |
| 31 | + @ApiModelProperty(value = "邮箱账号编号", example = "18107") | |
| 32 | + private Long accountId; | |
| 33 | + | |
| 34 | + @ApiModelProperty(value = "模板编号", example = "5678") | |
| 35 | + private Long templateId; | |
| 36 | + | |
| 37 | + @ApiModelProperty(value = "发送状态", example = "1", notes = "参见 MailSendStatusEnum 枚举") | |
| 38 | + private Integer sendStatus; | |
| 39 | + | |
| 40 | + @ApiModelProperty(value = "发送时间") | |
| 41 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 42 | + private LocalDateTime[] sendTime; | |
| 43 | + | |
| 44 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogRespVO.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.time.LocalDateTime; | |
| 5 | +import io.swagger.annotations.*; | |
| 6 | + | |
| 7 | +@ApiModel("管理后台 - 邮件日志 Response VO") | |
| 8 | +@Data | |
| 9 | +@EqualsAndHashCode(callSuper = true) | |
| 10 | +@ToString(callSuper = true) | |
| 11 | +public class MailLogRespVO extends MailLogBaseVO { | |
| 12 | + | |
| 13 | + @ApiModelProperty(value = "编号", required = true, example = "31020") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @ApiModelProperty(value = "创建时间", required = true) | |
| 17 | + private LocalDateTime createTime; | |
| 18 | + | |
| 19 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import javax.validation.constraints.NotEmpty; | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 邮件模版 Base VO,提供给添加、修改、详细的子 VO 使用 | |
| 12 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | |
| 13 | + */ | |
| 14 | +@Data | |
| 15 | +public class MailTemplateBaseVO { | |
| 16 | + | |
| 17 | + @ApiModelProperty(value = "模版名称", required = true, example = "测试名字") | |
| 18 | + @NotNull(message = "名称不能为空") | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | + @ApiModelProperty(value = "模版编号", required = true, example = "test") | |
| 22 | + @NotNull(message = "模版编号不能为空") | |
| 23 | + private String code; | |
| 24 | + | |
| 25 | + @ApiModelProperty(value = "发送的邮箱账号编号", required = true, example = "1") | |
| 26 | + @NotNull(message = "发送的邮箱账号编号不能为空") | |
| 27 | + private Long accountId; | |
| 28 | + | |
| 29 | + @ApiModelProperty(value = "发送人名称", example = "芋头") | |
| 30 | + private String nickname; | |
| 31 | + | |
| 32 | + @ApiModelProperty(value = "标题", required = true, example = "注册成功") | |
| 33 | + @NotEmpty(message = "标题不能为空") | |
| 34 | + private String title; | |
| 35 | + | |
| 36 | + @ApiModelProperty(value = "内容", required = true, example = "你好,注册成功啦") | |
| 37 | + @NotEmpty(message = "内容不能为空") | |
| 38 | + private String content; | |
| 39 | + | |
| 40 | + @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") | |
| 41 | + @NotNull(message = "状态不能为空") | |
| 42 | + private Integer status; | |
| 43 | + | |
| 44 | + @ApiModelProperty(value = "备注", example = "奥特曼") | |
| 45 | + private String remark; | |
| 46 | + | |
| 47 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@ApiModel("管理后台 - 邮件模版创建 Request VO") | |
| 9 | +@Data | |
| 10 | +@EqualsAndHashCode(callSuper = true) | |
| 11 | +@ToString(callSuper = true) | |
| 12 | +public class MailTemplateCreateReqVO extends MailTemplateBaseVO { | |
| 13 | + | |
| 14 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplatePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.annotations.ApiModel; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.ToString; | |
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | + | |
| 13 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 14 | + | |
| 15 | +@ApiModel("管理后台 - 邮件模版分页 Request VO") | |
| 16 | +@Data | |
| 17 | +@EqualsAndHashCode(callSuper = true) | |
| 18 | +@ToString(callSuper = true) | |
| 19 | +public class MailTemplatePageReqVO extends PageParam { | |
| 20 | + | |
| 21 | + @ApiModelProperty(value = "状态", example = "1", notes = "参见 CommonStatusEnum 枚举") | |
| 22 | + private Integer status; | |
| 23 | + | |
| 24 | + @ApiModelProperty(value = "标识", example = "code_1024", notes = "模糊匹配") | |
| 25 | + private String code; | |
| 26 | + | |
| 27 | + @ApiModelProperty(value = "名称", example = "芋头", notes = "模糊匹配") | |
| 28 | + private String name; | |
| 29 | + | |
| 30 | + @ApiModelProperty(value = "账号编号", example = "2048") | |
| 31 | + private Long accountId; | |
| 32 | + | |
| 33 | + @ApiModelProperty(value = "创建时间") | |
| 34 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 35 | + private LocalDateTime[] createTime; | |
| 36 | + | |
| 37 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +@ApiModel("管理后台 - 邮件末班 Response VO") | |
| 13 | +@Data | |
| 14 | +@EqualsAndHashCode(callSuper = true) | |
| 15 | +@ToString(callSuper = true) | |
| 16 | +public class MailTemplateRespVO extends MailTemplateBaseVO { | |
| 17 | + | |
| 18 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @ApiModelProperty(value = "参数数组", example = "name,code") | |
| 22 | + private List<String> params; | |
| 23 | + | |
| 24 | + @ApiModelProperty(value = "创建时间", required = true) | |
| 25 | + private LocalDateTime createTime; | |
| 26 | + | |
| 27 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateSendReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import javax.validation.constraints.NotEmpty; | |
| 8 | +import javax.validation.constraints.NotNull; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +@ApiModel("管理后台 - 邮件发送 Req VO") | |
| 12 | +@Data | |
| 13 | +public class MailTemplateSendReqVO { | |
| 14 | + | |
| 15 | + @ApiModelProperty(value = "接收邮箱", required = true, example = "7685413@qq.com") | |
| 16 | + @NotEmpty(message = "接收邮箱不能为空") | |
| 17 | + private String mail; | |
| 18 | + | |
| 19 | + @ApiModelProperty(value = "模板编码", required = true, example = "test_01") | |
| 20 | + @NotNull(message = "模板编码不能为空") | |
| 21 | + private String templateCode; | |
| 22 | + | |
| 23 | + @ApiModelProperty(value = "模板参数") | |
| 24 | + private Map<String, Object> templateParams; | |
| 25 | + | |
| 26 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateSimpleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +@ApiModel("管理后台 - 邮件模版的精简 Response VO") | |
| 8 | +@Data | |
| 9 | +public class MailTemplateSimpleRespVO { | |
| 10 | + | |
| 11 | + @ApiModelProperty(value = "模版编号", required = true, example = "1024") | |
| 12 | + private Long id; | |
| 13 | + | |
| 14 | + @ApiModelProperty(value = "模版名字", required = true, example = "哒哒哒") | |
| 15 | + private String name; | |
| 16 | + | |
| 17 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 8 | + | |
| 9 | +import javax.validation.constraints.NotNull; | |
| 10 | + | |
| 11 | +@ApiModel("管理后台 - 邮件模版修改 Request VO") | |
| 12 | +@Data | |
| 13 | +@EqualsAndHashCode(callSuper = true) | |
| 14 | +@ToString(callSuper = true) | |
| 15 | +public class MailTemplateUpdateReqVO extends MailTemplateBaseVO { | |
| 16 | + | |
| 17 | + @ApiModelProperty(value = "编号", required = true, example = "1024") | |
| 18 | + @NotNull(message = "编号不能为空") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.mail; | |
| 2 | + | |
| 3 | +import cn.hutool.core.util.StrUtil; | |
| 4 | +import cn.hutool.extra.mail.MailAccount; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.*; | |
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 8 | +import org.mapstruct.Mapper; | |
| 9 | +import org.mapstruct.factory.Mappers; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +@Mapper | |
| 14 | +public interface MailAccountConvert { | |
| 15 | + | |
| 16 | + MailAccountConvert INSTANCE = Mappers.getMapper(MailAccountConvert.class); | |
| 17 | + | |
| 18 | + MailAccountDO convert(MailAccountCreateReqVO bean); | |
| 19 | + | |
| 20 | + MailAccountDO convert(MailAccountUpdateReqVO bean); | |
| 21 | + | |
| 22 | + MailAccountRespVO convert(MailAccountDO bean); | |
| 23 | + | |
| 24 | + PageResult<MailAccountBaseVO> convertPage(PageResult<MailAccountDO> pageResult); | |
| 25 | + | |
| 26 | + List<MailAccountSimpleRespVO> convertList02(List<MailAccountDO> list); | |
| 27 | + | |
| 28 | + default MailAccount convert(MailAccountDO account, String nickname) { | |
| 29 | + String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail(); | |
| 30 | + return new MailAccount().setFrom(from).setAuth(true) | |
| 31 | + .setUser(account.getUsername()).setPass(account.getPassword()) | |
| 32 | + .setHost(account.getHost()).setPort(account.getPort()).setSslEnable(account.getSslEnable()); | |
| 33 | + } | |
| 34 | + | |
| 35 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailLogConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO; | |
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | |
| 6 | +import org.mapstruct.Mapper; | |
| 7 | +import org.mapstruct.factory.Mappers; | |
| 8 | + | |
| 9 | +@Mapper | |
| 10 | +public interface MailLogConvert { | |
| 11 | + | |
| 12 | + MailLogConvert INSTANCE = Mappers.getMapper(MailLogConvert.class); | |
| 13 | + | |
| 14 | + PageResult<MailLogRespVO> convertPage(PageResult<MailLogDO> pageResult); | |
| 15 | + | |
| 16 | + MailLogRespVO convert(MailLogDO bean); | |
| 17 | + | |
| 18 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailTemplateConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.*; | |
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 6 | +import org.mapstruct.Mapper; | |
| 7 | +import org.mapstruct.factory.Mappers; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +@Mapper | |
| 12 | +public interface MailTemplateConvert { | |
| 13 | + | |
| 14 | + MailTemplateConvert INSTANCE = Mappers.getMapper(MailTemplateConvert.class); | |
| 15 | + | |
| 16 | + MailTemplateDO convert(MailTemplateUpdateReqVO bean); | |
| 17 | + | |
| 18 | + MailTemplateDO convert(MailTemplateCreateReqVO bean); | |
| 19 | + | |
| 20 | + MailTemplateRespVO convert(MailTemplateDO bean); | |
| 21 | + | |
| 22 | + PageResult<MailTemplateRespVO> convertPage(PageResult<MailTemplateDO> pageResult); | |
| 23 | + | |
| 24 | + List<MailTemplateSimpleRespVO> convertList02(List<MailTemplateDO> list); | |
| 25 | + | |
| 26 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailAccountDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.dataobject.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 邮箱账号 DO | |
| 11 | + * | |
| 12 | + * 用途:配置发送邮箱的账号 | |
| 13 | + * | |
| 14 | + * @author wangjingyi | |
| 15 | + * @since 2022-03-21 | |
| 16 | + */ | |
| 17 | +@TableName(value = "system_mail_account", autoResultMap = true) | |
| 18 | +@Data | |
| 19 | +@EqualsAndHashCode(callSuper = true) | |
| 20 | +public class MailAccountDO extends BaseDO { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 主键 | |
| 24 | + */ | |
| 25 | + @TableId | |
| 26 | + private Long id; | |
| 27 | + /** | |
| 28 | + * 邮箱 | |
| 29 | + */ | |
| 30 | + private String mail; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 用户名 | |
| 34 | + */ | |
| 35 | + private String username; | |
| 36 | + /** | |
| 37 | + * 密码 | |
| 38 | + */ | |
| 39 | + private String password; | |
| 40 | + /** | |
| 41 | + * SMTP 服务器域名 | |
| 42 | + */ | |
| 43 | + private String host; | |
| 44 | + /** | |
| 45 | + * SMTP 服务器端口 | |
| 46 | + */ | |
| 47 | + private Integer port; | |
| 48 | + /** | |
| 49 | + * 是否开启 SSL | |
| 50 | + */ | |
| 51 | + private Boolean sslEnable; | |
| 52 | + | |
| 53 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailLogDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.dataobject.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | +import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 8 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 9 | +import lombok.*; | |
| 10 | + | |
| 11 | +import java.io.Serializable; | |
| 12 | +import java.util.Date; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 邮箱日志 DO | |
| 17 | + * 记录每一次邮件的发送 | |
| 18 | + * | |
| 19 | + * @author wangjingyi | |
| 20 | + * @since 2022-03-21 | |
| 21 | + */ | |
| 22 | +@TableName(value = "system_mail_log", autoResultMap = true) | |
| 23 | +@Data | |
| 24 | +@EqualsAndHashCode(callSuper = true) | |
| 25 | +@ToString(callSuper = true) | |
| 26 | +@Builder | |
| 27 | +@AllArgsConstructor | |
| 28 | +@NoArgsConstructor | |
| 29 | +public class MailLogDO extends BaseDO implements Serializable { | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 日志编号,自增 | |
| 33 | + */ | |
| 34 | + private Long id; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 用户编码 | |
| 38 | + */ | |
| 39 | + private Long userId; | |
| 40 | + /** | |
| 41 | + * 用户类型 | |
| 42 | + * | |
| 43 | + * 枚举 {@link UserTypeEnum} | |
| 44 | + */ | |
| 45 | + private Integer userType; | |
| 46 | + /** | |
| 47 | + * 接收邮箱地址 | |
| 48 | + */ | |
| 49 | + private String toMail; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 邮箱账号编号 | |
| 53 | + * | |
| 54 | + * 关联 {@link MailAccountDO#getId()} | |
| 55 | + */ | |
| 56 | + private Long accountId; | |
| 57 | + /** | |
| 58 | + * 发送邮箱地址 | |
| 59 | + * | |
| 60 | + * 冗余 {@link MailAccountDO#getMail()} | |
| 61 | + */ | |
| 62 | + private String fromMail; | |
| 63 | + | |
| 64 | + // ========= 模板相关字段 ========= | |
| 65 | + /** | |
| 66 | + * 模版编号 | |
| 67 | + * | |
| 68 | + * 关联 {@link MailTemplateDO#getId()} | |
| 69 | + */ | |
| 70 | + private Long templateId; | |
| 71 | + /** | |
| 72 | + * 模版编码 | |
| 73 | + * | |
| 74 | + * 冗余 {@link MailTemplateDO#getCode()} | |
| 75 | + */ | |
| 76 | + private String templateCode; | |
| 77 | + /** | |
| 78 | + * 模版发送人名称 | |
| 79 | + * | |
| 80 | + * 冗余 {@link MailTemplateDO#getNickname()} | |
| 81 | + */ | |
| 82 | + private String templateNickname; | |
| 83 | + /** | |
| 84 | + * 模版标题 | |
| 85 | + */ | |
| 86 | + private String templateTitle; | |
| 87 | + /** | |
| 88 | + * 模版内容 | |
| 89 | + * | |
| 90 | + * 基于 {@link MailTemplateDO#getContent()} 格式化后的内容 | |
| 91 | + */ | |
| 92 | + private String templateContent; | |
| 93 | + /** | |
| 94 | + * 模版参数 | |
| 95 | + * | |
| 96 | + * 基于 {@link MailTemplateDO#getParams()} 输入后的参数 | |
| 97 | + */ | |
| 98 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 99 | + private Map<String, Object> templateParams; | |
| 100 | + | |
| 101 | + // ========= 发送相关字段 ========= | |
| 102 | + /** | |
| 103 | + * 发送状态 | |
| 104 | + * | |
| 105 | + * 枚举 {@link MailSendStatusEnum} | |
| 106 | + */ | |
| 107 | + private Integer sendStatus; | |
| 108 | + /** | |
| 109 | + * 发送时间 | |
| 110 | + */ | |
| 111 | + private Date sendTime; | |
| 112 | + /** | |
| 113 | + * 发送返回的消息 ID | |
| 114 | + */ | |
| 115 | + private String sendMessageId; | |
| 116 | + /** | |
| 117 | + * 发送异常 | |
| 118 | + */ | |
| 119 | + private String sendException; | |
| 120 | + | |
| 121 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailTemplateDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.dataobject.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 8 | +import lombok.Data; | |
| 9 | +import lombok.EqualsAndHashCode; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 邮件模版 DO | |
| 15 | + * | |
| 16 | + * @author wangjingyi | |
| 17 | + * @since 2022-03-21 | |
| 18 | + */ | |
| 19 | +@TableName(value = "system_mail_template", autoResultMap = true) | |
| 20 | +@Data | |
| 21 | +@EqualsAndHashCode(callSuper = true) | |
| 22 | +public class MailTemplateDO extends BaseDO { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 主键 | |
| 26 | + */ | |
| 27 | + private Long id; | |
| 28 | + /** | |
| 29 | + * 模版名称 | |
| 30 | + */ | |
| 31 | + private String name; | |
| 32 | + /** | |
| 33 | + * 模版编号 | |
| 34 | + */ | |
| 35 | + private String code; | |
| 36 | + /** | |
| 37 | + * 发送的邮箱账号编号 | |
| 38 | + * | |
| 39 | + * 关联 {@link MailAccountDO#getId()} | |
| 40 | + */ | |
| 41 | + private Long accountId; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 发送人名称 | |
| 45 | + */ | |
| 46 | + private String nickname; | |
| 47 | + /** | |
| 48 | + * 标题 | |
| 49 | + */ | |
| 50 | + private String title; | |
| 51 | + /** | |
| 52 | + * 内容 | |
| 53 | + */ | |
| 54 | + private String content; | |
| 55 | + /** | |
| 56 | + * 参数数组(自动根据内容生成) | |
| 57 | + */ | |
| 58 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 59 | + private List<String> params; | |
| 60 | + /** | |
| 61 | + * 状态 | |
| 62 | + * | |
| 63 | + * 枚举 {@link CommonStatusEnum} | |
| 64 | + */ | |
| 65 | + private Integer status; | |
| 66 | + /** | |
| 67 | + * 备注 | |
| 68 | + */ | |
| 69 | + private String remark; | |
| 70 | + | |
| 71 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailAccountMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +@Mapper | |
| 12 | +public interface MailAccountMapper extends BaseMapperX<MailAccountDO> { | |
| 13 | + | |
| 14 | + default PageResult<MailAccountDO> selectPage(MailAccountPageReqVO pageReqVO) { | |
| 15 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<MailAccountDO>() | |
| 16 | + .likeIfPresent(MailAccountDO::getMail, pageReqVO.getMail()) | |
| 17 | + .likeIfPresent(MailAccountDO::getUsername , pageReqVO.getUsername())); | |
| 18 | + } | |
| 19 | + | |
| 20 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailLogMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | |
| 8 | +import org.apache.ibatis.annotations.Mapper; | |
| 9 | + | |
| 10 | +@Mapper | |
| 11 | +public interface MailLogMapper extends BaseMapperX<MailLogDO> { | |
| 12 | + | |
| 13 | + default PageResult<MailLogDO> selectPage(MailLogPageReqVO reqVO) { | |
| 14 | + return selectPage(reqVO, new LambdaQueryWrapperX<MailLogDO>() | |
| 15 | + .eqIfPresent(MailLogDO::getUserId, reqVO.getUserId()) | |
| 16 | + .eqIfPresent(MailLogDO::getUserType, reqVO.getUserType()) | |
| 17 | + .likeIfPresent(MailLogDO::getToMail, reqVO.getToMail()) | |
| 18 | + .eqIfPresent(MailLogDO::getAccountId, reqVO.getAccountId()) | |
| 19 | + .eqIfPresent(MailLogDO::getTemplateId, reqVO.getTemplateId()) | |
| 20 | + .eqIfPresent(MailLogDO::getSendStatus, reqVO.getSendStatus()) | |
| 21 | + .betweenIfPresent(MailLogDO::getSendTime, reqVO.getSendTime()) | |
| 22 | + .orderByDesc(MailLogDO::getId)); | |
| 23 | + } | |
| 24 | + | |
| 25 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailTemplateMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO; | |
| 10 | +import org.apache.ibatis.annotations.Mapper; | |
| 11 | +import org.apache.ibatis.annotations.Select; | |
| 12 | + | |
| 13 | +import java.util.Date; | |
| 14 | + | |
| 15 | +@Mapper | |
| 16 | +public interface MailTemplateMapper extends BaseMapperX<MailTemplateDO> { | |
| 17 | + | |
| 18 | + default PageResult<MailTemplateDO> selectPage(MailTemplatePageReqVO pageReqVO){ | |
| 19 | + return selectPage(pageReqVO , new LambdaQueryWrapperX<MailTemplateDO>() | |
| 20 | + .eqIfPresent(MailTemplateDO::getStatus, pageReqVO.getStatus()) | |
| 21 | + .likeIfPresent(MailTemplateDO::getCode, pageReqVO.getCode()) | |
| 22 | + .likeIfPresent(MailTemplateDO::getName, pageReqVO.getName()) | |
| 23 | + .eqIfPresent(MailTemplateDO::getAccountId, pageReqVO.getAccountId()) | |
| 24 | + .betweenIfPresent(MailTemplateDO::getCreateTime, pageReqVO.getCreateTime())); | |
| 25 | + } | |
| 26 | + | |
| 27 | + default Long selectCountByAccountId(Long accountId) { | |
| 28 | + return selectCount(MailTemplateDO::getAccountId, accountId); | |
| 29 | + } | |
| 30 | + | |
| 31 | + default MailTemplateDO selectByCode(String code) { | |
| 32 | + return selectOne(MailTemplateDO::getCode, code); | |
| 33 | + } | |
| 34 | + | |
| 35 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/mail/MailAccountRefreshConsumer.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.mq.consumer.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailAccountRefreshMessage; | |
| 5 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage; | |
| 6 | +import cn.iocoder.yudao.module.system.service.mail.MailAccountService; | |
| 7 | +import cn.iocoder.yudao.module.system.service.mail.MailTemplateService; | |
| 8 | +import lombok.extern.slf4j.Slf4j; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +import javax.annotation.Resource; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 针对 {@link MailAccountRefreshMessage} 的消费者 | |
| 15 | + * | |
| 16 | + * @author wangjingyi | |
| 17 | + */ | |
| 18 | +@Component | |
| 19 | +@Slf4j | |
| 20 | +public class MailAccountRefreshConsumer extends AbstractChannelMessageListener<MailAccountRefreshMessage> { | |
| 21 | + | |
| 22 | + @Resource | |
| 23 | + private MailAccountService mailAccountService; | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public void onMessage(MailAccountRefreshMessage message) { | |
| 27 | + log.info("[onMessage][收到 Mail Account 刷新信息]"); | |
| 28 | + mailAccountService.initLocalCache(); | |
| 29 | + } | |
| 30 | + | |
| 31 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/mail/MailSendConsumer.java
| ... | ... | @@ -2,17 +2,29 @@ package cn.iocoder.yudao.module.system.mq.consumer.mail; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; |
| 4 | 4 | import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage; |
| 5 | +import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage; | |
| 6 | +import cn.iocoder.yudao.module.system.service.mail.MailSendService; | |
| 5 | 7 | import lombok.extern.slf4j.Slf4j; |
| 6 | 8 | import org.springframework.stereotype.Component; |
| 7 | 9 | |
| 8 | -// TODO 芋艿:这个暂未实现 | |
| 10 | +import javax.annotation.Resource; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 针对 {@link MailSendMessage} 的消费者 | |
| 14 | + * | |
| 15 | + * @author 芋道源码 | |
| 16 | + */ | |
| 9 | 17 | @Component |
| 10 | 18 | @Slf4j |
| 11 | 19 | public class MailSendConsumer extends AbstractStreamMessageListener<MailSendMessage> { |
| 12 | 20 | |
| 21 | + @Resource | |
| 22 | + private MailSendService mailSendService; | |
| 23 | + | |
| 13 | 24 | @Override |
| 14 | 25 | public void onMessage(MailSendMessage message) { |
| 15 | 26 | log.info("[onMessage][消息内容({})]", message); |
| 27 | + mailSendService.doSendMail(message); | |
| 16 | 28 | } |
| 17 | 29 | |
| 18 | 30 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/mail/MailTemplateRefreshConsumer.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.mq.consumer.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; | |
| 4 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage; | |
| 5 | +import cn.iocoder.yudao.module.system.service.mail.MailTemplateService; | |
| 6 | +import lombok.extern.slf4j.Slf4j; | |
| 7 | +import org.springframework.stereotype.Component; | |
| 8 | + | |
| 9 | +import javax.annotation.Resource; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 针对 {@link MailTemplateRefreshMessage} 的消费者 | |
| 13 | + * | |
| 14 | + * @author wangjingyi | |
| 15 | + */ | |
| 16 | +@Component | |
| 17 | +@Slf4j | |
| 18 | +public class MailTemplateRefreshConsumer extends AbstractChannelMessageListener<MailTemplateRefreshMessage> { | |
| 19 | + | |
| 20 | + @Resource | |
| 21 | + private MailTemplateService mailTemplateService; | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void onMessage(MailTemplateRefreshMessage message) { | |
| 25 | + log.info("[onMessage][收到 Mail Template 刷新信息]"); | |
| 26 | + mailTemplateService.initLocalCache(); | |
| 27 | + } | |
| 28 | + | |
| 29 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/message/mail/MailAccountRefreshMessage.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.mq.message.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 邮箱账号的数据刷新 Message | |
| 9 | + * | |
| 10 | + * @author wangjingyi | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +@EqualsAndHashCode(callSuper = true) | |
| 14 | +public class MailAccountRefreshMessage extends AbstractChannelMessage { | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public String getChannel() { | |
| 18 | + return "system.mail-account.refresh"; | |
| 19 | + } | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/message/mail/MailSendMessage.java
| ... | ... | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import lombok.EqualsAndHashCode; |
| 6 | 6 | |
| 7 | +import javax.validation.constraints.NotEmpty; | |
| 7 | 8 | import javax.validation.constraints.NotNull; |
| 8 | -import java.util.Map; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * 邮箱发送消息 |
| ... | ... | @@ -17,28 +17,35 @@ import java.util.Map; |
| 17 | 17 | public class MailSendMessage extends AbstractStreamMessage { |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * 邮箱地址 | |
| 20 | + * 邮件日志编号 | |
| 21 | 21 | */ |
| 22 | - @NotNull(message = "邮箱地址不能为空") | |
| 23 | - private String address; | |
| 22 | + @NotNull(message = "邮件日志编号不能为空") | |
| 23 | + private Long logId; | |
| 24 | 24 | /** |
| 25 | - * 短信模板编号 | |
| 25 | + * 接收邮件地址 | |
| 26 | 26 | */ |
| 27 | - @NotNull(message = "短信模板编号不能为空") | |
| 28 | - private String templateCode; | |
| 27 | + @NotNull(message = "接收邮件地址不能为空") | |
| 28 | + private String mail; | |
| 29 | 29 | /** |
| 30 | - * 短信模板参数 | |
| 30 | + * 邮件账号编号 | |
| 31 | 31 | */ |
| 32 | - private Map<String, Object> templateParams; | |
| 32 | + @NotNull(message = "邮件账号编号不能为空") | |
| 33 | + private Long accountId; | |
| 33 | 34 | |
| 34 | 35 | /** |
| 35 | - * 用户编号,允许空 | |
| 36 | + * 邮件发件人 | |
| 36 | 37 | */ |
| 37 | - private Integer userId; | |
| 38 | + private String nickname; | |
| 38 | 39 | /** |
| 39 | - * 用户类型,允许空 | |
| 40 | + * 邮件标题 | |
| 40 | 41 | */ |
| 41 | - private Integer userType; | |
| 42 | + @NotEmpty(message = "邮件标题不能为空") | |
| 43 | + private String title; | |
| 44 | + /** | |
| 45 | + * 邮件内容 | |
| 46 | + */ | |
| 47 | + @NotEmpty(message = "邮件内容不能为空") | |
| 48 | + private String content; | |
| 42 | 49 | |
| 43 | 50 | @Override |
| 44 | 51 | public String getStreamKey() { | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/message/mail/MailTemplateRefreshMessage.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.mq.message.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessage; | |
| 4 | +import lombok.Data; | |
| 5 | +import lombok.EqualsAndHashCode; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 邮箱模板的数据刷新 Message | |
| 9 | + * | |
| 10 | + * @author wangjingyi | |
| 11 | + */ | |
| 12 | +@Data | |
| 13 | +@EqualsAndHashCode(callSuper = true) | |
| 14 | +public class MailTemplateRefreshMessage extends AbstractChannelMessage { | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public String getChannel() { | |
| 18 | + return "system.mail-template.refresh"; | |
| 19 | + } | |
| 20 | + | |
| 21 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/mq/producer/mail/MailProducer.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.mq.producer.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; | |
| 4 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailAccountRefreshMessage; | |
| 5 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage; | |
| 6 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailTemplateRefreshMessage; | |
| 7 | +import lombok.extern.slf4j.Slf4j; | |
| 8 | +import org.springframework.stereotype.Component; | |
| 9 | + | |
| 10 | +import javax.annotation.Resource; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Mail 邮件相关消息的 Producer | |
| 14 | + * | |
| 15 | + * @author wangjingyi | |
| 16 | + * @since 2021/4/19 13:33 | |
| 17 | + */ | |
| 18 | +@Slf4j | |
| 19 | +@Component | |
| 20 | +public class MailProducer { | |
| 21 | + | |
| 22 | + @Resource | |
| 23 | + private RedisMQTemplate redisMQTemplate; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 发送 {@link MailTemplateRefreshMessage} 消息 | |
| 27 | + */ | |
| 28 | + public void sendMailTemplateRefreshMessage() { | |
| 29 | + MailTemplateRefreshMessage message = new MailTemplateRefreshMessage(); | |
| 30 | + redisMQTemplate.send(message); | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 发送 {@link MailAccountRefreshMessage} 消息 | |
| 35 | + */ | |
| 36 | + public void sendMailAccountRefreshMessage() { | |
| 37 | + MailAccountRefreshMessage message = new MailAccountRefreshMessage(); | |
| 38 | + redisMQTemplate.send(message); | |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 发送 {@link MailSendMessage} 消息 | |
| 43 | + * | |
| 44 | + * @param sendLogId 发送日志编码 | |
| 45 | + * @param mail 接收邮件地址 | |
| 46 | + * @param accountId 邮件账号编号 | |
| 47 | + * @param nickname 邮件发件人 | |
| 48 | + * @param title 邮件标题 | |
| 49 | + * @param content 邮件内容 | |
| 50 | + */ | |
| 51 | + public void sendMailSendMessage(Long sendLogId, String mail, Long accountId, | |
| 52 | + String nickname, String title, String content) { | |
| 53 | + MailSendMessage message = new MailSendMessage() | |
| 54 | + .setLogId(sendLogId).setMail(mail).setAccountId(accountId) | |
| 55 | + .setNickname(nickname).setTitle(title).setContent(content); | |
| 56 | + redisMQTemplate.send(message); | |
| 57 | + } | |
| 58 | + | |
| 59 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 8 | + | |
| 9 | +import javax.validation.Valid; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 邮箱账号 Service 接口 | |
| 14 | + * | |
| 15 | + * @author wangjingyi | |
| 16 | + * @since 2022-03-21 | |
| 17 | + */ | |
| 18 | +public interface MailAccountService { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 初始化邮箱账号的本地缓存 | |
| 22 | + */ | |
| 23 | + void initLocalCache(); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 从缓存中获取邮箱账号 | |
| 27 | + * | |
| 28 | + * @param id 编号 | |
| 29 | + * @return 邮箱账号 | |
| 30 | + */ | |
| 31 | + MailAccountDO getMailAccountFromCache(Long id); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 创建邮箱账号 | |
| 35 | + * | |
| 36 | + * @param createReqVO 邮箱账号信息 | |
| 37 | + * @return 编号 | |
| 38 | + */ | |
| 39 | + Long createMailAccount(@Valid MailAccountCreateReqVO createReqVO); | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 修改邮箱账号 | |
| 43 | + * | |
| 44 | + * @param updateReqVO 邮箱账号信息 | |
| 45 | + */ | |
| 46 | + void updateMailAccount(@Valid MailAccountUpdateReqVO updateReqVO); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 删除邮箱账号 | |
| 50 | + * | |
| 51 | + * @param id 编号 | |
| 52 | + */ | |
| 53 | + void deleteMailAccount(Long id); | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 获取邮箱账号信息 | |
| 57 | + * | |
| 58 | + * @param id 编号 | |
| 59 | + * @return 邮箱账号信息 | |
| 60 | + */ | |
| 61 | + MailAccountDO getMailAccount(Long id); | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 获取邮箱账号分页信息 | |
| 65 | + * | |
| 66 | + * @param pageReqVO 邮箱账号分页参数 | |
| 67 | + * @return 邮箱账号分页信息 | |
| 68 | + */ | |
| 69 | + PageResult<MailAccountDO> getMailAccountPage(MailAccountPageReqVO pageReqVO); | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 获取邮箱数组信息 | |
| 73 | + * | |
| 74 | + * @return 邮箱账号信息数组 | |
| 75 | + */ | |
| 76 | + List<MailAccountDO> getMailAccountList(); | |
| 77 | + | |
| 78 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper; | |
| 10 | +import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer; | |
| 11 | +import lombok.Getter; | |
| 12 | +import lombok.extern.slf4j.Slf4j; | |
| 13 | +import org.springframework.stereotype.Service; | |
| 14 | +import org.springframework.validation.annotation.Validated; | |
| 15 | + | |
| 16 | +import javax.annotation.PostConstruct; | |
| 17 | +import javax.annotation.Resource; | |
| 18 | +import java.util.List; | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 21 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 22 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 23 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * 邮箱账号 Service 实现类 | |
| 27 | + * | |
| 28 | + * @author wangjingyi | |
| 29 | + * @since 2022-03-21 | |
| 30 | + */ | |
| 31 | +@Service | |
| 32 | +@Validated | |
| 33 | +@Slf4j | |
| 34 | +public class MailAccountServiceImpl implements MailAccountService { | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private MailAccountMapper mailAccountMapper; | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private MailTemplateService mailTemplateService; | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private MailProducer mailProducer; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 邮箱账号缓存 | |
| 47 | + * key:邮箱账号编码 {@link MailAccountDO#getId()} | |
| 48 | + * | |
| 49 | + * 这里声明 volatile 修饰的原因是,每次刷新时,直接修改指向 | |
| 50 | + */ | |
| 51 | + @Getter | |
| 52 | + private volatile Map<Long, MailAccountDO> mailAccountCache; | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + @PostConstruct | |
| 56 | + public void initLocalCache() { | |
| 57 | + // 第一步:查询数据 | |
| 58 | + List<MailAccountDO> accounts = mailAccountMapper.selectList(); | |
| 59 | + log.info("[initLocalCache][缓存邮箱账号,数量:{}]", accounts.size()); | |
| 60 | + | |
| 61 | + // 第二步:构建缓存 | |
| 62 | + mailAccountCache = convertMap(accounts, MailAccountDO::getId); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + public MailAccountDO getMailAccountFromCache(Long id) { | |
| 67 | + return mailAccountCache.get(id); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public Long createMailAccount(MailAccountCreateReqVO createReqVO) { | |
| 72 | + // 插入 | |
| 73 | + MailAccountDO account = MailAccountConvert.INSTANCE.convert(createReqVO); | |
| 74 | + mailAccountMapper.insert(account); | |
| 75 | + | |
| 76 | + // 发送刷新消息 | |
| 77 | + mailProducer.sendMailAccountRefreshMessage(); | |
| 78 | + return account.getId(); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public void updateMailAccount(MailAccountUpdateReqVO updateReqVO) { | |
| 83 | + // 校验是否存在 | |
| 84 | + validateMailAccountExists(updateReqVO.getId()); | |
| 85 | + | |
| 86 | + // 更新 | |
| 87 | + MailAccountDO updateObj = MailAccountConvert.INSTANCE.convert(updateReqVO); | |
| 88 | + mailAccountMapper.updateById(updateObj); | |
| 89 | + // 发送刷新消息 | |
| 90 | + mailProducer.sendMailAccountRefreshMessage(); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @Override | |
| 94 | + public void deleteMailAccount(Long id) { | |
| 95 | + // 校验是否存在账号 | |
| 96 | + validateMailAccountExists(id); | |
| 97 | + // 校验是否存在关联模版 | |
| 98 | + if (mailTemplateService.countByAccountId(id) > 0) { | |
| 99 | + throw exception(MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS); | |
| 100 | + } | |
| 101 | + | |
| 102 | + // 删除 | |
| 103 | + mailAccountMapper.deleteById(id); | |
| 104 | + // 发送刷新消息 | |
| 105 | + mailProducer.sendMailAccountRefreshMessage(); | |
| 106 | + } | |
| 107 | + | |
| 108 | + private void validateMailAccountExists(Long id) { | |
| 109 | + if (mailAccountMapper.selectById(id) == null) { | |
| 110 | + throw exception(MAIL_ACCOUNT_NOT_EXISTS); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + @Override | |
| 115 | + public MailAccountDO getMailAccount(Long id) { | |
| 116 | + return mailAccountMapper.selectById(id); | |
| 117 | + } | |
| 118 | + | |
| 119 | + @Override | |
| 120 | + public PageResult<MailAccountDO> getMailAccountPage(MailAccountPageReqVO pageReqVO) { | |
| 121 | + return mailAccountMapper.selectPage(pageReqVO); | |
| 122 | + } | |
| 123 | + | |
| 124 | + @Override | |
| 125 | + public List<MailAccountDO> getMailAccountList() { | |
| 126 | + return mailAccountMapper.selectList(); | |
| 127 | + } | |
| 128 | + | |
| 129 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 6 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | |
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 8 | + | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 邮件日志 Service 接口 | |
| 13 | + * | |
| 14 | + * @author wangjingyi | |
| 15 | + * @since 2022-03-21 | |
| 16 | + */ | |
| 17 | +public interface MailLogService { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * 邮件日志分页 | |
| 21 | + * | |
| 22 | + * @param pageVO 分页参数 | |
| 23 | + * @return 分页结果 | |
| 24 | + */ | |
| 25 | + PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO); | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 获得指定编号的邮件日志 | |
| 29 | + * | |
| 30 | + * @param id 日志编号 | |
| 31 | + * @return 邮件日志 | |
| 32 | + */ | |
| 33 | + MailLogDO getMailLog(Long id); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 创建邮件日志 | |
| 37 | + * | |
| 38 | + * @param userId 用户编码 | |
| 39 | + * @param userType 用户类型 | |
| 40 | + * @param toMail 收件人邮件 | |
| 41 | + * @param account 邮件账号信息 | |
| 42 | + * @param template 模版信息 | |
| 43 | + * @param templateContent 模版内容 | |
| 44 | + * @param templateParams 模版参数 | |
| 45 | + * @param isSend 是否发送成功 | |
| 46 | + * @return 日志编号 | |
| 47 | + */ | |
| 48 | + Long createMailLog(Long userId,Integer userType, String toMail, | |
| 49 | + MailAccountDO account, MailTemplateDO template , | |
| 50 | + String templateContent, Map<String, Object> templateParams, Boolean isSend); | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 更新邮件发送结果 | |
| 54 | + * | |
| 55 | + * @param logId 日志编号 | |
| 56 | + * @param messageId 发送后的消息编号 | |
| 57 | + * @param exception 发送异常 | |
| 58 | + */ | |
| 59 | + void updateMailSendResult(Long logId, String messageId, Exception exception); | |
| 60 | + | |
| 61 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 6 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | |
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailLogMapper; | |
| 9 | +import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum; | |
| 10 | +import org.springframework.stereotype.Service; | |
| 11 | +import org.springframework.validation.annotation.Validated; | |
| 12 | + | |
| 13 | +import javax.annotation.Resource; | |
| 14 | +import java.util.Date; | |
| 15 | +import java.util.Map; | |
| 16 | +import java.util.Objects; | |
| 17 | + | |
| 18 | +import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 邮件日志 Service 实现类 | |
| 22 | + * | |
| 23 | + * @author wangjingyi | |
| 24 | + * @since 2022-03-21 | |
| 25 | + */ | |
| 26 | +@Service | |
| 27 | +@Validated | |
| 28 | +public class MailLogServiceImpl implements MailLogService { | |
| 29 | + | |
| 30 | + @Resource | |
| 31 | + private MailLogMapper mailLogMapper; | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO) { | |
| 35 | + return mailLogMapper.selectPage(pageVO); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public MailLogDO getMailLog(Long id) { | |
| 40 | + return mailLogMapper.selectById(id); | |
| 41 | + } | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public Long createMailLog(Long userId, Integer userType, String toMail, | |
| 45 | + MailAccountDO account, MailTemplateDO template, | |
| 46 | + String templateContent, Map<String, Object> templateParams, Boolean isSend) { | |
| 47 | + MailLogDO.MailLogDOBuilder logDOBuilder = MailLogDO.builder(); | |
| 48 | + // 根据是否要发送,设置状态 | |
| 49 | + logDOBuilder.sendStatus(Objects.equals(isSend, true) ? MailSendStatusEnum.INIT.getStatus() | |
| 50 | + : MailSendStatusEnum.IGNORE.getStatus()) | |
| 51 | + // 用户信息 | |
| 52 | + .userId(userId).userType(userType).toMail(toMail) | |
| 53 | + .accountId(account.getId()).fromMail(account.getMail()) | |
| 54 | + // 模板相关字段 | |
| 55 | + .templateId(template.getId()).templateCode(template.getCode()).templateNickname(template.getNickname()) | |
| 56 | + .templateTitle(template.getTitle()).templateContent(templateContent).templateParams(templateParams); | |
| 57 | + | |
| 58 | + // 插入数据库 | |
| 59 | + MailLogDO logDO = logDOBuilder.build(); | |
| 60 | + mailLogMapper.insert(logDO); | |
| 61 | + return logDO.getId(); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Override | |
| 65 | + public void updateMailSendResult(Long logId, String messageId, Exception exception) { | |
| 66 | + // 1. 成功 | |
| 67 | + if (exception == null) { | |
| 68 | + mailLogMapper.updateById(new MailLogDO().setId(logId).setSendTime(new Date()) | |
| 69 | + .setSendStatus(MailSendStatusEnum.SUCCESS.getStatus()).setSendMessageId(messageId)); | |
| 70 | + return; | |
| 71 | + } | |
| 72 | + // 2. 失败 | |
| 73 | + mailLogMapper.updateById(new MailLogDO().setId(logId).setSendTime(new Date()) | |
| 74 | + .setSendStatus(MailSendStatusEnum.FAILURE.getStatus()).setSendException(getRootCauseMessage(exception))); | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailSendService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage; | |
| 4 | + | |
| 5 | +import java.util.Map; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 邮件发送 Service 接口 | |
| 9 | + * | |
| 10 | + * @author wangjingyi | |
| 11 | + * @since 2022-03-21 | |
| 12 | + */ | |
| 13 | +public interface MailSendService { | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 发送单条邮件给管理后台的用户 | |
| 17 | + * | |
| 18 | + * @param mail 邮箱 | |
| 19 | + * @param userId 用户编码 | |
| 20 | + * @param templateCode 邮件模版编码 | |
| 21 | + * @param templateParams 邮件模版参数 | |
| 22 | + * @return 发送日志编号 | |
| 23 | + */ | |
| 24 | + Long sendSingleMailToAdmin(String mail, Long userId, | |
| 25 | + String templateCode, Map<String, Object> templateParams); | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 发送单条邮件给用户 APP 的用户 | |
| 29 | + * | |
| 30 | + * @param mail 邮箱 | |
| 31 | + * @param userId 用户编码 | |
| 32 | + * @param templateCode 邮件模版编码 | |
| 33 | + * @param templateParams 邮件模版参数 | |
| 34 | + * @return 发送日志编号 | |
| 35 | + */ | |
| 36 | + Long sendSingleMailToMember(String mail, Long userId, | |
| 37 | + String templateCode, Map<String, Object> templateParams); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 发送单条邮件给用户 | |
| 41 | + * | |
| 42 | + * @param mail 邮箱 | |
| 43 | + * @param userId 用户编码 | |
| 44 | + * @param userType 用户类型 | |
| 45 | + * @param templateCode 邮件模版编码 | |
| 46 | + * @param templateParams 邮件模版参数 | |
| 47 | + * @return 发送日志编号 | |
| 48 | + */ | |
| 49 | + Long sendSingleMail(String mail, Long userId, Integer userType, | |
| 50 | + String templateCode, Map<String, Object> templateParams); | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 执行真正的邮件发送 | |
| 54 | + * 注意,该方法仅仅提供给 MQ Consumer 使用 | |
| 55 | + * | |
| 56 | + * @param message 邮件 | |
| 57 | + */ | |
| 58 | + void doSendMail(MailSendMessage message); | |
| 59 | + | |
| 60 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.hutool.core.util.StrUtil; | |
| 4 | +import cn.hutool.extra.mail.MailAccount; | |
| 5 | +import cn.hutool.extra.mail.MailUtil; | |
| 6 | +import cn.iocoder.yudao.framework.common.core.KeyValue; | |
| 7 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 8 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 9 | +import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 12 | +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; | |
| 13 | +import cn.iocoder.yudao.module.system.mq.message.mail.MailSendMessage; | |
| 14 | +import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer; | |
| 15 | +import cn.iocoder.yudao.module.system.service.member.MemberService; | |
| 16 | +import cn.iocoder.yudao.module.system.service.user.AdminUserService; | |
| 17 | +import com.google.common.annotations.VisibleForTesting; | |
| 18 | +import lombok.extern.slf4j.Slf4j; | |
| 19 | +import org.springframework.stereotype.Service; | |
| 20 | +import org.springframework.validation.annotation.Validated; | |
| 21 | + | |
| 22 | +import javax.annotation.Resource; | |
| 23 | +import java.util.List; | |
| 24 | +import java.util.Map; | |
| 25 | +import java.util.stream.Collectors; | |
| 26 | + | |
| 27 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 28 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * 邮箱模版 服务实现类 | |
| 32 | + * | |
| 33 | + * @author wangjingyi | |
| 34 | + * @since 2022-03-21 | |
| 35 | + */ | |
| 36 | +@Service | |
| 37 | +@Validated | |
| 38 | +@Slf4j | |
| 39 | +public class MailSendServiceImpl implements MailSendService { | |
| 40 | + | |
| 41 | + @Resource | |
| 42 | + private AdminUserService adminUserService; | |
| 43 | + @Resource | |
| 44 | + private MemberService memberService; | |
| 45 | + | |
| 46 | + @Resource | |
| 47 | + private MailAccountService mailAccountService; | |
| 48 | + @Resource | |
| 49 | + private MailTemplateService mailTemplateService; | |
| 50 | + | |
| 51 | + @Resource | |
| 52 | + private MailLogService mailLogService; | |
| 53 | + @Resource | |
| 54 | + private MailProducer mailProducer; | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public Long sendSingleMailToAdmin(String mail, Long userId, | |
| 58 | + String templateCode, Map<String, Object> templateParams) { | |
| 59 | + // 如果 mail 为空,则加载用户编号对应的邮箱 | |
| 60 | + if (StrUtil.isEmpty(mail)) { | |
| 61 | + AdminUserDO user = adminUserService.getUser(userId); | |
| 62 | + if (user != null) { | |
| 63 | + mail = user.getEmail(); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + // 执行发送 | |
| 67 | + return sendSingleMail(mail, userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public Long sendSingleMailToMember(String mail, Long userId, | |
| 72 | + String templateCode, Map<String, Object> templateParams) { | |
| 73 | + // 如果 mail 为空,则加载用户编号对应的邮箱 | |
| 74 | + if (StrUtil.isEmpty(mail)) { | |
| 75 | + mail = memberService.getMemberUserEmail(userId); | |
| 76 | + } | |
| 77 | + // 执行发送 | |
| 78 | + return sendSingleMail(mail, userId, UserTypeEnum.MEMBER.getValue(), templateCode, templateParams); | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public Long sendSingleMail(String mail, Long userId, Integer userType, | |
| 83 | + String templateCode, Map<String, Object> templateParams) { | |
| 84 | + // 校验邮箱模版是否合法 | |
| 85 | + MailTemplateDO template = checkMailTemplateValid(templateCode); | |
| 86 | + // 校验邮箱账号是否合法 | |
| 87 | + MailAccountDO account = checkMailAccountValid(template.getAccountId()); | |
| 88 | + | |
| 89 | + // 校验邮箱是否存在 | |
| 90 | + mail = checkMail(mail); | |
| 91 | + // 构建有序的模板参数。为什么放在这个位置,是提前保证模板参数的正确性,而不是到了插入发送日志 | |
| 92 | + List<KeyValue<String, Object>> newTemplateParams = buildTemplateParams(template, templateParams); | |
| 93 | + | |
| 94 | + // 创建发送日志。如果模板被禁用,则不发送短信,只记录日志 | |
| 95 | + Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus()); | |
| 96 | + String content = mailTemplateService.formatMailTemplateContent(template.getContent(), templateParams); | |
| 97 | + Long sendLogId = mailLogService.createMailLog(userId, userType, mail, | |
| 98 | + account, template, content, templateParams, isSend); | |
| 99 | + // 发送 MQ 消息,异步执行发送短信 | |
| 100 | + if (isSend) { | |
| 101 | + mailProducer.sendMailSendMessage(sendLogId, mail, account.getId(), | |
| 102 | + template.getNickname(), template.getTitle(), content); | |
| 103 | + } | |
| 104 | + return sendLogId; | |
| 105 | + } | |
| 106 | + | |
| 107 | + @Override | |
| 108 | + public void doSendMail(MailSendMessage message) { | |
| 109 | + // 1. 创建发送账号 | |
| 110 | + MailAccountDO account = checkMailAccountValid(message.getAccountId()); | |
| 111 | + MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname()); | |
| 112 | + // 2. 发送邮件 | |
| 113 | + try { | |
| 114 | + String messageId = MailUtil.send(mailAccount, message.getMail(), | |
| 115 | + message.getTitle(), message.getContent(),true); | |
| 116 | + // 3. 更新结果(成功) | |
| 117 | + mailLogService.updateMailSendResult(message.getLogId(), messageId, null); | |
| 118 | + } catch (Exception e) { | |
| 119 | + // 3. 更新结果(异常) | |
| 120 | + mailLogService.updateMailSendResult(message.getLogId(), null, e); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + @VisibleForTesting | |
| 125 | + public MailTemplateDO checkMailTemplateValid(String templateCode) { | |
| 126 | + // 获得邮件模板。考虑到效率,从缓存中获取 | |
| 127 | + MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode); | |
| 128 | + // 邮件模板不存在 | |
| 129 | + if (template == null) { | |
| 130 | + throw exception(MAIL_TEMPLATE_NOT_EXISTS); | |
| 131 | + } | |
| 132 | + return template; | |
| 133 | + } | |
| 134 | + | |
| 135 | + @VisibleForTesting | |
| 136 | + public MailAccountDO checkMailAccountValid(Long accountId) { | |
| 137 | + // 获得邮箱账号。考虑到效率,从缓存中获取 | |
| 138 | + MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId); | |
| 139 | + // 邮箱账号不存在 | |
| 140 | + if (account == null) { | |
| 141 | + throw exception(MAIL_ACCOUNT_NOT_EXISTS); | |
| 142 | + } | |
| 143 | + return account; | |
| 144 | + } | |
| 145 | + | |
| 146 | + @VisibleForTesting | |
| 147 | + public String checkMail(String mail) { | |
| 148 | + if (StrUtil.isEmpty(mail)) { | |
| 149 | + throw exception(MAIL_SEND_MAIL_NOT_EXISTS); | |
| 150 | + } | |
| 151 | + return mail; | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * 将参数模板,处理成有序的 KeyValue 数组 | |
| 156 | + * | |
| 157 | + * @param template 邮箱模板 | |
| 158 | + * @param templateParams 原始参数 | |
| 159 | + * @return 处理后的参数 | |
| 160 | + */ | |
| 161 | + @VisibleForTesting | |
| 162 | + public List<KeyValue<String, Object>> buildTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) { | |
| 163 | + return template.getParams().stream().map(key -> { | |
| 164 | + Object value = templateParams.get(key); | |
| 165 | + if (value == null) { | |
| 166 | + throw exception(MAIL_SEND_TEMPLATE_PARAM_MISS, key); | |
| 167 | + } | |
| 168 | + return new KeyValue<>(key, value); | |
| 169 | + }).collect(Collectors.toList()); | |
| 170 | + } | |
| 171 | + | |
| 172 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTemplateService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 8 | + | |
| 9 | +import javax.validation.Valid; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 邮件模版 Service 接口 | |
| 15 | + * | |
| 16 | + * @author wangjingyi | |
| 17 | + * @since 2022-03-21 | |
| 18 | + */ | |
| 19 | +public interface MailTemplateService { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 初始化邮件模版的本地缓存 | |
| 23 | + */ | |
| 24 | + void initLocalCache(); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 邮件模版创建 | |
| 28 | + * | |
| 29 | + * @param createReqVO 邮件信息 | |
| 30 | + * @return 编号 | |
| 31 | + */ | |
| 32 | + Long createMailTemplate(@Valid MailTemplateCreateReqVO createReqVO); | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 邮件模版修改 | |
| 36 | + * | |
| 37 | + * @param updateReqVO 邮件信息 | |
| 38 | + */ | |
| 39 | + void updateMailTemplate(@Valid MailTemplateUpdateReqVO updateReqVO); | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 邮件模版删除 | |
| 43 | + * | |
| 44 | + * @param id 编号 | |
| 45 | + */ | |
| 46 | + void deleteMailTemplate(Long id); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 获取邮件模版 | |
| 50 | + * | |
| 51 | + * @param id 编号 | |
| 52 | + * @return 邮件模版 | |
| 53 | + */ | |
| 54 | + MailTemplateDO getMailTemplate(Long id); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 获取邮件模版分页 | |
| 58 | + * | |
| 59 | + * @param pageReqVO 模版信息 | |
| 60 | + * @return 邮件模版分页信息 | |
| 61 | + */ | |
| 62 | + PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO); | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 获取邮件模板数组 | |
| 66 | + * | |
| 67 | + * @return 模版数组 | |
| 68 | + */ | |
| 69 | + List<MailTemplateDO> getMailTemplateList(); | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 从缓存中获取邮件模版 | |
| 73 | + * | |
| 74 | + * @param code 模板编码 | |
| 75 | + * @return 邮件模板 | |
| 76 | + */ | |
| 77 | + MailTemplateDO getMailTemplateByCodeFromCache(String code); | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 邮件模版内容合成 | |
| 81 | + * | |
| 82 | + * @param content 邮件模版 | |
| 83 | + * @param params 合成参数 | |
| 84 | + * @return 格式化后的内容 | |
| 85 | + */ | |
| 86 | + String formatMailTemplateContent(String content, Map<String, Object> params); | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 获得指定邮件账号下的邮件模板数量 | |
| 90 | + * | |
| 91 | + * @param accountId 账号编号 | |
| 92 | + * @return 数量 | |
| 93 | + */ | |
| 94 | + long countByAccountId(Long accountId); | |
| 95 | + | |
| 96 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTemplateServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.hutool.core.util.ObjUtil; | |
| 4 | +import cn.hutool.core.util.ReUtil; | |
| 5 | +import cn.hutool.core.util.StrUtil; | |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO; | |
| 10 | +import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 12 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailTemplateMapper; | |
| 13 | +import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer; | |
| 14 | +import com.google.common.annotations.VisibleForTesting; | |
| 15 | +import lombok.Getter; | |
| 16 | +import lombok.extern.slf4j.Slf4j; | |
| 17 | +import org.springframework.stereotype.Service; | |
| 18 | +import org.springframework.validation.annotation.Validated; | |
| 19 | + | |
| 20 | +import javax.annotation.PostConstruct; | |
| 21 | +import javax.annotation.Resource; | |
| 22 | +import javax.validation.Valid; | |
| 23 | +import java.util.List; | |
| 24 | +import java.util.Map; | |
| 25 | +import java.util.regex.Pattern; | |
| 26 | + | |
| 27 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 28 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 29 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * 邮箱模版 Service 实现类 | |
| 33 | + * | |
| 34 | + * @author wangjingyi | |
| 35 | + * @since 2022-03-21 | |
| 36 | + */ | |
| 37 | +@Service | |
| 38 | +@Validated | |
| 39 | +@Slf4j | |
| 40 | +public class MailTemplateServiceImpl implements MailTemplateService { | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 正则表达式,匹配 {} 中的变量 | |
| 44 | + */ | |
| 45 | + private static final Pattern PATTERN_PARAMS = Pattern.compile("\\{(.*?)}"); | |
| 46 | + | |
| 47 | + @Resource | |
| 48 | + private MailTemplateMapper mailTemplateMapper; | |
| 49 | + | |
| 50 | + @Resource | |
| 51 | + private MailProducer mailProducer; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 邮件模板缓存 | |
| 55 | + * key:邮件模版标识 {@link MailTemplateDO#getCode()} | |
| 56 | + * | |
| 57 | + * 这里声明 volatile 修饰的原因是,每次刷新时,直接修改指向 | |
| 58 | + */ | |
| 59 | + @Getter | |
| 60 | + private volatile Map<String, MailTemplateDO> mailTemplateCache; | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + @PostConstruct | |
| 64 | + public void initLocalCache() { | |
| 65 | + // 第一步:查询数据 | |
| 66 | + List<MailTemplateDO> templates = mailTemplateMapper.selectList(); | |
| 67 | + log.info("[initLocalCache][缓存邮件模版,数量:{}]", templates.size()); | |
| 68 | + | |
| 69 | + // 第二步:构建缓存 | |
| 70 | + mailTemplateCache = convertMap(templates, MailTemplateDO::getCode); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + public Long createMailTemplate(MailTemplateCreateReqVO createReqVO) { | |
| 75 | + // 校验 code 是否唯一 | |
| 76 | + validateCodeUnique(null, createReqVO.getCode()); | |
| 77 | + | |
| 78 | + // 插入 | |
| 79 | + MailTemplateDO template = MailTemplateConvert.INSTANCE.convert(createReqVO) | |
| 80 | + .setParams(parseTemplateContentParams(createReqVO.getContent())); | |
| 81 | + mailTemplateMapper.insert(template); | |
| 82 | + // 发送刷新消息 | |
| 83 | + mailProducer.sendMailTemplateRefreshMessage(); | |
| 84 | + return template.getId(); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Override | |
| 88 | + public void updateMailTemplate(@Valid MailTemplateUpdateReqVO updateReqVO) { | |
| 89 | + // 校验是否存在 | |
| 90 | + validateMailTemplateExists(updateReqVO.getId()); | |
| 91 | + // 校验 code 是否唯一 | |
| 92 | + validateCodeUnique(updateReqVO.getId(),updateReqVO.getCode()); | |
| 93 | + | |
| 94 | + // 更新 | |
| 95 | + MailTemplateDO updateObj = MailTemplateConvert.INSTANCE.convert(updateReqVO) | |
| 96 | + .setParams(parseTemplateContentParams(updateReqVO.getContent())); | |
| 97 | + mailTemplateMapper.updateById(updateObj); | |
| 98 | + // 发送刷新消息 | |
| 99 | + mailProducer.sendMailTemplateRefreshMessage(); | |
| 100 | + } | |
| 101 | + | |
| 102 | + @VisibleForTesting | |
| 103 | + public void validateCodeUnique(Long id, String code) { | |
| 104 | + MailTemplateDO template = mailTemplateMapper.selectByCode(code); | |
| 105 | + if (template == null) { | |
| 106 | + return; | |
| 107 | + } | |
| 108 | + // 存在 template 记录的情况下 | |
| 109 | + if (id == null // 新增时,说明重复 | |
| 110 | + || ObjUtil.notEqual(id, template.getId())) { // 更新时,如果 id 不一致,说明重复 | |
| 111 | + throw exception(MAIL_TEMPLATE_CODE_EXISTS); | |
| 112 | + } | |
| 113 | + } | |
| 114 | + | |
| 115 | + @Override | |
| 116 | + public void deleteMailTemplate(Long id) { | |
| 117 | + // 校验是否存在 | |
| 118 | + validateMailTemplateExists(id); | |
| 119 | + | |
| 120 | + // 删除 | |
| 121 | + mailTemplateMapper.deleteById(id); | |
| 122 | + // 发送刷新消息 | |
| 123 | + mailProducer.sendMailTemplateRefreshMessage(); | |
| 124 | + } | |
| 125 | + | |
| 126 | + private void validateMailTemplateExists(Long id) { | |
| 127 | + if (mailTemplateMapper.selectById(id) == null) { | |
| 128 | + throw exception(MAIL_TEMPLATE_NOT_EXISTS); | |
| 129 | + } | |
| 130 | + } | |
| 131 | + | |
| 132 | + @Override | |
| 133 | + public MailTemplateDO getMailTemplate(Long id) {return mailTemplateMapper.selectById(id);} | |
| 134 | + | |
| 135 | + @Override | |
| 136 | + public PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO) { | |
| 137 | + return mailTemplateMapper.selectPage(pageReqVO); | |
| 138 | + } | |
| 139 | + | |
| 140 | + @Override | |
| 141 | + public List<MailTemplateDO> getMailTemplateList() {return mailTemplateMapper.selectList();} | |
| 142 | + | |
| 143 | + @Override | |
| 144 | + public MailTemplateDO getMailTemplateByCodeFromCache(String code) { | |
| 145 | + return mailTemplateCache.get(code); | |
| 146 | + } | |
| 147 | + | |
| 148 | + @Override | |
| 149 | + public String formatMailTemplateContent(String content, Map<String, Object> params) { | |
| 150 | + return StrUtil.format(content, params); | |
| 151 | + } | |
| 152 | + | |
| 153 | + @VisibleForTesting | |
| 154 | + public List<String> parseTemplateContentParams(String content) { | |
| 155 | + return ReUtil.findAllGroup1(PATTERN_PARAMS, content); | |
| 156 | + } | |
| 157 | + | |
| 158 | + @Override | |
| 159 | + public long countByAccountId(Long accountId) { | |
| 160 | + return mailTemplateMapper.selectCountByAccountId(accountId); | |
| 161 | + } | |
| 162 | + | |
| 163 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/member/MemberService.java
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/member/MemberServiceImpl.java
| ... | ... | @@ -21,14 +21,27 @@ public class MemberServiceImpl implements MemberService { |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | 23 | public String getMemberUserMobile(Long id) { |
| 24 | - if (id == null) { | |
| 24 | + Object user = getMemberUser(id); | |
| 25 | + if (user == null) { | |
| 25 | 26 | return null; |
| 26 | 27 | } |
| 27 | - Object user = ReflectUtil.invoke(getMemberUserApi(), "getUser", id); | |
| 28 | + return ReflectUtil.invoke(user, "getMobile"); | |
| 29 | + } | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public String getMemberUserEmail(Long id) { | |
| 33 | + Object user = getMemberUser(id); | |
| 28 | 34 | if (user == null) { |
| 29 | 35 | return null; |
| 30 | 36 | } |
| 31 | - return ReflectUtil.invoke(user, "getMobile"); | |
| 37 | + return ReflectUtil.invoke(user, "getEmail"); | |
| 38 | + } | |
| 39 | + | |
| 40 | + private Object getMemberUser(Long id) { | |
| 41 | + if (id == null) { | |
| 42 | + return null; | |
| 43 | + } | |
| 44 | + return ReflectUtil.invoke(getMemberUserApi(), "getUser", id); | |
| 32 | 45 | } |
| 33 | 46 | |
| 34 | 47 | private Object getMemberUserApi() { | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceImpl.java
| ... | ... | @@ -81,7 +81,7 @@ public class SmsChannelServiceImpl implements SmsChannelService { |
| 81 | 81 | public void deleteSmsChannel(Long id) { |
| 82 | 82 | // 校验存在 |
| 83 | 83 | this.validateSmsChannelExists(id); |
| 84 | - // 校验是否有字典数据 | |
| 84 | + // 校验是否有在使用该账号的模版 | |
| 85 | 85 | if (smsTemplateService.countByChannelId(id) > 0) { |
| 86 | 86 | throw exception(SMS_CHANNEL_HAS_CHILDREN); |
| 87 | 87 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImplTest.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper; | |
| 11 | +import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer; | |
| 12 | +import org.junit.jupiter.api.Test; | |
| 13 | +import org.springframework.boot.test.mock.mockito.MockBean; | |
| 14 | +import org.springframework.context.annotation.Import; | |
| 15 | + | |
| 16 | +import javax.annotation.Resource; | |
| 17 | + | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 21 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | |
| 24 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS; | |
| 25 | +import static org.junit.jupiter.api.Assertions.*; | |
| 26 | +import static org.mockito.Mockito.verify; | |
| 27 | + | |
| 28 | +/** | |
| 29 | +* {@link MailAccountServiceImpl} 的单元测试类 | |
| 30 | +* | |
| 31 | +* @author 芋道源码 | |
| 32 | +*/ | |
| 33 | +@Import(MailAccountServiceImpl.class) | |
| 34 | +public class MailAccountServiceImplTest extends BaseDbUnitTest { | |
| 35 | + | |
| 36 | + @Resource | |
| 37 | + private MailAccountServiceImpl mailAccountService; | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private MailAccountMapper mailAccountMapper; | |
| 41 | + | |
| 42 | + @MockBean | |
| 43 | + private MailTemplateService mailTemplateService; | |
| 44 | + @MockBean | |
| 45 | + private MailProducer mailProducer; | |
| 46 | + | |
| 47 | + @Test | |
| 48 | + public void testInitLocalCache() { | |
| 49 | + MailAccountDO accountDO1 = randomPojo(MailAccountDO.class); | |
| 50 | + mailAccountMapper.insert(accountDO1); | |
| 51 | + MailAccountDO accountDO02 = randomPojo(MailAccountDO.class); | |
| 52 | + mailAccountMapper.insert(accountDO02); | |
| 53 | + | |
| 54 | + // 调用 | |
| 55 | + mailAccountService.initLocalCache(); | |
| 56 | + // 断言 mailAccountCache 缓存 | |
| 57 | + Map<Long, MailAccountDO> mailAccountCache = mailAccountService.getMailAccountCache(); | |
| 58 | + assertPojoEquals(accountDO1, mailAccountCache.get(accountDO1.getId())); | |
| 59 | + assertPojoEquals(accountDO02, mailAccountCache.get(accountDO02.getId())); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Test | |
| 63 | + public void testCreateMailAccount_success() { | |
| 64 | + // 准备参数 | |
| 65 | + MailAccountCreateReqVO reqVO = randomPojo(MailAccountCreateReqVO.class, o -> o.setMail(randomEmail())); | |
| 66 | + | |
| 67 | + // 调用 | |
| 68 | + Long mailAccountId = mailAccountService.createMailAccount(reqVO); | |
| 69 | + // 断言 | |
| 70 | + assertNotNull(mailAccountId); | |
| 71 | + // 校验记录的属性是否正确 | |
| 72 | + MailAccountDO mailAccount = mailAccountMapper.selectById(mailAccountId); | |
| 73 | + assertPojoEquals(reqVO, mailAccount); | |
| 74 | + verify(mailProducer).sendMailAccountRefreshMessage(); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Test | |
| 78 | + public void testUpdateMailAccount_success() { | |
| 79 | + // mock 数据 | |
| 80 | + MailAccountDO dbMailAccount = randomPojo(MailAccountDO.class); | |
| 81 | + mailAccountMapper.insert(dbMailAccount);// @Sql: 先插入出一条存在的数据 | |
| 82 | + // 准备参数 | |
| 83 | + MailAccountUpdateReqVO reqVO = randomPojo(MailAccountUpdateReqVO.class, o -> { | |
| 84 | + o.setId(dbMailAccount.getId()); // 设置更新的 ID | |
| 85 | + o.setMail(randomEmail()); | |
| 86 | + }); | |
| 87 | + | |
| 88 | + // 调用 | |
| 89 | + mailAccountService.updateMailAccount(reqVO); | |
| 90 | + // 校验是否更新正确 | |
| 91 | + MailAccountDO mailAccount = mailAccountMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 92 | + assertPojoEquals(reqVO, mailAccount); | |
| 93 | + verify(mailProducer).sendMailAccountRefreshMessage(); | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Test | |
| 97 | + public void testUpdateMailAccount_notExists() { | |
| 98 | + // 准备参数 | |
| 99 | + MailAccountUpdateReqVO reqVO = randomPojo(MailAccountUpdateReqVO.class); | |
| 100 | + | |
| 101 | + // 调用, 并断言异常 | |
| 102 | + assertServiceException(() -> mailAccountService.updateMailAccount(reqVO), MAIL_ACCOUNT_NOT_EXISTS); | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Test | |
| 106 | + public void testDeleteMailAccount_success() { | |
| 107 | + // mock 数据 | |
| 108 | + MailAccountDO dbMailAccount = randomPojo(MailAccountDO.class); | |
| 109 | + mailAccountMapper.insert(dbMailAccount);// @Sql: 先插入出一条存在的数据 | |
| 110 | + // 准备参数 | |
| 111 | + Long id = dbMailAccount.getId(); | |
| 112 | + | |
| 113 | + // 调用 | |
| 114 | + mailAccountService.deleteMailAccount(id); | |
| 115 | + // 校验数据不存在了 | |
| 116 | + assertNull(mailAccountMapper.selectById(id)); | |
| 117 | + verify(mailProducer).sendMailAccountRefreshMessage(); | |
| 118 | + } | |
| 119 | + | |
| 120 | + @Test | |
| 121 | + public void testDeleteMailAccount_notExists() { | |
| 122 | + // 准备参数 | |
| 123 | + Long id = randomLongId(); | |
| 124 | + | |
| 125 | + // 调用, 并断言异常 | |
| 126 | + assertServiceException(() -> mailAccountService.deleteMailAccount(id), MAIL_ACCOUNT_NOT_EXISTS); | |
| 127 | + } | |
| 128 | + | |
| 129 | + @Test | |
| 130 | + public void testGetMailAccountPage() { | |
| 131 | + // mock 数据 | |
| 132 | + MailAccountDO dbMailAccount = randomPojo(MailAccountDO.class, o -> { // 等会查询到 | |
| 133 | + o.setMail("768@qq.com"); | |
| 134 | + o.setUsername("yunai"); | |
| 135 | + }); | |
| 136 | + mailAccountMapper.insert(dbMailAccount); | |
| 137 | + // 测试 mail 不匹配 | |
| 138 | + mailAccountMapper.insert(cloneIgnoreId(dbMailAccount, o -> o.setMail("788@qq.com"))); | |
| 139 | + // 测试 username 不匹配 | |
| 140 | + mailAccountMapper.insert(cloneIgnoreId(dbMailAccount, o -> o.setUsername("tudou"))); | |
| 141 | + // 准备参数 | |
| 142 | + MailAccountPageReqVO reqVO = new MailAccountPageReqVO(); | |
| 143 | + reqVO.setMail("768"); | |
| 144 | + reqVO.setUsername("yu"); | |
| 145 | + | |
| 146 | + // 调用 | |
| 147 | + PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(reqVO); | |
| 148 | + // 断言 | |
| 149 | + assertEquals(1, pageResult.getTotal()); | |
| 150 | + assertEquals(1, pageResult.getList().size()); | |
| 151 | + assertPojoEquals(dbMailAccount, pageResult.getList().get(0)); | |
| 152 | + } | |
| 153 | + | |
| 154 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImplTest.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.hutool.core.map.MapUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailLogMapper; | |
| 12 | +import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum; | |
| 13 | +import org.junit.jupiter.api.Test; | |
| 14 | +import org.springframework.context.annotation.Import; | |
| 15 | + | |
| 16 | +import javax.annotation.Resource; | |
| 17 | +import java.util.Map; | |
| 18 | + | |
| 19 | +import static cn.hutool.core.util.RandomUtil.randomEle; | |
| 20 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; | |
| 21 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | |
| 22 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 24 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | |
| 25 | +import static org.junit.jupiter.api.Assertions.*; | |
| 26 | + | |
| 27 | +/** | |
| 28 | +* {@link MailLogServiceImpl} 的单元测试类 | |
| 29 | +* | |
| 30 | +* @author 芋道源码 | |
| 31 | +*/ | |
| 32 | +@Import(MailLogServiceImpl.class) | |
| 33 | +public class MailLogServiceImplTest extends BaseDbUnitTest { | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private MailLogServiceImpl mailLogService; | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MailLogMapper mailLogMapper; | |
| 40 | + | |
| 41 | + @Test | |
| 42 | + public void testCreateMailLog() { | |
| 43 | + // 准备参数 | |
| 44 | + Long userId = randomLongId(); | |
| 45 | + Integer userType = randomEle(UserTypeEnum.values()).getValue(); | |
| 46 | + String toMail = randomEmail(); | |
| 47 | + MailAccountDO account = randomPojo(MailAccountDO.class); | |
| 48 | + MailTemplateDO template = randomPojo(MailTemplateDO.class); | |
| 49 | + String templateContent = randomString(); | |
| 50 | + Map<String, Object> templateParams = randomTemplateParams(); | |
| 51 | + Boolean isSend = true; | |
| 52 | + // mock 方法 | |
| 53 | + | |
| 54 | + // 调用 | |
| 55 | + Long logId = mailLogService.createMailLog(userId, userType, toMail, account, template, templateContent, templateParams, isSend); | |
| 56 | + // 断言 | |
| 57 | + MailLogDO log = mailLogMapper.selectById(logId); | |
| 58 | + assertNotNull(log); | |
| 59 | + assertEquals(MailSendStatusEnum.INIT.getStatus(), log.getSendStatus()); | |
| 60 | + assertEquals(userId, log.getUserId()); | |
| 61 | + assertEquals(userType, log.getUserType()); | |
| 62 | + assertEquals(toMail, log.getToMail()); | |
| 63 | + assertEquals(account.getId(), log.getAccountId()); | |
| 64 | + assertEquals(account.getMail(), log.getFromMail()); | |
| 65 | + assertEquals(template.getId(), log.getTemplateId()); | |
| 66 | + assertEquals(template.getCode(), log.getTemplateCode()); | |
| 67 | + assertEquals(template.getNickname(), log.getTemplateNickname()); | |
| 68 | + assertEquals(template.getTitle(), log.getTemplateTitle()); | |
| 69 | + assertEquals(templateContent, log.getTemplateContent()); | |
| 70 | + assertEquals(templateParams, log.getTemplateParams()); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Test | |
| 74 | + public void testUpdateMailSendResult_success() { | |
| 75 | + // mock 数据 | |
| 76 | + MailLogDO log = randomPojo(MailLogDO.class, o -> { | |
| 77 | + o.setSendStatus(MailSendStatusEnum.INIT.getStatus()); | |
| 78 | + o.setSendTime(null).setSendMessageId(null).setSendException(null) | |
| 79 | + .setTemplateParams(randomTemplateParams()); | |
| 80 | + }); | |
| 81 | + mailLogMapper.insert(log); | |
| 82 | + // 准备参数 | |
| 83 | + Long logId = log.getId(); | |
| 84 | + String messageId = randomString(); | |
| 85 | + | |
| 86 | + // 调用 | |
| 87 | + mailLogService.updateMailSendResult(logId, messageId, null); | |
| 88 | + // 断言 | |
| 89 | + MailLogDO dbLog = mailLogMapper.selectById(logId); | |
| 90 | + assertEquals(MailSendStatusEnum.SUCCESS.getStatus(), dbLog.getSendStatus()); | |
| 91 | + assertNotNull(dbLog.getSendTime()); | |
| 92 | + assertEquals(messageId, dbLog.getSendMessageId()); | |
| 93 | + assertNull(dbLog.getSendException()); | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Test | |
| 97 | + public void testUpdateMailSendResult_exception() { | |
| 98 | + // mock 数据 | |
| 99 | + MailLogDO log = randomPojo(MailLogDO.class, o -> { | |
| 100 | + o.setSendStatus(MailSendStatusEnum.INIT.getStatus()); | |
| 101 | + o.setSendTime(null).setSendMessageId(null).setSendException(null) | |
| 102 | + .setTemplateParams(randomTemplateParams()); | |
| 103 | + }); | |
| 104 | + mailLogMapper.insert(log); | |
| 105 | + // 准备参数 | |
| 106 | + Long logId = log.getId(); | |
| 107 | + Exception exception = new NullPointerException("测试异常"); | |
| 108 | + | |
| 109 | + // 调用 | |
| 110 | + mailLogService.updateMailSendResult(logId, null, exception); | |
| 111 | + // 断言 | |
| 112 | + MailLogDO dbLog = mailLogMapper.selectById(logId); | |
| 113 | + assertEquals(MailSendStatusEnum.FAILURE.getStatus(), dbLog.getSendStatus()); | |
| 114 | + assertNotNull(dbLog.getSendTime()); | |
| 115 | + assertNull(dbLog.getSendMessageId()); | |
| 116 | + assertEquals("NullPointerException: 测试异常", dbLog.getSendException()); | |
| 117 | + } | |
| 118 | + | |
| 119 | + @Test | |
| 120 | + public void testGetMailLogPage() { | |
| 121 | + // mock 数据 | |
| 122 | + MailLogDO dbMailLog = randomPojo(MailLogDO.class, o -> { // 等会查询到 | |
| 123 | + o.setUserId(1L); | |
| 124 | + o.setUserType(UserTypeEnum.ADMIN.getValue()); | |
| 125 | + o.setToMail("768@qq.com"); | |
| 126 | + o.setAccountId(10L); | |
| 127 | + o.setTemplateId(100L); | |
| 128 | + o.setSendStatus(MailSendStatusEnum.INIT.getStatus()); | |
| 129 | + o.setSendTime(buildTime(2023, 2, 10)); | |
| 130 | + o.setTemplateParams(randomTemplateParams()); | |
| 131 | + }); | |
| 132 | + mailLogMapper.insert(dbMailLog); | |
| 133 | + // 测试 userId 不匹配 | |
| 134 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setUserId(2L))); | |
| 135 | + // 测试 userType 不匹配 | |
| 136 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setUserType(UserTypeEnum.MEMBER.getValue()))); | |
| 137 | + // 测试 toMail 不匹配 | |
| 138 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setToMail("788@.qq.com"))); | |
| 139 | + // 测试 accountId 不匹配 | |
| 140 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setAccountId(11L))); | |
| 141 | + // 测试 templateId 不匹配 | |
| 142 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setTemplateId(101L))); | |
| 143 | + // 测试 sendStatus 不匹配 | |
| 144 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setSendStatus(MailSendStatusEnum.SUCCESS.getStatus()))); | |
| 145 | + // 测试 sendTime 不匹配 | |
| 146 | + mailLogMapper.insert(cloneIgnoreId(dbMailLog, o -> o.setSendTime(buildTime(2023, 3, 10)))); | |
| 147 | + // 准备参数 | |
| 148 | + MailLogPageReqVO reqVO = new MailLogPageReqVO(); | |
| 149 | + reqVO.setUserId(1L); | |
| 150 | + reqVO.setUserType(UserTypeEnum.ADMIN.getValue()); | |
| 151 | + reqVO.setToMail("768"); | |
| 152 | + reqVO.setAccountId(10L); | |
| 153 | + reqVO.setTemplateId(100L); | |
| 154 | + reqVO.setSendStatus(MailSendStatusEnum.INIT.getStatus()); | |
| 155 | + reqVO.setSendTime((buildBetweenTime(2023, 2, 1, 2023, 2, 15))); | |
| 156 | + | |
| 157 | + // 调用 | |
| 158 | + PageResult<MailLogDO> pageResult = mailLogService.getMailLogPage(reqVO); | |
| 159 | + // 断言 | |
| 160 | + assertEquals(1, pageResult.getTotal()); | |
| 161 | + assertEquals(1, pageResult.getList().size()); | |
| 162 | + assertPojoEquals(dbMailLog, pageResult.getList().get(0)); | |
| 163 | + } | |
| 164 | + | |
| 165 | + private static Map<String, Object> randomTemplateParams() { | |
| 166 | + return MapUtil.<String, Object>builder().put(randomString(), randomString()) | |
| 167 | + .put(randomString(), randomString()).build(); | |
| 168 | + } | |
| 169 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImplTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.hutool.core.map.MapUtil; | |
| 4 | +import cn.hutool.extra.mail.MailAccount; | |
| 5 | +import cn.hutool.extra.mail.MailUtil; | |
| 6 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 7 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 8 | +import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 11 | +import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer; | |
| 12 | +import org.assertj.core.util.Lists; | |
| 13 | +import org.junit.jupiter.api.Disabled; | |
| 14 | +import org.junit.jupiter.api.Test; | |
| 15 | +import org.mockito.InjectMocks; | |
| 16 | +import org.mockito.Mock; | |
| 17 | + | |
| 18 | +import java.util.HashMap; | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 21 | +import static cn.hutool.core.util.RandomUtil.randomEle; | |
| 22 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 23 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; | |
| 24 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | |
| 25 | +import static org.junit.jupiter.api.Assertions.assertEquals; | |
| 26 | +import static org.mockito.ArgumentMatchers.eq; | |
| 27 | +import static org.mockito.Mockito.*; | |
| 28 | + | |
| 29 | +class MailSendServiceImplTest extends BaseMockitoUnitTest { | |
| 30 | + | |
| 31 | + @InjectMocks | |
| 32 | + private MailSendServiceImpl mailSendService; | |
| 33 | + | |
| 34 | + @Mock | |
| 35 | + private MailAccountService mailAccountService; | |
| 36 | + @Mock | |
| 37 | + private MailTemplateService mailTemplateService; | |
| 38 | + @Mock | |
| 39 | + private MailLogService mailLogService; | |
| 40 | + @Mock | |
| 41 | + private MailProducer mailProducer; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 用于快速测试你的邮箱账号是否正常 | |
| 45 | + */ | |
| 46 | + @Test | |
| 47 | + @Disabled | |
| 48 | + public void testDemo() { | |
| 49 | + MailAccount mailAccount = new MailAccount() | |
| 50 | +// .setFrom("奥特曼 <ydym_test@163.com>") | |
| 51 | + .setFrom("ydym_test@163.com") // 邮箱地址 | |
| 52 | + .setHost("smtp.163.com").setPort(465).setSslEnable(true) // SMTP 服务器 | |
| 53 | + .setAuth(true).setUser("ydym_test@163.com").setPass("WBZTEINMIFVRYSOE"); // 登录账号密码 | |
| 54 | + String messageId = MailUtil.send(mailAccount, "7685413@qq.com", "主题", "内容", false); | |
| 55 | + System.out.println("发送结果:" + messageId); | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 发送成功,当短信模板开启时 | |
| 60 | + */ | |
| 61 | + @Test | |
| 62 | + public void testSendSingleMail_successWhenMailTemplateEnable() { | |
| 63 | + // 准备参数 | |
| 64 | + String mail = randomEmail(); | |
| 65 | + Long userId = randomLongId(); | |
| 66 | + Integer userType = randomEle(UserTypeEnum.values()).getValue(); | |
| 67 | + String templateCode = randomString(); | |
| 68 | + Map<String, Object> templateParams = MapUtil.<String, Object>builder().put("code", "1234") | |
| 69 | + .put("op", "login").build(); | |
| 70 | + // mock MailTemplateService 的方法 | |
| 71 | + MailTemplateDO template = randomPojo(MailTemplateDO.class, o -> { | |
| 72 | + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 73 | + o.setContent("验证码为{code}, 操作为{op}"); | |
| 74 | + o.setParams(Lists.newArrayList("code", "op")); | |
| 75 | + }); | |
| 76 | + when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); | |
| 77 | + String content = randomString(); | |
| 78 | + when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams))) | |
| 79 | + .thenReturn(content); | |
| 80 | + // mock MailAccountService 的方法 | |
| 81 | + MailAccountDO account = randomPojo(MailAccountDO.class); | |
| 82 | + when(mailAccountService.getMailAccountFromCache(eq(template.getAccountId()))).thenReturn(account); | |
| 83 | + // mock MailLogService 的方法 | |
| 84 | + Long mailLogId = randomLongId(); | |
| 85 | + when(mailLogService.createMailLog(eq(userId), eq(userType), eq(mail), | |
| 86 | + eq(account), eq(template), eq(content), eq(templateParams), eq(true))).thenReturn(mailLogId); | |
| 87 | + | |
| 88 | + // 调用 | |
| 89 | + Long resultMailLogId = mailSendService.sendSingleMail(mail, userId, userType, templateCode, templateParams); | |
| 90 | + // 断言 | |
| 91 | + assertEquals(mailLogId, resultMailLogId); | |
| 92 | + // 断言调用 | |
| 93 | + verify(mailProducer).sendMailSendMessage(eq(mailLogId), eq(mail), | |
| 94 | + eq(account.getId()), eq(template.getNickname()), eq(template.getTitle()), eq(content)); | |
| 95 | + } | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * 发送成功,当短信模板关闭时 | |
| 99 | + */ | |
| 100 | + @Test | |
| 101 | + public void testSendSingleMail_successWhenSmsTemplateDisable() { | |
| 102 | + // 准备参数 | |
| 103 | + String mail = randomEmail(); | |
| 104 | + Long userId = randomLongId(); | |
| 105 | + Integer userType = randomEle(UserTypeEnum.values()).getValue(); | |
| 106 | + String templateCode = randomString(); | |
| 107 | + Map<String, Object> templateParams = MapUtil.<String, Object>builder().put("code", "1234") | |
| 108 | + .put("op", "login").build(); | |
| 109 | + // mock MailTemplateService 的方法 | |
| 110 | + MailTemplateDO template = randomPojo(MailTemplateDO.class, o -> { | |
| 111 | + o.setStatus(CommonStatusEnum.DISABLE.getStatus()); | |
| 112 | + o.setContent("验证码为{code}, 操作为{op}"); | |
| 113 | + o.setParams(Lists.newArrayList("code", "op")); | |
| 114 | + }); | |
| 115 | + when(mailTemplateService.getMailTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); | |
| 116 | + String content = randomString(); | |
| 117 | + when(mailTemplateService.formatMailTemplateContent(eq(template.getContent()), eq(templateParams))) | |
| 118 | + .thenReturn(content); | |
| 119 | + // mock MailAccountService 的方法 | |
| 120 | + MailAccountDO account = randomPojo(MailAccountDO.class); | |
| 121 | + when(mailAccountService.getMailAccountFromCache(eq(template.getAccountId()))).thenReturn(account); | |
| 122 | + // mock MailLogService 的方法 | |
| 123 | + Long mailLogId = randomLongId(); | |
| 124 | + when(mailLogService.createMailLog(eq(userId), eq(userType), eq(mail), | |
| 125 | + eq(account), eq(template), eq(content), eq(templateParams), eq(false))).thenReturn(mailLogId); | |
| 126 | + | |
| 127 | + // 调用 | |
| 128 | + Long resultMailLogId = mailSendService.sendSingleMail(mail, userId, userType, templateCode, templateParams); | |
| 129 | + // 断言 | |
| 130 | + assertEquals(mailLogId, resultMailLogId); | |
| 131 | + // 断言调用 | |
| 132 | + verify(mailProducer, times(0)).sendMailSendMessage(anyLong(), anyString(), | |
| 133 | + anyLong(), anyString(), anyString(), anyString()); | |
| 134 | + } | |
| 135 | + | |
| 136 | + @Test | |
| 137 | + public void testCheckMailTemplateValid_notExists() { | |
| 138 | + // 准备参数 | |
| 139 | + String templateCode = randomString(); | |
| 140 | + // mock 方法 | |
| 141 | + | |
| 142 | + // 调用,并断言异常 | |
| 143 | + assertServiceException(() -> mailSendService.checkMailTemplateValid(templateCode), | |
| 144 | + MAIL_TEMPLATE_NOT_EXISTS); | |
| 145 | + } | |
| 146 | + | |
| 147 | + @Test | |
| 148 | + public void testBuildTemplateParams_paramMiss() { | |
| 149 | + // 准备参数 | |
| 150 | + MailTemplateDO template = randomPojo(MailTemplateDO.class, | |
| 151 | + o -> o.setParams(Lists.newArrayList("code"))); | |
| 152 | + Map<String, Object> templateParams = new HashMap<>(); | |
| 153 | + // mock 方法 | |
| 154 | + | |
| 155 | + // 调用,并断言异常 | |
| 156 | + assertServiceException(() -> mailSendService.buildTemplateParams(template, templateParams), | |
| 157 | + MAIL_SEND_TEMPLATE_PARAM_MISS, "code"); | |
| 158 | + } | |
| 159 | + | |
| 160 | + @Test | |
| 161 | + public void testCheckMail_notExists() { | |
| 162 | + // 准备参数 | |
| 163 | + // mock 方法 | |
| 164 | + | |
| 165 | + // 调用,并断言异常 | |
| 166 | + assertServiceException(() -> mailSendService.checkMail(null), | |
| 167 | + MAIL_SEND_MAIL_NOT_EXISTS); | |
| 168 | + } | |
| 169 | + | |
| 170 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/mail/MailTemplateServiceImplTest.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.system.service.mail; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | |
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | |
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | |
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | |
| 11 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailTemplateMapper; | |
| 12 | +import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer; | |
| 13 | +import org.junit.jupiter.api.Test; | |
| 14 | +import org.springframework.boot.test.mock.mockito.MockBean; | |
| 15 | +import org.springframework.context.annotation.Import; | |
| 16 | + | |
| 17 | +import javax.annotation.Resource; | |
| 18 | + | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 21 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | |
| 22 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; | |
| 23 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 24 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | |
| 25 | +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; | |
| 26 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; | |
| 27 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | |
| 28 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS; | |
| 29 | +import static org.junit.jupiter.api.Assertions.*; | |
| 30 | + | |
| 31 | +/** | |
| 32 | +* {@link MailTemplateServiceImpl} 的单元测试类 | |
| 33 | +* | |
| 34 | +* @author 芋道源码 | |
| 35 | +*/ | |
| 36 | +@Import(MailTemplateServiceImpl.class) | |
| 37 | +public class MailTemplateServiceImplTest extends BaseDbUnitTest { | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private MailTemplateServiceImpl mailTemplateService; | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private MailTemplateMapper mailTemplateMapper; | |
| 44 | + | |
| 45 | + @MockBean | |
| 46 | + private MailProducer mailProducer; | |
| 47 | + | |
| 48 | + @Test | |
| 49 | + public void testInitLocalCache() { | |
| 50 | + MailTemplateDO templateDO01 = randomPojo(MailTemplateDO.class); | |
| 51 | + mailTemplateMapper.insert(templateDO01); | |
| 52 | + MailTemplateDO templateDO02 = randomPojo(MailTemplateDO.class); | |
| 53 | + mailTemplateMapper.insert(templateDO02); | |
| 54 | + | |
| 55 | + // 调用 | |
| 56 | + mailTemplateService.initLocalCache(); | |
| 57 | + // 断言 mailTemplateCache 缓存 | |
| 58 | + Map<String, MailTemplateDO> mailTemplateCache = mailTemplateService.getMailTemplateCache(); | |
| 59 | + assertPojoEquals(templateDO01, mailTemplateCache.get(templateDO01.getCode())); | |
| 60 | + assertPojoEquals(templateDO02, mailTemplateCache.get(templateDO02.getCode())); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Test | |
| 64 | + public void testCreateMailTemplate_success() { | |
| 65 | + // 准备参数 | |
| 66 | + MailTemplateCreateReqVO reqVO = randomPojo(MailTemplateCreateReqVO.class); | |
| 67 | + | |
| 68 | + // 调用 | |
| 69 | + Long mailTemplateId = mailTemplateService.createMailTemplate(reqVO); | |
| 70 | + // 断言 | |
| 71 | + assertNotNull(mailTemplateId); | |
| 72 | + // 校验记录的属性是否正确 | |
| 73 | + MailTemplateDO mailTemplate = mailTemplateMapper.selectById(mailTemplateId); | |
| 74 | + assertPojoEquals(reqVO, mailTemplate); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Test | |
| 78 | + public void testUpdateMailTemplate_success() { | |
| 79 | + // mock 数据 | |
| 80 | + MailTemplateDO dbMailTemplate = randomPojo(MailTemplateDO.class); | |
| 81 | + mailTemplateMapper.insert(dbMailTemplate);// @Sql: 先插入出一条存在的数据 | |
| 82 | + // 准备参数 | |
| 83 | + MailTemplateUpdateReqVO reqVO = randomPojo(MailTemplateUpdateReqVO.class, o -> { | |
| 84 | + o.setId(dbMailTemplate.getId()); // 设置更新的 ID | |
| 85 | + }); | |
| 86 | + | |
| 87 | + // 调用 | |
| 88 | + mailTemplateService.updateMailTemplate(reqVO); | |
| 89 | + // 校验是否更新正确 | |
| 90 | + MailTemplateDO mailTemplate = mailTemplateMapper.selectById(reqVO.getId()); // 获取最新的 | |
| 91 | + assertPojoEquals(reqVO, mailTemplate); | |
| 92 | + } | |
| 93 | + | |
| 94 | + @Test | |
| 95 | + public void testUpdateMailTemplate_notExists() { | |
| 96 | + // 准备参数 | |
| 97 | + MailTemplateUpdateReqVO reqVO = randomPojo(MailTemplateUpdateReqVO.class); | |
| 98 | + | |
| 99 | + // 调用, 并断言异常 | |
| 100 | + assertServiceException(() -> mailTemplateService.updateMailTemplate(reqVO), MAIL_TEMPLATE_NOT_EXISTS); | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Test | |
| 104 | + public void testDeleteMailTemplate_success() { | |
| 105 | + // mock 数据 | |
| 106 | + MailTemplateDO dbMailTemplate = randomPojo(MailTemplateDO.class); | |
| 107 | + mailTemplateMapper.insert(dbMailTemplate);// @Sql: 先插入出一条存在的数据 | |
| 108 | + // 准备参数 | |
| 109 | + Long id = dbMailTemplate.getId(); | |
| 110 | + | |
| 111 | + // 调用 | |
| 112 | + mailTemplateService.deleteMailTemplate(id); | |
| 113 | + // 校验数据不存在了 | |
| 114 | + assertNull(mailTemplateMapper.selectById(id)); | |
| 115 | + } | |
| 116 | + | |
| 117 | + @Test | |
| 118 | + public void testDeleteMailTemplate_notExists() { | |
| 119 | + // 准备参数 | |
| 120 | + Long id = randomLongId(); | |
| 121 | + | |
| 122 | + // 调用, 并断言异常 | |
| 123 | + assertServiceException(() -> mailTemplateService.deleteMailTemplate(id), MAIL_TEMPLATE_NOT_EXISTS); | |
| 124 | + } | |
| 125 | + | |
| 126 | + @Test | |
| 127 | + public void testGetMailTemplatePage() { | |
| 128 | + // mock 数据 | |
| 129 | + MailTemplateDO dbMailTemplate = randomPojo(MailTemplateDO.class, o -> { // 等会查询到 | |
| 130 | + o.setName("源码"); | |
| 131 | + o.setCode("test_01"); | |
| 132 | + o.setAccountId(1L); | |
| 133 | + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 134 | + o.setCreateTime(buildTime(2023, 2, 3)); | |
| 135 | + }); | |
| 136 | + mailTemplateMapper.insert(dbMailTemplate); | |
| 137 | + // 测试 name 不匹配 | |
| 138 | + mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setName("芋道"))); | |
| 139 | + // 测试 code 不匹配 | |
| 140 | + mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setCode("test_02"))); | |
| 141 | + // 测试 accountId 不匹配 | |
| 142 | + mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setAccountId(2L))); | |
| 143 | + // 测试 status 不匹配 | |
| 144 | + mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); | |
| 145 | + // 测试 createTime 不匹配 | |
| 146 | + mailTemplateMapper.insert(cloneIgnoreId(dbMailTemplate, o -> o.setCreateTime(buildTime(2023, 1, 5)))); | |
| 147 | + // 准备参数 | |
| 148 | + MailTemplatePageReqVO reqVO = new MailTemplatePageReqVO(); | |
| 149 | + reqVO.setName("源"); | |
| 150 | + reqVO.setCode("est_01"); | |
| 151 | + reqVO.setAccountId(1L); | |
| 152 | + reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 153 | + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 5)); | |
| 154 | + | |
| 155 | + // 调用 | |
| 156 | + PageResult<MailTemplateDO> pageResult = mailTemplateService.getMailTemplatePage(reqVO); | |
| 157 | + // 断言 | |
| 158 | + assertEquals(1, pageResult.getTotal()); | |
| 159 | + assertEquals(1, pageResult.getList().size()); | |
| 160 | + assertPojoEquals(dbMailTemplate, pageResult.getList().get(0)); | |
| 161 | + } | |
| 162 | + | |
| 163 | +} | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java
| ... | ... | @@ -235,7 +235,6 @@ public class SmsLogServiceTest extends BaseDbUnitTest { |
| 235 | 235 | return randomPojo(SmsLogDO.class, ArrayUtils.append(consumer, consumers)); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - | |
| 239 | 238 | private static Map<String, Object> randomTemplateParams() { |
| 240 | 239 | return MapUtil.<String, Object>builder().put(randomString(), randomString()) |
| 241 | 240 | .put(randomString(), randomString()).build(); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/resources/sql/clean.sql
| ... | ... | @@ -25,3 +25,6 @@ DELETE FROM "system_oauth2_approve"; |
| 25 | 25 | DELETE FROM "system_oauth2_access_token"; |
| 26 | 26 | DELETE FROM "system_oauth2_refresh_token"; |
| 27 | 27 | DELETE FROM "system_oauth2_code"; |
| 28 | +DELETE FROM "system_mail_account"; | |
| 29 | +DELETE FROM "system_mail_template"; | |
| 30 | +DELETE FROM "system_mail_log"; | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/resources/sql/create_tables.sql
| ... | ... | @@ -566,3 +566,63 @@ CREATE TABLE IF NOT EXISTS "system_oauth2_code" ( |
| 566 | 566 | "deleted" bit NOT NULL DEFAULT FALSE, |
| 567 | 567 | PRIMARY KEY ("id") |
| 568 | 568 | ) COMMENT 'OAuth2 刷新令牌'; |
| 569 | + | |
| 570 | +CREATE TABLE IF NOT EXISTS "system_mail_account" ( | |
| 571 | + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | |
| 572 | + "mail" varchar NOT NULL, | |
| 573 | + "username" varchar NOT NULL, | |
| 574 | + "password" varchar NOT NULL, | |
| 575 | + "host" varchar NOT NULL, | |
| 576 | + "port" int NOT NULL, | |
| 577 | + "ssl_enable" bit NOT NULL, | |
| 578 | + "creator" varchar DEFAULT '', | |
| 579 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 580 | + "updater" varchar DEFAULT '', | |
| 581 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| 582 | + "deleted" bit NOT NULL DEFAULT FALSE, | |
| 583 | + PRIMARY KEY ("id") | |
| 584 | +) COMMENT '邮箱账号表'; | |
| 585 | + | |
| 586 | +CREATE TABLE IF NOT EXISTS "system_mail_template" ( | |
| 587 | + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | |
| 588 | + "name" varchar NOT NULL, | |
| 589 | + "code" varchar NOT NULL, | |
| 590 | + "account_id" bigint NOT NULL, | |
| 591 | + "nickname" varchar, | |
| 592 | + "title" varchar NOT NULL, | |
| 593 | + "content" varchar NOT NULL, | |
| 594 | + "params" varchar NOT NULL, | |
| 595 | + "status" varchar NOT NULL, | |
| 596 | + "remark" varchar, | |
| 597 | + "creator" varchar DEFAULT '', | |
| 598 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 599 | + "updater" varchar DEFAULT '', | |
| 600 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| 601 | + "deleted" bit NOT NULL DEFAULT FALSE, | |
| 602 | + PRIMARY KEY ("id") | |
| 603 | +) COMMENT '邮件模版表'; | |
| 604 | + | |
| 605 | +CREATE TABLE IF NOT EXISTS "system_mail_log" ( | |
| 606 | + "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | |
| 607 | + "user_id" bigint, | |
| 608 | + "user_type" varchar, | |
| 609 | + "to_mail" varchar NOT NULL, | |
| 610 | + "account_id" bigint NOT NULL, | |
| 611 | + "from_mail" varchar NOT NULL, | |
| 612 | + "template_id" bigint NOT NULL, | |
| 613 | + "template_code" varchar NOT NULL, | |
| 614 | + "template_nickname" varchar, | |
| 615 | + "template_title" varchar NOT NULL, | |
| 616 | + "template_content" varchar NOT NULL, | |
| 617 | + "template_params" varchar NOT NULL, | |
| 618 | + "send_status" varchar NOT NULL, | |
| 619 | + "send_time" datetime, | |
| 620 | + "send_message_id" varchar, | |
| 621 | + "send_exception" varchar, | |
| 622 | + "creator" varchar DEFAULT '', | |
| 623 | + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 624 | + "updater" varchar DEFAULT '', | |
| 625 | + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| 626 | + "deleted" bit NOT NULL DEFAULT FALSE, | |
| 627 | + PRIMARY KEY ("id") | |
| 628 | +) COMMENT '邮件日志表'; | ... | ... |
yudao-server/src/main/resources/application.yaml
yudao-ui-admin-vue3/src/api/system/mail/account/index.ts
0 → 100644
| 1 | +import request from '@/config/axios' | |
| 2 | + | |
| 3 | +export interface MailAccountVO { | |
| 4 | + id: number | |
| 5 | + mail: string | |
| 6 | + username: string | |
| 7 | + password: string | |
| 8 | + host: string | |
| 9 | + port: number | |
| 10 | + sslEnable: boolean | |
| 11 | +} | |
| 12 | + | |
| 13 | +export interface MailAccountPageReqVO extends PageParam { | |
| 14 | + mail?: string | |
| 15 | + username?: string | |
| 16 | +} | |
| 17 | + | |
| 18 | +// 查询邮箱账号列表 | |
| 19 | +export const getMailAccountPageApi = async (params: MailAccountPageReqVO) => { | |
| 20 | + return await request.get({ url: '/system/mail-account/page', params }) | |
| 21 | +} | |
| 22 | + | |
| 23 | +// 查询邮箱账号详情 | |
| 24 | +export const getMailAccountApi = async (id: number) => { | |
| 25 | + return await request.get({ url: '/system/mail-account/get?id=' + id }) | |
| 26 | +} | |
| 27 | + | |
| 28 | +// 新增邮箱账号 | |
| 29 | +export const createMailAccountApi = async (data: MailAccountVO) => { | |
| 30 | + return await request.post({ url: '/system/mail-account/create', data }) | |
| 31 | +} | |
| 32 | + | |
| 33 | +// 修改邮箱账号 | |
| 34 | +export const updateMailAccountApi = async (data: MailAccountVO) => { | |
| 35 | + return await request.put({ url: '/system/mail-account/update', data }) | |
| 36 | +} | |
| 37 | + | |
| 38 | +// 删除邮箱账号 | |
| 39 | +export const deleteMailAccountApi = async (id: number) => { | |
| 40 | + return await request.delete({ url: '/system/mail-account/delete?id=' + id }) | |
| 41 | +} | |
| 42 | + | |
| 43 | +// 获得邮箱账号精简列表 | |
| 44 | +export const getSimpleMailAccounts = async () => { | |
| 45 | + return request.get({ url: '/system/mail-account/list-all-simple' }) | |
| 46 | +} | ... | ... |
yudao-ui-admin-vue3/src/api/system/mail/log/index.ts
0 → 100644
| 1 | +import request from '@/config/axios' | |
| 2 | + | |
| 3 | +export interface MailLogVO { | |
| 4 | + id: number | |
| 5 | + userId: number | |
| 6 | + userType: number | |
| 7 | + toMail: string | |
| 8 | + accountId: number | |
| 9 | + fromMail: string | |
| 10 | + templateId: number | |
| 11 | + templateCode: string | |
| 12 | + templateNickname: string | |
| 13 | + templateTitle: string | |
| 14 | + templateContent: string | |
| 15 | + templateParams: string | |
| 16 | + sendStatus: number | |
| 17 | + sendTime: Date | |
| 18 | + sendMessageId: string | |
| 19 | + sendException: string | |
| 20 | +} | |
| 21 | + | |
| 22 | +export interface MailLogPageReqVO extends PageParam { | |
| 23 | + userId?: number | |
| 24 | + userType?: number | |
| 25 | + toMail?: string | |
| 26 | + accountId?: number | |
| 27 | + templateId?: number | |
| 28 | + sendStatus?: number | |
| 29 | + sendTime?: Date[] | |
| 30 | +} | |
| 31 | + | |
| 32 | +// 查询邮件日志列表 | |
| 33 | +export const getMailLogPageApi = async (params: MailLogPageReqVO) => { | |
| 34 | + return await request.get({ url: '/system/mail-log/page', params }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 查询邮件日志详情 | |
| 38 | +export const getMailLogApi = async (id: number) => { | |
| 39 | + return await request.get({ url: '/system/mail-log/get?id=' + id }) | |
| 40 | +} | ... | ... |
yudao-ui-admin-vue3/src/api/system/mail/template/index.ts
0 → 100644
| 1 | +import request from '@/config/axios' | |
| 2 | + | |
| 3 | +export interface MailTemplateVO { | |
| 4 | + id: number | |
| 5 | + name: string | |
| 6 | + code: string | |
| 7 | + accountId: number | |
| 8 | + nickname: string | |
| 9 | + title: string | |
| 10 | + content: string | |
| 11 | + params: string | |
| 12 | + status: number | |
| 13 | + remark: string | |
| 14 | +} | |
| 15 | + | |
| 16 | +export interface MailTemplatePageReqVO extends PageParam { | |
| 17 | + name?: string | |
| 18 | + code?: string | |
| 19 | + accountId?: number | |
| 20 | + status?: number | |
| 21 | + createTime?: Date[] | |
| 22 | +} | |
| 23 | + | |
| 24 | +export interface MailSmsReqVO { | |
| 25 | + mail: string | |
| 26 | + templateCode: string | |
| 27 | + templateParams: Map<String, Object> | |
| 28 | +} | |
| 29 | + | |
| 30 | +// 查询邮件模版列表 | |
| 31 | +export const getMailTemplatePageApi = async (params: MailTemplatePageReqVO) => { | |
| 32 | + return await request.get({ url: '/system/mail-template/page', params }) | |
| 33 | +} | |
| 34 | + | |
| 35 | +// 查询邮件模版详情 | |
| 36 | +export const getMailTemplateApi = async (id: number) => { | |
| 37 | + return await request.get({ url: '/system/mail-template/get?id=' + id }) | |
| 38 | +} | |
| 39 | + | |
| 40 | +// 新增邮件模版 | |
| 41 | +export const createMailTemplateApi = async (data: MailTemplateVO) => { | |
| 42 | + return await request.post({ url: '/system/mail-template/create', data }) | |
| 43 | +} | |
| 44 | + | |
| 45 | +// 修改邮件模版 | |
| 46 | +export const updateMailTemplateApi = async (data: MailTemplateVO) => { | |
| 47 | + return await request.put({ url: '/system/mail-template/update', data }) | |
| 48 | +} | |
| 49 | + | |
| 50 | +// 删除邮件模版 | |
| 51 | +export const deleteMailTemplateApi = async (id: number) => { | |
| 52 | + return await request.delete({ url: '/system/mail-template/delete?id=' + id }) | |
| 53 | +} | |
| 54 | + | |
| 55 | +// 发送邮件 | |
| 56 | +export const sendMailApi = (data: MailSmsReqVO) => { | |
| 57 | + return request.post({ url: '/system/mail-template/send-mail', data }) | |
| 58 | +} | ... | ... |
yudao-ui-admin-vue3/src/utils/dict.ts
| ... | ... | @@ -90,6 +90,7 @@ export enum DICT_TYPE { |
| 90 | 90 | SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status', |
| 91 | 91 | SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type', |
| 92 | 92 | SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type', |
| 93 | + SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status', | |
| 93 | 94 | |
| 94 | 95 | // ========== INFRA 模块 ========== |
| 95 | 96 | INFRA_BOOLEAN_STRING = 'infra_boolean_string', | ... | ... |
yudao-ui-admin-vue3/src/views/system/mail/account/account.data.ts
0 → 100644
| 1 | +import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' | |
| 2 | + | |
| 3 | +// 表单校验 | |
| 4 | +export const rules = reactive({ | |
| 5 | + mail: [required], | |
| 6 | + username: [required], | |
| 7 | + password: [required], | |
| 8 | + host: [required], | |
| 9 | + port: [required], | |
| 10 | + sslEnable: [required] | |
| 11 | +}) | |
| 12 | + | |
| 13 | +// CrudSchema | |
| 14 | +const crudSchemas = reactive<VxeCrudSchema>({ | |
| 15 | + primaryKey: 'id', // 默认的主键 ID | |
| 16 | + primaryTitle: '编号', | |
| 17 | + primaryType: 'id', | |
| 18 | + action: true, | |
| 19 | + actionWidth: '200', // 3 个按钮默认 200,如有删减对应增减即可 | |
| 20 | + columns: [ | |
| 21 | + { | |
| 22 | + title: '邮箱', | |
| 23 | + field: 'mail', | |
| 24 | + isSearch: true | |
| 25 | + }, | |
| 26 | + { | |
| 27 | + title: '用户名', | |
| 28 | + field: 'username', | |
| 29 | + isSearch: true | |
| 30 | + }, | |
| 31 | + { | |
| 32 | + title: '密码', | |
| 33 | + field: 'password', | |
| 34 | + isTable: false | |
| 35 | + }, | |
| 36 | + { | |
| 37 | + title: 'SMTP 服务器域名', | |
| 38 | + field: 'host' | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + title: 'SMTP 服务器端口', | |
| 42 | + field: 'port', | |
| 43 | + form: { | |
| 44 | + component: 'InputNumber', | |
| 45 | + value: 465 | |
| 46 | + } | |
| 47 | + }, | |
| 48 | + { | |
| 49 | + title: '是否开启 SSL', | |
| 50 | + field: 'sslEnable', | |
| 51 | + dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, | |
| 52 | + dictClass: 'boolean' | |
| 53 | + }, | |
| 54 | + { | |
| 55 | + title: '创建时间', | |
| 56 | + field: 'createTime', | |
| 57 | + isForm: false, | |
| 58 | + formatter: 'formatDate', | |
| 59 | + table: { | |
| 60 | + width: 180 | |
| 61 | + } | |
| 62 | + } | |
| 63 | + ] | |
| 64 | +}) | |
| 65 | +export const { allSchemas } = useVxeCrudSchemas(crudSchemas) | ... | ... |
yudao-ui-admin-vue3/src/views/system/mail/account/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <ContentWrap> | |
| 3 | + <!-- 列表 --> | |
| 4 | + <XTable @register="registerTable"> | |
| 5 | + <template #toolbar_buttons> | |
| 6 | + <!-- 操作:新增 --> | |
| 7 | + <XButton | |
| 8 | + type="primary" | |
| 9 | + preIcon="ep:zoom-in" | |
| 10 | + :title="t('action.add')" | |
| 11 | + v-hasPermi="['system:mail-account:create']" | |
| 12 | + @click="handleCreate()" | |
| 13 | + /> | |
| 14 | + </template> | |
| 15 | + <template #actionbtns_default="{ row }"> | |
| 16 | + <!-- 操作:修改 --> | |
| 17 | + <XTextButton | |
| 18 | + preIcon="ep:edit" | |
| 19 | + :title="t('action.edit')" | |
| 20 | + v-hasPermi="['system:mail-account:update']" | |
| 21 | + @click="handleUpdate(row.id)" | |
| 22 | + /> | |
| 23 | + <!-- 操作:详情 --> | |
| 24 | + <XTextButton | |
| 25 | + preIcon="ep:view" | |
| 26 | + :title="t('action.detail')" | |
| 27 | + v-hasPermi="['system:mail-account:query']" | |
| 28 | + @click="handleDetail(row.id)" | |
| 29 | + /> | |
| 30 | + <!-- 操作:删除 --> | |
| 31 | + <XTextButton | |
| 32 | + preIcon="ep:delete" | |
| 33 | + :title="t('action.del')" | |
| 34 | + v-hasPermi="['system:mail-account:delete']" | |
| 35 | + @click="deleteData(row.id)" | |
| 36 | + /> | |
| 37 | + </template> | |
| 38 | + </XTable> | |
| 39 | + </ContentWrap> | |
| 40 | + <!-- 弹窗 --> | |
| 41 | + <XModal id="mailAccountModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> | |
| 42 | + <!-- 表单:添加/修改 --> | |
| 43 | + <Form | |
| 44 | + ref="formRef" | |
| 45 | + v-if="['create', 'update'].includes(actionType)" | |
| 46 | + :schema="allSchemas.formSchema" | |
| 47 | + :rules="rules" | |
| 48 | + /> | |
| 49 | + <!-- 表单:详情 --> | |
| 50 | + <Descriptions | |
| 51 | + v-if="actionType === 'detail'" | |
| 52 | + :schema="allSchemas.detailSchema" | |
| 53 | + :data="detailData" | |
| 54 | + /> | |
| 55 | + <template #footer> | |
| 56 | + <!-- 按钮:保存 --> | |
| 57 | + <XButton | |
| 58 | + v-if="['create', 'update'].includes(actionType)" | |
| 59 | + type="primary" | |
| 60 | + :title="t('action.save')" | |
| 61 | + :loading="actionLoading" | |
| 62 | + @click="submitForm()" | |
| 63 | + /> | |
| 64 | + <!-- 按钮:关闭 --> | |
| 65 | + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" /> | |
| 66 | + </template> | |
| 67 | + </XModal> | |
| 68 | +</template> | |
| 69 | +<script setup lang="ts" name="MailAccount"> | |
| 70 | +import { FormExpose } from '@/components/Form' | |
| 71 | +// 业务相关的 import | |
| 72 | +import { rules, allSchemas } from './account.data' | |
| 73 | +import * as MailAccountApi from '@/api/system/mail/account' | |
| 74 | + | |
| 75 | +const { t } = useI18n() // 国际化 | |
| 76 | +const message = useMessage() // 消息弹窗 | |
| 77 | + | |
| 78 | +// 列表相关的变量 | |
| 79 | +const [registerTable, { reload, deleteData }] = useXTable({ | |
| 80 | + allSchemas: allSchemas, | |
| 81 | + getListApi: MailAccountApi.getMailAccountPageApi, | |
| 82 | + deleteApi: MailAccountApi.deleteMailAccountApi | |
| 83 | +}) | |
| 84 | + | |
| 85 | +// 弹窗相关的变量 | |
| 86 | +const modelVisible = ref(false) // 是否显示弹出层 | |
| 87 | +const modelTitle = ref('edit') // 弹出层标题 | |
| 88 | +const modelLoading = ref(false) // 弹出层loading | |
| 89 | +const actionType = ref('') // 操作按钮的类型 | |
| 90 | +const actionLoading = ref(false) // 按钮 Loading | |
| 91 | +const formRef = ref<FormExpose>() // 表单 Ref | |
| 92 | +const detailData = ref() // 详情 Ref | |
| 93 | + | |
| 94 | +// 设置标题 | |
| 95 | +const setDialogTile = (type: string) => { | |
| 96 | + modelLoading.value = true | |
| 97 | + modelTitle.value = t('action.' + type) | |
| 98 | + actionType.value = type | |
| 99 | + modelVisible.value = true | |
| 100 | +} | |
| 101 | + | |
| 102 | +// 新增操作 | |
| 103 | +const handleCreate = () => { | |
| 104 | + setDialogTile('create') | |
| 105 | + modelLoading.value = false | |
| 106 | +} | |
| 107 | + | |
| 108 | +// 修改操作 | |
| 109 | +const handleUpdate = async (rowId: number) => { | |
| 110 | + setDialogTile('update') | |
| 111 | + // 设置数据 | |
| 112 | + const res = await MailAccountApi.getMailAccountApi(rowId) | |
| 113 | + unref(formRef)?.setValues(res) | |
| 114 | + modelLoading.value = false | |
| 115 | +} | |
| 116 | + | |
| 117 | +// 详情操作 | |
| 118 | +const handleDetail = async (rowId: number) => { | |
| 119 | + setDialogTile('detail') | |
| 120 | + const res = await MailAccountApi.getMailAccountApi(rowId) | |
| 121 | + detailData.value = res | |
| 122 | + modelLoading.value = false | |
| 123 | +} | |
| 124 | + | |
| 125 | +// 提交按钮 | |
| 126 | +const submitForm = async () => { | |
| 127 | + const elForm = unref(formRef)?.getElFormRef() | |
| 128 | + if (!elForm) return | |
| 129 | + elForm.validate(async (valid) => { | |
| 130 | + if (valid) { | |
| 131 | + actionLoading.value = true | |
| 132 | + // 提交请求 | |
| 133 | + try { | |
| 134 | + const data = unref(formRef)?.formModel as MailAccountApi.MailAccountVO | |
| 135 | + if (actionType.value === 'create') { | |
| 136 | + await MailAccountApi.createMailAccountApi(data) | |
| 137 | + message.success(t('common.createSuccess')) | |
| 138 | + } else { | |
| 139 | + await MailAccountApi.updateMailAccountApi(data) | |
| 140 | + message.success(t('common.updateSuccess')) | |
| 141 | + } | |
| 142 | + modelVisible.value = false | |
| 143 | + } finally { | |
| 144 | + actionLoading.value = false | |
| 145 | + // 刷新列表 | |
| 146 | + await reload() | |
| 147 | + } | |
| 148 | + } | |
| 149 | + }) | |
| 150 | +} | |
| 151 | +</script> | ... | ... |
yudao-ui-admin-vue3/src/views/system/mail/log/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <ContentWrap> | |
| 3 | + <!-- 列表 --> | |
| 4 | + <XTable @register="registerTable"> | |
| 5 | + <template #accountId_search> | |
| 6 | + <el-select v-model="queryParams.accountId"> | |
| 7 | + <el-option :key="undefined" label="全部" :value="undefined" /> | |
| 8 | + <el-option | |
| 9 | + v-for="item in accountOptions" | |
| 10 | + :key="item.id" | |
| 11 | + :label="item.mail" | |
| 12 | + :value="item.id" | |
| 13 | + /> | |
| 14 | + </el-select> | |
| 15 | + </template> | |
| 16 | + <template #toMail_default="{ row }"> | |
| 17 | + <div>{{ row.toMail }}</div> | |
| 18 | + <div v-if="row.userType && row.userId"> | |
| 19 | + <dict-tag :type="DICT_TYPE.USER_TYPE" :value="row.userType" />{{ '(' + row.userId + ')' }} | |
| 20 | + </div> | |
| 21 | + </template> | |
| 22 | + <template #actionbtns_default="{ row }"> | |
| 23 | + <!-- 操作:详情 --> | |
| 24 | + <XTextButton | |
| 25 | + preIcon="ep:view" | |
| 26 | + :title="t('action.detail')" | |
| 27 | + v-hasPermi="['system:mail-log:query']" | |
| 28 | + @click="handleDetail(row.id)" | |
| 29 | + /> | |
| 30 | + </template> | |
| 31 | + </XTable> | |
| 32 | + </ContentWrap> | |
| 33 | + <!-- 弹窗 --> | |
| 34 | + <XModal id="mailLogModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> | |
| 35 | + <!-- 表单:详情 --> | |
| 36 | + <Descriptions | |
| 37 | + v-if="actionType === 'detail'" | |
| 38 | + :schema="allSchemas.detailSchema" | |
| 39 | + :data="detailData" | |
| 40 | + /> | |
| 41 | + <template #footer> | |
| 42 | + <!-- 按钮:关闭 --> | |
| 43 | + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" /> | |
| 44 | + </template> | |
| 45 | + </XModal> | |
| 46 | +</template> | |
| 47 | +<script setup lang="ts" name="MailLog"> | |
| 48 | +// 业务相关的 import | |
| 49 | +import { allSchemas } from './log.data' | |
| 50 | +import * as MailLogApi from '@/api/system/mail/log' | |
| 51 | +import * as MailAccountApi from '@/api/system/mail/account' | |
| 52 | + | |
| 53 | +const { t } = useI18n() // 国际化 | |
| 54 | + | |
| 55 | +// 列表相关的变量 | |
| 56 | +const queryParams = reactive({ | |
| 57 | + accountId: null | |
| 58 | +}) | |
| 59 | +const [registerTable] = useXTable({ | |
| 60 | + allSchemas: allSchemas, | |
| 61 | + params: queryParams, | |
| 62 | + getListApi: MailLogApi.getMailLogPageApi | |
| 63 | +}) | |
| 64 | +const accountOptions = ref([]) // 账号下拉选项 | |
| 65 | + | |
| 66 | +// 弹窗相关的变量 | |
| 67 | +const modelVisible = ref(false) // 是否显示弹出层 | |
| 68 | +const modelTitle = ref('edit') // 弹出层标题 | |
| 69 | +const modelLoading = ref(false) // 弹出层loading | |
| 70 | +const actionType = ref('') // 操作按钮的类型 | |
| 71 | +const actionLoading = ref(false) // 按钮 Loading | |
| 72 | +const detailData = ref() // 详情 Ref | |
| 73 | + | |
| 74 | +// 设置标题 | |
| 75 | +const setDialogTile = (type: string) => { | |
| 76 | + modelLoading.value = true | |
| 77 | + modelTitle.value = t('action.' + type) | |
| 78 | + actionType.value = type | |
| 79 | + modelVisible.value = true | |
| 80 | +} | |
| 81 | + | |
| 82 | +// 详情操作 | |
| 83 | +const handleDetail = async (rowId: number) => { | |
| 84 | + setDialogTile('detail') | |
| 85 | + const res = await MailLogApi.getMailLogApi(rowId) | |
| 86 | + detailData.value = res | |
| 87 | + modelLoading.value = false | |
| 88 | +} | |
| 89 | + | |
| 90 | +// ========== 初始化 ========== | |
| 91 | +onMounted(() => { | |
| 92 | + MailAccountApi.getSimpleMailAccounts().then((data) => { | |
| 93 | + accountOptions.value = data | |
| 94 | + }) | |
| 95 | +}) | |
| 96 | +</script> | ... | ... |
yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts
0 → 100644
| 1 | +import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' | |
| 2 | + | |
| 3 | +// CrudSchema | |
| 4 | +const crudSchemas = reactive<VxeCrudSchema>({ | |
| 5 | + primaryKey: 'id', | |
| 6 | + primaryTitle: '编号', | |
| 7 | + primaryType: 'id', | |
| 8 | + action: true, | |
| 9 | + actionWidth: '70', | |
| 10 | + columns: [ | |
| 11 | + { | |
| 12 | + title: '发送时间', | |
| 13 | + field: 'sendTime', | |
| 14 | + table: { | |
| 15 | + width: 180 | |
| 16 | + }, | |
| 17 | + formatter: 'formatDate', | |
| 18 | + search: { | |
| 19 | + show: true, | |
| 20 | + itemRender: { | |
| 21 | + name: 'XDataTimePicker' | |
| 22 | + } | |
| 23 | + } | |
| 24 | + }, | |
| 25 | + { | |
| 26 | + title: '接收邮箱', | |
| 27 | + field: 'toMail', | |
| 28 | + isSearch: true, | |
| 29 | + table: { | |
| 30 | + width: 180, | |
| 31 | + slots: { | |
| 32 | + default: 'toMail_default' | |
| 33 | + } | |
| 34 | + } | |
| 35 | + }, | |
| 36 | + { | |
| 37 | + title: '用户编号', | |
| 38 | + field: 'userId', | |
| 39 | + isSearch: true, | |
| 40 | + isTable: false | |
| 41 | + }, | |
| 42 | + { | |
| 43 | + title: '用户类型', | |
| 44 | + field: 'userType', | |
| 45 | + dictType: DICT_TYPE.USER_TYPE, | |
| 46 | + dictClass: 'number', | |
| 47 | + isSearch: true, | |
| 48 | + isTable: false | |
| 49 | + }, | |
| 50 | + { | |
| 51 | + title: '邮件标题', | |
| 52 | + field: 'templateTitle' | |
| 53 | + }, | |
| 54 | + { | |
| 55 | + title: '邮件内容', | |
| 56 | + field: 'templateContent', | |
| 57 | + isTable: false | |
| 58 | + }, | |
| 59 | + { | |
| 60 | + title: '邮箱参数', | |
| 61 | + field: 'templateParams', | |
| 62 | + isTable: false | |
| 63 | + }, | |
| 64 | + { | |
| 65 | + title: '发送状态', | |
| 66 | + field: 'sendStatus', | |
| 67 | + dictType: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS, | |
| 68 | + dictClass: 'string', | |
| 69 | + isSearch: true | |
| 70 | + }, | |
| 71 | + { | |
| 72 | + title: '邮箱账号', | |
| 73 | + field: 'accountId', | |
| 74 | + isSearch: true, | |
| 75 | + isTable: false, | |
| 76 | + search: { | |
| 77 | + slots: { | |
| 78 | + default: 'accountId_search' | |
| 79 | + } | |
| 80 | + } | |
| 81 | + }, | |
| 82 | + { | |
| 83 | + title: '发送邮箱地址', | |
| 84 | + field: 'fromMail', | |
| 85 | + table: { | |
| 86 | + title: '邮箱账号' | |
| 87 | + } | |
| 88 | + }, | |
| 89 | + { | |
| 90 | + title: '模板编号', | |
| 91 | + field: 'templateId', | |
| 92 | + isSearch: true | |
| 93 | + }, | |
| 94 | + { | |
| 95 | + title: '模板编码', | |
| 96 | + field: 'templateCode', | |
| 97 | + isTable: false | |
| 98 | + }, | |
| 99 | + { | |
| 100 | + title: '模版发送人名称', | |
| 101 | + field: 'templateNickname', | |
| 102 | + isTable: false | |
| 103 | + }, | |
| 104 | + { | |
| 105 | + title: '发送返回的消息编号', | |
| 106 | + field: 'sendMessageId', | |
| 107 | + isTable: false | |
| 108 | + }, | |
| 109 | + { | |
| 110 | + title: '发送异常', | |
| 111 | + field: 'sendException', | |
| 112 | + isTable: false | |
| 113 | + }, | |
| 114 | + { | |
| 115 | + title: '创建时间', | |
| 116 | + field: 'createTime', | |
| 117 | + isTable: false | |
| 118 | + } | |
| 119 | + ] | |
| 120 | +}) | |
| 121 | +export const { allSchemas } = useVxeCrudSchemas(crudSchemas) | ... | ... |
yudao-ui-admin-vue3/src/views/system/mail/template/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <ContentWrap> | |
| 3 | + <!-- 列表 --> | |
| 4 | + <XTable @register="registerTable"> | |
| 5 | + <template #accountId_search> | |
| 6 | + <el-select v-model="queryParams.accountId"> | |
| 7 | + <el-option :key="undefined" label="全部" :value="undefined" /> | |
| 8 | + <el-option | |
| 9 | + v-for="item in accountOptions" | |
| 10 | + :key="item.id" | |
| 11 | + :label="item.mail" | |
| 12 | + :value="item.id" | |
| 13 | + /> | |
| 14 | + </el-select> | |
| 15 | + </template> | |
| 16 | + <template #toolbar_buttons> | |
| 17 | + <!-- 操作:新增 --> | |
| 18 | + <XButton | |
| 19 | + type="primary" | |
| 20 | + preIcon="ep:zoom-in" | |
| 21 | + :title="t('action.add')" | |
| 22 | + v-hasPermi="['system:mail-template:create']" | |
| 23 | + @click="handleCreate()" | |
| 24 | + /> | |
| 25 | + </template> | |
| 26 | + <template #accountId_default="{ row }"> | |
| 27 | + <span>{{ accountOptions.find((account) => account.id === row.accountId)?.mail }}</span> | |
| 28 | + </template> | |
| 29 | + <template #actionbtns_default="{ row }"> | |
| 30 | + <!-- 操作:测试短信 --> | |
| 31 | + <XTextButton | |
| 32 | + preIcon="ep:cpu" | |
| 33 | + :title="t('action.test')" | |
| 34 | + v-hasPermi="['system:mail-template:send-mail']" | |
| 35 | + @click="handleSendMail(row)" | |
| 36 | + /> | |
| 37 | + <!-- 操作:修改 --> | |
| 38 | + <XTextButton | |
| 39 | + preIcon="ep:edit" | |
| 40 | + :title="t('action.edit')" | |
| 41 | + v-hasPermi="['system:mail-template:update']" | |
| 42 | + @click="handleUpdate(row.id)" | |
| 43 | + /> | |
| 44 | + <!-- 操作:详情 --> | |
| 45 | + <XTextButton | |
| 46 | + preIcon="ep:view" | |
| 47 | + :title="t('action.detail')" | |
| 48 | + v-hasPermi="['system:mail-template:query']" | |
| 49 | + @click="handleDetail(row.id)" | |
| 50 | + /> | |
| 51 | + <!-- 操作:删除 --> | |
| 52 | + <XTextButton | |
| 53 | + preIcon="ep:delete" | |
| 54 | + :title="t('action.del')" | |
| 55 | + v-hasPermi="['system:mail-template:delete']" | |
| 56 | + @click="deleteData(row.id)" | |
| 57 | + /> | |
| 58 | + </template> | |
| 59 | + </XTable> | |
| 60 | + </ContentWrap> | |
| 61 | + | |
| 62 | + <!-- 添加/修改/详情的弹窗 --> | |
| 63 | + <XModal id="mailTemplateModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> | |
| 64 | + <!-- 表单:添加/修改 --> | |
| 65 | + <Form | |
| 66 | + ref="formRef" | |
| 67 | + v-if="['create', 'update'].includes(actionType)" | |
| 68 | + :schema="allSchemas.formSchema" | |
| 69 | + :rules="rules" | |
| 70 | + > | |
| 71 | + <template #accountId="form"> | |
| 72 | + <el-select v-model="form.accountId"> | |
| 73 | + <el-option | |
| 74 | + v-for="item in accountOptions" | |
| 75 | + :key="item.id" | |
| 76 | + :label="item.mail" | |
| 77 | + :value="item.id" | |
| 78 | + /> | |
| 79 | + </el-select> | |
| 80 | + </template> | |
| 81 | + </Form> | |
| 82 | + <!-- 表单:详情 --> | |
| 83 | + <Descriptions | |
| 84 | + v-if="actionType === 'detail'" | |
| 85 | + :schema="allSchemas.detailSchema" | |
| 86 | + :data="detailData" | |
| 87 | + /> | |
| 88 | + <template #footer> | |
| 89 | + <!-- 按钮:保存 --> | |
| 90 | + <XButton | |
| 91 | + v-if="['create', 'update'].includes(actionType)" | |
| 92 | + type="primary" | |
| 93 | + :title="t('action.save')" | |
| 94 | + :loading="actionLoading" | |
| 95 | + @click="submitForm()" | |
| 96 | + /> | |
| 97 | + <!-- 按钮:关闭 --> | |
| 98 | + <XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" /> | |
| 99 | + </template> | |
| 100 | + </XModal> | |
| 101 | + | |
| 102 | + <!-- 测试邮件的弹窗 --> | |
| 103 | + <XModal id="sendTest" v-model="sendVisible" title="测试"> | |
| 104 | + <el-form :model="sendForm" :rules="sendRules" label-width="200px" label-position="top"> | |
| 105 | + <el-form-item label="模板内容" prop="content"> | |
| 106 | + <Editor :model-value="sendForm.content" readonly height="150px" /> | |
| 107 | + </el-form-item> | |
| 108 | + <el-form-item label="收件邮箱" prop="mail"> | |
| 109 | + <el-input v-model="sendForm.mail" placeholder="请输入收件邮箱" /> | |
| 110 | + </el-form-item> | |
| 111 | + <el-form-item | |
| 112 | + v-for="param in sendForm.params" | |
| 113 | + :key="param" | |
| 114 | + :label="'参数 {' + param + '}'" | |
| 115 | + :prop="'templateParams.' + param" | |
| 116 | + > | |
| 117 | + <el-input | |
| 118 | + v-model="sendForm.templateParams[param]" | |
| 119 | + :placeholder="'请输入 ' + param + ' 参数'" | |
| 120 | + /> | |
| 121 | + </el-form-item> | |
| 122 | + </el-form> | |
| 123 | + <!-- 操作按钮 --> | |
| 124 | + <template #footer> | |
| 125 | + <XButton | |
| 126 | + type="primary" | |
| 127 | + :title="t('action.test')" | |
| 128 | + :loading="actionLoading" | |
| 129 | + @click="sendTest()" | |
| 130 | + /> | |
| 131 | + <XButton :title="t('dialog.close')" @click="sendVisible = false" /> | |
| 132 | + </template> | |
| 133 | + </XModal> | |
| 134 | +</template> | |
| 135 | +<script setup lang="ts" name="MailTemplate"> | |
| 136 | +import { FormExpose } from '@/components/Form' | |
| 137 | +// 业务相关的 import | |
| 138 | +import { rules, allSchemas } from './template.data' | |
| 139 | +import * as MailTemplateApi from '@/api/system/mail/template' | |
| 140 | +import * as MailAccountApi from '@/api/system/mail/account' | |
| 141 | + | |
| 142 | +const { t } = useI18n() // 国际化 | |
| 143 | +const message = useMessage() // 消息弹窗 | |
| 144 | + | |
| 145 | +// 列表相关的变量 | |
| 146 | +const queryParams = reactive({ | |
| 147 | + accountId: null | |
| 148 | +}) | |
| 149 | +const [registerTable, { reload, deleteData }] = useXTable({ | |
| 150 | + allSchemas: allSchemas, | |
| 151 | + params: queryParams, | |
| 152 | + getListApi: MailTemplateApi.getMailTemplatePageApi, | |
| 153 | + deleteApi: MailTemplateApi.deleteMailTemplateApi | |
| 154 | +}) | |
| 155 | +const accountOptions = ref([]) // 账号下拉选项 | |
| 156 | + | |
| 157 | +// 弹窗相关的变量 | |
| 158 | +const modelVisible = ref(false) // 是否显示弹出层 | |
| 159 | +const modelTitle = ref('edit') // 弹出层标题 | |
| 160 | +const modelLoading = ref(false) // 弹出层loading | |
| 161 | +const actionType = ref('') // 操作按钮的类型 | |
| 162 | +const actionLoading = ref(false) // 按钮 Loading | |
| 163 | +const formRef = ref<FormExpose>() // 表单 Ref | |
| 164 | +const detailData = ref() // 详情 Ref | |
| 165 | + | |
| 166 | +// 设置标题 | |
| 167 | +const setDialogTile = (type: string) => { | |
| 168 | + modelLoading.value = true | |
| 169 | + modelTitle.value = t('action.' + type) | |
| 170 | + actionType.value = type | |
| 171 | + modelVisible.value = true | |
| 172 | +} | |
| 173 | + | |
| 174 | +// 新增操作 | |
| 175 | +const handleCreate = () => { | |
| 176 | + setDialogTile('create') | |
| 177 | + modelLoading.value = false | |
| 178 | +} | |
| 179 | + | |
| 180 | +// 修改操作 | |
| 181 | +const handleUpdate = async (rowId: number) => { | |
| 182 | + setDialogTile('update') | |
| 183 | + // 设置数据 | |
| 184 | + const res = await MailTemplateApi.getMailTemplateApi(rowId) | |
| 185 | + unref(formRef)?.setValues(res) | |
| 186 | + modelLoading.value = false | |
| 187 | +} | |
| 188 | + | |
| 189 | +// 详情操作 | |
| 190 | +const handleDetail = async (rowId: number) => { | |
| 191 | + setDialogTile('detail') | |
| 192 | + const res = await MailTemplateApi.getMailTemplateApi(rowId) | |
| 193 | + detailData.value = res | |
| 194 | + modelLoading.value = false | |
| 195 | +} | |
| 196 | + | |
| 197 | +// 提交按钮 | |
| 198 | +const submitForm = async () => { | |
| 199 | + const elForm = unref(formRef)?.getElFormRef() | |
| 200 | + if (!elForm) return | |
| 201 | + elForm.validate(async (valid) => { | |
| 202 | + if (valid) { | |
| 203 | + actionLoading.value = true | |
| 204 | + // 提交请求 | |
| 205 | + try { | |
| 206 | + const data = unref(formRef)?.formModel as MailTemplateApi.MailTemplateVO | |
| 207 | + if (actionType.value === 'create') { | |
| 208 | + await MailTemplateApi.createMailTemplateApi(data) | |
| 209 | + message.success(t('common.createSuccess')) | |
| 210 | + } else { | |
| 211 | + await MailTemplateApi.updateMailTemplateApi(data) | |
| 212 | + message.success(t('common.updateSuccess')) | |
| 213 | + } | |
| 214 | + modelVisible.value = false | |
| 215 | + } finally { | |
| 216 | + actionLoading.value = false | |
| 217 | + // 刷新列表 | |
| 218 | + await reload() | |
| 219 | + } | |
| 220 | + } | |
| 221 | + }) | |
| 222 | +} | |
| 223 | + | |
| 224 | +// ========== 测试相关 ========== | |
| 225 | +const sendForm = ref({ | |
| 226 | + content: '', | |
| 227 | + params: {}, | |
| 228 | + mail: '', | |
| 229 | + templateCode: '', | |
| 230 | + templateParams: {} | |
| 231 | +}) | |
| 232 | +const sendRules = ref({ | |
| 233 | + mail: [{ required: true, message: '邮箱不能为空', trigger: 'blur' }], | |
| 234 | + templateCode: [{ required: true, message: '模版编号不能为空', trigger: 'blur' }], | |
| 235 | + templateParams: {} | |
| 236 | +}) | |
| 237 | +const sendVisible = ref(false) | |
| 238 | + | |
| 239 | +const handleSendMail = (row: any) => { | |
| 240 | + sendForm.value.content = row.content | |
| 241 | + sendForm.value.params = row.params | |
| 242 | + sendForm.value.templateCode = row.code | |
| 243 | + sendForm.value.templateParams = row.params.reduce(function (obj, item) { | |
| 244 | + obj[item] = undefined | |
| 245 | + return obj | |
| 246 | + }, {}) | |
| 247 | + sendRules.value.templateParams = row.params.reduce(function (obj, item) { | |
| 248 | + obj[item] = { required: true, message: '参数 ' + item + ' 不能为空', trigger: 'change' } | |
| 249 | + return obj | |
| 250 | + }, {}) | |
| 251 | + sendVisible.value = true | |
| 252 | +} | |
| 253 | + | |
| 254 | +const sendTest = async () => { | |
| 255 | + const data: MailTemplateApi.MailSmsReqVO = { | |
| 256 | + mail: sendForm.value.mail, | |
| 257 | + templateCode: sendForm.value.templateCode, | |
| 258 | + templateParams: sendForm.value.templateParams as unknown as Map<string, Object> | |
| 259 | + } | |
| 260 | + const res = await MailTemplateApi.sendMailApi(data) | |
| 261 | + if (res) { | |
| 262 | + message.success('提交发送成功!发送结果,见发送日志编号:' + res) | |
| 263 | + } | |
| 264 | + sendVisible.value = false | |
| 265 | +} | |
| 266 | + | |
| 267 | +// ========== 初始化 ========== | |
| 268 | +onMounted(() => { | |
| 269 | + MailAccountApi.getSimpleMailAccounts().then((data) => { | |
| 270 | + accountOptions.value = data | |
| 271 | + }) | |
| 272 | +}) | |
| 273 | +</script> | ... | ... |
yudao-ui-admin-vue3/src/views/system/mail/template/template.data.ts
0 → 100644
| 1 | +import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' | |
| 2 | + | |
| 3 | +// 表单校验 | |
| 4 | +export const rules = reactive({ | |
| 5 | + name: [required], | |
| 6 | + code: [required], | |
| 7 | + accountId: [required], | |
| 8 | + title: [required], | |
| 9 | + content: [required], | |
| 10 | + params: [required], | |
| 11 | + status: [required] | |
| 12 | +}) | |
| 13 | + | |
| 14 | +// CrudSchema | |
| 15 | +const crudSchemas = reactive<VxeCrudSchema>({ | |
| 16 | + primaryKey: 'id', // 默认的主键ID | |
| 17 | + primaryTitle: '编号', // 默认显示的值 | |
| 18 | + primaryType: null, | |
| 19 | + action: true, | |
| 20 | + actionWidth: '260', | |
| 21 | + columns: [ | |
| 22 | + { | |
| 23 | + title: '模板编码', | |
| 24 | + field: 'code', | |
| 25 | + isSearch: true | |
| 26 | + }, | |
| 27 | + { | |
| 28 | + title: '模板名称', | |
| 29 | + field: 'name', | |
| 30 | + isSearch: true | |
| 31 | + }, | |
| 32 | + { | |
| 33 | + title: '模板标题', | |
| 34 | + field: 'title' | |
| 35 | + }, | |
| 36 | + { | |
| 37 | + title: '模板内容', | |
| 38 | + field: 'content', | |
| 39 | + form: { | |
| 40 | + component: 'Editor', | |
| 41 | + colProps: { | |
| 42 | + span: 24 | |
| 43 | + }, | |
| 44 | + componentProps: { | |
| 45 | + valueHtml: '' | |
| 46 | + } | |
| 47 | + } | |
| 48 | + }, | |
| 49 | + { | |
| 50 | + title: '邮箱账号', | |
| 51 | + field: 'accountId', | |
| 52 | + isSearch: true, | |
| 53 | + table: { | |
| 54 | + width: 200, | |
| 55 | + slots: { | |
| 56 | + default: 'accountId_default' | |
| 57 | + } | |
| 58 | + }, | |
| 59 | + search: { | |
| 60 | + slots: { | |
| 61 | + default: 'accountId_search' | |
| 62 | + } | |
| 63 | + } | |
| 64 | + }, | |
| 65 | + { | |
| 66 | + title: '发送人名称', | |
| 67 | + field: 'nickname' | |
| 68 | + }, | |
| 69 | + { | |
| 70 | + title: '开启状态', | |
| 71 | + field: 'status', | |
| 72 | + isSearch: true, | |
| 73 | + dictType: DICT_TYPE.COMMON_STATUS, | |
| 74 | + dictClass: 'number' | |
| 75 | + }, | |
| 76 | + { | |
| 77 | + title: '备注', | |
| 78 | + field: 'remark', | |
| 79 | + isTable: false | |
| 80 | + }, | |
| 81 | + { | |
| 82 | + title: '创建时间', | |
| 83 | + field: 'createTime', | |
| 84 | + isForm: false, | |
| 85 | + formatter: 'formatDate', | |
| 86 | + table: { | |
| 87 | + width: 180 | |
| 88 | + }, | |
| 89 | + search: { | |
| 90 | + show: true, | |
| 91 | + itemRender: { | |
| 92 | + name: 'XDataTimePicker' | |
| 93 | + } | |
| 94 | + } | |
| 95 | + } | |
| 96 | + ] | |
| 97 | +}) | |
| 98 | +export const { allSchemas } = useVxeCrudSchemas(crudSchemas) | ... | ... |
yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue
| ... | ... | @@ -197,7 +197,7 @@ const sendSmsForm = ref({ |
| 197 | 197 | }) |
| 198 | 198 | const sendSmsRules = ref({ |
| 199 | 199 | mobile: [{ required: true, message: '手机不能为空', trigger: 'blur' }], |
| 200 | - templateCode: [{ required: true, message: '手机不能为空', trigger: 'blur' }], | |
| 200 | + templateCode: [{ required: true, message: '模版编号不能为空', trigger: 'blur' }], | |
| 201 | 201 | templateParams: {} |
| 202 | 202 | }) |
| 203 | 203 | const sendVisible = ref(false) |
| ... | ... | @@ -225,7 +225,7 @@ const sendSmsTest = async () => { |
| 225 | 225 | } |
| 226 | 226 | const res = await SmsTemplateApi.sendSmsApi(data) |
| 227 | 227 | if (res) { |
| 228 | - message.success('发送成功') | |
| 228 | + message.success('提交发送成功!发送结果,见发送日志编号:' + res) | |
| 229 | 229 | } |
| 230 | 230 | sendVisible.value = false |
| 231 | 231 | } | ... | ... |
yudao-ui-admin/src/api/system/mail/account.js
0 → 100755
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建邮箱账号 | |
| 4 | +export function createMailAccount(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/system/mail-account/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新邮箱账号 | |
| 13 | +export function updateMailAccount(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/system/mail-account/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除邮箱账号 | |
| 22 | +export function deleteMailAccount(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/system/mail-account/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得邮箱账号 | |
| 30 | +export function getMailAccount(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/system/mail-account/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得邮箱账号分页 | |
| 38 | +export function getMailAccountPage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/system/mail-account/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 获取邮箱账号的精简信息列表 | |
| 47 | +export function getSimpleMailAccountList() { | |
| 48 | + return request({ | |
| 49 | + url: '/system/mail-account/list-all-simple', | |
| 50 | + method: 'get', | |
| 51 | + }) | |
| 52 | +} | ... | ... |
yudao-ui-admin/src/api/system/mail/log.js
0 → 100755
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获得邮件日志 | |
| 4 | +export function getMailLog(id) { | |
| 5 | + return request({ | |
| 6 | + url: '/system/mail-log/get?id=' + id, | |
| 7 | + method: 'get' | |
| 8 | + }) | |
| 9 | +} | |
| 10 | + | |
| 11 | +// 获得邮件日志分页 | |
| 12 | +export function getMailLogPage(query) { | |
| 13 | + return request({ | |
| 14 | + url: '/system/mail-log/page', | |
| 15 | + method: 'get', | |
| 16 | + params: query | |
| 17 | + }) | |
| 18 | +} | ... | ... |
yudao-ui-admin/src/api/system/mail/template.js
0 → 100755
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建邮件模版 | |
| 4 | +export function createMailTemplate(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/system/mail-template/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新邮件模版 | |
| 13 | +export function updateMailTemplate(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/system/mail-template/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | +// 删除邮件模版 | |
| 22 | +export function deleteMailTemplate(id) { | |
| 23 | + return request({ | |
| 24 | + url: '/system/mail-template/delete?id=' + id, | |
| 25 | + method: 'delete' | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 获得邮件模版 | |
| 30 | +export function getMailTemplate(id) { | |
| 31 | + return request({ | |
| 32 | + url: '/system/mail-template/get?id=' + id, | |
| 33 | + method: 'get' | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获得邮件模版分页 | |
| 38 | +export function getMailTemplatePage(query) { | |
| 39 | + return request({ | |
| 40 | + url: '/system/mail-template/page', | |
| 41 | + method: 'get', | |
| 42 | + params: query | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 发送测试邮件 | |
| 47 | +export function sendMail(data) { | |
| 48 | + return request({ | |
| 49 | + url: '/system/mail-template/send-mail', | |
| 50 | + method: 'post', | |
| 51 | + data: data | |
| 52 | + }) | |
| 53 | +} | ... | ... |
yudao-ui-admin/src/api/system/sms/smsTemplate.js
yudao-ui-admin/src/utils/dict.js
| ... | ... | @@ -25,6 +25,7 @@ export const DICT_TYPE = { |
| 25 | 25 | SYSTEM_SMS_RECEIVE_STATUS: 'system_sms_receive_status', |
| 26 | 26 | SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type', |
| 27 | 27 | SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type', |
| 28 | + SYSTEM_MAIL_SEND_STATUS: 'system_mail_send_status', | |
| 28 | 29 | |
| 29 | 30 | // ========== INFRA 模块 ========== |
| 30 | 31 | INFRA_BOOLEAN_STRING: 'infra_boolean_string', | ... | ... |
yudao-ui-admin/src/views/system/mail/account/index.vue
0 → 100755
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" /> | |
| 4 | + | |
| 5 | + <!-- 搜索工作栏 --> | |
| 6 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | |
| 7 | + <el-form-item label="邮箱" prop="mail"> | |
| 8 | + <el-input v-model="queryParams.mail" placeholder="请输入邮箱" clearable @keyup.enter.native="handleQuery"/> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item label="用户名" prop="username"> | |
| 11 | + <el-input v-model="queryParams.username" placeholder="请输入用户名" clearable @keyup.enter.native="handleQuery"/> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item> | |
| 14 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | |
| 15 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | |
| 16 | + </el-form-item> | |
| 17 | + </el-form> | |
| 18 | + | |
| 19 | + <!-- 操作工具栏 --> | |
| 20 | + <el-row :gutter="10" class="mb8"> | |
| 21 | + <el-col :span="1.5"> | |
| 22 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | |
| 23 | + v-hasPermi="['system:mail-account:create']">新增</el-button> | |
| 24 | + </el-col> | |
| 25 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 26 | + </el-row> | |
| 27 | + | |
| 28 | + <!-- 列表 --> | |
| 29 | + <el-table v-loading="loading" :data="list"> | |
| 30 | + <el-table-column label="编号" align="center" prop="id" /> | |
| 31 | + <el-table-column label="邮箱" align="center" prop="mail" /> | |
| 32 | + <el-table-column label="用户名" align="center" prop="username" /> | |
| 33 | + <el-table-column label="SMTP 服务器域名" align="center" prop="host" /> | |
| 34 | + <el-table-column label="SMTP 服务器端口" align="center" prop="port" /> | |
| 35 | + <el-table-column label="是否开启 SSL" align="center" prop="sslEnable"> | |
| 36 | + <template v-slot="scope"> | |
| 37 | + <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.sslEnable" /> | |
| 38 | + </template> | |
| 39 | + </el-table-column> | |
| 40 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | |
| 41 | + <template v-slot="scope"> | |
| 42 | + <span>{{ parseTime(scope.row.createTime) }}</span> | |
| 43 | + </template> | |
| 44 | + </el-table-column> | |
| 45 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 46 | + <template v-slot="scope"> | |
| 47 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | |
| 48 | + v-hasPermi="['system:mail-account:update']">修改</el-button> | |
| 49 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | |
| 50 | + v-hasPermi="['system:mail-account:delete']">删除</el-button> | |
| 51 | + </template> | |
| 52 | + </el-table-column> | |
| 53 | + </el-table> | |
| 54 | + <!-- 分页组件 --> | |
| 55 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 56 | + @pagination="getList"/> | |
| 57 | + | |
| 58 | + <!-- 对话框(添加 / 修改) --> | |
| 59 | + <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body> | |
| 60 | + <el-form ref="form" :model="form" :rules="rules" label-width="140px"> | |
| 61 | + <el-form-item label="邮箱" prop="mail"> | |
| 62 | + <el-input v-model="form.mail" placeholder="请输入邮箱" /> | |
| 63 | + </el-form-item> | |
| 64 | + <el-form-item label="用户名" prop="username"> | |
| 65 | + <el-input v-model="form.username" placeholder="请输入用户名,一般和邮箱一致" /> | |
| 66 | + </el-form-item> | |
| 67 | + <el-form-item label="密码" prop="password"> | |
| 68 | + <el-input v-model="form.password" placeholder="请输入密码" /> | |
| 69 | + </el-form-item> | |
| 70 | + <el-form-item label="SMTP 服务器域名" prop="host"> | |
| 71 | + <el-input v-model="form.host" placeholder="请输入 SMTP 服务器域名" /> | |
| 72 | + </el-form-item> | |
| 73 | + <el-form-item label="SMTP 服务器端口" prop="port"> | |
| 74 | + <el-input v-model="form.port" placeholder="请输入 SMTP 服务器端口" /> | |
| 75 | + </el-form-item> | |
| 76 | + <el-form-item label="是否开启 SSL" prop="sslEnable"> | |
| 77 | + <el-radio-group v-model="form.sslEnable"> | |
| 78 | + <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)" | |
| 79 | + :key="dict.value" :label="dict.value === 'true'">{{dict.label}}</el-radio> | |
| 80 | + </el-radio-group> | |
| 81 | + </el-form-item> | |
| 82 | + </el-form> | |
| 83 | + <div slot="footer" class="dialog-footer"> | |
| 84 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 85 | + <el-button @click="cancel">取 消</el-button> | |
| 86 | + </div> | |
| 87 | + </el-dialog> | |
| 88 | + </div> | |
| 89 | +</template> | |
| 90 | + | |
| 91 | +<script> | |
| 92 | +import { createMailAccount, updateMailAccount, deleteMailAccount, getMailAccount, getMailAccountPage } from "@/api/system/mail/account"; | |
| 93 | + | |
| 94 | +export default { | |
| 95 | + name: "MailAccount", | |
| 96 | + components: { | |
| 97 | + }, | |
| 98 | + data() { | |
| 99 | + return { | |
| 100 | + // 遮罩层 | |
| 101 | + loading: true, | |
| 102 | + // 显示搜索条件 | |
| 103 | + showSearch: true, | |
| 104 | + // 总条数 | |
| 105 | + total: 0, | |
| 106 | + // 邮箱账号列表 | |
| 107 | + list: [], | |
| 108 | + // 弹出层标题 | |
| 109 | + title: "", | |
| 110 | + // 是否显示弹出层 | |
| 111 | + open: false, | |
| 112 | + // 查询参数 | |
| 113 | + queryParams: { | |
| 114 | + pageNo: 1, | |
| 115 | + pageSize: 10, | |
| 116 | + mail: null, | |
| 117 | + username: null | |
| 118 | + }, | |
| 119 | + // 表单参数 | |
| 120 | + form: {}, | |
| 121 | + // 表单校验 | |
| 122 | + rules: { | |
| 123 | + mail: [{ required: true, message: "邮箱不能为空", trigger: "blur" }], | |
| 124 | + username: [{ required: true, message: "用户名不能为空", trigger: "blur" }], | |
| 125 | + password: [{ required: true, message: "密码不能为空", trigger: "blur" }], | |
| 126 | + host: [{ required: true, message: "SMTP 服务器域名不能为空", trigger: "blur" }], | |
| 127 | + port: [{ required: true, message: "SMTP 服务器端口不能为空", trigger: "blur" }], | |
| 128 | + sslEnable: [{ required: true, message: "是否开启 SSL不能为空", trigger: "blur" }], | |
| 129 | + }, | |
| 130 | + }; | |
| 131 | + }, | |
| 132 | + created() { | |
| 133 | + this.getList(); | |
| 134 | + }, | |
| 135 | + methods: { | |
| 136 | + /** 查询列表 */ | |
| 137 | + getList() { | |
| 138 | + this.loading = true; | |
| 139 | + // 执行查询 | |
| 140 | + getMailAccountPage(this.queryParams).then(response => { | |
| 141 | + this.list = response.data.list; | |
| 142 | + this.total = response.data.total; | |
| 143 | + this.loading = false; | |
| 144 | + }); | |
| 145 | + }, | |
| 146 | + /** 取消按钮 */ | |
| 147 | + cancel() { | |
| 148 | + this.open = false; | |
| 149 | + this.reset(); | |
| 150 | + }, | |
| 151 | + /** 表单重置 */ | |
| 152 | + reset() { | |
| 153 | + this.form = { | |
| 154 | + id: undefined, | |
| 155 | + mail: undefined, | |
| 156 | + username: undefined, | |
| 157 | + password: undefined, | |
| 158 | + host: undefined, | |
| 159 | + port: undefined, | |
| 160 | + sslEnable: true, | |
| 161 | + }; | |
| 162 | + this.resetForm("form"); | |
| 163 | + }, | |
| 164 | + /** 搜索按钮操作 */ | |
| 165 | + handleQuery() { | |
| 166 | + this.queryParams.pageNo = 1; | |
| 167 | + this.getList(); | |
| 168 | + }, | |
| 169 | + /** 重置按钮操作 */ | |
| 170 | + resetQuery() { | |
| 171 | + this.resetForm("queryForm"); | |
| 172 | + this.handleQuery(); | |
| 173 | + }, | |
| 174 | + /** 新增按钮操作 */ | |
| 175 | + handleAdd() { | |
| 176 | + this.reset(); | |
| 177 | + this.open = true; | |
| 178 | + this.title = "添加邮箱账号"; | |
| 179 | + }, | |
| 180 | + /** 修改按钮操作 */ | |
| 181 | + handleUpdate(row) { | |
| 182 | + this.reset(); | |
| 183 | + const id = row.id; | |
| 184 | + getMailAccount(id).then(response => { | |
| 185 | + this.form = response.data; | |
| 186 | + this.open = true; | |
| 187 | + this.title = "修改邮箱账号"; | |
| 188 | + }); | |
| 189 | + }, | |
| 190 | + /** 提交按钮 */ | |
| 191 | + submitForm() { | |
| 192 | + this.$refs["form"].validate(valid => { | |
| 193 | + if (!valid) { | |
| 194 | + return; | |
| 195 | + } | |
| 196 | + // 修改的提交 | |
| 197 | + if (this.form.id != null) { | |
| 198 | + updateMailAccount(this.form).then(response => { | |
| 199 | + this.$modal.msgSuccess("修改成功"); | |
| 200 | + this.open = false; | |
| 201 | + this.getList(); | |
| 202 | + }); | |
| 203 | + return; | |
| 204 | + } | |
| 205 | + // 添加的提交 | |
| 206 | + createMailAccount(this.form).then(response => { | |
| 207 | + this.$modal.msgSuccess("新增成功"); | |
| 208 | + this.open = false; | |
| 209 | + this.getList(); | |
| 210 | + }); | |
| 211 | + }); | |
| 212 | + }, | |
| 213 | + /** 删除按钮操作 */ | |
| 214 | + handleDelete(row) { | |
| 215 | + const id = row.id; | |
| 216 | + this.$modal.confirm('是否确认删除邮箱账号编号为"' + id + '"的数据项?').then(function() { | |
| 217 | + return deleteMailAccount(id); | |
| 218 | + }).then(() => { | |
| 219 | + this.getList(); | |
| 220 | + this.$modal.msgSuccess("删除成功"); | |
| 221 | + }).catch(() => {}); | |
| 222 | + } | |
| 223 | + } | |
| 224 | +}; | |
| 225 | +</script> | ... | ... |
yudao-ui-admin/src/views/system/mail/log/index.vue
0 → 100755
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" /> | |
| 4 | + | |
| 5 | + <!-- 搜索工作栏 --> | |
| 6 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | |
| 7 | + <el-form-item label="接收邮箱" prop="toMail"> | |
| 8 | + <el-input v-model="queryParams.toMail" placeholder="请输入接收邮箱" clearable @keyup.enter.native="handleQuery"/> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item label="邮箱账号" prop="accountId"> | |
| 11 | + <el-select v-model="queryParams.accountId" placeholder="请输入邮箱账号" clearable> | |
| 12 | + <el-option v-for="account in accountOptions" :key="account.id" :value="account.id" :label="account.mail" /> | |
| 13 | + </el-select> | |
| 14 | + </el-form-item> | |
| 15 | + <el-form-item label="模板编号" prop="templateId"> | |
| 16 | + <el-input v-model="queryParams.templateId" placeholder="请输入模板编号" clearable @keyup.enter.native="handleQuery"/> | |
| 17 | + </el-form-item> | |
| 18 | + <el-form-item label="发送状态" prop="sendStatus"> | |
| 19 | + <el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small"> | |
| 20 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_MAIL_SEND_STATUS)" | |
| 21 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 22 | + </el-select> | |
| 23 | + </el-form-item> | |
| 24 | + <el-form-item label="发送时间" prop="sendTime"> | |
| 25 | + <el-date-picker v-model="queryParams.sendTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | |
| 26 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | |
| 27 | + </el-form-item> | |
| 28 | + <el-form-item label="用户编号" prop="userId"> | |
| 29 | + <el-input v-model="queryParams.userId" placeholder="请输入用户编号" clearable @keyup.enter.native="handleQuery"/> | |
| 30 | + </el-form-item> | |
| 31 | + <el-form-item label="用户类型" prop="userType"> | |
| 32 | + <el-select v-model="queryParams.userType" placeholder="请选择用户类型" clearable> | |
| 33 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.USER_TYPE)" | |
| 34 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 35 | + </el-select> | |
| 36 | + </el-form-item> | |
| 37 | + <el-form-item> | |
| 38 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | |
| 39 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | |
| 40 | + </el-form-item> | |
| 41 | + </el-form> | |
| 42 | + | |
| 43 | + <!-- 操作工具栏 --> | |
| 44 | + <el-row :gutter="10" class="mb8"> | |
| 45 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 46 | + </el-row> | |
| 47 | + | |
| 48 | + <!-- 列表 --> | |
| 49 | + <el-table v-loading="loading" :data="list"> | |
| 50 | + <el-table-column label="编号" align="center" prop="id" /> | |
| 51 | + <el-table-column label="发送时间" align="center" prop="sendTime" width="180"> | |
| 52 | + <template v-slot="scope"> | |
| 53 | + <span>{{ parseTime(scope.row.sendTime) }}</span> | |
| 54 | + </template> | |
| 55 | + </el-table-column> | |
| 56 | + <el-table-column label="接收邮箱" align="center" prop="toMail" width="200"> | |
| 57 | + <template v-slot="scope"> | |
| 58 | + <div>{{ scope.row.toMail }}</div> | |
| 59 | + <div v-if="scope.row.userType && scope.row.userId"> | |
| 60 | + <dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType"/>{{ '(' + scope.row.userId + ')' }} | |
| 61 | + </div> | |
| 62 | + </template> | |
| 63 | + </el-table-column> | |
| 64 | + <el-table-column label="邮件标题" align="center" prop="templateTitle" /> | |
| 65 | + <el-table-column label="发送状态" align="center" prop="sendStatus"> | |
| 66 | + <template v-slot="scope"> | |
| 67 | + <dict-tag :type="DICT_TYPE.SYSTEM_MAIL_SEND_STATUS" :value="scope.row.sendStatus" /> | |
| 68 | + </template> | |
| 69 | + </el-table-column> | |
| 70 | + <el-table-column label="邮箱账号" align="center" prop="fromMail" /> | |
| 71 | + <el-table-column label="模板编号" align="center" prop="templateId" /> | |
| 72 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 73 | + <template v-slot="scope"> | |
| 74 | + <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" | |
| 75 | + v-hasPermi="['system:mail-log:query']">详细</el-button> | |
| 76 | + </template> | |
| 77 | + </el-table-column> | |
| 78 | + </el-table> | |
| 79 | + <!-- 分页组件 --> | |
| 80 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 81 | + @pagination="getList"/> | |
| 82 | + | |
| 83 | + <!-- 邮件日志详细--> | |
| 84 | + <el-dialog :title="title" :visible.sync="open" width="700px" v-dialogDrag append-to-body> | |
| 85 | + <el-form ref="form" :model="form" label-width="160px"> | |
| 86 | + <el-row> | |
| 87 | + <el-col :span="24"> | |
| 88 | + <el-form-item label="日志主键:">{{ form.id }}</el-form-item> | |
| 89 | + <el-form-item label="用户编号:">{{ form.userId }}</el-form-item> | |
| 90 | + <el-form-item label="用户类型:"> | |
| 91 | + <dict-tag :type="DICT_TYPE.USER_TYPE" :value="form.userType"/> | |
| 92 | + </el-form-item> | |
| 93 | + <el-form-item label="接收邮箱地址:">{{ form.toMail }}</el-form-item> | |
| 94 | + <el-form-item label="邮箱账号编号:">{{ form.accountId }}</el-form-item> | |
| 95 | + <el-form-item label="发送邮箱地址:">{{ form.fromMail }}</el-form-item> | |
| 96 | + <el-form-item label="模板编号:">{{ form.templateId }}</el-form-item> | |
| 97 | + <el-form-item label="模板编码:">{{ form.templateCode }}</el-form-item> | |
| 98 | + <el-form-item label="模版发送人名称:">{{ form.templateNickname }}</el-form-item> | |
| 99 | + <el-form-item label="邮件标题:">{{ form.templateTitle }}</el-form-item> | |
| 100 | + <el-form-item label="邮件内容:"> | |
| 101 | + <editor v-model="form.templateContent" :min-height="192" read-only /> | |
| 102 | + </el-form-item> | |
| 103 | + <el-form-item label="邮件参数:">{{ form.templateParams }}</el-form-item> | |
| 104 | + <el-form-item label="发送状态:"> | |
| 105 | + <dict-tag :type="DICT_TYPE.SYSTEM_MAIL_SEND_STATUS" :value="form.sendStatus" /> | |
| 106 | + </el-form-item> | |
| 107 | + <el-form-item label="发送时间:">{{ parseTime(form.sendTime) }}</el-form-item> | |
| 108 | + <el-form-item label="发送返回的消息编号:">{{ form.sendMessageId }}</el-form-item> | |
| 109 | + <el-form-item label="发送异常:">{{ form.sendException }}</el-form-item> | |
| 110 | + </el-col> | |
| 111 | + </el-row> | |
| 112 | + </el-form> | |
| 113 | + <div slot="footer" class="dialog-footer"> | |
| 114 | + <el-button @click="open = false">关 闭</el-button> | |
| 115 | + </div> | |
| 116 | + </el-dialog> | |
| 117 | + </div> | |
| 118 | +</template> | |
| 119 | + | |
| 120 | +<script> | |
| 121 | +import { getMailLog, getMailLogPage } from "@/api/system/mail/log"; | |
| 122 | +import Editor from '@/components/Editor'; | |
| 123 | +import { getSimpleMailAccountList } from "@/api/system/mail/account"; | |
| 124 | + | |
| 125 | +export default { | |
| 126 | + name: "MailLog", | |
| 127 | + components: { | |
| 128 | + Editor, | |
| 129 | + }, | |
| 130 | + data() { | |
| 131 | + return { | |
| 132 | + // 遮罩层 | |
| 133 | + loading: true, | |
| 134 | + // 导出遮罩层 | |
| 135 | + exportLoading: false, | |
| 136 | + // 显示搜索条件 | |
| 137 | + showSearch: true, | |
| 138 | + // 总条数 | |
| 139 | + total: 0, | |
| 140 | + // 邮件日志列表 | |
| 141 | + list: [], | |
| 142 | + // 弹出层标题 | |
| 143 | + title: "", | |
| 144 | + // 是否显示弹出层 | |
| 145 | + open: false, | |
| 146 | + // 查询参数 | |
| 147 | + queryParams: { | |
| 148 | + pageNo: 1, | |
| 149 | + pageSize: 10, | |
| 150 | + userId: null, | |
| 151 | + userType: null, | |
| 152 | + toMail: null, | |
| 153 | + accountId: null, | |
| 154 | + templateId: null, | |
| 155 | + sendStatus: null, | |
| 156 | + sendTime: [], | |
| 157 | + }, | |
| 158 | + // 表单参数 | |
| 159 | + form: {}, | |
| 160 | + // 邮箱账号 | |
| 161 | + accountOptions: [] | |
| 162 | + }; | |
| 163 | + }, | |
| 164 | + created() { | |
| 165 | + this.getList(); | |
| 166 | + // 获得邮箱账号列表 | |
| 167 | + getSimpleMailAccountList().then(response => { | |
| 168 | + this.accountOptions = response.data | |
| 169 | + }) | |
| 170 | + }, | |
| 171 | + methods: { | |
| 172 | + /** 查询列表 */ | |
| 173 | + getList() { | |
| 174 | + this.loading = true; | |
| 175 | + // 执行查询 | |
| 176 | + getMailLogPage(this.queryParams).then(response => { | |
| 177 | + this.list = response.data.list; | |
| 178 | + this.total = response.data.total; | |
| 179 | + this.loading = false; | |
| 180 | + }); | |
| 181 | + }, | |
| 182 | + /** 取消按钮 */ | |
| 183 | + cancel() { | |
| 184 | + this.open = false; | |
| 185 | + this.reset(); | |
| 186 | + }, | |
| 187 | + /** 表单重置 */ | |
| 188 | + reset() { | |
| 189 | + this.form = { | |
| 190 | + id: undefined, | |
| 191 | + userId: undefined, | |
| 192 | + userType: undefined, | |
| 193 | + toMail: undefined, | |
| 194 | + accountId: undefined, | |
| 195 | + fromMail: undefined, | |
| 196 | + templateId: undefined, | |
| 197 | + templateCode: undefined, | |
| 198 | + templateNickname: undefined, | |
| 199 | + templateTitle: undefined, | |
| 200 | + templateContent: undefined, | |
| 201 | + templateParams: undefined, | |
| 202 | + sendStatus: undefined, | |
| 203 | + sendTime: undefined, | |
| 204 | + sendMessageId: undefined, | |
| 205 | + sendException: undefined, | |
| 206 | + }; | |
| 207 | + this.resetForm("form"); | |
| 208 | + }, | |
| 209 | + /** 搜索按钮操作 */ | |
| 210 | + handleQuery() { | |
| 211 | + this.queryParams.pageNo = 1; | |
| 212 | + this.getList(); | |
| 213 | + }, | |
| 214 | + /** 重置按钮操作 */ | |
| 215 | + resetQuery() { | |
| 216 | + this.resetForm("queryForm"); | |
| 217 | + this.handleQuery(); | |
| 218 | + }, | |
| 219 | + /** 详细按钮操作 */ | |
| 220 | + handleView(row) { | |
| 221 | + this.open = true; | |
| 222 | + this.form = row; | |
| 223 | + } | |
| 224 | + } | |
| 225 | +}; | |
| 226 | +</script> | ... | ... |
yudao-ui-admin/src/views/system/mail/template/index.vue
0 → 100755
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <doc-alert title="邮件配置" url="https://doc.iocoder.cn/mail" /> | |
| 4 | + | |
| 5 | + <!-- 搜索工作栏 --> | |
| 6 | + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | |
| 7 | + <el-form-item label="模板名称" prop="name"> | |
| 8 | + <el-input v-model="queryParams.name" placeholder="请输入模板名称" clearable @keyup.enter.native="handleQuery"/> | |
| 9 | + </el-form-item> | |
| 10 | + <el-form-item label="模板编码" prop="code"> | |
| 11 | + <el-input v-model="queryParams.code" placeholder="请输入模板编码" clearable @keyup.enter.native="handleQuery"/> | |
| 12 | + </el-form-item> | |
| 13 | + <el-form-item label="邮箱账号" prop="accountId"> | |
| 14 | + <el-select v-model="queryParams.accountId" placeholder="请输入邮箱账号" clearable> | |
| 15 | + <el-option v-for="account in accountOptions" :key="account.id" :value="account.id" :label="account.mail" /> | |
| 16 | + </el-select> | |
| 17 | + </el-form-item> | |
| 18 | + <el-form-item label="开启状态" prop="status"> | |
| 19 | + <el-select v-model="queryParams.status" placeholder="请选择开启状态" clearable size="small"> | |
| 20 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | |
| 21 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 22 | + </el-select> | |
| 23 | + </el-form-item> | |
| 24 | + <el-form-item label="创建时间" prop="createTime"> | |
| 25 | + <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | |
| 26 | + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | |
| 27 | + </el-form-item> | |
| 28 | + <el-form-item> | |
| 29 | + <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | |
| 30 | + <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | |
| 31 | + </el-form-item> | |
| 32 | + </el-form> | |
| 33 | + | |
| 34 | + <!-- 操作工具栏 --> | |
| 35 | + <el-row :gutter="10" class="mb8"> | |
| 36 | + <el-col :span="1.5"> | |
| 37 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | |
| 38 | + v-hasPermi="['system:mail-template:create']">新增</el-button> | |
| 39 | + </el-col> | |
| 40 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 41 | + </el-row> | |
| 42 | + | |
| 43 | + <!-- 列表 --> | |
| 44 | + <el-table v-loading="loading" :data="list"> | |
| 45 | + <el-table-column label="模板编码" align="center" prop="code" /> | |
| 46 | + <el-table-column label="模板名称" align="center" prop="name" /> | |
| 47 | + <el-table-column label="模板标题" align="center" prop="title" /> | |
| 48 | + <el-table-column label="模板内容" align="center" prop="content" :show-overflow-tooltip="true" /> | |
| 49 | + <el-table-column label="邮箱账号" align="center" prop="accountId" width="200"> | |
| 50 | + <template v-slot="scope"> | |
| 51 | + {{ accountOptions.find(account => account.id === scope.row.accountId)?.mail }} | |
| 52 | + </template> | |
| 53 | + </el-table-column> | |
| 54 | + <el-table-column label="发送人名称" align="center" prop="nickname" /> | |
| 55 | + <el-table-column label="开启状态" align="center" prop="status"> | |
| 56 | + <template v-slot="scope"> | |
| 57 | + <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> | |
| 58 | + </template> | |
| 59 | + </el-table-column> | |
| 60 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | |
| 61 | + <template v-slot="scope"> | |
| 62 | + <span>{{ parseTime(scope.row.createTime) }}</span> | |
| 63 | + </template> | |
| 64 | + </el-table-column> | |
| 65 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> | |
| 66 | + <template v-slot="scope"> | |
| 67 | + <el-button size="mini" type="text" icon="el-icon-share" @click="handleSend(scope.row)" | |
| 68 | + v-hasPermi="['system:mail-template:send-mail']">测试</el-button> | |
| 69 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | |
| 70 | + v-hasPermi="['system:mail-template:update']">修改</el-button> | |
| 71 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | |
| 72 | + v-hasPermi="['system:mail-template:delete']">删除</el-button> | |
| 73 | + </template> | |
| 74 | + </el-table-column> | |
| 75 | + </el-table> | |
| 76 | + <!-- 分页组件 --> | |
| 77 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 78 | + @pagination="getList"/> | |
| 79 | + | |
| 80 | + <!-- 对话框(添加 / 修改) --> | |
| 81 | + <el-dialog :title="title" :visible.sync="open" width="600px" v-dialogDrag append-to-body> | |
| 82 | + <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | |
| 83 | + <el-form-item label="模板名称" prop="name"> | |
| 84 | + <el-input v-model="form.name" placeholder="请输入模板名称" /> | |
| 85 | + </el-form-item> | |
| 86 | + <el-form-item label="模板编码" prop="code"> | |
| 87 | + <el-input v-model="form.code" placeholder="请输入模板编码" /> | |
| 88 | + </el-form-item> | |
| 89 | + <el-form-item label="邮箱账号" prop="accountId"> | |
| 90 | + <el-select v-model="form.accountId" placeholder="请输入邮箱账号"> | |
| 91 | + <el-option v-for="account in accountOptions" :key="account.id" :value="account.id" :label="account.mail" /> | |
| 92 | + </el-select> | |
| 93 | + </el-form-item> | |
| 94 | + <el-form-item label="发送人名称" prop="nickname"> | |
| 95 | + <el-input v-model="form.nickname" placeholder="请输入发送人名称" /> | |
| 96 | + </el-form-item> | |
| 97 | + <el-form-item label="模板标题" prop="title"> | |
| 98 | + <el-input v-model="form.title" placeholder="请输入模板标题" /> | |
| 99 | + </el-form-item> | |
| 100 | + <el-form-item label="模板内容"> | |
| 101 | + <editor v-model="form.content" :min-height="192"/> | |
| 102 | + </el-form-item> | |
| 103 | + <el-form-item label="开启状态" prop="status"> | |
| 104 | + <el-radio-group v-model="form.status"> | |
| 105 | + <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | |
| 106 | + :key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio> | |
| 107 | + </el-radio-group> | |
| 108 | + </el-form-item> | |
| 109 | + <el-form-item label="备注" prop="remark"> | |
| 110 | + <el-input v-model="form.remark" placeholder="请输入备注" /> | |
| 111 | + </el-form-item> | |
| 112 | + </el-form> | |
| 113 | + <div slot="footer" class="dialog-footer"> | |
| 114 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 115 | + <el-button @click="cancel">取 消</el-button> | |
| 116 | + </div> | |
| 117 | + </el-dialog> | |
| 118 | + | |
| 119 | + <!-- 对话框(发送邮件) --> | |
| 120 | + <el-dialog title="测试发送邮件" :visible.sync="sendOpen" width="500px" append-to-body> | |
| 121 | + <el-form ref="sendForm" :model="sendForm" :rules="sendRules" label-width="140px"> | |
| 122 | + <el-form-item label="模板内容" prop="content"> | |
| 123 | + <editor v-model="sendForm.content" :min-height="192" readonly /> | |
| 124 | + </el-form-item> | |
| 125 | + <el-form-item label="收件邮箱" prop="mail"> | |
| 126 | + <el-input v-model="sendForm.mail" placeholder="请输入收件邮箱" /> | |
| 127 | + </el-form-item> | |
| 128 | + <el-form-item v-for="param in sendForm.params" :key="param" :label="'参数 {' + param + '}'" :prop="'templateParams.' + param"> | |
| 129 | + <el-input v-model="sendForm.templateParams[param]" :placeholder="'请输入 ' + param + ' 参数'" /> | |
| 130 | + </el-form-item> | |
| 131 | + </el-form> | |
| 132 | + <div slot="footer" class="dialog-footer"> | |
| 133 | + <el-button type="primary" @click="submitSendForm">确 定</el-button> | |
| 134 | + <el-button @click="cancelSend">取 消</el-button> | |
| 135 | + </div> | |
| 136 | + </el-dialog> | |
| 137 | + </div> | |
| 138 | +</template> | |
| 139 | + | |
| 140 | +<script> | |
| 141 | +import { createMailTemplate, updateMailTemplate, deleteMailTemplate, getMailTemplate, getMailTemplatePage, sendMail } from "@/api/system/mail/template"; | |
| 142 | +import Editor from '@/components/Editor'; | |
| 143 | +import { CommonStatusEnum } from "@/utils/constants"; | |
| 144 | +import { getSimpleMailAccountList } from "@/api/system/mail/account"; | |
| 145 | + | |
| 146 | +export default { | |
| 147 | + name: "MailTemplate", | |
| 148 | + components: { | |
| 149 | + Editor, | |
| 150 | + }, | |
| 151 | + data() { | |
| 152 | + return { | |
| 153 | + // 遮罩层 | |
| 154 | + loading: true, | |
| 155 | + // 显示搜索条件 | |
| 156 | + showSearch: true, | |
| 157 | + // 总条数 | |
| 158 | + total: 0, | |
| 159 | + // 邮件模版列表 | |
| 160 | + list: [], | |
| 161 | + // 弹出层标题 | |
| 162 | + title: "", | |
| 163 | + // 是否显示弹出层 | |
| 164 | + open: false, | |
| 165 | + // 查询参数 | |
| 166 | + queryParams: { | |
| 167 | + pageNo: 1, | |
| 168 | + pageSize: 10, | |
| 169 | + name: null, | |
| 170 | + code: null, | |
| 171 | + accountId: null, | |
| 172 | + status: null, | |
| 173 | + createTime: [], | |
| 174 | + }, | |
| 175 | + // 表单参数 | |
| 176 | + form: {}, | |
| 177 | + // 表单校验 | |
| 178 | + rules: { | |
| 179 | + name: [{ required: true, message: "模板名称不能为空", trigger: "blur" }], | |
| 180 | + code: [{ required: true, message: "模板编码不能为空", trigger: "blur" }], | |
| 181 | + accountId: [{ required: true, message: "邮箱账号不能为空", trigger: "blur" }], | |
| 182 | + title: [{ required: true, message: "模板标题不能为空", trigger: "blur" }], | |
| 183 | + content: [{ required: true, message: "模板内容不能为空", trigger: "blur" }], | |
| 184 | + status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }], | |
| 185 | + }, | |
| 186 | + // 邮箱账号 | |
| 187 | + accountOptions: [], | |
| 188 | + | |
| 189 | + // 发送邮箱 | |
| 190 | + sendOpen: false, | |
| 191 | + sendForm: { | |
| 192 | + params: [], // 模板的参数列表 | |
| 193 | + }, | |
| 194 | + sendRules: { | |
| 195 | + mail: [{ required: true, message: "收件邮箱不能为空", trigger: "blur" }], | |
| 196 | + templateCode: [{ required: true, message: "模版编码不能为空", trigger: "blur" }], | |
| 197 | + templateParams: { } | |
| 198 | + } | |
| 199 | + }; | |
| 200 | + }, | |
| 201 | + created() { | |
| 202 | + this.getList(); | |
| 203 | + // 获得邮箱账号列表 | |
| 204 | + getSimpleMailAccountList().then(response => { | |
| 205 | + this.accountOptions = response.data | |
| 206 | + }) | |
| 207 | + }, | |
| 208 | + methods: { | |
| 209 | + /** 查询列表 */ | |
| 210 | + getList() { | |
| 211 | + this.loading = true; | |
| 212 | + // 执行查询 | |
| 213 | + getMailTemplatePage(this.queryParams).then(response => { | |
| 214 | + this.list = response.data.list; | |
| 215 | + this.total = response.data.total; | |
| 216 | + this.loading = false; | |
| 217 | + }); | |
| 218 | + }, | |
| 219 | + /** 取消按钮 */ | |
| 220 | + cancel() { | |
| 221 | + this.open = false; | |
| 222 | + this.reset(); | |
| 223 | + }, | |
| 224 | + /** 表单重置 */ | |
| 225 | + reset() { | |
| 226 | + this.form = { | |
| 227 | + id: undefined, | |
| 228 | + name: undefined, | |
| 229 | + code: undefined, | |
| 230 | + accountId: undefined, | |
| 231 | + nickname: undefined, | |
| 232 | + title: undefined, | |
| 233 | + content: undefined, | |
| 234 | + status: CommonStatusEnum.ENABLE, | |
| 235 | + remark: undefined, | |
| 236 | + }; | |
| 237 | + this.resetForm("form"); | |
| 238 | + }, | |
| 239 | + /** 搜索按钮操作 */ | |
| 240 | + handleQuery() { | |
| 241 | + this.queryParams.pageNo = 1; | |
| 242 | + this.getList(); | |
| 243 | + }, | |
| 244 | + /** 重置按钮操作 */ | |
| 245 | + resetQuery() { | |
| 246 | + this.resetForm("queryForm"); | |
| 247 | + this.handleQuery(); | |
| 248 | + }, | |
| 249 | + /** 新增按钮操作 */ | |
| 250 | + handleAdd() { | |
| 251 | + this.reset(); | |
| 252 | + this.open = true; | |
| 253 | + this.title = "添加邮件模版"; | |
| 254 | + }, | |
| 255 | + /** 修改按钮操作 */ | |
| 256 | + handleUpdate(row) { | |
| 257 | + this.reset(); | |
| 258 | + const id = row.id; | |
| 259 | + getMailTemplate(id).then(response => { | |
| 260 | + this.form = response.data; | |
| 261 | + this.open = true; | |
| 262 | + this.title = "修改邮件模版"; | |
| 263 | + }); | |
| 264 | + }, | |
| 265 | + /** 提交按钮 */ | |
| 266 | + submitForm() { | |
| 267 | + this.$refs["form"].validate(valid => { | |
| 268 | + if (!valid) { | |
| 269 | + return; | |
| 270 | + } | |
| 271 | + // 修改的提交 | |
| 272 | + if (this.form.id != null) { | |
| 273 | + updateMailTemplate(this.form).then(response => { | |
| 274 | + this.$modal.msgSuccess("修改成功"); | |
| 275 | + this.open = false; | |
| 276 | + this.getList(); | |
| 277 | + }); | |
| 278 | + return; | |
| 279 | + } | |
| 280 | + // 添加的提交 | |
| 281 | + createMailTemplate(this.form).then(response => { | |
| 282 | + this.$modal.msgSuccess("新增成功"); | |
| 283 | + this.open = false; | |
| 284 | + this.getList(); | |
| 285 | + }); | |
| 286 | + }); | |
| 287 | + }, | |
| 288 | + /** 删除按钮操作 */ | |
| 289 | + handleDelete(row) { | |
| 290 | + const id = row.id; | |
| 291 | + this.$modal.confirm('是否确认删除邮件模版编号为"' + id + '"的数据项?').then(function() { | |
| 292 | + return deleteMailTemplate(id); | |
| 293 | + }).then(() => { | |
| 294 | + this.getList(); | |
| 295 | + this.$modal.msgSuccess("删除成功"); | |
| 296 | + }).catch(() => {}); | |
| 297 | + }, | |
| 298 | + /** 发送短息按钮 */ | |
| 299 | + handleSend(row) { | |
| 300 | + this.resetSend(row); | |
| 301 | + // 设置参数 | |
| 302 | + this.sendForm.content = row.content; | |
| 303 | + this.sendForm.params = row.params; | |
| 304 | + this.sendForm.templateCode = row.code; | |
| 305 | + this.sendForm.templateParams = row.params.reduce(function(obj, item) { | |
| 306 | + obj[item] = undefined; | |
| 307 | + return obj; | |
| 308 | + }, {}); | |
| 309 | + // 根据 row 重置 rules | |
| 310 | + this.sendRules.templateParams = row.params.reduce(function(obj, item) { | |
| 311 | + obj[item] = { required: true, message: '参数 ' + item + " 不能为空", trigger: "change" }; | |
| 312 | + return obj; | |
| 313 | + }, {}); | |
| 314 | + // 设置打开 | |
| 315 | + this.sendOpen = true; | |
| 316 | + }, | |
| 317 | + /** 重置发送邮箱的表单 */ | |
| 318 | + resetSend() { | |
| 319 | + // 根据 row 重置表单 | |
| 320 | + this.sendForm = { | |
| 321 | + content: undefined, | |
| 322 | + params: undefined, | |
| 323 | + mail: undefined, | |
| 324 | + templateCode: undefined, | |
| 325 | + templateParams: {} | |
| 326 | + }; | |
| 327 | + this.resetForm("sendForm"); | |
| 328 | + }, | |
| 329 | + /** 取消发送邮箱 */ | |
| 330 | + cancelSend() { | |
| 331 | + this.sendOpen = false; | |
| 332 | + this.resetSend(); | |
| 333 | + }, | |
| 334 | + /** 提交按钮 */ | |
| 335 | + submitSendForm() { | |
| 336 | + this.$refs["sendForm"].validate(valid => { | |
| 337 | + if (!valid) { | |
| 338 | + return; | |
| 339 | + } | |
| 340 | + // 添加的提交 | |
| 341 | + sendMail(this.sendForm).then(response => { | |
| 342 | + this.$modal.msgSuccess("提交发送成功!发送结果,见发送日志编号:" + response.data); | |
| 343 | + this.sendOpen = false; | |
| 344 | + }); | |
| 345 | + }); | |
| 346 | + }, | |
| 347 | + } | |
| 348 | +}; | |
| 349 | +</script> | ... | ... |
yudao-ui-admin/src/views/system/sms/smsLog.vue
| ... | ... | @@ -94,7 +94,7 @@ |
| 94 | 94 | </el-table-column> |
| 95 | 95 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 96 | 96 | <template v-slot="scope"> |
| 97 | - <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)" | |
| 97 | + <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" | |
| 98 | 98 | v-hasPermi="['system:sms-log:query']">详细</el-button> |
| 99 | 99 | </template> |
| 100 | 100 | </el-table-column> | ... | ... |
yudao-ui-admin/src/views/system/sms/smsTemplate.vue
| ... | ... | @@ -216,7 +216,7 @@ export default { |
| 216 | 216 | }, |
| 217 | 217 | sendSmsRules: { |
| 218 | 218 | mobile: [{ required: true, message: "手机不能为空", trigger: "blur" }], |
| 219 | - templateCode: [{ required: true, message: "手机不能为空", trigger: "blur" }], | |
| 219 | + templateCode: [{ required: true, message: "模版编码不能为空", trigger: "blur" }], | |
| 220 | 220 | templateParams: { } |
| 221 | 221 | } |
| 222 | 222 | }; | ... | ... |