master
parent
6e2a215149
commit
b37de07911
|
|
@ -5,6 +5,7 @@ import java.util.Date;
|
|||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.boot.security.server.dao.SysLogsDao;
|
||||
|
|
@ -33,6 +34,7 @@ public class SysLogServiceImpl implements SysLogService {
|
|||
sysLogsDao.save(sysLogs);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void save(Long userId, String module, Boolean flag, String remark) {
|
||||
SysLogs sysLogs = new SysLogs();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.springframework.util.StringUtils;
|
|||
|
||||
import com.boot.security.server.dto.LoginUser;
|
||||
import com.boot.security.server.dto.Token;
|
||||
import com.boot.security.server.service.SysLogService;
|
||||
import com.boot.security.server.service.TokenService;
|
||||
|
||||
@Service
|
||||
|
|
@ -25,6 +26,8 @@ public class TokenServiceImpl implements TokenService {
|
|||
private RedisTemplate<String, LoginUser> redisTemplate;
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> idTokenRedisTemplate;
|
||||
@Autowired
|
||||
private SysLogService logService;
|
||||
|
||||
@Override
|
||||
public Token saveToken(LoginUser loginUser) {
|
||||
|
|
@ -35,6 +38,7 @@ public class TokenServiceImpl implements TokenService {
|
|||
|
||||
loginUser.setToken(token);
|
||||
updateLoginUser(loginUser);
|
||||
logService.save(loginUser.getId(), "登陆", true, null);
|
||||
|
||||
return Token.builder().token(token).build();
|
||||
}
|
||||
|
|
@ -61,6 +65,7 @@ public class TokenServiceImpl implements TokenService {
|
|||
if (loginUser != null) {
|
||||
redisTemplate.delete(key);
|
||||
redisTemplate.delete(getUserIdKey(loginUser.getId()));
|
||||
logService.save(loginUser.getId(), "退出", true, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue