ip2region & GeoLite2 ip地址转换,支持国家、省、市、地域
This commit is contained in:
+1
-2
@@ -59,8 +59,7 @@ import com.nimbusds.jose.JOSEException;
|
||||
|
||||
@AutoConfiguration
|
||||
public class ApplicationAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger =
|
||||
LoggerFactory.getLogger(ApplicationAutoConfiguration.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(ApplicationAutoConfiguration.class);
|
||||
|
||||
@Bean
|
||||
public PasswordReciprocal passwordReciprocal() {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ import jakarta.servlet.Filter;
|
||||
|
||||
@AutoConfiguration
|
||||
public class MvcAutoConfiguration implements InitializingBean , WebMvcConfigurer {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(MvcAutoConfiguration.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(MvcAutoConfiguration.class);
|
||||
|
||||
/**
|
||||
* 消息处理,可以直接使用properties的key值,返回的是对应的value值
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
@AutoConfiguration
|
||||
public class RedisAutoConfiguration implements InitializingBean {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(RedisAutoConfiguration.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(RedisAutoConfiguration.class);
|
||||
|
||||
/**
|
||||
* RedisConnectionFactory.
|
||||
|
||||
@@ -18,7 +18,7 @@ import io.swagger.v3.oas.models.info.License;
|
||||
|
||||
@AutoConfiguration
|
||||
public class SwaggerConfig {
|
||||
final static Logger _logger = LoggerFactory.getLogger(SwaggerConfig.class);
|
||||
static final Logger _logger = LoggerFactory.getLogger(SwaggerConfig.class);
|
||||
|
||||
@Value("${maxkey.swagger.title}")
|
||||
String title;
|
||||
|
||||
@@ -64,9 +64,13 @@ public class HistoryLogin extends JpaEntity implements Serializable{
|
||||
@Column
|
||||
String sourceIp;
|
||||
@Column
|
||||
String ipRegion;
|
||||
String country;
|
||||
@Column
|
||||
String ipLocation;
|
||||
String province;
|
||||
@Column
|
||||
String city;
|
||||
@Column
|
||||
String location;
|
||||
@Column
|
||||
String browser;
|
||||
@Column
|
||||
@@ -173,20 +177,36 @@ public class HistoryLogin extends JpaEntity implements Serializable{
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public String getIpRegion() {
|
||||
return ipRegion;
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setIpRegion(String ipRegion) {
|
||||
this.ipRegion = ipRegion;
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getIpLocation() {
|
||||
return ipLocation;
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setIpLocation(String ipLocation) {
|
||||
this.ipLocation = ipLocation;
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getBrowser() {
|
||||
@@ -300,10 +320,14 @@ public class HistoryLogin extends JpaEntity implements Serializable{
|
||||
builder.append(provider);
|
||||
builder.append(", sourceIp=");
|
||||
builder.append(sourceIp);
|
||||
builder.append(", ipRegion=");
|
||||
builder.append(ipRegion);
|
||||
builder.append(", ipLocation=");
|
||||
builder.append(ipLocation);
|
||||
builder.append(", country=");
|
||||
builder.append(country);
|
||||
builder.append(", province=");
|
||||
builder.append(province);
|
||||
builder.append(", city=");
|
||||
builder.append(city);
|
||||
builder.append(", location=");
|
||||
builder.append(location);
|
||||
builder.append(", browser=");
|
||||
builder.append(browser);
|
||||
builder.append(", platform=");
|
||||
|
||||
+30
-3
@@ -28,7 +28,30 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
public class LoginHistoryRepository {
|
||||
private static Logger logger = LoggerFactory.getLogger(LoginHistoryRepository.class);
|
||||
|
||||
private static final String HISTORY_LOGIN_INSERT_STATEMENT = "insert into mxk_history_login (id , sessionid , userid , username , displayname , logintype , message , code , provider , sourceip , ipregion , iplocation, browser , platform , application , loginurl , sessionstatus ,instid)values( ? , ? , ? , ? , ? , ? , ? , ? , ?, ? , ? , ?, ? , ? , ?, ? , ? , ?)";
|
||||
private static final String HISTORY_LOGIN_INSERT_STATEMENT = """
|
||||
insert into mxk_history_login
|
||||
( id ,
|
||||
sessionid ,
|
||||
userid ,
|
||||
username ,
|
||||
displayname ,
|
||||
logintype ,
|
||||
message ,
|
||||
code ,
|
||||
provider ,
|
||||
sourceip ,
|
||||
country ,
|
||||
province ,
|
||||
city ,
|
||||
location ,
|
||||
browser ,
|
||||
platform ,
|
||||
application ,
|
||||
loginurl ,
|
||||
sessionstatus ,
|
||||
instid)
|
||||
values( ? , ? , ? , ? , ? , ? , ? , ? , ?, ? , ? , ? , ?, ?, ? , ? , ?, ? , ? , ?)
|
||||
""";
|
||||
|
||||
protected JdbcTemplate jdbcTemplate;
|
||||
|
||||
@@ -71,8 +94,10 @@ public class LoginHistoryRepository {
|
||||
historyLogin.getCode(),
|
||||
historyLogin.getProvider(),
|
||||
historyLogin.getSourceIp(),
|
||||
historyLogin.getIpRegion(),
|
||||
historyLogin.getIpLocation(),
|
||||
historyLogin.getCountry(),
|
||||
historyLogin.getProvince(),
|
||||
historyLogin.getCity(),
|
||||
historyLogin.getLocation(),
|
||||
historyLogin.getBrowser(),
|
||||
historyLogin.getPlatform(),
|
||||
"Browser",
|
||||
@@ -97,6 +122,8 @@ public class LoginHistoryRepository {
|
||||
Types.VARCHAR,
|
||||
Types.VARCHAR,
|
||||
Types.VARCHAR,
|
||||
Types.VARCHAR,
|
||||
Types.VARCHAR,
|
||||
Types.INTEGER,
|
||||
Types.VARCHAR
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user