Merge remote-tracking branch 'origin/master'
# Conflicts: # sql/mysql/optional/vue3-menu.sql # sql/mysql/ruoyi-vue-pro.sql # yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/permission/MenuServiceTest.java
This commit is contained in:
@@ -30,12 +30,12 @@ public interface DeptApi {
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@ApiOperation("获得部门信息数组")
|
||||
@ApiImplicitParam(name = "ids", value = "部门编号数组", example = "1,2", required = true, allowMultiple = true)
|
||||
CommonResult<List<DeptRespDTO>> getDepts(@RequestParam("ids") Collection<Long> ids);
|
||||
CommonResult<List<DeptRespDTO>> getDeptList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@ApiOperation("校验部门是否合法")
|
||||
@ApiImplicitParam(name = "ids", value = "部门编号数组", example = "1,2", required = true, allowMultiple = true)
|
||||
CommonResult<Boolean> validDepts(@RequestParam("ids") Collection<Long> ids);
|
||||
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得指定编号的部门 Map
|
||||
@@ -44,7 +44,7 @@ public interface DeptApi {
|
||||
* @return 部门 Map
|
||||
*/
|
||||
default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
|
||||
return CollectionUtils.convertMap(getDepts(ids).getCheckedData(), DeptRespDTO::getId);
|
||||
return CollectionUtils.convertMap(getDeptList(ids).getCheckedData(), DeptRespDTO::getId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ public interface PostApi {
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@ApiOperation("校验岗位是否合法")
|
||||
@ApiImplicitParam(name = "ids", value = "岗位编号数组", example = "1,2", required = true, allowMultiple = true)
|
||||
CommonResult<Boolean> validPosts(@RequestParam("ids") Collection<Long> ids);
|
||||
CommonResult<Boolean> validPostList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ public interface DictDataApi {
|
||||
@ApiImplicitParam(name = "dictType", value = "字典类型", example = "SEX", required = true, dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "values", value = "字典数据值的数组", example = "1,2", required = true, allowMultiple = true)
|
||||
})
|
||||
CommonResult<Boolean> validDictDatas(@RequestParam("dictType") String dictType,
|
||||
@RequestParam("values") Collection<String> values);
|
||||
CommonResult<Boolean> validateDictDatas(@RequestParam("dictType") String dictType,
|
||||
@RequestParam("values") Collection<String> values);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@ApiOperation("获得指定的字典数据")
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@@ -27,7 +26,7 @@ public interface ErrorCodeApi {
|
||||
|
||||
@PostMapping(PREFIX + "/auto-generate")
|
||||
@ApiOperation("自动创建错误码")
|
||||
CommonResult<Boolean> autoGenerateErrorCodes(@Valid @RequestBody List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
|
||||
CommonResult<Boolean> autoGenerateErrorCodeList(@Valid @RequestBody List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs);
|
||||
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@ApiOperation(value = "增量获得错误码数组", notes = "如果 minUpdateTime 为空时,则获取所有错误码")
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.api.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Api(tags = "RPC 服务 - 邮件发送")
|
||||
public interface MailSendApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/mail/send";
|
||||
|
||||
@PostMapping(PREFIX + "/send-single-admin")
|
||||
@ApiOperation(value = "发送单条邮件给 Admin 用户", notes = "在 mail 为空时,使用 userId 加载对应 Admin 的邮箱")
|
||||
CommonResult<Long> sendSingleMailToAdmin(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||
|
||||
@PostMapping(PREFIX + "/send-single-member")
|
||||
@ApiOperation(value = "发送单条邮件给 Member 用户", notes = "在 mail 为空时,使用 userId 加载对应 Member 的邮箱")
|
||||
CommonResult<Long> sendSingleMailToMember(@Valid MailSendSingleToUserReqDTO reqDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.api.mail.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel("RPC 服务 - 邮件发送给 Admin 或者 Member 用户 Request DTO")
|
||||
@Data
|
||||
public class MailSendSingleToUserReqDTO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "1024")
|
||||
private Long userId;
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
@Email
|
||||
private String mail;
|
||||
|
||||
@ApiModelProperty(value = "邮件模板编号", required = true, example = "USER_SEND")
|
||||
@NotNull(message = "邮件模板编号不能为空")
|
||||
private String templateCode;
|
||||
@ApiModelProperty(value = "邮件模板参数")
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.api.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Api(tags = "RPC 服务 - 站内信发送")
|
||||
public interface NotifyMessageSendApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/notify/send";
|
||||
|
||||
@PostMapping(PREFIX + "/send-single-admin")
|
||||
@ApiOperation(value = "发送单条站内信给 Admin 用户")
|
||||
CommonResult<Long> sendSingleMessageToAdmin(@Valid NotifySendSingleToUserReqDTO reqDTO);
|
||||
|
||||
@PostMapping(PREFIX + "/send-single-member")
|
||||
@ApiOperation(value = "发送单条站内信给 Member 用户")
|
||||
CommonResult<Long> sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.api.notify.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel("RPC 服务 - 站内信发送给 Admin 或者 Member 用户 Request DTO")
|
||||
@Data
|
||||
public class NotifySendSingleToUserReqDTO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1024")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "站内信模板编号", required = true, example = "USER_SEND")
|
||||
@NotEmpty(message = "站内信模板编号不能为空")
|
||||
private String templateCode;
|
||||
@ApiModelProperty(value = "邮件模板参数")
|
||||
private Map<String, Object> templateParams;
|
||||
}
|
||||
@@ -20,6 +20,6 @@ public interface RoleApi {
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@ApiOperation("校验角色是否合法")
|
||||
@ApiImplicitParam(name = "ids", value = "角色编号数组", example = "1,2", required = true, allowMultiple = true)
|
||||
CommonResult<Boolean> validRoles(@RequestParam("ids") Collection<Long> ids);
|
||||
CommonResult<Boolean> validRoleList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.api.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeCheckReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
@@ -29,8 +29,8 @@ public interface SmsCodeApi {
|
||||
@ApiOperation("验证短信验证码,并进行使用")
|
||||
CommonResult<Boolean> useSmsCode(@Valid @RequestBody SmsCodeUseReqDTO reqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/check")
|
||||
@GetMapping(PREFIX + "/validate")
|
||||
@ApiOperation("检查验证码是否有效")
|
||||
CommonResult<Boolean> checkSmsCode(@Valid @RequestBody SmsCodeCheckReqDTO reqDTO);
|
||||
CommonResult<Boolean> validateSmsCode(@Valid @RequestBody SmsCodeValidateReqDTO reqDTO);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("RPC 服务 - 短信验证码的校验 Request DTO")
|
||||
@Data
|
||||
public class SmsCodeCheckReqDTO {
|
||||
public class SmsCodeValidateReqDTO {
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
@Mobile
|
||||
@@ -18,7 +18,8 @@ public class SmsSendSingleToUserReqDTO {
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "USER_SEND")
|
||||
|
||||
@ApiModelProperty(value = "短信模板编号", required = true, example = "USER_SEND")
|
||||
@NotEmpty(message = "短信模板编号不能为空")
|
||||
private String templateCode;
|
||||
@ApiModelProperty(value = "短信模板参数")
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface SocialUserApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/social-user";
|
||||
|
||||
@GetMapping("/get-authorize-url")
|
||||
@GetMapping(PREFIX + "/get-authorize-url")
|
||||
@ApiOperation("获得社交平台的授权 URL")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "社交平台的类型", example = "1", required = true, dataTypeClass = Integer.class),
|
||||
@@ -28,15 +28,15 @@ public interface SocialUserApi {
|
||||
CommonResult<String> getAuthorizeUrl(@RequestParam("type") Integer type,
|
||||
@RequestParam("redirectUri") String redirectUri);
|
||||
|
||||
@PostMapping("/bind")
|
||||
@PostMapping(PREFIX + "/bind")
|
||||
@ApiOperation("绑定社交用户")
|
||||
CommonResult<Boolean> bindSocialUser(@Valid @RequestBody SocialUserBindReqDTO reqDTO);
|
||||
|
||||
@DeleteMapping("/unbind")
|
||||
@DeleteMapping(PREFIX + "/unbind")
|
||||
@ApiOperation("取消绑定社交用户")
|
||||
CommonResult<Boolean> unbindSocialUser(@Valid @RequestBody SocialUserUnbindReqDTO reqDTO);
|
||||
|
||||
@GetMapping("/get-bind-user-id")
|
||||
@GetMapping(PREFIX + "/get-bind-user-id")
|
||||
@ApiOperation("获得社交用户的绑定用户编号")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userType", value = "用户类型", example = "2", required = true, dataTypeClass = Integer.class),
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface TenantApi {
|
||||
|
||||
@GetMapping(PREFIX + "/id-list")
|
||||
@ApiOperation("获得所有租户编号")
|
||||
CommonResult<List<Long>> getTenantIds();
|
||||
CommonResult<List<Long>> getTenantIdList();
|
||||
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@ApiOperation("校验租户是否合法")
|
||||
|
||||
@@ -30,17 +30,17 @@ public interface AdminUserApi {
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@ApiOperation("通过用户 ID 查询用户们")
|
||||
@ApiImplicitParam(name = "ids", value = "部门编号数组", example = "1,2", required = true, allowMultiple = true)
|
||||
CommonResult<List<AdminUserRespDTO>> getUsers(@RequestParam("ids") Collection<Long> ids);
|
||||
CommonResult<List<AdminUserRespDTO>> getUserList(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-dept-id")
|
||||
@ApiOperation("获得指定部门的用户数组")
|
||||
@ApiImplicitParam(name = "deptIds", value = "部门编号数组", example = "1,2", required = true, allowMultiple = true)
|
||||
CommonResult<List<AdminUserRespDTO>> getUsersByDeptIds(@RequestParam("deptIds") Collection<Long> deptIds);
|
||||
CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(@RequestParam("deptIds") Collection<Long> deptIds);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-post-id")
|
||||
@ApiOperation("获得指定岗位的用户数组")
|
||||
@ApiImplicitParam(name = "postIds", value = "岗位编号数组", example = "2,3", required = true, allowMultiple = true)
|
||||
CommonResult<List<AdminUserRespDTO>> getUsersByPostIds(@RequestParam("postIds") Collection<Long> postIds);
|
||||
CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(@RequestParam("postIds") Collection<Long> postIds);
|
||||
|
||||
/**
|
||||
* 获得用户 Map
|
||||
@@ -49,12 +49,12 @@ public interface AdminUserApi {
|
||||
* @return 用户 Map
|
||||
*/
|
||||
default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) {
|
||||
return CollectionUtils.convertMap(getUsers(ids).getCheckedData(), AdminUserRespDTO::getId);
|
||||
return CollectionUtils.convertMap(getUserList(ids).getCheckedData(), AdminUserRespDTO::getId);
|
||||
}
|
||||
|
||||
@GetMapping(PREFIX + "/valid")
|
||||
@ApiOperation("校验用户们是否有效")
|
||||
@ApiImplicitParam(name = "ids", value = "用户编号数组", example = "3,5", required = true)
|
||||
CommonResult<Boolean> validUsers(@RequestParam("ids") Set<Long> ids);
|
||||
CommonResult<Boolean> validUserList(@RequestParam("ids") Set<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1002004003, "存在子部门,无法删除");
|
||||
ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1002004004, "不能设置自己为父部门");
|
||||
ErrorCode DEPT_EXISTS_USER = new ErrorCode(1002004005, "部门中存在员工,无法删除");
|
||||
ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004006, "部门不处于开启状态,不允许选择");
|
||||
ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1002004006, "部门({})不处于开启状态,不允许选择");
|
||||
ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1002004007, "不能设置自己的子部门为父部门");
|
||||
|
||||
// ========== 岗位模块 1002005000 ==========
|
||||
@@ -141,4 +141,25 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在");
|
||||
ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022001, "code 已过期");
|
||||
|
||||
// ========== 邮箱账号 1002023000 ==========
|
||||
ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002023000, "邮箱账号不存在");
|
||||
ErrorCode MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS = new ErrorCode(1002023001, "无法删除,该邮箱账号还有邮件模板");
|
||||
|
||||
// ========== 邮件模版 1002024000 ==========
|
||||
ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002024000, "邮件模版不存在");
|
||||
ErrorCode MAIL_TEMPLATE_CODE_EXISTS = new ErrorCode(1002024001, "邮件模版 code({}) 已存在");
|
||||
|
||||
// ========== 邮件发送 1002025000 ==========
|
||||
ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
|
||||
ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1002025000, "邮箱不存在");
|
||||
|
||||
// ========== 站内信模版 1002026000 ==========
|
||||
ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1002026000, "站内信模版不存在");
|
||||
ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1002026001, "已经存在编码为【{}】的站内信模板");
|
||||
|
||||
// ========== 站内信模版 1002027000 ==========
|
||||
|
||||
// ========== 站内信发送 1002028000 ==========
|
||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.enums.mail;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 邮件的发送状态枚举
|
||||
*
|
||||
* @author wangjingyi
|
||||
* @since 2022/4/10 13:39
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MailSendStatusEnum {
|
||||
|
||||
INIT(0), // 初始化
|
||||
SUCCESS(10), // 发送成功
|
||||
FAILURE(20), // 发送失败
|
||||
IGNORE(30), // 忽略,即不发送
|
||||
;
|
||||
|
||||
private final int status;
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.iocoder.yudao.module.system.enums.permission;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Menu 编号枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MenuIdEnum {
|
||||
|
||||
/**
|
||||
* 根节点
|
||||
*/
|
||||
ROOT(0L);
|
||||
|
||||
private final Long id;
|
||||
|
||||
}
|
||||
@@ -150,6 +150,11 @@
|
||||
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
|
||||
@@ -31,14 +31,14 @@ public class DeptApiImpl implements DeptApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<DeptRespDTO>> getDepts(Collection<Long> ids) {
|
||||
List<DeptDO> depts = deptService.getDepts(ids);
|
||||
public CommonResult<List<DeptRespDTO>> getDeptList(Collection<Long> ids) {
|
||||
List<DeptDO> depts = deptService.getDeptList(ids);
|
||||
return success(DeptConvert.INSTANCE.convertList03(depts));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validDepts(Collection<Long> ids) {
|
||||
deptService.validDepts(ids);
|
||||
public CommonResult<Boolean> validateDeptList(Collection<Long> ids) {
|
||||
deptService.validateDeptList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ public class PostApiImpl implements PostApi {
|
||||
private PostService postService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validPosts(Collection<Long> ids) {
|
||||
postService.validPosts(ids);
|
||||
public CommonResult<Boolean> validPostList(Collection<Long> ids) {
|
||||
postService.validatePostList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -25,8 +24,8 @@ public class DictDataApiImpl implements DictDataApi {
|
||||
private DictDataService dictDataService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validDictDatas(String dictType, Collection<String> values) {
|
||||
dictDataService.validDictDatas(dictType, values);
|
||||
public CommonResult<Boolean> validateDictDatas(String dictType, Collection<String> values) {
|
||||
dictDataService.validateDictDataList(dictType, values);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ErrorCodeApiImpl implements ErrorCodeApi {
|
||||
private ErrorCodeService errorCodeService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> autoGenerateErrorCodes(List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs) {
|
||||
public CommonResult<Boolean> autoGenerateErrorCodeList(List<ErrorCodeAutoGenerateReqDTO> autoGenerateDTOs) {
|
||||
errorCodeService.autoGenerateErrorCodes(autoGenerateDTOs);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.system.api.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.mail.dto.MailSendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.send.SmsSendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailSendService;
|
||||
import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
||||
@Validated
|
||||
public class MailSendApiImpl implements MailSendApi {
|
||||
|
||||
@Resource
|
||||
private MailSendService mailSendService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> sendSingleMailToAdmin(MailSendSingleToUserReqDTO reqDTO) {
|
||||
return success(mailSendService.sendSingleMailToAdmin(reqDTO.getMail(), reqDTO.getUserId(),
|
||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> sendSingleMailToMember(MailSendSingleToUserReqDTO reqDTO) {
|
||||
return success(mailSendService.sendSingleMailToMember(reqDTO.getMail(), reqDTO.getUserId(),
|
||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.api.notify.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||
import cn.iocoder.yudao.module.system.service.notify.NotifySendService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
||||
@Validated
|
||||
public class NotifyMessageSendApiImpl implements NotifyMessageSendApi {
|
||||
|
||||
@Resource
|
||||
private NotifySendService notifySendService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) {
|
||||
return success(notifySendService.sendSingleNotifyToAdmin(reqDTO.getUserId(),
|
||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) {
|
||||
return success(notifySendService.sendSingleNotifyToMember(reqDTO.getUserId(),
|
||||
reqDTO.getTemplateCode(), reqDTO.getTemplateParams()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,8 @@ public class RoleApiImpl implements RoleApi {
|
||||
private RoleService roleService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validRoles(Collection<Long> ids) {
|
||||
roleService.validRoles(ids);
|
||||
public CommonResult<Boolean> validRoleList(Collection<Long> ids) {
|
||||
roleService.validateRoleList(ids);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.api.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeCheckReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import cn.iocoder.yudao.module.system.service.sms.SmsCodeService;
|
||||
@@ -35,8 +35,8 @@ public class SmsCodeApiImpl implements SmsCodeApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> checkSmsCode(SmsCodeCheckReqDTO reqDTO) {
|
||||
smsCodeService.checkSmsCode(reqDTO);
|
||||
public CommonResult<Boolean> validateSmsCode(SmsCodeValidateReqDTO reqDTO) {
|
||||
smsCodeService.validateSmsCode(reqDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ public class TenantApiImpl implements TenantApi {
|
||||
private TenantService tenantService;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Long>> getTenantIds() {
|
||||
return success(tenantService.getTenantIds());
|
||||
public CommonResult<List<Long>> getTenantIdList() {
|
||||
return success(tenantService.getTenantIdList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,26 +33,26 @@ public class AdminUserApiImpl implements AdminUserApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsers(Collection<Long> ids) {
|
||||
List<AdminUserDO> users = userService.getUsers(ids);
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserList(Collection<Long> ids) {
|
||||
List<AdminUserDO> users = userService.getUserList(ids);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsersByDeptIds(Collection<Long> deptIds) {
|
||||
List<AdminUserDO> users = userService.getUsersByDeptIds(deptIds);
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserListByDeptIds(Collection<Long> deptIds) {
|
||||
List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<AdminUserRespDTO>> getUsersByPostIds(Collection<Long> postIds) {
|
||||
List<AdminUserDO> users = userService.getUsersByPostIds(postIds);
|
||||
public CommonResult<List<AdminUserRespDTO>> getUserListByPostIds(Collection<Long> postIds) {
|
||||
List<AdminUserDO> users = userService.getUserListByPostIds(postIds);
|
||||
return success(UserConvert.INSTANCE.convertList4(users));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validUsers(Set<Long> ids) {
|
||||
userService.validUsers(ids);
|
||||
public CommonResult<Boolean> validUserList(Set<Long> ids) {
|
||||
userService.validateUserList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class AuthController {
|
||||
}
|
||||
// 获得角色列表
|
||||
Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
List<RoleDO> roleList = roleService.getRolesFromCache(roleIds);
|
||||
List<RoleDO> roleList = roleService.getRoleListFromCache(roleIds);
|
||||
// 获得菜单列表
|
||||
List<MenuDO> menuList = permissionService.getRoleMenuListFromCache(roleIds,
|
||||
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()),
|
||||
@@ -109,7 +109,7 @@ public class AuthController {
|
||||
|
||||
@GetMapping("/list-menus")
|
||||
@ApiOperation("获得登录用户的菜单列表")
|
||||
public CommonResult<List<AuthMenuRespVO>> getMenus() {
|
||||
public CommonResult<List<AuthMenuRespVO>> getMenuList() {
|
||||
// 获得角色列表
|
||||
Set<Long> roleIds = permissionService.getUserRoleIdsFromCache(getLoginUserId(), singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
// 获得用户拥有的菜单列表
|
||||
|
||||
@@ -57,19 +57,19 @@ public class DeptController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取部门列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||
public CommonResult<List<DeptRespVO>> listDepts(DeptListReqVO reqVO) {
|
||||
List<DeptDO> list = deptService.getSimpleDepts(reqVO);
|
||||
public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) {
|
||||
List<DeptDO> list = deptService.getDeptList(reqVO);
|
||||
list.sort(Comparator.comparing(DeptDO::getSort));
|
||||
return success(DeptConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取部门精简信息列表", notes = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||
public CommonResult<List<DeptSimpleRespVO>> getSimpleDepts() {
|
||||
public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
|
||||
// 获得部门列表,只要开启状态的
|
||||
DeptListReqVO reqVO = new DeptListReqVO();
|
||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
List<DeptDO> list = deptService.getSimpleDepts(reqVO);
|
||||
List<DeptDO> list = deptService.getDeptList(reqVO);
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(DeptDO::getSort));
|
||||
return success(DeptConvert.INSTANCE.convertList02(list));
|
||||
|
||||
@@ -70,9 +70,9 @@ public class PostController {
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取岗位精简信息列表", notes = "只包含被开启的岗位,主要用于前端的下拉选项")
|
||||
public CommonResult<List<PostSimpleRespVO>> getSimplePosts() {
|
||||
public CommonResult<List<PostSimpleRespVO>> getSimplePostList() {
|
||||
// 获得岗位列表,只要开启状态的
|
||||
List<PostDO> list = postService.getPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
List<PostDO> list = postService.getPostList(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(PostDO::getSort));
|
||||
return success(PostConvert.INSTANCE.convertList02(list));
|
||||
@@ -90,7 +90,7 @@ public class PostController {
|
||||
@PreAuthorize("@ss.hasPermission('system:post:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Validated PostExportReqVO reqVO) throws IOException {
|
||||
List<PostDO> posts = postService.getPosts(reqVO);
|
||||
List<PostDO> posts = postService.getPostList(reqVO);
|
||||
List<PostExcelVO> data = PostConvert.INSTANCE.convertList03(posts);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostExcelVO.class, data);
|
||||
|
||||
@@ -61,8 +61,8 @@ public class DictDataController {
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDatas() {
|
||||
List<DictDataDO> list = dictDataService.getDictDatas();
|
||||
public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList() {
|
||||
List<DictDataDO> list = dictDataService.getDictDataList();
|
||||
return success(DictDataConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class DictDataController {
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException {
|
||||
List<DictDataDO> list = dictDataService.getDictDatas(reqVO);
|
||||
List<DictDataDO> list = dictDataService.getDictDataList(reqVO);
|
||||
List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class DictTypeController {
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<DictTypeSimpleRespVO>> listSimpleDictTypes() {
|
||||
public CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList() {
|
||||
List<DictTypeDO> list = dictTypeService.getDictTypeList();
|
||||
return success(DictTypeConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class OperateLogController {
|
||||
@PreAuthorize("@ss.hasPermission('system:operate-log:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportOperateLog(HttpServletResponse response, @Valid OperateLogExportReqVO reqVO) throws IOException {
|
||||
List<OperateLogDO> list = operateLogService.getOperateLogs(reqVO);
|
||||
List<OperateLogDO> list = operateLogService.getOperateLogList(reqVO);
|
||||
|
||||
// 获得拼接需要的数据
|
||||
Collection<Long> userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||
|
||||
|
||||
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.account.*;
|
||||
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
||||
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.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - 邮箱账号")
|
||||
@RestController
|
||||
@RequestMapping("/system/mail-account")
|
||||
public class MailAccountController {
|
||||
|
||||
@Resource
|
||||
private MailAccountService mailAccountService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建邮箱账号")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-account:create')")
|
||||
public CommonResult<Long> createMailAccount(@Valid @RequestBody MailAccountCreateReqVO createReqVO) {
|
||||
return success(mailAccountService.createMailAccount(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改邮箱账号")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-account:update')")
|
||||
public CommonResult<Boolean> updateMailAccount(@Valid @RequestBody MailAccountUpdateReqVO updateReqVO) {
|
||||
mailAccountService.updateMailAccount(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除邮箱账号")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-account:delete')")
|
||||
public CommonResult<Boolean> deleteMailAccount(@RequestParam Long id) {
|
||||
mailAccountService.deleteMailAccount(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得邮箱账号")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-account:get')")
|
||||
public CommonResult<MailAccountRespVO> getMailAccount(@RequestParam("id") Long id) {
|
||||
MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id);
|
||||
return success(MailAccountConvert.INSTANCE.convert(mailAccountDO));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得邮箱账号分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-account:query')")
|
||||
public CommonResult<PageResult<MailAccountBaseVO>> getMailAccountPage(@Valid MailAccountPageReqVO pageReqVO) {
|
||||
PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO);
|
||||
return success(MailAccountConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得邮箱账号精简列表")
|
||||
public CommonResult<List<MailAccountSimpleRespVO>> getSimpleMailAccountList() {
|
||||
List<MailAccountDO> list = mailAccountService.getMailAccountList();
|
||||
return success(MailAccountConvert.INSTANCE.convertList02(list));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||
|
||||
|
||||
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.convert.mail.MailLogConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||
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;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Api(tags = "管理后台 - 邮件日志")
|
||||
@RestController
|
||||
@RequestMapping("/system/mail-log")
|
||||
public class MailLogController {
|
||||
|
||||
@Resource
|
||||
private MailLogService mailLogService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得邮箱日志分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-log:query')")
|
||||
public CommonResult<PageResult<MailLogRespVO>> getMailLogPage(@Valid MailLogPageReqVO pageVO) {
|
||||
PageResult<MailLogDO> pageResult = mailLogService.getMailLogPage(pageVO);
|
||||
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<MailLogRespVO> getMailTemplate(@RequestParam("id") Long id) {
|
||||
MailLogDO mailLogDO = mailLogService.getMailLog(id);
|
||||
return success(MailLogConvert.INSTANCE.convert(mailLogDO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
### 请求 /system/mail-template/send-mail 接口 => 成功
|
||||
POST {{baseUrl}}/system/mail-template/send-mail
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
tenant-id: {{adminTenentId}}
|
||||
|
||||
{
|
||||
"templateCode": "test_01",
|
||||
"mail": "7685413@qq.com",
|
||||
"templateParams": {
|
||||
"key01": "value01",
|
||||
"key02": "value02"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||
|
||||
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.template.*;
|
||||
import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailSendService;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailTemplateService;
|
||||
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.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - 邮件模版")
|
||||
@RestController
|
||||
@RequestMapping("/system/mail-template")
|
||||
public class MailTemplateController {
|
||||
|
||||
@Resource
|
||||
private MailTemplateService mailTempleService;
|
||||
@Resource
|
||||
private MailSendService mailSendService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建邮件模版")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:create')")
|
||||
public CommonResult<Long> createMailTemplate(@Valid @RequestBody MailTemplateCreateReqVO createReqVO){
|
||||
return success(mailTempleService.createMailTemplate(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改邮件模版")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:update')")
|
||||
public CommonResult<Boolean> updateMailTemplate(@Valid @RequestBody MailTemplateUpdateReqVO updateReqVO){
|
||||
mailTempleService.updateMailTemplate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除邮件模版")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:delete')")
|
||||
public CommonResult<Boolean> deleteMailTemplate(@RequestParam("id") Long id) {
|
||||
mailTempleService.deleteMailTemplate(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得邮件模版")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:get')")
|
||||
public CommonResult<MailTemplateRespVO> getMailTemplate(@RequestParam("id") Long id) {
|
||||
MailTemplateDO mailTemplateDO = mailTempleService.getMailTemplate(id);
|
||||
return success(MailTemplateConvert.INSTANCE.convert(mailTemplateDO));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得邮件模版分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:query')")
|
||||
public CommonResult<PageResult<MailTemplateRespVO>> getMailTemplatePage(@Valid MailTemplatePageReqVO pageReqVO) {
|
||||
PageResult<MailTemplateDO> pageResult = mailTempleService.getMailTemplatePage(pageReqVO);
|
||||
return success(MailTemplateConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得邮件模版精简列表")
|
||||
public CommonResult<List<MailTemplateSimpleRespVO>> getSimpleTemplateList() {
|
||||
List<MailTemplateDO> list = mailTempleService.getMailTemplateList();
|
||||
return success(MailTemplateConvert.INSTANCE.convertList02(list));
|
||||
}
|
||||
|
||||
@PostMapping("/send-mail")
|
||||
@ApiOperation("发送短信")
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:send-mail')")
|
||||
public CommonResult<Long> sendMail(@Valid @RequestBody MailTemplateSendReqVO sendReqVO) {
|
||||
return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), null,
|
||||
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 邮箱账号 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MailAccountBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "邮箱", required = true, example = "yudaoyuanma@123.com")
|
||||
@NotNull(message = "邮箱不能为空")
|
||||
@Email(message = "必须是 Email 格式")
|
||||
private String mail;
|
||||
|
||||
@ApiModelProperty(value = "用户名", required = true, example = "yudao")
|
||||
@NotNull(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", required = true, example = "123456")
|
||||
@NotNull(message = "密码必填")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "SMTP 服务器域名", required = true, example = "www.iocoder.cn")
|
||||
@NotNull(message = "SMTP 服务器域名不能为空")
|
||||
private String host;
|
||||
|
||||
@ApiModelProperty(value = "SMTP 服务器端口", required = true, example = "80")
|
||||
@NotNull(message = "SMTP 服务器端口不能为空")
|
||||
private Integer port;
|
||||
|
||||
@ApiModelProperty(value = "是否开启 ssl", required = true, example = "true")
|
||||
@NotNull(message = "是否开启 ssl 必填")
|
||||
private Boolean sslEnable;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("管理后台 - 邮箱账号创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailAccountCreateReqVO extends MailAccountBaseVO {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("管理后台 - 邮箱账号分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailAccountPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "邮箱", required = true, example = "yudaoyuanma@123.com")
|
||||
private String mail;
|
||||
|
||||
@ApiModelProperty(value = "用户名" , required = true , example = "yudao")
|
||||
private String username;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ApiModel("管理后台 - 邮箱账号 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailAccountRespVO extends MailAccountBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("管理后台 - 邮箱账号的精简 Response VO")
|
||||
@Data
|
||||
public class MailAccountSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "邮箱编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "邮箱", required = true, example = "768541388@qq.com")
|
||||
private String mail;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("管理后台 - 邮箱账号修改 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailAccountUpdateReqVO extends MailAccountBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 邮件日志 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MailLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "30883")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", example = "2", notes = "参见 UserTypeEnum 枚举")
|
||||
private Byte userType;
|
||||
|
||||
@ApiModelProperty(value = "接收邮箱地址", required = true, example = "76854@qq.com")
|
||||
@NotNull(message = "接收邮箱地址不能为空")
|
||||
private String toMail;
|
||||
|
||||
@ApiModelProperty(value = "邮箱账号编号", required = true, example = "18107")
|
||||
@NotNull(message = "邮箱账号编号不能为空")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "发送邮箱地址", required = true, example = "85757@qq.com")
|
||||
@NotNull(message = "发送邮箱地址不能为空")
|
||||
private String fromMail;
|
||||
|
||||
@ApiModelProperty(value = "模板编号", required = true, example = "5678")
|
||||
@NotNull(message = "模板编号不能为空")
|
||||
private Long templateId;
|
||||
|
||||
@ApiModelProperty(value = "模板编码", required = true, example = "test_01")
|
||||
@NotNull(message = "模板编码不能为空")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty(value = "模版发送人名称", example = "李四")
|
||||
private String templateNickname;
|
||||
|
||||
@ApiModelProperty(value = "邮件标题", required = true, example = "测试标题")
|
||||
@NotNull(message = "邮件标题不能为空")
|
||||
private String templateTitle;
|
||||
|
||||
@ApiModelProperty(value = "邮件内容", required = true, example = "测试内容")
|
||||
@NotNull(message = "邮件内容不能为空")
|
||||
private String templateContent;
|
||||
|
||||
@ApiModelProperty(value = "邮件参数", required = true)
|
||||
@NotNull(message = "邮件参数不能为空")
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
@ApiModelProperty(value = "发送状态", required = true, example = "1", notes = "参见 MailSendStatusEnum 枚举")
|
||||
@NotNull(message = "发送状态不能为空")
|
||||
private Byte sendStatus;
|
||||
|
||||
@ApiModelProperty(value = "发送时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime sendTime;
|
||||
|
||||
@ApiModelProperty(value = "发送返回的消息 ID", example = "28568")
|
||||
private String sendMessageId;
|
||||
|
||||
@ApiModelProperty(value = "发送异常")
|
||||
private String sendException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("管理后台 - 邮箱日志分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailLogPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "30883")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", example = "2", notes = "参见 UserTypeEnum 枚举")
|
||||
private Integer userType;
|
||||
|
||||
@ApiModelProperty(value = "接收邮箱地址", example = "76854@qq.com", notes = "模糊匹配")
|
||||
private String toMail;
|
||||
|
||||
@ApiModelProperty(value = "邮箱账号编号", example = "18107")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "模板编号", example = "5678")
|
||||
private Long templateId;
|
||||
|
||||
@ApiModelProperty(value = "发送状态", example = "1", notes = "参见 MailSendStatusEnum 枚举")
|
||||
private Integer sendStatus;
|
||||
|
||||
@ApiModelProperty(value = "发送时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] sendTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ApiModel("管理后台 - 邮件日志 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailLogRespVO extends MailLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "31020")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 邮件模版 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MailTemplateBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "模版名称", required = true, example = "测试名字")
|
||||
@NotNull(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "模版编号", required = true, example = "test")
|
||||
@NotNull(message = "模版编号不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "发送的邮箱账号编号", required = true, example = "1")
|
||||
@NotNull(message = "发送的邮箱账号编号不能为空")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "发送人名称", example = "芋头")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "标题", required = true, example = "注册成功")
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "内容", required = true, example = "你好,注册成功啦")
|
||||
@NotEmpty(message = "内容不能为空")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "奥特曼")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("管理后台 - 邮件模版创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailTemplateCreateReqVO extends MailTemplateBaseVO {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("管理后台 - 邮件模版分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailTemplatePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "状态", example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "标识", example = "code_1024", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "名称", example = "芋头", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "账号编号", example = "2048")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理后台 - 邮件末班 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailTemplateRespVO extends MailTemplateBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "参数数组", example = "name,code")
|
||||
private List<String> params;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel("管理后台 - 邮件发送 Req VO")
|
||||
@Data
|
||||
public class MailTemplateSendReqVO {
|
||||
|
||||
@ApiModelProperty(value = "接收邮箱", required = true, example = "7685413@qq.com")
|
||||
@NotEmpty(message = "接收邮箱不能为空")
|
||||
private String mail;
|
||||
|
||||
@ApiModelProperty(value = "模板编码", required = true, example = "test_01")
|
||||
@NotNull(message = "模板编码不能为空")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty(value = "模板参数")
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("管理后台 - 邮件模版的精简 Response VO")
|
||||
@Data
|
||||
public class MailTemplateSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "模版编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "模版名字", required = true, example = "哒哒哒")
|
||||
private String name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("管理后台 - 邮件模版修改 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MailTemplateUpdateReqVO extends MailTemplateBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -57,8 +57,8 @@ public class NoticeController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获取通知公告列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:query')")
|
||||
public CommonResult<PageResult<NoticeRespVO>> pageNotices(@Validated NoticePageReqVO reqVO) {
|
||||
return success(NoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
|
||||
public CommonResult<PageResult<NoticeRespVO>> getNoticePage(@Validated NoticePageReqVO reqVO) {
|
||||
return success(NoticeConvert.INSTANCE.convertPage(noticeService.getNoticePage(reqVO)));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageMyPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
|
||||
import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
||||
import cn.iocoder.yudao.module.system.service.notify.NotifyMessageService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Api(tags = "管理后台 - 我的站内信")
|
||||
@RestController
|
||||
@RequestMapping("/system/notify-message")
|
||||
@Validated
|
||||
public class NotifyMessageController {
|
||||
|
||||
@Resource
|
||||
private NotifyMessageService notifyMessageService;
|
||||
|
||||
// ========== 管理所有的站内信 ==========
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得站内信")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-message:query')")
|
||||
public CommonResult<NotifyMessageRespVO> getNotifyMessage(@RequestParam("id") Long id) {
|
||||
NotifyMessageDO notifyMessage = notifyMessageService.getNotifyMessage(id);
|
||||
return success(NotifyMessageConvert.INSTANCE.convert(notifyMessage));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得站内信分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-message:query')")
|
||||
public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) {
|
||||
PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO);
|
||||
return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
// ========== 查看自己的站内信 ==========
|
||||
|
||||
@GetMapping("/my-page")
|
||||
@ApiOperation("获得我的站内信分页")
|
||||
public CommonResult<PageResult<NotifyMessageRespVO>> getMyMyNotifyMessagePage(@Valid NotifyMessageMyPageReqVO pageVO) {
|
||||
PageResult<NotifyMessageDO> pageResult = notifyMessageService.getMyMyNotifyMessagePage(pageVO,
|
||||
getLoginUserId(), UserTypeEnum.ADMIN.getValue());
|
||||
return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@PutMapping("/update-read")
|
||||
@ApiOperation("标记站内信为已读")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
public CommonResult<Boolean> updateNotifyMessageRead(@RequestParam("ids") List<Long> ids) {
|
||||
notifyMessageService.updateNotifyMessageRead(ids, getLoginUserId(), UserTypeEnum.ADMIN.getValue());
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@PutMapping("/update-all-read")
|
||||
@ApiOperation("标记所有站内信为已读")
|
||||
public CommonResult<Boolean> updateAllNotifyMessageRead() {
|
||||
notifyMessageService.updateAllNotifyMessageRead(getLoginUserId(), UserTypeEnum.ADMIN.getValue());
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@GetMapping("/get-unread-list")
|
||||
@ApiOperation("获取当前用户的最新站内信列表,默认 10 条")
|
||||
@ApiImplicitParam(name = "size", value = "10", defaultValue = "10", dataTypeClass = Integer.class)
|
||||
public CommonResult<List<NotifyMessageRespVO>> getUnreadNotifyMessageList(
|
||||
@RequestParam(name = "size", defaultValue = "10") Integer size) {
|
||||
List<NotifyMessageDO> list = notifyMessageService.getUnreadNotifyMessageList(
|
||||
getLoginUserId(), UserTypeEnum.ADMIN.getValue(), size);
|
||||
return success(NotifyMessageConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/get-unread-count")
|
||||
@ApiOperation("获得当前用户的未读站内信数量")
|
||||
public CommonResult<Long> getUnreadNotifyMessageCount() {
|
||||
return success(notifyMessageService.getUnreadNotifyMessageCount(getLoginUserId(), UserTypeEnum.ADMIN.getValue()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.*;
|
||||
import cn.iocoder.yudao.module.system.convert.notify.NotifyTemplateConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
||||
import cn.iocoder.yudao.module.system.service.notify.NotifySendService;
|
||||
import cn.iocoder.yudao.module.system.service.notify.NotifyTemplateService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - 站内信模版")
|
||||
@RestController
|
||||
@RequestMapping("/system/notify-template")
|
||||
@Validated
|
||||
public class NotifyTemplateController {
|
||||
|
||||
@Resource
|
||||
private NotifyTemplateService notifyTemplateService;
|
||||
|
||||
@Resource
|
||||
private NotifySendService notifySendService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建站内信模版")
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:create')")
|
||||
public CommonResult<Long> createNotifyTemplate(@Valid @RequestBody NotifyTemplateCreateReqVO createReqVO) {
|
||||
return success(notifyTemplateService.createNotifyTemplate(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新站内信模版")
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:update')")
|
||||
public CommonResult<Boolean> updateNotifyTemplate(@Valid @RequestBody NotifyTemplateUpdateReqVO updateReqVO) {
|
||||
notifyTemplateService.updateNotifyTemplate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除站内信模版")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:delete')")
|
||||
public CommonResult<Boolean> deleteNotifyTemplate(@RequestParam("id") Long id) {
|
||||
notifyTemplateService.deleteNotifyTemplate(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得站内信模版")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:query')")
|
||||
public CommonResult<NotifyTemplateRespVO> getNotifyTemplate(@RequestParam("id") Long id) {
|
||||
NotifyTemplateDO notifyTemplate = notifyTemplateService.getNotifyTemplate(id);
|
||||
return success(NotifyTemplateConvert.INSTANCE.convert(notifyTemplate));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得站内信模版分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:query')")
|
||||
public CommonResult<PageResult<NotifyTemplateRespVO>> getNotifyTemplatePage(@Valid NotifyTemplatePageReqVO pageVO) {
|
||||
PageResult<NotifyTemplateDO> pageResult = notifyTemplateService.getNotifyTemplatePage(pageVO);
|
||||
return success(NotifyTemplateConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@PostMapping("/send-notify")
|
||||
@ApiOperation("发送站内信")
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:send-notify')")
|
||||
public CommonResult<Long> sendNotify(@Valid @RequestBody NotifyTemplateSendReqVO sendReqVO) {
|
||||
return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(),
|
||||
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 站内信消息 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class NotifyMessageBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "25025")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", required = true, example = "1", notes = "参见 UserTypeEnum 枚举")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private Byte userType;
|
||||
|
||||
@ApiModelProperty(value = "模版编号", required = true, example = "13013")
|
||||
@NotNull(message = "模版编号不能为空")
|
||||
private Long templateId;
|
||||
|
||||
@ApiModelProperty(value = "模板编码", required = true, example = "test_01")
|
||||
@NotNull(message = "模板编码不能为空")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty(value = "模版发送人名称", required = true, example = "芋艿")
|
||||
@NotNull(message = "模版发送人名称不能为空")
|
||||
private String templateNickname;
|
||||
|
||||
@ApiModelProperty(value = "模版内容", required = true, example = "测试内容")
|
||||
@NotNull(message = "模版内容不能为空")
|
||||
private String templateContent;
|
||||
|
||||
@ApiModelProperty(value = "模版类型", required = true, example = "2")
|
||||
@NotNull(message = "模版类型不能为空")
|
||||
private Integer templateType;
|
||||
|
||||
@ApiModelProperty(value = "模版参数", required = true)
|
||||
@NotNull(message = "模版参数不能为空")
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
@ApiModelProperty(value = "是否已读", required = true, example = "true")
|
||||
@NotNull(message = "是否已读不能为空")
|
||||
private Boolean readStatus;
|
||||
|
||||
@ApiModelProperty(value = "阅读时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime readTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("管理后台 - 站内信分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyMessageMyPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "是否已读", example = "true")
|
||||
private Boolean readStatus;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("管理后台 - 站内信分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyMessagePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "25025")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", example = "1")
|
||||
private Integer userType;
|
||||
|
||||
@ApiModelProperty(value = "模板编码", example = "test_01")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty(value = "模版类型", example = "2")
|
||||
private Integer templateType;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("管理后台 - 站内信 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyMessageRespVO extends NotifyMessageBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "ID", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 站内信模版 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class NotifyTemplateBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "模版名称", required = true, example = "测试模版")
|
||||
@NotEmpty(message = "模版名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "模版编码", required = true, example = "SEND_TEST")
|
||||
@NotNull(message = "模版编码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "模版类型", required = true, example = "1", notes = "对应 system_notify_template_type 字典")
|
||||
@NotNull(message = "模版类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "发送人名称", required = true, example = "土豆")
|
||||
@NotEmpty(message = "发送人名称不能为空")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "模版内容", required = true, example = "我是模版内容")
|
||||
@NotEmpty(message = "模版内容不能为空")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "我是备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("管理后台 - 站内信模版创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyTemplateCreateReqVO extends NotifyTemplateBaseVO {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("管理后台 - 站内信模版分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyTemplatePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "模版编码", example = "test_01")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "模版名称", example = "我是名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "状态", example = "1", notes = "参见 CommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理后台 - 站内信模版 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyTemplateRespVO extends NotifyTemplateBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "ID", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "参数数组", example = "name,code")
|
||||
private List<String> params;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiModel("管理后台 - 站内信模板的发送 Request VO")
|
||||
@Data
|
||||
public class NotifyTemplateSendReqVO {
|
||||
|
||||
@ApiModelProperty(value = "用户id", required = true, example = "01")
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "模板编码", required = true, example = "01")
|
||||
@NotEmpty(message = "模板编码不能为空")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty(value = "模板参数")
|
||||
private Map<String, Object> templateParams;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("管理后台 - 站内信模版更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class NotifyTemplateUpdateReqVO extends NotifyTemplateBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "ID", required = true, example = "1024")
|
||||
@NotNull(message = "ID 不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class OAuth2UserController {
|
||||
}
|
||||
// 获得岗位信息
|
||||
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
||||
List<PostDO> posts = postService.getPosts(user.getPostIds());
|
||||
List<PostDO> posts = postService.getPostList(user.getPostIds());
|
||||
resp.setPosts(OAuth2UserConvert.INSTANCE.convertList(posts));
|
||||
}
|
||||
return success(resp);
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.*;
|
||||
import cn.iocoder.yudao.module.system.convert.permission.MenuConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.MenuService;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -29,8 +28,6 @@ public class MenuController {
|
||||
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建菜单")
|
||||
@@ -60,8 +57,8 @@ public class MenuController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "获取菜单列表", notes = "用于【菜单管理】界面")
|
||||
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
||||
public CommonResult<List<MenuRespVO>> getMenus(MenuListReqVO reqVO) {
|
||||
List<MenuDO> list = menuService.getMenus(reqVO);
|
||||
public CommonResult<List<MenuRespVO>> getMenuList(MenuListReqVO reqVO) {
|
||||
List<MenuDO> list = menuService.getMenuList(reqVO);
|
||||
list.sort(Comparator.comparing(MenuDO::getSort));
|
||||
return success(MenuConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
@@ -69,11 +66,11 @@ public class MenuController {
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取菜单精简信息列表", notes = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。" +
|
||||
"在多租户的场景下,会只返回租户所在套餐有的菜单")
|
||||
public CommonResult<List<MenuSimpleRespVO>> getSimpleMenus() {
|
||||
public CommonResult<List<MenuSimpleRespVO>> getSimpleMenuList() {
|
||||
// 获得菜单列表,只要开启状态的
|
||||
MenuListReqVO reqVO = new MenuListReqVO();
|
||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
List<MenuDO> list = menuService.getTenantMenus(reqVO);
|
||||
List<MenuDO> list = menuService.getMenuListByTenant(reqVO);
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(MenuDO::getSort));
|
||||
return success(MenuConvert.INSTANCE.convertList02(list));
|
||||
|
||||
@@ -20,12 +20,12 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static java.util.Collections.singleton;
|
||||
|
||||
@Api(tags = "管理后台 - 角色")
|
||||
@RestController
|
||||
@@ -85,9 +85,9 @@ public class RoleController {
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取角色精简信息列表", notes = "只包含被开启的角色,主要用于前端的下拉选项")
|
||||
public CommonResult<List<RoleSimpleRespVO>> getSimpleRoles() {
|
||||
public CommonResult<List<RoleSimpleRespVO>> getSimpleRoleList() {
|
||||
// 获得角色列表,只要开启状态的
|
||||
List<RoleDO> list = roleService.getRoles(Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
List<RoleDO> list = roleService.getRoleListByStatus(singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(RoleDO::getSort));
|
||||
return success(RoleConvert.INSTANCE.convertList02(list));
|
||||
|
||||
@@ -90,8 +90,8 @@ public class SensitiveWordController {
|
||||
@GetMapping("/get-tags")
|
||||
@ApiOperation("获取所有敏感词的标签数组")
|
||||
@PreAuthorize("@ss.hasPermission('system:sensitive-word:query')")
|
||||
public CommonResult<Set<String>> getSensitiveWordTags() throws IOException {
|
||||
return success(sensitiveWordService.getSensitiveWordTags());
|
||||
public CommonResult<Set<String>> getSensitiveWordTagSet() {
|
||||
return success(sensitiveWordService.getSensitiveWordTagSet());
|
||||
}
|
||||
|
||||
@GetMapping("/validate-text")
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SmsChannelController {
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得短信渠道精简列表", notes = "包含被禁用的短信渠道")
|
||||
public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannels() {
|
||||
public CommonResult<List<SmsChannelSimpleRespVO>> getSimpleSmsChannelList() {
|
||||
List<SmsChannelDO> list = smsChannelService.getSmsChannelList();
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(SmsChannelDO::getId));
|
||||
|
||||
@@ -111,9 +111,9 @@ public class UserController {
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取用户精简信息列表", notes = "只包含被开启的用户,主要用于前端的下拉选项")
|
||||
public CommonResult<List<UserSimpleRespVO>> getSimpleUsers() {
|
||||
// 获用户门列表,只要开启状态的
|
||||
List<AdminUserDO> list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
|
||||
// 获用户列表,只要开启状态的
|
||||
List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
// 排序后,返回给前端
|
||||
return success(UserConvert.INSTANCE.convertList04(list));
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class UserController {
|
||||
@ApiOperation("获得用户详情")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||
public CommonResult<UserRespVO> getInfo(@RequestParam("id") Long id) {
|
||||
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
||||
return success(UserConvert.INSTANCE.convert(userService.getUser(id)));
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ public class UserController {
|
||||
@ApiOperation("导出用户")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportUsers(@Validated UserExportReqVO reqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
public void exportUserList(@Validated UserExportReqVO reqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
// 获得用户列表
|
||||
List<AdminUserDO> users = userService.getUsers(reqVO);
|
||||
List<AdminUserDO> users = userService.getUserList(reqVO);
|
||||
|
||||
// 获得拼接需要的数据
|
||||
Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId);
|
||||
@@ -183,7 +183,7 @@ public class UserController {
|
||||
public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class);
|
||||
return success(userService.importUsers(list, updateSupport));
|
||||
return success(userService.importUserList(list, updateSupport));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||
@@ -63,7 +64,7 @@ public class UserProfileController {
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
UserProfileRespVO resp = UserConvert.INSTANCE.convert03(user);
|
||||
// 获得用户角色
|
||||
List<RoleDO> userRoles = roleService.getRolesFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
|
||||
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
|
||||
resp.setRoles(UserConvert.INSTANCE.convertList(userRoles));
|
||||
// 获得部门信息
|
||||
if (user.getDeptId() != null) {
|
||||
@@ -72,7 +73,7 @@ public class UserProfileController {
|
||||
}
|
||||
// 获得岗位信息
|
||||
if (CollUtil.isNotEmpty(user.getPostIds())) {
|
||||
List<PostDO> posts = postService.getPosts(user.getPostIds());
|
||||
List<PostDO> posts = postService.getPostList(user.getPostIds());
|
||||
resp.setPosts(UserConvert.INSTANCE.convertList02(posts));
|
||||
}
|
||||
// 获得社交用户信息
|
||||
@@ -99,7 +100,7 @@ public class UserProfileController {
|
||||
@ApiOperation("上传用户个人头像")
|
||||
public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw ServiceExceptionUtil.exception(FILE_IS_EMPTY);
|
||||
throw exception(FILE_IS_EMPTY);
|
||||
}
|
||||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||
return success(avatar);
|
||||
|
||||
@@ -9,13 +9,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.MenuIdEnum;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO.ID_ROOT;
|
||||
|
||||
@Mapper
|
||||
public interface AuthConvert {
|
||||
|
||||
@@ -26,8 +28,8 @@ public interface AuthConvert {
|
||||
default AuthPermissionInfoRespVO convert(AdminUserDO user, List<RoleDO> roleList, List<MenuDO> menuList) {
|
||||
return AuthPermissionInfoRespVO.builder()
|
||||
.user(AuthPermissionInfoRespVO.UserVO.builder().id(user.getId()).nickname(user.getNickname()).avatar(user.getAvatar()).build())
|
||||
.roles(CollectionUtils.convertSet(roleList, RoleDO::getCode))
|
||||
.permissions(CollectionUtils.convertSet(menuList, MenuDO::getPermission))
|
||||
.roles(convertSet(roleList, RoleDO::getCode))
|
||||
.permissions(convertSet(menuList, MenuDO::getPermission))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ public interface AuthConvert {
|
||||
Map<Long, AuthMenuRespVO> treeNodeMap = new LinkedHashMap<>();
|
||||
menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu)));
|
||||
// 处理父子关系
|
||||
treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(MenuIdEnum.ROOT.getId())).forEach(childNode -> {
|
||||
treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(ID_ROOT)).forEach(childNode -> {
|
||||
// 获得父节点
|
||||
AuthMenuRespVO parentNode = treeNodeMap.get(childNode.getParentId());
|
||||
if (parentNode == null) {
|
||||
@@ -62,7 +64,7 @@ public interface AuthConvert {
|
||||
parentNode.getChildren().add(childNode);
|
||||
});
|
||||
// 获得到所有的根节点
|
||||
return CollectionUtils.filterList(treeNodeMap.values(), node -> MenuIdEnum.ROOT.getId().equals(node.getParentId()));
|
||||
return filterList(treeNodeMap.values(), node -> ID_ROOT.equals(node.getParentId()));
|
||||
}
|
||||
|
||||
SocialUserBindReqDTO convert(Long userId, Integer userType, AuthSocialBindLoginReqVO reqVO);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.convert.mail;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.mail.MailAccount;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MailAccountConvert {
|
||||
|
||||
MailAccountConvert INSTANCE = Mappers.getMapper(MailAccountConvert.class);
|
||||
|
||||
MailAccountDO convert(MailAccountCreateReqVO bean);
|
||||
|
||||
MailAccountDO convert(MailAccountUpdateReqVO bean);
|
||||
|
||||
MailAccountRespVO convert(MailAccountDO bean);
|
||||
|
||||
PageResult<MailAccountBaseVO> convertPage(PageResult<MailAccountDO> pageResult);
|
||||
|
||||
List<MailAccountSimpleRespVO> convertList02(List<MailAccountDO> list);
|
||||
|
||||
default MailAccount convert(MailAccountDO account, String nickname) {
|
||||
String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail();
|
||||
return new MailAccount().setFrom(from).setAuth(true)
|
||||
.setUser(account.getUsername()).setPass(account.getPassword())
|
||||
.setHost(account.getHost()).setPort(account.getPort()).setSslEnable(account.getSslEnable());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.convert.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface MailLogConvert {
|
||||
|
||||
MailLogConvert INSTANCE = Mappers.getMapper(MailLogConvert.class);
|
||||
|
||||
PageResult<MailLogRespVO> convertPage(PageResult<MailLogDO> pageResult);
|
||||
|
||||
MailLogRespVO convert(MailLogDO bean);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.system.convert.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MailTemplateConvert {
|
||||
|
||||
MailTemplateConvert INSTANCE = Mappers.getMapper(MailTemplateConvert.class);
|
||||
|
||||
MailTemplateDO convert(MailTemplateUpdateReqVO bean);
|
||||
|
||||
MailTemplateDO convert(MailTemplateCreateReqVO bean);
|
||||
|
||||
MailTemplateRespVO convert(MailTemplateDO bean);
|
||||
|
||||
PageResult<MailTemplateRespVO> convertPage(PageResult<MailTemplateDO> pageResult);
|
||||
|
||||
List<MailTemplateSimpleRespVO> convertList02(List<MailTemplateDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.convert.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站内信 Convert
|
||||
*
|
||||
* @author xrcoder
|
||||
*/
|
||||
@Mapper
|
||||
public interface NotifyMessageConvert {
|
||||
|
||||
NotifyMessageConvert INSTANCE = Mappers.getMapper(NotifyMessageConvert.class);
|
||||
|
||||
NotifyMessageRespVO convert(NotifyMessageDO bean);
|
||||
|
||||
List<NotifyMessageRespVO> convertList(List<NotifyMessageDO> list);
|
||||
|
||||
PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.convert.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站内信模版 Convert
|
||||
*
|
||||
* @author xrcoder
|
||||
*/
|
||||
@Mapper
|
||||
public interface NotifyTemplateConvert {
|
||||
|
||||
NotifyTemplateConvert INSTANCE = Mappers.getMapper(NotifyTemplateConvert.class);
|
||||
|
||||
NotifyTemplateDO convert(NotifyTemplateCreateReqVO bean);
|
||||
|
||||
NotifyTemplateDO convert(NotifyTemplateUpdateReqVO bean);
|
||||
|
||||
NotifyTemplateRespVO convert(NotifyTemplateDO bean);
|
||||
|
||||
List<NotifyTemplateRespVO> convertList(List<NotifyTemplateDO> list);
|
||||
|
||||
PageResult<NotifyTemplateRespVO> convertPage(PageResult<NotifyTemplateDO> page);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 邮箱账号 DO
|
||||
*
|
||||
* 用途:配置发送邮箱的账号
|
||||
*
|
||||
* @author wangjingyi
|
||||
* @since 2022-03-21
|
||||
*/
|
||||
@TableName(value = "system_mail_account", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MailAccountDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String mail;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* SMTP 服务器域名
|
||||
*/
|
||||
private String host;
|
||||
/**
|
||||
* SMTP 服务器端口
|
||||
*/
|
||||
private Integer port;
|
||||
/**
|
||||
* 是否开启 SSL
|
||||
*/
|
||||
private Boolean sslEnable;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.system.enums.mail.MailSendStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 邮箱日志 DO
|
||||
* 记录每一次邮件的发送
|
||||
*
|
||||
* @author wangjingyi
|
||||
* @since 2022-03-21
|
||||
*/
|
||||
@TableName(value = "system_mail_log", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MailLogDO extends BaseDO implements Serializable {
|
||||
|
||||
/**
|
||||
* 日志编号,自增
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编码
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户类型
|
||||
*
|
||||
* 枚举 {@link UserTypeEnum}
|
||||
*/
|
||||
private Integer userType;
|
||||
/**
|
||||
* 接收邮箱地址
|
||||
*/
|
||||
private String toMail;
|
||||
|
||||
/**
|
||||
* 邮箱账号编号
|
||||
*
|
||||
* 关联 {@link MailAccountDO#getId()}
|
||||
*/
|
||||
private Long accountId;
|
||||
/**
|
||||
* 发送邮箱地址
|
||||
*
|
||||
* 冗余 {@link MailAccountDO#getMail()}
|
||||
*/
|
||||
private String fromMail;
|
||||
|
||||
// ========= 模板相关字段 =========
|
||||
/**
|
||||
* 模版编号
|
||||
*
|
||||
* 关联 {@link MailTemplateDO#getId()}
|
||||
*/
|
||||
private Long templateId;
|
||||
/**
|
||||
* 模版编码
|
||||
*
|
||||
* 冗余 {@link MailTemplateDO#getCode()}
|
||||
*/
|
||||
private String templateCode;
|
||||
/**
|
||||
* 模版发送人名称
|
||||
*
|
||||
* 冗余 {@link MailTemplateDO#getNickname()}
|
||||
*/
|
||||
private String templateNickname;
|
||||
/**
|
||||
* 模版标题
|
||||
*/
|
||||
private String templateTitle;
|
||||
/**
|
||||
* 模版内容
|
||||
*
|
||||
* 基于 {@link MailTemplateDO#getContent()} 格式化后的内容
|
||||
*/
|
||||
private String templateContent;
|
||||
/**
|
||||
* 模版参数
|
||||
*
|
||||
* 基于 {@link MailTemplateDO#getParams()} 输入后的参数
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
// ========= 发送相关字段 =========
|
||||
/**
|
||||
* 发送状态
|
||||
*
|
||||
* 枚举 {@link MailSendStatusEnum}
|
||||
*/
|
||||
private Integer sendStatus;
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
private Date sendTime;
|
||||
/**
|
||||
* 发送返回的消息 ID
|
||||
*/
|
||||
private String sendMessageId;
|
||||
/**
|
||||
* 发送异常
|
||||
*/
|
||||
private String sendException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 邮件模版 DO
|
||||
*
|
||||
* @author wangjingyi
|
||||
* @since 2022-03-21
|
||||
*/
|
||||
@TableName(value = "system_mail_template", autoResultMap = true)
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MailTemplateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 模版名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 模版编号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 发送的邮箱账号编号
|
||||
*
|
||||
* 关联 {@link MailAccountDO#getId()}
|
||||
*/
|
||||
private Long accountId;
|
||||
|
||||
/**
|
||||
* 发送人名称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 参数数组(自动根据内容生成)
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<String> params;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 站内信 DO
|
||||
*
|
||||
* @author xrcoder
|
||||
*/
|
||||
@TableName(value = "system_notify_message", autoResultMap = true)
|
||||
@KeySequence("system_notify_message_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotifyMessageDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 站内信编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*
|
||||
* 关联 MemberUserDO 的 id 字段、或者 AdminUserDO 的 id 字段
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户类型
|
||||
*
|
||||
* 枚举 {@link UserTypeEnum}
|
||||
*/
|
||||
private Integer userType;
|
||||
|
||||
// ========= 模板相关字段 =========
|
||||
|
||||
/**
|
||||
* 模版编号
|
||||
*
|
||||
* 关联 {@link NotifyTemplateDO#getId()}
|
||||
*/
|
||||
private Long templateId;
|
||||
/**
|
||||
* 模版编码
|
||||
*
|
||||
* 关联 {@link NotifyTemplateDO#getCode()}
|
||||
*/
|
||||
private String templateCode;
|
||||
/**
|
||||
* 模版类型
|
||||
*
|
||||
* 冗余 {@link NotifyTemplateDO#getType()}
|
||||
*/
|
||||
private Integer templateType;
|
||||
/**
|
||||
* 模版发送人名称
|
||||
*
|
||||
* 冗余 {@link NotifyTemplateDO#getNickname()}
|
||||
*/
|
||||
private String templateNickname;
|
||||
/**
|
||||
* 模版内容
|
||||
*
|
||||
* 基于 {@link NotifyTemplateDO#getContent()} 格式化后的内容
|
||||
*/
|
||||
private String templateContent;
|
||||
/**
|
||||
* 模版参数
|
||||
*
|
||||
* 基于 {@link NotifyTemplateDO#getParams()} 输入后的参数
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String, Object> templateParams;
|
||||
|
||||
// ========= 读取相关字段 =========
|
||||
|
||||
/**
|
||||
* 是否已读
|
||||
*/
|
||||
private Boolean readStatus;
|
||||
/**
|
||||
* 阅读时间
|
||||
*/
|
||||
private LocalDateTime readTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站内信模版 DO
|
||||
*
|
||||
* @author xrcoder
|
||||
*/
|
||||
@TableName(value = "system_notify_template", autoResultMap = true)
|
||||
@KeySequence("system_notify_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotifyTemplateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 模版名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 模版编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 模版类型
|
||||
*
|
||||
* 对应 system_notify_template_type 字典
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 发送人名称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 模版内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 参数数组
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<String> params;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,9 +18,7 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
||||
}
|
||||
|
||||
default DeptDO selectByParentIdAndName(Long parentId, String name) {
|
||||
return selectOne(new LambdaQueryWrapper<DeptDO>()
|
||||
.eq(DeptDO::getParentId, parentId)
|
||||
.eq(DeptDO::getName, name));
|
||||
return selectOne(DeptDO::getParentId, parentId, DeptDO::getName, name);
|
||||
}
|
||||
|
||||
default Long selectCountByParentId(Long parentId) {
|
||||
|
||||
@@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.dept;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -16,31 +15,32 @@ import java.util.List;
|
||||
public interface PostMapper extends BaseMapperX<PostDO> {
|
||||
|
||||
default List<PostDO> selectList(Collection<Long> ids, Collection<Integer> statuses) {
|
||||
return selectList(new QueryWrapperX<PostDO>().inIfPresent("id", ids)
|
||||
.inIfPresent("status", statuses));
|
||||
return selectList(new LambdaQueryWrapperX<PostDO>()
|
||||
.inIfPresent(PostDO::getId, ids)
|
||||
.inIfPresent(PostDO::getStatus, statuses));
|
||||
}
|
||||
|
||||
default PageResult<PostDO> selectPage(PostPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<PostDO>()
|
||||
.likeIfPresent("code", reqVO.getCode())
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.eqIfPresent("status", reqVO.getStatus())
|
||||
.orderByDesc("id"));
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PostDO>()
|
||||
.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(PostDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PostDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(PostDO::getId));
|
||||
}
|
||||
|
||||
default List<PostDO> selectList(PostExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<PostDO>()
|
||||
.likeIfPresent("code", reqVO.getCode())
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.eqIfPresent("status", reqVO.getStatus()));
|
||||
return selectList(new LambdaQueryWrapperX<PostDO>()
|
||||
.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(PostDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PostDO::getStatus, reqVO.getStatus()));
|
||||
}
|
||||
|
||||
default PostDO selectByName(String name) {
|
||||
return selectOne(new QueryWrapper<PostDO>().eq("name", name));
|
||||
return selectOne(PostDO::getName, name);
|
||||
}
|
||||
|
||||
default PostDO selectByCode(String code) {
|
||||
return selectOne(new QueryWrapper<PostDO>().eq("code", code));
|
||||
return selectOne(PostDO::getCode, code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@ import java.util.List;
|
||||
public interface UserPostMapper extends BaseMapperX<UserPostDO> {
|
||||
|
||||
default List<UserPostDO> selectListByUserId(Long userId) {
|
||||
return selectList(new LambdaQueryWrapperX<UserPostDO>()
|
||||
.eq(UserPostDO::getUserId, userId));
|
||||
return selectList(UserPostDO::getUserId, userId);
|
||||
}
|
||||
|
||||
default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) {
|
||||
@@ -24,11 +23,10 @@ public interface UserPostMapper extends BaseMapperX<UserPostDO> {
|
||||
}
|
||||
|
||||
default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) {
|
||||
return selectList(new LambdaQueryWrapperX<UserPostDO>()
|
||||
.in(UserPostDO::getPostId, postIds));
|
||||
return selectList(UserPostDO::getPostId, postIds);
|
||||
}
|
||||
|
||||
default void deleteByUserId(Long userId){
|
||||
default void deleteByUserId(Long userId) {
|
||||
delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,11 @@ import java.util.List;
|
||||
public interface DictDataMapper extends BaseMapperX<DictDataDO> {
|
||||
|
||||
default DictDataDO selectByDictTypeAndValue(String dictType, String value) {
|
||||
return selectOne(new LambdaQueryWrapper<DictDataDO>().eq(DictDataDO::getDictType, dictType)
|
||||
.eq(DictDataDO::getValue, value));
|
||||
return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getValue, value);
|
||||
}
|
||||
|
||||
default DictDataDO selectByDictTypeAndLabel(String dictType, String label) {
|
||||
return selectOne(new LambdaQueryWrapper<DictDataDO>().eq(DictDataDO::getDictType, dictType)
|
||||
.eq(DictDataDO::getLabel, label));
|
||||
return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getLabel, label);
|
||||
}
|
||||
|
||||
default List<DictDataDO> selectByDictTypeAndValues(String dictType, Collection<String> values) {
|
||||
|
||||
@@ -8,8 +8,8 @@ import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodePag
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@@ -36,11 +36,11 @@ public interface ErrorCodeMapper extends BaseMapperX<ErrorCodeDO> {
|
||||
}
|
||||
|
||||
default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
|
||||
return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().in(ErrorCodeDO::getCode, codes));
|
||||
return selectList(ErrorCodeDO::getCode, codes);
|
||||
}
|
||||
|
||||
default ErrorCodeDO selectByCode(Integer code) {
|
||||
return selectOne(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getCode, code));
|
||||
return selectOne(ErrorCodeDO::getCode, code);
|
||||
}
|
||||
|
||||
default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, LocalDateTime minUpdateTime) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MailAccountMapper extends BaseMapperX<MailAccountDO> {
|
||||
|
||||
default PageResult<MailAccountDO> selectPage(MailAccountPageReqVO pageReqVO) {
|
||||
return selectPage(pageReqVO, new LambdaQueryWrapperX<MailAccountDO>()
|
||||
.likeIfPresent(MailAccountDO::getMail, pageReqVO.getMail())
|
||||
.likeIfPresent(MailAccountDO::getUsername , pageReqVO.getUsername()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MailLogMapper extends BaseMapperX<MailLogDO> {
|
||||
|
||||
default PageResult<MailLogDO> selectPage(MailLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MailLogDO>()
|
||||
.eqIfPresent(MailLogDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(MailLogDO::getUserType, reqVO.getUserType())
|
||||
.likeIfPresent(MailLogDO::getToMail, reqVO.getToMail())
|
||||
.eqIfPresent(MailLogDO::getAccountId, reqVO.getAccountId())
|
||||
.eqIfPresent(MailLogDO::getTemplateId, reqVO.getTemplateId())
|
||||
.eqIfPresent(MailLogDO::getSendStatus, reqVO.getSendStatus())
|
||||
.betweenIfPresent(MailLogDO::getSendTime, reqVO.getSendTime())
|
||||
.orderByDesc(MailLogDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MailTemplateMapper extends BaseMapperX<MailTemplateDO> {
|
||||
|
||||
default PageResult<MailTemplateDO> selectPage(MailTemplatePageReqVO pageReqVO){
|
||||
return selectPage(pageReqVO , new LambdaQueryWrapperX<MailTemplateDO>()
|
||||
.eqIfPresent(MailTemplateDO::getStatus, pageReqVO.getStatus())
|
||||
.likeIfPresent(MailTemplateDO::getCode, pageReqVO.getCode())
|
||||
.likeIfPresent(MailTemplateDO::getName, pageReqVO.getName())
|
||||
.eqIfPresent(MailTemplateDO::getAccountId, pageReqVO.getAccountId())
|
||||
.betweenIfPresent(MailTemplateDO::getCreateTime, pageReqVO.getCreateTime()));
|
||||
}
|
||||
|
||||
default Long selectCountByAccountId(Long accountId) {
|
||||
return selectCount(MailTemplateDO::getAccountId, accountId);
|
||||
}
|
||||
|
||||
default MailTemplateDO selectByCode(String code) {
|
||||
return selectOne(MailTemplateDO::getCode, code);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageMyPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
|
||||
|
||||
default PageResult<NotifyMessageDO> selectPage(NotifyMessagePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>()
|
||||
.eqIfPresent(NotifyMessageDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(NotifyMessageDO::getUserType, reqVO.getUserType())
|
||||
.likeIfPresent(NotifyMessageDO::getTemplateCode, reqVO.getTemplateCode())
|
||||
.eqIfPresent(NotifyMessageDO::getTemplateType, reqVO.getTemplateType())
|
||||
.betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(NotifyMessageDO::getId));
|
||||
}
|
||||
|
||||
default PageResult<NotifyMessageDO> selectPage(NotifyMessageMyPageReqVO reqVO, Long userId, Integer userType) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>()
|
||||
.eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus())
|
||||
.betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eq(NotifyMessageDO::getUserId, userId)
|
||||
.eq(NotifyMessageDO::getUserType, userType)
|
||||
.orderByDesc(NotifyMessageDO::getId));
|
||||
}
|
||||
|
||||
default int updateListRead(Collection<Long> ids, Long userId, Integer userType) {
|
||||
return update(new NotifyMessageDO().setReadStatus(true).setReadTime(LocalDateTime.now()),
|
||||
new LambdaQueryWrapperX<NotifyMessageDO>()
|
||||
.in(NotifyMessageDO::getId, ids)
|
||||
.eq(NotifyMessageDO::getUserId, userId)
|
||||
.eq(NotifyMessageDO::getUserType, userType)
|
||||
.eq(NotifyMessageDO::getReadStatus, false));
|
||||
}
|
||||
|
||||
default int updateListRead(Long userId, Integer userType) {
|
||||
return update(new NotifyMessageDO().setReadStatus(true).setReadTime(LocalDateTime.now()),
|
||||
new LambdaQueryWrapperX<NotifyMessageDO>()
|
||||
.eq(NotifyMessageDO::getUserId, userId)
|
||||
.eq(NotifyMessageDO::getUserType, userType)
|
||||
.eq(NotifyMessageDO::getReadStatus, false));
|
||||
}
|
||||
|
||||
default List<NotifyMessageDO> selectUnreadListByUserIdAndUserType(Long userId, Integer userType, Integer size) {
|
||||
return selectList(new QueryWrapperX<NotifyMessageDO>() // 由于要使用 limitN 语句,所以只能用 QueryWrapperX
|
||||
.eq("user_id", userId)
|
||||
.eq("user_type", userType)
|
||||
.eq("read_status", false)
|
||||
.orderByDesc("id").limitN(size));
|
||||
}
|
||||
|
||||
default Long selectUnreadCountByUserIdAndUserType(Long userId, Integer userType) {
|
||||
return selectCount(new LambdaQueryWrapperX<NotifyMessageDO>()
|
||||
.eq(NotifyMessageDO::getReadStatus, false)
|
||||
.eq(NotifyMessageDO::getUserId, userId)
|
||||
.eq(NotifyMessageDO::getUserType, userType));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.notify;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface NotifyTemplateMapper extends BaseMapperX<NotifyTemplateDO> {
|
||||
|
||||
default NotifyTemplateDO selectByCode(String code) {
|
||||
return selectOne(NotifyTemplateDO::getCode, code);
|
||||
}
|
||||
|
||||
default PageResult<NotifyTemplateDO> selectPage(NotifyTemplatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<NotifyTemplateDO>()
|
||||
.likeIfPresent(NotifyTemplateDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(NotifyTemplateDO::getName, reqVO.getName())
|
||||
.eqIfPresent(NotifyTemplateDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(NotifyTemplateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(NotifyTemplateDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public interface SmsCodeMapper extends BaseMapperX<SmsCodeDO> {
|
||||
.eqIfPresent("scene", scene)
|
||||
.eqIfPresent("code", code)
|
||||
.orderByDesc("id")
|
||||
.limit1());
|
||||
.limitN(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@ public interface SocialUserBindMapper extends BaseMapperX<SocialUserBindDO> {
|
||||
}
|
||||
|
||||
default SocialUserBindDO selectByUserTypeAndSocialUserId(Integer userType, Long socialUserId) {
|
||||
return selectOne(new LambdaQueryWrapperX<SocialUserBindDO>()
|
||||
.eq(SocialUserBindDO::getUserType, userType)
|
||||
.eq(SocialUserBindDO::getSocialUserId, socialUserId));
|
||||
return selectOne(SocialUserBindDO::getUserType, userType,
|
||||
SocialUserBindDO::getSocialUserId, socialUserId);
|
||||
}
|
||||
|
||||
default List<SocialUserBindDO> selectListByUserIdAndUserType(Long userId, Integer userType) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -16,15 +15,15 @@ import java.util.List;
|
||||
public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
|
||||
default AdminUserDO selectByUsername(String username) {
|
||||
return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getUsername, username));
|
||||
return selectOne(AdminUserDO::getUsername, username);
|
||||
}
|
||||
|
||||
default AdminUserDO selectByEmail(String email) {
|
||||
return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getEmail, email));
|
||||
return selectOne(AdminUserDO::getEmail, email);
|
||||
}
|
||||
|
||||
default AdminUserDO selectByMobile(String mobile) {
|
||||
return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getMobile, mobile));
|
||||
return selectOne(AdminUserDO::getMobile, mobile);
|
||||
}
|
||||
|
||||
default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) {
|
||||
@@ -50,10 +49,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
|
||||
}
|
||||
|
||||
default List<AdminUserDO> selectListByUsername(String username) {
|
||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getUsername, username));
|
||||
}
|
||||
|
||||
default List<AdminUserDO> selectListByStatus(Integer status) {
|
||||
return selectList(AdminUserDO::getStatus, status);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.system.mq.consumer.mail;
|
||||
|
||||
import cn.iocoder.yudao.module.system.mq.message.mail.MailAccountRefreshMessage;
|
||||
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 针对 {@link MailAccountRefreshMessage} 的消费者
|
||||
*
|
||||
* @author wangjingyi
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MailAccountRefreshConsumer {
|
||||
|
||||
@Resource
|
||||
private MailAccountService mailAccountService;
|
||||
|
||||
@EventListener
|
||||
public void onMessage(MailAccountRefreshMessage message) {
|
||||
log.info("[onMessage][收到 Mail Account 刷新信息]");
|
||||
mailAccountService.initLocalCache();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user