fix: 邮件模板配置用户
This commit is contained in:
parent
a3dfe63e92
commit
4c3a2e87d0
|
@ -20,6 +20,10 @@ public class EmailTemplateAddDto {
|
|||
@NotNull(message = "模板名称不能为空")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "emailUser", title = "配置邮件用户")
|
||||
@NotNull(message = "配置邮件用户不能为空")
|
||||
private Long emailUser;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
@NotBlank(message = "主题不能为空")
|
||||
@NotNull(message = "主题不能为空")
|
||||
|
|
|
@ -24,6 +24,10 @@ public class EmailTemplateUpdateDto {
|
|||
@NotNull(message = "模板名称不能为空")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "emailUser", title = "配置邮件用户")
|
||||
@NotNull(message = "配置邮件用户不能为空")
|
||||
private Long emailUser;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
@NotBlank(message = "主题不能为空")
|
||||
@NotNull(message = "主题不能为空")
|
||||
|
|
|
@ -25,6 +25,9 @@ public class EmailTemplate extends BaseEntity {
|
|||
@Schema(name = "templateName", title = "模板名称")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "emailUser", title = "模板名称")
|
||||
private Long emailUser;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
private String subject;
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package cn.bunny.dao.vo.system.email;
|
||||
|
||||
import cn.bunny.dao.vo.BaseVo;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
|
@ -15,6 +18,14 @@ public class EmailTemplateVo extends BaseVo {
|
|||
@Schema(name = "templateName", title = "模板名称")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "emailUser", title = "配置邮件用户")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
@JSONField(serializeUsing = ToStringSerializer.class)
|
||||
private Long emailUser;
|
||||
|
||||
@Schema(name = "emailUsername", title = "邮箱账户")
|
||||
private String emailUsername;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
private String subject;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -50,6 +51,13 @@ public class EmailUsersController {
|
|||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有邮箱配置用户", description = "获取所有邮箱配置用户")
|
||||
@GetMapping("getAllMailboxConfigurationUsers")
|
||||
public Mono<Result<List<Map<String, String>>>> getAllMailboxConfigurationUsers() {
|
||||
List<Map<String, String>> list = emailUsersService.getAllMailboxConfigurationUsers();
|
||||
return Mono.just(Result.success(list));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加邮箱用户发送配置", description = "添加邮箱用户发送配置")
|
||||
@PostMapping("addEmailUsers")
|
||||
public Mono<Result<String>> addEmailUsers(@Valid @RequestBody EmailUsersAddDto dto) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -57,4 +58,12 @@ public interface EmailUsersService extends IService<EmailUsers> {
|
|||
* @param dto 邮箱用户更新状态表单
|
||||
*/
|
||||
void updateEmailUserStatus(EmailUserUpdateStatusDto dto);
|
||||
|
||||
/**
|
||||
* * 获取所有邮箱配置用户
|
||||
*
|
||||
* @return 邮件用户列表
|
||||
*/
|
||||
List<Map<String, String>> getAllMailboxConfigurationUsers();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -71,9 +73,8 @@ public class EmailUsersServiceImpl extends ServiceImpl<EmailUsersMapper, EmailUs
|
|||
* @param dto 邮箱用户发送配置添加
|
||||
*/
|
||||
@Override
|
||||
public void addEmailUsers(@Valid EmailUsersAddDto dto) {
|
||||
public void addEmailUsers(EmailUsersAddDto dto) {
|
||||
// 判断邮箱是否添加
|
||||
String email = dto.getEmail();
|
||||
List<EmailUsers> emailUsersList = list(Wrappers.<EmailUsers>lambdaQuery().eq(EmailUsers::getEmail, dto.getEmail()));
|
||||
if (!emailUsersList.isEmpty()) throw new BunnyException(ResultCodeEnum.EMAIL_EXIST);
|
||||
|
||||
|
@ -130,4 +131,19 @@ public class EmailUsersServiceImpl extends ServiceImpl<EmailUsersMapper, EmailUs
|
|||
BeanUtils.copyProperties(dto, emailUsers);
|
||||
updateById(emailUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 获取所有邮箱配置用户
|
||||
*
|
||||
* @return 邮件用户列表
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, String>> getAllMailboxConfigurationUsers() {
|
||||
return list().stream().map(emailUsers -> {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("key", emailUsers.getEmail());
|
||||
map.put("value", emailUsers.getId().toString());
|
||||
return map;
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ spring:
|
|||
quartz:
|
||||
job-store-type: jdbc
|
||||
jdbc:
|
||||
initialize-schema: always
|
||||
initialize-schema: embedded
|
||||
auto-startup: true
|
||||
wait-for-jobs-to-complete-on-shutdown: true
|
||||
overwrite-existing-jobs: false
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<id column="update_user" property="updateUser"/>
|
||||
<id column="is_deleted" property="isDeleted"/>
|
||||
<id column="template_name" property="templateName"/>
|
||||
<id column="email_user" property="emailUser"/>
|
||||
<id column="subject" property="subject"/>
|
||||
<id column="body" property="body"/>
|
||||
<id column="type" property="type"/>
|
||||
|
@ -19,7 +20,7 @@
|
|||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, create_time, update_time, create_user, update_user, is_deleted, template_name, subject, body, type, is_default
|
||||
id, create_time, update_time, create_user, update_user, is_deleted, template_name, email_user, subject, body, type, is_default
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询邮件模板表内容 -->
|
||||
|
|
Loading…
Reference in New Issue