项目初始导入

This commit is contained in:
dell
2017-12-29 16:18:40 +08:00
commit 0788f42ae7
3221 changed files with 500217 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
package com.nis.domain;
import java.io.Serializable;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Maps;
import com.nis.supcan.SupCol;
import com.nis.supcan.SupTreeList;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
import com.nis.web.security.UserUtils;
/**
* Entity支持类
* @author ThinkGem
* @version 2014-05-16
*/
@SupTreeList
public abstract class BaseEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 删除标记1正常0删除2审核
*/
public static final String DEL_FLAG_NORMAL = "1";
public static final String DEL_FLAG_DELETE = "0";
public static final String DEL_FLAG_AUDIT = "2";
/**
* 实体编号(唯一标识)
*/
protected Long id;
/**
* 当前用户
*/
protected SysUser currentUser;
/**
* 当前实体分页对象
*/
protected Page<T> page;
/**
* 自定义SQLSQL标识SQL内容
*/
protected Map<String, String> sqlMap;
/**
* 是否是新记录默认false调用setIsNewRecord()设置新记录使用自定义ID。
* 设置为true后强制执行插入语句ID不会自动生成需从手动传入。
*/
protected boolean isNewRecord = false;
public BaseEntity() {
}
public BaseEntity(Long id) {
this();
this.id = id;
}
@SupCol(isUnique="true", isHide="true")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@JsonIgnore
@XmlTransient
public SysUser getCurrentUser() {
if(currentUser == null){
currentUser = UserUtils.getUser();
}
return currentUser;
}
public void setCurrentUser(SysUser currentUser) {
this.currentUser = currentUser;
}
@JsonIgnore
@XmlTransient
public Page<T> getPage() {
if (page == null){
page = new Page<T>();
}
return page;
}
public Page<T> setPage(Page<T> page) {
this.page = page;
return page;
}
@JsonIgnore
@XmlTransient
public Map<String, String> getSqlMap() {
if (sqlMap == null){
sqlMap = Maps.newHashMap();
}
return sqlMap;
}
public void setSqlMap(Map<String, String> sqlMap) {
this.sqlMap = sqlMap;
}
/**
* 是否是新记录默认false调用setIsNewRecord()设置新记录使用自定义ID。
* 设置为true后强制执行插入语句ID不会自动生成需从手动传入。
* @return
*/
@JsonIgnore
public boolean getIsNewRecord() {
return isNewRecord || StringUtil.isEmpty(getId());
}
/**
* 是否是新记录默认false调用setIsNewRecord()设置新记录使用自定义ID。
* 设置为true后强制执行插入语句ID不会自动生成需从手动传入。
*/
public void setIsNewRecord(boolean isNewRecord) {
this.isNewRecord = isNewRecord;
}
/**
* 获取数据库名称
*/
@JsonIgnore
public String getDbName(){
return Configurations.getStringProperty("jdbc.type", "mysql");
}
@Override
public boolean equals(Object obj) {
if (null == obj) {
return false;
}
if (this == obj) {
return true;
}
if (!getClass().equals(obj.getClass())) {
return false;
}
BaseEntity<?> that = (BaseEntity<?>) obj;
return null == this.getId() ? false : this.getId().equals(that.getId());
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
}

View File

@@ -0,0 +1,120 @@
/**
* @Title: ControlLog.java
* @Package com.nis.domain
* @Description: TODO(用一句话描述该文件做什么)
* @author darnell
* @date 2016年8月15日 下午4:11:12
* @version V1.0
*/
package com.nis.domain;
import java.util.Date;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
* @ClassName: ControlLog
* @Description: TODO(这里用一句话描述这个类的作用)
* @author (darnell)
* @date 2016年8月15日 下午4:11:12
* @version V1.0
*/
@ApiModel
public class ControlLog extends BaseEntity<ControlLog> {
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = 7644628891063420679L;
/**
*/
@ApiModelProperty(value="域名", required=true)
private String domain;
@ApiModelProperty(value="标题", required=true)
private String title;
@ApiModelProperty(value="源IP", required=true)
private String srcIp;
@ApiModelProperty(value="应答IP", required=true)
private String resIp;
@ApiModelProperty(value="状态", required=true)
private Integer status;
@ApiModelProperty(value="操作时间", required=true)
private Date optTime;
/**
* @return domain
*/
public String getDomain() {
return domain;
}
/**
* @param domain 要设置的 domain
*/
public void setDomain(String domain) {
this.domain = domain;
}
/**
* @return title
*/
public String getTitle() {
return title;
}
/**
* @param title 要设置的 title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return srcIp
*/
public String getSrcIp() {
return srcIp;
}
/**
* @param srcIp 要设置的 srcIp
*/
public void setSrcIp(String srcIp) {
this.srcIp = srcIp;
}
/**
* @return resIp
*/
public String getResIp() {
return resIp;
}
/**
* @param resIp 要设置的 resIp
*/
public void setResIp(String resIp) {
this.resIp = resIp;
}
/**
* @return status
*/
public Integer getStatus() {
return status;
}
/**
* @param status 要设置的 status
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* @return optTime
*/
public Date getOptTime() {
return optTime;
}
/**
* @param optTime 要设置的 optTime
*/
public void setOptTime(Date optTime) {
this.optTime = optTime;
}
}

View File

