yun-zuoyi
amy 7 years ago
commit 5baec35497

@ -96,16 +96,43 @@ public class BaseResultBean<Obj> {
}
public static BaseResultBean buildBaseResultBean(boolean success,String msg){
BaseResultBean rs = new BaseResultBean();
BaseResultBean rs = new BaseResultBean();
rs.success = success;
if(success) {
if (success) {
rs.msg = msg;
rs.code = ResourceEnumUtil.MESSAGE.SUCCESS.getCode();
}else {
} else {
rs.code = ResourceEnumUtil.MESSAGE.FAIL.getCode();
rs.errorMsg = msg;
}
return rs;
}
public BaseResultBean setResultList(List<Obj> resultList) {
this.resultList = resultList;
return this;
}
public BaseResultBean setResultObject(Obj resultObject) {
this.resultObject = resultObject;
return this;
}
public BaseResultBean setResultMap(Map<String, Object> resultMap) {
this.resultMap = resultMap;
return this;
}
public BaseResultBean setPager(Pager pager) {
this.pager = pager;
return this;
}
public BaseResultBean setListPager(ListPager<Obj> listPager) {
this.listPager = listPager;
this.setPager(listPager.getObjectPager());
this.setResultList(listPager.getObjectList());
return this;
}
}

@ -615,35 +615,195 @@ public class CommonEnumUtil {
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum CLOUD_STATUS {
REGISTERED(1, "注册"),
DISCONNECT(2, "断开");
public enum CLOUD_APP_STATUS {
UP(1,"UP" ,"在线"),
DOWN(2, "DOWN","断线");
private int value;
private String code;
private String description;
private CLOUD_APP_STATUS(int value, String code, String description) {
this.value = value;
this.code = code;
this.description = description;
}
public int getValue() {
return value;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
private CLOUD_STATUS(int value, String description) {
public static String valueOfCode(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].code;
}
}
return tmp;
}
public static int codeOfValue(String code) {
int tmp = 1;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
tmp = values()[i].value;
}
}
return tmp;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public static String codeOfDescription(String code) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
*
* 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].description;
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;
}
}
}

@ -209,6 +209,16 @@ public class ImppEnumUtil {
return tmp;
}
public static String valueOfName(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].name;
}
}
return tmp;
}
public static String codeOfDescription(String code) {
String tmp = null;
for (int i = 0; i < values().length; i++) {

@ -1,6 +1,7 @@
package cn.estsh.i3plus.pojo.platform.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
@ -33,6 +34,14 @@ public class SysLogException extends BaseBean {
@ApiParam(value ="系统模块(枚举)", example = "1")
private Integer excModule;
private String excModuleName;
public String getExcModuleName(){
if(this.excModule != null){
return CommonEnumUtil.SOFT_TYPE.valueOfDescription(this.excModule);
}
return excModuleName;
}
@Column(name="EXC_CLASS_NAME")
@ApiParam(value ="异常类名")
private String excClassName;

@ -1,6 +1,7 @@
package cn.estsh.i3plus.pojo.platform.bean;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
@ -35,6 +36,14 @@ public class SysLogOperate extends BaseBean {
@ApiParam(value ="系统模块(枚举)", example = "1")
private Integer operateModule;
private String operateModuleName;
public String getOperateModuleName(){
if(this.operateModule != null){
return CommonEnumUtil.SOFT_TYPE.valueOfDescription(this.operateModule);
}
return operateModuleName;
}
//ImppEnumUtil.OPERATE_TYPE枚举
@Column(name="OPERATE_TYPE")
@ApiParam(value ="操作类型" , example = "-1")

@ -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 ="登录时间")

Loading…
Cancel
Save