| ... | ... | @@ -6,6 +6,7 @@ import com.tianbo.warehouse.annotation.LogAnnotation; | 
|  |  | import com.tianbo.warehouse.annotation.RequestRequire; | 
|  |  | import com.tianbo.warehouse.annotation.UserPasswordSM3; | 
|  |  | import com.tianbo.warehouse.controller.response.ResultJson; | 
|  |  | import com.tianbo.warehouse.model.Token; | 
|  |  | import com.tianbo.warehouse.model.USERS; | 
|  |  | import com.tianbo.warehouse.model.UserRole; | 
|  |  | import com.tianbo.warehouse.security.CustomUserDetailService; | 
| ... | ... | @@ -158,4 +159,22 @@ public class UserController { | 
|  |  | } | 
|  |  | return new ResultJson("500","缓存更新失败"); | 
|  |  | } | 
|  |  |  | 
|  |  | @LogAnnotation(moduleName = "用户锁定",operate = "用户锁定") | 
|  |  | @PutMapping("/lock") | 
|  |  | public ResultJson lockUserById(@Validated(UpdateUser.class) @RequestBody USERS user){ | 
|  |  | USERS lockuser = new USERS(); | 
|  |  | lockuser.setUserId(user.getUserId()); | 
|  |  | lockuser.setState(user.getState()); | 
|  |  |  | 
|  |  | int i = userService.updateByPrimaryKeySelective(lockuser); | 
|  |  | //删除用户token缓存 及时生效锁定账号 | 
|  |  | if (i>0){ | 
|  |  | String userTokenStr = redisUtils.get(Token.USER_TOKEN_KEY + user.getUsername()); | 
|  |  | redisUtils.del(userTokenStr); | 
|  |  | redisUtils.del(Token.USER_TOKEN_KEY + user.getUsername()); | 
|  |  | } | 
|  |  | return i==1 ? new ResultJson("200","success") :new ResultJson("500","lock user faild"); | 
|  |  |  | 
|  |  | } | 
|  |  | } | 
... | ... |  |