diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java index 33469e3c2..0fb95087a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java @@ -30,7 +30,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @RequestMapping("/system/mail-account") public class MailAccountController { @Resource - private MailAccountService mailAccountService; + private MailAccountService mailAccountService; // TODO @wangjingyi:属性和类名,中间要空一行 @PostMapping("/create") @ApiOperation("创建邮箱账号") @@ -50,7 +50,7 @@ public class MailAccountController { @DeleteMapping("/delete") @ApiOperation("删除邮箱账号") - @PreAuthorize("@ss.hasPermission('system:mail-account:delete')") + @PreAuthorize("@ss.hasPermission('system:mail-account:delete')") // TODO @wangjingyi:id 应该是 @RequestParam。另外,id 的 swagger 注解,要写下 public CommonResult deleteMailAccount(@Valid @RequestBody Long id) { mailAccountService.delete(id); return success(true); @@ -63,7 +63,7 @@ public class MailAccountController { public CommonResult getMailAccount(@RequestParam("id") Long id) { MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id); return success(MailAccountConvert.INSTANCE.convert(mailAccountDO)); - } + } // TODO wangjingyi:方法与方法之间,只空一行 @GetMapping("/page") @@ -82,7 +82,7 @@ public class MailAccountController { list.sort(Comparator.comparing(MailAccountDO::getId)); return success(MailAccountConvert.INSTANCE.convertList02(list)); } - @PostMapping("/send") + @PostMapping("/send") // TODO wangjingyi:方法与方法之间,空一行 @ApiOperation("发送邮件") @PreAuthorize("@ss.hasPermission('system:mail-account:send')") public CommonResult sendMail(MailSendVO mailSendVO){ diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java index b07801cee..9dc681962 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; import lombok.Data; -@Data -public class MailAccountCreateReqVO extends MailAccountBaseVO{ +@Data // TODO @wangjingyi:swagger 注解 +public class MailAccountCreateReqVO extends MailAccountBaseVO{ // TODO @wangjingyi:要空格再 { } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java index 9482ce474..925e7cd44 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java @@ -5,4 +5,6 @@ import lombok.Data; @Data public class MailAccountUpdateReqVO extends MailAccountBaseVO{ + // TODO @wangjingyi:更新的话,是不是要有个 id??? + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java index 41d9d03b4..4d1bd9a5f 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/send/MailSendVO.java @@ -5,7 +5,7 @@ import lombok.Data; import java.util.List; @Data -public class MailSendVO { +public class MailSendVO { // TODO @wangjingyi:1)参数校验;2)ReqVO @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com") private String from; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java index 3cc0acb02..464c43205 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java @@ -13,12 +13,12 @@ import java.util.List; /** *

* 邮箱账号 Service 接口 - *

+ *

// TODO wangjingyi:不用

标签; * * @author wangjingyi * @since 2022-03-21 */ -public interface MailAccountService { +public interface MailAccountService { // TODO wangjingyi:方法的注释 Long create(MailAccountCreateReqVO createReqVO); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java index 0c0d86eba..c4610222a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java @@ -62,7 +62,7 @@ public class MailAccountServiceImpl implements MailAccountService { this.validateMailAccountOnly(map); MailAccountDO mailAccountDO = MailAccountConvert.INSTANCE.convert(updateReqVO); // 校验是否存在 - this.validateMailAccountExists(mailAccountDO.getId()); + this.validateMailAccountExists(mailAccountDO.getId()); // TODO wangjingyi:没有传递 id 噢 mailAccountMapper.updateById(mailAccountDO); } @@ -92,6 +92,7 @@ public class MailAccountServiceImpl implements MailAccountService { @Override public void sendMail(MailSendVO mailSendVO) { // FIXME 查询模版信息 查询模版多条时 使用规则是什么 + // 回复:选择某一条模板,进行发送邮件。 List mailTemplateDOList = mailTemplateMapper.selectList( "username",mailSendVO.getFrom() ); @@ -100,6 +101,7 @@ public class MailAccountServiceImpl implements MailAccountService { "from",mailSendVO.getFrom() ); // FIXME 模版和邮件内容合成方式未知 + // 回复:参考短信的方式,通过 {name} {mobile} 这样的占位符。搜 formatSmsTemplateContent 方法 String content = mailSendVO.getContent(); String templateContent = ""; // 后续功能 TODO :附件查询 @@ -119,9 +121,10 @@ public class MailAccountServiceImpl implements MailAccountService { } private void validateMailAccountOnly(Map params){ + // TODO wangjingyi:Service 里,不允许出现 MyBatis 操作。而是 Mapper 提供对应查询方法 QueryWrapper queryWrapper = new QueryWrapper(); params.forEach((k , v)->{ - queryWrapper.like(k , v); + queryWrapper.like(k , v); // TODO wangjingyi:账号,应该是 equlas,不能是 like }); if (mailAccountMapper.selectOne(queryWrapper) != null) { throw exception(MAIL_ACCOUNT_EXISTS);