@@ -0,0 +1,179 @@
/**
* @Title: LogEntity.java
* @Package com.nis.domain
* @Description: TODO(用一句话描述该文件做什么)
* @author darnell
* @date 2016年9月1日 上午10:16:54
* @version V1.0
*/
package com.nis.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Maps;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: DfJitLogEntity
* @Description: TODO(实时统计公共实体部分)
* @author (rkg)
* @date 2016年9月13日下午2:54:12
* @version V1.0
*/
public abstract class DfJitLogEntity<T> implements Serializable {
@ApiModelProperty(value = "id", required = true)
protected Long statId;
@ApiModelProperty(value = "统计时间", required = true)
protected Date reportTime;
@ApiModelProperty(value = "ip所属国家", required = false)
protected String nation;
@ApiModelProperty(value = "ip所属省", required = false)
protected String province;
@ApiModelProperty(value = "ip所属市", required = false)
protected String city;
@ApiModelProperty(value = "日志数量", required = true)
protected Long sum;
@ApiModelProperty(value = "业务类型", required = true)
protected Integer service;
/**
* 公共查询部分
*/
protected String searchReportStartTime;
protected String searchReportEndTime;
protected String searchService;
/**
* 当前实体分页对象
*/
protected Page<T> page;
/**
* 自定义SQLSQL标识SQL内容
*/
protected Map<String, String> sqlMap;
public DfJitLogEntity() {
super();
}
public Long getStatId() {
return statId;
}
public void setStatId(Long statId) {
this.statId = statId;
}
@JsonSerialize(using = JsonDateSerializer.class)
public Date getReportTime() {
return reportTime;
}
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
public String getNation() {
return nation;
}
public void setNation(String nation) {
this.nation = nation;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Long getSum() {
return sum;
}
public void setSum(Long sum) {
this.sum = sum;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
@JsonIgnore
public String getSearchReportStartTime() {
return searchReportStartTime;
}
public void setSearchReportStartTime(String searchReportStartTime) {
this.searchReportStartTime = searchReportStartTime;
}
@JsonIgnore
public String getSearchReportEndTime() {
return searchReportEndTime;
}
public void setSearchReportEndTime(String searchReportEndTime) {
this.searchReportEndTime = searchReportEndTime;
}
@JsonIgnore
public String getSearchService() {
return searchService;
}
public void setSearchService(String searchService) {
this.searchService = searchService;
}
@JsonIgnore
@XmlTransient
public Page<T> getPage() {
if (page == null) {
page = new Page<T>();
}
return page;
}
public void setPage(Page<T> page) {
this.page = page;
}
@JsonIgnore
@XmlTransient
public Map<String, String> getSqlMap() {
if (sqlMap == null) {
sqlMap = Maps.newHashMap();
}
return sqlMap;
}
public void setSqlMap(Map<String, String> sqlMap) {
this.sqlMap = sqlMap;
}
}

View File

@@ -0,0 +1,149 @@
package com.nis.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.util.Configurations;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
public class DfReportEntity<T> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2990823464993846973L;
@ApiModelProperty(value = "A系统", required = true)
protected Long asum;
@ApiModelProperty(value = "B系统", required = true)
protected Long bsum;
@ApiModelProperty(value = "C系统", required = true)
protected Long csum;
@ApiModelProperty(value = "统计时间", required = true)
protected Date reportTime;
@ApiModelProperty(value = "全A+单B", required = true)
protected Long absum;
public Long getAsum() {
return asum;
}
public void setAsum(Long asum) {
this.asum = asum;
}
public Long getBsum() {
return bsum;
}
public void setBsum(Long bsum) {
this.bsum = bsum;
}
@JsonSerialize(using = JsonDateSerializer.class)
public Date getReportTime() {
return reportTime;
}
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
protected String searchReportStartTime;
protected String searchReportEndTime;
@JsonIgnore
public String getSearchReportStartTime() {
return searchReportStartTime;
}
public void setSearchReportStartTime(String searchReportStartTime) {
this.searchReportStartTime = searchReportStartTime;
}
@JsonIgnore
public String getSearchReportEndTime() {
return searchReportEndTime;
}
public void setSearchReportEndTime(String searchReportEndTime) {
this.searchReportEndTime = searchReportEndTime;
}
/**
* 当前实体分页对象
*/
protected Page<T> page;
/**
* 自定义SQLSQL标识SQL内容
*/
protected Map<String, String> sqlMap;
@JsonIgnore
@XmlTransient
public Page<T> getPage() {
if (page == null) {
page = new Page<T>();
}
return page;
}
public Page<T> setPage(Page<T> page) {
this.page = page;
return page;
}
@JsonIgnore
@XmlTransient
public Map<String, String> getSqlMap() {
if (sqlMap == null) {
sqlMap = Maps.newHashMap();
}
return sqlMap;
}
public void setSqlMap(Map<String, String> sqlMap) {
this.sqlMap = sqlMap;
}
/**
* 获取数据库名称
*/
@JsonIgnore
public String getDbName() {
return Configurations.getStringProperty("jdbc.type", "mysql");
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
public Long getAbsum() {
return absum;
}
public void setAbsum(Long absum) {
this.absum = absum;
}
public Long getCsum() {
return csum;
}
public void setCsum(Long csum) {
this.csum = csum;
}
}

View File

@@ -0,0 +1,841 @@
/**
* @Title: LogEntity.java
* @Package com.nis.domain
* @Description: TODO(用一句话描述该文件做什么)
* @author darnell
* @date 2016年9月1日 上午10:16:54
* @version V1.0
*/
package com.nis.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Maps;
import com.nis.util.Configurations;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
* @ClassName: LogEntity
* @Description: TODO(日志公共实体部分)
* @author (darnell)
* @date 2016年9月1日 上午10:16:54
* @version V1.0
*/
public abstract class LogEntity<T> implements Serializable {
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value="日志编号", required=true)
protected Long id;
@ApiModelProperty(value="配置ID", required=true)
protected Long cfgId;
@ApiModelProperty(value="发现时间", required=true)
protected Date foundTime;
@ApiModelProperty(value="接收时间", required=true)
protected Date recvTime;
/*@ApiModelProperty(value="外层嵌套关联信息ID", required=true)
protected Long overId;*/
@ApiModelProperty(value="外层嵌套关联信息ID", required=true)
protected String overId;
@ApiModelProperty(value="协议类型", required=true)
protected String protocol;
@ApiModelProperty(value="服务端ip地址", required=true)
protected String serverIp;
@ApiModelProperty(value="客户端ip地址", required=true)
protected String clientIp;
@ApiModelProperty(value="服务端端口", required=true)
protected Integer serverPort;
@ApiModelProperty(value="客户端端口", required=true)
protected Integer clientPort;
@ApiModelProperty(value="嵌套协议类型", required=true)
protected String nestProtocol;
@ApiModelProperty(value="嵌套服务端ip地址", required=true)
protected String nestServerIp;
@ApiModelProperty(value="嵌套客户端ip地址", required=true)
protected String nestClientIp;
@ApiModelProperty(value="嵌套服务端端口", required=true)
protected Integer nestServerPort;
@ApiModelProperty(value="嵌套客户端端口", required=true)
protected Integer nestClientPort;
@ApiModelProperty(value="业务类型", required=true)
protected Integer serviceType;
@ApiModelProperty(value="出入口编号", required=true)
protected Long entranceId;
@ApiModelProperty(value="处理机IP", required=true)
protected String cljIp;
@ApiModelProperty(value="封堵包记录文件", required=true)
protected String injectedPktFile;
@ApiModelProperty(value="存放现场日志文件的URL地址", required=true)
protected String sceneFile;
@ApiModelProperty(value="管控动作", required=true)
protected Integer action;
@ApiModelProperty(value="服务端地址定位信息", required=true)
protected String serverLocate;
@ApiModelProperty(value="客户端地址定位信息", required=true)
protected String clientLocate;
protected Long foundTimeCluster;
protected Long recvTimeCluster;
protected String searchFoundStartTime;
protected String searchFoundEndTime;
protected Long searchFoundStartTimeCluster;
protected Long searchFoundEndTimeCluster;
protected String searchCfgId;
protected String searchProtocol;
protected String searchServiceType;
protected String searchServerIp;
protected String searchClientIp;
protected String searchEntranceId;
protected String searchCljIp;
protected String tableName;//神通数据库根据A/B版动态切换表名
@JsonIgnore
public Long getFoundTimeCluster() {
return foundTimeCluster;
}
@JsonIgnore
public Long getRecvTimeCluster() {
return recvTimeCluster;
}
public void setFoundTimeCluster(Long foundTimeCluster) {
this.foundTimeCluster = foundTimeCluster;
}
public void setRecvTimeCluster(Long recvTimeCluster) {
this.recvTimeCluster = recvTimeCluster;
}
@JsonIgnore
public Long getSearchFoundStartTimeCluster() {
return searchFoundStartTimeCluster;
}
public void setSearchFoundStartTimeCluster(Long searchFoundStartTimeCluster) {
this.searchFoundStartTimeCluster = searchFoundStartTimeCluster;
}
@JsonIgnore
public Long getSearchFoundEndTimeCluster() {
return searchFoundEndTimeCluster;
}
public void setSearchFoundEndTimeCluster(Long searchFoundEndTimeCluster) {
this.searchFoundEndTimeCluster = searchFoundEndTimeCluster;
}
@JsonIgnore
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getOverId() {
return overId;
}
public void setOverId(String overId) {
this.overId = overId;
}
/**
* 当前实体分页对象
*/
protected Page<T> page;
/**
* 自定义SQLSQL标识SQL内容
*/
protected Map<String, String> sqlMap;
/**
* @Title:
* @Description: TODO
* @param 入参
*/
public LogEntity() {
super();
}
public String getInjectedPktFile() {
return injectedPktFile;
}
public void setInjectedPktFile(String injectedPktFile) {
this.injectedPktFile = injectedPktFile;
}
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id 要设置的 id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return cfgId
*/
public Long getCfgId() {
return cfgId;
}
/**
* @param cfgId 要设置的 cfgId
*/
public void setCfgId(Long cfgId) {
this.cfgId = cfgId;
}
/**
* @return foundTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getFoundTime() {
if(foundTime ==null && this.foundTimeCluster != null){
foundTime=new Date(this.foundTimeCluster*1000);
}
return foundTime;
}
/**
* @param foundTime 要设置的 foundTime
*/
public void setFoundTime(Date foundTime) {
this.foundTime = foundTime;
}
/**
* @return recvTime
*/
@JsonSerialize(using=JsonDateSerializer.class)
public Date getRecvTime() {
if(recvTime ==null && this.recvTimeCluster != null){
recvTime=new Date(this.recvTimeCluster*1000);
}
return recvTime;
}
/**
* @param recvTime 要设置的 recvTime
*/
public void setRecvTime(Date recvTime) {
this.recvTime = recvTime;
}
/**
* @return overId
*/
/*public Long getOverId() {
return overId;
}
*//**
* @param overId 要设置的 overId
*//*
public void setOverId(Long overId) {
this.overId = overId;
}*/
/**
* @return protocol
*/
public String getProtocol() {
return protocol;
}
/**
* @param protocol 要设置的 protocol
*/
public void setProtocol(String protocol) {
this.protocol = protocol;
}
/**
* @return serverIp
*/
public String getServerIp() {
return serverIp;
}
/**
* @param serverIp 要设置的 serverIp
*/
public void setServerIp(String serverIp) {
this.serverIp = serverIp;
}
/**
* @return clientIp
*/
public String getClientIp() {
return clientIp;
}
/**
* @param clientIp 要设置的 clientIp
*/
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
/**
* @return serverPort
*/
public Integer getServerPort() {
return serverPort;
}
/**
* @param serverPort 要设置的 serverPort
*/
public void setServerPort(Integer serverPort) {
this.serverPort = serverPort;
}
/**
* @return clientPort
*/
public Integer getClientPort() {
return clientPort;
}
/**
* @param clientPort 要设置的 clientPort
*/
public void setClientPort(Integer clientPort) {
this.clientPort = clientPort;
}
/**
* @return nestProtocol
*/
public String getNestProtocol() {
return nestProtocol;
}
/**
* @param nestProtocol 要设置的 nestProtocol
*/
public void setNestProtocol(String nestProtocol) {
this.nestProtocol = nestProtocol;
}
/**
* @return nestServerIp
*/
public String getNestServerIp() {
return nestServerIp;
}
/**
* @param nestServerIp 要设置的 nestServerIp
*/
public void setNestServerIp(String nestServerIp) {
this.nestServerIp = nestServerIp;
}
/**
* @return nestClientIp
*/
public String getNestClientIp() {
return nestClientIp;
}
/**
* @param nestClientIp 要设置的 nestClientIp
*/
public void setNestClientIp(String nestClientIp) {
this.nestClientIp = nestClientIp;
}
/**
* @return nestServerPort
*/
public Integer getNestServerPort() {
return nestServerPort;
}
/**
* @param nestServerPort 要设置的 nestServerPort
*/
public void setNestServerPort(Integer nestServerPort) {
this.nestServerPort = nestServerPort;
}
/**
* @return nestClientPort
*/
public Integer getNestClientPort() {
return nestClientPort;
}
/**
* @param nestClientPort 要设置的 nestClientPort
*/
public void setNestClientPort(Integer nestClientPort) {
this.nestClientPort = nestClientPort;
}
/**
* @return serviceType
*/
public Integer getServiceType() {
return serviceType;
}
/**
* @param serviceType 要设置的 serviceType
*/
public void setServiceType(Integer serviceType) {
this.serviceType = serviceType;
}
/**
* @return entranceId
*/
public Long getEntranceId() {
return entranceId;
}
/**
* @param entranceId 要设置的 entranceId
*/
public void setEntranceId(Long entranceId) {
this.entranceId = entranceId;
}
/**
* @return cljIp
*/
public String getCljIp() {
return cljIp;
}
/**
* @param cljIp 要设置的 cljIp
*/
public void setCljIp(String cljIp) {
this.cljIp = cljIp;
}
public String getServerLocate() {
return serverLocate;
}
public void setServerLocate(String serverLocate) {
this.serverLocate = serverLocate;
}
public String getClientLocate() {
return clientLocate;
}
public void setClientLocate(String clientLocate) {
this.clientLocate = clientLocate;
}
@JsonIgnore
@XmlTransient
public Page<T> getPage() {
if (page == null){
page = new Page<T>();
}
return page;
}
public Page<T> setPage(Page<T> page) {
this.page = page;
return page;
}
@JsonIgnore
@XmlTransient
public Map<String, String> getSqlMap() {
if (sqlMap == null){
sqlMap = Maps.newHashMap();
}
return sqlMap;
}
public void setSqlMap(Map<String, String> sqlMap) {
this.sqlMap = sqlMap;
}
/**
* 获取数据库名称
*/
@JsonIgnore
public String getDbName(){
return Configurations.getStringProperty("jdbc.type", "mysql");
}
@Override
public boolean equals(Object obj) {
if (null == obj) {
return false;
}
if (this == obj) {
return true;
}
if (!getClass().equals(obj.getClass())) {
return false;
}
LogEntity<?> that = (LogEntity<?>) obj;
return null == this.getId() ? false : this.getId().equals(that.getId());
}
/**
* @return searchFoundStartTime
*/
@JsonIgnore
public String getSearchFoundStartTime() {
return searchFoundStartTime;
}
/**
* @param searchFoundStartTime 要设置的 searchFoundStartTime
*/
public void setSearchFoundStartTime(String searchFoundStartTime) {
this.searchFoundStartTime = searchFoundStartTime;
}
/**
* @return searchFoundEndTime
*/
@JsonIgnore
public String getSearchFoundEndTime() {
return searchFoundEndTime;
}
/**
* @param searchFoundEndTime 要设置的 searchFoundEndTime
*/
public void setSearchFoundEndTime(String searchFoundEndTime) {
this.searchFoundEndTime = searchFoundEndTime;
}
/**
* @return searchCfgId
*/
@JsonIgnore
public String getSearchCfgId() {
return searchCfgId;
}
/**
* @param searchCfgId 要设置的 searchCfgId
*/
public void setSearchCfgId(String searchCfgId) {
this.searchCfgId = searchCfgId;
}
/**
* @return searchProtocol
*/
@JsonIgnore
public String getSearchProtocol() {
return searchProtocol;
}
/**
* @param searchProtocol 要设置的 searchProtocol
*/
public void setSearchProtocol(String searchProtocol) {
this.searchProtocol = searchProtocol;
}
/**
* @return searchServerIp
*/
@JsonIgnore
public String getSearchServerIp() {
return searchServerIp;
}
/**
* @param searchServerIp 要设置的 searchServerIp
*/
public void setSearchServerIp(String searchServerIp) {
this.searchServerIp = searchServerIp;
}
/**
* @return searchClientIp
*/
@JsonIgnore
public String getSearchClientIp() {
return searchClientIp;
}
/**
* @param searchClientIp 要设置的 searchClientIp
*/
public void setSearchClientIp(String searchClientIp) {
this.searchClientIp = searchClientIp;
}
/**
* @return searchEntranceId
*/
@JsonIgnore
public String getSearchEntranceId() {
return searchEntranceId;
}
/**
* @param searchEntranceId 要设置的 searchEntranceId
*/
public void setSearchEntranceId(String searchEntranceId) {
this.searchEntranceId = searchEntranceId;
}
/**
* @return searchCljIp
*/
@JsonIgnore
public String getSearchCljIp() {
return searchCljIp;
}
/**
* @param searchCljIp 要设置的 searchCljIp
*/
public void setSearchCljIp(String searchCljIp) {
this.searchCljIp = searchCljIp;
}
/**
* @return searchServiceType
*/
@JsonIgnore
public String getSearchServiceType() {
return searchServiceType;
}
/**
* @param searchServiceType 要设置的 searchServiceType
*/
public void setSearchServiceType(String searchServiceType) {
this.searchServiceType = searchServiceType;
}
public String getSceneFile() {
return sceneFile;
}
public void setSceneFile(String sceneFile) {
this.sceneFile = sceneFile;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
}

View File

@@ -0,0 +1,780 @@
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.nis.domain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.mapping.ResultMap;
import org.apache.ibatis.mapping.ResultMapping;
import org.apache.ibatis.session.SqlSessionFactory;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.CookieUtil;
import com.nis.util.StringUtil;
import com.nis.web.service.SpringContextHolder;
/**
* 分页类
* @author ThinkGem
* @version 2013-7-2
* @param <T>
*/
public class Page<T> {
private int pageNo = 1; // 当前页码
private int pageSize = Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)); // 页面大小,设置为“-1”表示不进行分页分页无效
private long count;// 总记录数,设置为“-1”表示不查询总数
private int first;// 首页索引
private int last;// 尾页索引
private int prev;// 上一页索引
private int next;// 下一页索引
private boolean firstPage;//是否是第一页
private boolean lastPage;//是否是最后一页
private int length = 8;// 显示页面长度
private int slider = 1;// 前后显示页面长度
private List<T> list = new ArrayList<T>();
private String orderBy = ""; // 标准查询有效, 实例: updatedate desc, name asc
private String fields ="";//制定资源的字段
private String where;
private String funcName = "page"; // 设置点击页码调用的js函数名称默认为page在一页有多个分页对象时使用。
private String funcParam = ""; // 函数的附加参数,第三个参数值。
private String message = ""; // 设置提示消息显示在“共n条”之后
public Page() {
this.pageSize = pageSize;
}
/**
* 构造方法
* @param request 传递 repage 参数,来记住页码
* @param response 用于设置 Cookie记住页码
*/
public Page(HttpServletRequest request, HttpServletResponse response){
//this(request, response,Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)));
}
/**
* 构造方法
* @param request 传递 repage 参数,来记住页码
* @param response 用于设置 Cookie记住页码
*
*/
public Page(HttpServletRequest request, HttpServletResponse response,Class clazz){
this(request, response,clazz.getSimpleName(),Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)));
}
public Page(HttpServletRequest request, HttpServletResponse response,int defaultPageSize){
this(request, response,"",Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)));
}
public Page(HttpServletRequest request, HttpServletResponse response,String className, int defaultPageSize){
try {
// 设置页码参数传递repage参数来记住页码
String no = request.getParameter("pageNo");
if (StringUtils.isNotBlank(no)) {
if (StringUtils.isNumeric(no)){
CookieUtil.addCookie(response, "pageNo", no);
this.setPageNo(Integer.parseInt(no));
}else if (request.getParameter("repage")!=null){
no = CookieUtil.getValue(request, "pageNo");
if (StringUtils.isNumeric(no)){
this.setPageNo(Integer.parseInt(no));
}
}
}
// 设置页面大小参数传递repage参数来记住页码大小
String size = request.getParameter("pageSize");
if (StringUtils.isNotBlank(size)) {
if (StringUtils.isNumeric(size) || size.equals("-1")){
CookieUtil.addCookie(response, "pageSize", size);
this.setPageSize(Integer.parseInt(size));
} else if (request.getParameter("repage")!=null){
size = CookieUtil.getValue(request, "pageSize");
if (StringUtils.isNumeric(size)){
this.setPageSize(Integer.parseInt(size));
}
}
} else {
this.pageSize = defaultPageSize;
}
//超出每页最大显示条数,取限制的最大条数
if(this.pageSize > Constants.MAX_PAGE_SIZE){
this.pageSize = Constants.MAX_PAGE_SIZE;
}
String fields = request.getParameter("fields");
if (StringUtils.isNotBlank(fields)){
fields=getFiledsSql(className, fields);
this.setFields(fields);
}
// 设置排序参数
String orderBy = request.getParameter("orderBy");
if (StringUtils.isNotBlank(orderBy)){
orderBy=getOrderBySql(className, orderBy);
this.setOrderBy(orderBy);
}
this.count=Integer.valueOf(Configurations.getIntProperty("page.count", -1));
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @Title: getWhere
* @Description: TODO(抽取where查询条件)
* @param @param request
* @param @return 入参
* @return String 返回类型
* @author darnell
* @throws
* @date 2016年8月17日 上午9:28:21
* @version V1.0
*/
private String getWhere(HttpServletRequest request) {
Map<String, String[]> requestMap = request.getParameterMap();
StringBuilder whereBuilder = new StringBuilder(512);
for(String paramName : request.getParameterMap().keySet()) {
if (paramName.startsWith("search")) {
whereBuilder.append(paramName.substring("search_".length()))
.append("=").append(requestMap.get(paramName)[0]).append(" and ");
}
}
if (whereBuilder.length() > 0) {
whereBuilder.delete(whereBuilder.lastIndexOf(" and "), whereBuilder.length());
}
return whereBuilder.toString();
}
/**
* 构造方法
* @param pageNo 当前页码
* @param pageSize 分页大小
*/
public Page(int pageNo, int pageSize) {
this(pageNo, pageSize, 0);
}
/**
* 构造方法
* @param pageNo 当前页码
* @param pageSize 分页大小
* @param count 数据条数
*/
public Page(int pageNo, int pageSize, long count) {
this(pageNo, pageSize, count, new ArrayList<T>());
}
/**
* 构造方法
* @param pageNo 当前页码
* @param pageSize 分页大小
* @param count 数据条数
* @param list 本页数据对象列表
*/
public Page(int pageNo, int pageSize, long count, List<T> list) {
this.setCount(count);
this.setPageNo(pageNo);
this.pageSize = pageSize;
this.list = list;
}
/**
* 初始化参数
*/
public void initialize(){
//1
this.first = 1;
this.last = (int)(count / (this.pageSize < 1 ? 20 : this.pageSize) + first - 1);
if (this.count % this.pageSize != 0 || this.last == 0) {
this.last++;
}
if (this.last < this.first) {
this.last = this.first;
}
if (this.pageNo <= 1) {
this.pageNo = this.first;
this.firstPage=true;
}
if (this.pageNo >= this.last) {
this.pageNo = this.last;
this.lastPage=true;
}
if (this.pageNo < this.last - 1) {
this.next = this.pageNo + 1;
} else {
this.next = this.last;
}
if (this.pageNo > 1) {
this.prev = this.pageNo - 1;
} else {
this.prev = this.first;
}
//2
if (this.pageNo < this.first) {// 如果当前页小于首页
this.pageNo = this.first;
}
if (this.pageNo > this.last) {// 如果当前页大于尾页
this.pageNo = this.last;
}
}
/**
* 默认输出当前分页标签
* <div class="page">${page}</div>
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (pageNo == first) {// 如果是首页
sb.append("<li class=\"disabled\"><a href=\"javascript:\">&#171; 上一页</a></li>\n");
} else {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+prev+","+pageSize+",'"+funcParam+"');\">&#171; 上一页</a></li>\n");
}
int begin = pageNo - (length / 2);
if (begin < first) {
begin = first;
}
int end = begin + length - 1;
if (end >= last) {
end = last;
begin = end - length + 1;
if (begin < first) {
begin = first;
}
}
if (begin > first) {
int i = 0;
for (i = first; i < first + slider && i < begin; i++) {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+i+","+pageSize+",'"+funcParam+"');\">"
+ (i + 1 - first) + "</a></li>\n");
}
if (i < begin) {
sb.append("<li class=\"disabled\"><a href=\"javascript:\">...</a></li>\n");
}
}
for (int i = begin; i <= end; i++) {
if (i == pageNo) {
sb.append("<li class=\"active\"><a href=\"javascript:\">" + (i + 1 - first)
+ "</a></li>\n");
} else {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+i+","+pageSize+",'"+funcParam+"');\">"
+ (i + 1 - first) + "</a></li>\n");
}
}
if (last - end > slider) {
sb.append("<li class=\"disabled\"><a href=\"javascript:\">...</a></li>\n");
end = last - slider;
}
for (int i = end + 1; i <= last; i++) {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+i+","+pageSize+",'"+funcParam+"');\">"
+ (i + 1 - first) + "</a></li>\n");
}
if (pageNo == last) {
sb.append("<li class=\"disabled\"><a href=\"javascript:\">下一页 &#187;</a></li>\n");
} else {
sb.append("<li><a href=\"javascript:\" onclick=\""+funcName+"("+next+","+pageSize+",'"+funcParam+"');\">"
+ "下一页 &#187;</a></li>\n");
}
sb.append("<li class=\"disabled controls\"><a href=\"javascript:\">当前 ");
sb.append("<input type=\"text\" value=\""+pageNo+"\" onkeypress=\"var e=window.event||this;var c=e.keyCode||e.which;if(c==13)");
sb.append(funcName+"(this.value,"+pageSize+",'"+funcParam+"');\" onclick=\"this.select();\"/> / ");
sb.append("<input type=\"text\" value=\""+pageSize+"\" onkeypress=\"var e=window.event||this;var c=e.keyCode||e.which;if(c==13)");
sb.append(funcName+"("+pageNo+",this.value,'"+funcParam+"');\" onclick=\"this.select();\"/> 条,");
sb.append("" + count + ""+(message!=null?message:"")+"</a></li>\n");
sb.insert(0,"<ul>\n").append("</ul>\n");
sb.append("<div style=\"clear:both;\"></div>");
// sb.insert(0,"<div class=\"page\">\n").append("</div>\n");
return sb.toString();
}
/**
* 获取分页HTML代码
* @return
*/
@JsonIgnore
public String getHtml(){
return toString();
}
// public static void main(String[] args) {
// Page<String> p = new Page<String>(3, 3);
// System.out.println(p);
// System.out.println("首页:"+p.getFirst());
// System.out.println("尾页:"+p.getLast());
// System.out.println("上页:"+p.getPrev());
// System.out.println("下页:"+p.getNext());
// }
/**
* 获取设置总数
* @return
*/
public long getCount() {
return count;
}
/**
* 设置数据总数
* @param count
*/
public void setCount(long count) {
this.count = count;
if (pageSize >= count){
pageNo = 1;
}
}
/**
* 获取当前页码
* @return
*/
public int getPageNo() {
return pageNo;
}
/**
* 设置当前页码
* @param pageNo
*/
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
/**
* 获取页面大小
* @return
*/
public int getPageSize() {
return pageSize;
}
/**
* 设置页面大小最大500
* @param pageSize
*/
public void setPageSize(int pageSize) {
if (pageSize == -1 || pageSize > 0 ) {
this.pageSize = pageSize;
} else {
this.pageSize = Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30));
}
}
/**
* 首页索引
* @return
*/
@JsonIgnore
public int getFirst() {
return first;
}
/**
* 尾页索引
* @return
*/
public int getLast() {
return last;
}
/**
* 获取页面总数
* @return getLast();
*/
@JsonIgnore
public int getTotalPage() {
return getLast();
}
/**
* 是否为第一页
* @return
*/
@JsonIgnore
public boolean isFirstPage() {
return firstPage;
}
/**
* 是否为最后一页
* @return
*/
@JsonIgnore
public boolean isLastPage() {
return lastPage;
}
/**
* @return where
*/
@JsonIgnore
public String getWhere() {
return where;
}
/**
* @param where 要设置的 where
*/
public void setWhere(String where) {
this.where = where;
}
/**
* 上一页索引值
* @return
*/
@JsonIgnore
public int getPrev() {
if (isFirstPage()) {
return pageNo;
} else {
return pageNo - 1;
}
}
/**
* 下一页索引值
* @return
*/
@JsonIgnore
public int getNext() {
if (isLastPage()) {
return pageNo;
} else {
return pageNo + 1;
}
}
/**
* 获取本页数据对象列表
* @return List<T>
*/
public List<T> getList() {
return list;
}
/**
* 设置本页数据对象列表
* @param list
*/
public Page<T> setList(List<T> list) {
this.list = list;
initialize();
return this;
}
/**
* 获取查询排序字符串
* @return
*/
@JsonIgnore
public String getOrderBy() {
// SQL过滤防止注入
String reg = "(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|"
+ "(\\b(select|update|and|or|delete|insert|trancate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute)\\b)";
Pattern sqlPattern = Pattern.compile(reg, Pattern.CASE_INSENSITIVE);
if (sqlPattern.matcher(orderBy).find()) {
return "";
}
return orderBy;
}
/**
* 设置查询排序,标准查询有效, 实例: updatedate desc, name asc
*/
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
/**
* @return fields 字段属性查询,拼接用,分隔
*/
@JsonIgnore
public String getFields() {
return fields;
}
/**
* @param fields 要设置的 fields
*/
public void setFields(String fields) {
this.fields = fields;
}
/**
* 获取点击页码调用的js函数名称
* function ${page.funcName}(pageNo){location="${ctx}/list-${category.id}${urlSuffix}?pageNo="+i;}
* @return
*/
@JsonIgnore
public String getFuncName() {
return funcName;
}
/**
* 设置点击页码调用的js函数名称默认为page在一页有多个分页对象时使用。
* @param funcName 默认为page
*/
public void setFuncName(String funcName) {
this.funcName = funcName;
}
/**
* 获取分页函数的附加参数
* @return
*/
@JsonIgnore
public String getFuncParam() {
return funcParam;
}
/**
* 设置分页函数的附加参数
* @return
*/
public void setFuncParam(String funcParam) {
this.funcParam = funcParam;
}
/**
* 设置提示消息显示在“共n条”之后
* @param message
*/
public void setMessage(String message) {
this.message = message;
}
/**
* 分页是否有效
* @return this.pageSize==-1
*/
@JsonIgnore
public boolean isDisabled() {
return this.pageSize==-1;
}
/**
* 是否进行总数统计
* @return this.count==-1
*/
@JsonIgnore
public boolean isNotCount() {
return this.count==-1;
}
/**
* 获取 Hibernate FirstResult
*/
@JsonIgnore
public int getFirstResult(){
int firstResult = (getPageNo() - 1) * getPageSize();
if (firstResult >= getCount()) {
firstResult = 0;
}
return firstResult;
}
/**
* 获取 Hibernate MaxResults
*/
@JsonIgnore
public int getMaxResults(){
return getPageSize();
}
/**
* @Title: getFiledsSql
* @Description: 将fields的属性名称替换为字段名称
* @param @param mapName
* @param @param fileds
* @param @return
* @param @throws Exception
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@JsonIgnore
public String getFiledsSql(String mapName,String fileds) throws Exception{
String[] fieldsColoumn=null;
String orderByStr="";
//所有字段名
List<String> columnList=new ArrayList<String>();
//所有属性名
List<String> propertyList=new ArrayList<String>();
//属性名称为key字段名称为value
Map<String, String> columnMap=new HashMap<String, String>();
if(!StringUtil.isBlank(fileds)){
//解析Fileds的字段/属性名称
fieldsColoumn=fileds.split(",");
//从resultMap中获取字段名称和属性名称
if(fieldsColoumn != null){
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
ResultMap map= sqlSessionFactory.getConfiguration().getResultMap(mapName+"Map");
List<ResultMapping> mapping= map.getResultMappings();
for(ResultMapping mapp:mapping){
columnList.add(mapp.getColumn().toLowerCase());
propertyList.add(mapp.getProperty());
columnMap.put(mapp.getProperty(), mapp.getColumn());
}
}
if(fieldsColoumn != null){
fileds="";
for (String column : fieldsColoumn) {
if(!StringUtil.isBlank(column)){
column=column.trim();
if(columnList.contains(column.toLowerCase())){
fileds+=","+column;
}else if(propertyList.contains(column)){
fileds+=","+columnMap.get(column).toString();
}
}
}
if(!StringUtil.isBlank(fileds)){
fileds=fileds.substring(1);
}
}
}
return fileds;
}
/**
* @Title: getOrderBySql
* @Description: 将orderBy的属性名称替换为字段名称
* @param @param mapName
* @param @param orderBy
* @param @return
* @param @throws Exception
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@JsonIgnore
public static String getOrderBySql(String mapName,String orderBy) throws Exception{
String[] orderByColoumn=null;
//所有字段名
List<String> columnList=new ArrayList<String>();
//所有属性名
List<String> propertyList=new ArrayList<String>();
Map<String, String> columnMap=new HashMap<String, String>();
if(!StringUtil.isBlank(orderBy)){
//解析orderBy的字段/属性名称
orderByColoumn=orderBy.split(",");
//从resultMap中获取字段名称和属性名称
if(orderByColoumn != null){
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
ResultMap map= sqlSessionFactory.getConfiguration().getResultMap(mapName+"Map");
List<ResultMapping> mapping= map.getResultMappings();
for(ResultMapping mapp:mapping){
columnList.add(mapp.getColumn().toLowerCase());
propertyList.add(mapp.getProperty());
columnMap.put(mapp.getProperty(), mapp.getColumn());
}
}
if(orderByColoumn != null){
orderBy="";
for (String column : orderByColoumn) {
if(!StringUtil.isBlank(column)){
if(columnList.contains(replaceOrderBy(column))){
orderBy+=","+column;
}else if(propertyList.contains(replaceOrderBy(column))){
//如果是实体类名字则获取对应数据库名字+排序方式
orderBy+=","+columnMap.get(replaceOrderBy(column)).toString()
+column.replace(replaceOrderBy(column), "");
}
}
}
if(!StringUtil.isBlank(orderBy)){
orderBy=orderBy.substring(1);
}
}
}
return orderBy;
}
/**
* @Title: replaceOrderBy
* @Description: 去掉orderBy中的desc和asc
* @param @param str
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public static String replaceOrderBy(String str){
if(!StringUtil.isBlank(str)){
str=str.trim();
str=str.replace(" asc","");
str=str.replace(" ASC","");
str=str.replace(" DESC","");
str=str.replace(" desc","");
str=str.trim();
}
return str;
}
}

View File

@@ -0,0 +1,220 @@
/**
*@Title: ServicesRequestLog.java
*@Package com.nis.domain
*@Description TODO
*@author dell
*@date 2016年10月13日 下午3:39:14
*@version 版本号
*/
package com.nis.domain;
import java.io.Serializable;
import java.util.Date;
import com.nis.util.JsonMapper;
/**
* @ClassName: ServicesRequestLog.java
* @Description: TODO
* @author (dell)
* @date 2016年10月13日 下午3:39:14
* @version V1.0
*/
public class ServicesRequestLog implements Serializable {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = 3374409440640840339L;
private Long id;
private String operator;
private String version;
private Integer opAction;
private Date opTime;
private String requestContent;
private Date requestTime;
private Long consumerTime;
private String requestIp;
private Integer businessCode;
private String exceptionInfo;
private String serverIp;
/**
* serverIp
* @return serverIp
*/
public String getServerIp() {
return serverIp;
}
/**
* @param serverIp the serverIp to set
*/
public void setServerIp(String serverIp) {
this.serverIp = serverIp;
}
/**
* businessCode
* @return businessCode
*/
public Integer getBusinessCode() {
return businessCode;
}
/**
* @param businessCode the businessCode to set
*/
public void setBusinessCode(Integer businessCode) {
this.businessCode = businessCode;
}
/**
* id
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* operator
* @return operator
*/
public String getOperator() {
return operator;
}
/**
* @param operator the operator to set
*/
public void setOperator(String operator) {
this.operator = operator;
}
/**
* version
* @return version
*/
public String getVersion() {
return version;
}
/**
* @param version the version to set
*/
public void setVersion(String version) {
this.version = version;
}
/**
* opAction
* @return opAction
*/
public Integer getOpAction() {
return opAction;
}
/**
* @param opAction the opAction to set
*/
public void setOpAction(Integer opAction) {
this.opAction = opAction;
}
/**
* opTime
* @return opTime
*/
public Date getOpTime() {
return opTime;
}
/**
* @param opTime the opTime to set
*/
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
/**
* requestContent
* @return requestContent
*/
public String getRequestContent() {
return requestContent;
}
/**
* @param requestContent the requestContent to set
*/
public void setRequestContent(String requestContent) {
this.requestContent = requestContent;
}
/**
* @param requestContent the requestContent to set
*/
public void setRequestContent(Object requestContent) {
this.requestContent = JsonMapper.getInstance().toJsonString(requestContent);
}
/**
* requestTime
* @return requestTime
*/
public Date getRequestTime() {
return requestTime;
}
/**
* @param requestTime the requestTime to set
*/
public void setRequestTime(Date requestTime) {
this.requestTime = requestTime;
}
/**
* consumerTime
* @return consumerTime
*/
public Long getConsumerTime() {
return consumerTime;
}
/**
* @param consumerTime the consumerTime to set
*/
public void setConsumerTime(Long consumerTime) {
this.consumerTime = consumerTime;
}
/**
* requestIp
* @return requestIp
*/
public String getRequestIp() {
return requestIp;
}
/**
* @param requestIp the requestIp to set
*/
public void setRequestIp(String requestIp) {
this.requestIp = requestIp;
}
/**
* exceptionInfo
* @return exceptionInfo
*/
public String getExceptionInfo() {
return exceptionInfo;
}
/**
* @param exceptionInfo the exceptionInfo to set
*/
public void setExceptionInfo(String exceptionInfo) {
this.exceptionInfo = exceptionInfo;
}
}

