mirror of https://gitee.com/topiam/eiam
⚡ 优化代码
parent
2ed71ca215
commit
4ab97e9521
|
@ -39,11 +39,6 @@ import lombok.NonNull;
|
||||||
@Builder
|
@Builder
|
||||||
public class Actor implements Serializable {
|
public class Actor implements Serializable {
|
||||||
|
|
||||||
public static final String ACTOR_ID = "actor.id";
|
|
||||||
public static final String ACTOR_TYPE = "actor.type";
|
|
||||||
|
|
||||||
public static final String ACTOR_AUTH_TYPE = "actor.auth_type.keyword";
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = -1144169992714000310L;
|
private static final long serialVersionUID = -1144169992714000310L;
|
||||||
|
|
||||||
|
@ -51,20 +46,17 @@ public class Actor implements Serializable {
|
||||||
* 行动者ID
|
* 行动者ID
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
@Field(type = FieldType.Keyword, name = "id")
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 行动者类型
|
* 行动者类型
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
@Field(type = FieldType.Keyword, name = "type")
|
|
||||||
private UserType type;
|
private UserType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 身份验证类型
|
* 身份验证类型
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "auth_type")
|
|
||||||
private String authType;
|
private String authType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,67 +52,56 @@ public class GeoLocation implements Serializable {
|
||||||
/**
|
/**
|
||||||
* IP
|
* IP
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Ip, name = "ip")
|
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* continent code
|
* continent code
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "continent_code")
|
|
||||||
private String continentCode;
|
private String continentCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* continent Name
|
* continent Name
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Text, name = "continent_code")
|
|
||||||
private String continentName;
|
private String continentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国家code
|
* 国家code
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "country_code")
|
|
||||||
private String countryCode;
|
private String countryCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国家名称
|
* 国家名称
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Text, name = "country_name")
|
|
||||||
private String countryName;
|
private String countryName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 省份code
|
* 省份code
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "province_code")
|
|
||||||
private String provinceCode;
|
private String provinceCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 省份
|
* 省份
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Text, name = "province_name")
|
|
||||||
private String provinceName;
|
private String provinceName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 城市code
|
* 城市code
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "city_code")
|
|
||||||
private String cityCode;
|
private String cityCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 城市名称
|
* 城市名称
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Text, name = "city_name")
|
|
||||||
private String cityName;
|
private String cityName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地理坐标
|
* 地理坐标
|
||||||
*/
|
*/
|
||||||
@GeoPointField
|
|
||||||
private GeoPoint point;
|
private GeoPoint point;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供商
|
* 提供商
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "provider")
|
|
||||||
private GeoLocationProvider provider;
|
private GeoLocationProvider provider;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,24 +50,20 @@ public class Target implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 目标 ID
|
* 目标 ID
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "id")
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目标名称
|
* 目标名称
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "name")
|
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 目标类型
|
* 目标类型
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "type")
|
|
||||||
private TargetType type;
|
private TargetType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目标类型名称
|
* 目标类型名称
|
||||||
*/
|
*/
|
||||||
@Field(type = FieldType.Keyword, name = "type_name")
|
|
||||||
private String typeName;
|
private String typeName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,21 +38,15 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class UserAgent implements Serializable {
|
public class UserAgent implements Serializable {
|
||||||
|
|
||||||
@Field(type = FieldType.Keyword, name = "device_type")
|
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
|
|
||||||
@Field(type = FieldType.Keyword, name = "platform")
|
|
||||||
private String platform;
|
private String platform;
|
||||||
|
|
||||||
@Field(type = FieldType.Keyword, name = "platform_version")
|
|
||||||
private String platformVersion;
|
private String platformVersion;
|
||||||
|
|
||||||
@Field(type = FieldType.Keyword, name = "browser")
|
|
||||||
private String browser;
|
private String browser;
|
||||||
|
|
||||||
@Field(type = FieldType.Keyword, name = "browser_type")
|
|
||||||
private String browserType;
|
private String browserType;
|
||||||
|
|
||||||
@Field(type = FieldType.Keyword, name = "browser_major_version")
|
|
||||||
private String browserMajorVersion;
|
private String browserMajorVersion;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,13 @@ export default (props: { userId: string }) => {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: intl.formatMessage({ id: 'pages.account.user_detail.login_audit.columns.platform' }),
|
||||||
|
ellipsis: true,
|
||||||
|
dataIndex: 'platform',
|
||||||
|
width: 110,
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'pages.account.user_detail.login_audit.columns.browser' }),
|
title: intl.formatMessage({ id: 'pages.account.user_detail.login_audit.columns.browser' }),
|
||||||
dataIndex: 'browser',
|
dataIndex: 'browser',
|
||||||
|
|
|
@ -67,6 +67,7 @@ export default {
|
||||||
'pages.account.user_detail.login_audit.columns.app_name': '应用名称',
|
'pages.account.user_detail.login_audit.columns.app_name': '应用名称',
|
||||||
'pages.account.user_detail.login_audit.columns.client_ip': '客户端IP',
|
'pages.account.user_detail.login_audit.columns.client_ip': '客户端IP',
|
||||||
'pages.account.user_detail.login_audit.columns.browser': '浏览器',
|
'pages.account.user_detail.login_audit.columns.browser': '浏览器',
|
||||||
|
'pages.account.user_detail.login_audit.columns.platform': '操作系统',
|
||||||
'pages.account.user_detail.login_audit.columns.location': '地理位置',
|
'pages.account.user_detail.login_audit.columns.location': '地理位置',
|
||||||
'pages.account.user_detail.login_audit.columns.event_time': '登录时间',
|
'pages.account.user_detail.login_audit.columns.event_time': '登录时间',
|
||||||
'pages.account.user_detail.login_audit.columns.event_status': '登录结果',
|
'pages.account.user_detail.login_audit.columns.event_status': '登录结果',
|
||||||
|
|
|
@ -221,6 +221,10 @@ declare namespace AccountAPI {
|
||||||
export interface UserLoginAuditList {
|
export interface UserLoginAuditList {
|
||||||
appName: string;
|
appName: string;
|
||||||
clientIp: string;
|
clientIp: string;
|
||||||
|
userAgent: {
|
||||||
|
platformVersion:string;
|
||||||
|
platform:string
|
||||||
|
};
|
||||||
browser: string;
|
browser: string;
|
||||||
eventStatus: string;
|
eventStatus: string;
|
||||||
eventTime: string;
|
eventTime: string;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.topiam.employee.audit.entity.GeoLocation;
|
||||||
|
import cn.topiam.employee.audit.entity.UserAgent;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.springframework.data.elasticsearch.client.elc.NativeQuery;
|
import org.springframework.data.elasticsearch.client.elc.NativeQuery;
|
||||||
|
@ -275,10 +277,13 @@ public interface UserConverter {
|
||||||
if (audit.getEventType().getCode().equals(PortalEventType.LOGIN_PORTAL.getCode())) {
|
if (audit.getEventType().getCode().equals(PortalEventType.LOGIN_PORTAL.getCode())) {
|
||||||
result.setAppName(PORTAL.getDesc());
|
result.setAppName(PORTAL.getDesc());
|
||||||
}
|
}
|
||||||
|
UserAgent userAgent=audit.getUserAgent();
|
||||||
|
GeoLocation geoLocation= audit.getGeoLocation();
|
||||||
result.setEventTime(audit.getEventTime());
|
result.setEventTime(audit.getEventTime());
|
||||||
result.setClientIp(audit.getGeoLocation().getIp());
|
result.setClientIp(geoLocation.getIp());
|
||||||
result.setBrowser(audit.getUserAgent().getBrowser());
|
result.setLocation(geoLocation.getCityName());
|
||||||
result.setLocation(audit.getGeoLocation().getCityName());
|
result.setBrowser(userAgent.getBrowser());
|
||||||
|
result.setPlatform(userAgent.getPlatform()+" "+userAgent.getPlatformVersion());
|
||||||
result.setEventStatus(audit.getEventStatus());
|
result.setEventStatus(audit.getEventStatus());
|
||||||
list.add(result);
|
list.add(result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,6 +53,12 @@ public class UserLoginAuditListResult {
|
||||||
@Parameter(description = "客户端IP")
|
@Parameter(description = "客户端IP")
|
||||||
private String clientIp;
|
private String clientIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统
|
||||||
|
*/
|
||||||
|
@Parameter(description = "操作系统")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录结果
|
* 登录结果
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue