session干扰

This commit is contained in:
lyd
2022-09-28 08:55:14 +08:00
parent 805792e5fa
commit a820a7fdf5
5 changed files with 24 additions and 49 deletions

View File

@@ -105,7 +105,7 @@ public class User extends BaseEntity implements Serializable {
public boolean equals(Object o) {
if (this == o) {
return true;
}
}
if (o == null || getClass() != o.getClass()) {
return false;
}

View File

@@ -70,7 +70,7 @@ public class MenuController {
@ApiOperation("根据菜单ID返回所有子节点ID包含自身ID")
@GetMapping(value = "/child")
@SaCheckPermission("menu:list','roles:list")
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
public ResponseEntity<Object> child(@RequestParam Long id){
Set<Menu> menuSet = new HashSet<>();
List<MenuDto> menuList = menuService.getMenus(id);

View File

@@ -94,6 +94,7 @@ public class UserServiceImpl implements UserService {
if (userRepository.findByEmail(resources.getEmail()) != null) {
throw new EntityExistException(User.class, "email", resources.getEmail());
}
resources.setCreateBy(SecurityUtils.getCurrentUsername());
userRepository.save(resources);
}
@@ -139,7 +140,7 @@ public class UserServiceImpl implements UserService {
// 清除缓存
delCaches(user.getId(), user.getUsername());
// 修改session
flushSession(user);
// flushSession(user);
}
@Override
@@ -153,7 +154,7 @@ public class UserServiceImpl implements UserService {
// 清理缓存
delCaches(user.getId(), user.getUsername());
// 修改session
flushSession(user);
// flushSession(user);
}
@Override
@@ -183,7 +184,7 @@ public class UserServiceImpl implements UserService {
public void updatePass(String username, String pass) {
userRepository.updatePass(username, pass, new Date());
redisUtils.del("user::username:" + username);
flushSession(userRepository.findByUsername(username));
// flushSession(userRepository.findByUsername(username));
}
@Override
@@ -199,7 +200,7 @@ public class UserServiceImpl implements UserService {
FileUtil.del(oldPath);
}
@NotBlank String username = user.getUsername();
flushSession(user);
// flushSession(user);
return new HashMap<String, String>(1) {{
put("avatar", file.getName());
}};
@@ -209,7 +210,7 @@ public class UserServiceImpl implements UserService {
@Transactional(rollbackFor = Exception.class)
public void updateEmail(String username, String email) {
userRepository.updateEmail(username, email);
flushSession(userRepository.findByUsername(username));
// flushSession(userRepository.findByUsername(username));
}
@Override
@@ -246,9 +247,9 @@ public class UserServiceImpl implements UserService {
*
* @param user /
*/
private void flushSession(User user) {
UserDto userDto = this.findByName(user.getUsername());
List<String> permissionList = roleService.getPermissionList(userDto.getId().toString());
flushSessionUtil.flushSessionInfo(userDto, permissionList);
}
// private void flushSession(User user) {
// UserDto userDto = this.findByName(user.getUsername());
// List<String> permissionList = roleService.getPermissionList(userDto.getId().toString());
// flushSessionUtil.flushSessionInfo(userDto, permissionList);
// }
}