fix: 邮件模板配置用户
This commit is contained in:
parent
a3dfe63e92
commit
4c3a2e87d0
|
@ -20,6 +20,10 @@ public class EmailTemplateAddDto {
|
||||||
@NotNull(message = "模板名称不能为空")
|
@NotNull(message = "模板名称不能为空")
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
|
@Schema(name = "emailUser", title = "配置邮件用户")
|
||||||
|
@NotNull(message = "配置邮件用户不能为空")
|
||||||
|
private Long emailUser;
|
||||||
|
|
||||||
@Schema(name = "subject", title = "主题")
|
@Schema(name = "subject", title = "主题")
|
||||||
@NotBlank(message = "主题不能为空")
|
@NotBlank(message = "主题不能为空")
|
||||||
@NotNull(message = "主题不能为空")
|
@NotNull(message = "主题不能为空")
|
||||||
|
|
|
@ -18,12 +18,16 @@ public class EmailTemplateUpdateDto {
|
||||||
@Schema(name = "id", title = "主键")
|
@Schema(name = "id", title = "主键")
|
||||||
@NotNull(message = "id不能为空")
|
@NotNull(message = "id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(name = "templateName", title = "模板名称")
|
@Schema(name = "templateName", title = "模板名称")
|
||||||
@NotBlank(message = "模板名称不能为空")
|
@NotBlank(message = "模板名称不能为空")
|
||||||
@NotNull(message = "模板名称不能为空")
|
@NotNull(message = "模板名称不能为空")
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
|
@Schema(name = "emailUser", title = "配置邮件用户")
|
||||||
|
@NotNull(message = "配置邮件用户不能为空")
|
||||||
|
private Long emailUser;
|
||||||
|
|
||||||
@Schema(name = "subject", title = "主题")
|
@Schema(name = "subject", title = "主题")
|
||||||
@NotBlank(message = "主题不能为空")
|
@NotBlank(message = "主题不能为空")
|
||||||
@NotNull(message = "主题不能为空")
|
@NotNull(message = "主题不能为空")
|
||||||
|
|
|
@ -25,6 +25,9 @@ public class EmailTemplate extends BaseEntity {
|
||||||
@Schema(name = "templateName", title = "模板名称")
|
@Schema(name = "templateName", title = "模板名称")
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
|
@Schema(name = "emailUser", title = "模板名称")
|
||||||
|
private Long emailUser;
|
||||||
|
|
||||||
@Schema(name = "subject", title = "主题")
|
@Schema(name = "subject", title = "主题")
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package cn.bunny.dao.vo.system.email;
|
package cn.bunny.dao.vo.system.email;
|
||||||
|
|
||||||
import cn.bunny.dao.vo.BaseVo;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
@ -15,6 +18,14 @@ public class EmailTemplateVo extends BaseVo {
|
||||||
@Schema(name = "templateName", title = "模板名称")
|
@Schema(name = "templateName", title = "模板名称")
|
||||||
private String templateName;
|
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 = "主题")
|
@Schema(name = "subject", title = "主题")
|
||||||
private String subject;
|
private String subject;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -50,6 +51,13 @@ public class EmailUsersController {
|
||||||
return Mono.just(Result.success(pageResult));
|
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 = "添加邮箱用户发送配置")
|
@Operation(summary = "添加邮箱用户发送配置", description = "添加邮箱用户发送配置")
|
||||||
@PostMapping("addEmailUsers")
|
@PostMapping("addEmailUsers")
|
||||||
public Mono<Result<String>> addEmailUsers(@Valid @RequestBody EmailUsersAddDto dto) {
|
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 jakarta.validation.Valid;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -57,4 +58,12 @@ public interface EmailUsersService extends IService<EmailUsers> {
|
||||||
* @param dto 邮箱用户更新状态表单
|
* @param dto 邮箱用户更新状态表单
|
||||||
*/
|
*/
|
||||||
void updateEmailUserStatus(EmailUserUpdateStatusDto 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.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -71,9 +73,8 @@ public class EmailUsersServiceImpl extends ServiceImpl<EmailUsersMapper, EmailUs
|
||||||
* @param dto 邮箱用户发送配置添加
|
* @param dto 邮箱用户发送配置添加
|
||||||
*/
|
*/
|
||||||
@Override
|
@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()));
|
List<EmailUsers> emailUsersList = list(Wrappers.<EmailUsers>lambdaQuery().eq(EmailUsers::getEmail, dto.getEmail()));
|
||||||
if (!emailUsersList.isEmpty()) throw new BunnyException(ResultCodeEnum.EMAIL_EXIST);
|
if (!emailUsersList.isEmpty()) throw new BunnyException(ResultCodeEnum.EMAIL_EXIST);
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ public class EmailUsersServiceImpl extends ServiceImpl<EmailUsersMapper, EmailUs
|
||||||
public void deleteEmailUsers(List<Long> ids) {
|
public void deleteEmailUsers(List<Long> ids) {
|
||||||
// 判断数据请求是否为空
|
// 判断数据请求是否为空
|
||||||
if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY);
|
if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY);
|
||||||
|
|
||||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,4 +131,19 @@ public class EmailUsersServiceImpl extends ServiceImpl<EmailUsersMapper, EmailUs
|
||||||
BeanUtils.copyProperties(dto, emailUsers);
|
BeanUtils.copyProperties(dto, emailUsers);
|
||||||
updateById(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:
|
quartz:
|
||||||
job-store-type: jdbc
|
job-store-type: jdbc
|
||||||
jdbc:
|
jdbc:
|
||||||
initialize-schema: always
|
initialize-schema: embedded
|
||||||
auto-startup: true
|
auto-startup: true
|
||||||
wait-for-jobs-to-complete-on-shutdown: true
|
wait-for-jobs-to-complete-on-shutdown: true
|
||||||
overwrite-existing-jobs: false
|
overwrite-existing-jobs: false
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<id column="update_user" property="updateUser"/>
|
<id column="update_user" property="updateUser"/>
|
||||||
<id column="is_deleted" property="isDeleted"/>
|
<id column="is_deleted" property="isDeleted"/>
|
||||||
<id column="template_name" property="templateName"/>
|
<id column="template_name" property="templateName"/>
|
||||||
|
<id column="email_user" property="emailUser"/>
|
||||||
<id column="subject" property="subject"/>
|
<id column="subject" property="subject"/>
|
||||||
<id column="body" property="body"/>
|
<id column="body" property="body"/>
|
||||||
<id column="type" property="type"/>
|
<id column="type" property="type"/>
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<!-- 分页查询邮件模板表内容 -->
|
<!-- 分页查询邮件模板表内容 -->
|
||||||
|
|
Loading…
Reference in New Issue