用户页面修改

This commit is contained in:
zhangzhiqiang
2022-12-07 16:55:42 +08:00
parent 2e636fbc8a
commit 34a4ec4b26
3 changed files with 54 additions and 48 deletions

View File

@@ -97,4 +97,8 @@ public class UserVo extends BaseDto implements Serializable {
this.depts = Arrays.stream(split).map(a->Long.valueOf(a)).collect(Collectors.toList());
}
}
public void setPassword(String password) {
this.password = null;
}
}

View File

@@ -146,9 +146,12 @@ public class UserServiceImpl implements UserService {
List<Long> depts = resources.getDepts();
List<Long> roles = resources.getRoles();
JSONObject currentUser = WQLObject.getWQLObject("sys_user").query("username = '" + resources.getUsername() + "'").uniqueResult(0);
userRelateService.inserDeptRelate(currentUser.getLong("user_id"),new HashSet(depts));
userRelateService.inserRoleRelate(currentUser.getLong("user_id"),new HashSet(roles));
if (!CollectionUtils.isEmpty(depts)){
userRelateService.inserDeptRelate(currentUser.getLong("user_id"),new HashSet(depts));
}
if (!CollectionUtils.isEmpty(roles)){
userRelateService.inserRoleRelate(currentUser.getLong("user_id"),new HashSet(roles));
}
}
@@ -162,7 +165,9 @@ public class UserServiceImpl implements UserService {
if("0".equals(resources.getIs_used())){
onlineUserService.kickOutForUsername(resources.getUsername());
}
resources.setPassword(SaSecureUtil.md5BySalt(resources.getPassword(), "salt"));
if (StringUtils.isNotEmpty(resources.getPassword())){
resources.setPassword(SaSecureUtil.md5BySalt(resources.getPassword(), "salt"));
}
resources.setUpdate_time(new Date());
resources.setUpdate_optid(user.getId());
resources.setUpdate_optname(user.getUsername());
@@ -172,16 +177,20 @@ public class UserServiceImpl implements UserService {
//更新部门用户
List<Long> depts = resources.getDepts();
List<Long> roles = resources.getRoles();
userRelateService.updateDeptRelate(resources.getUser_id(),new HashSet(depts));
userRelateService.updateRoleRelate(resources.getUser_id(),new HashSet(roles));
// 如果用户的角色改变
if (!resources.getRoles().equals(user.getRoles())) {
redisUtils.del(CacheKey.DATA_USER + resources.getUser_id());
redisUtils.del(CacheKey.MENU_USER + resources.getUser_id());
redisUtils.del(CacheKey.ROLE_AUTH + resources.getUser_id());
if (!CollectionUtils.isEmpty(depts)){
userRelateService.updateDeptRelate(resources.getUser_id(),new HashSet(depts));
}
if (!CollectionUtils.isEmpty(roles)){
userRelateService.updateRoleRelate(resources.getUser_id(),new HashSet(roles));
// 如果用户的角色改变
if (!resources.getRoles().equals(user.getRoles())) {
redisUtils.del(CacheKey.DATA_USER + resources.getUser_id());
redisUtils.del(CacheKey.MENU_USER + resources.getUser_id());
redisUtils.del(CacheKey.ROLE_AUTH + resources.getUser_id());
}
}
}