View File

@@ -0,0 +1,145 @@
package com.nis.domain;
public class SrcIp {
private Integer seqId;
private Integer ipStartAddr;
private Integer ipEndAddr;
private Integer ipAddrRange;
private String ipStartString;
private String ipEndString;
private Integer port;
private Long ispId;
private Long areaId;
private Integer flag;
private String description;
private Integer yl1;
private String yl2;
private String searchIp;
public String getSearchIp() {
return searchIp;
}
public void setSearchIp(String searchIp) {
this.searchIp = searchIp;
}
public Integer getSeqId() {
return seqId;
}
public void setSeqId(Integer seqId) {
this.seqId = seqId;
}
public Integer getIpStartAddr() {
return ipStartAddr;
}
public void setIpStartAddr(Integer ipStartAddr) {
this.ipStartAddr = ipStartAddr;
}
public Integer getIpEndAddr() {
return ipEndAddr;
}
public void setIpEndAddr(Integer ipEndAddr) {
this.ipEndAddr = ipEndAddr;
}
public Integer getIpAddrRange() {
return ipAddrRange;
}
public void setIpAddrRange(Integer ipAddrRange) {
this.ipAddrRange = ipAddrRange;
}
public String getIpStartString() {
return ipStartString;
}
public void setIpStartString(String ipStartString) {
this.ipStartString = ipStartString == null ? null : ipStartString.trim();
}
public String getIpEndString() {
return ipEndString;
}
public void setIpEndString(String ipEndString) {
this.ipEndString = ipEndString == null ? null : ipEndString.trim();
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public Long getIspId() {
return ispId;
}
public void setIspId(Long ispId) {
this.ispId = ispId;
}
public Long getAreaId() {
return areaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public Integer getFlag() {
return flag;
}
public void setFlag(Integer flag) {
this.flag = flag;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public Integer getYl1() {
return yl1;
}
public void setYl1(Integer yl1) {
this.yl1 = yl1;
}
public String getYl2() {
return yl2;
}
public void setYl2(String yl2) {
this.yl2 = yl2 == null ? null : yl2.trim();
}
}

View File

@@ -0,0 +1,203 @@
/**
* @Title: StatLogEntity.java
* @Package com.nis.domain
* @Description: TODO(用一句话描述该文件做什么)
* @author ddm
* @date 2016年9月13日 上午10:49:01
* @version V1.0
*/
package com.nis.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Maps;
import com.nis.util.Configurations;
import com.nis.util.JsonDateSerializer;
import com.wordnik.swagger.annotations.ApiModelProperty;
/**
* @ClassName: StatLogEntity
* @Description: TODO(日志报表公共实体部分)
* @author (ddm)
* @date 2016年9月1日 上午10:16:54
* @version V1.0
*/
public abstract class StatLogEntity<T> implements Serializable {
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = -5210683756718456730L;
@ApiModelProperty(value="私有标签", required=true)
protected Integer service;
@ApiModelProperty(value="生效系统", required=true)
protected Integer activeSys;
@ApiModelProperty(value="A版总计", required=true)
protected Long asum;
@ApiModelProperty(value="B版总计", required=true)
protected Long bsum;
@ApiModelProperty(value="全A+单B数量", required=true)
protected Long absum;
@ApiModelProperty(value="统计时间", required=true)
protected Date statTime;
protected String searchStatStartTime;
protected String searchStatEndTime;
protected String searchService;
protected String searchStatActiveSys;
@JsonSerialize(using=JsonDateSerializer.class)
public Date getStatTime() {
return statTime;
}
public void setStatTime(Date statTime) {
this.statTime = statTime;
}
public Integer getActiveSys() {
return activeSys;
}
public void setActiveSys(Integer activeSys) {
this.activeSys = activeSys;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Long getAbsum() {
return absum;
}
public Long getBsum() {
return bsum;
}
public void setAbsum(Long absum) {
this.absum = absum;
}
public void setBsum(Long bsum) {
this.bsum = bsum;
}
public Long getAsum() {
return asum;
}
public void setAsum(Long asum) {
this.asum = asum;
}
@JsonIgnore
public String getSearchStatStartTime() {
return searchStatStartTime;
}
public void setSearchStatStartTime(String searchStatStartTime) {
this.searchStatStartTime = searchStatStartTime;
}
@JsonIgnore
public String getSearchStatEndTime() {
return searchStatEndTime;
}
public void setSearchStatEndTime(String searchStatEndTime) {
this.searchStatEndTime = searchStatEndTime;
}
@JsonIgnore
public String getSearchService() {
return searchService;
}
public void setSearchService(String searchService) {
this.searchService = searchService;
}
@JsonIgnore
public String getSearchStatActiveSys() {
return searchStatActiveSys;
}
public void setSearchStatActiveSys(String searchStatActiveSys) {
this.searchStatActiveSys = searchStatActiveSys;
}
/**
* 当前实体分页对象
*/
protected Page<T> page;
/**
* 自定义SQLSQL标识SQL内容
*/
protected Map<String, String> sqlMap;
/**
* @Title:
* @Description: TODO
* @param 入参
*/
public StatLogEntity() {
super();
}
@JsonIgnore
@XmlTransient
public Page<T> getPage() {
if (page == null){
page = new Page<T>();
}
return page;
}
public Page<T> setPage(Page<T> page) {
this.page = page;
return page;
}
@JsonIgnore
@XmlTransient
public Map<String, String> getSqlMap() {
if (sqlMap == null){
sqlMap = Maps.newHashMap();
}
return sqlMap;
}
public void setSqlMap(Map<String, String> sqlMap) {
this.sqlMap = sqlMap;
}
/**
* 获取数据库名称
*/
@JsonIgnore
public String getDbName(){
return Configurations.getStringProperty("jdbc.type", "mysql");
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
}

View File

@@ -0,0 +1,80 @@
package com.nis.domain;
public class SysArea extends TreeEntity<SysArea>{
private static final long serialVersionUID = -6425455761476080303L;
private String code;
private String type;
private String remarks;
private double longitude;
private double latitude;
private Integer delFlag;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks == null ? null : remarks.trim();
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
@Override
public SysArea getParent() {
return parent;
}
@Override
public void setParent(SysArea parent) {
this.parent = parent;
}
}

View File

@@ -0,0 +1,76 @@
package com.nis.domain;
import java.io.Serializable;
public class SysDataDictionaryItem implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String itemCode;
private String itemValue;
private String itemDesc;
private int itemSort;
private SysDataDictionaryName sysDataDictionaryName;
private int dictionaryId;
public int getItemSort() {
return itemSort;
}
public void setItemSort(int itemSort) {
this.itemSort = itemSort;
}
private int status;
private int type;
public Long getId() {
return id;
}
public String getItemCode() {
return itemCode;
}
public String getItemValue() {
return itemValue;
}
public String getItemDesc() {
return itemDesc;
}
public int getStatus() {
return status;
}
public int getType() {
return type;
}
public SysDataDictionaryName getSysDataDictionaryName() {
return sysDataDictionaryName;
}
public void setId(Long id) {
this.id = id;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public void setItemValue(String itemValue) {
this.itemValue = itemValue;
}
public void setItemDesc(String itemDesc) {
this.itemDesc = itemDesc;
}
public void setStatus(int status) {
this.status = status;
}
public void setType(int type) {
this.type = type;
}
public void setSysDataDictionaryName(SysDataDictionaryName sysDataDictionaryName) {
this.sysDataDictionaryName = sysDataDictionaryName;
}
public int getDictionaryId() {
return dictionaryId;
}
public void setDictionaryId(int dictionaryId) {
this.dictionaryId = dictionaryId;
}
}

View File

@@ -0,0 +1,116 @@
package com.nis.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
public class SysDataDictionaryName extends BaseEntity<SysDataDictionaryName> {
private static final long serialVersionUID = 8475518325068404528L;
private String moduleName;
private String mark;
private String remark;
private String revision;
private Date createTime;
private Date modifyTime;
private Integer status;
private List<SysDataDictionaryItem> dictItemList = Lists.newArrayList();
private Date beginDate; // 开始日期
private Date endDate; // 结束日期
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName == null ? null : moduleName.trim();
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark == null ? null : mark.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public String getRevision() {
return revision;
}
public void setRevision(String revision) {
this.revision = revision == null ? null : revision.trim();
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public List<SysDataDictionaryItem> getDictItemList() {
return dictItemList;
}
public void setDictItemList(List<SysDataDictionaryItem> dictItemList) {
this.dictItemList = dictItemList;
}
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}

View File

@@ -0,0 +1,180 @@
package com.nis.domain;
import java.util.Date;
import java.util.Map;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.nis.util.StringUtils;
public class SysLog extends BaseEntity<SysLog>{
private static final long serialVersionUID = -926412650391800311L;
private Integer type;//日志类型运行日志1000-系统登录 1001-系统退出、操作2000-添加 2001-删除 2002-修改 2003-查询) \404 未知操作
private String title;// 日志标题
private Date createDate;//创建日期
private String remoteAddr;// 操作用户的IP地址
private String userAgent;// 操作用户代理信息
private String requestUri;// 操作的URI
private String method;// 操作的方式
private Integer state;//0-失败 1-成功
private String params; // 操作提交的数据
private String exception; // 异常信息
private Long consumerTime;//消费时间
public Long getConsumerTime() {
return consumerTime;
}
public void setConsumerTime(Long consumerTime) {
this.consumerTime = consumerTime;
}
private Date beginDate; // 开始日期
private Date endDate; // 结束日期
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getRemoteAddr() {
return remoteAddr;
}
public void setRemoteAddr(String remoteAddr) {
this.remoteAddr = remoteAddr == null ? null : remoteAddr.trim();
}
public String getUserAgent() {
return userAgent;
}
public void setUserAgent(String userAgent) {
this.userAgent = userAgent == null ? null : userAgent.trim();
}
public String getRequestUri() {
return requestUri;
}
public void setRequestUri(String requestUri) {
this.requestUri = requestUri == null ? null : requestUri.trim();
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method == null ? null : method.trim();
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getException() {
return exception;
}
public void setException(String exception) {
this.exception = exception;
}
private String createBy;// 创建者
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
/**
* 设置请求参数
* @param paramMap
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setParams(Map paramMap){
if (paramMap == null){
return;
}
StringBuilder params = new StringBuilder();
for (Map.Entry<String, String[]> param : ((Map<String, String[]>)paramMap).entrySet()){
params.append(("".equals(params.toString()) ? "" : "&") + param.getKey() + "=");
String paramValue = (param.getValue() != null && param.getValue().length > 0 ? param.getValue()[0] : "");
params.append(StringUtils.abbr(StringUtils.endsWithIgnoreCase(param.getKey(), "password") ? "" : paramValue, 100));
}
this.params = params.toString();
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
}

View File

@@ -0,0 +1,253 @@
package com.nis.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class SysMenu extends BaseEntity<SysMenu>{
private static final long serialVersionUID = 8586837252075033023L;
private SysMenu parent; // 父级菜单
private Long parentId;
private String parentIds;
private String name;
private Integer sort;
private String href;
private String target;
private String icon;
private Integer isShow;
private String permission;
private SysUser createBy; // 创建者
private Date createDate;
private SysUser updateBy;
private Date updateDate;
private String remarks;
private Integer delFlag;
private Integer quickAction;
private String menuBg;
private List<SysMenu> children = new ArrayList<SysMenu>();
public SysMenu(){
super();
this.sort = 30;
this.isShow = 1;
}
public SysMenu(Long id){
super(id);
}
public List<SysMenu> getChildren() {
return children;
}
public void setChildren(List<SysMenu> children) {
this.children = children;
}
public Long getParentId() {
return (parent != null && parent.getId() != null) ? parent.getId() : 0 ;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getParentIds() {
return parentIds;
}
public void setParentIds(String parentIds) {
this.parentIds = parentIds == null ? null : parentIds.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href == null ? null : href.trim();
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target == null ? null : target.trim();
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon == null ? null : icon.trim();
}
public String getMenuBg() {
return menuBg;
}
public void setMenuBg(String menuBg) {
this.menuBg = menuBg;
}
public Integer getIsShow() {
return isShow;
}
public void setIsShow(Integer isShow) {
this.isShow = isShow;
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission == null ? null : permission.trim();
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public SysUser getCreateBy() {
return createBy;
}
public void setCreateBy(SysUser createBy) {
this.createBy = createBy;
}
public SysUser getUpdateBy() {
return updateBy;
}
public void setUpdateBy(SysUser updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks == null ? null : remarks.trim();
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public Integer getQuickAction() {
return quickAction;
}
public void setQuickAction(Integer quickAction) {
this.quickAction = quickAction;
}
@JsonIgnore
public static void sortList(List<SysMenu> list, List<SysMenu> sourcelist, Long parentId, boolean cascade){
for (int i=0; i<sourcelist.size(); i++){
SysMenu menu = sourcelist.get(i);
if (menu.getParent()!=null && menu.getParent().getId()!=null
&& menu.getParent().getId().equals(parentId)){
list.add(menu);
if (cascade){
// 判断是否还有子节点, 有则继续获取子节点
for (int j=0; j<sourcelist.size(); j++){
SysMenu child = sourcelist.get(j);
if (child.getParent()!=null && child.getParent().getId()!=null
&& child.getParent().getId().equals(menu.getId())){
sortList(list, sourcelist, menu.getId(), true);
break;
}
}
}
}
}
}
@JsonIgnore
public static Long getRootId(){
return 1l;
}
@JsonBackReference
public SysMenu getParent() {
return parent;
}
public void setParent(SysMenu parent) {
this.parent = parent;
}
}

View File

@@ -0,0 +1,221 @@
package com.nis.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class SysOffice extends TreeEntity<SysOffice> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 7057026197597361766L;
private SysArea area;
private String code;
private Integer type;// 机构类型1公司2部门3小组
private Integer grade;// 机构等级1一级2二级3三级4四级
private Integer jobType;//部门职责分类
private String address;
private String zipCode;
private String master;
private String phone;
private String fax;
private String email;
private Integer useable;
private SysUser primaryPerson;
private SysUser deputyPerson;
private String remarks;
private Integer delFlag;
private Date createTime;
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
private List<String> childDeptList;//快速添加子部门
public SysOffice(){
super();
this.type = 2;
}
public SysOffice(Long id){
super(id);
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getGrade() {
return grade;
}
public void setGrade(Integer grade) {
this.grade = grade;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode == null ? null : zipCode.trim();
}
public String getMaster() {
return master;
}
public void setMaster(String master) {
this.master = master == null ? null : master.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax == null ? null : fax.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public Integer getUseable() {
return useable;
}
public void setUseable(Integer useable) {
this.useable = useable;
}
public SysOffice getParent() {
return parent;
}
public void setParent(SysOffice parent) {
this.parent = parent;
}
public SysArea getArea() {
return area;
}
public void setArea(SysArea area) {
this.area = area;
}
public SysUser getPrimaryPerson() {
return primaryPerson;
}
public void setPrimaryPerson(SysUser primaryPerson) {
this.primaryPerson = primaryPerson;
}
public SysUser getDeputyPerson() {
return deputyPerson;
}
public void setDeputyPerson(SysUser deputyPerson) {
this.deputyPerson = deputyPerson;
}
public List<String> getChildDeptList() {
return childDeptList;
}
public void setChildDeptList(List<String> childDeptList) {
this.childDeptList = childDeptList;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks == null ? null : remarks.trim();
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public Integer getJobType() {
return jobType;
}
public void setJobType(Integer jobType) {
this.jobType = jobType;
}
}

View File

@@ -0,0 +1,132 @@
package com.nis.domain;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Lists;
public class SysRole extends BaseEntity<SysRole>{
private static final long serialVersionUID = -5388120268433030734L;
private String name;
public String getOldName() {
return oldName;
}
public void setOldName(String oldName) {
this.oldName = oldName;
}
private String oldName; // 原角色名称
private String roleType;
private Integer dataScope;
private String remark;
private List<SysMenu> menuList = Lists.newArrayList(); // 拥有菜单列表
public List<SysMenu> getMenuList() {
return menuList;
}
public void setMenuList(List<SysMenu> menuList) {
this.menuList = menuList;
}
public Integer getDataScope() {
return dataScope;
}
public void setDataScope(Integer dataScope) {
this.dataScope = dataScope;
}
private Integer status;
private Date createTime;
// 数据范围1所有数据2所在公司及以下数据3所在公司数据4所在部门及以下数据5所在部门数据8所在单位及以下数据9所在单位数据
public static final Integer DATA_SCOPE_ALL = 1;
public static final Integer DATA_SCOPE_COMPANY_AND_CHILD = 2;
public static final Integer DATA_SCOPE_COMPANY = 3;
public static final Integer DATA_SCOPE_OFFICE_AND_CHILD = 4;
public static final Integer DATA_SCOPE_OFFICE = 5;
public static final Integer DATA_SCOPE_ENTITY_AND_CHILD = 6;
public static final Integer DATA_SCOPE_ENTITY = 7;
public String getRoleType() {
return roleType;
}
public void setRoleType(String roleType) {
this.roleType = roleType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public List<Long> getMenuIdList() {
List<Long> menuIdList = Lists.newArrayList();
for (SysMenu menu : menuList) {
menuIdList.add(menu.getId());
}
return menuIdList;
}
public void setMenuIdList(List<String> menuIdList) {
menuList = Lists.newArrayList();
for (String menuId : menuIdList) {
SysMenu menu = new SysMenu();
menu.setId(Long.parseLong(menuId));
menuList.add(menu);
}
}
public String getMenuIds() {
return StringUtils.join(getMenuIdList(), ",");
}
public void setMenuIds(String menuIds) {
menuList = Lists.newArrayList();
if (menuIds != null){
String[] ids = StringUtils.split(menuIds, ",");
setMenuIdList(Lists.newArrayList(ids));
}
}
}

View File

@@ -0,0 +1,243 @@
package com.nis.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.nis.util.Collections3;
import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.util.excel.ExcelField;
import com.nis.util.excel.fieldtype.RoleListType;
public class SysUser extends BaseEntity<SysUser> {
private static final long serialVersionUID = -4871709358302801032L;
private String loginId;
private String photo; // 头像
private String name;
private String email;//电子邮箱
private String password;
private String newPassword; // 新密码
private SysRole role;
private String oldLoginId;// 原登录名
private Date createTime;
private Integer status;
private Integer identity;//用户身份标识 1-信访办 0-办理人员
private List<SysRole> userRoleList = new ArrayList<SysRole>();
private SysOffice company;//所属公司
private SysOffice entity;//归属单位
private SysOffice office;//用户所在部门
public SysUser() {
super();
}
public SysUser(Long id, String loginId) {
super();
this.id = id;
this.loginId = loginId;
}
public SysUser(Long id, String loginId, String name, String email,
String password, String oldLoginId, Date createTime, Integer status) {
super();
this.id = id;
this.loginId = loginId;
this.name = name;
this.email = email;
this.password = password;
this.oldLoginId = oldLoginId;
this.createTime = createTime;
this.status = status;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public SysOffice getEntity() {
return entity;
}
public void setEntity(SysOffice entity) {
this.entity = entity;
}
public String getOldLoginId() {
return oldLoginId;
}
public void setOldLoginId(String oldLoginId) {
this.oldLoginId = oldLoginId;
}
@ExcelField(title="姓名", align=2, sort=40)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getStatus() {
return status;
}
public Integer getIdentity() {
return identity;
}
public void setIdentity(Integer identity) {
this.identity = identity;
}
public SysOffice getOffice() {
return office;
}
public void setOffice(SysOffice office) {
this.office = office;
}
public SysOffice getCompany() {
return company;
}
public void setCompany(SysOffice company) {
this.company = company;
}
public SysRole getRole() {
return role;
}
public void setRole(SysRole role) {
this.role = role;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
@ExcelField(title="拥有角色", align=1, sort=800, fieldType=RoleListType.class)
public List<SysRole> getUserRoleList() {
return userRoleList;
}
public void setUserRoleList(List<SysRole> userRoleList) {
this.userRoleList = userRoleList;
}
public void setStatus(Integer status) {
this.status = status;
}
public boolean isAdmin(){
return isAdmin(this.loginId);
}
public static boolean isAdmin(String loginId){
return loginId != null && "admin".equals(loginId);
}
@JsonIgnore
public List<Long> getRoleIdList() {
List<Long> roleIdList = Lists.newArrayList();
for (SysRole role : userRoleList) {
roleIdList.add(role.getId());
}
return roleIdList;
}
public void setRoleIdList(List<Long> roleIdList) {
userRoleList = Lists.newArrayList();
for (Long roleId : roleIdList) {
SysRole role = new SysRole();
role.setId(roleId);
userRoleList.add(role);
}
}
/**
* 用户拥有的角色名称字符串, 多个角色名称用','分隔.
*/
public String getRoleNames() {
return Collections3.extractToString(userRoleList, "name", ",");
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelField(title="创建日期", type=1, align=1, sort=110)
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@ExcelField(title="登录名", align=1, sort=20)
public String getLoginId() {
return loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
@ExcelField(title="邮箱", align=1, sort=50)
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}

View File

@@ -0,0 +1,79 @@
package com.nis.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.nis.util.Reflections;
import com.nis.util.StringUtil;
/**
* 数据Entity类
* @author ThinkGem
* @version 2014-05-16
*/
public abstract class TreeEntity<T> extends BaseEntity<T> {
private static final long serialVersionUID = 1L;
protected T parent; // 父级编号
protected String parentIds; // 所有父级编号
protected String name; // 机构名称
protected Long sort; // 排序
public TreeEntity() {
super();
this.sort = 30L;
}
public TreeEntity(Long id) {
super(id);
}
/**
* 父对象只能通过子类实现父类实现mybatis无法读取
* @return
*/
@JsonBackReference
public abstract T getParent();
/**
* 父对象只能通过子类实现父类实现mybatis无法读取
* @return
*/
public abstract void setParent(T parent);
public String getParentIds() {
return parentIds;
}
public void setParentIds(String parentIds) {
this.parentIds = parentIds;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getSort() {
return sort;
}
public void setSort(Long sort) {
this.sort = sort;
}
public Long getParentId() {
Long id = null;
if (parent != null){
id = (Long)Reflections.getFieldValue(parent, "id");
}
return StringUtil.isEmpty(id) ? 0 : id;
}
}