|
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import me.chanjar.weixin.common.annotation.Required;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
@@ -131,9 +132,14 @@ public class SysUserController {
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/getAllUser", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/getAllUser", method = RequestMethod.GET)
|
|
- public Result<Object> getAllUser(String status) {
|
|
|
|
|
|
+ public Result<Object> getAllUser(@RequestParam("status")String status,@RequestParam(name="userId",required = false )String userId) {
|
|
try {
|
|
try {
|
|
List<SysUserVo> allUser = sysUserService.getAllUser(null, status);
|
|
List<SysUserVo> allUser = sysUserService.getAllUser(null, status);
|
|
|
|
+ if(!Check.isNull(userId)){
|
|
|
|
+ List<SysUserVo> mulUserList = treeCategoryData(allUser, userId); //获取自己的下属id
|
|
|
|
+ allUser.removeAll(mulUserList);
|
|
|
|
+ }
|
|
|
|
+
|
|
return Result.ok(allUser);
|
|
return Result.ok(allUser);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -141,6 +147,18 @@ public class SysUserController {
|
|
return Result.error("查询失败");
|
|
return Result.error("查询失败");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<SysUserVo> treeCategoryData(List<SysUserVo> allList, String leaderId) {
|
|
|
|
+ List<SysUserVo> mapList = new ArrayList<>();
|
|
|
|
+ for (SysUserVo vo : allList) {
|
|
|
|
+ if (leaderId.equals(vo.getLeaderId())){
|
|
|
|
+ mapList.add(vo);
|
|
|
|
+ mapList.addAll(treeCategoryData(allList,vo.getUserId()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return mapList;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取用户列表数据
|
|
* 获取用户列表数据
|
|
@@ -372,6 +390,18 @@ public class SysUserController {
|
|
} else {
|
|
} else {
|
|
sysUser = sysUserService.queryPageList(sysUser).get(0);
|
|
sysUser = sysUserService.queryPageList(sysUser).get(0);
|
|
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
|
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
|
|
|
+
|
|
|
|
+ //汇报上级选择合法性校验:校验被修改人的汇报上级的汇报上级是不是本人
|
|
|
|
+ String leaderId = user.getLeaderId();
|
|
|
|
+ if(!Check.isNull(leaderId) && !sysUser.getLeaderId().equals(leaderId)){ //判断此次修改是否修改了leadId
|
|
|
|
+ String leaderIdOfLeaderUser = sysUserService.getById(leaderId).getLeaderId();
|
|
|
|
+ if(!Check.isNull(leaderIdOfLeaderUser) && leaderIdOfLeaderUser.equals(user.getId())){ //汇报上级的上级领导不为空,且恰好是自己构成了管理循环
|
|
|
|
+ result.error500("要修改的汇报上级是自己的下属,请重新选择!");
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //添加修改记录的日志
|
|
BytedanceOperationLog bytedanceOperationLog = new BytedanceOperationLog();
|
|
BytedanceOperationLog bytedanceOperationLog = new BytedanceOperationLog();
|
|
bytedanceOperationLog.setOldData(sysUser.toString());
|
|
bytedanceOperationLog.setOldData(sysUser.toString());
|
|
bytedanceOperationLog.setNewData(user.toString());
|
|
bytedanceOperationLog.setNewData(user.toString());
|
|
@@ -384,7 +414,7 @@ public class SysUserController {
|
|
|
|
|
|
user.setLeaderName(user.getLeaderName().trim());
|
|
user.setLeaderName(user.getLeaderName().trim());
|
|
user.setUpdateTime(new Date());
|
|
user.setUpdateTime(new Date());
|
|
- user.setLeaderName(user.getLeaderName().trim());
|
|
|
|
|
|
+// user.setLeaderName(user.getLeaderName().trim());
|
|
//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
|
|
//String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), sysUser.getSalt());
|
|
user.setPassword(sysUser.getPassword());
|
|
user.setPassword(sysUser.getPassword());
|
|
String roles = jsonObject.getString("selectedroles");//用户角色
|
|
String roles = jsonObject.getString("selectedroles");//用户角色
|