|
@@ -11,7 +11,6 @@ import com.ozs.common.utils.StringUtils;
|
|
|
import com.ozs.framework.web.service.TokenService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.ozs.common.constant.Constants;
|
|
@@ -50,9 +49,6 @@ public class SysLoginController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
- // 令牌自定义标识
|
|
|
- @Value("${token.header}")
|
|
|
- private String header;
|
|
|
|
|
|
/**
|
|
|
* 登录方法
|
|
@@ -61,10 +57,13 @@ public class SysLoginController extends BaseController {
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@PostMapping("/login")
|
|
|
- public AjaxResult login(@RequestBody LoginBody loginBody, HttpServletRequest request) {
|
|
|
- // 判断账号是否在其他电脑登陆/**/
|
|
|
- if (!ObjectUtils.isEmpty(request.getHeader(this.header))) {
|
|
|
- request.removeAttribute(header);
|
|
|
+ public AjaxResult login(@RequestBody LoginBody loginBody) {
|
|
|
+ // 判断账号是否在其他电脑登陆
|
|
|
+ String userId = loginService.getUserIdByUserName(loginBody.getUsername());
|
|
|
+ log.info("111111111-----" + userId);
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ log.info("22222222-----" + userId);
|
|
|
+ redisCache.deleteObject(userId);
|
|
|
}
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
// 生成令牌
|