|
|
@@ -0,0 +1,39 @@
|
|
|
+package com.storlead.mail.common;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.storlead.framework.common.result.Result;
|
|
|
+import com.storlead.sales.mail.common.entity.MailServerPortConfigEntity;
|
|
|
+import com.storlead.sales.mail.common.service.MailServerPortConfigService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/common")
|
|
|
+@Api(tags = "021. 邮件公共配置接口")
|
|
|
+@Log4j2
|
|
|
+public class MailCommonApiController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MailServerPortConfigService serverPortConfigService;
|
|
|
+
|
|
|
+ @PostMapping(value = "/mail_port_config")
|
|
|
+ @ApiOperation(value = "获取邮箱端口配置", notes = "获取邮箱端口配置")
|
|
|
+ public Result getMailPortConfig(String mailAccount) throws IOException {
|
|
|
+ if (StrUtil.isBlank(mailAccount)) {
|
|
|
+ return Result.result("参数错误");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<MailServerPortConfigEntity> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(MailServerPortConfigEntity::getMailServerSuffix, EmailServiceChecker.getEmailService(mailAccount));
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
+ MailServerPortConfigEntity portConfig = serverPortConfigService.getOne(queryWrapper);
|
|
|
+ return Result.result(portConfig);
|
|
|
+ }
|
|
|
+}
|