用户页面修改
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user