Merge branch 'master' of https://gitee.com/zhijiantianya/yudao-cloud into feat/springdoc
# Conflicts: # yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/errorcode/ErrorCodeApi.java # yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApi.java # yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java # yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DictDataController {
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDatas() {
|
||||
public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList() {
|
||||
List<DictDataDO> list = dictDataService.getDictDataList();
|
||||
return success(DictDataConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class DictTypeController {
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<DictTypeSimpleRespVO>> listSimpleDictTypes() {
|
||||
public CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList() {
|
||||
List<DictTypeDO> list = dictTypeService.getDictTypeList();
|
||||
return success(DictTypeConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ public class SensitiveWordController {
|
||||
@GetMapping("/get-tags")
|
||||
@Operation(summary = "获取所有敏感词的标签数组")
|
||||
@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")
|
||||
|
||||
@@ -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;
|
||||
@@ -99,7 +100,7 @@ public class UserProfileController {
|
||||
@Operation(summary = "上传用户个人头像")
|
||||
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);
|
||||
|
||||
@@ -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,8 +23,7 @@ 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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class OperateLogServiceImpl implements OperateLogService {
|
||||
// 处理基于用户昵称的查询
|
||||
Collection<Long> userIds = null;
|
||||
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
||||
userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
||||
userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return PageResult.empty();
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class OperateLogServiceImpl implements OperateLogService {
|
||||
// 处理基于用户昵称的查询
|
||||
Collection<Long> userIds = null;
|
||||
if (StrUtil.isNotEmpty(reqVO.getUserNickname())) {
|
||||
userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
||||
userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId);
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.mail;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.mail.MailAccount;
|
||||
import cn.hutool.extra.mail.MailUtil;
|
||||
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
||||
@@ -20,15 +19,13 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 邮箱模版 服务实现类
|
||||
* 邮箱发送 Service 实现类
|
||||
*
|
||||
* @author wangjingyi
|
||||
* @since 2022-03-21
|
||||
@@ -82,14 +79,13 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
public Long sendSingleMail(String mail, Long userId, Integer userType,
|
||||
String templateCode, Map<String, Object> templateParams) {
|
||||
// 校验邮箱模版是否合法
|
||||
MailTemplateDO template = checkMailTemplateValid(templateCode);
|
||||
MailTemplateDO template = validateMailTemplate(templateCode);
|
||||
// 校验邮箱账号是否合法
|
||||
MailAccountDO account = checkMailAccountValid(template.getAccountId());
|
||||
MailAccountDO account = validateMailAccount(template.getAccountId());
|
||||
|
||||
// 校验邮箱是否存在
|
||||
mail = checkMail(mail);
|
||||
// 校验参数模版
|
||||
checkTemplateParams(template, templateParams);
|
||||
mail = validateMail(mail);
|
||||
validateTemplateParams(template, templateParams);
|
||||
|
||||
// 创建发送日志。如果模板被禁用,则不发送短信,只记录日志
|
||||
Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus());
|
||||
@@ -107,7 +103,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
@Override
|
||||
public void doSendMail(MailSendMessage message) {
|
||||
// 1. 创建发送账号
|
||||
MailAccountDO account = checkMailAccountValid(message.getAccountId());
|
||||
MailAccountDO account = validateMailAccount(message.getAccountId());
|
||||
MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname());
|
||||
// 2. 发送邮件
|
||||
try {
|
||||
@@ -122,7 +118,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public MailTemplateDO checkMailTemplateValid(String templateCode) {
|
||||
MailTemplateDO validateMailTemplate(String templateCode) {
|
||||
// 获得邮件模板。考虑到效率,从缓存中获取
|
||||
MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode);
|
||||
// 邮件模板不存在
|
||||
@@ -133,7 +129,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public MailAccountDO checkMailAccountValid(Long accountId) {
|
||||
MailAccountDO validateMailAccount(Long accountId) {
|
||||
// 获得邮箱账号。考虑到效率,从缓存中获取
|
||||
MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId);
|
||||
// 邮箱账号不存在
|
||||
@@ -144,7 +140,7 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public String checkMail(String mail) {
|
||||
String validateMail(String mail) {
|
||||
if (StrUtil.isEmpty(mail)) {
|
||||
throw exception(MAIL_SEND_MAIL_NOT_EXISTS);
|
||||
}
|
||||
@@ -152,13 +148,13 @@ public class MailSendServiceImpl implements MailSendService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数模板
|
||||
* 校验邮件参数是否确实
|
||||
*
|
||||
* @param template 邮箱模板
|
||||
* @param templateParams 原始参数
|
||||
* @param templateParams 参数列表
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void checkTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) {
|
||||
void validateTemplateParams(MailTemplateDO template, Map<String, Object> templateParams) {
|
||||
template.getParams().forEach(key -> {
|
||||
Object value = templateParams.get(key);
|
||||
if (value == null) {
|
||||
|
||||
@@ -13,7 +13,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTIFY_SEND_TEMPLATE_PARAM_MISS;
|
||||
|
||||
/**
|
||||
* 站内信发送 Service 实现类
|
||||
@@ -44,13 +45,13 @@ public class NotifySendServiceImpl implements NotifySendService {
|
||||
@Override
|
||||
public Long sendSingleNotify(Long userId, Integer userType, String templateCode, Map<String, Object> templateParams) {
|
||||
// 校验模版
|
||||
NotifyTemplateDO template = checkNotifyTemplateValid(templateCode);
|
||||
NotifyTemplateDO template = validateNotifyTemplate(templateCode);
|
||||
if (Objects.equals(template.getStatus(), CommonStatusEnum.DISABLE.getStatus())) {
|
||||
log.info("[sendSingleNotify][模版({})已经关闭,无法给用户({}/{})发送]", templateCode, userId, userType);
|
||||
return null;
|
||||
}
|
||||
// 校验参数
|
||||
checkTemplateParams(template, templateParams);
|
||||
validateTemplateParams(template, templateParams);
|
||||
|
||||
// 发送站内信
|
||||
String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams);
|
||||
@@ -58,7 +59,7 @@ public class NotifySendServiceImpl implements NotifySendService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public NotifyTemplateDO checkNotifyTemplateValid(String templateCode) {
|
||||
public NotifyTemplateDO validateNotifyTemplate(String templateCode) {
|
||||
// 获得站内信模板。考虑到效率,从缓存中获取
|
||||
NotifyTemplateDO template = notifyTemplateService.getNotifyTemplateByCodeFromCache(templateCode);
|
||||
// 站内信模板不存在
|
||||
@@ -75,7 +76,7 @@ public class NotifySendServiceImpl implements NotifySendService {
|
||||
* @param templateParams 参数列表
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void checkTemplateParams(NotifyTemplateDO template, Map<String, Object> templateParams) {
|
||||
public void validateTemplateParams(NotifyTemplateDO template, Map<String, Object> templateParams) {
|
||||
template.getParams().forEach(key -> {
|
||||
Object value = templateParams.get(key);
|
||||
if (value == null) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
|
||||
@Override
|
||||
public Long createNotifyTemplate(NotifyTemplateCreateReqVO createReqVO) {
|
||||
// 校验站内信编码是否重复
|
||||
checkNotifyTemplateCodeDuplicate(null, createReqVO.getCode());
|
||||
validateNotifyTemplateCodeDuplicate(null, createReqVO.getCode());
|
||||
|
||||
// 插入
|
||||
NotifyTemplateDO notifyTemplate = NotifyTemplateConvert.INSTANCE.convert(createReqVO);
|
||||
@@ -93,7 +93,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
|
||||
// 校验存在
|
||||
validateNotifyTemplateExists(updateReqVO.getId());
|
||||
// 校验站内信编码是否重复
|
||||
checkNotifyTemplateCodeDuplicate(updateReqVO.getId(), updateReqVO.getCode());
|
||||
validateNotifyTemplateCodeDuplicate(updateReqVO.getId(), updateReqVO.getCode());
|
||||
|
||||
// 更新
|
||||
NotifyTemplateDO updateObj = NotifyTemplateConvert.INSTANCE.convert(updateReqVO);
|
||||
@@ -136,7 +136,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkNotifyTemplateCodeDuplicate(Long id, String code) {
|
||||
public void validateNotifyTemplateCodeDuplicate(Long id, String code) {
|
||||
NotifyTemplateDO template = notifyTemplateMapper.selectByCode(code);
|
||||
if (template == null) {
|
||||
return;
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO.ID_ROOT;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -118,7 +119,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
public void updateMenu(MenuUpdateReqVO reqVO) {
|
||||
// 校验更新的菜单是否存在
|
||||
if (menuMapper.selectById(reqVO.getId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(MENU_NOT_EXISTS);
|
||||
throw exception(MENU_NOT_EXISTS);
|
||||
}
|
||||
// 校验父菜单存在
|
||||
validateParentMenu(reqVO.getParentId(), reqVO.getId());
|
||||
@@ -138,11 +139,11 @@ public class MenuServiceImpl implements MenuService {
|
||||
public void deleteMenu(Long menuId) {
|
||||
// 校验是否还有子菜单
|
||||
if (menuMapper.selectCountByParentId(menuId) > 0) {
|
||||
throw ServiceExceptionUtil.exception(MENU_EXISTS_CHILDREN);
|
||||
throw exception(MENU_EXISTS_CHILDREN);
|
||||
}
|
||||
// 校验删除的菜单是否存在
|
||||
if (menuMapper.selectById(menuId) == null) {
|
||||
throw ServiceExceptionUtil.exception(MENU_NOT_EXISTS);
|
||||
throw exception(MENU_NOT_EXISTS);
|
||||
}
|
||||
// 标记删除
|
||||
menuMapper.deleteById(menuId);
|
||||
@@ -229,17 +230,17 @@ public class MenuServiceImpl implements MenuService {
|
||||
}
|
||||
// 不能设置自己为父菜单
|
||||
if (parentId.equals(childId)) {
|
||||
throw ServiceExceptionUtil.exception(MENU_PARENT_ERROR);
|
||||
throw exception(MENU_PARENT_ERROR);
|
||||
}
|
||||
MenuDO menu = menuMapper.selectById(parentId);
|
||||
// 父菜单不存在
|
||||
if (menu == null) {
|
||||
throw ServiceExceptionUtil.exception(MENU_PARENT_NOT_EXISTS);
|
||||
throw exception(MENU_PARENT_NOT_EXISTS);
|
||||
}
|
||||
// 父菜单必须是目录或者菜单类型
|
||||
if (!MenuTypeEnum.DIR.getType().equals(menu.getType())
|
||||
&& !MenuTypeEnum.MENU.getType().equals(menu.getType())) {
|
||||
throw ServiceExceptionUtil.exception(MENU_PARENT_NOT_DIR_OR_MENU);
|
||||
throw exception(MENU_PARENT_NOT_DIR_OR_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,10 +261,10 @@ public class MenuServiceImpl implements MenuService {
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的菜单
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(MENU_NAME_DUPLICATE);
|
||||
throw exception(MENU_NAME_DUPLICATE);
|
||||
}
|
||||
if (!menu.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(MENU_NAME_DUPLICATE);
|
||||
throw exception(MENU_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public interface SensitiveWordService {
|
||||
*
|
||||
* @return 标签数组
|
||||
*/
|
||||
Set<String> getSensitiveWordTags();
|
||||
Set<String> getSensitiveWordTagSet();
|
||||
|
||||
/**
|
||||
* 获得文本所包含的不合法的敏感词数组
|
||||
|
||||
@@ -182,7 +182,7 @@ public class SensitiveWordServiceImpl implements SensitiveWordService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSensitiveWordTags() {
|
||||
public Set<String> getSensitiveWordTagSet() {
|
||||
return sensitiveWordTagsCache;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
* 短信模板 Service 实现类
|
||||
*
|
||||
* @author zzf
|
||||
* @date 2021/1/25 9:25
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -105,11 +104,11 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
@Override
|
||||
public Long createSmsTemplate(SmsTemplateCreateReqVO createReqVO) {
|
||||
// 校验短信渠道
|
||||
SmsChannelDO channelDO = checkSmsChannel(createReqVO.getChannelId());
|
||||
SmsChannelDO channelDO = validateSmsChannel(createReqVO.getChannelId());
|
||||
// 校验短信编码是否重复
|
||||
checkSmsTemplateCodeDuplicate(null, createReqVO.getCode());
|
||||
validateSmsTemplateCodeDuplicate(null, createReqVO.getCode());
|
||||
// 校验短信模板
|
||||
checkApiTemplate(createReqVO.getChannelId(), createReqVO.getApiTemplateId());
|
||||
validateApiTemplate(createReqVO.getChannelId(), createReqVO.getApiTemplateId());
|
||||
|
||||
// 插入
|
||||
SmsTemplateDO template = SmsTemplateConvert.INSTANCE.convert(createReqVO);
|
||||
@@ -127,11 +126,11 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
// 校验存在
|
||||
validateSmsTemplateExists(updateReqVO.getId());
|
||||
// 校验短信渠道
|
||||
SmsChannelDO channelDO = checkSmsChannel(updateReqVO.getChannelId());
|
||||
SmsChannelDO channelDO = validateSmsChannel(updateReqVO.getChannelId());
|
||||
// 校验短信编码是否重复
|
||||
checkSmsTemplateCodeDuplicate(updateReqVO.getId(), updateReqVO.getCode());
|
||||
validateSmsTemplateCodeDuplicate(updateReqVO.getId(), updateReqVO.getCode());
|
||||
// 校验短信模板
|
||||
checkApiTemplate(updateReqVO.getChannelId(), updateReqVO.getApiTemplateId());
|
||||
validateApiTemplate(updateReqVO.getChannelId(), updateReqVO.getApiTemplateId());
|
||||
|
||||
// 更新
|
||||
SmsTemplateDO updateObj = SmsTemplateConvert.INSTANCE.convert(updateReqVO);
|
||||
@@ -184,7 +183,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public SmsChannelDO checkSmsChannel(Long channelId) {
|
||||
public SmsChannelDO validateSmsChannel(Long channelId) {
|
||||
SmsChannelDO channelDO = smsChannelService.getSmsChannel(channelId);
|
||||
if (channelDO == null) {
|
||||
throw exception(SMS_CHANNEL_NOT_EXISTS);
|
||||
@@ -196,7 +195,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkSmsTemplateCodeDuplicate(Long id, String code) {
|
||||
public void validateSmsTemplateCodeDuplicate(Long id, String code) {
|
||||
SmsTemplateDO template = smsTemplateMapper.selectByCode(code);
|
||||
if (template == null) {
|
||||
return;
|
||||
@@ -217,7 +216,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
||||
* @param apiTemplateId API 模板编号
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void checkApiTemplate(Long channelId, String apiTemplateId) {
|
||||
public void validateApiTemplate(Long channelId, String apiTemplateId) {
|
||||
// 获得短信模板
|
||||
SmsClient smsClient = smsClientFactory.getSmsClient(channelId);
|
||||
Assert.notNull(smsClient, String.format("短信客户端(%d) 不存在", channelId));
|
||||
|
||||
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.system.service.tenant;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO;
|
||||
@@ -121,7 +120,7 @@ public interface TenantService {
|
||||
*
|
||||
* @return 租户编号数组
|
||||
*/
|
||||
List<Long> getTenantIds();
|
||||
List<Long> getTenantIdList();
|
||||
|
||||
/**
|
||||
* 校验租户是否合法
|
||||
|
||||
@@ -75,7 +75,7 @@ public class TenantServiceImpl implements TenantService {
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Override
|
||||
public List<Long> getTenantIds() {
|
||||
public List<Long> getTenantIdList() {
|
||||
List<TenantDO> tenants = tenantMapper.selectList();
|
||||
return CollectionUtils.convertList(tenants, TenantDO::getId);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public interface AdminUserService {
|
||||
* @param deptIds 部门数组
|
||||
* @return 用户数组
|
||||
*/
|
||||
List<AdminUserDO> getUsersByDeptIds(Collection<Long> deptIds);
|
||||
List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds);
|
||||
|
||||
/**
|
||||
* 获得指定岗位的用户数组
|
||||
@@ -135,7 +135,7 @@ public interface AdminUserService {
|
||||
* @param postIds 岗位数组
|
||||
* @return 用户数组
|
||||
*/
|
||||
List<AdminUserDO> getUsersByPostIds(Collection<Long> postIds);
|
||||
List<AdminUserDO> getUserListByPostIds(Collection<Long> postIds);
|
||||
|
||||
/**
|
||||
* 获得用户列表
|
||||
@@ -143,7 +143,7 @@ public interface AdminUserService {
|
||||
* @param ids 用户编号数组
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<AdminUserDO> getUsers(Collection<Long> ids);
|
||||
List<AdminUserDO> getUserList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 校验用户们是否有效。如下情况,视为无效:
|
||||
@@ -152,7 +152,7 @@ public interface AdminUserService {
|
||||
*
|
||||
* @param ids 用户编号数组
|
||||
*/
|
||||
void validUsers(Set<Long> ids);
|
||||
void validateUserList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户 Map
|
||||
@@ -164,7 +164,7 @@ public interface AdminUserService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return CollectionUtils.convertMap(getUsers(ids), AdminUserDO::getId);
|
||||
return CollectionUtils.convertMap(getUserList(ids), AdminUserDO::getId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,7 +173,7 @@ public interface AdminUserService {
|
||||
* @param reqVO 列表请求
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<AdminUserDO> getUsers(UserExportReqVO reqVO);
|
||||
List<AdminUserDO> getUserList(UserExportReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得用户列表,基于昵称模糊匹配
|
||||
@@ -181,15 +181,7 @@ public interface AdminUserService {
|
||||
* @param nickname 昵称
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<AdminUserDO> getUsersByNickname(String nickname);
|
||||
|
||||
/**
|
||||
* 获得用户列表,基于用户账号模糊匹配
|
||||
*
|
||||
* @param username 用户账号
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<AdminUserDO> getUsersByUsername(String username);
|
||||
List<AdminUserDO> getUserListByNickname(String nickname);
|
||||
|
||||
/**
|
||||
* 批量导入用户
|
||||
@@ -198,7 +190,7 @@ public interface AdminUserService {
|
||||
* @param isUpdateSupport 是否支持更新
|
||||
* @return 导入结果
|
||||
*/
|
||||
UserImportRespVO importUsers(List<UserImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||
UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||
|
||||
/**
|
||||
* 获得指定状态的用户们
|
||||
@@ -206,7 +198,7 @@ public interface AdminUserService {
|
||||
* @param status 状态
|
||||
* @return 用户们
|
||||
*/
|
||||
List<AdminUserDO> getUsersByStatus(Integer status);
|
||||
List<AdminUserDO> getUserListByStatus(Integer status);
|
||||
|
||||
/**
|
||||
* 判断密码是否匹配
|
||||
|
||||
@@ -8,7 +8,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
|
||||
@@ -43,6 +43,7 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 后台用户 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service("adminUserService")
|
||||
@@ -73,10 +74,6 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Resource
|
||||
private FileApi fileApi;
|
||||
|
||||
@Resource
|
||||
@Lazy // 循环依赖(自己依赖自己),避免报错
|
||||
private AdminUserServiceImpl self;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createUser(UserCreateReqVO reqVO) {
|
||||
@@ -88,12 +85,12 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
});
|
||||
// 校验正确性
|
||||
self.checkCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(),
|
||||
validateUserForCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(),
|
||||
reqVO.getDeptId(), reqVO.getPostIds());
|
||||
// 插入用户
|
||||
AdminUserDO user = UserConvert.INSTANCE.convert(reqVO);
|
||||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
user.setPassword(passwordEncoder.encode(reqVO.getPassword())); // 加密密码
|
||||
user.setPassword(encodePassword(reqVO.getPassword())); // 加密密码
|
||||
userMapper.insert(user);
|
||||
// 插入关联岗位
|
||||
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||
@@ -107,7 +104,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUser(UserUpdateReqVO reqVO) {
|
||||
// 校验正确性
|
||||
self.checkCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(),
|
||||
validateUserForCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(),
|
||||
reqVO.getDeptId(), reqVO.getPostIds());
|
||||
// 更新用户
|
||||
AdminUserDO updateObj = UserConvert.INSTANCE.convert(reqVO);
|
||||
@@ -141,9 +138,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
public void updateUserProfile(Long id, UserProfileUpdateReqVO reqVO) {
|
||||
// 校验正确性
|
||||
checkUserExists(id);
|
||||
checkEmailUnique(id, reqVO.getEmail());
|
||||
checkMobileUnique(id, reqVO.getMobile());
|
||||
validateUserExists(id);
|
||||
validateEmailUnique(id, reqVO.getEmail());
|
||||
validateMobileUnique(id, reqVO.getMobile());
|
||||
// 执行更新
|
||||
userMapper.updateById(UserConvert.INSTANCE.convert(reqVO).setId(id));
|
||||
}
|
||||
@@ -151,7 +148,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
public void updateUserPassword(Long id, UserProfileUpdatePasswordReqVO reqVO) {
|
||||
// 校验旧密码密码
|
||||
checkOldPassword(id, reqVO.getOldPassword());
|
||||
validateOldPassword(id, reqVO.getOldPassword());
|
||||
// 执行更新
|
||||
AdminUserDO updateObj = new AdminUserDO().setId(id);
|
||||
updateObj.setPassword(encodePassword(reqVO.getNewPassword())); // 加密密码
|
||||
@@ -160,7 +157,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Override
|
||||
public String updateUserAvatar(Long id, InputStream avatarFile) throws Exception {
|
||||
checkUserExists(id);
|
||||
validateUserExists(id);
|
||||
// 存储文件
|
||||
String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile));
|
||||
// 更新路径
|
||||
@@ -174,7 +171,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
public void updateUserPassword(Long id, String password) {
|
||||
// 校验用户存在
|
||||
checkUserExists(id);
|
||||
validateUserExists(id);
|
||||
// 更新密码
|
||||
AdminUserDO updateObj = new AdminUserDO();
|
||||
updateObj.setId(id);
|
||||
@@ -185,7 +182,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
public void updateUserStatus(Long id, Integer status) {
|
||||
// 校验用户存在
|
||||
checkUserExists(id);
|
||||
validateUserExists(id);
|
||||
// 更新状态
|
||||
AdminUserDO updateObj = new AdminUserDO();
|
||||
updateObj.setId(id);
|
||||
@@ -197,7 +194,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteUser(Long id) {
|
||||
// 校验用户存在
|
||||
checkUserExists(id);
|
||||
validateUserExists(id);
|
||||
// 删除用户
|
||||
userMapper.deleteById(id);
|
||||
// 删除用户关联数据
|
||||
@@ -227,7 +224,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsersByDeptIds(Collection<Long> deptIds) {
|
||||
public List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds) {
|
||||
if (CollUtil.isEmpty(deptIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -235,7 +232,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsersByPostIds(Collection<Long> postIds) {
|
||||
public List<AdminUserDO> getUserListByPostIds(Collection<Long> postIds) {
|
||||
if (CollUtil.isEmpty(postIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -247,7 +244,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsers(Collection<Long> ids) {
|
||||
public List<AdminUserDO> getUserList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -255,7 +252,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validUsers(Set<Long> ids) {
|
||||
public void validateUserList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
@@ -275,20 +272,15 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsers(UserExportReqVO reqVO) {
|
||||
public List<AdminUserDO> getUserList(UserExportReqVO reqVO) {
|
||||
return userMapper.selectList(reqVO, getDeptCondition(reqVO.getDeptId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsersByNickname(String nickname) {
|
||||
public List<AdminUserDO> getUserListByNickname(String nickname) {
|
||||
return userMapper.selectListByNickname(nickname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsersByUsername(String username) {
|
||||
return userMapper.selectListByUsername(username);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得部门条件:查询指定部门的子部门编号们,包括自身
|
||||
* @param deptId 部门编号
|
||||
@@ -304,25 +296,27 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
@DataPermission(enable = false) // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||
public void checkCreateOrUpdate(Long id, String username, String mobile, String email,
|
||||
Long deptId, Set<Long> postIds) {
|
||||
// 校验用户存在
|
||||
checkUserExists(id);
|
||||
// 校验用户名唯一
|
||||
checkUsernameUnique(id, username);
|
||||
// 校验手机号唯一
|
||||
checkMobileUnique(id, mobile);
|
||||
// 校验邮箱唯一
|
||||
checkEmailUnique(id, email);
|
||||
// 校验部门处于开启状态
|
||||
deptService.validateDeptList(CollectionUtils.singleton(deptId));
|
||||
// 校验岗位处于开启状态
|
||||
postService.validatePostList(postIds);
|
||||
private void validateUserForCreateOrUpdate(Long id, String username, String mobile, String email,
|
||||
Long deptId, Set<Long> postIds) {
|
||||
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||
DataPermissionUtils.executeIgnore(() -> {
|
||||
// 校验用户存在
|
||||
validateUserExists(id);
|
||||
// 校验用户名唯一
|
||||
validateUsernameUnique(id, username);
|
||||
// 校验手机号唯一
|
||||
validateMobileUnique(id, mobile);
|
||||
// 校验邮箱唯一
|
||||
validateEmailUnique(id, email);
|
||||
// 校验部门处于开启状态
|
||||
deptService.validateDeptList(CollectionUtils.singleton(deptId));
|
||||
// 校验岗位处于开启状态
|
||||
postService.validatePostList(postIds);
|
||||
});
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkUserExists(Long id) {
|
||||
void validateUserExists(Long id) {
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
@@ -333,7 +327,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkUsernameUnique(Long id, String username) {
|
||||
void validateUsernameUnique(Long id, String username) {
|
||||
if (StrUtil.isBlank(username)) {
|
||||
return;
|
||||
}
|
||||
@@ -351,7 +345,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkEmailUnique(Long id, String email) {
|
||||
void validateEmailUnique(Long id, String email) {
|
||||
if (StrUtil.isBlank(email)) {
|
||||
return;
|
||||
}
|
||||
@@ -369,7 +363,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkMobileUnique(Long id, String mobile) {
|
||||
void validateMobileUnique(Long id, String mobile) {
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
return;
|
||||
}
|
||||
@@ -392,7 +386,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
* @param oldPassword 旧密码
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void checkOldPassword(Long id, String oldPassword) {
|
||||
void validateOldPassword(Long id, String oldPassword) {
|
||||
AdminUserDO user = userMapper.selectById(id);
|
||||
if (user == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
@@ -404,7 +398,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public UserImportRespVO importUsers(List<UserImportExcelVO> importUsers, boolean isUpdateSupport) {
|
||||
public UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport) {
|
||||
if (CollUtil.isEmpty(importUsers)) {
|
||||
throw exception(USER_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
@@ -413,7 +407,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
importUsers.forEach(importUser -> {
|
||||
// 校验,判断是否有不符合的原因
|
||||
try {
|
||||
checkCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(),
|
||||
validateUserForCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(),
|
||||
importUser.getDeptId(), null);
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage());
|
||||
@@ -441,7 +435,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUsersByStatus(Integer status) {
|
||||
public List<AdminUserDO> getUserListByStatus(Integer status) {
|
||||
return userMapper.selectListByStatus(status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user