Commit 3d3c88dd4f52922c79692c9ceed6d3d6f30ad124
1 parent
1d3ca8a9
完善 AdminUserServiceImpl 单元测试
Showing
13 changed files
with
357 additions
and
142 deletions
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtils.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.datapermission.core.util; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; | |
| 4 | +import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder; | |
| 5 | +import lombok.SneakyThrows; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 数据权限 Util | |
| 9 | + * | |
| 10 | + * @author 芋道源码 | |
| 11 | + */ | |
| 12 | +public class DataPermissionUtils { | |
| 13 | + | |
| 14 | + private static DataPermission DATA_PERMISSION_DISABLE; | |
| 15 | + | |
| 16 | + @DataPermission(enable = false) | |
| 17 | + @SneakyThrows | |
| 18 | + private static DataPermission getDisableDataPermissionDisable() { | |
| 19 | + if (DATA_PERMISSION_DISABLE == null) { | |
| 20 | + DATA_PERMISSION_DISABLE = DataPermissionUtils.class | |
| 21 | + .getDeclaredMethod("getDisableDataPermissionDisable") | |
| 22 | + .getAnnotation(DataPermission.class); | |
| 23 | + } | |
| 24 | + return DATA_PERMISSION_DISABLE; | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 忽略数据权限,执行对应的逻辑 | |
| 29 | + * | |
| 30 | + * @param runnable 逻辑 | |
| 31 | + */ | |
| 32 | + public static void executeIgnore(Runnable runnable) { | |
| 33 | + DataPermission dataPermission = getDisableDataPermissionDisable(); | |
| 34 | + DataPermissionContextHolder.add(dataPermission); | |
| 35 | + try { | |
| 36 | + // 执行 runnable | |
| 37 | + runnable.run(); | |
| 38 | + } finally { | |
| 39 | + DataPermissionContextHolder.remove(); | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | +} | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/util/DataPermissionUtilsTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.datapermission.core.util; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.datapermission.core.aop.DataPermissionContextHolder; | |
| 4 | +import org.junit.jupiter.api.Test; | |
| 5 | + | |
| 6 | +import static org.junit.jupiter.api.Assertions.*; | |
| 7 | + | |
| 8 | +public class DataPermissionUtilsTest { | |
| 9 | + | |
| 10 | + @Test | |
| 11 | + public void testExecuteIgnore() { | |
| 12 | + DataPermissionUtils.executeIgnore(() -> assertFalse(DataPermissionContextHolder.get().enable())); | |
| 13 | + } | |
| 14 | + | |
| 15 | +} | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java
| ... | ... | @@ -220,7 +220,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { |
| 220 | 220 | } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.POST.getType())) { |
| 221 | 221 | postApi.validPostList(options); |
| 222 | 222 | } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER.getType())) { |
| 223 | - adminUserApi.validUsers(options); | |
| 223 | + adminUserApi.validateUserList(options); | |
| 224 | 224 | } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) { |
| 225 | 225 | userGroupService.validUserGroups(options); |
| 226 | 226 | } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) { |
| ... | ... | @@ -288,7 +288,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | private Set<Long> calculateTaskCandidateUsersByDeptMember(BpmTaskAssignRuleDO rule) { |
| 291 | - List<AdminUserRespDTO> users = adminUserApi.getUsersByDeptIds(rule.getOptions()); | |
| 291 | + List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(rule.getOptions()); | |
| 292 | 292 | return convertSet(users, AdminUserRespDTO::getId); |
| 293 | 293 | } |
| 294 | 294 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImplTest.java
| ... | ... | @@ -86,7 +86,7 @@ public class BpmTaskAssignRuleServiceImplTest extends BaseDbUnitTest { |
| 86 | 86 | // mock 方法 |
| 87 | 87 | List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L), |
| 88 | 88 | id -> new AdminUserRespDTO().setId(id)); |
| 89 | - when(adminUserApi.getUsersByDeptIds(eq(rule.getOptions()))).thenReturn(users); | |
| 89 | + when(adminUserApi.getUserListByDeptIds(eq(rule.getOptions()))).thenReturn(users); | |
| 90 | 90 | mockGetUserMap(asSet(11L, 22L)); |
| 91 | 91 | |
| 92 | 92 | // 调用 | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java
| ... | ... | @@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 6 | 6 | import java.util.Collection; |
| 7 | 7 | import java.util.List; |
| 8 | 8 | import java.util.Map; |
| 9 | -import java.util.Set; | |
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * Admin 用户 API 接口 |
| ... | ... | @@ -29,7 +28,7 @@ public interface AdminUserApi { |
| 29 | 28 | * @param ids 用户 ID 们 |
| 30 | 29 | * @return 用户对象信息 |
| 31 | 30 | */ |
| 32 | - List<AdminUserRespDTO> getUsers(Collection<Long> ids); | |
| 31 | + List<AdminUserRespDTO> getUserList(Collection<Long> ids); | |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | 34 | * 获得指定部门的用户数组 |
| ... | ... | @@ -37,7 +36,7 @@ public interface AdminUserApi { |
| 37 | 36 | * @param deptIds 部门数组 |
| 38 | 37 | * @return 用户数组 |
| 39 | 38 | */ |
| 40 | - List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds); | |
| 39 | + List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds); | |
| 41 | 40 | |
| 42 | 41 | /** |
| 43 | 42 | * 获得指定岗位的用户数组 |
| ... | ... | @@ -54,7 +53,7 @@ public interface AdminUserApi { |
| 54 | 53 | * @return 用户 Map |
| 55 | 54 | */ |
| 56 | 55 | default Map<Long, AdminUserRespDTO> getUserMap(Collection<Long> ids) { |
| 57 | - List<AdminUserRespDTO> users = getUsers(ids); | |
| 56 | + List<AdminUserRespDTO> users = getUserList(ids); | |
| 58 | 57 | return CollectionUtils.convertMap(users, AdminUserRespDTO::getId); |
| 59 | 58 | } |
| 60 | 59 | |
| ... | ... | @@ -65,6 +64,6 @@ public interface AdminUserApi { |
| 65 | 64 | * |
| 66 | 65 | * @param ids 用户编号数组 |
| 67 | 66 | */ |
| 68 | - void validUsers(Set<Long> ids); | |
| 67 | + void validateUserList(Collection<Long> ids); | |
| 69 | 68 | |
| 70 | 69 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
| ... | ... | @@ -9,7 +9,6 @@ import org.springframework.stereotype.Service; |
| 9 | 9 | import javax.annotation.Resource; |
| 10 | 10 | import java.util.Collection; |
| 11 | 11 | import java.util.List; |
| 12 | -import java.util.Set; | |
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * Admin 用户 API 实现类 |
| ... | ... | @@ -29,26 +28,26 @@ public class AdminUserApiImpl implements AdminUserApi { |
| 29 | 28 | } |
| 30 | 29 | |
| 31 | 30 | @Override |
| 32 | - public List<AdminUserRespDTO> getUsers(Collection<Long> ids) { | |
| 33 | - List<AdminUserDO> users = userService.getUsers(ids); | |
| 31 | + public List<AdminUserRespDTO> getUserList(Collection<Long> ids) { | |
| 32 | + List<AdminUserDO> users = userService.getUserList(ids); | |
| 34 | 33 | return UserConvert.INSTANCE.convertList4(users); |
| 35 | 34 | } |
| 36 | 35 | |
| 37 | 36 | @Override |
| 38 | - public List<AdminUserRespDTO> getUsersByDeptIds(Collection<Long> deptIds) { | |
| 39 | - List<AdminUserDO> users = userService.getUsersByDeptIds(deptIds); | |
| 37 | + public List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds) { | |
| 38 | + List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds); | |
| 40 | 39 | return UserConvert.INSTANCE.convertList4(users); |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | 42 | @Override |
| 44 | 43 | public List<AdminUserRespDTO> getUsersByPostIds(Collection<Long> postIds) { |
| 45 | - List<AdminUserDO> users = userService.getUsersByPostIds(postIds); | |
| 44 | + List<AdminUserDO> users = userService.getUserListByPostIds(postIds); | |
| 46 | 45 | return UserConvert.INSTANCE.convertList4(users); |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | @Override |
| 50 | - public void validUsers(Set<Long> ids) { | |
| 51 | - userService.validUsers(ids); | |
| 49 | + public void validateUserList(Collection<Long> ids) { | |
| 50 | + userService.validateUserList(ids); | |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | 53 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
| ... | ... | @@ -111,9 +111,9 @@ public class UserController { |
| 111 | 111 | |
| 112 | 112 | @GetMapping("/list-all-simple") |
| 113 | 113 | @ApiOperation(value = "获取用户精简信息列表", notes = "只包含被开启的用户,主要用于前端的下拉选项") |
| 114 | - public CommonResult<List<UserSimpleRespVO>> getSimpleUsers() { | |
| 114 | + public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() { | |
| 115 | 115 | // 获用户列表,只要开启状态的 |
| 116 | - List<AdminUserDO> list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 116 | + List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 117 | 117 | // 排序后,返回给前端 |
| 118 | 118 | return success(UserConvert.INSTANCE.convertList04(list)); |
| 119 | 119 | } |
| ... | ... | @@ -122,7 +122,7 @@ public class UserController { |
| 122 | 122 | @ApiOperation("获得用户详情") |
| 123 | 123 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 124 | 124 | @PreAuthorize("@ss.hasPermission('system:user:query')") |
| 125 | - public CommonResult<UserRespVO> getInfo(@RequestParam("id") Long id) { | |
| 125 | + public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) { | |
| 126 | 126 | return success(UserConvert.INSTANCE.convert(userService.getUser(id))); |
| 127 | 127 | } |
| 128 | 128 | |
| ... | ... | @@ -130,10 +130,10 @@ public class UserController { |
| 130 | 130 | @ApiOperation("导出用户") |
| 131 | 131 | @PreAuthorize("@ss.hasPermission('system:user:export')") |
| 132 | 132 | @OperateLog(type = EXPORT) |
| 133 | - public void exportUsers(@Validated UserExportReqVO reqVO, | |
| 134 | - HttpServletResponse response) throws IOException { | |
| 133 | + public void exportUserList(@Validated UserExportReqVO reqVO, | |
| 134 | + HttpServletResponse response) throws IOException { | |
| 135 | 135 | // 获得用户列表 |
| 136 | - List<AdminUserDO> users = userService.getUsers(reqVO); | |
| 136 | + List<AdminUserDO> users = userService.getUserList(reqVO); | |
| 137 | 137 | |
| 138 | 138 | // 获得拼接需要的数据 |
| 139 | 139 | Collection<Long> deptIds = convertList(users, AdminUserDO::getDeptId); |
| ... | ... | @@ -183,7 +183,7 @@ public class UserController { |
| 183 | 183 | public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file, |
| 184 | 184 | @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { |
| 185 | 185 | List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class); |
| 186 | - return success(userService.importUsers(list, updateSupport)); | |
| 186 | + return success(userService.importUserList(list, updateSupport)); | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java
| ... | ... | @@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | 6 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; |
| 9 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 10 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 10 | |
| 12 | 11 | import java.util.Collection; |
| ... | ... | @@ -16,15 +15,15 @@ import java.util.List; |
| 16 | 15 | public interface AdminUserMapper extends BaseMapperX<AdminUserDO> { |
| 17 | 16 | |
| 18 | 17 | default AdminUserDO selectByUsername(String username) { |
| 19 | - return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getUsername, username)); | |
| 18 | + return selectOne(AdminUserDO::getUsername, username); | |
| 20 | 19 | } |
| 21 | 20 | |
| 22 | 21 | default AdminUserDO selectByEmail(String email) { |
| 23 | - return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getEmail, email)); | |
| 22 | + return selectOne(AdminUserDO::getEmail, email); | |
| 24 | 23 | } |
| 25 | 24 | |
| 26 | 25 | default AdminUserDO selectByMobile(String mobile) { |
| 27 | - return selectOne(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getMobile, mobile)); | |
| 26 | + return selectOne(AdminUserDO::getMobile, mobile); | |
| 28 | 27 | } |
| 29 | 28 | |
| 30 | 29 | default PageResult<AdminUserDO> selectPage(UserPageReqVO reqVO, Collection<Long> deptIds) { |
| ... | ... | @@ -50,10 +49,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> { |
| 50 | 49 | return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname)); |
| 51 | 50 | } |
| 52 | 51 | |
| 53 | - default List<AdminUserDO> selectListByUsername(String username) { | |
| 54 | - return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getUsername, username)); | |
| 55 | - } | |
| 56 | - | |
| 57 | 52 | default List<AdminUserDO> selectListByStatus(Integer status) { |
| 58 | 53 | return selectList(AdminUserDO::getStatus, status); |
| 59 | 54 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java
| ... | ... | @@ -49,7 +49,7 @@ public class OperateLogServiceImpl implements OperateLogService { |
| 49 | 49 | // 处理基于用户昵称的查询 |
| 50 | 50 | Collection<Long> userIds = null; |
| 51 | 51 | if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { |
| 52 | - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId); | |
| 52 | + userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId); | |
| 53 | 53 | if (CollUtil.isEmpty(userIds)) { |
| 54 | 54 | return PageResult.empty(); |
| 55 | 55 | } |
| ... | ... | @@ -63,7 +63,7 @@ public class OperateLogServiceImpl implements OperateLogService { |
| 63 | 63 | // 处理基于用户昵称的查询 |
| 64 | 64 | Collection<Long> userIds = null; |
| 65 | 65 | if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { |
| 66 | - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), AdminUserDO::getId); | |
| 66 | + userIds = convertSet(userService.getUserListByNickname(reqVO.getUserNickname()), AdminUserDO::getId); | |
| 67 | 67 | if (CollUtil.isEmpty(userIds)) { |
| 68 | 68 | return Collections.emptyList(); |
| 69 | 69 | } | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java
| ... | ... | @@ -127,7 +127,7 @@ public interface AdminUserService { |
| 127 | 127 | * @param deptIds 部门数组 |
| 128 | 128 | * @return 用户数组 |
| 129 | 129 | */ |
| 130 | - List<AdminUserDO> getUsersByDeptIds(Collection<Long> deptIds); | |
| 130 | + List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds); | |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * 获得指定岗位的用户数组 |
| ... | ... | @@ -135,7 +135,7 @@ public interface AdminUserService { |
| 135 | 135 | * @param postIds 岗位数组 |
| 136 | 136 | * @return 用户数组 |
| 137 | 137 | */ |
| 138 | - List<AdminUserDO> getUsersByPostIds(Collection<Long> postIds); | |
| 138 | + List<AdminUserDO> getUserListByPostIds(Collection<Long> postIds); | |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * 获得用户列表 |
| ... | ... | @@ -143,7 +143,7 @@ public interface AdminUserService { |
| 143 | 143 | * @param ids 用户编号数组 |
| 144 | 144 | * @return 用户列表 |
| 145 | 145 | */ |
| 146 | - List<AdminUserDO> getUsers(Collection<Long> ids); | |
| 146 | + List<AdminUserDO> getUserList(Collection<Long> ids); | |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * 校验用户们是否有效。如下情况,视为无效: |
| ... | ... | @@ -152,7 +152,7 @@ public interface AdminUserService { |
| 152 | 152 | * |
| 153 | 153 | * @param ids 用户编号数组 |
| 154 | 154 | */ |
| 155 | - void validUsers(Set<Long> ids); | |
| 155 | + void validateUserList(Collection<Long> ids); | |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * 获得用户 Map |
| ... | ... | @@ -164,7 +164,7 @@ public interface AdminUserService { |
| 164 | 164 | if (CollUtil.isEmpty(ids)) { |
| 165 | 165 | return new HashMap<>(); |
| 166 | 166 | } |
| 167 | - return CollectionUtils.convertMap(getUsers(ids), AdminUserDO::getId); | |
| 167 | + return CollectionUtils.convertMap(getUserList(ids), AdminUserDO::getId); | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
| ... | ... | @@ -173,7 +173,7 @@ public interface AdminUserService { |
| 173 | 173 | * @param reqVO 列表请求 |
| 174 | 174 | * @return 用户列表 |
| 175 | 175 | */ |
| 176 | - List<AdminUserDO> getUsers(UserExportReqVO reqVO); | |
| 176 | + List<AdminUserDO> getUserList(UserExportReqVO reqVO); | |
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * 获得用户列表,基于昵称模糊匹配 |
| ... | ... | @@ -181,15 +181,7 @@ public interface AdminUserService { |
| 181 | 181 | * @param nickname 昵称 |
| 182 | 182 | * @return 用户列表 |
| 183 | 183 | */ |
| 184 | - List<AdminUserDO> getUsersByNickname(String nickname); | |
| 185 | - | |
| 186 | - /** | |
| 187 | - * 获得用户列表,基于用户账号模糊匹配 | |
| 188 | - * | |
| 189 | - * @param username 用户账号 | |
| 190 | - * @return 用户列表 | |
| 191 | - */ | |
| 192 | - List<AdminUserDO> getUsersByUsername(String username); | |
| 184 | + List<AdminUserDO> getUserListByNickname(String nickname); | |
| 193 | 185 | |
| 194 | 186 | /** |
| 195 | 187 | * 批量导入用户 |
| ... | ... | @@ -198,7 +190,7 @@ public interface AdminUserService { |
| 198 | 190 | * @param isUpdateSupport 是否支持更新 |
| 199 | 191 | * @return 导入结果 |
| 200 | 192 | */ |
| 201 | - UserImportRespVO importUsers(List<UserImportExcelVO> importUsers, boolean isUpdateSupport); | |
| 193 | + UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport); | |
| 202 | 194 | |
| 203 | 195 | /** |
| 204 | 196 | * 获得指定状态的用户们 |
| ... | ... | @@ -206,7 +198,7 @@ public interface AdminUserService { |
| 206 | 198 | * @param status 状态 |
| 207 | 199 | * @return 用户们 |
| 208 | 200 | */ |
| 209 | - List<AdminUserDO> getUsersByStatus(Integer status); | |
| 201 | + List<AdminUserDO> getUserListByStatus(Integer status); | |
| 210 | 202 | |
| 211 | 203 | /** |
| 212 | 204 | * 判断密码是否匹配 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
| ... | ... | @@ -8,7 +8,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 11 | -import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission; | |
| 11 | +import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils; | |
| 12 | 12 | import cn.iocoder.yudao.module.infra.api.file.FileApi; |
| 13 | 13 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; |
| 14 | 14 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; |
| ... | ... | @@ -74,10 +74,6 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 74 | 74 | @Resource |
| 75 | 75 | private FileApi fileApi; |
| 76 | 76 | |
| 77 | - @Resource | |
| 78 | - @Lazy // 循环依赖(自己依赖自己),避免报错 | |
| 79 | - private AdminUserServiceImpl self; | |
| 80 | - | |
| 81 | 77 | @Override |
| 82 | 78 | @Transactional(rollbackFor = Exception.class) |
| 83 | 79 | public Long createUser(UserCreateReqVO reqVO) { |
| ... | ... | @@ -89,7 +85,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 89 | 85 | } |
| 90 | 86 | }); |
| 91 | 87 | // 校验正确性 |
| 92 | - self.checkCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), | |
| 88 | + validateUserForCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), | |
| 93 | 89 | reqVO.getDeptId(), reqVO.getPostIds()); |
| 94 | 90 | // 插入用户 |
| 95 | 91 | AdminUserDO user = UserConvert.INSTANCE.convert(reqVO); |
| ... | ... | @@ -108,7 +104,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 108 | 104 | @Transactional(rollbackFor = Exception.class) |
| 109 | 105 | public void updateUser(UserUpdateReqVO reqVO) { |
| 110 | 106 | // 校验正确性 |
| 111 | - self.checkCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), | |
| 107 | + validateUserForCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), | |
| 112 | 108 | reqVO.getDeptId(), reqVO.getPostIds()); |
| 113 | 109 | // 更新用户 |
| 114 | 110 | AdminUserDO updateObj = UserConvert.INSTANCE.convert(reqVO); |
| ... | ... | @@ -142,9 +138,9 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 142 | 138 | @Override |
| 143 | 139 | public void updateUserProfile(Long id, UserProfileUpdateReqVO reqVO) { |
| 144 | 140 | // 校验正确性 |
| 145 | - checkUserExists(id); | |
| 146 | - checkEmailUnique(id, reqVO.getEmail()); | |
| 147 | - checkMobileUnique(id, reqVO.getMobile()); | |
| 141 | + validateUserExists(id); | |
| 142 | + validateEmailUnique(id, reqVO.getEmail()); | |
| 143 | + validateMobileUnique(id, reqVO.getMobile()); | |
| 148 | 144 | // 执行更新 |
| 149 | 145 | userMapper.updateById(UserConvert.INSTANCE.convert(reqVO).setId(id)); |
| 150 | 146 | } |
| ... | ... | @@ -152,7 +148,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 152 | 148 | @Override |
| 153 | 149 | public void updateUserPassword(Long id, UserProfileUpdatePasswordReqVO reqVO) { |
| 154 | 150 | // 校验旧密码密码 |
| 155 | - checkOldPassword(id, reqVO.getOldPassword()); | |
| 151 | + validateOldPassword(id, reqVO.getOldPassword()); | |
| 156 | 152 | // 执行更新 |
| 157 | 153 | AdminUserDO updateObj = new AdminUserDO().setId(id); |
| 158 | 154 | updateObj.setPassword(encodePassword(reqVO.getNewPassword())); // 加密密码 |
| ... | ... | @@ -161,7 +157,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 161 | 157 | |
| 162 | 158 | @Override |
| 163 | 159 | public String updateUserAvatar(Long id, InputStream avatarFile) throws Exception { |
| 164 | - checkUserExists(id); | |
| 160 | + validateUserExists(id); | |
| 165 | 161 | // 存储文件 |
| 166 | 162 | String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); |
| 167 | 163 | // 更新路径 |
| ... | ... | @@ -175,7 +171,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 175 | 171 | @Override |
| 176 | 172 | public void updateUserPassword(Long id, String password) { |
| 177 | 173 | // 校验用户存在 |
| 178 | - checkUserExists(id); | |
| 174 | + validateUserExists(id); | |
| 179 | 175 | // 更新密码 |
| 180 | 176 | AdminUserDO updateObj = new AdminUserDO(); |
| 181 | 177 | updateObj.setId(id); |
| ... | ... | @@ -186,7 +182,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 186 | 182 | @Override |
| 187 | 183 | public void updateUserStatus(Long id, Integer status) { |
| 188 | 184 | // 校验用户存在 |
| 189 | - checkUserExists(id); | |
| 185 | + validateUserExists(id); | |
| 190 | 186 | // 更新状态 |
| 191 | 187 | AdminUserDO updateObj = new AdminUserDO(); |
| 192 | 188 | updateObj.setId(id); |
| ... | ... | @@ -198,7 +194,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 198 | 194 | @Transactional(rollbackFor = Exception.class) |
| 199 | 195 | public void deleteUser(Long id) { |
| 200 | 196 | // 校验用户存在 |
| 201 | - checkUserExists(id); | |
| 197 | + validateUserExists(id); | |
| 202 | 198 | // 删除用户 |
| 203 | 199 | userMapper.deleteById(id); |
| 204 | 200 | // 删除用户关联数据 |
| ... | ... | @@ -228,7 +224,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 228 | 224 | } |
| 229 | 225 | |
| 230 | 226 | @Override |
| 231 | - public List<AdminUserDO> getUsersByDeptIds(Collection<Long> deptIds) { | |
| 227 | + public List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds) { | |
| 232 | 228 | if (CollUtil.isEmpty(deptIds)) { |
| 233 | 229 | return Collections.emptyList(); |
| 234 | 230 | } |
| ... | ... | @@ -236,7 +232,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 236 | 232 | } |
| 237 | 233 | |
| 238 | 234 | @Override |
| 239 | - public List<AdminUserDO> getUsersByPostIds(Collection<Long> postIds) { | |
| 235 | + public List<AdminUserDO> getUserListByPostIds(Collection<Long> postIds) { | |
| 240 | 236 | if (CollUtil.isEmpty(postIds)) { |
| 241 | 237 | return Collections.emptyList(); |
| 242 | 238 | } |
| ... | ... | @@ -248,7 +244,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 248 | 244 | } |
| 249 | 245 | |
| 250 | 246 | @Override |
| 251 | - public List<AdminUserDO> getUsers(Collection<Long> ids) { | |
| 247 | + public List<AdminUserDO> getUserList(Collection<Long> ids) { | |
| 252 | 248 | if (CollUtil.isEmpty(ids)) { |
| 253 | 249 | return Collections.emptyList(); |
| 254 | 250 | } |
| ... | ... | @@ -256,7 +252,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 256 | 252 | } |
| 257 | 253 | |
| 258 | 254 | @Override |
| 259 | - public void validUsers(Set<Long> ids) { | |
| 255 | + public void validateUserList(Collection<Long> ids) { | |
| 260 | 256 | if (CollUtil.isEmpty(ids)) { |
| 261 | 257 | return; |
| 262 | 258 | } |
| ... | ... | @@ -276,20 +272,15 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 276 | 272 | } |
| 277 | 273 | |
| 278 | 274 | @Override |
| 279 | - public List<AdminUserDO> getUsers(UserExportReqVO reqVO) { | |
| 275 | + public List<AdminUserDO> getUserList(UserExportReqVO reqVO) { | |
| 280 | 276 | return userMapper.selectList(reqVO, getDeptCondition(reqVO.getDeptId())); |
| 281 | 277 | } |
| 282 | 278 | |
| 283 | 279 | @Override |
| 284 | - public List<AdminUserDO> getUsersByNickname(String nickname) { | |
| 280 | + public List<AdminUserDO> getUserListByNickname(String nickname) { | |
| 285 | 281 | return userMapper.selectListByNickname(nickname); |
| 286 | 282 | } |
| 287 | 283 | |
| 288 | - @Override | |
| 289 | - public List<AdminUserDO> getUsersByUsername(String username) { | |
| 290 | - return userMapper.selectListByUsername(username); | |
| 291 | - } | |
| 292 | - | |
| 293 | 284 | /** |
| 294 | 285 | * 获得部门条件:查询指定部门的子部门编号们,包括自身 |
| 295 | 286 | * @param deptId 部门编号 |
| ... | ... | @@ -305,25 +296,27 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 305 | 296 | return deptIds; |
| 306 | 297 | } |
| 307 | 298 | |
| 308 | - @DataPermission(enable = false) // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 | |
| 309 | - public void checkCreateOrUpdate(Long id, String username, String mobile, String email, | |
| 310 | - Long deptId, Set<Long> postIds) { | |
| 311 | - // 校验用户存在 | |
| 312 | - checkUserExists(id); | |
| 313 | - // 校验用户名唯一 | |
| 314 | - checkUsernameUnique(id, username); | |
| 315 | - // 校验手机号唯一 | |
| 316 | - checkMobileUnique(id, mobile); | |
| 317 | - // 校验邮箱唯一 | |
| 318 | - checkEmailUnique(id, email); | |
| 319 | - // 校验部门处于开启状态 | |
| 320 | - deptService.validateDeptList(CollectionUtils.singleton(deptId)); | |
| 321 | - // 校验岗位处于开启状态 | |
| 322 | - postService.validatePostList(postIds); | |
| 299 | + private void validateUserForCreateOrUpdate(Long id, String username, String mobile, String email, | |
| 300 | + Long deptId, Set<Long> postIds) { | |
| 301 | + // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 | |
| 302 | + DataPermissionUtils.executeIgnore(() -> { | |
| 303 | + // 校验用户存在 | |
| 304 | + validateUserExists(id); | |
| 305 | + // 校验用户名唯一 | |
| 306 | + validateUsernameUnique(id, username); | |
| 307 | + // 校验手机号唯一 | |
| 308 | + validateMobileUnique(id, mobile); | |
| 309 | + // 校验邮箱唯一 | |
| 310 | + validateEmailUnique(id, email); | |
| 311 | + // 校验部门处于开启状态 | |
| 312 | + deptService.validateDeptList(CollectionUtils.singleton(deptId)); | |
| 313 | + // 校验岗位处于开启状态 | |
| 314 | + postService.validatePostList(postIds); | |
| 315 | + }); | |
| 323 | 316 | } |
| 324 | 317 | |
| 325 | 318 | @VisibleForTesting |
| 326 | - public void checkUserExists(Long id) { | |
| 319 | + void validateUserExists(Long id) { | |
| 327 | 320 | if (id == null) { |
| 328 | 321 | return; |
| 329 | 322 | } |
| ... | ... | @@ -334,7 +327,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 334 | 327 | } |
| 335 | 328 | |
| 336 | 329 | @VisibleForTesting |
| 337 | - public void checkUsernameUnique(Long id, String username) { | |
| 330 | + void validateUsernameUnique(Long id, String username) { | |
| 338 | 331 | if (StrUtil.isBlank(username)) { |
| 339 | 332 | return; |
| 340 | 333 | } |
| ... | ... | @@ -352,7 +345,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 352 | 345 | } |
| 353 | 346 | |
| 354 | 347 | @VisibleForTesting |
| 355 | - public void checkEmailUnique(Long id, String email) { | |
| 348 | + void validateEmailUnique(Long id, String email) { | |
| 356 | 349 | if (StrUtil.isBlank(email)) { |
| 357 | 350 | return; |
| 358 | 351 | } |
| ... | ... | @@ -370,7 +363,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 370 | 363 | } |
| 371 | 364 | |
| 372 | 365 | @VisibleForTesting |
| 373 | - public void checkMobileUnique(Long id, String mobile) { | |
| 366 | + void validateMobileUnique(Long id, String mobile) { | |
| 374 | 367 | if (StrUtil.isBlank(mobile)) { |
| 375 | 368 | return; |
| 376 | 369 | } |
| ... | ... | @@ -393,7 +386,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 393 | 386 | * @param oldPassword 旧密码 |
| 394 | 387 | */ |
| 395 | 388 | @VisibleForTesting |
| 396 | - public void checkOldPassword(Long id, String oldPassword) { | |
| 389 | + void validateOldPassword(Long id, String oldPassword) { | |
| 397 | 390 | AdminUserDO user = userMapper.selectById(id); |
| 398 | 391 | if (user == null) { |
| 399 | 392 | throw exception(USER_NOT_EXISTS); |
| ... | ... | @@ -405,7 +398,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 405 | 398 | |
| 406 | 399 | @Override |
| 407 | 400 | @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 |
| 408 | - public UserImportRespVO importUsers(List<UserImportExcelVO> importUsers, boolean isUpdateSupport) { | |
| 401 | + public UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport) { | |
| 409 | 402 | if (CollUtil.isEmpty(importUsers)) { |
| 410 | 403 | throw exception(USER_IMPORT_LIST_IS_EMPTY); |
| 411 | 404 | } |
| ... | ... | @@ -414,7 +407,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 414 | 407 | importUsers.forEach(importUser -> { |
| 415 | 408 | // 校验,判断是否有不符合的原因 |
| 416 | 409 | try { |
| 417 | - checkCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(), | |
| 410 | + validateUserForCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(), | |
| 418 | 411 | importUser.getDeptId(), null); |
| 419 | 412 | } catch (ServiceException ex) { |
| 420 | 413 | respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage()); |
| ... | ... | @@ -442,7 +435,7 @@ public class AdminUserServiceImpl implements AdminUserService { |
| 442 | 435 | } |
| 443 | 436 | |
| 444 | 437 | @Override |
| 445 | - public List<AdminUserDO> getUsersByStatus(Integer status) { | |
| 438 | + public List<AdminUserDO> getUserListByStatus(Integer status) { | |
| 446 | 439 | return userMapper.selectListByStatus(status); |
| 447 | 440 | } |
| 448 | 441 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java
| ... | ... | @@ -64,7 +64,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest { |
| 64 | 64 | o.setNickname("wang"); |
| 65 | 65 | o.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 66 | 66 | }); |
| 67 | - when(userService.getUsersByNickname("wang")).thenReturn(Collections.singletonList(user)); | |
| 67 | + when(userService.getUserListByNickname("wang")).thenReturn(Collections.singletonList(user)); | |
| 68 | 68 | Long userId = user.getId(); |
| 69 | 69 | |
| 70 | 70 | // 构造操作日志 |
| ... | ... | @@ -112,7 +112,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest { |
| 112 | 112 | o.setNickname("wang"); |
| 113 | 113 | o.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 114 | 114 | }); |
| 115 | - when(userService.getUsersByNickname("wang")).thenReturn(Collections.singletonList(user)); | |
| 115 | + when(userService.getUserListByNickname("wang")).thenReturn(Collections.singletonList(user)); | |
| 116 | 116 | Long userId = user.getId(); |
| 117 | 117 | |
| 118 | 118 | // 构造操作日志 | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java
| ... | ... | @@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 9 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 10 | 9 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 11 | 10 | import cn.iocoder.yudao.module.infra.api.file.FileApi; |
| 12 | 11 | import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; |
| ... | ... | @@ -32,23 +31,25 @@ import org.springframework.security.crypto.password.PasswordEncoder; |
| 32 | 31 | |
| 33 | 32 | import javax.annotation.Resource; |
| 34 | 33 | import java.io.ByteArrayInputStream; |
| 35 | -import java.time.LocalDateTime; | |
| 36 | 34 | import java.util.Collection; |
| 37 | 35 | import java.util.List; |
| 36 | +import java.util.Map; | |
| 38 | 37 | import java.util.function.Consumer; |
| 39 | 38 | |
| 40 | 39 | import static cn.hutool.core.util.RandomUtil.randomBytes; |
| 41 | 40 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| 42 | 41 | import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; |
| 42 | +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; | |
| 43 | 43 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; |
| 44 | +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | |
| 44 | 45 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 45 | 46 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; |
| 46 | 47 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; |
| 47 | 48 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; |
| 48 | 49 | import static java.util.Collections.singleton; |
| 50 | +import static java.util.Collections.singletonList; | |
| 49 | 51 | import static org.assertj.core.util.Lists.newArrayList; |
| 50 | -import static org.junit.jupiter.api.Assertions.assertEquals; | |
| 51 | -import static org.junit.jupiter.api.Assertions.assertNull; | |
| 52 | +import static org.junit.jupiter.api.Assertions.*; | |
| 52 | 53 | import static org.mockito.ArgumentMatchers.*; |
| 53 | 54 | import static org.mockito.Mockito.*; |
| 54 | 55 | |
| ... | ... | @@ -174,6 +175,23 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 174 | 175 | } |
| 175 | 176 | |
| 176 | 177 | @Test |
| 178 | + public void testUpdateUserLogin() { | |
| 179 | + // mock 数据 | |
| 180 | + AdminUserDO user = randomAdminUserDO(o -> o.setLoginDate(null)); | |
| 181 | + userMapper.insert(user); | |
| 182 | + // 准备参数 | |
| 183 | + Long id = user.getId(); | |
| 184 | + String loginIp = randomString(); | |
| 185 | + | |
| 186 | + // 调用 | |
| 187 | + userService.updateUserLogin(id, loginIp); | |
| 188 | + // 断言 | |
| 189 | + AdminUserDO dbUser = userMapper.selectById(id); | |
| 190 | + assertEquals(loginIp, dbUser.getLoginIp()); | |
| 191 | + assertNotNull(dbUser.getLoginDate()); | |
| 192 | + } | |
| 193 | + | |
| 194 | + @Test | |
| 177 | 195 | public void testUpdateUserProfile_success() { |
| 178 | 196 | // mock 数据 |
| 179 | 197 | AdminUserDO dbUser = randomAdminUserDO(); |
| ... | ... | @@ -287,6 +305,34 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 287 | 305 | } |
| 288 | 306 | |
| 289 | 307 | @Test |
| 308 | + public void testGetUserByUsername() { | |
| 309 | + // mock 数据 | |
| 310 | + AdminUserDO dbUser = randomAdminUserDO(); | |
| 311 | + userMapper.insert(dbUser); | |
| 312 | + // 准备参数 | |
| 313 | + String username = dbUser.getUsername(); | |
| 314 | + | |
| 315 | + // 调用 | |
| 316 | + AdminUserDO user = userService.getUserByUsername(username); | |
| 317 | + // 断言 | |
| 318 | + assertPojoEquals(dbUser, user); | |
| 319 | + } | |
| 320 | + | |
| 321 | + @Test | |
| 322 | + public void testGetUserByMobile() { | |
| 323 | + // mock 数据 | |
| 324 | + AdminUserDO dbUser = randomAdminUserDO(); | |
| 325 | + userMapper.insert(dbUser); | |
| 326 | + // 准备参数 | |
| 327 | + String mobile = dbUser.getMobile(); | |
| 328 | + | |
| 329 | + // 调用 | |
| 330 | + AdminUserDO user = userService.getUserByMobile(mobile); | |
| 331 | + // 断言 | |
| 332 | + assertPojoEquals(dbUser, user); | |
| 333 | + } | |
| 334 | + | |
| 335 | + @Test | |
| 290 | 336 | public void testGetUserPage() { |
| 291 | 337 | // mock 数据 |
| 292 | 338 | AdminUserDO dbUser = initGetUserPageData(); |
| ... | ... | @@ -295,7 +341,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 295 | 341 | reqVO.setUsername("tu"); |
| 296 | 342 | reqVO.setMobile("1560"); |
| 297 | 343 | reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 298 | - reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)})); | |
| 344 | + reqVO.setCreateTime(buildBetweenTime(2020, 12, 1, 2020, 12, 24)); | |
| 299 | 345 | reqVO.setDeptId(1L); // 其中,1L 是 2L 的父部门 |
| 300 | 346 | // mock 方法 |
| 301 | 347 | List<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L))); |
| ... | ... | @@ -310,7 +356,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 310 | 356 | } |
| 311 | 357 | |
| 312 | 358 | @Test |
| 313 | - public void testGetUsers() { | |
| 359 | + public void testGetUserList_export() { | |
| 314 | 360 | // mock 数据 |
| 315 | 361 | AdminUserDO dbUser = initGetUserPageData(); |
| 316 | 362 | // 准备参数 |
| ... | ... | @@ -318,14 +364,14 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 318 | 364 | reqVO.setUsername("tu"); |
| 319 | 365 | reqVO.setMobile("1560"); |
| 320 | 366 | reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| 321 | - reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)})); | |
| 367 | + reqVO.setCreateTime(buildBetweenTime(2020, 12, 1, 2020, 12, 24)); | |
| 322 | 368 | reqVO.setDeptId(1L); // 其中,1L 是 2L 的父部门 |
| 323 | 369 | // mock 方法 |
| 324 | 370 | List<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L))); |
| 325 | 371 | when(deptService.getDeptListByParentIdFromCache(eq(reqVO.getDeptId()), eq(true))).thenReturn(deptList); |
| 326 | 372 | |
| 327 | 373 | // 调用 |
| 328 | - List<AdminUserDO> list = userService.getUsers(reqVO); | |
| 374 | + List<AdminUserDO> list = userService.getUserList(reqVO); | |
| 329 | 375 | // 断言 |
| 330 | 376 | assertEquals(1, list.size()); |
| 331 | 377 | assertPojoEquals(dbUser, list.get(0)); |
| ... | ... | @@ -345,23 +391,54 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 345 | 391 | }); |
| 346 | 392 | userMapper.insert(dbUser); |
| 347 | 393 | // 测试 username 不匹配 |
| 348 | - userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setUsername("dou"))); | |
| 394 | + userMapper.insert(cloneIgnoreId(dbUser, o -> o.setUsername("dou"))); | |
| 349 | 395 | // 测试 mobile 不匹配 |
| 350 | - userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setMobile("18818260888"))); | |
| 396 | + userMapper.insert(cloneIgnoreId(dbUser, o -> o.setMobile("18818260888"))); | |
| 351 | 397 | // 测试 status 不匹配 |
| 352 | - userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); | |
| 398 | + userMapper.insert(cloneIgnoreId(dbUser, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); | |
| 353 | 399 | // 测试 createTime 不匹配 |
| 354 | - userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setCreateTime(buildTime(2020, 11, 11)))); | |
| 400 | + userMapper.insert(cloneIgnoreId(dbUser, o -> o.setCreateTime(buildTime(2020, 11, 11)))); | |
| 355 | 401 | // 测试 dept 不匹配 |
| 356 | - userMapper.insert(ObjectUtils.cloneIgnoreId(dbUser, o -> o.setDeptId(0L))); | |
| 402 | + userMapper.insert(cloneIgnoreId(dbUser, o -> o.setDeptId(0L))); | |
| 357 | 403 | return dbUser; |
| 358 | 404 | } |
| 359 | 405 | |
| 406 | + @Test | |
| 407 | + public void testGetUser() { | |
| 408 | + // mock 数据 | |
| 409 | + AdminUserDO dbUser = randomAdminUserDO(); | |
| 410 | + userMapper.insert(dbUser); | |
| 411 | + // 准备参数 | |
| 412 | + Long userId = dbUser.getId(); | |
| 413 | + | |
| 414 | + // 调用 | |
| 415 | + AdminUserDO user = userService.getUser(userId); | |
| 416 | + // 断言 | |
| 417 | + assertPojoEquals(dbUser, user); | |
| 418 | + } | |
| 419 | + | |
| 420 | + @Test | |
| 421 | + public void testGetUserListByDeptIds() { | |
| 422 | + // mock 数据 | |
| 423 | + AdminUserDO dbUser = randomAdminUserDO(o -> o.setDeptId(1L)); | |
| 424 | + userMapper.insert(dbUser); | |
| 425 | + // 测试 deptId 不匹配 | |
| 426 | + userMapper.insert(cloneIgnoreId(dbUser, o -> o.setDeptId(2L))); | |
| 427 | + // 准备参数 | |
| 428 | + Collection<Long> deptIds = singleton(1L); | |
| 429 | + | |
| 430 | + // 调用 | |
| 431 | + List<AdminUserDO> list = userService.getUserListByDeptIds(deptIds); | |
| 432 | + // 断言 | |
| 433 | + assertEquals(1, list.size()); | |
| 434 | + assertEquals(dbUser, list.get(0)); | |
| 435 | + } | |
| 436 | + | |
| 360 | 437 | /** |
| 361 | 438 | * 情况一,校验不通过,导致插入失败 |
| 362 | 439 | */ |
| 363 | 440 | @Test |
| 364 | - public void testImportUsers_01() { | |
| 441 | + public void testImportUserList_01() { | |
| 365 | 442 | // 准备参数 |
| 366 | 443 | UserImportExcelVO importUser = randomPojo(UserImportExcelVO.class, o -> { |
| 367 | 444 | }); |
| ... | ... | @@ -369,7 +446,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 369 | 446 | doThrow(new ServiceException(DEPT_NOT_FOUND)).when(deptService).validateDeptList(any()); |
| 370 | 447 | |
| 371 | 448 | // 调用 |
| 372 | - UserImportRespVO respVO = userService.importUsers(newArrayList(importUser), true); | |
| 449 | + UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true); | |
| 373 | 450 | // 断言 |
| 374 | 451 | assertEquals(0, respVO.getCreateUsernames().size()); |
| 375 | 452 | assertEquals(0, respVO.getUpdateUsernames().size()); |
| ... | ... | @@ -381,7 +458,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 381 | 458 | * 情况二,不存在,进行插入 |
| 382 | 459 | */ |
| 383 | 460 | @Test |
| 384 | - public void testImportUsers_02() { | |
| 461 | + public void testImportUserList_02() { | |
| 385 | 462 | // 准备参数 |
| 386 | 463 | UserImportExcelVO importUser = randomPojo(UserImportExcelVO.class, o -> { |
| 387 | 464 | o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // 保证 status 的范围 |
| ... | ... | @@ -397,7 +474,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 397 | 474 | when(passwordEncoder.encode(eq("yudaoyuanma"))).thenReturn("java"); |
| 398 | 475 | |
| 399 | 476 | // 调用 |
| 400 | - UserImportRespVO respVO = userService.importUsers(newArrayList(importUser), true); | |
| 477 | + UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true); | |
| 401 | 478 | // 断言 |
| 402 | 479 | assertEquals(1, respVO.getCreateUsernames().size()); |
| 403 | 480 | AdminUserDO user = userMapper.selectByUsername(respVO.getCreateUsernames().get(0)); |
| ... | ... | @@ -411,7 +488,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 411 | 488 | * 情况三,存在,但是不强制更新 |
| 412 | 489 | */ |
| 413 | 490 | @Test |
| 414 | - public void testImportUsers_03() { | |
| 491 | + public void testImportUserList_03() { | |
| 415 | 492 | // mock 数据 |
| 416 | 493 | AdminUserDO dbUser = randomAdminUserDO(); |
| 417 | 494 | userMapper.insert(dbUser); |
| ... | ... | @@ -429,7 +506,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 429 | 506 | when(deptService.getDept(eq(dept.getId()))).thenReturn(dept); |
| 430 | 507 | |
| 431 | 508 | // 调用 |
| 432 | - UserImportRespVO respVO = userService.importUsers(newArrayList(importUser), false); | |
| 509 | + UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), false); | |
| 433 | 510 | // 断言 |
| 434 | 511 | assertEquals(0, respVO.getCreateUsernames().size()); |
| 435 | 512 | assertEquals(0, respVO.getUpdateUsernames().size()); |
| ... | ... | @@ -441,7 +518,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 441 | 518 | * 情况四,存在,强制更新 |
| 442 | 519 | */ |
| 443 | 520 | @Test |
| 444 | - public void testImportUsers_04() { | |
| 521 | + public void testImportUserList_04() { | |
| 445 | 522 | // mock 数据 |
| 446 | 523 | AdminUserDO dbUser = randomAdminUserDO(); |
| 447 | 524 | userMapper.insert(dbUser); |
| ... | ... | @@ -459,7 +536,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 459 | 536 | when(deptService.getDept(eq(dept.getId()))).thenReturn(dept); |
| 460 | 537 | |
| 461 | 538 | // 调用 |
| 462 | - UserImportRespVO respVO = userService.importUsers(newArrayList(importUser), true); | |
| 539 | + UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true); | |
| 463 | 540 | // 断言 |
| 464 | 541 | assertEquals(0, respVO.getCreateUsernames().size()); |
| 465 | 542 | assertEquals(1, respVO.getUpdateUsernames().size()); |
| ... | ... | @@ -469,24 +546,24 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 469 | 546 | } |
| 470 | 547 | |
| 471 | 548 | @Test |
| 472 | - public void testCheckUserExists_notExists() { | |
| 473 | - assertServiceException(() -> userService.checkUserExists(randomLongId()), USER_NOT_EXISTS); | |
| 549 | + public void testValidateUserExists_notExists() { | |
| 550 | + assertServiceException(() -> userService.validateUserExists(randomLongId()), USER_NOT_EXISTS); | |
| 474 | 551 | } |
| 475 | 552 | |
| 476 | 553 | @Test |
| 477 | - public void testCheckUsernameUnique_usernameExistsForCreate() { | |
| 554 | + public void testValidateUsernameUnique_usernameExistsForCreate() { | |
| 478 | 555 | // 准备参数 |
| 479 | 556 | String username = randomString(); |
| 480 | 557 | // mock 数据 |
| 481 | 558 | userMapper.insert(randomAdminUserDO(o -> o.setUsername(username))); |
| 482 | 559 | |
| 483 | 560 | // 调用,校验异常 |
| 484 | - assertServiceException(() -> userService.checkUsernameUnique(null, username), | |
| 561 | + assertServiceException(() -> userService.validateUsernameUnique(null, username), | |
| 485 | 562 | USER_USERNAME_EXISTS); |
| 486 | 563 | } |
| 487 | 564 | |
| 488 | 565 | @Test |
| 489 | - public void testCheckUsernameUnique_usernameExistsForUpdate() { | |
| 566 | + public void testValidateUsernameUnique_usernameExistsForUpdate() { | |
| 490 | 567 | // 准备参数 |
| 491 | 568 | Long id = randomLongId(); |
| 492 | 569 | String username = randomString(); |
| ... | ... | @@ -494,24 +571,24 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 494 | 571 | userMapper.insert(randomAdminUserDO(o -> o.setUsername(username))); |
| 495 | 572 | |
| 496 | 573 | // 调用,校验异常 |
| 497 | - assertServiceException(() -> userService.checkUsernameUnique(id, username), | |
| 574 | + assertServiceException(() -> userService.validateUsernameUnique(id, username), | |
| 498 | 575 | USER_USERNAME_EXISTS); |
| 499 | 576 | } |
| 500 | 577 | |
| 501 | 578 | @Test |
| 502 | - public void testCheckEmailUnique_emailExistsForCreate() { | |
| 579 | + public void testValidateEmailUnique_emailExistsForCreate() { | |
| 503 | 580 | // 准备参数 |
| 504 | 581 | String email = randomString(); |
| 505 | 582 | // mock 数据 |
| 506 | 583 | userMapper.insert(randomAdminUserDO(o -> o.setEmail(email))); |
| 507 | 584 | |
| 508 | 585 | // 调用,校验异常 |
| 509 | - assertServiceException(() -> userService.checkEmailUnique(null, email), | |
| 586 | + assertServiceException(() -> userService.validateEmailUnique(null, email), | |
| 510 | 587 | USER_EMAIL_EXISTS); |
| 511 | 588 | } |
| 512 | 589 | |
| 513 | 590 | @Test |
| 514 | - public void testCheckEmailUnique_emailExistsForUpdate() { | |
| 591 | + public void testValidateEmailUnique_emailExistsForUpdate() { | |
| 515 | 592 | // 准备参数 |
| 516 | 593 | Long id = randomLongId(); |
| 517 | 594 | String email = randomString(); |
| ... | ... | @@ -519,24 +596,24 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 519 | 596 | userMapper.insert(randomAdminUserDO(o -> o.setEmail(email))); |
| 520 | 597 | |
| 521 | 598 | // 调用,校验异常 |
| 522 | - assertServiceException(() -> userService.checkEmailUnique(id, email), | |
| 599 | + assertServiceException(() -> userService.validateEmailUnique(id, email), | |
| 523 | 600 | USER_EMAIL_EXISTS); |
| 524 | 601 | } |
| 525 | 602 | |
| 526 | 603 | @Test |
| 527 | - public void testCheckMobileUnique_mobileExistsForCreate() { | |
| 604 | + public void testValidateMobileUnique_mobileExistsForCreate() { | |
| 528 | 605 | // 准备参数 |
| 529 | 606 | String mobile = randomString(); |
| 530 | 607 | // mock 数据 |
| 531 | 608 | userMapper.insert(randomAdminUserDO(o -> o.setMobile(mobile))); |
| 532 | 609 | |
| 533 | 610 | // 调用,校验异常 |
| 534 | - assertServiceException(() -> userService.checkMobileUnique(null, mobile), | |
| 611 | + assertServiceException(() -> userService.validateMobileUnique(null, mobile), | |
| 535 | 612 | USER_MOBILE_EXISTS); |
| 536 | 613 | } |
| 537 | 614 | |
| 538 | 615 | @Test |
| 539 | - public void testCheckMobileUnique_mobileExistsForUpdate() { | |
| 616 | + public void testValidateMobileUnique_mobileExistsForUpdate() { | |
| 540 | 617 | // 准备参数 |
| 541 | 618 | Long id = randomLongId(); |
| 542 | 619 | String mobile = randomString(); |
| ... | ... | @@ -544,18 +621,18 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 544 | 621 | userMapper.insert(randomAdminUserDO(o -> o.setMobile(mobile))); |
| 545 | 622 | |
| 546 | 623 | // 调用,校验异常 |
| 547 | - assertServiceException(() -> userService.checkMobileUnique(id, mobile), | |
| 624 | + assertServiceException(() -> userService.validateMobileUnique(id, mobile), | |
| 548 | 625 | USER_MOBILE_EXISTS); |
| 549 | 626 | } |
| 550 | 627 | |
| 551 | 628 | @Test |
| 552 | - public void testCheckOldPassword_notExists() { | |
| 553 | - assertServiceException(() -> userService.checkOldPassword(randomLongId(), randomString()), | |
| 629 | + public void testValidateOldPassword_notExists() { | |
| 630 | + assertServiceException(() -> userService.validateOldPassword(randomLongId(), randomString()), | |
| 554 | 631 | USER_NOT_EXISTS); |
| 555 | 632 | } |
| 556 | 633 | |
| 557 | 634 | @Test |
| 558 | - public void testCheckOldPassword_passwordFailed() { | |
| 635 | + public void testValidateOldPassword_passwordFailed() { | |
| 559 | 636 | // mock 数据 |
| 560 | 637 | AdminUserDO user = randomAdminUserDO(); |
| 561 | 638 | userMapper.insert(user); |
| ... | ... | @@ -564,14 +641,14 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 564 | 641 | String oldPassword = user.getPassword(); |
| 565 | 642 | |
| 566 | 643 | // 调用,校验异常 |
| 567 | - assertServiceException(() -> userService.checkOldPassword(id, oldPassword), | |
| 644 | + assertServiceException(() -> userService.validateOldPassword(id, oldPassword), | |
| 568 | 645 | USER_PASSWORD_FAILED); |
| 569 | 646 | // 校验调用 |
| 570 | 647 | verify(passwordEncoder, times(1)).matches(eq(oldPassword), eq(user.getPassword())); |
| 571 | 648 | } |
| 572 | 649 | |
| 573 | 650 | @Test |
| 574 | - public void testUsersByPostIds() { | |
| 651 | + public void testUserListByPostIds() { | |
| 575 | 652 | // 准备参数 |
| 576 | 653 | Collection<Long> postIds = asSet(10L, 20L); |
| 577 | 654 | // mock user1 数据 |
| ... | ... | @@ -585,12 +662,114 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { |
| 585 | 662 | userPostMapper.insert(new UserPostDO().setUserId(user2.getId()).setPostId(100L)); |
| 586 | 663 | |
| 587 | 664 | // 调用 |
| 588 | - List<AdminUserDO> result = userService.getUsersByPostIds(postIds); | |
| 665 | + List<AdminUserDO> result = userService.getUserListByPostIds(postIds); | |
| 589 | 666 | // 断言 |
| 590 | 667 | assertEquals(1, result.size()); |
| 591 | 668 | assertEquals(user1, result.get(0)); |
| 592 | 669 | } |
| 593 | 670 | |
| 671 | + @Test | |
| 672 | + public void testGetUserList() { | |
| 673 | + // mock 数据 | |
| 674 | + AdminUserDO user = randomAdminUserDO(); | |
| 675 | + userMapper.insert(user); | |
| 676 | + // 测试 id 不匹配 | |
| 677 | + userMapper.insert(randomAdminUserDO()); | |
| 678 | + // 准备参数 | |
| 679 | + Collection<Long> ids = singleton(user.getId()); | |
| 680 | + | |
| 681 | + // 调用 | |
| 682 | + List<AdminUserDO> result = userService.getUserList(ids); | |
| 683 | + // 断言 | |
| 684 | + assertEquals(1, result.size()); | |
| 685 | + assertEquals(user, result.get(0)); | |
| 686 | + } | |
| 687 | + | |
| 688 | + @Test | |
| 689 | + public void testGetUserMap() { | |
| 690 | + // mock 数据 | |
| 691 | + AdminUserDO user = randomAdminUserDO(); | |
| 692 | + userMapper.insert(user); | |
| 693 | + // 测试 id 不匹配 | |
| 694 | + userMapper.insert(randomAdminUserDO()); | |
| 695 | + // 准备参数 | |
| 696 | + Collection<Long> ids = singleton(user.getId()); | |
| 697 | + | |
| 698 | + // 调用 | |
| 699 | + Map<Long, AdminUserDO> result = userService.getUserMap(ids); | |
| 700 | + // 断言 | |
| 701 | + assertEquals(1, result.size()); | |
| 702 | + assertEquals(user, result.get(user.getId())); | |
| 703 | + } | |
| 704 | + | |
| 705 | + @Test | |
| 706 | + public void testGetUserListByNickname() { | |
| 707 | + // mock 数据 | |
| 708 | + AdminUserDO user = randomAdminUserDO(o -> o.setNickname("芋头")); | |
| 709 | + userMapper.insert(user); | |
| 710 | + // 测试 nickname 不匹配 | |
| 711 | + userMapper.insert(randomAdminUserDO(o -> o.setNickname("源码"))); | |
| 712 | + // 准备参数 | |
| 713 | + String nickname = "芋"; | |
| 714 | + | |
| 715 | + // 调用 | |
| 716 | + List<AdminUserDO> result = userService.getUserListByNickname(nickname); | |
| 717 | + // 断言 | |
| 718 | + assertEquals(1, result.size()); | |
| 719 | + assertEquals(user, result.get(0)); | |
| 720 | + } | |
| 721 | + | |
| 722 | + @Test | |
| 723 | + public void testGetUserListByStatus() { | |
| 724 | + // mock 数据 | |
| 725 | + AdminUserDO user = randomAdminUserDO(o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus())); | |
| 726 | + userMapper.insert(user); | |
| 727 | + // 测试 status 不匹配 | |
| 728 | + userMapper.insert(randomAdminUserDO(o -> o.setStatus(CommonStatusEnum.ENABLE.getStatus()))); | |
| 729 | + // 准备参数 | |
| 730 | + Integer status = CommonStatusEnum.DISABLE.getStatus(); | |
| 731 | + | |
| 732 | + // 调用 | |
| 733 | + List<AdminUserDO> result = userService.getUserListByStatus(status); | |
| 734 | + // 断言 | |
| 735 | + assertEquals(1, result.size()); | |
| 736 | + assertEquals(user, result.get(0)); | |
| 737 | + } | |
| 738 | + | |
| 739 | + @Test | |
| 740 | + public void testValidateUserList_success() { | |
| 741 | + // mock 数据 | |
| 742 | + AdminUserDO userDO = randomAdminUserDO().setStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 743 | + userMapper.insert(userDO); | |
| 744 | + // 准备参数 | |
| 745 | + List<Long> ids = singletonList(userDO.getId()); | |
| 746 | + | |
| 747 | + // 调用,无需断言 | |
| 748 | + userService.validateUserList(ids); | |
| 749 | + } | |
| 750 | + | |
| 751 | + @Test | |
| 752 | + public void testValidateUserList_notFound() { | |
| 753 | + // 准备参数 | |
| 754 | + List<Long> ids = singletonList(randomLongId()); | |
| 755 | + | |
| 756 | + // 调用, 并断言异常 | |
| 757 | + assertServiceException(() -> userService.validateUserList(ids), USER_NOT_EXISTS); | |
| 758 | + } | |
| 759 | + | |
| 760 | + @Test | |
| 761 | + public void testValidateUserList_notEnable() { | |
| 762 | + // mock 数据 | |
| 763 | + AdminUserDO userDO = randomAdminUserDO().setStatus(CommonStatusEnum.DISABLE.getStatus()); | |
| 764 | + userMapper.insert(userDO); | |
| 765 | + // 准备参数 | |
| 766 | + List<Long> ids = singletonList(userDO.getId()); | |
| 767 | + | |
| 768 | + // 调用, 并断言异常 | |
| 769 | + assertServiceException(() -> userService.validateUserList(ids), USER_IS_DISABLE, | |
| 770 | + userDO.getNickname()); | |
| 771 | + } | |
| 772 | + | |
| 594 | 773 | // ========== 随机对象 ========== |
| 595 | 774 | |
| 596 | 775 | @SafeVarargs | ... | ... |