mirror of https://github.com/elunez/eladmin
parent
1556f13379
commit
a90bfac2cf
|
@ -179,11 +179,12 @@ public class OnlineUserService {
|
|||
* @param username /
|
||||
*/
|
||||
@Async
|
||||
public void kickOutForUsername(String username) {
|
||||
public void kickOutForUsername(String username) throws Exception {
|
||||
List<OnlineUserDto> onlineUsers = getAll(username);
|
||||
for (OnlineUserDto onlineUser : onlineUsers) {
|
||||
if (onlineUser.getUserName().equals(username)) {
|
||||
kickOut(onlineUser.getKey());
|
||||
String token =EncryptUtils.desDecrypt(onlineUser.getKey());
|
||||
kickOut(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class UserController {
|
|||
@ApiOperation("修改用户")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('user:edit')")
|
||||
public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources){
|
||||
public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
|
||||
checkLevel(resources);
|
||||
userService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
|
|
@ -49,7 +49,7 @@ public interface UserService {
|
|||
* 编辑用户
|
||||
* @param resources /
|
||||
*/
|
||||
void update(User resources);
|
||||
void update(User resources) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
|
|
|
@ -98,7 +98,7 @@ public class UserServiceImpl implements UserService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(User resources) {
|
||||
public void update(User resources) throws Exception {
|
||||
User user = userRepository.findById(resources.getId()).orElseGet(User::new);
|
||||
ValidationUtil.isNull(user.getId(), "User", "id", resources.getId());
|
||||
User user1 = userRepository.findByUsername(resources.getUsername());
|
||||
|
|
Loading…
Reference in New Issue