|
@@ -3,6 +3,7 @@ package com.boman.auth.service;
|
|
|
import com.boman.common.redis.service.RedisService;
|
|
|
import com.boman.domain.dto.AjaxResult;
|
|
|
import com.boman.domain.form.LoginBody;
|
|
|
+import com.boman.wechat.api.RemoteWechatService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -18,6 +19,8 @@ import com.boman.system.api.RemoteUserService;
|
|
|
import com.boman.domain.SysUser;
|
|
|
import com.boman.system.api.model.LoginUser;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
import static com.boman.domain.constant.Constants.SUCCESS;
|
|
|
|
|
|
/**
|
|
@@ -35,6 +38,8 @@ public class SysLoginService {
|
|
|
|
|
|
@Autowired
|
|
|
private RedisService redisService;
|
|
|
+ @Resource
|
|
|
+ private RemoteWechatService remoteWechatService;
|
|
|
|
|
|
@Value("${upkeep}")
|
|
|
private Boolean upKeep;
|
|
@@ -82,6 +87,14 @@ public class SysLoginService {
|
|
|
throw new BaseException("对不起,您的账号:" + username + " 已被删除");
|
|
|
}
|
|
|
|
|
|
+ //判断15天内是否登录过 大于0 登录过
|
|
|
+ Integer lastLogininforCount = remoteWechatService.getLastLogininfor(username);
|
|
|
+ if (lastLogininforCount < 1){
|
|
|
+ //设置用户停用
|
|
|
+ remoteUserService.updateStatus(user);
|
|
|
+ remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
|
|
+ throw new BaseException("对不起,您的账号:" + username + "超过15天未登录 已停用,请联系管理员");
|
|
|
+ }
|
|
|
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
|
|
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
|
|
throw new BaseException("对不起,您的账号:" + username + " 已停用");
|
|
@@ -120,7 +133,14 @@ public class SysLoginService {
|
|
|
remoteLogService.saveLogininfor(userName, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
|
|
throw new BaseException("对不起,您的账号:" + userName + " 已被删除");
|
|
|
}
|
|
|
-
|
|
|
+ //判断15天内是否登录过 大于0 登录过
|
|
|
+ Integer lastLogininforCount = remoteWechatService.getLastLogininfor(userName);
|
|
|
+ if (lastLogininforCount < 1){
|
|
|
+ //设置用户停用
|
|
|
+ remoteUserService.updateStatus(user);
|
|
|
+ remoteLogService.saveLogininfor(userName, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
|
|
+ throw new BaseException("对不起,您的账号:" + userName + "超过15天未登录 已停用,请联系管理员");
|
|
|
+ }
|
|
|
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
|
|
remoteLogService.saveLogininfor(userName, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
|
|
throw new BaseException("对不起,您的账号:" + userName + " 已停用");
|