From c221d618ea50a6223639c3bc3a997640ebf4399c Mon Sep 17 00:00:00 2001 From: "wei.peng" Date: Mon, 17 Dec 2018 20:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=97=A5=E5=BF=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/CommonEnumUtil.java | 124 +++++++++++++++++++++ .../i3plus/pojo/platform/bean/SysLogUserLogin.java | 5 + 2 files changed, 129 insertions(+) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java index 5795927..491e3ac 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java @@ -639,4 +639,128 @@ public class CommonEnumUtil { } } + /** + * 客户端操作系统 + * return "Windows"; + * return "Mac"; + * return "Unix"; + * return "Android"; + * return "IPhone"; + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum LOG_LOGIN_PLATFORM { + WINDOWS(1, "Windows", "Windows 操作系统"), + MAC(2, "Mac", "Mac 操作系统"), + UNIX(3, "Unix", "Linux 操作系统"), + ANDROID(4, "Android", "Android 操作系统"), + IPHONE(5, "IPhone", "IPhone 操作系统"); + + private int value; + private String name; + private String description; + + LOG_LOGIN_PLATFORM() { + } + + LOG_LOGIN_PLATFORM(int value, String name, String description) { + this.value = value; + this.name = name; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public String getName() { + return name; + } + + public static String valueOf(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].getName(); + } + } + return tmp; + } + + /** + * -1 未识别操作系统 + * @param desc + * @return + */ + public static int descOf(String desc) { + int tmp = -1; + for (int i = 0; i < values().length; i++) { + if (values()[i].name.equals(desc)) { + tmp = values()[i].value; + } + } + return tmp; + } + } + + /** + * 用户登录状态 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum USER_LOGIN_STATUS { + LOGIN_SUCCESS(1, "登录成功", "登录成功"), + WRONG_PASSWORD(3, "密码错误", "Linux 密码错误"), + WRONG_USERNAME_OR_PASSWORD(2, "用户名或密码错误", "用户名或密码错误"), + USER_LOGIN_LOCKING(4, "账号已锁定", "账号已锁定"), + USER_INFO_NULL(5, "用户信息不存在", "用户信息不存在"), + SYSTEM_ERROR(6, "系统异常", "系统异常"); + + private int value; + private String name; + private String description; + + USER_LOGIN_STATUS() { + } + + USER_LOGIN_STATUS(int value, String name, String description) { + this.value = value; + this.name = name; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public String getName() { + return name; + } + + public static String valueOf(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].getName(); + } + } + return tmp; + } + + public static int descOf(String desc) { + int tmp = -1; + for (int i = 0; i < values().length; i++) { + if (values()[i].name.equals(desc)) { + tmp = values()[i].value; + } + } + return tmp; + } + } } diff --git a/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysLogUserLogin.java b/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysLogUserLogin.java index b2b572c..179d637 100644 --- a/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysLogUserLogin.java +++ b/modules/i3plus-pojo-platform/src/main/java/cn/estsh/i3plus/pojo/platform/bean/SysLogUserLogin.java @@ -11,6 +11,7 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; +import javax.servlet.http.HttpServletRequest; /** * @Description : 用户登录记录 @@ -47,6 +48,10 @@ public class SysLogUserLogin extends BaseBean { @Column(name="LOG_LOGIN_HOST") @ApiParam(value ="登录IP" , access ="登录IP") private String logLoginHost; + + @Column(name="LOG_LOGIN_BROWSER") + @ApiParam(value ="登录浏览器" , access ="登录的浏览器") + private String logLoginBrowser; @Column(name="LOG_LOGIN_DATE_TIME") @ApiParam(value ="登录时间" , access ="登录时间")