|
@@ -2,6 +2,7 @@ package com.huaxu.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
+import com.huaxu.dao.LoginLogMapper;
|
|
|
import com.huaxu.dao.UserMapper;
|
|
|
import com.huaxu.dto.UserDto;
|
|
|
import com.huaxu.entity.LoginLog;
|
|
@@ -15,6 +16,7 @@ import com.huaxu.security.smsCode.SmsCodeException;
|
|
|
import com.huaxu.service.UserService;
|
|
|
import com.huaxu.util.ByteArrayUtils;
|
|
|
import com.huaxu.util.RedisUtil;
|
|
|
+import com.huaxu.util.Util;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@@ -55,6 +57,8 @@ public class UserServiceImpl implements UserService {
|
|
|
|
|
|
@Autowired
|
|
|
private AuthorizationServerTokenServices authorizationServerTokenServices;
|
|
|
+ @Autowired
|
|
|
+ private LoginLogMapper loginLogMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -206,8 +210,16 @@ public class UserServiceImpl implements UserService {
|
|
|
OAuth2Authentication oAuth2AuthenticationNew = new OAuth2Authentication(oAuth2Authentication.getOAuth2Request(), authenticationTokenReslut);
|
|
|
|
|
|
OAuth2AccessToken accessToken = authorizationServerTokenServices.createAccessToken(oAuth2AuthenticationNew);
|
|
|
- //0404d87f-c25d-4947-b17a-0cb65210f5bb
|
|
|
- //new RedisTokenStore()
|
|
|
+ LoginLog loginLog=new LoginLog();
|
|
|
+ loginLog.setName(loginUser.getName());
|
|
|
+ loginLog.setCreateTime(new Date());
|
|
|
+ loginLog.setPhone(loginUser.getPhoneNumber());
|
|
|
+ loginLog.setCompanyId(loginUser.getCompanyId());
|
|
|
+ loginLog.setDepartmentId(loginUser.getDepartmentId());
|
|
|
+ loginLog.setType("登录");
|
|
|
+ loginLog.setLoginIp(Util.getIpAddr(request));
|
|
|
+ loginLogMapper.insert(loginLog);
|
|
|
+
|
|
|
return accessToken;
|
|
|
}
|
|
|
|