|
|
@@ -19,6 +19,7 @@ import cn.hutool.core.util.ObjUtil;
|
|
19
|
19
|
import cn.hutool.core.util.StrUtil;
|
|
20
|
20
|
import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
|
|
21
|
21
|
import com.sundot.airport.common.core.domain.LargeScreenHomePageUserInfoSqlDto;
|
|
|
22
|
+import com.sundot.airport.common.core.domain.ResetUserPostDto;
|
|
22
|
23
|
import com.sundot.airport.common.core.domain.ResetUserRoleDto;
|
|
23
|
24
|
import com.sundot.airport.common.core.domain.entity.SysDept;
|
|
24
|
25
|
import com.sundot.airport.common.core.domain.entity.SysDictData;
|
|
|
@@ -1140,4 +1141,37 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
1140
|
1141
|
public List<LargeScreenHomePageUserInfoSqlDto> homePageUserInfo() {
|
|
1141
|
1142
|
return userMapper.homePageUserInfo();
|
|
1142
|
1143
|
}
|
|
|
1144
|
+
|
|
|
1145
|
+ /**
|
|
|
1146
|
+ * 重置指定部门中指定角色的人员的指定岗位
|
|
|
1147
|
+ */
|
|
|
1148
|
+ @Override
|
|
|
1149
|
+ public int resetUserPostByDept(ResetUserPostDto resetUserPostDto) {
|
|
|
1150
|
+ // 获取指定部门下指定角色的用户
|
|
|
1151
|
+ List<Long> userIdList = new ArrayList<>();
|
|
|
1152
|
+ resetUserPostDto.getDeptIdList().forEach(deptId -> {
|
|
|
1153
|
+ List<SysUser> sysUserList = selectUserListByRoleKeyAndDeptId(resetUserPostDto.getRoleKeyList(), deptId);
|
|
|
1154
|
+ List<Long> userIds = sysUserList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
1155
|
+ userIdList.addAll(userIds);
|
|
|
1156
|
+ });
|
|
|
1157
|
+ // 获取指定岗位
|
|
|
1158
|
+ List<Long> postIdList = new ArrayList<>();
|
|
|
1159
|
+ resetUserPostDto.getPostParentIdList().forEach(postParentId -> {
|
|
|
1160
|
+ List<SysPost> sysPostList = postMapper.selectPostByParentId(postParentId);
|
|
|
1161
|
+ List<Long> postIds = sysPostList.stream().map(SysPost::getPostId).collect(Collectors.toList());
|
|
|
1162
|
+ postIdList.addAll(postIds);
|
|
|
1163
|
+ });
|
|
|
1164
|
+ // 更新用户岗位
|
|
|
1165
|
+ for (Long userId : userIdList) {
|
|
|
1166
|
+ // 创建数据
|
|
|
1167
|
+ SysUser user = new SysUser();
|
|
|
1168
|
+ user.setUserId(userId);
|
|
|
1169
|
+ user.setPostIds(postIdList.toArray(new Long[0]));
|
|
|
1170
|
+ // 删除用户与岗位关联
|
|
|
1171
|
+ userPostMapper.deleteUserPostByUserId(userId);
|
|
|
1172
|
+ // 新增用户与岗位管理
|
|
|
1173
|
+ insertUserPost(user);
|
|
|
1174
|
+ }
|
|
|
1175
|
+ return 1;
|
|
|
1176
|
+ }
|
|
1143
|
1177
|
}
|