diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java index 88cfeb7a4..2252c8789 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java @@ -5,14 +5,19 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateRespVO; import cn.iocoder.yudao.module.system.convert.mail.MailLogConvert; +import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; import cn.iocoder.yudao.module.system.service.mail.MailLogService; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -37,4 +42,13 @@ public class MailLogController { return success(MailLogConvert.INSTANCE.convertPage(pageResult)); } + @GetMapping("/get") + @ApiOperation("获得邮箱日志") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('system:mail-log:query')") + public CommonResult getMailTemplate(@RequestParam("id") Long id) { + MailLogDO mailLogDO = mailLogService.getMailLog(id); + return success(MailLogConvert.INSTANCE.convert(mailLogDO)); + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailLogConvert.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailLogConvert.java index f4a729c5c..c5599e355 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailLogConvert.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailLogConvert.java @@ -13,4 +13,6 @@ public interface MailLogConvert { PageResult convertPage(PageResult pageResult); + MailLogRespVO convert(MailLogDO bean); + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java index 859b93c75..703467141 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java @@ -24,6 +24,14 @@ public interface MailLogService { */ PageResult getMailLogPage(MailLogPageReqVO pageVO); + /** + * 获得指定编号的邮件日志 + * + * @param id 日志编号 + * @return 邮件日志 + */ + MailLogDO getMailLog(Long id); + /** * 创建邮件日志 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImpl.java index 997eb3d88..743c3a4c7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogServiceImpl.java @@ -35,6 +35,11 @@ public class MailLogServiceImpl implements MailLogService { return mailLogMapper.selectPage(pageVO); } + @Override + public MailLogDO getMailLog(Long id) { + return mailLogMapper.selectById(id); + } + @Override public Long createMailLog(Long userId, Integer userType, String toMail, MailAccountDO account, MailTemplateDO template, diff --git a/yudao-ui-admin-vue3/src/api/system/mail/log/index.ts b/yudao-ui-admin-vue3/src/api/system/mail/log/index.ts new file mode 100644 index 000000000..9c6c60eb2 --- /dev/null +++ b/yudao-ui-admin-vue3/src/api/system/mail/log/index.ts @@ -0,0 +1,40 @@ +import request from '@/config/axios' + +export interface MailLogVO { + id: number + userId: number + userType: number + toMail: string + accountId: number + fromMail: string + templateId: number + templateCode: string + templateNickname: string + templateTitle: string + templateContent: string + templateParams: string + sendStatus: number + sendTime: Date + sendMessageId: string + sendException: string +} + +export interface MailLogPageReqVO extends PageParam { + userId?: number + userType?: number + toMail?: string + accountId?: number + templateId?: number + sendStatus?: number + sendTime?: Date[] +} + +// 查询邮件日志列表 +export const getMailLogPageApi = async (params: MailLogPageReqVO) => { + return await request.get({ url: '/system/mail-log/page', params }) +} + +// 查询邮件日志详情 +export const getMailLogApi = async (id: number) => { + return await request.get({ url: '/system/mail-log/get?id=' + id }) +} diff --git a/yudao-ui-admin-vue3/src/utils/dict.ts b/yudao-ui-admin-vue3/src/utils/dict.ts index 5e168e301..176ddf92d 100644 --- a/yudao-ui-admin-vue3/src/utils/dict.ts +++ b/yudao-ui-admin-vue3/src/utils/dict.ts @@ -90,6 +90,7 @@ export enum DICT_TYPE { SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status', SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type', SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type', + SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status', // ========== INFRA 模块 ========== INFRA_BOOLEAN_STRING = 'infra_boolean_string', diff --git a/yudao-ui-admin-vue3/src/views/system/mail/log/index.vue b/yudao-ui-admin-vue3/src/views/system/mail/log/index.vue new file mode 100644 index 000000000..be9648200 --- /dev/null +++ b/yudao-ui-admin-vue3/src/views/system/mail/log/index.vue @@ -0,0 +1,96 @@ + + diff --git a/yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts b/yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts new file mode 100644 index 000000000..d389bce58 --- /dev/null +++ b/yudao-ui-admin-vue3/src/views/system/mail/log/log.data.ts @@ -0,0 +1,121 @@ +import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' + +// CrudSchema +const crudSchemas = reactive({ + primaryKey: 'id', + primaryTitle: '编号', + primaryType: 'id', + action: true, + actionWidth: '70', + columns: [ + { + title: '发送时间', + field: 'sendTime', + table: { + width: 180 + }, + formatter: 'formatDate', + search: { + show: true, + itemRender: { + name: 'XDataTimePicker' + } + } + }, + { + title: '接收邮箱', + field: 'toMail', + isSearch: true, + table: { + width: 180, + slots: { + default: 'toMail_default' + } + } + }, + { + title: '用户编号', + field: 'userId', + isSearch: true, + isTable: false + }, + { + title: '用户类型', + field: 'userType', + dictType: DICT_TYPE.USER_TYPE, + dictClass: 'number', + isSearch: true, + isTable: false + }, + { + title: '邮件标题', + field: 'templateTitle' + }, + { + title: '邮件内容', + field: 'templateContent', + isTable: false + }, + { + title: '邮箱参数', + field: 'templateParams', + isTable: false + }, + { + title: '发送状态', + field: 'sendStatus', + dictType: DICT_TYPE.SYSTEM_MAIL_SEND_STATUS, + dictClass: 'string', + isSearch: true + }, + { + title: '邮箱账号', + field: 'accountId', + isSearch: true, + isTable: false, + search: { + slots: { + default: 'accountId_search' + } + } + }, + { + title: '发送邮箱地址', + field: 'fromMail', + table: { + title: '邮箱账号' + } + }, + { + title: '模板编号', + field: 'templateId', + isSearch: true + }, + { + title: '模板编码', + field: 'templateCode', + isTable: false + }, + { + title: '模版发送人名称', + field: 'templateNickname', + isTable: false + }, + { + title: '发送返回的消息编号', + field: 'sendMessageId', + isTable: false + }, + { + title: '发送异常', + field: 'sendException', + isTable: false + }, + { + title: '创建时间', + field: 'createTime', + isTable: false + } + ] +}) +export const { allSchemas } = useVxeCrudSchemas(crudSchemas)