|
@@ -6,11 +6,14 @@ import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
import com.boman.domain.SysDept;
|
|
|
import com.boman.system.service.*;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
@@ -46,6 +49,8 @@ import com.boman.system.api.model.LoginUser;
|
|
|
@RequestMapping("/user")
|
|
|
public class SysUserController extends BaseController
|
|
|
{
|
|
|
+
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(SysUserController.class);
|
|
|
@Autowired
|
|
|
private ISysUserService userService;
|
|
|
|
|
@@ -137,18 +142,23 @@ public class SysUserController extends BaseController
|
|
|
// 权限集合
|
|
|
Set<String> permissions = permissionService.getMenuPermission(sysUser.getId());
|
|
|
|
|
|
- // 当前人所在部门和下级部门的deptIdList
|
|
|
- List<SysDept> sysDepts = deptService.listChildrenDepts(sysUser.getDeptId());
|
|
|
- if (ObjectUtils.isNotEmpty(sysDepts)) {
|
|
|
- // 所有部门
|
|
|
- List<Long> childrenDeptIds = ObjectUtils.map(sysDepts, SysDept::getId);
|
|
|
- List<SysUser> users = userService.listByDeptId(childrenDeptIds);
|
|
|
- sysUserVo.setDeptUserIds(getUserIds(users));
|
|
|
-
|
|
|
- // 去除本部门后的所有子部门
|
|
|
- List<Long> child = ObjectUtils.filter(childrenDeptIds, deptId -> !deptId.equals(sysUser.getDeptId()));
|
|
|
- List<SysUser> childUsers = userService.listByDeptId(child);
|
|
|
- sysUserVo.setSubDeptUserIds(getUserIds(childUsers));
|
|
|
+ // todo
|
|
|
+ if (ObjectUtils.isNotEmpty(sysUser.getDeptId())) {
|
|
|
+ // 当前人所在部门和下级部门的deptIdList
|
|
|
+ List<SysDept> sysDepts = deptService.listChildrenDepts(sysUser.getDeptId());
|
|
|
+ if (ObjectUtils.isNotEmpty(sysDepts)) {
|
|
|
+ // 所有部门
|
|
|
+ List<Long> childrenDeptIds = ObjectUtils.map(sysDepts, SysDept::getId);
|
|
|
+ if (ObjectUtils.isNotEmpty(childrenDeptIds)) {
|
|
|
+ List<SysUser> users = userService.listByDeptId(childrenDeptIds);
|
|
|
+ sysUserVo.setDeptUserIds(getUserIds(users));
|
|
|
+
|
|
|
+ // 去除本部门后的所有子部门
|
|
|
+ List<Long> child = ObjectUtils.filter(childrenDeptIds, deptId -> !deptId.equals(sysUser.getDeptId()));
|
|
|
+ List<SysUser> childUsers = userService.listByDeptId(child);
|
|
|
+ sysUserVo.setSubDeptUserIds(getUserIds(childUsers));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
sysUserVo.setSysUser(sysUser);
|
|
@@ -343,6 +353,7 @@ public class SysUserController extends BaseController
|
|
|
@GetMapping("/getByPhone/{phone}")
|
|
|
public SysUser getByPhone(@PathVariable("phone") String phone) {
|
|
|
SysUser sysUser = userService.getByPhone(phone);
|
|
|
+ LOGGER.info("getByPhone: 请求结果:{}",JSON.toJSONString(sysUser));
|
|
|
return ObjectUtils.requireNonNull(sysUser, String.format("手机号 [%s] 对应的用户不存在", phone));
|
|
|
}
|
|
|
|