Merge branch 'dev' of http://git.znkjfw.com/ak/zn-cloud into frx

This commit is contained in:
furongxin 2024-11-01 14:16:59 +08:00
commit a6b2f5831f
8 changed files with 33 additions and 18 deletions

View File

@ -160,8 +160,9 @@ public class UserController {
@GetMapping({"/list-all-simple", "/simple-list"}) @GetMapping({"/list-all-simple", "/simple-list"})
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
public CommonResult<List<UserSimpleRespVO>> getSimpleUserList(@RequestParam(required = false, defaultValue = "1") Integer userType) { public CommonResult<List<UserSimpleRespVO>> getSimpleUserList(@RequestParam(required = false, defaultValue = "1") Integer userType,
List<AdminUserDO> list = userService.getUserListByStatus(userType, CommonStatusEnum.ENABLE.getStatus()); @RequestParam(required = false) Long deptId) {
List<AdminUserDO> list = userService.getUserListByStatus(userType, deptId, CommonStatusEnum.ENABLE.getStatus());
// 拼接数据 // 拼接数据
Map<Long, DeptDO> deptMap = deptService.getDeptMap( Map<Long, DeptDO> deptMap = deptService.getDeptMap(
convertList(list, AdminUserDO::getDeptId)); convertList(list, AdminUserDO::getDeptId));
@ -171,8 +172,9 @@ public class UserController {
@GetMapping({"/list-all"}) @GetMapping({"/list-all"})
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项,无数据权限") @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项,无数据权限")
@DataPermission(enable = false) @DataPermission(enable = false)
public CommonResult<List<UserSimpleRespVO>> getAllUserList(@RequestParam(required = false, defaultValue = "1") Integer userType) { public CommonResult<List<UserSimpleRespVO>> getAllUserList(@RequestParam(required = false, defaultValue = "1") Integer userType,
List<AdminUserDO> list = userService.getUserListByStatus(userType, CommonStatusEnum.ENABLE.getStatus()); @RequestParam(required = false) Long deptId) {
List<AdminUserDO> list = userService.getUserListByStatus(userType, deptId, CommonStatusEnum.ENABLE.getStatus());
// 拼接数据 // 拼接数据
Map<Long, DeptDO> deptMap = deptService.getDeptMap( Map<Long, DeptDO> deptMap = deptService.getDeptMap(
convertList(list, AdminUserDO::getDeptId)); convertList(list, AdminUserDO::getDeptId));

View File

@ -65,9 +65,10 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname)); return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
} }
default List<AdminUserDO> selectListByStatus(Integer userType, Integer status) { default List<AdminUserDO> selectListByStatus(Integer userType, List<Long> deptIds, Integer status) {
return selectList(new LambdaQueryWrapperX<AdminUserDO>() return selectList(new LambdaQueryWrapperX<AdminUserDO>()
.eq(AdminUserDO::getStatus, status) .eq(AdminUserDO::getStatus, status)
.inIfPresent(AdminUserDO::getDeptId, deptIds)
.eqIfPresent(AdminUserDO::getUserType, userType)); .eqIfPresent(AdminUserDO::getUserType, userType));
} }

View File

@ -980,7 +980,11 @@ public class AttendanceServiceImpl implements AttendanceService {
String first = CollectionUtil.getFirst(dateList); String first = CollectionUtil.getFirst(dateList);
String last = CollectionUtil.getLast(dateList); String last = CollectionUtil.getLast(dateList);
//查询出数据 -- 时间周期 - 用户列表 //查询出数据 -- 时间周期 - 用户列表
List<AttendancePunchRecordDO> list = attendancePunchRecordMapper.statistics(userList.stream().map(AdminUserDO::getId).collect(Collectors.toList()), dateList); userIds = userList.stream().map(AdminUserDO::getId).collect(Collectors.toList());
List<AttendancePunchRecordDO> list = new ArrayList<>();
if (CollUtil.isNotEmpty(userIds)) {
list = attendancePunchRecordMapper.statistics(userIds, dateList);
}
//获取用户列表 //获取用户列表
Map<Long, AdminUserDO> userMap = new HashMap<>(); Map<Long, AdminUserDO> userMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(userList)) { if (CollectionUtil.isNotEmpty(userList)) {

View File

@ -123,7 +123,7 @@ public class NoticeServiceImpl implements NoticeService {
//全员推送 //全员推送
case 0: case 0:
//获得用户信息 //获得用户信息
userDOs = userService.getUserListByStatus(null, CommonStatusEnum.ENABLE.getStatus()); userDOs = userService.getUserListByStatus(null, null, CommonStatusEnum.ENABLE.getStatus());
break; break;
//部门推送 //部门推送
case 1: case 1:

View File

@ -288,10 +288,11 @@ public interface AdminUserService {
* 获得指定状态的用户们 * 获得指定状态的用户们
* *
* @param userType 用户类型 1公司用户 2工厂用户 * @param userType 用户类型 1公司用户 2工厂用户
* @param deptId
* @param status * @param status
* @return 用户们 * @return 用户们
*/ */
List<AdminUserDO> getUserListByStatus(Integer userType, Integer status); List<AdminUserDO> getUserListByStatus(Integer userType, Long deptId, Integer status);
/** /**
* 判断密码是否匹配 * 判断密码是否匹配

View File

@ -675,8 +675,12 @@ public class AdminUserServiceImpl implements AdminUserService {
} }
@Override @Override
public List<AdminUserDO> getUserListByStatus(Integer userType, Integer status) { public List<AdminUserDO> getUserListByStatus(Integer userType, Long deptId, Integer status) {
return userMapper.selectListByStatus(userType, status); List<Long> deptIds = new ArrayList<>();
if (deptId != null) {
deptIds = convertList(deptService.getChildDeptList(deptId), DeptDO::getId);
}
return userMapper.selectListByStatus(userType, deptIds, status);
} }
@Override @Override
@ -732,6 +736,9 @@ public class AdminUserServiceImpl implements AdminUserService {
@Override @Override
public List<AdminUserDO> getAllList(Integer status, Integer type, List<Long> userIds) { public List<AdminUserDO> getAllList(Integer status, Integer type, List<Long> userIds) {
if (CollUtil.isEmpty(userIds)){
return Collections.emptyList();
}
return userMapper.selectList(new LambdaQueryWrapper<AdminUserDO>() return userMapper.selectList(new LambdaQueryWrapper<AdminUserDO>()
.eq(status != null, AdminUserDO::getStatus, status) .eq(status != null, AdminUserDO::getStatus, status)
.eq(type != null, AdminUserDO::getUserType, type) .eq(type != null, AdminUserDO::getUserType, type)

View File

@ -170,7 +170,7 @@
</foreach> </foreach>
</if> </if>
<if test="dto.nickName != null and dto.nickName != ''"> <if test="dto.nickName != null and dto.nickName != ''">
and c.nickname like concat('%', #{dto.nickName}, '%') and a.nickname like concat('%', #{dto.nickName}, '%')
</if> </if>
<if test="dto.type != null"> <if test="dto.type != null">
and b.type = #{dto.type} and b.type = #{dto.type}

View File

@ -708,7 +708,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
Integer status = CommonStatusEnum.DISABLE.getStatus(); Integer status = CommonStatusEnum.DISABLE.getStatus();
// 调用 // 调用
List<AdminUserDO> result = userService.getUserListByStatus(status, CommonStatusEnum.ENABLE.getStatus()); List<AdminUserDO> result = userService.getUserListByStatus(status, null, CommonStatusEnum.ENABLE.getStatus());
// 断言 // 断言
assertEquals(1, result.size()); assertEquals(1, result.size());
assertEquals(user, result.get(0)); assertEquals(user, result.get(0));