10 Commits

Author SHA1 Message Date
段冬梅
bb7197f098 20190610之前部署的sql记录 2019-07-03 15:01:25 +08:00
duandongmei
de1eb563a3 时间间隔默认5分钟,日志导出最大条数修改为2万 2019-06-03 17:07:53 +08:00
wangwei
af28efc76d 修复审核通过配置修改成功提示信息bug
Conflicts:
	src/main/java/com/nis/web/controller/configuration/proxy/FileStrategyController.java
2019-05-29 14:01:14 +08:00
wangxin
973f071897 删除无必要的判断 2019-05-28 19:51:46 +08:00
wangxin
e8e948ce7d 修复packet ip address asn切换到ip配置时,没有正确获取到配置属性的bug 2019-05-28 19:51:01 +08:00
wangwei
df9665376f 完善修改配置数据时提示信息问题 2019-05-27 10:17:42 +08:00
wangwei
2858e643ac 修复文件摘要修改功能请求服务接口失败 2019-05-27 10:15:59 +08:00
wangxin
8d2e30b952 Steam三个菜单的form表单当action 为monit的时候ip和账号必选一个 2019-05-23 10:22:24 +08:00
duandongmei
19c8492cc8 热修改功能打开 2019-05-20 15:57:52 +08:00
段冬梅
328f266046 Update README.md 2019-05-20 15:48:57 +08:00
251 changed files with 5239 additions and 58313 deletions

View File

@@ -1,7 +1,3 @@
630上线内容版本
1、统计整合为一个模块儿
2、object-list-group HTTP和代理
3、代理新功能
610功能升级
系统需要支持对 生效中的配置 进行修改的功能;
统计的时间修改为一个月,性能是否可以;

View File

@@ -1,74 +0,0 @@
package com.nis.domain.basics;
import java.io.Serializable;
import java.util.Date;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
/**
* 公共分组实体
*/
public class CommonGroupInfo extends BaseCfg<CommonGroupInfo> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 7931466570918016654L;
private Integer groupId;
@ExcelField(title="group_name",sort=1)
private String groupName;
@ExcelField(title="group_type",dictType="GROUP_TYPE",sort=2)
private Integer groupType;
private Integer serviceGroupId;
@ExcelField(title="desc",sort=4)
private String description;
public Integer getServiceGroupId() {
return serviceGroupId;
}
public void setServiceGroupId(Integer serviceGroupId) {
this.serviceGroupId = serviceGroupId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getEditTime() {
return editTime;
}
public void setEditTime(Date editTime) {
this.editTime = editTime;
}
public Integer getGroupType() {
return groupType;
}
public void setGroupType(Integer groupType) {
this.groupType = groupType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View File

@@ -1,67 +0,0 @@
package com.nis.domain.basics;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.excel.ExcelField;
public class DomainCommCfg extends BaseStringCfg<DomainCommCfg>{
private static final long serialVersionUID = 5117517145731135023L;
private static final String tableName="domain_comm_cfg";
@ExcelField(title="key_word",sort=3)
protected String cfgKeywords;
protected Integer isHexbin;
protected String ratelimit;
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public static String getTablename() {
return tableName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -1,312 +0,0 @@
package com.nis.domain.basics;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
public class IpCommCfg extends BaseCfg<IpCommCfg> {
/**
*
*/
private static final long serialVersionUID = 4218856118489784060L;
/**
* 创建一个新的实例 BaseIpCfg.
*
*/
public IpCommCfg() {
super();
// TODO Auto-generated constructor stub
}
private static final String indexTable="ip_comm_cfg";
/**
* ip类型
*/
@Expose
@SerializedName("ipType")
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=50)
protected Integer ipType;
@ExcelField(title="src_ip_pattern",dictType="IP_PATTERN",sort=51)
protected Integer srcIpPattern;
@ExcelField(title="client_ip",sort=52)
protected String srcIpAddress;
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=53)
protected Integer destIpPattern;
@ExcelField(title="server_ip",sort=54)
protected String destIpAddress;
@ExcelField(title="src_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer srcPortPattern;
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=56)
protected Integer destPortPattern;
@ExcelField(title="client_port",sort=55)
protected String srcPort;
@ExcelField(title="server_port",sort=57)
protected String destPort;
protected Integer dnsStrategyId;
@ExcelField(title="ir_type",dictType="IR_TYPE",sort=58)
protected Integer irType;
@ExcelField(title="group_name",sort=45)
protected String groupName;
// @ExcelField(title="log_total",sort=42)
private Long totalLogs;
private Integer regionId;
private Integer groupId;
public Integer getRegionId() {
return regionId;
}
public void setRegionId(Integer regionId) {
this.regionId = regionId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Long getTotalLogs() {
return totalLogs;
}
public void setTotalLogs(Long totalLogs) {
this.totalLogs = totalLogs;
}
/**
* irType
* @return irType
*/
public Integer getIrType() {
return irType;
}
/**
* @param irType the irType to set
*/
public void setIrType(Integer irType) {
this.irType = irType;
}
/**
* groupName
* @return groupName
*/
public String getGroupName() {
return groupName;
}
/**
* @param groupName the groupName to set
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* 方向
*/
@Expose
@SerializedName("direction")
@ExcelField(title="direction",dictType="DIRECTION",sort=58)
protected Integer direction ;
/**
* 协议
*/
@Expose
@SerializedName("protocol")
@ExcelField(title="protocol",dictType="PROTOCOL",sort=59)
protected Integer protocol ;
/**
* 协议ID
*/
@Expose
@SerializedName("protocolId")
protected Integer protocolId ;
/**
* 限速比例
*/
protected String ratelimit ;
/**
* ratelimit
* @return ratelimit
*/
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**
* ipType
* @return ipType
*/
public Integer getIpType() {
return ipType;
}
/**
* @param ipType the ipType to set
*/
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
/**
* direction
* @return direction
*/
public Integer getDirection() {
return direction;
}
/**
* @param direction the direction to set
*/
public void setDirection(Integer direction) {
this.direction = direction;
}
/**
* protocol
* @return protocol
*/
public Integer getProtocol() {
return protocol;
}
/**
* @param protocol the protocol to set
*/
public void setProtocol(Integer protocol) {
this.protocol = protocol;
}
/**
* protocolId
* @return protocolId
*/
public Integer getProtocolId() {
return protocolId;
}
/**
* @param protocolId the protocolId to set
*/
public void setProtocolId(Integer protocolId) {
this.protocolId = protocolId;
}
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
/**
* srcIpAddress
* @return srcIpAddress
*/
public String getSrcIpAddress() {
return srcIpAddress;
}
/**
* @param srcIpAddress the srcIpAddress to set
*/
public void setSrcIpAddress(String srcIpAddress) {
this.srcIpAddress = srcIpAddress;
}
/**
* destIpAddress
* @return destIpAddress
*/
public String getDestIpAddress() {
return destIpAddress;
}
/**
* @param destIpAddress the destIpAddress to set
*/
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
/**
* srcPort
* @return srcPort
*/
public String getSrcPort() {
return srcPort;
}
/**
* @param srcPort the srcPort to set
*/
public void setSrcPort(String srcPort) {
this.srcPort = srcPort;
}
/**
* destPort
* @return destPort
*/
public String getDestPort() {
return destPort;
}
/**
* @param destPort the destPort to set
*/
public void setDestPort(String destPort) {
this.destPort = destPort;
}
/**
* dnsStrategyId
* @return dnsStrategyId
*/
public Integer getDnsStrategyId() {
return dnsStrategyId;
}
/**
* @param dnsStrategyId the dnsStrategyId to set
*/
public void setDnsStrategyId(Integer dnsStrategyId) {
this.dnsStrategyId = dnsStrategyId;
}
@Override
public void initDefaultValue(){
super.initDefaultValue();
this.direction = 0;
}
public static String getIndexTable() {
return indexTable;
}
public Integer getIndex() {
return index;
}
public void setIndex(Integer index) {
this.index = index;
}
}

View File

@@ -1,67 +0,0 @@
package com.nis.domain.basics;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.excel.ExcelField;
public class ScriberIdCommCfg extends BaseStringCfg<ScriberIdCommCfg>{
private static final long serialVersionUID = 5117517145731135023L;
private static final String tableName="scriberid_comm_cfg";
@ExcelField(title="key_word",sort=3)
protected String cfgKeywords;
protected Integer isHexbin;
protected String ratelimit;
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public static String getTablename() {
return tableName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -1,66 +0,0 @@
package com.nis.domain.basics;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.excel.ExcelField;
public class UrlCommCfg extends BaseStringCfg<UrlCommCfg>{
private static final long serialVersionUID = 398247881810945300L;
private static final String tableName="url_comm_cfg";
@ExcelField(title="key_word",sort=3)
protected String cfgKeywords;//url关键字配置
protected Integer isHexbin;//是否大小写敏感
protected String ratelimit;//限速比例,0到1之间
@ExcelField(title="group_name",sort=2)
protected String groupName;//公共组名称
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=18)
protected Integer exprType;
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=20)
protected Integer matchMethod;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
public Integer getIsHexbin() {
return isHexbin;
}
public void setIsHexbin(Integer isHexbin) {
this.isHexbin = isHexbin;
}
public String getRatelimit() {
return ratelimit;
}
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
public static String getTablename() {
return tableName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getMatchMethod() {
return matchMethod;
}
public void setMatchMethod(Integer matchMethod) {
this.matchMethod = matchMethod;
}
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
}

View File

@@ -1,54 +0,0 @@
package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
/**
* http代理劫持文件
* @author lenovo
*
*/
public class ProxyFileHijackCfg extends BaseCfg<ProxyFileHijackCfg>{
private static final long serialVersionUID = -4600604393808056286L;
public String indexTable = "pxy_profile_hijack_files";//对应表名
@ExcelField(title="profile_name",sort=1)
private String profileName;//名称,辅助记忆
@ExcelField(title="content_type",sort=3)
private String contentType;//填充HTTP content-type如“video/mp4” exe、apk
@ExcelField(title="hijack_file_strategy",sort=2)
private String path;//储存路径
@ExcelField(title="content_name",sort=4)
private String contentName;//内容格式
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

View File

@@ -1,114 +0,0 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileHijackCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer profileId;//compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String profileName;
@Expose
private String contentType;
@Expose
private String path;
@Expose
private String contentName;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Long getId() {
return id;
}
public Integer getProfileId() {
return profileId;
}
public void setProfileId(Integer profileId) {
this.profileId = profileId;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
}

View File

@@ -1,40 +0,0 @@
package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
public class ProxyFileInsertScriptCfg extends BaseCfg<ProxyFileInsertScriptCfg>{
private static final long serialVersionUID = 4705202662940705064L;
public String indexTable = "pxy_profile_insert_scripts";//对应表名
@ExcelField(title="script_name",sort=1)
private String cfgDesc;//名称,辅助记忆
@ExcelField(title="script_format",sort=3)
private String format;//css/js
@ExcelField(title="script_file",sort=2)
private String path;//储存路径
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

View File

@@ -1,99 +0,0 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileInsertScriptCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer profileId;//compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String profileName;
@Expose
private String format;
@Expose
private String path;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getProfileId() {
return profileId;
}
public void setProfileId(Integer profileId) {
this.profileId = profileId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

View File

@@ -1,67 +0,0 @@
package com.nis.domain.callback;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
/**
* http代理文件策略
* @author nanfang
*
*/
public class ProxyFileResponsePageCfg extends BaseCfg<ProxyFileResponsePageCfg> {
private static final long serialVersionUID = -1989406217948847813L;
public final static String TABLE_NAME = "pxy_profile_response_pages";//对应表名
private String indexTable = "pxy_profile_response_pages";
@ExcelField(title="file_desc",sort=1)
private String fileDesc;//文件描述
@ExcelField(title="response_file",sort=2)
private String url;//文件保存的url
@ExcelField(title="format",sort=3)
private String contentType;//内容类型如text/html取字典表contentType
private String md5;//文件md5值
private Long contentLength;//文件长度
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public ProxyFileResponsePageCfg() {
super();
}
public String getFileDesc() {
return fileDesc;
}
public void setFileDesc(String fileDesc) {
this.fileDesc = fileDesc;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
}

View File

@@ -1,106 +0,0 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileResponsePageCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String format;
@Expose
private Long contentLength;
@Expose
private String path;
@Expose
private Long profileId;
@Expose
private String profileName;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Long getProfileId() {
return profileId;
}
public void setProfileId(Long profileId) {
this.profileId = profileId;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
}

View File

@@ -9,21 +9,12 @@ import com.nis.domain.configuration.BaseCfg;
public class ProxyFileStrategyCfg extends BaseCfg<ProxyFileStrategyCfg> {
private static final long serialVersionUID = 4283944377949702481L;
public final static String TABLE_NAME = "PROXY_FILE_STRATEGY_CFG";//对应表名
private String indexTable = "proxy_file_strategy_cfg";
private String fileDesc;//文件描述
private String url;//文件保存的url
private String contentType;//内容类型如text/html取字典表contentType
private String md5;//文件md5值
private Long contentLength;//文件长度
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public ProxyFileStrategyCfg() {
super();
}

View File

@@ -1,106 +0,0 @@
package com.nis.domain.callback;
import java.util.Date;
import com.google.gson.annotations.Expose;
public class ProxyFileStrategyCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String contentType;
@Expose
private Long contentLength;
@Expose
private String filePath;
@Expose
private Long fileId;
@Expose
private String fileDesc;
@Expose
private Long opUser;
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
public String getFileDesc() {
return fileDesc;
}
public void setFileDesc(String fileDesc) {
this.fileDesc = fileDesc;
}
}

View File

@@ -1,45 +0,0 @@
package com.nis.domain.callback;
import java.util.Arrays;
import com.nis.domain.configuration.BaseCfg;
import com.nis.util.excel.ExcelField;
import antlr.collections.List;
public class ProxyFileTrafficMirrorCfg extends BaseCfg<ProxyFileTrafficMirrorCfg>{
private static final long serialVersionUID = -5895958073449509268L;
public String indexTable = "pxy_profile_traffic_mirror";//对应表名
@ExcelField(title="address_name",sort=1)
private String cfgDesc;//名称,辅助记忆
@ExcelField(title="mirror_addr_list",sort=3)
private String addrList;//目标表示列表
@ExcelField(title="mirror_addr_type",sort=2)
private String addrType;//目标表示类型
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
public String getAddrList() {
return addrList;
}
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getAddrType() {
return addrType;
}
public void setAddrType(String addrType) {
this.addrType = addrType;
}
}

View File

@@ -1,106 +0,0 @@
package com.nis.domain.callback;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose;
public class ProxyFileTrafficMirrorCfgAudit {
@Expose
private Long id; //compileId
@Expose
private Integer cfgId; //compileId
@Expose
private Integer profileId;//compileId
@Expose
private Integer action;
@Expose
private Integer service;
@Expose
private Integer isValid;
@Expose
private Date opTime;
@Expose
private String profileName;
@Expose
private String addrList;
@Expose
private String addrContent;
@Expose
private String addrType;
@Expose
private Long opUser;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public Integer getProfileId() {
return profileId;
}
public void setProfileId(Integer profileId) {
this.profileId = profileId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public String getAddrList() {
return addrList;
}
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getAddrContent() {
return addrContent;
}
public void setAddrContent(String addrContent) {
this.addrContent = addrContent;
}
public String getAddrType() {
return addrType;
}
public void setAddrType(String addrType) {
this.addrType = addrType;
}
public Long getOpUser() {
return opUser;
}
public void setOpUser(Long opUser) {
this.opUser = opUser;
}
}

View File

@@ -76,29 +76,17 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
* 定时任务信息2019年1月18日18:54:53 修改
*/
protected ScheduleCfg schedule;
protected String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
protected Integer groupType; //url组以及dns组相关功能使用
protected Integer udFlag; //url组以及dns组相关功能使用 过滤数据库数据标记
private String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
public String getCommonGroupIds() {
return commonGroupIds;
}
public void setCommonGroupIds(String commonGroupIds) {
this.commonGroupIds = commonGroupIds;
}
public Integer getGroupType() {
return groupType;
}
public void setGroupType(Integer groupType) {
this.groupType = groupType;
}
public Integer getUdFlag() {
return udFlag;
}
public void setUdFlag(Integer udFlag) {
this.udFlag = udFlag;
}
public String getExType() {
return exType;

View File

@@ -9,7 +9,6 @@
package com.nis.domain.configuration;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
@@ -400,125 +399,4 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
public void setIndex(Integer index) {
this.index = index;
}
protected Integer keyring;
protected Integer evCert;
protected Integer certTransparency;
protected Integer clientCertReq;
protected Integer pinning;
protected Integer protocolErrors;
protected Integer cn;
protected Integer issuer;
protected Integer selfSigned;
protected Integer expiration;
protected String failMethod;
protected String min;
protected String max;
protected Integer mirrorClient;
protected Integer allowHttp2;
protected Integer enable;
protected Integer mirrorProfile;
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -45,14 +45,7 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
protected Integer specServiceId;//仅用于copy属性使用
protected String domain;//仅用于copy属性使用
protected Integer dnsStrategyId;//仅用作复制属性使用
protected String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Integer getDnsStrategyId() {
return dnsStrategyId;
}
@@ -289,124 +282,5 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
public void setRegionId(Integer regionId) {
this.regionId = regionId;
}
protected Integer keyring;
protected Integer evCert;
protected Integer certTransparency;
protected Integer clientCertReq;
protected Integer pinning;
protected Integer protocolErrors;
protected Integer cn;
protected Integer issuer;
protected Integer selfSigned;
protected Integer expiration;
protected String failMethod;
protected String min;
protected String max;
protected Integer mirrorClient;
protected Integer allowHttp2;
protected Integer enable;
protected Integer mirrorProfile;
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -14,11 +14,7 @@ import java.util.Map;
import com.google.gson.annotations.Expose;
import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.IpReuseIpCfg;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.util.Constants;
import com.nis.util.excel.ExcelField;
@@ -92,12 +88,8 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private List<AsnKeywordCfg> asnKeywords;
@ExcelField(title="log_total",sort=42)
private Long totalLogs;
private List<UrlCommCfg> urlCommGroupList;
private List<IpCommCfg> ipCommGroupCfgList;
private List<DomainCommCfg> domainCommGroupList;
private List<ScriberIdCommCfg> scriberIdCommGroupList;
private String groupName;
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
public static class CachePolicyUserRegion{
@@ -109,18 +101,6 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public String getOrganization() {
return organization;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public List<IpCommCfg> getIpCommGroupCfgList() {
return ipCommGroupCfgList;
}
public void setIpCommGroupCfgList(List<IpCommCfg> ipCommGroupCfgList) {
this.ipCommGroupCfgList = ipCommGroupCfgList;
}
public List<AsnKeywordCfg> getAsnKeywords() {
return asnKeywords;
}
@@ -431,26 +411,4 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public void setTotalLogs(Long totalLogs) {
this.totalLogs = totalLogs;
}
public List<UrlCommCfg> getUrlCommGroupList() {
return urlCommGroupList;
}
public void setUrlCommGroupList(List<UrlCommCfg> urlCommGroupList) {
this.urlCommGroupList = urlCommGroupList;
}
public List<DomainCommCfg> getDomainCommGroupList() {
return domainCommGroupList;
}
public void setDomainCommGroupList(List<DomainCommCfg> domainCommGroupList) {
this.domainCommGroupList = domainCommGroupList;
}
public List<ScriberIdCommCfg> getScriberIdCommGroupList() {
return scriberIdCommGroupList;
}
public void setScriberIdCommGroupList(List<ScriberIdCommCfg> scriberIdCommGroupList) {
this.scriberIdCommGroupList = scriberIdCommGroupList;
}
}

View File

@@ -1,58 +0,0 @@
package com.nis.domain.configuration;
import com.nis.util.excel.ExcelField;
public class ManipulatCfgExport extends CfgIndexInfo {
/**
*
*/
private static final long serialVersionUID = -842585769617969577L;
@ExcelField(title="block_type",dictType="SERVICE_ACTION",sort=2)
private String actionExport;
@ExcelField(title="method_export",dictType="SERVICE_ACTION",sort=3)
private String methodExport;
@ExcelField(title="response_code",sort=3)
private String responseCode;
@ExcelField(title="profile_info",sort=10)
private String profileInfo;
private Integer action;
public String getResponseCode() {
return responseCode;
}
public void setResponseCode(String responseCode) {
this.responseCode = responseCode;
}
public String getMethodExport() {
return methodExport;
}
public void setMethodExport(String methodExport) {
this.methodExport = methodExport;
}
public String getProfileInfo() {
return profileInfo;
}
public void setProfileInfo(String profileInfo) {
this.profileInfo = profileInfo;
}
public String getActionExport() {
return actionExport;
}
public void setActionExport(String actionExport) {
this.actionExport = actionExport;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
}

View File

@@ -1,60 +0,0 @@
package com.nis.domain.configuration;
import com.nis.util.excel.ExcelField;
public class ObjGroupCfg extends BaseCfg<ObjGroupCfg> {
@ExcelField(title="ip_group",sort=33)
private String ipGroup;
@ExcelField(title="url_group",sort=35)
private String urlGroup;
@ExcelField(title="subscribe_id_group",sort=34)
private String subscribeIdGroup;
@ExcelField(title="domain_group",sort=36)
private String domainGroup;
@ExcelField(title="block_type",sort=2)//这里没有使用公共方法处理直接将字典值set进去了不用使用dictType
protected String actionCode;
@ExcelField(title="protocol",sort=3)
protected String userRegion1;
public String getActionCode() {
return actionCode;
}
public void setActionCode(String actionCode) {
this.actionCode = actionCode;
}
public String getIpGroup() {
return ipGroup;
}
public void setIpGroup(String ipGroup) {
this.ipGroup = ipGroup;
}
public String getUrlGroup() {
return urlGroup;
}
public void setUrlGroup(String urlGroup) {
this.urlGroup = urlGroup;
}
public String getSubscribeIdGroup() {
return subscribeIdGroup;
}
public void setSubscribeIdGroup(String subscribeIdGroup) {
this.subscribeIdGroup = subscribeIdGroup;
}
public String getDomainGroup() {
return domainGroup;
}
public void setDomainGroup(String domainGroup) {
this.domainGroup = domainGroup;
}
protected Integer action;//覆盖默认的action上的注解
}

View File

@@ -1,153 +0,0 @@
package com.nis.domain.configuration;
import com.nis.util.excel.ExcelField;
public class PxyInterceptCfg extends CfgIndexInfo {
/**
*
*/
private static final long serialVersionUID = 994229066993318362L;
@ExcelField(title="pxy_intercept_monit_keyring",sort=8)
private String keyring;
@ExcelField(title="exclusions_ev_cert",dictType="SYS_YES_NO",sort=9)
private String evCert;
@ExcelField(title="exclusions_cert_transparency",dictType="SYS_YES_NO",sort=10)
private String certTransparency;
@ExcelField(title="exclusions_client_cert_req",dictType="SYS_YES_NO",sort=11)
private String clientCertReq;
@ExcelField(title="exclusions_pinning",dictType="SYS_YES_NO",sort=12)
private String pinning;
@ExcelField(title="exclusions_protocol_errors",dictType="SYS_YES_NO",sort=13)
private String protocolErrors;
@ExcelField(title="cert_verify_approach_cn",dictType="SYS_YES_NO",sort=14)
private String cn;
@ExcelField(title="cert_verify_approach_issuer",dictType="SYS_YES_NO",sort=15)
private String issuer;
@ExcelField(title="cert_verify_approach_self_signed",dictType="SYS_YES_NO",sort=16)
private String selfSigned;
@ExcelField(title="cert_verify_approach_expiration",dictType="SYS_YES_NO",sort=17)
private String expiration;
@ExcelField(title="cert_verify_fail_method",dictType="FAIL_METHOD",sort=18)
private String failMethod;
@ExcelField(title="ssl_ver_min",dictType="SSL_VERSION",sort=19)
private String min;
@ExcelField(title="ssl_ver_max",dictType="SSL_VERSION",sort=20)
private String max;
@ExcelField(title="ssl_ver_mirror_client",dictType="SYS_YES_NO",sort=21)
private String mirrorClient;
@ExcelField(title="ssl_ver_allow_http2",dictType="SYS_YES_NO",sort=22)
private String allowHttp2;
@ExcelField(title="decrypt_mirror_enable",dictType="SYS_YES_NO",sort=23)
private String enable;
@ExcelField(title="decrypt_mirror_mirror_profile",sort=24)
private String mirrorProfile;
private String userRegion1;
private String userRegion2;
private String userRegion3;
private String userRegion4;
// private String userRegion5;
public String getKeyring() {
return keyring;
}
public void setKeyring(String keyring) {
this.keyring = keyring;
}
public String getEvCert() {
return evCert;
}
public void setEvCert(String evCert) {
this.evCert = evCert;
}
public String getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(String certTransparency) {
this.certTransparency = certTransparency;
}
public String getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(String clientCertReq) {
this.clientCertReq = clientCertReq;
}
public String getPinning() {
return pinning;
}
public void setPinning(String pinning) {
this.pinning = pinning;
}
public String getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(String protocolErrors) {
this.protocolErrors = protocolErrors;
}
public String getCn() {
return cn;
}
public void setCn(String cn) {
this.cn = cn;
}
public String getIssuer() {
return issuer;
}
public void setIssuer(String issuer) {
this.issuer = issuer;
}
public String getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(String selfSigned) {
this.selfSigned = selfSigned;
}
public String getExpiration() {
return expiration;
}
public void setExpiration(String expiration) {
this.expiration = expiration;
}
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(String mirrorClient) {
this.mirrorClient = mirrorClient;
}
public String getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(String allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public String getEnable() {
return enable;
}
public void setEnable(String enable) {
this.enable = enable;
}
public String getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(String mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -25,7 +25,6 @@ public class PxyObjKeyring extends BaseCfg<PxyObjKeyring> {
@ExcelField(title="expire_after",sort=5)
private Integer expireAfter;
private String publicKeyAlgo;
@ExcelField(title="CRL",sort=5)
private String crl;
@ExcelField(title="issuer",sort=6)
private String issuer;

View File

@@ -18,18 +18,9 @@ public class PxyObjTrustedCaCert extends BaseCfg<PxyObjTrustedCaCert> {
private String issuer; //颁发者
@ExcelField(title="certificate_file",sort=2)
private String certFile;
//@ExcelField(title="crl_file",sort=4)
@ExcelField(title="crl_file",sort=4)
private String crlFile;
private Integer builtIn;//是否内置证书
@ExcelField(title="built_in",sort=5)//是否内置证书(导出用)
private String builtInExp;
public String getBuiltInExp() {
return builtInExp;
}
public void setBuiltInExp(String builtInExp) {
this.builtInExp = builtInExp;
}
public String getCrlFile() {
return crlFile;
}
@@ -56,11 +47,6 @@ public class PxyObjTrustedCaCert extends BaseCfg<PxyObjTrustedCaCert> {
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
public Integer getBuiltIn() {
return builtIn;
}
public void setBuiltIn(Integer builtIn) {
this.builtIn = builtIn;
}
}

View File

@@ -1,23 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* 域名公共组配置 导入模板
* @author dell
*
*/
public class DomainCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -1,160 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class InterceptDomainTemplate extends StringAllNotDoLogTemplate {
private Integer keyring;
private Integer evCert;
private Integer certTransparency;
private Integer clientCertReq;
private Integer pinning;
private Integer protocolErrors;
private Integer cn;
private Integer issuer;
private Integer selfSigned;
private Integer expiration;
private String failMethod;
private String min;
private String max;
private Integer mirrorClient;
private Integer allowHttp2;
private Integer enable;
private Integer mirrorProfile;
@ExcelField(title="pxy_intercept_monit_keyring",align=2,sort=17)
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
@ExcelField(title="exclusions_ev_cert",align=2,sort=18)
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
@ExcelField(title="exclusions_cert_transparency",align=2,sort=19)
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
@ExcelField(title="exclusions_client_cert_req",align=2,sort=20)
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
@ExcelField(title="exclusions_pinning",align=2,sort=21)
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
@ExcelField(title="protocol_errors",align=2,sort=22)
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
@ExcelField(title="cert_verify_approach_cn",align=2,sort=23)
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
@ExcelField(title="cert_verify_approach_issuer",align=2,sort=24)
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
@ExcelField(title="cert_verify_approach_self_signed",align=2,sort=25)
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
@ExcelField(title="cert_verify_approach_expiration",align=2,sort=26)
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
@ExcelField(title="cert_verify_fail_method",dictType="FAIL_METHOD",align=2,sort=27)
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
@ExcelField(title="ssl_ver_min",dictType="SSL_VERSION",align=2,sort=28)
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
@ExcelField(title="ssl_ver_max",dictType="SSL_VERSION",align=2,sort=29)
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
@ExcelField(title="ssl_ver_mirror_client",align=2,sort=30)
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
@ExcelField(title="ssl_ver_allow_http2",align=2,sort=31)
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=32)
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=33)
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -1,161 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class InterceptIpTemplate extends IpAllNotDoLogTemplate {
private Integer keyring;
private Integer evCert;
private Integer certTransparency;
private Integer clientCertReq;
private Integer pinning;
private Integer protocolErrors;
private Integer cn;
private Integer issuer;
private Integer selfSigned;
private Integer expiration;
private String failMethod;
private String min;
private String max;
private Integer mirrorClient;
private Integer allowHttp2;
private Integer enable;
private Integer mirrorProfile;
@ExcelField(title="pxy_intercept_monit_keyring",align=2,sort=17)
public Integer getKeyring() {
return keyring;
}
public void setKeyring(Integer keyring) {
this.keyring = keyring;
}
@ExcelField(title="exclusions_ev_cert",align=2,sort=18)
public Integer getEvCert() {
return evCert;
}
public void setEvCert(Integer evCert) {
this.evCert = evCert;
}
@ExcelField(title="exclusions_cert_transparency",align=2,sort=19)
public Integer getCertTransparency() {
return certTransparency;
}
public void setCertTransparency(Integer certTransparency) {
this.certTransparency = certTransparency;
}
@ExcelField(title="exclusions_client_cert_req",align=2,sort=20)
public Integer getClientCertReq() {
return clientCertReq;
}
public void setClientCertReq(Integer clientCertReq) {
this.clientCertReq = clientCertReq;
}
@ExcelField(title="exclusions_pinning",align=2,sort=21)
public Integer getPinning() {
return pinning;
}
public void setPinning(Integer pinning) {
this.pinning = pinning;
}
@ExcelField(title="exclusions_protocol_errors",align=2,sort=22)
public Integer getProtocolErrors() {
return protocolErrors;
}
public void setProtocolErrors(Integer protocolErrors) {
this.protocolErrors = protocolErrors;
}
@ExcelField(title="cert_verify_approach_cn",align=2,sort=23)
public Integer getCn() {
return cn;
}
public void setCn(Integer cn) {
this.cn = cn;
}
@ExcelField(title="cert_verify_approach_issuer",align=2,sort=24)
public Integer getIssuer() {
return issuer;
}
public void setIssuer(Integer issuer) {
this.issuer = issuer;
}
@ExcelField(title="cert_verify_approach_self_signed",align=2,sort=25)
public Integer getSelfSigned() {
return selfSigned;
}
public void setSelfSigned(Integer selfSigned) {
this.selfSigned = selfSigned;
}
@ExcelField(title="cert_verify_approach_expiration",align=2,sort=26)
public Integer getExpiration() {
return expiration;
}
public void setExpiration(Integer expiration) {
this.expiration = expiration;
}
@ExcelField(title="cert_verify_fail_method",dictType="FAIL_METHOD",align=2,sort=27)
public String getFailMethod() {
return failMethod;
}
public void setFailMethod(String failMethod) {
this.failMethod = failMethod;
}
@ExcelField(title="ssl_ver_min",dictType="SSL_VERSION",align=2,sort=28)
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
@ExcelField(title="ssl_ver_max",dictType="SSL_VERSION",align=2,sort=29)
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
@ExcelField(title="ssl_ver_mirror_client",align=2,sort=30)
public Integer getMirrorClient() {
return mirrorClient;
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
@ExcelField(title="ssl_ver_allow_http2",align=2,sort=31)
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=32)
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=33)
public Integer getMirrorProfile() {
return mirrorProfile;
}
public void setMirrorProfile(Integer mirrorProfile) {
this.mirrorProfile = mirrorProfile;
}
}

View File

@@ -15,13 +15,13 @@ public class IpAllNotDoLogTemplate extends BasicTemplate{
protected String cfgDesc;
protected String srcIpAddress;
protected String destIpAddress;
protected String srcPort;
protected String destPort;
protected Integer protocol;
protected Integer direction;
private String cfgDesc;
private String srcIpAddress;
private String destIpAddress;
private String srcPort;
private String destPort;
private Integer protocol;
private Integer direction;
@ExcelField(title="config_describe",align=2,sort=1)
public String getCfgDesc() {

View File

@@ -1,20 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
public class IpCommCfgTemplate extends IpAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -1,23 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* 域名公共组配置 导入模板
* @author dell
*
*/
public class ScriberIdCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -1,23 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* URL公共组配置 导入模板
* @author dell
*
*/
public class UrlCommCfgTemplate extends StringAllNotDoLogTemplate{
@ExcelField(title="group_name",align=2,sort=10)
private String groupName;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

View File

@@ -1,116 +0,0 @@
package com.nis.domain.dashboard;
import com.nis.domain.report.BaseReport;
import com.nis.util.excel.ExcelField;
public class ConfigStatistic extends BaseReport<ConfigStatistic>{
private static final long serialVersionUID = 8905927100915123026L;
@ExcelField(title="cfg_id",sort=1)
private String cfgId;
@ExcelField(title="config_describe",sort=2)
private String cfgDesc;
private String serviceId;
private String tableName;//表名
private String beginDate;
private String endDate;
private String area;//区域
private String operator;//运营商
private String chartType;//图表类型
public String getBeginDate() {
return beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getCfgId() {
return cfgId;
}
public void setCfgId(String cfgId) {
this.cfgId = cfgId;
}
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
public String getServiceId() {
return serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
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;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getChartType() {
return chartType;
}
public void setChartType(String chartType) {
this.chartType = chartType;
}
}

View File

@@ -1,94 +0,0 @@
package com.nis.domain.dashboard.codedic;
import java.io.Serializable;
import java.util.Date;
public class CodeDomainDic implements Serializable{
/**
*
*/
private static final long serialVersionUID = 8878203808371459079L;
private Integer id;
private String websiteServiceId;
private String domain;
private String topicId;
private Date createTime;
private String creatorId;
private Integer isValid;
private String ican;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getWebsiteServiceId() {
return websiteServiceId;
}
public void setWebsiteServiceId(String websiteServiceId) {
this.websiteServiceId = websiteServiceId;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getTopicId() {
return topicId;
}
public void setTopicId(String topicId) {
this.topicId = topicId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public String getIcan() {
return ican;
}
public void setIcan(String ican) {
this.ican = ican;
}
}

View File

@@ -6,7 +6,7 @@ public class NtcCollectRadiusLog extends BaseLogEntity<NtcCollectRadiusLog> {
private static final long serialVersionUID = -4947912502754359817L;
@ExcelField(title="code",dictType="MESSAGE_TYPE",sort=10)
@ExcelField(title="message_type",dictType="MESSAGE_TYPE",sort=10)
protected Integer code;
@ExcelField(title="nas_ip",sort=15)
protected String nasIp;

View File

@@ -1,736 +0,0 @@
package com.nis.domain.log;
import com.google.gson.annotations.Expose;
import com.nis.domain.BaseEntity;
import com.nis.util.excel.ExcelField;
/**
* (日志 代理HTTP 操控 实体类
*
*/
public class PxyHttpManipulationLog extends BaseEntity<PxyHttpManipulationLog>{
private static final long serialVersionUID = -3046458130302949428L;
@ExcelField(title="found_time",sort=5)
protected String foundTime; //发现时间timestamp
@ExcelField(title="recv_time",sort=6)
protected String recvTime; //接收时间timestamp
@ExcelField(title="transport_layer_protocol",dictType="LOG_PROTOCOL",sort=30)
protected String transProto; //协议类型从字典LOG_PROTOCOL取值
@ExcelField(title="addr_type",dictType="IP_TYPE",sort=35)
protected Integer addrType; //ip地址类型从字典IP_TYPE取值
@ExcelField(title="URL",sort=8)
private String url;
@ExcelField(title="host",sort=8)
private String host;//主机地址
@ExcelField(title="domain_name",sort=8)
private String domain;//域名
@ExcelField(title="category",sort=8)
private String category;//域名分类
@ExcelField(title="req_line",sort=9)
private String reqLine;
@ExcelField(title="res_line",sort=10)
private String resLine;
@ExcelField(title="PXY_CACHE_HTTP_COOKIE",sort=11)
private String cookie;
@ExcelField(title="referer",sort=12)
private String referer;
@ExcelField(title="user_agent",sort=13)
private String userAgent;
@ExcelField(title="content_len",sort=14)
private String contentLen;
@ExcelField(title="content_type",sort=15)
private String contentType;
@ExcelField(title="set_cookie",sort=16)
private String setCookie;
@ExcelField(title="req_header",sort=17)
private String reqHeader;
@ExcelField(title="resp_header",sort=18)
private String respHeader;
@ExcelField(title="req_body",sort=78)
private String reqBody;
@ExcelField(title="resp_body",sort=79)
private String respBody;
// @ExcelField(title="website",sort=8)
// private String website;
@ExcelField(title="cfg_id",sort=1)
private Integer policyId;//
@ExcelField(title="app_proto",sort=31)
private String appProto;//应用协议类型
@ExcelField(title="startTime",sort=5)
private String startTime;//会话创建时间
@ExcelField(title="endTime",sort=5)
private String endTime;//会话结束时间
@Expose
@ExcelField(title="server_ip",sort=40)
protected String serverIp; //服务端ip地址
@Expose
@ExcelField(title="client_ip",sort=41)
protected String clientIp; //客户端ip地址
@Expose
@ExcelField(title="server_port",sort=42)
protected String serverPort; //服务端ip端口
@Expose
@ExcelField(title="client_port",sort=43)
protected String clientPort; //客户端ip端口
@ExcelField(title="entrance_id",dictType="ENTRANCE",sort=7)
protected Integer entranceId; //出入口编号
@ExcelField(title="deviceid",dictType="DEVICE",sort=50)
protected Integer deviceId; //串联设备编号
@ExcelField(title="direction",dictType="LOG_DIRECTION",sort=55)
protected Integer direction; //传输方向 0域内->域外1域外->域内从字典LOG_DIRECTION取值
@ExcelField(title="stream_type",dictType="LOG_STREAM_TYPE",sort=65)
protected Integer streamDir; //流类型 0c2s1s2c2double从字典LOG_STREAMTYPE取值
@ExcelField(title="clj_ip",sort=27)
protected String capIp; //处理机IP
@ExcelField(title="nest_addr_list",sort=66)
protected String addrList; //嵌套地址列表
@ExcelField(title="server_locate",sort=67)
protected String serverLocation;// 服务端地址定位信息
@ExcelField(title="client_locate",sort=68)
protected String clientLocation;// 客户端地址定位信息
@ExcelField(title="s_asn",sort=70)
protected String clientAsn;//客户端ASN
@ExcelField(title="d_asn",sort=71)
protected String serverAsn;//服务端ASN
@ExcelField(title="s_subscribe_id",sort=73)
protected String subscribeId;//客户端用户名
@ExcelField(title="scene_file",sort=77)
protected String sceneFile;//现场日志文件地址
@ExcelField(title="isp",sort=80)
protected String isp;//运营商
protected Integer service; //配置表的serviceId
protected Integer functionId;
@ExcelField(title="action",dictType="SERVICE_ACTION",sort=2)
protected Integer action;
//新增字段
@ExcelField(title="encap_type",dictType="ENCAP_TYPE",sort=52)
protected Integer encapType;//原始二层封装格式
@ExcelField(title="link_id",dictType="LINK",sort=51)
protected Integer linkId;//串联设备链路号
@ExcelField(title="inner_smac",sort=58)
protected String innerSmac;//MAC_IN_MAC的内层源MAC
@ExcelField(title="inner_dmac",sort=59)
protected String innerDmac;//MAC_IN_MAC的内层目标MAC
//自定义字段
protected String date;//配置界面日志总量查询时间
protected String seltype;//选中类型,页面搜索用
protected String searchFoundStartTime;//开始时间格式为yyyy-mm-dd hh24:mi:ss
protected String searchFoundEndTime;//结束时间,格式同上
protected String isLogTotalSearch;//由配置界面跳转日志查询标识
protected String orderBy;//排序参数
protected Integer cfgId;
protected String fields;
protected Integer compileId;//
protected String startRecvTime;//开始时间
protected String endRecvTime; //结束时间
@ExcelField(title="con_duration_ms",sort=81)
protected Integer conDurationMs;//通信时长
protected String reqBodyKey;//请求体转储文件KEY
protected String resBodyKey;//应答体转储文件KEY
@ExcelField(title="version",sort=82)
protected String version;//版本
@ExcelField(title="sni",sort=83)
protected String sni;//
@ExcelField(title="san",sort=84)
protected String san;
@ExcelField(title="cn",sort=85)
protected String cn;
@ExcelField(title="social_app",sort=86)
protected String appId;//app
// @ExcelField(title="social_app",sort=86)
protected String appName;//app
@ExcelField(title="protocol",sort=87)
protected String protocolId;//协议
// @ExcelField(title="protocol",sort=87)
protected String protocolName;//协议
@ExcelField(title="con_latency_ms",sort=88)
protected Integer conLatencyMs;//握手延迟
@ExcelField(title="pinning",dictType="PINNING",sort=89)
protected Integer pinningst;//pinning状态
@ExcelField(title="intercept_state",dictType="INTERCEPT_STATE",sort=90)
protected Integer interceptState;//拦截状态
@ExcelField(title="ssl_server_side_latency",sort=91)
protected Integer sslServerSideLatency;//服务器侧ssl建立延迟
@ExcelField(title="ssl_client_side_latency",sort=92)
protected Integer sslClientSideLatency;//客户端侧ssl建立延迟
@ExcelField(title="ssl_server_side_version",dictType="SSL_VERSION",sort=93)
protected String sslServerSideVersion;//服务端侧ssl版本
@ExcelField(title="ssl_client_side_version",dictType="SSL_VERSION",sort=94)
protected String sslClientSideVersion;//客户端侧ssl版本
@ExcelField(title="ssl_cert_verify",dictType="SSL_CERT_VERIFY",sort=95)
protected Integer sslCertVerify;//证书校验结果
@ExcelField(title="stream_trace_id",sort=96)
protected String streamTraceId;//流的追踪ID
@ExcelField(title="ssl_error",sort=97)
protected String sslError;//ssl错误信息
@ExcelField(title="c2s_pkt_num",sort=98)
protected Integer c2sPktNum;//c2s包数
@ExcelField(title="s2c_pkt_num",sort=99)
protected Integer s2cPktNum;//s2c包数
@ExcelField(title="c2s_byte_num",sort=100)
protected Integer c2sByteNum;//c2s字节数
@ExcelField(title="s2c_byte_num",sort=101)
protected Integer s2cByteNum;//s2c字节数
@ExcelField(title="nas_ip",sort=102)
protected String nasIp;//ISN接入的IP
@ExcelField(title="framed_ip",sort=103)
protected String framedIp;//用户IP地址
@ExcelField(title="account",sort=104)
protected String account;//用户名
@ExcelField(title="packet_type",dictType="MESSAGE_TYPE",sort=105)
protected Integer packetType;//报文类型
protected String dIp;
protected String sIp;
public String getProtocolName() {
return protocolName;
}
public void setProtocolName(String protocolName) {
this.protocolName = protocolName;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getdIp() {
return dIp;
}
public void setdIp(String dIp) {
this.dIp = dIp;
}
public String getsIp() {
return sIp;
}
public void setsIp(String sIp) {
this.sIp = sIp;
}
public String getAppProto() {
return appProto;
}
public void setAppProto(String appProto) {
this.appProto = appProto;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getReqLine() {
return reqLine;
}
public void setReqLine(String reqLine) {
this.reqLine = reqLine;
}
public String getResLine() {
return resLine;
}
public void setResLine(String resLine) {
this.resLine = resLine;
}
public String getCookie() {
return cookie;
}
public void setCookie(String cookie) {
this.cookie = cookie;
}
public String getReferer() {
return referer;
}
public void setReferer(String referer) {
this.referer = referer;
}
public String getUserAgent() {
return userAgent;
}
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
public String getContentLen() {
return contentLen;
}
public void setContentLen(String contentLen) {
this.contentLen = contentLen;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getSetCookie() {
return setCookie;
}
public void setSetCookie(String setCookie) {
this.setCookie = setCookie;
}
public String getReqHeader() {
return reqHeader;
}
public void setReqHeader(String reqHeader) {
this.reqHeader = reqHeader;
}
public String getRespHeader() {
return respHeader;
}
public void setRespHeader(String respHeader) {
this.respHeader = respHeader;
}
public String getReqBody() {
return reqBody;
}
public void setReqBody(String reqBody) {
this.reqBody = reqBody;
}
public String getRespBody() {
return respBody;
}
public void setRespBody(String respBody) {
this.respBody = respBody;
}
// public String getWebsite() {
// return website;
// }
// public void setWebsite(String website) {
// this.website = website;
// }
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getIsp() {
return isp;
}
public void setIsp(String isp) {
this.isp = isp;
}
public Integer getPolicyId() {
return policyId;
}
public void setPolicyId(Integer policyId) {
this.policyId = policyId;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getServerIp() {
return serverIp;
}
public void setServerIp(String serverIp) {
this.serverIp = serverIp;
}
public String getClientIp() {
return clientIp;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
public String getServerPort() {
return serverPort;
}
public void setServerPort(String serverPort) {
this.serverPort = serverPort;
}
public String getClientPort() {
return clientPort;
}
public void setClientPort(String clientPort) {
this.clientPort = clientPort;
}
public String getServerLocation() {
return serverLocation;
}
public void setServerLocation(String serverLocation) {
this.serverLocation = serverLocation;
}
public String getClientLocation() {
return clientLocation;
}
public void setClientLocation(String clientLocation) {
this.clientLocation = clientLocation;
}
public String getClientAsn() {
return clientAsn;
}
public void setClientAsn(String clientAsn) {
this.clientAsn = clientAsn;
}
public String getServerAsn() {
return serverAsn;
}
public void setServerAsn(String serverAsn) {
this.serverAsn = serverAsn;
}
public String getSubscribeId() {
return subscribeId;
}
public void setSubscribeId(String subscribeId) {
this.subscribeId = subscribeId;
}
public Integer getConDurationMs() {
return conDurationMs;
}
public void setConDurationMs(Integer conDurationMs) {
this.conDurationMs = conDurationMs;
}
public String getReqBodyKey() {
return reqBodyKey;
}
public void setReqBodyKey(String reqBodyKey) {
this.reqBodyKey = reqBodyKey;
}
public String getResBodyKey() {
return resBodyKey;
}
public void setResBodyKey(String resBodyKey) {
this.resBodyKey = resBodyKey;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getSni() {
return sni;
}
public void setSni(String sni) {
this.sni = sni;
}
public String getSan() {
return san;
}
public void setSan(String san) {
this.san = san;
}
public String getCn() {
return cn;
}
public void setCn(String cn) {
this.cn = cn;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getProtocolId() {
return protocolId;
}
public void setProtocolId(String protocolId) {
this.protocolId = protocolId;
}
public Integer getConLatencyMs() {
return conLatencyMs;
}
public void setConLatencyMs(Integer conLatencyMs) {
this.conLatencyMs = conLatencyMs;
}
public Integer getPinningst() {
return pinningst;
}
public void setPinningst(Integer pinningst) {
this.pinningst = pinningst;
}
public Integer getC2sPktNum() {
return c2sPktNum;
}
public void setC2sPktNum(Integer c2sPktNum) {
this.c2sPktNum = c2sPktNum;
}
public Integer getS2cPktNum() {
return s2cPktNum;
}
public void setS2cPktNum(Integer s2cPktNum) {
this.s2cPktNum = s2cPktNum;
}
public Integer getC2sByteNum() {
return c2sByteNum;
}
public void setC2sByteNum(Integer c2sByteNum) {
this.c2sByteNum = c2sByteNum;
}
public Integer getS2cByteNum() {
return s2cByteNum;
}
public void setS2cByteNum(Integer s2cByteNum) {
this.s2cByteNum = s2cByteNum;
}
public String getNasIp() {
return nasIp;
}
public void setNasIp(String nasIp) {
this.nasIp = nasIp;
}
public String getFramedIp() {
return framedIp;
}
public void setFramedIp(String framedIp) {
this.framedIp = framedIp;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public Integer getPacketType() {
return packetType;
}
public void setPacketType(Integer packetType) {
this.packetType = packetType;
}
public Integer getCompileId() {
return compileId;
}
public void setCompileId(Integer compileId) {
this.compileId = compileId;
}
public String getStartRecvTime() {
return startRecvTime;
}
public void setStartRecvTime(String startRecvTime) {
this.startRecvTime = startRecvTime;
}
public String getEndRecvTime() {
return endRecvTime;
}
public void setEndRecvTime(String endRecvTime) {
this.endRecvTime = endRecvTime;
}
public String getFoundTime() {
return foundTime;
}
public void setFoundTime(String foundTime) {
this.foundTime = foundTime;
}
public String getRecvTime() {
return recvTime;
}
public void setRecvTime(String recvTime) {
this.recvTime = recvTime;
}
public String getTransProto() {
return transProto;
}
public void setTransProto(String transProto) {
this.transProto = transProto;
}
public Integer getAddrType() {
return addrType;
}
public void setAddrType(Integer addrType) {
this.addrType = addrType;
}
public Integer getEntranceId() {
return entranceId;
}
public void setEntranceId(Integer entranceId) {
this.entranceId = entranceId;
}
public Integer getDeviceId() {
return deviceId;
}
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
public Integer getStreamDir() {
return streamDir;
}
public void setStreamDir(Integer streamDir) {
this.streamDir = streamDir;
}
public String getCapIp() {
return capIp;
}
public void setCapIp(String capIp) {
this.capIp = capIp;
}
public String getAddrList() {
return addrList;
}
public void setAddrList(String addrList) {
this.addrList = addrList;
}
public String getSceneFile() {
return sceneFile;
}
public void setSceneFile(String sceneFile) {
this.sceneFile = sceneFile;
}
public Integer getService() {
return service;
}
public void setService(Integer service) {
this.service = service;
}
public Integer getFunctionId() {
return functionId;
}
public void setFunctionId(Integer functionId) {
this.functionId = functionId;
}
public Integer getAction() {
return action;
}
public void setAction(Integer action) {
this.action = action;
}
public Integer getEncapType() {
return encapType;
}
public void setEncapType(Integer encapType) {
this.encapType = encapType;
}
public Integer getLinkId() {
return linkId;
}
public void setLinkId(Integer linkId) {
this.linkId = linkId;
}
public String getInnerSmac() {
return innerSmac;
}
public void setInnerSmac(String innerSmac) {
this.innerSmac = innerSmac;
}
public String getInnerDmac() {
return innerDmac;
}
public void setInnerDmac(String innerDmac) {
this.innerDmac = innerDmac;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getSeltype() {
return seltype;
}
public void setSeltype(String seltype) {
this.seltype = seltype;
}
public String getSearchFoundStartTime() {
return searchFoundStartTime;
}
public void setSearchFoundStartTime(String searchFoundStartTime) {
this.searchFoundStartTime = searchFoundStartTime;
}
public String getSearchFoundEndTime() {
return searchFoundEndTime;
}
public void setSearchFoundEndTime(String searchFoundEndTime) {
this.searchFoundEndTime = searchFoundEndTime;
}
public String getIsLogTotalSearch() {
return isLogTotalSearch;
}
public void setIsLogTotalSearch(String isLogTotalSearch) {
this.isLogTotalSearch = isLogTotalSearch;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public Integer getInterceptState() {
return interceptState;
}
public void setInterceptState(Integer interceptState) {
this.interceptState = interceptState;
}
public Integer getSslServerSideLatency() {
return sslServerSideLatency;
}
public void setSslServerSideLatency(Integer sslServerSideLatency) {
this.sslServerSideLatency = sslServerSideLatency;
}
public Integer getSslClientSideLatency() {
return sslClientSideLatency;
}
public void setSslClientSideLatency(Integer sslClientSideLatency) {
this.sslClientSideLatency = sslClientSideLatency;
}
public String getSslServerSideVersion() {
return sslServerSideVersion;
}
public void setSslServerSideVersion(String sslServerSideVersion) {
this.sslServerSideVersion = sslServerSideVersion;
}
public String getSslClientSideVersion() {
return sslClientSideVersion;
}
public void setSslClientSideVersion(String sslClientSideVersion) {
this.sslClientSideVersion = sslClientSideVersion;
}
public Integer getSslCertVerify() {
return sslCertVerify;
}
public void setSslCertVerify(Integer sslCertVerify) {
this.sslCertVerify = sslCertVerify;
}
public String getStreamTraceId() {
return streamTraceId;
}
public void setStreamTraceId(String streamTraceId) {
this.streamTraceId = streamTraceId;
}
public String getSslError() {
return sslError;
}
public void setSslError(String sslError) {
this.sslError = sslError;
}
public Integer getCfgId() {
return cfgId;
}
public void setCfgId(Integer cfgId) {
this.cfgId = cfgId;
}
public String getFields() {
return fields;
}
public void setFields(String fields) {
this.fields = fields;
}
}

View File

@@ -1,140 +0,0 @@
package com.nis.domain.maat;
import java.io.Serializable;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* 管控策略动作参数
*/
public class ManipulatActionParam implements Serializable{
private static final long serialVersionUID = 7282481538239386968L;
@Expose
private String method;
@Expose
private Integer code;
@Expose
private String to;
@Expose
private String message;
@Expose
private Integer html_profile;
@Expose
private List<ReplaceCfg> rules;
public static class ReplaceCfg{
@Expose
private String search_in;
@Expose
private String find;
@Expose
private String replace_with;
public String getSearch_in() {
return search_in;
}
public void setSearch_in(String search_in) {
this.search_in = search_in;
}
public String getFind() {
return find;
}
public void setFind(String find) {
this.find = find;
}
public String getReplace_with() {
return replace_with;
}
public void setReplace_with(String replace_with) {
this.replace_with = replace_with;
}
}
@Expose
private Integer hijack_profile;
@Expose
private Integer insert_profile;
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getHtml_profile() {
return html_profile;
}
public void setHtml_profile(Integer html_profile) {
this.html_profile = html_profile;
}
public List<ReplaceCfg> getRules() {
return rules;
}
public void setRules(List<ReplaceCfg> rules) {
this.rules = rules;
}
public Integer getHijack_profile() {
return hijack_profile;
}
public void setHijack_profile(Integer hijack_profile) {
this.hijack_profile = hijack_profile;
}
public Integer getInsert_profile() {
return insert_profile;
}
public void setInsert_profile(Integer insert_profile) {
this.insert_profile = insert_profile;
}
}

View File

@@ -9,7 +9,6 @@
package com.nis.domain.report;
import com.nis.domain.BaseEntity;
import com.nis.util.excel.ExcelField;
/**
* @ClassName: BaseReportLog.java
@@ -26,7 +25,6 @@ public class BaseReport<T> extends BaseEntity<T>{
*/
private static final long serialVersionUID = -6190203013788730697L;
@ExcelField(title="config_log_total",sort=3)
protected Long sum;
protected Integer service;
protected String reportTime;

View File

@@ -7,7 +7,6 @@ import com.nis.domain.dashboard.SysIspInfo;
import com.nis.domain.dashboard.codedic.CodeAppDic;
import com.nis.domain.dashboard.codedic.CodeBehaviorTypeDic;
import com.nis.domain.dashboard.codedic.CodeBrowserTypeDic;
import com.nis.domain.dashboard.codedic.CodeDomainDic;
import com.nis.domain.dashboard.codedic.CodeOsTypeDic;
import com.nis.domain.dashboard.codedic.CodeProtocolTypeDic;
import com.nis.domain.dashboard.codedic.CodeServiceTypeDic;
@@ -15,7 +14,6 @@ import com.nis.domain.dashboard.codedic.CodeWebServiceDic;
import com.nis.web.dao.dashboard.codedic.CodeAppDicDao;
import com.nis.web.dao.dashboard.codedic.CodeBehaviorTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeBrowserTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeDomainDicDao;
import com.nis.web.dao.dashboard.codedic.CodeOsTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeProtocolTypeDicDao;
import com.nis.web.dao.dashboard.codedic.CodeResult;
@@ -33,7 +31,6 @@ public class CodeDicUtils {
private final static CodeServiceTypeDicDao codeServiceTypeDicDao = SpringContextHolder.getBean(CodeServiceTypeDicDao.class);
private final static CodeWebServiceDicDao codeWebServiceDicDao = SpringContextHolder.getBean(CodeWebServiceDicDao.class);
private final static CodeSysIspInfoDicDao codeSysIspInfoDicDao = SpringContextHolder.getBean(CodeSysIspInfoDicDao.class);
private final static CodeDomainDicDao codeDomainDicDao = SpringContextHolder.getBean(CodeDomainDicDao.class);
private static final String APP_CODE="appCode";
@@ -45,7 +42,6 @@ public class CodeDicUtils {
private static final String WEB_CODE="webCode";
private static final String ISP_CODE="ispCode";
private static final String DOMAIN_CODE="domainCode";
/**
* 适用于大屏图表标签显示
*/
@@ -182,23 +178,6 @@ public class CodeDicUtils {
}
}
return result;
}else if (name.equals(DOMAIN_CODE)) {
// List<CodeWebServiceDic> codeDicList = (List<CodeWebServiceDic>) CacheUtils.get(WEB_CODE);
// if(StringUtil.isEmpty(codeDicList)){
// codeDicList = codeWebServiceDicDao.getCodeDicList();
// CacheUtils.put(WEB_CODE, codeDicList);
// }
List<CodeDomainDic> codeDicList = codeDomainDicDao.getCodeDicList();
if(codeDicList!=null&&codeDicList.size()>0){
for (int i = 0; i < codeDicList.size(); i++) {
CodeResult codeResult = new CodeResult();
codeResult.setItem(codeDicList.get(i).getDomain());
codeResult.setCode(String.valueOf(codeDicList.get(i).getId()));
result.add(codeResult);
}
}
return result;
}
return result;
}

View File

@@ -1,17 +1,11 @@
package com.nis.util;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.configuration.*;
import com.nis.web.service.BaseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,6 +15,13 @@ import com.google.common.collect.Lists;
import com.googlecode.ipv6.IPv6Address;
import com.googlecode.ipv6.IPv6Network;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.MaatCfg.DigestCfg;
import com.nis.domain.maat.MaatCfg.GroupCfg;
import com.nis.domain.maat.MaatCfg.IpCfg;
@@ -232,6 +233,7 @@ public class ConfigConvertUtil {
* @param dstList
* @param srcList
* @param cfgType1为IP类型2为字符串类型3为增强字符串4数值类型5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
* @param baseCfg配置基本信息
* @param groupRelationList
* 配置分组列表
* @return
@@ -575,411 +577,4 @@ public class ConfigConvertUtil {
dstIp.setDstPortMask("65535");
}
}
/**
*Obj 组maat配置转换
* @param <T>
* @param <T>
* @param dstList
* @param srcList
* @param cfgType1为IP类型2为字符串类型3为增强字符串4数值类型5摘要类,6回调类[但字符串类域配置和增强字符串域配置在接口参数中同属于strRegionList]
* @param baseCfg配置基本信息
* @param groupRelationList
* 配置分组列表
* @return
*/
public static <T> Map<String, List> objGroupCfgConvert(Map<Integer,FunctionServiceDict> dictMap,List dstList, List<T> srcList, Integer cfgType, BaseCfg baseCfg,
List groupRelationList, Map<String,Object> maatTableMap, Set<Integer> groupIdSet) {
long start=System.currentTimeMillis(),end=0l;
Map<String, List> map = new HashMap();
if (cfgType == 1) {
List numRegionList = new ArrayList();
int pos=0;
Set<Integer> numGroupVals = new HashSet<>();
List<Integer> regionIdList = calRangeIps(srcList);//ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
T srcCfg = srcList.get(i);
BaseIpCfg baseIpCfg = new BaseIpCfg();
BeanUtils.copyProperties(srcCfg, baseIpCfg);
IpCfg cfg = new IpCfg();
BeanUtils.copyProperties(baseIpCfg, cfg);
// 区域IP配置多条IP配置属于同一个分组其他业务配置IP一条配置一个分组
// if(groupId==0 || !cfg.getCfgType().equals(Constants.AREA_REGION)){
if (!groupIdSet.contains(baseIpCfg.getGroupId())) {
GroupCfg group = new GroupCfg();
//groupId = ConfigServiceUtil.getId(2, 1).get(0);
group.setGroupId(baseIpCfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(baseIpCfg.getGroupId());
}
cfg.setGroupId(baseIpCfg.getGroupId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
if(maatTableMap.containsKey("ipMaatTable")){
Map<String,String> ipMaatTable=(Map<String,String>)maatTableMap.get("ipMaatTable");
cfg.setCfgType(ipMaatTable.get(baseIpCfg.getGroupId().toString()));
}
List<IpCfg> cfgs = ipConvert(cfg, baseIpCfg);
if (cfgs.size() > 1) {
List<Integer> ids =regionIdList.subList(pos,pos+cfgs.size());
//支持range????
for (int j = 1; j < cfgs.size(); j++) {
cfgs.get(j).setRegionId(ids.get(j-1));
}
pos+=cfgs.size();
}
dstList.addAll(cfgs);
// 如果protocolId非空非零需要构造数值型域配置多条相同协议的IP只需要一条数值域配置目前没有不同协议IP&情况)
//分组复用每个IP组还需要不同的数值域组么 answer:一个就行了
if (baseCfg!=null&&baseCfg.getServiceId()!=null&&baseCfg.getServiceId()>0&&dictMap.containsKey(baseCfg.getServiceId())) {
FunctionServiceDict dict=dictMap.get(baseCfg.getServiceId());
Integer protocolId=dict.getProtocolId();
if (protocolId>0&&!numGroupVals.contains(protocolId)) {
GroupCfg group1 = new GroupCfg();
group1.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
group1.setCompileId(baseCfg.getCompileId());
group1.setAuditTime(baseCfg.getAuditTime());
group1.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group1);
NumBoundaryCfg numCfg = new NumBoundaryCfg();
numCfg.initDefaultValue();
numCfg.setLowBoundary(protocolId);
numCfg.setUpBoundary(protocolId);
numCfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
numCfg.setAuditTime(baseCfg.getAuditTime());
numCfg.setGroupId(group1.getGroupId());
numCfg.setIsValid(baseCfg.getIsValid());
if(maatTableMap.containsKey("protocolMaatTable")){
numCfg.setCfgType(maatTableMap.get("protocolMaatTable").toString());
}
numRegionList.add(numCfg);
map.put("numRegionList", numRegionList);
numGroupVals.add(protocolId);
}
}
}
regionIdList.clear();
} else if (cfgType == 2 || cfgType == 3) {
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
BaseStringCfg baserStringCfg=new BaseStringCfg();
BeanUtils.copyProperties(srcList.get(i),baserStringCfg);
if(!groupIdSet.contains(baserStringCfg.getGroupId())){
GroupCfg group = new GroupCfg();
group.setGroupId(baserStringCfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(baserStringCfg.getGroupId());
}
StringCfg cfg = new StringCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
cfg.setGroupId(baserStringCfg.getGroupId());
cfg.setRegionId(baserStringCfg.getRegionId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
// 处理配置关键字转译
cfg.setCfgKeywords(keywordsEscape(cfg.getCfgKeywords()));
// 增强字符串转换
cfg.setDistrict(keywordsEscape(cfg.getDistrict()));
if(maatTableMap.containsKey("stringMaatTable")){
Map<String,String> stringMaatTable=(Map<String,String>)maatTableMap.get("stringMaatTable");
cfg.setCfgType(stringMaatTable.get(baserStringCfg.getGroupId().toString()));
}
dstList.add(cfg);
}
} else if (cfgType == 4) {
// List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
// List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
// 一条业务配置创建一个分组
NumBoundaryCfg cfg = new NumBoundaryCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
if(!groupIdSet.contains(cfg.getGroupId())){
GroupCfg group = new GroupCfg();
group.setGroupId(cfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(cfg.getGroupId());
}
cfg.setGroupId(cfg.getGroupId());
cfg.setRegionId(cfg.getRegionId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
dstList.add(cfg);
}
} else if (cfgType == 5) {
//List<Integer> groupIdList = ConfigServiceUtil.getId(2, srcList.size());
//List<Integer> regionIdList = ConfigServiceUtil.getId(3, srcList.size());
for (int i = 0; i < srcList.size(); i++) {
// 一条业务配置创建一个分组
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
BeanUtils.copyProperties(srcList.get(i), cfg);
if(!groupIdSet.contains(cfg.getGroupId())){
GroupCfg group = new GroupCfg();
group.setGroupId(cfg.getGroupId());
group.setCompileId(baseCfg.getCompileId());
group.setAuditTime(baseCfg.getAuditTime());
group.setIsValid(baseCfg.getIsValid());
groupRelationList.add(group);
groupIdSet.add(cfg.getGroupId());
}
cfg.setGroupId(cfg.getGroupId());
cfg.setRegionId(cfg.getRegionId());
cfg.setAuditTime(baseCfg.getAuditTime());
cfg.setIsValid(baseCfg.getIsValid());
dstList.add(cfg);
}
} else {
dstList.addAll(srcList);
}
map.put("groupList", groupRelationList);
map.put("dstList", dstList);
end=System.currentTimeMillis();
logger.info("objGroupCfgConvert cost:"+(end-start));
return map;
}
/**
* 转换成字符串
*
* @param obj
* @return
*/
public static <T> String gsonToJson(T obj) {
Gson gson = new GsonBuilder().disableHtmlEscaping().excludeFieldsWithoutExposeAnnotation()
.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
@Override
public JsonElement serialize(Date src, Type type, JsonSerializationContext context) {
String format = "yyyy-MM-dd HH:mm:ss";
long time = ((Date) src).getTime();
SimpleDateFormat sdf = new SimpleDateFormat(format);
return new JsonPrimitive(sdf.format(time));
}
}).create();
return gson.toJson(obj);
}
/**
* 字符串转成对象
*
* @param jsonString
* @param cls
* @return
*/
public static <T> T gsonFromJson(String jsonString, Class<T> cls) {
Gson gson = new GsonBuilder().registerTypeAdapter(new TypeToken<Map>() {
}.getType(), new BaseService.MapTypeAdapter()).registerTypeAdapter(new TypeToken<List>() {
}.getType(), new BaseService.MapTypeAdapter()).create();
return gson.fromJson(jsonString, cls);
}
/**
* 公共分组生成默认自定义域
* @param userRegionMap
* @param serviceId
* @return
*/
public static String generateCommonGroupDefaultUserRegion(Map<String,Object> userRegionMap,Integer serviceId){
if(userRegionMap==null){
userRegionMap=new HashMap<>();
}
if(serviceId.equals(576)){
userRegionMap.put("method","block");
userRegionMap.put("code",404);
userRegionMap.put("message","");
userRegionMap.put("html_profile",0);
return gsonToJson(userRegionMap);
}else if(serviceId.equals(512)){
if(userRegionMap.isEmpty()){
//keyring
userRegionMap.put("keyring", 1);
Map<String,Object> map = new HashMap();
//exclusions
map.put("ev_cert", 0);
map.put("cert_transparency", 0);
map.put("pinning", 1);
map.put("client_cert_req", 1);
map.put("protocol_errors", 1);
userRegionMap.put("exclusions", map);
//cert_verify
Map<String,Object> map1=new HashMap<>();
map=new HashMap<>();
map.put("cn",1);
map.put("issuer",1);
map.put("self-signed",1);
map.put("expiration",1);
map1.put("approach", map);
userRegionMap.put("cert_verify", map1);
//ssl_ver
map=new HashMap<>();
map.put("mirror_client", 1);
map.put("allow_http2", 1);
// map.put("min", "ssl3");
// map.put("max", "tls13");
userRegionMap.put("ssl_ver", map);
//decrypt_mirror
map=new HashMap<>();
map.put("enable", 0);
userRegionMap.put("decrypt_mirror", map);
}
return gsonToJson(userRegionMap);
}else if(serviceId.equals(592)){
return "{}";
}else{
return "0";
}
}
public static Map<String,Object> convertCommonGroupMaatTable(CfgIndexInfo cfgIndexInfo, List<Map<String, Object>> cfgList){
Map<String,Object> maatTableMap=new HashMap<>();
Map<String,Object> commonGroupIds= MapUtils.isEmpty(cfgIndexInfo.getUserRegion())?(Map<String,Object>)gsonFromJson(cfgIndexInfo.getCommonGroupIds(),Map.class):cfgIndexInfo.getUserRegion();
for (Map<String, Object> map : cfgList) {
String cfgType = map.get("cfgType").toString();
if (cfgType.equals("1")) {
if(commonGroupIds.containsKey("ipGroup")&&map.containsKey("maatTable")){
Map<String,String> ipMaatMap=new HashMap<>();
for(String group:commonGroupIds.get("ipGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
ipMaatMap.put(group,map.get("maatTable").toString());
}
}
maatTableMap.put("ipMaatTable",ipMaatMap);
}
if(map.containsKey("protocolMaatTable")){
maatTableMap.put("protocolMaatTable",map.get("protocolMaatTable").toString());
}
} else if (cfgType.equals("2")) {
String _maatTable = map.containsKey("maatTable")?map.get("maatTable").toString():null;
Map<String,String> stringMaatMap=new HashMap<>();
if(StringUtils.isNotBlank(_maatTable)){
if(commonGroupIds.containsKey("urlGroup")&&_maatTable.toUpperCase().contains("URL")){
for(String group:commonGroupIds.get("urlGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
stringMaatMap.put(group,_maatTable);
}
}
}
if(commonGroupIds.containsKey("domainGroup")&&_maatTable.toUpperCase().contains("DOMAIN")){
for(String group:commonGroupIds.get("domainGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
stringMaatMap.put(group,_maatTable);
}
}
}
if(commonGroupIds.containsKey("subscribeIdGroup")&&_maatTable.toUpperCase().contains("SUBSCRIBE_ID")){
for(String group:commonGroupIds.get("subscribeIdGroup").toString().split(",")){
if(StringUtils.isNotBlank(group)){
stringMaatMap.put(group,_maatTable);
}
}
}
}
if(maatTableMap.containsKey("stringMaatTable")){
((Map<String,String>)maatTableMap.get("stringMaatTable")).putAll(stringMaatMap);
}else{
maatTableMap.put("stringMaatTable",stringMaatMap);
}
}
}
return maatTableMap;
}
/**
* 获取obj-list-group业务的function_service_dict
* @param functionId
* @return
*/
public static Map<Integer,FunctionServiceDict> objGetServiceDict(Integer functionId){
Map<Integer,FunctionServiceDict> dictMap=new HashMap<>();
ServiceConfigTemplateUtil util=new ServiceConfigTemplateUtil();
List<Map<String,Object>> list=util.getServiceListByFunctionId(functionId);
for(Map<String,Object> map:list){
if(map.containsKey("serviceIds")){
String serviceIds=map.get("serviceIds").toString();
for(String serviceId:serviceIds.split(",")){
List<Map<String,Object>> _mapList=util.getServiceListByServiceId(Integer.parseInt(serviceId));
for(Map<String,Object> _map:_mapList){
if(_map.containsKey("functionId")){
List<FunctionServiceDict> dictList=DictUtils.getFunctionServiceDictList(Integer.parseInt(_map.get("functionId").toString()));
for(FunctionServiceDict dict:dictList){
dictMap.put(dict.getServiceId(),dict);
}
}
}
}
}else{
if(map.containsKey("functionId")){
List<FunctionServiceDict> dictList=DictUtils.getFunctionServiceDictList(Integer.parseInt(map.get("functionId").toString()));
for(FunctionServiceDict dict:dictList){
dictMap.put(dict.getServiceId(),dict);
}
}
}
}
return dictMap;
}
public static <T>List<Integer> calRangeIps(List<T> srcList ){
List<Integer> regionIdsList=new ArrayList<>();
int total=0;
//通过反射获取IP的src ip地址目的IP地址
Class clazz=null;
Field srcIpAddressField=null,destIpAddressField=null,ipTypeFild=null;
for(T instance:srcList){
if(clazz==null&&srcIpAddressField==null&&destIpAddressField==null){
try {
clazz=instance.getClass();
srcIpAddressField=clazz.getDeclaredField("srcIpAddress");
srcIpAddressField.setAccessible(true);
destIpAddressField=clazz.getDeclaredField("destIpAddress");
destIpAddressField.setAccessible(true);
ipTypeFild=clazz.getDeclaredField("ipType");
ipTypeFild.setAccessible(true);
} catch (NoSuchFieldException e) {
return regionIdsList;
}
}
try {
String srcIpAddressValue=(String)srcIpAddressField.get(instance);
String destIpAddressValue=(String)destIpAddressField.get(instance);
Integer ipType=(Integer)ipTypeFild.get(instance);
if(ipType.equals(4)){
long left=1,right=1;
if(srcIpAddressValue.indexOf("-")>-1){
String[] srcIpAddressValueArray=srcIpAddressValue.split("-");
int startPos=0,endPos=0;
startPos=Integer.parseInt(srcIpAddressValueArray[0].split("\\.")[3]);
endPos=Integer.parseInt(srcIpAddressValueArray[1].split("\\.")[3]);
left=endPos-startPos+1;
}
if(destIpAddressValue.indexOf("-")>-1){
String[] destIpAddressValueArray=destIpAddressValue.split("-");
int startPos=0,endPos=0;
startPos=Integer.parseInt(destIpAddressValueArray[0].split("\\.")[3]);
endPos=Integer.parseInt(destIpAddressValueArray[1].split("\\.")[3]);
right=endPos-startPos+1;
}
total+=left*right;
}else{
continue;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
return regionIdsList;
}
}
if(total>0){
regionIdsList=ConfigServiceUtil.getId(3,total);
}
return regionIdsList;
}
}

View File

@@ -968,7 +968,6 @@ public class ConfigServiceUtil {
return result;
}
public static void main(String[] args) {
try {
// getId(1,1);

View File

@@ -8,17 +8,6 @@ import java.util.regex.Pattern;
import com.google.gson.GsonBuilder;
public final class Constants {
/**
* json打印长度
*/
public static Integer JSON_PRINT_LENTH=Configurations.getIntProperty("json_print_length", 100000);
/**
* obj group list group type
*/
public static Integer IP_OBJ_GROUP_TYPE=Configurations.getIntProperty("ip_obj_group_type", 5);
public static Integer URL_OBJ_GROUP_TYPE=Configurations.getIntProperty("url_obj_group_type", 7);
public static Integer SUBID_OBJ_GROUP_TYPE=Configurations.getIntProperty("subid_obj_group_type", 9);
public static Integer DOMAIN_OBJ_GROUP_TYPE=Configurations.getIntProperty("domain_obj_group_type", 8);
/**
* 导入条数限制
*/
@@ -196,22 +185,6 @@ public final class Constants {
* DNS 策略组KEY
*/
public static final String CACHE_DNSGROUP_DICT = "dnsGroupDict";
/**
* IP公共组缓存KEY
*/
public static final String CACHE_IPGROUP_DICT = "ipComGroupDict";
/**
* URL公共组缓存KEY
*/
public static final String CACHE_URLGROUP_DICT = "urlComGroupDict";
/**
* Domain公共组缓存KEY
*/
public static final String CACHE_DOMAINGROUP_DICT = "domainComGroupDict";
/**
* ScriberId公共组缓存KEY
*/
public static final String CACHE_SCRIBERGROUP_DICT = "scriberComGroupDict";
/**
* 词典数据分类
*/
@@ -724,14 +697,8 @@ public final class Constants {
public static final String CERT_FILE_PATH=Configurations.getStringProperty("cert_file_path", "");
//证书校验文件
public static final String CERT_VALIDATE_FILE=Configurations.getStringProperty("cert_validate_file", "x509");
public static final String CA_CERT_FILE=Configurations.getStringProperty("ca_cert_file", "cacert.sh");
public static final String CA_CERT_DIR=Configurations.getStringProperty("ca_cert_dir", "/home/cacert/");
//证书校验成功关键字
public static final String CERT_VALIDATE_SUCCESS_INFO=Configurations.getStringProperty("cert_validate_success_info", "x509");
//内置证书的isser
public static final String KEYRING_BUILT_IN_ISSER=Configurations.getStringProperty("keyring_built_in_isser", "||CN=Tango Secure Gateway CA, O=Maserati Solution||CN=Tango Secure Gateway CA UNTRUST, O=Maserati Solution||");
//内置证书的指纹
public static final String KEYRING_BUILT_IN_FINGERPRINT=Configurations.getStringProperty("keyring_built_in_fingerprint", "||ee23abb40085901c12f574d610153c008d49e6a0||3475833f1a9525b4ad7fbee06dfa3e4a8de0c1e0||");
/**
* 一些正则的pattern预先编译,避免多次编译
*/
@@ -828,46 +795,4 @@ public final class Constants {
* 管理员用户预警查询服务配置总量接口
*/
public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService","");
/**
* 获取配置统计页面列表的配置总量接口
*/
public static final String NTC_PZ_COUNT_REPORT = Configurations.getStringProperty("ntcPzCountReport","");
/**
* 查询的是流量统计菜单-配置统计中BandWidth统计的数据接口
*/
public static final String TRAFFIC_BANDWIDTH_TRANS_THREE_NEW=Configurations.getStringProperty("trafficBandwidthTransThreeNew","trafficBandwidthTransThreeNew");
/**
* 查询的是流量统计菜单-配置统计中RulesType统计的数据接口
*/
public static final String NTC_ACTION_ENTRANCE_REPORT_NEW=Configurations.getStringProperty("ntcActionEntranceReportNew","ntcActionEntranceReportNew");
/**
* 查询的是流量统计菜单-配置统计中Protocol统计的数据接口
*/
public static final String TRAFFIC_PROTOCOL_STATISTIC_NEW=Configurations.getStringProperty("trafficProtocolStatisticNew","trafficProtocolStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中APP统计的数据接口
*/
public static final String TRAFFIC_APP_STATISTIC_NEW=Configurations.getStringProperty("trafficAppStatisticNew","trafficAppStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中Domains统计的数据接口
*/
public static final String TRAFFIC_DOMAIN_STATISTIC_NEW=Configurations.getStringProperty("trafficDomainStatisticNew","trafficDomainStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中ClientIP统计的数据接口
*/
public static final String TRAFFIC_SOURCE_IP_STATISTIC_NEW=Configurations.getStringProperty("trafficSourceIPStatisticNew","trafficSourceIPStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中ServerIP统计的数据接口
*/
public static final String TRAFFIC_DEST_IP_STATISTIC_NEW=Configurations.getStringProperty("trafficDestIPStatisticNew","trafficDestIPStatisticNew");
/**
* 查询的是流量统计菜单-配置统计中SubscriberID统计的数据接口
*/
public static final String TRAFFIC_SUBSCRIBER_ID_STATISTIC_NEW=Configurations.getStringProperty("trafficSubscriberIDStatisticNew","trafficSubscriberIDStatisticNew");
/**
* HTTP(S)操控日志接口
*/
public static final String POLICY_EVENT=Configurations.getStringProperty("policyevent","policyevent");
}

View File

@@ -14,14 +14,12 @@ import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysDataDictionaryName;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.web.dao.FunctionRegionDictDao;
import com.nis.web.dao.FunctionServiceDictDao;
import com.nis.web.dao.SysDictDao;
import com.nis.web.dao.basics.CommonGroupManageDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.dao.configuration.DnsResStrategyDao;
@@ -44,7 +42,6 @@ public class DictUtils {
private final static FunctionServiceDictDao functionServiceDictDao = SpringContextHolder.getBean(FunctionServiceDictDao.class);
private final static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class);
private final static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
private final static CommonGroupManageDao commonGroupManageDao = SpringContextHolder.getBean(CommonGroupManageDao.class);
public static Map<String, List<SysDataDictionaryItem>> getDictData() {
@@ -404,38 +401,4 @@ public class DictUtils {
}
return null;
}
/**
* 获取公共组字典缓存
*/
/*public static List<CommonGroupInfo> getCommonGroups(Integer groupType){
String dictKey = Constants.CACHE_IPGROUP_DICT;
if(groupType.equals(7)) {
dictKey = Constants.CACHE_URLGROUP_DICT;
}else if(groupType.equals(8)) {
dictKey = Constants.CACHE_DOMAINGROUP_DICT;
}else if(groupType.equals(9)) {
dictKey = Constants.CACHE_SCRIBERGROUP_DICT;
}
List<CommonGroupInfo> allDictList = (List<CommonGroupInfo>)CacheUtils.get(dictKey);
if(StringUtil.isEmpty(allDictList)){
allDictList = commonGroupManageDao.findCommonGroupInfosByType(groupType);
CacheUtils.put(dictKey, allDictList);
}
return allDictList;
}
public static CommonGroupInfo getCommonGroups(Integer groupId, Integer groupType){
List<CommonGroupInfo> allDictList = getCommonGroups(groupType);
if(StringUtil.isEmpty(allDictList)){
}else {
for(CommonGroupInfo group:allDictList) {
if(group.getServiceGroupId().equals(groupId)) {
return group;
}
}
}
return null;
}*/
}

View File

@@ -1,17 +1,13 @@
package com.nis.util;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.basics.*;
import com.nis.domain.configuration.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.config.IniSecurityManagerFactory;
@@ -23,9 +19,26 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.callback.InlineIp;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.DnsIpCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.FileDigestCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.domain.configuration.PxyObjTrustedCaCert;
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ManipulatActionParam;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToUpdateMaatBeanStatus;
@@ -78,7 +91,6 @@ public class SchedulerTaskUtil {
String tableName = service.get("tableName").toString();
String serviceType = service.get("serviceType").toString();
String className = service.get("className").toString();
String functionId= service.get("functionId").toString();
BaseCfg entity = new BaseCfg();
entity.setServiceId(serviceId);
entity.setTableName(tableName);
@@ -108,14 +120,6 @@ public class SchedulerTaskUtil {
List<BaseStringCfg> strList = new ArrayList();
List<ComplexkeywordCfg> complexStrList = new ArrayList();
List<com.nis.domain.configuration.NumBoundaryCfg> numList = new ArrayList();
//公共分组
boolean isCommonGroup=false;
List<IpCommCfg> ipCommCfgList=new ArrayList<>();
List<UrlCommCfg> urlCommCfgList=new ArrayList<>();
List<ScriberIdCommCfg> scriberIdCommCfgList=new ArrayList<>();
List<DomainCommCfg> domainCommCfgList=new ArrayList<>();
Map<String,Object> commGroupMap=new HashMap<>();
Set<Integer> groupIdSet=new HashSet<>();
List<FileDigestCfg> fileList = new ArrayList();
maatBean = new ToMaatBean();
configCompileList = new ArrayList();
@@ -127,71 +131,39 @@ public class SchedulerTaskUtil {
List<Map<String,Object>> userRegionList = (List<Map<String, Object>>) service.get("userRegionList");
entity.setCompileId(compileId);
compileIds.add(compileId);
Map<Integer, FunctionServiceDict> serviceDictMap=ConfigConvertUtil.objGetServiceDict(Integer.parseInt(functionId));
//查询配置
if("cfg_index_info".equals(tableName)){
List<CfgIndexInfo> list = configSynchronizationDao.getCfgIndexList(entity);
if(CollectionUtils.isNotEmpty(list)&&StringUtils.isNotBlank(list.get(0).getCommonGroupIds())){
isCommonGroup=true;
}
if(isIssueContent.equals(1)){
//用于存储自定义域为关键字的业务key=compileIdvalue=keyword.
Map<Integer, BaseStringCfg> keywordMap=new HashMap<>();
//查询子域配置详情
if(cfgList!=null){
if(isCommonGroup){
groupIdSet=new HashSet<>();
commGroupMap=ConfigConvertUtil.gsonFromJson(list.get(0).getCommonGroupIds(),Map.class);
//将组中的域设置到cfg_index_info中
covertCommongroupIdsMap(commGroupMap,"ipGroup",list.get(0),configSynchronizationDao,IpCommCfg.class);
if(CollectionUtils.isNotEmpty(list.get(0).getIpCommGroupCfgList())){
ipCommCfgList.addAll(list.get(0).getIpCommGroupCfgList());
}
covertCommongroupIdsMap(commGroupMap,"urlGroup",list.get(0),configSynchronizationDao,UrlCommCfg.class);
if(CollectionUtils.isNotEmpty(list.get(0).getUrlCommGroupList())){
urlCommCfgList.addAll(list.get(0).getUrlCommGroupList());
}
covertCommongroupIdsMap(commGroupMap,"subscribeIdGroup",list.get(0),configSynchronizationDao,ScriberIdCommCfg.class);
if(CollectionUtils.isNotEmpty(list.get(0).getScriberIdCommGroupList())){
scriberIdCommCfgList.addAll(list.get(0).getScriberIdCommGroupList());
}
covertCommongroupIdsMap(commGroupMap,"domainGroup",list.get(0),configSynchronizationDao,DomainCommCfg.class);
if(CollectionUtils.isNotEmpty(list.get(0).getDomainCommGroupList())){
domainCommCfgList.addAll(list.get(0).getDomainCommGroupList());
}
}else{
for(Map<String,Object> m:cfgList){
String regionTable = m.get("tableName").toString();
if("1".equals(m.get("cfgType"))){
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds));
}else if("2".equals(m.get("cfgType"))){
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds));
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
if(/*entity.getServiceId()==512
||*/entity.getServiceId()==521
||entity.getServiceId()==514
||entity.getServiceId()==1026) {
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds);
}
}else if("3".equals(m.get("cfgType"))){
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
}else if("4".equals(m.get("cfgType"))){
}else if("5".equals(m.get("cfgType"))){
fileList.addAll(configSynchronizationDao.getFileDigestList(regionTable, compileIds));
for(Map<String,Object> m:cfgList){
String regionTable = m.get("tableName").toString();
if("1".equals(m.get("cfgType"))){
ipList.addAll(configSynchronizationDao.getIpPortList(regionTable, compileIds));
}else if("2".equals(m.get("cfgType"))){
strList.addAll(configSynchronizationDao.getStrList(regionTable,compileIds));
//512/521/514/1026业务的用户自定义域取DOMAIN_STR取自Keyword
if(entity.getServiceId()==512
||entity.getServiceId()==521
||entity.getServiceId()==514
||entity.getServiceId()==1026) {
keywordMap=configSynchronizationDao.getCompileIdWithKeyword(regionTable, compileIds);
}
}else if("3".equals(m.get("cfgType"))){
complexStrList.addAll(configSynchronizationDao.getComplexStrList(regionTable,compileIds));
}else if("4".equals(m.get("cfgType"))){
}else if("5".equals(m.get("cfgType"))){
fileList.addAll(configSynchronizationDao.getFileDigestList(regionTable, compileIds));
}
}
}
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号分组复用的域配置不需要重新获取regionId,groupId
List<Integer> regionIds=new ArrayList<>(),groupIds=new ArrayList<>();
if(!isCommonGroup){
regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
}
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
entity.setAuditTime(updateTime);
for(CfgIndexInfo cfg:list){
@@ -201,236 +173,150 @@ public class SchedulerTaskUtil {
numRegionList = new ArrayList();
digestRegionList = new ArrayList();
areaIpRegionList = new ArrayList();
if(StringUtils.isNotBlank(cfg.getCommonGroupIds())){//公共分组
//处理自定义域
StringBuffer userRegion = new StringBuffer();
userRegion.append(ConfigConvertUtil.generateCommonGroupDefaultUserRegion(null,cfg.getServiceId()));
//子配置
Map<String,Object> maatTableMap=ConfigConvertUtil.convertCommonGroupMaatTable(cfg,cfgList);
//IP公共分组
if(CollectionUtils.isNotEmpty(cfg.getIpCommGroupCfgList())){
IpPortCfg _cfg = new IpPortCfg();
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
Map<String,List> map = ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,ipRegionList,cfg.getIpCommGroupCfgList(),1,_cfg,groupRelationList,maatTableMap,groupIdSet);
groupRelationList=map.get("groupList");
ipRegionList=map.get("dstList");
if(map.get("numRegionList")!=null){
numRegionList.addAll(map.get("numRegionList"));
}
}
//URL公共分组
if(CollectionUtils.isNotEmpty(cfg.getUrlCommGroupList())){
CommonStringCfg _cfg = new CommonStringCfg();
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getUrlCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
//账号公共分组
if(CollectionUtils.isNotEmpty(cfg.getScriberIdCommGroupList())){
CommonStringCfg _cfg = new CommonStringCfg();
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getScriberIdCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
//域名公共分组
if(CollectionUtils.isNotEmpty(cfg.getDomainCommGroupList())){
CommonStringCfg _cfg = new CommonStringCfg();
BeanUtils.copyProperties(cfg, _cfg, new String[]{"cfgId","menuNameCode"});
Map<String,List> map =ConfigConvertUtil.objGroupCfgConvert(serviceDictMap,strRegionList,cfg.getDomainCommGroupList(),2,_cfg,groupRelationList,maatTableMap,groupIdSet);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
BeanUtils.copyProperties(cfg, maatCfg);
if(cfg.getServiceId().equals(512)){
maatCfg.setAction(2);
}else{
maatCfg.setAction(cfg.getAction());
}
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
if(!StringUtil.isEmpty(userRegion.toString())){
maatCfg.setUserRegion(userRegion.toString());
}
configCompileList.add(maatCfg);
}else{//非公共分组
List list1 = new ArrayList();
List<BaseStringCfg> list2 = new ArrayList();
List<ComplexkeywordCfg> list3 = new ArrayList();
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList();
List<FileDigestCfg> list5 = new ArrayList();
String userRegion = "";
//处理自定义域
if(userRegionList!=null){
for(Map<String,Object> n:userRegionList){
Object userRegionPosition = n.get("userRegionPosition");
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){
//通过反射机制获取自定义域字段值
String regionColumn = n.get("regionColumn").toString();
String regionKey = n.get("regionKey").toString();
Object value = "";
Class aClass = null;
if(userRegionPosition.toString().equals(("0"))){
aClass = BaseCfg.class;
}else{
aClass = CfgIndexInfo.class;
}
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
String[] regionArray = regionColumn.split(",");
for(int r=0;r<regionArray.length;r++){
Field field = aClass.getDeclaredField(regionArray[r]);
field.setAccessible(true);
if(n.get("regionKey").equals("substitute")){
value += "/"+BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());//自定义域以/分割时的处理
}else{
value += BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());
}
List list1 = new ArrayList();
List<BaseStringCfg> list2 = new ArrayList();
List<ComplexkeywordCfg> list3 = new ArrayList();
List<com.nis.domain.configuration.NumBoundaryCfg> list4 = new ArrayList();
List<FileDigestCfg> list5 = new ArrayList();
String userRegion = "";
//处理自定义域
if(userRegionList!=null){
for(Map<String,Object> n:userRegionList){
Object userRegionPosition = n.get("userRegionPosition");
if(userRegionPosition!=null && (userRegionPosition.toString().equals("1")||userRegionPosition.toString().equals("0"))){
//通过反射机制获取自定义域字段值
String regionColumn = n.get("regionColumn").toString();
String regionKey = n.get("regionKey").toString();
Object value = "";
Class aClass = null;
if(userRegionPosition.toString().equals(("0"))){
aClass = BaseCfg.class;
}else{
aClass = CfgIndexInfo.class;
}
if(entity.getServiceId().equals(517)||entity.getServiceId().equals(560)){//代理替换策略
String[] regionArray = regionColumn.split(",");
for(int r=0;r<regionArray.length;r++){
Field field = aClass.getDeclaredField(regionArray[r]);
field.setAccessible(true);
if(n.get("regionKey").equals("substitute")){
value += "/"+BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());//自定义域以/分割时的处理
}else{
value += BaseService.replaceContentEscape(field.get(cfg)==null?"":field.get(cfg).toString());
}
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
}else{
/*if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){
}
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
}else{
if(regionKey.equals("keyring_id") && StringUtil.isEmpty(value)){
value = "0";
}else*/ if(regionKey.equals("DOMAIN_STR")) {
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
value = keywordMap.get(cfg.getCompileId()).getCfgKeywords();
}
}else if(regionKey.equals("DOMAIN_ID")) {
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
value = cfg.getCompileId();
}
}else {
Field field = aClass.getDeclaredField(regionColumn);
field.setAccessible(true);
value = field.get(cfg);
}else if(regionKey.equals("DOMAIN_STR")) {
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
value = keywordMap.get(cfg.getCompileId()).getCfgKeywords();
}
if(!StringUtil.isEmpty(value)){
if(StringUtil.isEmpty(n.get("regionKey"))){
userRegion = value.toString();
}else{
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
}
}else if(regionKey.equals("DOMAIN_ID")) {
if(!StringUtil.isEmpty(keywordMap) && !StringUtil.isEmpty(keywordMap.get(cfg.getCompileId()))) {
value = cfg.getCompileId();
}
}else {
Field field = aClass.getDeclaredField(regionColumn);
field.setAccessible(true);
value = field.get(cfg);
}
if(!StringUtil.isEmpty(value)){
if(StringUtil.isEmpty(n.get("regionKey"))){
userRegion = value.toString();
}else{
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
}
}
}
}
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
userRegion = userRegion.substring(0, userRegion.length()-1);
}
}
// Proxy Block --xml无法描述的user_region
if(entity.getServiceId().equals(576)) {
ManipulatActionParam actionParam = new ManipulatActionParam();
actionParam.setMethod("block");
actionParam.setCode(Integer.valueOf(cfg.getUserRegion1()));
actionParam.setMessage(!StringUtil.isBlank(cfg.getUserRegion2()) ? cfg.getUserRegion2():"");
actionParam.setHtml_profile(Integer.valueOf(!StringUtil.isBlank(cfg.getUserRegion3()) ? cfg.getUserRegion3():"0"));
userRegion = StringEscapeUtils.unescapeJson(BaseService.gsonToJson(actionParam));
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
userRegion = userRegion.substring(0, userRegion.length()-1);
}
// Proxy Manipulate
if(entity.getServiceId().equals(656)) {
userRegion = BaseService.setUserRegionOfMantipulateCfg(cfg, userRegion);
}
//Intercept Policy、http(s) 监测 、http(s) 白名单
else if(entity.getServiceId().equals(521) || entity.getServiceId().equals(592)
|| entity.getServiceId().equals(750)) {
userRegion="{}";
}
for(AsnIpCfg ip:asnIpList){//asn不需要再次获取regionId,groupId
if(ip.getAsnIpGroup().toString().equals(cfg.getUserRegion4())){//根据组号对应
ip.setIsValid(entity.getIsValid());
ip.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
list1.add(ip);
}
}
//ip spoofing
if(cfg.getServiceId().equals(518)){
//IP仿冒策略
//仿冒IP池配置匹配下发或者取消
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
// pxyObjSpoofingIpPoolDao.update(pool);
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
pool.setIsValid(entity.getIsValid());
pool.setIsAudit(entity.getIsAudit());
pool.setAuditorId(entity.getAuditorId());
pool.setAuditTime(entity.getAuditTime());
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
String json="";
String areaEffectiveIds="0";
if(isValid==1){
pool.setAreaEffectiveIds(areaEffectiveIds);
pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID
poolList.add(pool);
//调用服务接口下发配置数据
json=BaseService.gsonToJson(poolList);
logger.info("欺骗IP池配置下发配置参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){
logger.info("欺骗IP池配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("欺骗IP池配置配置下发失败",e);
throw e;
}
}
}
if(list1.size()>0){
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ConfigConvertUtil.groupReuseCfgAddRemoveConvert(list1,Constants.VALID_YES,null));
}else if(!StringUtil.isEmpty(asnGroupIds)) {
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ipRegionList);
}
//配置域转换
userRegion = ConfigConvertUtil.configCovert(ipList,strList,complexStrList,
numList,fileList,regionIds,groupIds,entity,cfg.getCompileId(),
StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime(),
groupRelationList,ipRegionList,strRegionList,numRegionList,digestRegionList,areaIpRegionList,userRegion);
BeanUtils.copyProperties(cfg, maatCfg);
maatCfg.setAction(cfg.getAction());
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
if(!StringUtil.isEmpty(userRegion)){
maatCfg.setUserRegion(userRegion);
}
configCompileList.add(maatCfg);
}
for(AsnIpCfg ip:asnIpList){//asn不需要再次获取regionId,groupId
if(ip.getAsnIpGroup().toString().equals(cfg.getUserRegion4())){//根据组号对应
ip.setIsValid(entity.getIsValid());
ip.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
list1.add(ip);
}
}
//ip spoofing
if(cfg.getServiceId().equals(518)){
//IP仿冒策略
//仿冒IP池配置匹配下发或者取消
PxyObjSpoofingIpPool pool=new PxyObjSpoofingIpPool();
pool.setCfgId(Long.valueOf(cfg.getUserRegion3()));
// pxyObjSpoofingIpPoolDao.update(pool);
pool = configSynchronizationDao.getPxyObjSpoofingIpPool(pool.getCfgId());
pool.setIsValid(entity.getIsValid());
pool.setIsAudit(entity.getIsAudit());
pool.setAuditorId(entity.getAuditorId());
pool.setAuditTime(entity.getAuditTime());
List<PxyObjSpoofingIpPool> poolList = new ArrayList<PxyObjSpoofingIpPool>();
String json="";
String areaEffectiveIds="0";
if(isValid==1){
pool.setAreaEffectiveIds(areaEffectiveIds);
pool.setGroupId(pool.getCfgId().intValue());//界面端的配置ID作为策略分组ID
poolList.add(pool);
//调用服务接口下发配置数据
json=BaseService.gsonToJson(poolList);
logger.info("欺骗IP池配置下发配置参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){
logger.info("欺骗IP池配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("欺骗IP池配置配置下发失败",e);
throw e;
}
}
}
if(list1.size()>0){
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ConfigConvertUtil.groupReuseCfgAddRemoveConvert(list1,Constants.VALID_YES,null));
}else if(!StringUtil.isEmpty(asnGroupIds)) {
GroupCfg groupCfg=new GroupCfg();
groupCfg.setCompileId(cfg.getCompileId());
groupCfg.setGroupId(Integer.parseInt(cfg.getUserRegion4()));
groupCfg.setIsValid(entity.getIsValid());
groupCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
groupRelationList.add(groupCfg);
ipRegionList.addAll(ipRegionList);
}
//配置域转换
userRegion = ConfigConvertUtil.configCovert(ipList,strList,complexStrList,
numList,fileList,regionIds,groupIds,entity,cfg.getCompileId(),
StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime(),
groupRelationList,ipRegionList,strRegionList,numRegionList,digestRegionList,areaIpRegionList,userRegion);
BeanUtils.copyProperties(cfg, maatCfg);
maatCfg.setAction(cfg.getAction());
maatCfg.setAuditTime(StringUtil.isEmpty(entity.getAuditTime()) ? cfg.getAuditTime():entity.getAuditTime());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
if(!StringUtil.isEmpty(userRegion)){
maatCfg.setUserRegion(userRegion);
}
configCompileList.add(maatCfg);
}
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(new Date());
@@ -438,11 +324,7 @@ public class SchedulerTaskUtil {
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
String json=BaseService.gsonToJson(maatBean);
if(json.length()<Constants.JSON_PRINT_LENTH){
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容"+json);
}else{
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容超过"+Constants.JSON_PRINT_LENTH+",不打印");
}
logger.info("定时任务修改NTC/PROXY策略的MAAT配置内容"+json);
//调用服务接口修改配置内容与状态
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
if(result!=null){
@@ -1116,28 +998,5 @@ public class SchedulerTaskUtil {
}
public static void main(String[] args) {
}
private void covertCommongroupIdsMap(Map commGroupMap,String key,CfgIndexInfo cfg,ConfigSynchronizationDao configSynchronizationDao,Class clazz){
if(commGroupMap.containsKey(key)){
String groups=commGroupMap.get(key).toString();
List<Integer> _groupIds=new ArrayList<>();
for(String group:groups.split(",")){
if(StringUtils.isNotBlank(group)){
_groupIds.add(Integer.parseInt(group));
}
}
if(_groupIds.size()>0){
if("IpCommCfg".equals(clazz.getSimpleName())){
cfg.setIpCommGroupCfgList(configSynchronizationDao.getIpCommCfgPortList(_groupIds));
}else if("UrlCommCfg".equals(clazz.getSimpleName())){
cfg.setUrlCommGroupList(configSynchronizationDao.getUrlCommCfgPortList(_groupIds));
}else if("ScriberIdCommCfg".equals(clazz.getSimpleName())){
cfg.setScriberIdCommGroupList(configSynchronizationDao.getSubscribeIdCommCfgPortList(_groupIds));
}else if("DomainCommCfg".equals(clazz.getSimpleName())){
cfg.setDomainCommGroupList(configSynchronizationDao.getDomainCommCfgPortList(_groupIds));
}
}
}
}
}

View File

@@ -319,18 +319,6 @@ public class ExcelCsv {
dict="action_spoofing";
val = msgProp.getProperty(dict,dict);
}
//http(s) manipulate 导出action修改为Manipulate
if(ef.title().equals("block_type")
&& dict.equals("action_redirect")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("656"))) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
if(ef.title().equals("action")
&& dict.equals("action_redirect")) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
}
}

View File

@@ -23,7 +23,6 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
@@ -50,9 +49,7 @@ import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.Encodes;
@@ -61,8 +58,6 @@ import com.nis.util.StringUtil;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.dao.configuration.DnsResStrategyDao;
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
import com.nis.web.service.SpringContextHolder;
/**
@@ -77,8 +72,6 @@ public class ExportExcel {
private static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class);
private static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
private static SysDictInfoDao sysDictInfoDao = SpringContextHolder.getBean(SysDictInfoDao.class);
private static PxyObjKeyringDao pxyObjKeyringDao = SpringContextHolder.getBean(PxyObjKeyringDao.class);
private static ProxyFileTrafficMirrorDao proxyFileDao = SpringContextHolder.getBean(ProxyFileTrafficMirrorDao.class);
/**
* 工作薄对象
@@ -302,7 +295,7 @@ public class ExportExcel {
}
}
/*** HTTP(s)替换 搜索区域 ***/
if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209) || region.getAction().equals(80))){
if(("replace_zone".equals(headerStr)) && (region.getFunctionId().equals(209))){
commentStr="";
List<SysDataDictionaryItem> dict=DictUtils.getDictList("CONTROL_REPLACE_ZONE");
if(dict !=null && dict.size()>0){
@@ -465,27 +458,18 @@ public class ExportExcel {
}
}
// IP、URL、Domain和ScriberId公共组
if("group_name".equals(headerStr)) {
if("ip_group".equals(headerStr)) {
commentStr="";
List<PolicyGroupInfo> list = null;
if(region.getFunctionId().equals(605)) {
list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.IP_OBJ_GROUP_TYPE);
}else if(region.getFunctionId().equals(606)) {
list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
}else if(region.getFunctionId().equals(607)) {
list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
}else if(region.getFunctionId().equals(608)) {
list=policyGroupInfoDao.findPolicyGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
}
if(!StringUtil.isEmpty(list)){
for (PolicyGroupInfo policyGroupInfo : list) {
commentStr=commentStr+policyGroupInfo.getGroupName()+"\n";
index++;
//查询dns fake ip policyGroup列表
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfosByType(5);
if(!StringUtil.isEmpty(list)){
for (PolicyGroupInfo policyGroupInfo : list) {
commentStr=commentStr+policyGroupInfo.getServiceGroupId()+""+policyGroupInfo.getGroupName()+"\n";
index++;
}
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
}
if("isp".equals(headerStr)) {
commentStr="";
@@ -603,393 +587,7 @@ public class ExportExcel {
commentStr=commentStr+""+msgProp.getProperty("ip_check")+"(IPv4)\n";
index++;
}
/**********************************************************************pxy intercept************************************************************************************************************/
//pxy intercept
if("pxy_intercept_monit_keyring".equals(headerStr)) {
commentStr="";
List<PxyObjKeyring> certificateList=pxyObjKeyringDao.findList(null,1,1,"ip");
if(CollectionUtils.isNotEmpty(certificateList)) {
for (PxyObjKeyring certificate : certificateList) {
commentStr=commentStr+certificate.getCompileId()+""+certificate.getCfgDesc()+"\n";
index++;
}
}
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
/*//2、默认值说明
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
index++;*/
index++;
}
}
//ev_cert
if("exclusions_ev_cert".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
index++;
index++;
}
}
//cert_transparency
if("exclusions_cert_transparency".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
index++;
index++;
}
}
//client_cert_req
if("exclusions_client_cert_req".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//pinning
if("exclusions_pinning".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//pinning
if("exclusions_protocol_errors".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//cn
if("cert_verify_approach_cn".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//issuer
if("cert_verify_approach_issuer".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//self-signed
if("cert_verify_approach_self_signed".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//expiration
if("cert_verify_approach_expiration".equals(headerStr)) {
commentStr="";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
index++;
index++;
}
}
//fail_method
if("cert_verify_fail_method".equals(headerStr)) {
commentStr="";
defaultValue="pass-through";
List<SysDataDictionaryItem> failMethods=DictUtils.getDictList("FAIL_METHOD");
if(CollectionUtils.isNotEmpty(failMethods)){
for (SysDataDictionaryItem failMethod : failMethods) {
commentStr=commentStr+failMethod.getItemCode()+""+msgProp.getProperty(failMethod.getItemValue(),failMethod.getItemValue())+""+"\n";
index++;
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
if(StringUtil.isEmpty(defaultValue)){
defaultValue = region.getConfigDirection().split(",")[0];
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
}
//fail_method
if("ssl_ver_mirror_client".equals(headerStr)) {
commentStr="";
defaultValue="1";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
commentStr=commentStr+""+msgProp.getProperty("ssl_ver_mirror_client_on","if the mirror client option value is '1', the min SSL version and the max SSL version will be ignored")+"\n";
index++;
}
//min
if("ssl_ver_min".equals(headerStr)) {
commentStr="";
defaultValue="ssl3";
List<SysDataDictionaryItem> sslversions=DictUtils.getDictList("SSL_VERSION");
if(CollectionUtils.isNotEmpty(sslversions)){
for (SysDataDictionaryItem sslversion : sslversions) {
commentStr=commentStr+sslversion.getItemCode()+""+msgProp.getProperty(sslversion.getItemValue(),sslversion.getItemValue())+""+"\n";
index++;
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
}
//max
if("ssl_ver_max".equals(headerStr)) {
commentStr="";
defaultValue="tls13";
List<SysDataDictionaryItem> sslversions=DictUtils.getDictList("SSL_VERSION");
if(CollectionUtils.isNotEmpty(sslversions)){
for (SysDataDictionaryItem sslversion : sslversions) {
commentStr=commentStr+sslversion.getItemCode()+""+msgProp.getProperty(sslversion.getItemValue(),sslversion.getItemValue())+""+"\n";
index++;
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
}
//allow_http2
if("ssl_ver_allow_http2".equals(headerStr)) {
commentStr="";
defaultValue="1";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
index++;
}
if("decrypt_mirror_enable".equals(headerStr)) {
commentStr="";
defaultValue="0";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
commentStr=commentStr+""+msgProp.getProperty("decrypt_mirror_enable_on","if the enable option value is '1', the Mirror profile is needed")+"\n";
index++;
}
if("decrypt_mirror_mirror_profile".equals(headerStr)) {
commentStr="";
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=proxyFileDao.findMirrorList(null,1,1);
if(CollectionUtils.isNotEmpty(mirrorProfileList)) {
for (ProxyFileTrafficMirrorCfg mirrorProfile : mirrorProfileList) {
commentStr=commentStr+mirrorProfile.getCompileId()+""+mirrorProfile.getCfgDesc()+"\n";
index++;
}
}
if(StringUtil.isEmpty(headerStr)){
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
/*//2、默认值说明
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
index++;*/
index++;
}
}
/**********************************************************************pxy intercept************************************************************************************************************/
if(region.getRegionType().equals(1)){//IP配置
//ip配置需要导入的信息srcIp srcPort destIp destPort Protocol Direction
//确定需要导入的srcIp srcPort destIp destPort信息
@@ -1572,17 +1170,11 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
if((region.getAction()!=null) && (region.getAction()==85 || region.getAction()==90)) {
commentStr=commentStr+"Content-Type"+"\n";
for (String districtStr : region.getConfigDistrict().split(",")) {
commentStr=commentStr+districtStr+"\n";
index++;
defaultValue="Content-Type";
}else {
for (String districtStr : region.getConfigDistrict().split(",")) {
commentStr=commentStr+districtStr+"\n";
index++;
}
defaultValue=region.getConfigDistrict().split(",")[0];
}
defaultValue=region.getConfigDistrict().split(",")[0];
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
@@ -1838,7 +1430,7 @@ public class ExportExcel {
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
if(region.getFunctionId().equals(200) || region.getFunctionId().equals(607)) {
if(region.getFunctionId().equals(200)) {
commentStr=commentStr+""+msgProp.getProperty("default_value")+":1\n";
}else {
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
@@ -2732,25 +2324,9 @@ public class ExportExcel {
dict="action_spoofing";
val = msgProp.getProperty(dict,dict);
}
//http(s) manipulate 导出action修改为Manipulate
if(ef.title().equals("block_type")
&& dict.equals("action_redirect")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("656"))) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
if(ef.title().equals("action")
&& dict.equals("action_redirect")) {
dict="action_manipulate";
val = msgProp.getProperty(dict,dict);
}
}
}
if(ef.title().equals("do_log")
&& (Reflections.invokeGetter(e, "serviceId").toString().equals("512"))) {
val = "";
}
if(ef.title().equals("whether_area_block")&&!StringUtil.isEmpty(val)){
Integer whetherAreaBlock=Integer.parseInt(valStr);
if(whetherAreaBlock.equals(0)){
@@ -2927,8 +2503,8 @@ public class ExportExcel {
/**
* 构造函数
* @param msgProp 国际化配置
* @param titleList sheet名称
* @param clsMap 实体对象通过annotation.ExportField获取标题
* @param title sheet名称
* @param cls 实体对象通过annotation.ExportField获取标题
* @param type 导出类型1:导出数据2导出模板
* @param groups 导入分组
* @return

View File

@@ -91,10 +91,6 @@ public class CheckComplexStringFormatThread implements Callable<String>{
throw new RuntimeException("Found String region,but mulityKeywords is Empty");
}
String dirtrictP = regionDict.getConfigDistrict();
// 代理-操控业务hijack、insert
if("85".equals(regionDict.getAction()+"") || "90".equals(regionDict.getAction()+"")) {
dirtrictP = "Content-Type";
}
StringBuffer errTip = new StringBuffer();
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
for (int i = 0; i < list.size(); i++) {
@@ -131,7 +127,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
}
}
// 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207) || "16".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(207)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("404");
}
@@ -157,7 +153,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
}
// 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208) || "48".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(208)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("302");
}
@@ -192,7 +188,7 @@ public class CheckComplexStringFormatThread implements Callable<String>{
}
}
// 代理HTTP(s)替换
if (regionDict.getFunctionId().equals(209) || "80".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(209)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("http_resp_body");
}

View File

@@ -1,7 +1,6 @@
package com.nis.util.excel.thread;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -21,24 +20,16 @@ import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.template.IpRateLimitTemplate;
//import com.nis.util.AsnCacheUtils;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.IPUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
public class CheckIpFormatThread implements Callable<String>{
private Logger logger=Logger.getLogger(CheckIpFormatThread.class);
@@ -50,10 +41,6 @@ public class CheckIpFormatThread implements Callable<String>{
private FunctionRegionDict regionDict;
private List<Map<Long,AsnGroupInfo>> asnNoMaps;
private Map<Long,AsnGroupInfo> asnGroupInfos;
private static PxyObjKeyringDao pxyObjKeyringDao = SpringContextHolder.getBean(PxyObjKeyringDao.class);
private static ProxyFileTrafficMirrorDao proxyFileDao = SpringContextHolder.getBean(ProxyFileTrafficMirrorDao.class);
private static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
// private DnsResStrategyDao dnsResStrategyDao;
public CheckIpFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseIpCfg> destQueue) {
this.serviceDict=serviceDict;
@@ -125,19 +112,9 @@ public class CheckIpFormatThread implements Callable<String>{
String direction = regionDict.getConfigDirection();
StringBuffer errTip = new StringBuffer();
// 因IP拦截 监测
if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(2)){
if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(1)){
protocol="6";
}
List<SysDataDictionaryItem> sslversions = new ArrayList<>();
List<SysDataDictionaryItem> failmethods = new ArrayList<>();
List<PxyObjKeyring> certificateList=new ArrayList<>();
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
certificateList=pxyObjKeyringDao.findList(null,1,1,"ip");
sslversions=DictUtils.getDictList("SSL_VERSION");
failmethods=DictUtils.getDictList("FAIL_METHOD");
mirrorProfileList=proxyFileDao.findMirrorList(null, 1, 1);
}
for (int i = 0; i < list.size(); i++) {
StringBuffer errInfo = new StringBuffer();
IpPortCfg baseIpCfg = new IpPortCfg();
@@ -152,15 +129,9 @@ public class CheckIpFormatThread implements Callable<String>{
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
}
}
if(regionDict.getFunctionId().equals(605)) {
if(StringUtils.isBlank(baseIpCfg.getGroupName())) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("group_name")) + ";");
}
}
if(regionDict.getFunctionId().equals(200)) {
if(!serviceDict.getAction().equals(2)) {
if(!serviceDict.getAction().equals(1)) {
baseIpCfg.setDoLog(0);
}
}
@@ -455,7 +426,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
}
// 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207) || "16".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(207)) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("404");
}
@@ -481,7 +452,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
// 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208) || "48".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(208)) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("302");
}
@@ -516,7 +487,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
}
// 代理HTTP(s)替换
if (regionDict.getFunctionId().equals(209) || "80".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(209)) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("http_resp_body");
}
@@ -575,252 +546,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
}
}
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
Integer kering=baseIpCfg.getKeyring();
Integer evCet=baseIpCfg.getEvCert();
Integer certTransparency=baseIpCfg.getCertTransparency();
Integer clientCertReq=baseIpCfg.getClientCertReq();
Integer pinning=baseIpCfg.getPinning();
Integer protocolErrors=baseIpCfg.getProtocolErrors();
Integer cn=baseIpCfg.getCn();
Integer issuer=baseIpCfg.getIssuer();
Integer selfSigned=baseIpCfg.getSelfSigned();
Integer expiration=baseIpCfg.getExpiration();
String failMethod=baseIpCfg.getFailMethod();
String min=baseIpCfg.getMin();
String max=baseIpCfg.getMax();
Integer mirrorClient=baseIpCfg.getMirrorClient();
Integer allowHttp2=baseIpCfg.getAllowHttp2();
Integer enable=baseIpCfg.getEnable();
Integer mirrorProfile=baseIpCfg.getMirrorProfile();
Map<String,Object> userRegionMap=new HashMap<>();
Map<String,Object> map=new HashMap<>();
if(kering!=null) {
boolean has=false;
for(PxyObjKeyring keyring:certificateList) {
if(keyring.getCompileId().toString().equals(kering.toString())) {
has=true;
break;
}
}
if(has) {
userRegionMap.put("keyring", kering);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("pxy_intercept_monit_keyring") + " ") + ";");
}
}else {
userRegionMap.put("keyring", 1);
}
if(evCet!=null) {
if(evCet!=0&&evCet!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_ev_cert","exclusions ev cert") + " ") + ";");
}else {
map.put("ev_cert", evCet);
}
}else {
map.put("ev_cert", 0);
}
if(certTransparency!=null) {
if(certTransparency!=0&&certTransparency!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_cert_transparency","exclusions cert transparency") + " ") + ";");
}else {
map.put("cert_transparency", certTransparency);
}
}else {
map.put("cert_transparency", 0);
}
if(clientCertReq!=null) {
if(clientCertReq!=0&&clientCertReq!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_client_cert_req","exclusions client cert req") + " ") + ";");
}else {
map.put("client_cert_req", clientCertReq);
}
}else {
map.put("client_cert_req", 1);
}
if(pinning!=null) {
if(pinning!=0&&pinning!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_pinning","exclusions pinning") + " ") + ";");
}else {
map.put("pinning", pinning);
}
}else {
map.put("pinning", 1);
}
if(protocolErrors!=null) {
if(protocolErrors!=0&&protocolErrors!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_protocol_errors","exclusions protocol errors") + " ") + ";");
}else {
map.put("protocol_errors", protocolErrors);
}
}else {
map.put("protocol_errors", 1);
}
userRegionMap.put("exclusions", map);
map=new HashMap<>();
Map<String,Object> map1=new HashMap<>();
if(cn!=null) {
if(cn!=0&&cn!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_cn","cert verify approach cn") + " ") + ";");
}else {
map1.put("cn", cn);
}
}else {
map1.put("cn", 1);
}
if(issuer!=null) {
if(issuer!=0&&issuer!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_issuer","cert verify approach issuer") + " ") + ";");
}else {
map1.put("issuer", issuer);
}
}else {
map1.put("issuer", 1);
}
if(selfSigned!=null) {
if(selfSigned!=0&&selfSigned!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_self_signed","cert verify approach self signed") + " ") + ";");
}else {
map1.put("self-signed", selfSigned);
}
}else {
map1.put("self-signed", 1);
}
if(expiration!=null) {
if(expiration!=0&&expiration!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_expiration","cert verify approach expiration") + " ") + ";");
}else {
map1.put("expiration", expiration);
}
}else {
map1.put("expiration", 1);
}
map.put("approach", map1);
if(StringUtils.isBlank(failMethod)) {
map.put("fail_method", "pass-through");
}else {
boolean has=false;
for(SysDataDictionaryItem fail: failmethods) {
if(fail.getItemCode().equals(failMethod)) {
has=true;
break;
}
}
if(!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_fail_method","cert verify fail method") + " ") + ";");
}
map.put("fail_method", failMethod);
}
userRegionMap.put("cert_verify", map);
map=new HashMap<>();
if(mirrorClient==null) {
mirrorClient=1;
map.put("mirror_client", 1);
}else {
if(mirrorClient!=0&&mirrorClient!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_mirror_client","SSL version mirror client") + " ") + ";");
}else {
map.put("mirror_client", mirrorClient);
}
}
if(allowHttp2==null) {
allowHttp2=1;
map.put("allow_http2", allowHttp2);
}else {
if(allowHttp2!=0&&allowHttp2!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_allow_http2","SSL version allow http2") + " ") + ";");
}else {
map.put("allow_http2", allowHttp2);
}
}
if(mirrorClient==0) {
int minSort=0,maxSort=0;
if(StringUtils.isBlank(min)) {
min="ssl3";
}
if(StringUtils.isBlank(max)) {
max="tls13";
}
for(SysDataDictionaryItem sslversion: sslversions) {
if(sslversion.getItemCode().equals(min)) {
minSort=sslversion.getItemSort();
}
if(sslversion.getItemCode().equals(max)) {
maxSort=sslversion.getItemSort();
}
}
if(minSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_min","min SSL version") + " ") + ";");
}
if(maxSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_max","max SSL version") + " ") + ";");
}
if(minSort>maxSort) {
errInfo.append(prop.getProperty("min_should_less_than_max","the min SSL version should less than the max SSL version") + ";");
}
map.put("min", min);
map.put("max", max);
}
userRegionMap.put("ssl_ver", map);
map=new HashMap<>();
if(enable==null) {
enable=0;
map.put("enable", 0);
}else {
if(enable!=0&&enable!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_enable","decrypt mirror enable") + " ") + ";");
}else {
map.put("enable", enable);
}
}
//enable==1的时候才设置mirror_profile
if(enable==1) {
if(mirrorProfile==null) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}else {
boolean has=false;
for(ProxyFileTrafficMirrorCfg _mirrorProfile:mirrorProfileList) {
if(_mirrorProfile.getCompileId().toString().equals(mirrorProfile.toString())) {
has=true;
break;
}
}
if(has) {
map.put("mirror_profile", mirrorProfile);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}
map.put("mirror_profile", mirrorProfile);
}
}
userRegionMap.put("decrypt_mirror", map);
baseIpCfg.setUserRegion1(BaseService.gsonToJson(userRegionMap));
}
// IpSpoofing
if (regionDict.getFunctionId().equals(214)) {
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("SPOOFING_IP_TYPE");
@@ -852,7 +578,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
}
}
if (regionDict.getRegionType().equals(1)) {
boolean srcIpEmpty = false;
boolean destIpEmpty = false;

View File

@@ -1,9 +1,7 @@
package com.nis.util.excel.thread;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
@@ -21,17 +19,10 @@ import com.beust.jcommander.internal.Sets;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.web.dao.configuration.ProxyFileTrafficMirrorDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
import com.nis.web.service.BaseService;
import com.nis.web.service.SpringContextHolder;
public class CheckStringFormatThread implements Callable<String>{
private Logger logger=Logger.getLogger(CheckStringFormatThread.class);
@@ -41,8 +32,6 @@ public class CheckStringFormatThread implements Callable<String>{
// private DnsResStrategyDao dnsResStrategyDao;
private FunctionServiceDict serviceDict;
private FunctionRegionDict regionDict;
private static PxyObjKeyringDao pxyObjKeyringDao = SpringContextHolder.getBean(PxyObjKeyringDao.class);
private static ProxyFileTrafficMirrorDao proxyFileDao = SpringContextHolder.getBean(ProxyFileTrafficMirrorDao.class);
public CheckStringFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<BaseStringCfg<?>> destQueue) {
this.serviceDict=serviceDict;
this.regionDict=regionDict;
@@ -102,16 +91,6 @@ public class CheckStringFormatThread implements Callable<String>{
StringBuffer errTip = new StringBuffer();
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
Pattern domainPattern = Pattern.compile("^[a-zA-Z0-9.-]*$");
List<SysDataDictionaryItem> sslversions = new ArrayList<>();
List<SysDataDictionaryItem> failmethods = new ArrayList<>();
List<PxyObjKeyring> certificateList=new ArrayList<>();
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
certificateList=pxyObjKeyringDao.findList(null,1,1,"ip");
sslversions=DictUtils.getDictList("SSL_VERSION");
failmethods=DictUtils.getDictList("FAIL_METHOD");
mirrorProfileList=proxyFileDao.findMirrorList(null, 1, 1);
}
for (int i = 0; i < list.size(); i++) {
StringBuffer errInfo = new StringBuffer();
BaseStringCfg baseStringCfg = new BaseStringCfg();
@@ -125,20 +104,14 @@ public class CheckStringFormatThread implements Callable<String>{
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
}
if(regionDict.getFunctionId().equals(606) || regionDict.getFunctionId().equals(607) || regionDict.getFunctionId().equals(608)) {
if(StringUtils.isBlank(baseStringCfg.getGroupName())) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("group_name")) + ";");
}
}
if(regionDict.getFunctionId().equals(200)) {
if(!serviceDict.getAction().equals(2)) {
if(!serviceDict.getAction().equals(1)) {
baseStringCfg.setDoLog(0);
}
}
// doLog属性检验
this.validDoLog(baseStringCfg,errInfo);
if (regionDict.getRegionType().equals(2)) {
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) {
String userRegion1 = baseStringCfg.getUserRegion1();
@@ -159,7 +132,7 @@ public class CheckStringFormatThread implements Callable<String>{
}
// 代理-域名拦截
if (regionDict.getFunctionId().equals(200) && "intercept_domain".equals(regionDict.getConfigServiceType())) {
/*if(serviceDict.getAction().equals(1)) {
if(serviceDict.getAction().equals(1)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion5())) {
baseStringCfg.setUserRegion5("1");
}
@@ -179,7 +152,7 @@ public class CheckStringFormatThread implements Callable<String>{
}
}
}else*/ if(serviceDict.getAction().equals(64)) {
}else if(serviceDict.getAction().equals(64)) {
baseStringCfg.setUserRegion1("0");// limit_rate_type限速方式默认值
if(StringUtils.isBlank(baseStringCfg.getUserRegion2())) {
baseStringCfg.setUserRegion2("0.1");
@@ -204,7 +177,7 @@ public class CheckStringFormatThread implements Callable<String>{
}
// 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207) || "16".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(207)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("404");
}
@@ -230,7 +203,7 @@ public class CheckStringFormatThread implements Callable<String>{
}
// 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208) || "48".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(208)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("302");
}
@@ -265,7 +238,7 @@ public class CheckStringFormatThread implements Callable<String>{
}
}
// 代理HTTP(s)替换
if (regionDict.getFunctionId().equals(209) || "80".equals(regionDict.getAction()+"")) {
if (regionDict.getFunctionId().equals(209)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("http_resp_body");
}
@@ -304,7 +277,7 @@ public class CheckStringFormatThread implements Callable<String>{
}
String keyword = baseStringCfg.getCfgKeywords();
if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(200) && !regionDict.getFunctionId().equals(607)) {// 201域名拦截
if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(200)) {// 201域名拦截
if (StringUtils.isBlank(keyword)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
@@ -521,252 +494,6 @@ public class CheckStringFormatThread implements Callable<String>{
}
}
if(serviceDict!=null&&serviceDict.getServiceId().equals(512)) {
Integer kering=baseStringCfg.getKeyring();
Integer evCet=baseStringCfg.getEvCert();
Integer certTransparency=baseStringCfg.getCertTransparency();
Integer clientCertReq=baseStringCfg.getClientCertReq();
Integer pinning=baseStringCfg.getPinning();
Integer protocolErrors=baseStringCfg.getProtocolErrors();
Integer cn=baseStringCfg.getCn();
Integer issuer=baseStringCfg.getIssuer();
Integer selfSigned=baseStringCfg.getSelfSigned();
Integer expiration=baseStringCfg.getExpiration();
String failMethod=baseStringCfg.getFailMethod();
String min=baseStringCfg.getMin();
String max=baseStringCfg.getMax();
Integer mirrorClient=baseStringCfg.getMirrorClient();
Integer allowHttp2=baseStringCfg.getAllowHttp2();
Integer enable=baseStringCfg.getEnable();
Integer mirrorProfile=baseStringCfg.getMirrorProfile();
Map<String,Object> userRegionMap=new HashMap<>();
Map<String,Object> map=new HashMap<>();
if(kering!=null) {
boolean has=false;
for(PxyObjKeyring keyring:certificateList) {
if(keyring.getCompileId().toString().equals(kering.toString())) {
has=true;
break;
}
}
if(has) {
userRegionMap.put("keyring", kering);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("pxy_intercept_monit_keyring") + " ") + ";");
}
}else {
userRegionMap.put("keyring", 1);
}
if(evCet!=null) {
if(evCet!=0&&evCet!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_ev_cert","exclusions ev cert") + " ") + ";");
}else {
map.put("ev_cert", evCet);
}
}else {
map.put("ev_cert", 0);
}
if(certTransparency!=null) {
if(certTransparency!=0&&certTransparency!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_cert_transparency","exclusions cert transparency") + " ") + ";");
}else {
map.put("cert_transparency", certTransparency);
}
}else {
map.put("cert_transparency", 0);
}
if(clientCertReq!=null) {
if(clientCertReq!=0&&clientCertReq!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_client_cert_req","exclusions client cert req") + " ") + ";");
}else {
map.put("client_cert_req", clientCertReq);
}
}else {
map.put("client_cert_req", 1);
}
if(pinning!=null) {
if(pinning!=0&&pinning!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_pinning","exclusions pinning") + " ") + ";");
}else {
map.put("pinning", pinning);
}
}else {
map.put("pinning", 1);
}
if(protocolErrors!=null) {
if(protocolErrors!=0&&protocolErrors!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("exclusions_protocol_errors","exclusions protocol errors") + " ") + ";");
}else {
map.put("protocol_errors", protocolErrors);
}
}else {
map.put("protocol_errors", 1);
}
userRegionMap.put("exclusions", map);
map=new HashMap<>();
Map<String,Object> map1=new HashMap<>();
if(cn!=null) {
if(cn!=0&&cn!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_cn","cert verify approach cn") + " ") + ";");
}else {
map1.put("cn", cn);
}
}else {
map1.put("cn", 1);
}
if(issuer!=null) {
if(issuer!=0&&issuer!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_issuer","cert verify approach issuer") + " ") + ";");
}else {
map1.put("issuer", issuer);
}
}else {
map1.put("issuer", 1);
}
if(selfSigned!=null) {
if(selfSigned!=0&&selfSigned!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_self_signed","cert verify approach self signed") + " ") + ";");
}else {
map1.put("self-signed", selfSigned);
}
}else {
map1.put("self-signed", 1);
}
if(expiration!=null) {
if(expiration!=0&&expiration!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_approach_expiration","cert verify approach expiration") + " ") + ";");
}else {
map1.put("expiration", expiration);
}
}else {
map1.put("expiration", 1);
}
map.put("approach", map1);
if(StringUtils.isBlank(failMethod)) {
map.put("fail_method", "pass-through");
}else {
boolean has=false;
for(SysDataDictionaryItem fail: failmethods) {
if(fail.getItemCode().equals(failMethod)) {
has=true;
break;
}
}
if(!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("cert_verify_fail_method","cert verify fail method") + " ") + ";");
}
map.put("fail_method", failMethod);
}
userRegionMap.put("cert_verify", map);
map=new HashMap<>();
if(mirrorClient==null) {
mirrorClient=1;
map.put("mirror_client", 1);
}else {
if(mirrorClient!=0&&mirrorClient!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_mirror_client","SSL version mirror client") + " ") + ";");
}else {
map.put("mirror_client", mirrorClient);
}
}
if(allowHttp2==null) {
allowHttp2=1;
map.put("allow_http2", allowHttp2);
}else {
if(allowHttp2!=0&&allowHttp2!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_allow_http2","SSL version allow http2") + " ") + ";");
}else {
map.put("allow_http2", allowHttp2);
}
}
if(mirrorClient==0) {
int minSort=0,maxSort=0;
if(StringUtils.isBlank(min)) {
min="ssl3";
}
if(StringUtils.isBlank(max)) {
max="tls13";
}
for(SysDataDictionaryItem sslversion: sslversions) {
if(sslversion.getItemCode().equals(min)) {
minSort=sslversion.getItemSort();
}
if(sslversion.getItemCode().equals(max)) {
maxSort=sslversion.getItemSort();
}
}
if(minSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_min","min SSL version") + " ") + ";");
}
if(maxSort==0) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_max","max SSL version") + " ") + ";");
}
if(minSort>maxSort) {
errInfo.append(prop.getProperty("min_should_less_than_max","the min SSL version should less than the max SSL version") + ";");
}
map.put("min", min);
map.put("max", max);
}
userRegionMap.put("ssl_ver", map);
map=new HashMap<>();
if(enable==null) {
enable=0;
map.put("enable", 0);
}else {
if(enable!=0&&enable!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_enable","decrypt mirror enable") + " ") + ";");
}else {
map.put("enable", enable);
}
}
//enable==1的时候才设置mirror_profile
if(enable==1) {
if(mirrorProfile==null) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}else {
boolean has=false;
for(ProxyFileTrafficMirrorCfg _mirrorProfile:mirrorProfileList) {
if(_mirrorProfile.getCompileId().toString().equals(mirrorProfile.toString())) {
has=true;
break;
}
}
if(has) {
map.put("mirror_profile", mirrorProfile);
}else {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("decrypt_mirror_mirror_profile") + " ") + ";");
}
map.put("mirror_profile", mirrorProfile);
}
}
userRegionMap.put("decrypt_mirror", map);
baseStringCfg.setUserRegion1(BaseService.gsonToJson(userRegionMap));
}
if (errInfo.toString().length() > 0) {//
errTip.append(String.format(prop.getProperty("line"), baseStringCfg.getIndex()) + ",");
errTip.append(errInfo);

View File

@@ -86,10 +86,7 @@ public class HttpClientUtil {
throw new ConnectException("流量统计服务接口连接错误"+response);
}
} catch (Exception e) {
// e.printStackTrace();
logger.error("获取消息失败,相应内容如下: " + response);
logger.error("获取消息失败 ", e);
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:");
throw e;
}finally {
if (response != null) {
try {

File diff suppressed because it is too large Load Diff

View File

@@ -1,158 +0,0 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.util.Constants;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.service.basics.CommonGroupManageService;
/**
* 公共组管理
*/
@Controller
@RequestMapping(value = "${adminPath}/basics/commonGroup")
public class CommonGroupManageController extends BaseController {
@Autowired
private CommonGroupManageService commonGroupManageService;
@RequestMapping(value = {"list"})
public String policyGroupList(CommonGroupInfo cfg, Model model, HttpServletRequest request, HttpServletResponse response) {
if(cfg == null)cfg=new CommonGroupInfo();
Page<CommonGroupInfo> pageCondition = new Page<CommonGroupInfo>(request, response,"r");
Page page = commonGroupManageService.findCommonGroupInfoList(pageCondition,cfg);
model.addAttribute("cfg", cfg);
model.addAttribute("page", page);
return "/basics/commonGroupList";
}
@RequestMapping(value={"/form"})
public String form(Integer groupType,String ids,Model model,String doAction,RedirectAttributes redirectAttributes) {
CommonGroupInfo groupInfo = new CommonGroupInfo();
if(!StringUtil.isEmpty(ids)){
groupInfo = commonGroupManageService.getById(Integer.parseInt(ids));
}
//groupInfo.setGroupType(groupType);
model.addAttribute("_cfg", groupInfo);
return "/basics/commonGroupForm";
}
@RequestMapping(value = "saveOrUpdate")
public String saveOrUpdate(CommonGroupInfo cfg, Model model, RedirectAttributes redirectAttributes,
String itType,Integer groupType,HttpServletRequest request) {
try {
commonGroupManageService.saveOrUpdate(cfg);
addMessage(redirectAttributes,"success","save_success");
} catch (Exception e) {
logger.error("新增失败",e);
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/commonGroup/list";
}
@RequestMapping(value={"delete"})
public String delete(RedirectAttributes redirectAttributes, String groupTypes, String ids, int isValid,HttpServletRequest request) {
try {
commonGroupManageService.deldete(ids, isValid, groupTypes);
addMessage(redirectAttributes,"success","delete_success");
} catch (Exception e) {
logger.error("删除失败",e);
addMessage(redirectAttributes,"error","delete_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/basics/commonGroup/list";
}
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfg",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfg(Model model, String grouIdAndCfgId, Integer groupType){
return commonGroupManageService.ajaxCheckIsLastOneCfg(grouIdAndCfgId, groupType);
}
@ResponseBody
@RequestMapping(value="ajaxGetGroupInfoByType",method=RequestMethod.GET)
public List<CommonGroupInfo> ajaxGetGroupInfoByType(Integer groupType){
return commonGroupManageService.findCommonGroupInfosByType(groupType);
}
// 数据导出
@RequestMapping(value = "exportGroup")
public void exportGroup(Model model,@ModelAttribute("cfg")CommonGroupInfo entity,String ids,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try {
entity.setMenuNameCode("common_group_manage");
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap=new HashMap<String, String>();
List<CommonGroupInfo> list = new ArrayList<CommonGroupInfo>();
if (!StringUtil.isEmpty(ids)) {
list = commonGroupManageService.findGroupInfoList(ids);
} else {
Page<CommonGroupInfo> pageInfo=new Page<CommonGroupInfo>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page page = commonGroupManageService.findCommonGroupInfoList(pageInfo,entity);
list=page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), CommonGroupInfo.class);
String cfgIndexInfoNoExport=",config_describe,cfg_id,block_type,do_log,action,valid_identifier,is_audit"
+ ",auditor,audit_time,letter,whether_area_block,classification,attribute,label"
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("Group export failed",e);
addMessage(redirectAttributes,"error","export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -1,318 +0,0 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.DomainCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.DomainCommGroupService;
@Controller
@RequestMapping(value = "${adminPath}/basics/domain")
public class DomainCommGroupController extends BaseController{
@Autowired
private DomainCommGroupService domainCommGroupService;
@RequestMapping(value = {"/list"})
public String list(Model model, @ModelAttribute("cfg")DomainCommCfg entity, HttpServletRequest request,HttpServletResponse response){
Page<DomainCommCfg> page = domainCommGroupService.findPage(new Page<DomainCommCfg>(request, response,"r"), entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", groupInfos);
return "/basics/domainCommGroupList";
}
@RequestMapping(value = {"/addForm"})
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response){
initFormCondition(model,cfg);
/* List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/domainCommGroupFormAdd";
}
@RequestMapping(value = {"/save"})
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try{
domainCommGroupService.saveCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/basics/domain/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/updateForm"})
public String updateForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,@ModelAttribute("cfg")DomainCommCfg cfg
,RedirectAttributes redirectAttributes){
cfg = domainCommGroupService.get(Long.parseLong(ids));
initUpdateFormCondition(model,cfg);
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.DOMAIN_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/domainCommGroupFormUpdate";
}
@RequestMapping(value = {"/update"})
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DomainCommCfg cfg,RedirectAttributes redirectAttributes){
try{
domainCommGroupService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"error","save_failed");
}
return "redirect:" + adminPath +"/basics/domain/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DomainCommCfg cfg){
try{
domainCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","delete_failed");
}
}
return "redirect:" + adminPath +"/basics/domain/list?functionId="+functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, DomainCommCfg searchCfg){
return domainCommGroupService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(2)) {
BlockingQueue<DomainCommCfgTemplate> list = ei.getDataList(DomainCommCfgTemplate.class );
stringCfgs = this.checkStringCfgMulity(errTip, serviceDict, regionDict, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(2)) {
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!stringCfgs.isEmpty()) {
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_stringCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseStringCfg<?> cfg : _stringCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("domain_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.DOMAIN_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
domainCommGroupService.saveAndSend(regionDict, serviceDict, _stringCfgs, groupIdMap, insertGroupList);
_stringCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
// 数据导出
@RequestMapping(value = "/exportGroupInfo")
public void exportGroupInfo(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")DomainCommCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap=new HashMap<String, String>();
List<DomainCommCfg> list = new ArrayList<DomainCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = domainCommGroupService.findByPage(ids);
} else {
Page<DomainCommCfg> pageInfo=new Page<DomainCommCfg>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<DomainCommCfg> page = domainCommGroupService.findPage(pageInfo, entity);
list=page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (DomainCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), DomainCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("domainGroupConfig export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}
}

View File

@@ -1,326 +0,0 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.IpCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.IpCommGroupCfgService;
@Controller
@RequestMapping(value = "${adminPath}/basics/ip")
public class IpCommGroupController extends BaseController {
@Autowired
private IpCommGroupCfgService ipCommGroupCfgService;
@RequestMapping(value = { "/list" })
public String list(Model model, @ModelAttribute("cfg") IpCommCfg entity, HttpServletRequest request, HttpServletResponse response) {
Page<IpCommCfg> page = ipCommGroupCfgService.findPage(new Page<IpCommCfg>(request, response, "r"),entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> policyGroupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.IP_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", policyGroupInfos);
return "/basics/ipCommonGroupCfgList";
}
@RequestMapping(value = { "/addForm" })
public String addForm(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
cfg.setGroupType(5);
initFormCondition(model, cfg);
/*List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(5);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/ipCommGroupFormAdd";
}
@RequestMapping(value = { "/save" })
@RequiresPermissions(value = { "ip:common:config" })
public String save(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
ipCommGroupCfgService.saveIpCommGroupCfg(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
}
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId();
}
@RequestMapping(value = { "/updateForm" })
public String updateForm(Model model, @ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes, String ids,
HttpServletRequest request, HttpServletResponse response) {
cfg = ipCommGroupCfgService.get(Long.parseLong(ids));
cfg.setGroupType(5);
initUpdateFormCondition(model, cfg);
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.IP_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/ipCommGroupFormUpdate";
}
@RequestMapping(value = { "/update" })
@RequiresPermissions(value = { "ip:common:config" })
public String update(Model model, @ModelAttribute("cfg") IpCommCfg cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
ipCommGroupCfgService.update(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId();
}
@RequestMapping(value = { "/delete" })
@RequiresPermissions(value = { "ip:common:config" })
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")IpCommCfg cfg) {
try {
ipCommGroupCfgService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes, "success", "delete_success");
} catch (Exception e) {
logger.error("Delete failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "delete_failed");
}
}
return "redirect:" + adminPath + "/basics/ip/list?functionId=" + functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, IpCommCfg searchCfg){
return ipCommGroupCfgService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导出
@RequestMapping(value = "/exportIpComm")
public void exportIpCommonCfg(Model model, @ModelAttribute("cfg") IpCommCfg entity, String ids, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<IpCommCfg> list = new ArrayList<IpCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = ipCommGroupCfgService.findByPage(ids);
} else {
Page<IpCommCfg> pageInfo = new Page<IpCommCfg>(request, response, "r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<IpCommCfg> page = ipCommGroupCfgService.findPage(pageInfo, entity);
list = page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (IpCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), IpCommCfg.class);
String cfgIndexInfoNoExport = ",block_type,do_log,action"
+ ",letter,whether_area_block,classification,attribute,label,userregion1,userregion2,userregion3,userregion4,userregion5"
+ ",cfg_id,is_audit,auditor,valid_identifier,ir_type,";
// 时间过滤
if (entity.getSearch_create_time_start() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("IpCommGroupCfg export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
}
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseIpCfg> ipPortCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(1)) {// IP
BlockingQueue<IpCommCfgTemplate> list = ei.getDataList(IpCommCfgTemplate.class );
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,null, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(1)) {// IP
List<BaseIpCfg> _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!ipPortCfgs.isEmpty()) {
ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_ipPortCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseIpCfg cfg : _ipPortCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("ip_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.IP_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
ipCommGroupCfgService.saveAndSend(regionDict, serviceDict, _ipPortCfgs, groupIdMap, insertGroupList);
_ipPortCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
}

View File

@@ -1,318 +0,0 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.ScriberIdCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.ScriberIdCommGroupService;
@Controller
@RequestMapping(value = "${adminPath}/basics/scriberId")
public class ScriberIdCommGroupController extends BaseController{
@Autowired
private ScriberIdCommGroupService scriberIdCommGroupService;
@RequestMapping(value = {"/list"})
public String list(Model model, @ModelAttribute("cfg")ScriberIdCommCfg entity, HttpServletRequest request,HttpServletResponse response){
Page<ScriberIdCommCfg> page = scriberIdCommGroupService.findPage(new Page<ScriberIdCommCfg>(request, response,"r"), entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", groupInfos);
return "/basics/scriberidCommGroupList";
}
@RequestMapping(value = {"/addForm"})
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response){
initFormCondition(model,cfg);
/*List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/scriberidCommGroupFormAdd";
}
@RequestMapping(value = {"/save"})
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try{
scriberIdCommGroupService.saveCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/basics/scriberId/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/updateForm"})
public String updateForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,@ModelAttribute("cfg")ScriberIdCommCfg cfg
,RedirectAttributes redirectAttributes){
cfg = scriberIdCommGroupService.get(Long.parseLong(ids));
initUpdateFormCondition(model,cfg);
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.SUBID_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/scriberidCommGroupFormUpdate";
}
@RequestMapping(value = {"/update"})
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")ScriberIdCommCfg cfg,RedirectAttributes redirectAttributes){
try{
scriberIdCommGroupService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"error","save_failed");
}
return "redirect:" + adminPath +"/basics/scriberId/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")ScriberIdCommCfg cfg){
try{
scriberIdCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","delete_failed");
}
}
return "redirect:" + adminPath +"/basics/scriberId/list?functionId="+functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, ScriberIdCommCfg searchCfg){
return scriberIdCommGroupService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(2)) {
BlockingQueue<ScriberIdCommCfgTemplate> list = ei.getDataList(ScriberIdCommCfgTemplate.class );
stringCfgs = this.checkStringCfgMulity(errTip, serviceDict, regionDict, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(2)) {
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!stringCfgs.isEmpty()) {
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_stringCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseStringCfg<?> cfg : _stringCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("scriberid_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.SUBID_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
scriberIdCommGroupService.saveAndSend(regionDict, serviceDict, _stringCfgs, groupIdMap, insertGroupList);
_stringCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
// 数据导出
@RequestMapping(value = "/exportGroupInfo")
public void exportGroupInfo(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")ScriberIdCommCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap=new HashMap<String, String>();
List<ScriberIdCommCfg> list = new ArrayList<ScriberIdCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = scriberIdCommGroupService.findByPage(ids);
} else {
Page<ScriberIdCommCfg> pageInfo=new Page<ScriberIdCommCfg>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ScriberIdCommCfg> page = scriberIdCommGroupService.findPage(pageInfo, entity);
list=page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (ScriberIdCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ScriberIdCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("scriberidGroupConfig export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}
}

View File

@@ -1,318 +0,0 @@
package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jets3t.service.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.template.UrlCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportBigExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.basics.UrlCommGroupService;
@Controller
@RequestMapping(value = "${adminPath}/basics/url")
public class UrlCommGroupController extends BaseController{
@Autowired
private UrlCommGroupService urlCommGroupService;
@RequestMapping(value = {"/list"})
public String list(Model model, @ModelAttribute("cfg")UrlCommCfg entity, HttpServletRequest request,HttpServletResponse response){
Page<UrlCommCfg> page = urlCommGroupService.findPage(new Page<UrlCommCfg>(request, response,"r"), entity);
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
List<CommonGroupInfo> groupInfos = commonGroupManageService.findCommonGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
model.addAttribute("page", page);
model.addAttribute("regionList", regionList);
model.addAttribute("serviceList", serviceList);
model.addAttribute("policyGroupInfos", groupInfos);
return "/basics/urlCommGroupList";
}
@RequestMapping(value = {"/addForm"})
public String addForm(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response){
initFormCondition(model,cfg);
/*List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);*/
model.addAttribute("_cfg", cfg);
return "/basics/urlCommGroupFormAdd";
}
@RequestMapping(value = {"/save"})
public String save(Model model, @ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes,
HttpServletRequest request,HttpServletResponse response){
try{
urlCommGroupService.saveUrlCommGroupCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","save_failed");
}
}
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/updateForm"})
public String updateForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,@ModelAttribute("cfg")UrlCommCfg cfg
,RedirectAttributes redirectAttributes){
cfg = urlCommGroupService.get(Long.parseLong(ids));
initUpdateFormCondition(model,cfg);
List<CommonGroupInfo> groupInfos=commonGroupManageService.findCommonGroupInfosByType(Constants.URL_OBJ_GROUP_TYPE);
model.addAttribute("policyGroupInfos", groupInfos);
model.addAttribute("_cfg", cfg);
return "/basics/urlCommGroupFormUpdate";
}
@RequestMapping(value = {"/update"})
public String update(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")UrlCommCfg cfg,RedirectAttributes redirectAttributes){
try{
urlCommGroupService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"error","save_failed");
}
return "redirect:" + adminPath +"/basics/url/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
public String delete(String groupIds, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")UrlCommCfg cfg){
try{
urlCommGroupService.delete(ids, groupIds, cfg, request, response);
addMessage(redirectAttributes,"success","delete_success");
}catch(Exception e){
logger.error("Delete failed",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
}else {
addMessage(redirectAttributes,"error","delete_failed");
}
}
return "redirect:" + adminPath +"/basics/url/list?functionId="+functionId;
}
// 批量删除前获取提示信息
@ResponseBody
@RequestMapping(value="ajaxCheckIsLastOneCfgBatch",method=RequestMethod.POST)
public List<Integer> ajaxCheckIsLastOneCfgBatch(Model model, UrlCommCfg searchCfg){
return urlCommGroupService.ajaxCheckIsLastOneCfgBatch(searchCfg);
}
// 数据导入
@RequestMapping(value = "import", method=RequestMethod.POST)
public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
@RequestParam("files") MultipartFile[] files, Integer serviceDictId ,Integer requestId ,String attribute ,String classify
,String regionDictIds ,String importPath) {
logger.warn("import start...");
long start=System.currentTimeMillis();
ImportBigExcel ei=null;
try {
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
StringBuffer errTip=new StringBuffer();
BlockingQueue<BaseStringCfg<?>> stringCfgs =null;
for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i];
ei = new ImportBigExcel(file, 0, 1);
FunctionRegionDict regionDict = DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
//加载模板
loadTemplate(ei,regionDict, serviceDict);
//------------------------------------check format start----------------------------
if (regionDict.getRegionType().equals(2)) {
BlockingQueue<UrlCommCfgTemplate> list = ei.getDataList(UrlCommCfgTemplate.class );
stringCfgs = this.checkStringCfgMulity(errTip, serviceDict, regionDict, list);
}
//删除文件
if(ei.getUploadFile()!=null&&ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
//------------------------------------check format end----------------------------
Date date = new Date();
//String isSend = request.getParameter("isSend")==null?"":request.getParameter("isSend");
if (regionDict.getRegionType().equals(2)) {
List<BaseStringCfg<?>> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
while(!stringCfgs.isEmpty()) {
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
List<Integer> regionIds = Lists.newArrayList(_stringCfgs.size());
try {
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
} catch (Exception e) {
logger.error("获取域ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
int index = 0;
Set<String> countSet = new HashSet<String>();
for (BaseStringCfg<?> cfg : _stringCfgs) {
cfg.setAction(serviceDict==null?null:serviceDict.getAction());
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
cfg.setCfgType(regionDict.getConfigRegionValue());
cfg.setCreateTime(date);
cfg.setCreatorId(UserUtils.getUser().getId());
//cfg.setDoLog(2);
cfg.setCompileId(0);
cfg.setFunctionId(regionDict.getFunctionId());
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
cfg.setIsValid(Constants.VALID_NO);
cfg.setIsAreaEffective(0);
cfg.setLable("0");
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
cfg.setAttribute(attribute);
cfg.setClassify(classify);
cfg.setServiceId(serviceDict==null?null:serviceDict.getServiceId());
cfg.setTableName("url_comm_cfg");
cfg.setRegionId(regionIds.get(index));
cfg.setGroupName(cfg.getGroupName().toUpperCase());
countSet.add(cfg.getGroupName());
index++;
}
List<CommonGroupInfo> insertGroupList = new ArrayList<CommonGroupInfo>();
Map<String, Integer> groupIdMap = commonGroupManageService.getCountByGroupName(countSet, insertGroupList, Constants.URL_OBJ_GROUP_TYPE); // 调用服务接口获取GroupId
urlCommGroupService.saveAndSend(regionDict, serviceDict, _stringCfgs, groupIdMap, insertGroupList);
_stringCfgs.clear();
}
}
}
if(errTip.toString().length()>0) {
addMessage(redirectAttributes,"error", errTip.toString());
}
} catch (Exception e) {
if(ei!=null) {
if(ei.getUploadFile().exists()) {
ei.getUploadFile().delete();
}
}
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
}else if(e instanceof ServiceException) {
addMessage(redirectAttributes,"error", e.getMessage());
}else if(e instanceof IndexOutOfBoundsException){
addMessage(redirectAttributes,"error", "template_error");
}else {
addMessage(redirectAttributes,"error", "import_failed");
}
logger.error("import failed", e);
}
long end=System.currentTimeMillis();
logger.warn("import finish,cost:"+(end-start));
return "redirect:" + adminPath+ importPath;
}
// 数据导出
@RequestMapping(value = "/exportUrlComm")
public void exportUrlComm(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")UrlCommCfg entity,String ids,RedirectAttributes redirectAttributes){
try {
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap=new HashMap<String, String>();
List<UrlCommCfg> list = new ArrayList<UrlCommCfg>();
if (!StringUtil.isEmpty(ids)) {
list = urlCommGroupService.findByPage(ids);
} else {
Page<UrlCommCfg> pageInfo=new Page<UrlCommCfg>(request, response,"r");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<UrlCommCfg> page = urlCommGroupService.findPage(pageInfo, entity);
list=page.getList();
}
CommonGroupInfo groupInfo = new CommonGroupInfo();
for (UrlCommCfg cfg : list) {
groupInfo.setServiceGroupId(cfg.getGroupId());
CommonGroupInfo commonGroupInfo = commonGroupManageService.getGroupInfo(groupInfo);
cfg.setGroupName(commonGroupInfo.getGroupName());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), UrlCommCfg.class);
String cfgIndexInfoNoExport=",block_type,do_log,action,letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,asn_no,"
+ "is_hex,is_case_insenstive,cfg_id,is_audit,auditor,valid_identifier,";
// 时间过滤
if (entity.getSearch_create_time_start() == null ) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), list);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("urlGroupConfig export failed",e);
addMessage(redirectAttributes,"error","export_failed");
}
}
}

View File

@@ -56,7 +56,7 @@ public class ConfigSynchronizationController extends BaseController {
Map<String,Integer> map = new HashMap();
map.put("syncStatus", cmd);
JSONObject result = ConfigServiceUtil.configSyncCmd(BaseService.gsonToJson(map));
// JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
//JSONObject result=JSONObject.fromObject("{\"status\": 201,\"businessCode\": 2001000,\"reason\":\"数据获取操作成功\",\"msg\": \"根据配置id获取对应的编译,组,域等信息成功\",\"fromuri\": \"/galaxy-service/service/cfg/v1/getAllKVByCompileId\",\"traceCode\": \"2019031211285044813363\",\"data\": [{\"service\":\"ntc\",\"status\":0,\"opTime\":\"2016-11-22 08:31:27\"}]}");
if(result.get("status").equals(201)){//响应成功
if(cmd.equals(1)){//同步
SysDataDictionaryName sysDictName = new SysDataDictionaryName();

View File

@@ -1,617 +0,0 @@
package com.nis.web.controller.configuration;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ObjGroupCfg;
import com.nis.exceptions.CallExternalProceduresException;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.*;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@Controller
@RequestMapping("${adminPath}/objgroup")
public class ObjectGroupController extends BaseController {
@RequestMapping(value = { "/list" })
public String list(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request,
HttpServletResponse response,String tip){
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = objectGroupService.getPolicyListList(searchPage, cfg);
model.addAttribute("page", page);
if(StringUtils.isNotBlank(tip)){
addMessage("error",model,tip);
}
initPageCondition(model,cfg);
return "/cfg/objgroup/list";
}
@RequestMapping(value = { "/form" })
@RequiresPermissions(value = { "objgroup:config" })
public String form(Model model, String ids, CfgIndexInfo entity) {
List<PolicyGroupInfo> ipGroups=new ArrayList<>();
List<PolicyGroupInfo> urlGroups=new ArrayList<>();
List<PolicyGroupInfo> subscribeIdGroups=new ArrayList<>();
List<PolicyGroupInfo> domainGroups=new ArrayList<>();
//查询所有可选择没有被其他配置引用并且组下有域配置的组ud_flag=1
ipGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.IP_OBJ_GROUP_TYPE,1);
urlGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.URL_OBJ_GROUP_TYPE,1);
subscribeIdGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.SUBID_OBJ_GROUP_TYPE,1);
domainGroups=policyGroupInfoService.findPolicyGroupInfosByTypeforUD(Constants.DOMAIN_OBJ_GROUP_TYPE,1);
if (StringUtils.isNotBlank(ids)) {
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(ids), null);
initUpdateFormCondition(model, entity);
//查询配置引用到的分组,加到对应的组下(维持选中选项)
if(MapUtils.isNotEmpty(entity.getUserRegion())){
for(Map.Entry<String,Object> e:entity.getUserRegion().entrySet()){
if(e.getKey().equals("ipGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _ipGrpups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_ipGrpups)){
ipGroups.addAll(_ipGrpups);
}
}else if(e.getKey().equals("urlGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _urlGrpups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_urlGrpups)){
urlGroups.addAll(_urlGrpups);
}
}else if(e.getKey().equals("subscribeIdGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _subscribeIdGroups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_subscribeIdGroups)){
subscribeIdGroups.addAll(_subscribeIdGroups);
}
}else if(e.getKey().equals("domainGroup")&&StringUtils.isNotBlank(e.getValue().toString())){
List<PolicyGroupInfo> _domainGroups=policyGroupInfoService.findPolicyByServiceGroupInfoList(e.getValue().toString());
if(CollectionUtils.isNotEmpty(_domainGroups)){
domainGroups.addAll(_domainGroups);
}
}
}
}
} else {
initFormCondition(model, entity);
}
model.addAttribute("ipGroups", ipGroups);
model.addAttribute("urlGroups", urlGroups);
model.addAttribute("subscribeIdGroups", subscribeIdGroups);
model.addAttribute("domainGroups", domainGroups);
model.addAttribute("_cfg", entity);
return "/cfg/objgroup/form";
}
@RequestMapping(value = {"saveOrUpdate"})
@RequiresPermissions(value={"objgroup:config"})
public String saveOrUpdate(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo cfg, RedirectAttributes redirectAttributes){
try{
String ipGroup=formatMultSelect(request.getParameterValues("ipGroup")),
subscribeIdGroup=formatMultSelect(request.getParameterValues("subscribeIdGroup")),
domainGroup=formatMultSelect(request.getParameterValues("domainGroup")),
urlGroup=formatMultSelect(request.getParameterValues("urlGroup"));
Map<String,Object> map = new HashMap();
if(StringUtils.isNotBlank(ipGroup)&&StringUtils.isNotBlank(ipGroup.replaceAll(",",""))){
map.put("ipGroup", ipGroup);
}
if(StringUtils.isNotBlank(subscribeIdGroup)&&StringUtils.isNotBlank(subscribeIdGroup.replaceAll(",",""))){
map.put("subscribeIdGroup", subscribeIdGroup);
}
if(StringUtils.isNotBlank(domainGroup)&&StringUtils.isNotBlank(domainGroup.replaceAll(",",""))){
map.put("domainGroup", domainGroup);
}
if(StringUtils.isNotBlank(urlGroup)&&StringUtils.isNotBlank(urlGroup.replaceAll(",",""))){
map.put("urlGroup", urlGroup);
}
cfg.setUserRegion(map);
objectGroupService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("对象组配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("对象组配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath +"/objgroup/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"updateValid"})
@RequiresPermissions(value={"objgroup:config"})
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg){
try {
if (!StringUtil.isEmpty(ids)) {
objectGroupService.updatePolicyValid(isValid,ids,functionId);
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
addMessage(redirectAttributes, "success", "delete_success");
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
}
/**
* 界面批量删除当前检索条件下的配置
* @param page
* @param functionId
* @param entity
* @throws Exception
*/
public void deleteAll(Page page,Integer functionId, Object entity)throws Exception {
long start=System.currentTimeMillis();
page.setOrderBy("");
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
page.setPageNo(1);
page.setLastPage(false);
CfgIndexInfo searchCfg = new CfgIndexInfo();
// 传递检索条件
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, searchCfg);
searchCfg.setFunctionId(functionId);
}
BaseCfg batchCfg = new BaseCfg();
batchCfg.setTableName(CfgIndexInfo.getTablename());
batchCfg.setIsValid(-1);
batchCfg.setIsAudit(0);
batchCfg.setEditTime(new Date());
batchCfg.setEditorId(UserUtils.getUser().getId());
//cfg_index_info表中存有servicdId
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
List<CfgIndexInfo> list = getDataList(page,searchCfg); //获取主配置表数据
if(CollectionUtils.isNotEmpty(list)){
StringBuffer serviceGroupIds=new StringBuffer();
List<BaseCfg> baseCfgList=new ArrayList<>();
for (CfgIndexInfo cfg : list) {
if(cfg.getUserRegion()!=null){
for (Object val:cfg.getUserRegion().values()) {
if(StringUtils.isNotBlank(val.toString())){
if(val.toString().startsWith(",")){
serviceGroupIds.append(val.toString().substring(1));
}else{
serviceGroupIds.append(val.toString());
}
}
}
}
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
baseCfgList.add(baseCfg);
}
if(StringUtils.isNotBlank(serviceGroupIds)&&serviceGroupIds.lastIndexOf(",")==(serviceGroupIds.toString().length()-1)){
serviceGroupIds.deleteCharAt(serviceGroupIds.toString().length()-1);
}
hasData = objectGroupService.batchDeleteMaatData(page, batchCfg, baseCfgList, hasData,serviceGroupIds.toString());
}else{
hasData = false;
}
}
long end=System.currentTimeMillis();
logger.warn("配置批量删除耗时:"+(end-start));
}
public List getDataList(Page searchPage
,CfgIndexInfo searchCfg
){
BaseCfg baseCfg=new BaseCfg<>();
if(!StringUtil.isEmpty(searchCfg)) {
BeanUtils.copyProperties(searchCfg, baseCfg);
}
Page pageResult=new Page();
pageResult=objectGroupService.getPolicyListList(searchPage,searchCfg);
return pageResult.getList();
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"objgroup:confirm"})
public String audit(Model model,@ModelAttribute("cfg") CfgIndexInfo cfg,
Integer isValid,
Integer isAudit,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes,
HttpServletResponse response,
HttpServletRequest request) {
Properties props=this.getMsgProp();
if(!StringUtil.isEmpty(ids)){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
StringBuffer tip=new StringBuffer();
for(String id :idArray){
entity = objectGroupService.getObjectGroupCfg(Long.parseLong(id),null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
if(StringUtils.isBlank(entity.getCommonGroupIds())){
tip.append(String.format(props.getProperty("no_common_group","The configuration ID of %s does not have an group;"),entity.getCompileId()));
tip.append("<br/>");
}else{
objectGroupService.auditPolicy(entity,isAudit,Constants.INSERT_ACTION);
}
if(tip.toString().length()>0){
addMessage(redirectAttributes,"error", tip.toString());
}else{
addMessage(redirectAttributes,"success", "audit_success");
}
} catch ( Exception e) {
logger.error("策略对象组下发失败:"+e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
}else {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"r");
Page<CfgIndexInfo> auditPage=new Page<CfgIndexInfo>(request,response,"r");
String tip=null;
try {
BeanUtils.copyProperties(searchPage, auditPage);
tip= auditAll(auditPage,isValid , cfg,props);
if(tip.toString().length()>0){
addMessage(redirectAttributes,"error", tip.toString());
}else{
addMessage(redirectAttributes,"success", "audit_success");
}
} catch (Exception e) {
logger.error("策略对象组下发失败:",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
//无法保存状态
return list(model, cfg, request, response,tip);
}
return "redirect:" + adminPath +"/objgroup/list?functionId="+functionId;
}
private String formatMultSelect(Object requestParameter){
if(StringUtil.isEmpty(requestParameter)){
return null;
}else if(requestParameter.getClass().isArray()){
String[] array=(String[])requestParameter;
StringBuffer buf=new StringBuffer(",");
for(String param:array){
buf.append(param).append(",");
}
return buf.toString().length()==1?null:buf.toString();
}else{
return ","+requestParameter.toString()+",";
}
}
@RequestMapping(value = { "/ajaxGetNames" })
@ResponseBody
public Map<String,Map<String,String>> ajaxGetNames(Model model, @RequestParam(required=true,value="groupIds")String group) {
String _group=group.replaceAll("\\|",",");
Map<String,Map<String,String>> datas=new HashMap<>();
datas.put("ipGroup",new HashMap<String,String>());
datas.put("urlGroup",new HashMap<String,String>());
datas.put("subscribeIdGroup",new HashMap<String,String>());
datas.put("domainGroup",new HashMap<String,String>());
if(StringUtils.isNotBlank(group)){
List<PolicyGroupInfo> infos=policyGroupInfoService.findPolicyByServiceGroupInfoList(_group);
for(PolicyGroupInfo info:infos){
for(String g:group.split("\\|")){
if(objectGroupService.indexOfContains(g,",",info.getServiceGroupId().toString())){
Map<String,String> map=null;
if(info.getGroupType().equals(Constants.IP_OBJ_GROUP_TYPE)){
map=datas.get("ipGroup");
}else if(info.getGroupType().equals(Constants.URL_OBJ_GROUP_TYPE)){
map=datas.get("urlGroup");
}else if(info.getGroupType().equals(Constants.SUBID_OBJ_GROUP_TYPE)){
map=datas.get("subscribeIdGroup");
}else if(info.getGroupType().equals(Constants.DOMAIN_OBJ_GROUP_TYPE)){
map=datas.get("domainGroup");
}
map.put(g,map.containsKey(g)?map.get(g)+info.getGroupName()+",":info.getGroupName()+",");
}
}
}
}
//删除最后的逗号
for(Map<String,String> m:datas.values()){
for(Map.Entry<String,String> e:m.entrySet()){
if(e.getValue().endsWith(",")){
m.put(e.getKey(),e.getValue().substring(0,e.getValue().length()-1));
}
}
}
return datas;
}
//http配置导出
@RequestMapping(value = "exportObjGroup")
public void exportdomain(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ObjGroupCfg entity, String ids, RedirectAttributes redirectAttributes){
try {
//export data info
List<String> titleList=new ArrayList<String>();
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
Map<String, List> dataMap=new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<ObjGroupCfg> lists = new ArrayList<ObjGroupCfg>();
Properties msgProp = getMsgProp();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
lists = objectGroupService.getObjGroupList(ids,msgProp,entity.getFunctionId());
} else {
Page<ObjGroupCfg> pageInfo=new Page<ObjGroupCfg>(request, response,"a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ObjGroupCfg> page = objectGroupService.getObjGroup(pageInfo, entity,msgProp);
lists = page.getList();
}
for(ObjGroupCfg c:lists){
if(StringUtils.isNotBlank(c.getIpGroup())&&c.getIpGroup().startsWith(",")){
c.setIpGroup(c.getIpGroup().substring(1));
}
if(StringUtils.isNotBlank(c.getUrlGroup())&&c.getUrlGroup().startsWith(",")){
c.setUrlGroup(c.getUrlGroup().substring(1));
}
if(StringUtils.isNotBlank(c.getSubscribeIdGroup())&&c.getSubscribeIdGroup().startsWith(",")){
c.setSubscribeIdGroup(c.getSubscribeIdGroup().substring(1));
}
if(StringUtils.isNotBlank(c.getDomainGroup())&&c.getDomainGroup().startsWith(",")){
c.setDomainGroup(c.getDomainGroup().substring(1));
}
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ObjGroupCfg.class);
String cfgIndexInfoNoExport=",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), lists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("Obj group export failed",e);
addMessage(redirectAttributes,"error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
/**
* 批量审核
* @param page
* @param auditType
* @param entity
* @return
*/
public String auditAll(Page page,Integer auditType,CfgIndexInfo entity,Properties props)throws Exception {
StringBuffer tip=new StringBuffer();
long start=System.currentTimeMillis();
page.setOrderBy("");
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
page.setPageNo(1);
page.setLastPage(false);
//携带审核状态信息的BaseCfg
BaseCfg auditBatchCfg=new BaseCfg();
//携带审核条件的BaseCfg
CfgIndexInfo searchCfg=new CfgIndexInfo();
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, auditBatchCfg);
BeanUtils.copyProperties(entity, searchCfg);
}
auditType = (Integer)Reflections.invokeGetter(entity, "isAudit");
//全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过
if(auditType.equals(1) || auditType.equals(2)) {
if(auditType.equals(1)) {
auditBatchCfg.setIsAudit(1);
auditBatchCfg.setIsValid(1);
}else {
auditBatchCfg.setIsAudit(2);
auditBatchCfg.setIsValid(0);
}
auditBatchCfg.setAuditTime(new Date());
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
}else {
auditBatchCfg.setIsAudit(3);
auditBatchCfg.setIsValid(0);
auditBatchCfg.setAuditTime(new Date());
auditBatchCfg.setAuditorId(UserUtils.getUser().getId());
}
ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil();
Integer functionId=0;
if(auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) {
functionId=auditBatchCfg.getFunctionId();
}
List<Map<String,Object>> serviceList = serviceTemplate.getServiceListByFunctionId(functionId);
for(Map<String,Object> service:serviceList){
String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表
String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback
String classNameXml = service.get("className").toString(); // 主配置Java类
String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段
String serviceIds=service.get("serviceIds").toString();
auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml));
auditBatchCfg.setTableName(tableNameXml);
//searchCfg.setServiceId(Integer.valueOf(serviceIdXml));
searchCfg.setTableName(tableNameXml);
if("1".equals(serviceTypeXml)){//maat类配置
if(StringUtils.isNotBlank(serviceIds)) {//公共分组
// 存放域配置类型 及 对应表名
Map<Integer,List<Map<String,Object>>> childrenCfgMap=new HashMap<>();
Map<Integer,List<Map<String,Object>>> childrenUserRegionMap=new HashMap<>();
for(String _serviceId:serviceIds.split(",")){
if(StringUtils.isNotBlank(_serviceId)){
Map<String,Object> subService=serviceTemplate.getServiceListByServiceId(Integer.parseInt(_serviceId)).get(0);
childrenCfgMap.put(Integer.parseInt(_serviceId),(List<Map<String,Object>>)subService.get("cfgList"));
}
}
if(childrenCfgMap.size()>0){
for(Map.Entry e:childrenCfgMap.entrySet()){
boolean hasData = true;
while(hasData){
page.setPageNo(1);
page.setLastPage(false);
searchCfg.setServiceId(Integer.parseInt(e.getKey().toString()));
auditBatchCfg.setServiceId(Integer.parseInt(e.getKey().toString()));
List<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过ServiceId获取cfg_index_info主配置表数据
for(CfgIndexInfo info:list){
if(StringUtils.isBlank(info.getCommonGroupIds())){
tip.append(String.format(props.getProperty("no_common_group","The configuration ID of %s does not have an group;"),info.getCompileId()));
tip.append("<br/>");
}
}
if(!StringUtil.isEmpty(list)){
//配置生效处理 复用全量下发
if(auditBatchCfg.getIsAudit().equals(1)) {
hasData = configSynchronizationService.auditObjGroupListMaatData(childrenCfgMap,childrenUserRegionMap,page,auditBatchCfg,list,hasData,true);
}else {
List<BaseCfg> BaseCfgList=new ArrayList<>();
if(!StringUtil.isEmpty(list)) {
for (CfgIndexInfo cfg : list) {
BaseCfg baseCfg=new BaseCfg();
BeanUtils.copyProperties(cfg, baseCfg);
BaseCfgList.add(baseCfg);
}
}
if(auditBatchCfg.getIsAudit().equals(2)) {// 配置批量审核不通过
hasData = commonPolicyService.batchUnApproveObjGroupListatData(page, auditBatchCfg, BaseCfgList, hasData);
}else {// 配置失效处理 批量处理
hasData = commonPolicyService.auditObjGroupListMaatData(tableNameXml, page, auditBatchCfg, BaseCfgList, hasData);
}
}
}else{
hasData = false;
}
}
}
}
}
}
}
//批量审核通过时如果没有携带isValid检索条件返回界面需要将isValid置为null
if(!StringUtil.isEmpty(entity)) {
BaseCfg base=(BaseCfg)entity ;
base.setBatchAuditValue("");
base.setBatchValidValue("");
//配置目标状态1 1 生效,isAudit条件置为1有selType条件,且不是isValid不改没有sel改为isValid并且为1
if(base.getIsAudit()==1 && base.getIsValid()==1){
base.setIsAudit(1);
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
}else{
base.setIsValid(1);
base.setSeltype("isValid");
}
}
//配置目标状态2 0 不通过,isAudit条件置为2有selType条件,且不是isValid不改没有sel改为isValid并且为0
if(base.getIsAudit()==2 && base.getIsValid()==0){
base.setIsAudit(2);
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
}else{
base.setIsValid(0);
base.setSeltype("isValid");
}
}
//配置目标状态3 0 取消
if(base.getIsAudit()==3 && base.getIsValid()==0){
base.setIsAudit(3);
if(!StringUtil.isEmpty(base.getSeltype()) && !base.getSeltype().equals("isValid")) {
base.setIsValid(null);
}else{
base.setIsValid(0);
base.setSeltype("isValid");
}
}
BeanUtils.copyProperties(base, entity);
}
long end=System.currentTimeMillis();
logger.warn("配置批量生效/失效耗时:"+(end-start));
return tip.toString();
}
@RequestMapping(value = { "ajaxSubList"})
public String ajaxSubList(Model model, Long cfgId, Integer index, Integer compileId) {
CfgIndexInfo cfg = objectGroupService.getObjectGroupCfg(cfgId, null);
List<String[]> tabList = new ArrayList();
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);
return "/cfg/objgroup/subList";
}
}

View File

@@ -307,13 +307,7 @@ public class FileTransferCfgController extends BaseController {
logger.info("获取文件摘要响应信息:" + result);
}
fileTransferCfgService.saveOrUpdateFileDigestCfg(entity, result, areaCfgIds);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
addMessage(redirectAttributes, "success", "save_success");
} catch (MaatConvertException e) {
logger.error("文件摘要配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");

View File

@@ -41,7 +41,6 @@ import com.nis.domain.configuration.template.DnsComplexStringTemplate;
import com.nis.domain.configuration.template.DnsFakeIpTemplate;
import com.nis.domain.configuration.template.DnsIpTemplate;
import com.nis.domain.configuration.template.DnsResStrategyTemplate;
import com.nis.domain.configuration.template.DomainCommCfgTemplate;
import com.nis.domain.configuration.template.DomainInterceptMonitTemplate;
import com.nis.domain.configuration.template.DomainInterceptRateLimitTemplate;
import com.nis.domain.configuration.template.DomainInterceptTemplate;
@@ -54,23 +53,18 @@ import com.nis.domain.configuration.template.HttpsRejectTemplate;
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
import com.nis.domain.configuration.template.InterceptDomainTemplate;
import com.nis.domain.configuration.template.InterceptIpTemplate;
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpCommCfgTemplate;
import com.nis.domain.configuration.template.IpPayloadTemplate;
import com.nis.domain.configuration.template.IpRateLimitTemplate;
import com.nis.domain.configuration.template.IpSpoofingTemplate;
import com.nis.domain.configuration.template.IpWhitelistTemplate;
import com.nis.domain.configuration.template.P2pHashStringTemplate;
import com.nis.domain.configuration.template.P2pIpTemplate;
import com.nis.domain.configuration.template.ScriberIdCommCfgTemplate;
import com.nis.domain.configuration.template.SnatTemplate;
import com.nis.domain.configuration.template.StringAllNotDoLogTemplate;
import com.nis.domain.configuration.template.StringAllTemplate;
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
import com.nis.domain.configuration.template.UrlCommCfgTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
@@ -202,7 +196,8 @@ public class IpController extends BaseController{
*
* @param model
* @param cfg
* @param isAudit 审核类型 批量审核时使用1批量生效0批量失效
* @param auditType 审核类型 批量审核时使用1批量生效0批量失效
* @param isAudit
* @param isValid
* @param ids
* @param functionId
@@ -343,12 +338,10 @@ public class IpController extends BaseController{
,Integer serviceDictId
,Integer regionDictId
,Integer requestId
,Integer manipulatType
) {
try {
FunctionRegionDict regionDict=DictUtils.getFunctionRegionDict(regionDictId);
FunctionServiceDict serviceDict=DictUtils.getFunctionServiceDict(serviceDictId);
regionDict.setAction(manipulatType);
exportTemplate(request,response,redirectAttributes,regionDict,serviceDict,requestId);
} catch (Exception e) {
logger.error("export_failed", e);
@@ -450,29 +443,6 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(215)){// HTTP(s)操控(阻断+重定向+替换)
if(regionDict.getAction() == 16) {
List<HttpsRejectIpTemplate> classList=new ArrayList<HttpsRejectIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 48) {
List<HttpsRedirectIpTemplate> classList=new ArrayList<HttpsRedirectIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 80) {
List<HttpsReplaceIpTemplate> classList=new ArrayList<HttpsReplaceIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllNotDoLogTemplate.class, 2);
@@ -484,12 +454,7 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(serviceDict.getAction().equals(2)){//forward
List<InterceptIpTemplate> classList=new ArrayList<InterceptIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, InterceptIpTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
}else {
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,classList,null).
@@ -511,11 +476,6 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(605)){// IP Common Group
List<IpCommCfgTemplate> classList=new ArrayList<IpCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
@@ -536,9 +496,9 @@ public class IpController extends BaseController{
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(200)){// 拦截策略(域名)
if(serviceDict.getAction().equals(2)){// forward
List<InterceptDomainTemplate> classList=new ArrayList<InterceptDomainTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, InterceptDomainTemplate.class, 2);
if(serviceDict.getAction().equals(1)){// 监测
List<DomainInterceptMonitTemplate> classList=new ArrayList<DomainInterceptMonitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DomainInterceptMonitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(serviceDict.getAction().equals(64)){// 限速
@@ -567,29 +527,6 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(215)){// HTTP(s)操控
if(regionDict.getAction() == 16) {
List<HttpsRejectTemplate> classList=new ArrayList<HttpsRejectTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 48) {
List<HttpsRedirectTemplate> classList=new ArrayList<HttpsRedirectTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 80) {
List<HttpsReplaceTemplate> classList=new ArrayList<HttpsReplaceTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<StringAllNotDoLogTemplate> classList=new ArrayList<StringAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllNotDoLogTemplate.class, 2);
@@ -600,21 +537,6 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, TopicWebsiteTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(606)) {// URL Common Group
List<UrlCommCfgTemplate> classList=new ArrayList<UrlCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, UrlCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(607)) {// Domain Common Group
List<DomainCommCfgTemplate> classList=new ArrayList<DomainCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, DomainCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(608)) {// ScriberId Common Group
List<ScriberIdCommCfgTemplate> classList=new ArrayList<ScriberIdCommCfgTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ScriberIdCommCfgTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
@@ -645,29 +567,6 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(215)){// HTTP(s)操控
if(regionDict.getAction() == 16) {
List<HttpsRejectComplexTemplate> classList=new ArrayList<HttpsRejectComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 48) {
List<HttpsRedirectComplexTemplate> classList=new ArrayList<HttpsRedirectComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getAction() == 80) {
List<HttpsReplaceComplexTemplate> classList=new ArrayList<HttpsReplaceComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, ComplexStringAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<ComplexStringAllNotDoLogTemplate> classList=new ArrayList<ComplexStringAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
@@ -709,12 +608,9 @@ public class IpController extends BaseController{
,String attribute
,String classify
,String regionDictIds
,String importPath
,Integer manipulatType
,Integer profileId) {
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify,manipulatType,profileId);
return "redirect:" + adminPath+ importPath;
,String importPath) {
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify);
return "redirect:" + adminPath+ importPath;
}
//ip配置导出
@RequestMapping(value = "exportIpAddr")

View File

@@ -1,255 +0,0 @@
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
@Controller
@RequestMapping("${adminPath}/proxy/fileHijack")
public class FileHijackController extends CommonController{
@RequestMapping(value = {"list"})
public String fileHijackList(ProxyFileHijackCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileHijack/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileHijack:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileHijackCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileHijackService.getCfgById(Long.valueOf(ids));
}
//初始化各字典
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileHijack/form";
}
@RequiresPermissions(value={"proxy:fileHijack:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileHijackCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
cfgFile.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("proxy 劫持文件 上传响应信息:" + JsonMapper.toJsonString(result));
String path = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
path = data.getAccessUrl();
cfg.setPath(path);
}
}
proxyFileHijackService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}finally {
if(file != null) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileHijack:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileHijackCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileHijackService.update(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileHijackCfg> searchPage = new Page<ProxyFileHijackCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileHijack:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileHijackCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileHijackService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
Page<ProxyFileHijackCfg> searchPage = new Page<ProxyFileHijackCfg>(request, response, "a");
Page<ProxyFileHijackCfg> auditPage = new Page<ProxyFileHijackCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileHijackList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileHijack/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileHijack")
public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileHijackCfg entity, String ids, RedirectAttributes redirectAttributes) {
try {
// export data info
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<ProxyFileHijackCfg> ipLists = new ArrayList<ProxyFileHijackCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileHijackService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileHijackCfg> pageInfo = new Page<ProxyFileHijackCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(pageInfo, entity);
ipLists = page.getList();
}
for (int i = 0; i < ipLists.size(); i++) {
ipLists.get(i).setProfileName(ipLists.get(i).getCfgDesc());
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileHijackCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileHijack export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -1,251 +0,0 @@
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
@Controller
@RequestMapping("${adminPath}/proxy/fileInsertScript")
public class FileInsertScriptController extends CommonController{
@RequestMapping(value = {"list"})
public String fileInsertScriptList(ProxyFileInsertScriptCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(new Page<ProxyFileInsertScriptCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileInsertScript/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileInsertScriptService.getCfgById(Long.valueOf(ids));
}
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileInsertScript/form";
}
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_"+ prefix, FileUtils.getSuffix(filename, true));
cfgFile.transferTo(file);//复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String,Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",new Date());
srcMap.put("key",prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("注入脚本文件上传响应信息:"+JsonMapper.toJsonString(result));
String srcAccessUrl = null;
if(!StringUtil.isEmpty(result)){
ResponseData data = result.getData();
srcAccessUrl=data.getAccessUrl();
cfg.setPath(srcAccessUrl);
}
}
proxyFileInsertScriptService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}finally {
if(file != null) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileInsertScript:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileInsertScriptCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileInsertScriptService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
Page<ProxyFileInsertScriptCfg> searchPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
Page<ProxyFileInsertScriptCfg> auditPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("批量配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileInsertScriptList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+functionId;
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileInsertScript:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileInsertScriptCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileInsertScriptService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileInsertScriptCfg> searchPage = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileInsertScript/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileInsertScript")
public void exportFileHijack(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileInsertScriptCfg entity, String ids, RedirectAttributes redirectAttributes){
try {
// export data info
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<ProxyFileInsertScriptCfg> ipLists = new ArrayList<ProxyFileInsertScriptCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileInsertScriptService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileInsertScriptCfg> pageInfo = new Page<ProxyFileInsertScriptCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileInsertScriptCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileInsertScript export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -1,286 +0,0 @@
/**
*@Title: ControlController.java
*@Package com.nis.web.controller.configuration.proxy
*@Description TODO
*@author dell
*@date 2018年6月22日 下午4:35:42
*@version 版本号
*/
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
/**
* @ClassName: ControlController.java
* @Description: TODO
* @author (dell)
* @date 2018年6月22日 下午4:35:42
* @version V1.0
*/
@Controller
@RequestMapping("${adminPath}/proxy/fileResponsePage")
public class FileResponsePageController extends CommonController {
@RequestMapping(value = {"list"})
public String fileResponsePageList(ProxyFileResponsePageCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileResponsePageCfg> page = proxyFileResponsePageService.findPage(new Page<ProxyFileResponsePageCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileResponsePage/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileResponsePage:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileResponsePageCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileResponsePageService.getCfgById(Long.valueOf(ids));
}
// initFormCondition(model);
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileResponsePage/form";
}
/**
* 保存 文件
* 1、将文件上传到 service 接口
* 2、将文件信息及 1返回的结果 保存到数据库
* @param model
* @param request
* @param response
* @param cfgFile
* @param cfg
* @param redirectAttributes
* @return
*/
@RequiresPermissions(value={"proxy:fileResponsePage:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileResponsePageCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_"+ prefix, FileUtils.getSuffix(filename, true));
cfgFile.transferTo(file);//复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String,Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",new Date());
srcMap.put("key",prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("http 重定向阻断文件上传响应信息:"+JsonMapper.toJsonString(result));
String srcAccessUrl = null;
if(!StringUtil.isEmpty(result)){
ResponseData data = result.getData();
srcAccessUrl=data.getAccessUrl();
cfg.setUrl(srcAccessUrl);;
}
cfg.setMd5(md5);//文件md5值
cfg.setContentLength(file.length());//文件长度
}
proxyFileResponsePageService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}finally {
if(file != null) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileResponsePage:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileResponsePageCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileResponsePageService.update(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileResponsePageCfg> searchPage = new Page<ProxyFileResponsePageCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileResponsePage:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileResponsePageCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileResponsePageService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
Page<ProxyFileResponsePageCfg> searchPage = new Page<ProxyFileResponsePageCfg>(request, response, "a");
Page<ProxyFileResponsePageCfg> auditPage = new Page<ProxyFileResponsePageCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileResponsePageList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileResponsePage/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileResponsePage")
public void exportPxy(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileResponsePageCfg entity, String ids, RedirectAttributes redirectAttributes) {
try {
// export data info
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<ProxyFileResponsePageCfg> ipLists = new ArrayList<ProxyFileResponsePageCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileResponsePageService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileResponsePageCfg> pageInfo = new Page<ProxyFileResponsePageCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileResponsePageCfg> page = proxyFileResponsePageService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileResponsePageCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileHijack export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -15,7 +15,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -26,7 +25,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.ToMaatResult.ResponseData;
@@ -141,81 +139,27 @@ public class FileStrategyController extends CommonController {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileStrategy:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileStrategyCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileStrategyService.update(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileStrategyCfg> searchPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
public String delete(Integer isAudit,Integer isValid,
String ids,
Integer functionId,
RedirectAttributes redirectAttributes){
proxyFileStrategyService.update(isAudit,isValid,ids,functionId);
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId;
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileStrategy:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileStrategyCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileStrategyService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
Page<ProxyFileStrategyCfg> searchPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
Page<ProxyFileStrategyCfg> auditPage = new Page<ProxyFileStrategyCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileStrategyList(cfg, model, request, response);
public String audit(Integer isAudit,Integer isValid,String ids
,Integer functionId, RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
proxyFileStrategyService.audit(isAudit, isValid, functionId, ids);
addMessage(redirectAttributes,"success", "audit_success");
}
return "redirect:" + adminPath +"/proxy/fileStrategy/list?functionId="+functionId;
}

View File

@@ -1,246 +0,0 @@
package com.nis.web.controller.configuration.proxy;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.FileUtils;
import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
@Controller
@RequestMapping("${adminPath}/proxy/fileTrafficMirror")
public class FileTrafficMirrorController extends CommonController {
@RequestMapping(value = {"list"})
public String fileTrafficMirrorList(ProxyFileTrafficMirrorCfg cfg,Model model,HttpServletRequest request,HttpServletResponse response) {
Page<ProxyFileTrafficMirrorCfg> page = proxyFileTrafficMirrorService.findPage(new Page<ProxyFileTrafficMirrorCfg>(request, response,"a"), cfg);
model.addAttribute("page", page);
model.addAttribute("cfg", cfg);
initPageCondition(model);
return "/cfg/proxy/fileTrafficMirror/list";
}
@RequestMapping(value = {"form"})
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
public String fileform(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg
,String ids
,RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
cfg = proxyFileTrafficMirrorService.getCfgById(Long.valueOf(ids));
}
initFormCondition(model, cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/proxy/fileTrafficMirror/form";
}
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
@RequestMapping(value = {"saveOrUpdate"})
public String saveOrUpdate(Model model,HttpServletRequest request
,HttpServletResponse response,MultipartFile cfgFile,
@ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg,
RedirectAttributes redirectAttributes){
File file = null;
try{
if(cfgFile != null) {
String filename = cfgFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_"+ prefix, suffix);
cfgFile.transferTo(file);//复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String,Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");//源文件存入数据中心
srcMap.put("createTime",new Date());
srcMap.put("key",prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("注入脚本文件上传响应信息:"+JsonMapper.toJsonString(result));
}
proxyFileTrafficMirrorService.saveOrUpdate(cfg);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch(Exception e){
logger.error("信息保存失败",e);
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error","request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes,"error","save_failed");
LogUtils.saveLog(request, null, e, null);
}
}finally {
if(file != null) {
file.delete();//删除临时文件
}
}
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"audit"})
@RequiresPermissions(value={"proxy:fileTrafficMirror:confirm"})
public String audit(Model model, @ModelAttribute("cfg") ProxyFileTrafficMirrorCfg cfg, Integer isValid, Integer isAudit,
String ids, Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,
HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
String[] idArray = ids.split(",");
for (String id : idArray) {
try {
proxyFileTrafficMirrorService.audit(isAudit, isValid, functionId, id);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
logger.error(e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error(e);
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
} else {
Page<ProxyFileTrafficMirrorCfg> searchPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
Page<ProxyFileTrafficMirrorCfg> auditPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
try {
BeanUtils.copyProperties(searchPage, auditPage);
auditAll(auditPage, isValid, cfg);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("批量配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return fileTrafficMirrorList(cfg, model, request, response);
}
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+functionId;
}
@RequestMapping(value = {"delete"})
@RequiresPermissions(value={"proxy:fileTrafficMirror:config"})
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")ProxyFileTrafficMirrorCfg cfg,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes){
try {
if (!StringUtil.isEmpty(ids)) {
proxyFileTrafficMirrorService.delete(isAudit, isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<ProxyFileTrafficMirrorCfg> searchPage = new Page<ProxyFileTrafficMirrorCfg>(request, response, "d");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath +"/proxy/fileTrafficMirror/list?functionId="+functionId;
}
@RequestMapping(value = "exportFileTrafficMirror")
public void exportFileHijack(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") ProxyFileTrafficMirrorCfg entity, String ids, RedirectAttributes redirectAttributes){
try {
// export data info
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<ProxyFileTrafficMirrorCfg> ipLists = new ArrayList<ProxyFileTrafficMirrorCfg>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = proxyFileTrafficMirrorService.findByList(ids);
} else {
entity.setTableName(IpPortCfg.getTablename());
Page<ProxyFileTrafficMirrorCfg> pageInfo = new Page<ProxyFileTrafficMirrorCfg>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<ProxyFileTrafficMirrorCfg> page = proxyFileTrafficMirrorService.findPage(pageInfo, entity);
ipLists = page.getList();
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), ProxyFileTrafficMirrorCfg.class);
String cfgIndexInfoNoExport = ",config_describe,whether_area_block,block_type,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
dataMap.put(entity.getMenuNameCode(), ipLists);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("proxyFileTrafficMirror export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}

View File

@@ -25,7 +25,6 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
@@ -64,8 +63,8 @@ public class HttpRedirectPolicyController extends BaseController {
model.addAttribute("page", page);
initPageCondition(model, cfg);
// 获取所有的响应文件内容,阻断,或重定向时可以选择
List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService
.getProxyFileResponsePageCfgList(new ProxyFileResponsePageCfg());
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
return "/cfg/proxy/control/httpRedirectList";
}
@@ -175,8 +174,8 @@ public class HttpRedirectPolicyController extends BaseController {
initFormCondition(model, entity);
}
// 获取所有的响应文件内容,阻断,或重定向时可以选择
List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService
.getProxyFileResponsePageCfgList(new ProxyFileResponsePageCfg());
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
model.addAttribute("_cfg", entity);
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);
return "/cfg/proxy/control/httpRedirectForm";
@@ -331,18 +330,8 @@ public class HttpRedirectPolicyController extends BaseController {
Page<CfgIndexInfo> page = httpRedirectCfgService.getHttpRedirectList(pageInfo, entity);
ipLists = page.getList();
}
Integer fucntionId = Integer.parseInt(request.getParameter("functionId"));
if(fucntionId==207){
for(CfgIndexInfo cfg:ipLists){
String userRegion3 = cfg.getUserRegion3();
if(!"".equals(userRegion3) && userRegion3 !=null){
ProxyFileResponsePageCfg temp = new ProxyFileResponsePageCfg();
temp.setCompileId(Integer.parseInt(cfg.getUserRegion3()));
List<ProxyFileResponsePageCfg> list = proxyFileResponsePageService.getProxyFileResponsePageCfgList(temp);
cfg.setUserRegion2(list.get(0).getFileDesc());
}
}
}
//日志总量
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids
@@ -376,12 +365,12 @@ public class HttpRedirectPolicyController extends BaseController {
if (entity.getFunctionId() == 207 || entity.getFunctionId() == 208) {
if (StringUtil.isEmpty(str.getUserRegion2())) {
if (!StringUtil.isEmpty(str.getUserRegion3())) {
ProxyFileResponsePageCfg file = new ProxyFileResponsePageCfg();
ProxyFileStrategyCfg file = new ProxyFileStrategyCfg();
file.setCompileId(Integer.valueOf(str.getUserRegion3()));
List<ProxyFileResponsePageCfg> allProxyFileResponsePageCfg = proxyFileResponsePageService
.getProxyFileResponsePageCfgList(file);
if (allProxyFileResponsePageCfg != null && allProxyFileResponsePageCfg.size() > 0) {
str.setUserRegion2(allProxyFileResponsePageCfg.get(0).getCfgDesc());
List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService
.getProxyFileStrategyCfgList(file);
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) {
str.setUserRegion2(allProxyFileStrategys.get(0).getCfgDesc());
}
}
}
@@ -405,15 +394,13 @@ public class HttpRedirectPolicyController extends BaseController {
String cfgIndexInfoNoExport = ",policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
if (entity.getFunctionId() == 207) {
cfgIndexInfoNoExport = ",log_total,policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:response_code-userregion2:response_content-";
} else if (entity.getFunctionId() == 208) {
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,userregion5,&userregion1:redirect_response_code-userregion2:redirect_url-";
} else if (entity.getFunctionId() == 209) {
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
} else if (entity.getFunctionId() == 211) {
cfgIndexInfoNoExport = ",do_log,log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
}else if (entity.getFunctionId() == 210) {
cfgIndexInfoNoExport = ",log_total,policy_name,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
}
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
@@ -501,7 +488,12 @@ public class HttpRedirectPolicyController extends BaseController {
dataMap.put(entity.getMenuNameCode(), ipLists);
dataMap.put("NTC_HTTP_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
if (entity.getFunctionId() != 211) {
if (entity.getFunctionId() != 208 && entity.getFunctionId() != 211) {
titleList.add("NTC_HTTP_RES_BODY");
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
} else if (entity.getFunctionId() != 211) {
titleList.add("NTC_HTTP_RES_HDR");
titleList.add("NTC_HTTP_REQ_BODY");
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
@@ -510,12 +502,6 @@ public class HttpRedirectPolicyController extends BaseController {
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
if (entity.getFunctionId() != 208) {
titleList.add("NTC_HTTP_RES_BODY");
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
}
}
titleList.add("NTC_UNIVERSAL_IP");
titleList.add("NTC_SUBSCRIBE_ID");

View File

@@ -18,19 +18,15 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.InterceptPktBin;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.PxyInterceptCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.domain.configuration.PxyObjSpoofingIpPool;
import com.nis.exceptions.MaatConvertException;
@@ -40,7 +36,6 @@ import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.configuration.CommonController;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
/**
* IP相关配置控制类
@@ -62,17 +57,13 @@ public class InterceptController extends CommonController {
// 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
List<ProxyFileTrafficMirrorCfg> mirrorProfiles = new ArrayList<ProxyFileTrafficMirrorCfg>();
if (cfg.getFunctionId().equals(200)) {//改为ajax查询
//certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
//mirrorProfiles=proxyFileTrafficMirrorService.findMirrorList(null,1,1);
if (cfg.getFunctionId().equals(200)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
}
if (cfg.getFunctionId().equals(201)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
}
model.addAttribute("certificateList", certificateList);
model.addAttribute("mirrorProfiles", mirrorProfiles);
/*if(cfg.getFunctionId().equals(214)){
// IP地址仿冒策略使用策略组
//List<PolicyGroupInfo> policyGroups = policyGroupInfoService.findPolicyGroupInfosByType(6);
@@ -98,16 +89,13 @@ public class InterceptController extends CommonController {
}
// 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
List<ProxyFileTrafficMirrorCfg> mirrorProfiles = new ArrayList<ProxyFileTrafficMirrorCfg>();
// if (entity.getFunctionId().equals(200)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, null);
mirrorProfiles=proxyFileTrafficMirrorService.findMirrorList(null,1,1);
// }
// if (entity.getFunctionId().equals(201)) {
// certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
// }
model.addAttribute("certificateList", certificateList);
model.addAttribute("mirrorProfiles", mirrorProfiles);
model.addAttribute("_cfg", entity);
// IP地址仿冒策略使用策略组
@@ -122,129 +110,6 @@ public class InterceptController extends CommonController {
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes, Model model, HttpServletRequest request,
HttpServletResponse response, String ids, CfgIndexInfo entity) {
try {
if(!entity.getAction().equals(2)||!entity.getServiceId().equals(512)) {
entity.setUserRegion(null);
}else {
if(entity.getUserRegion()==null) {
entity.setUserRegion(new HashMap<String,Object>());
}
//keyring
String keyring = request.getParameter("keyring");
if(StringUtils.isNotBlank(keyring)) {
entity.getUserRegion().put("keyring", Long.parseLong(keyring));
}else {
entity.getUserRegion().put("keyring", 1);
}
Map<String,Object> map = new HashMap();
//exclusions
String ev_cert = request.getParameter("ev_cert");
String cert_transparency = request.getParameter("cert_transparency");
String client_cert_req = request.getParameter("client_cert_req");
String pinning = request.getParameter("pinning");
String protocol_errors = request.getParameter("protocol_errors");
if(StringUtils.isNotBlank(ev_cert)){
map.put("ev_cert", Integer.parseInt(ev_cert.trim()));
}else {
map.put("ev_cert", 0);
}
if(StringUtils.isNotBlank(cert_transparency)){
map.put("cert_transparency",Integer.parseInt(cert_transparency.trim()));
}else {
map.put("cert_transparency", 0);
}
if(StringUtils.isNotBlank(pinning)){
map.put("pinning", Integer.parseInt(pinning.trim()));
}else {
map.put("pinning", 0);
}
if(StringUtils.isNotBlank(protocol_errors)){
map.put("protocol_errors", Integer.parseInt(protocol_errors.trim()));
}else {
map.put("protocol_errors", 0);
}
if(StringUtils.isNotBlank(client_cert_req)){
map.put("client_cert_req", Integer.parseInt(client_cert_req.trim()));
}else {
map.put("client_cert_req", 0);
}
entity.getUserRegion().put("exclusions", map);
//cert_verify
Map<String,Object> map1=new HashMap<>();
map=new HashMap<>();
String cn=request.getParameter("cn");
String issuer=request.getParameter("issuer");
String self_signed=request.getParameter("self-signed");
String expiration=request.getParameter("expiration");
if(StringUtils.isNotBlank(cn)){
map.put("cn",Integer.parseInt(cn.trim()));
}else {
map.put("cn",0);
}
if(StringUtils.isNotBlank(issuer)){
map.put("issuer",Integer.parseInt(issuer.trim()));
}else {
map.put("issuer",0);
}
if(StringUtils.isNotBlank(self_signed)){
map.put("self-signed",Integer.parseInt(self_signed.trim()));
}else {
map.put("self-signed",0);
}
if(StringUtils.isNotBlank(expiration)){
map.put("expiration",Integer.parseInt(expiration.trim()));
}else {
map.put("expiration",0);
}
map1.put("approach", map);
String fail_method=request.getParameter("fail_method");
if(StringUtils.isNotBlank(fail_method)){
map1.put("fail_method",fail_method.trim());
}
entity.getUserRegion().put("cert_verify", map1);
//ssl_ver
map=new HashMap<>();
String mirror_client=request.getParameter("mirror_client");
String allow_http2 = request.getParameter("allow_http2");
String min=request.getParameter("min");
String max=request.getParameter("max");
if(StringUtils.isNotBlank(mirror_client)){
map.put("mirror_client", Integer.parseInt(mirror_client.trim()));
}else {
mirror_client="0";
map.put("mirror_client", 0);
}
if(StringUtils.isNotBlank(allow_http2)){
map.put("allow_http2", Integer.parseInt(allow_http2.trim()));
}else {
allow_http2="0";
map.put("allow_http2", 0);
}
if("0".equals(mirror_client)) {
if(StringUtils.isNotBlank(min)){
map.put("min", min.trim());
}
if(StringUtils.isNotBlank(max)){
map.put("max", max.trim());
}
}
entity.getUserRegion().put("ssl_ver", map);
//decrypt_mirror
map=new HashMap<>();
String enable=request.getParameter("enable");
String mirror_profile=request.getParameter("mirror_profile");
if(StringUtils.isNotBlank(enable)){
map.put("enable", Integer.parseInt(enable.trim()));
}else {
enable="0";
map.put("enable", 0);
}
if("1".equals(enable)) {
if(StringUtils.isNotBlank(mirror_profile)){
map.put("mirror_profile", Integer.parseInt(mirror_profile));
}
}
entity.getUserRegion().put("decrypt_mirror", map);
}
interceptCfgService.saveInterceptCfg(entity);
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
@@ -304,33 +169,6 @@ public class InterceptController extends CommonController {
model.addAttribute("tabList", tabList);
return "/cfg/intercept/interceptSubList";
}
//替换keyring,mirror_profiles
@RequestMapping(value = { "/ajaxGetValues" })
@ResponseBody
public Map<String,Object> ajaxGetValues(Model model, @RequestParam(required=false,value="keyrings")String keyrings, @RequestParam(required=false,value="mirrorProfiles")String mirrorProfiles) {
Map<String,Object> datas=new HashMap<>();
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
List<ProxyFileTrafficMirrorCfg> mirrorProfileList = new ArrayList<ProxyFileTrafficMirrorCfg>();
// if (entity.getFunctionId().equals(200)) {
Map<String,Object> _datas=new HashMap<>();
if(StringUtils.isNotBlank(keyrings)) {
certificateList = pxyObjKeyringService.findAllPxyObjKeyrings(keyrings, 1, 1, null);
for(PxyObjKeyring certificate:certificateList) {
_datas.put(certificate.getCompileId().toString(), certificate.getCfgDesc());
}
datas.put("keyrings", _datas);
}
if(StringUtils.isNotBlank(mirrorProfiles)) {
mirrorProfileList=proxyFileTrafficMirrorService.findMirrorList(mirrorProfiles,1,1);
_datas=new HashMap<>();
for(ProxyFileTrafficMirrorCfg mirrorProfile:mirrorProfileList) {
_datas.put(mirrorProfile.getCompileId().toString(), mirrorProfile.getCfgDesc());
}
datas.put("mirrorProfiles", _datas);
}
return datas;
}
@RequestMapping(value = { "auditInterceptIpCfg", "auditInterceptDomainCfg", "auditInterceptIpPayloadCfg" })
public String auditInterceptIpCfg(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid,
@@ -446,7 +284,6 @@ public class InterceptController extends CommonController {
Map<String, String> replaceExportMap = new HashMap<String, String>();
Properties prop = getMsgProp();
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
List<PxyInterceptCfg> pxyInterceptCfgs=new ArrayList<>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = ipCfgService.getByIdsList(ids);
@@ -489,132 +326,59 @@ public class InterceptController extends CommonController {
}
// 获取证书信息
List<PxyObjKeyring> certificateList = new ArrayList<PxyObjKeyring>();
//获取镜像相关信息
List<ProxyFileTrafficMirrorCfg> mirrorProfileList=new ArrayList<>();
if (entity.getFunctionId().equals(200)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "ip");
mirrorProfileList=proxyFileTrafficMirrorService.findMirrorList(null, 1, 1);
}
if (entity.getFunctionId().equals(201)) {
certificateList = pxyObjKeyringService.findPxyObjKeyrings(null, 1, 1, "domain");
}
for (CfgIndexInfo str : ipLists) {
PxyInterceptCfg pxyInterceptCfg=new PxyInterceptCfg();
BeanUtils.copyProperties(str, pxyInterceptCfg);
if (!StringUtil.isEmpty(str.getUserRegion5())) {
String cs = DictUtils.getDictLabel("INTERCEPT_DOMAIN_INTENSITY", str.getUserRegion5());
str.setUserRegion5(prop.getProperty(cs));
}
str.setUserRegion(new HashMap<String,Object>());
if (certificateList != null) {
if (entity.getFunctionId().equals(200) ) {
if (!StringUtil.isEmpty(str.getUserRegion1())&&str.getUserRegion1().startsWith("{")) {
Map<String,Object> userregion=BaseService.gsonFromJson(str.getUserRegion1(), Map.class);
if(userregion.containsKey("keyring")) {
for (PxyObjKeyring pxyObjKeyring : certificateList) {
if (String.valueOf(pxyObjKeyring.getCompileId()).equals(userregion.get("keyring").toString())) {
pxyInterceptCfg.setKeyring(pxyObjKeyring.getCfgDesc());
break;
}
if (entity.getFunctionId() == 200 || entity.getFunctionId() == 201) {
if (!StringUtil.isEmpty(str.getUserRegion1())) {
boolean flag = false;
for (PxyObjKeyring pxyObjKeyring : certificateList) {
if (str.getUserRegion1().equals(String.valueOf(pxyObjKeyring.getCompileId()))) {
str.setUserRegion1(pxyObjKeyring.getCfgDesc());
flag = true;
break;
}
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")){
pxyInterceptCfg.setEvCert(((Map<String,Object>)userregion.get("exclusions")).get("ev_cert").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("cert_transparency")){
pxyInterceptCfg.setCertTransparency(((Map<String,Object>)userregion.get("exclusions")).get("cert_transparency").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")) {
pxyInterceptCfg.setClientCertReq(((Map<String,Object>)userregion.get("exclusions")).get("client_cert_req").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")) {
pxyInterceptCfg.setPinning(((Map<String,Object>)userregion.get("exclusions")).get("pinning").toString());
}
if(((Map<String,Object>)userregion.get("exclusions")).containsKey("ev_cert")) {
pxyInterceptCfg.setProtocolErrors(String.valueOf(((Map<String,Object>)userregion.get("exclusions")).get("protocol_errors")));
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("cn")) {
pxyInterceptCfg.setCn(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("cn").toString());
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("issuer")) {
pxyInterceptCfg.setIssuer(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("issuer").toString());
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("self-signed")) {
pxyInterceptCfg.setSelfSigned(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("self-signed").toString());
}
if(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).containsKey("expiration")) {
pxyInterceptCfg.setExpiration(((Map<String,Object>)((Map<String,Object>)userregion.get("cert_verify")).get("approach")).get("expiration").toString());
}
if(((Map<String,Object>)userregion.get("cert_verify")).containsKey("fail_method")) {
pxyInterceptCfg.setFailMethod(((Map<String,Object>)userregion.get("cert_verify")).get("fail_method").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("min")) {
pxyInterceptCfg.setMin(((Map<String,Object>)userregion.get("ssl_ver")).get("min").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("max")) {
pxyInterceptCfg.setMax(((Map<String,Object>)userregion.get("ssl_ver")).get("max").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("mirror_client")) {
pxyInterceptCfg.setMirrorClient(((Map<String,Object>)userregion.get("ssl_ver")).get("mirror_client").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("allow_http2")) {
pxyInterceptCfg.setAllowHttp2(((Map<String,Object>)userregion.get("ssl_ver")).get("allow_http2").toString());
}
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("enable")) {
pxyInterceptCfg.setEnable(((Map<String,Object>)userregion.get("decrypt_mirror")).get("enable").toString());
}
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("mirror_profile")) {
}
//pxyInterceptCfg.setMirrorProfile(((Map<String,Object>)userregion.get("decrypt_mirror")).get("mirror_profile").toString());
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("mirror_profile")) {
for (ProxyFileTrafficMirrorCfg mirrorProfile : mirrorProfileList) {
if (String.valueOf(mirrorProfile.getCompileId()).equals(((Map<String,Object>)userregion.get("decrypt_mirror")).get("mirror_profile").toString())) {
pxyInterceptCfg.setMirrorProfile(mirrorProfile.getCfgDesc());
break;
}
}
if (!flag) {
str.setUserRegion1(null);
}
}
}
}
pxyInterceptCfgs.add(pxyInterceptCfg);
}
titleList.add(entity.getMenuNameCode());
if(entity.getFunctionId().equals(200)) {
classMap.put(entity.getMenuNameCode(), PxyInterceptCfg.class);
}else {
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
}
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
String cfgIndexInfoNoExport = "";
String ipPortInfoNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label,block_type,"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String interceptNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label,block_type,"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,block_type,";
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
List<IpPortCfg> ipList = new ArrayList<IpPortCfg>();
List<BaseStringCfg> httpUrlList = new ArrayList<BaseStringCfg>();
List<BaseStringCfg> pktBinList = new ArrayList<BaseStringCfg>();
int index=0;
for (CfgIndexInfo cfg : ipLists) {
for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum"));
if (entity.getFunctionId().equals(200)){
pxyInterceptCfgs.get(index).setTotalLogs((Long)logTotal.get("sum"));
}
break;
}
}
@@ -624,40 +388,29 @@ public class InterceptController extends CommonController {
pktBinList.addAll(maps.get("PXY_INTERCEPT_PKT_BIN"));
if (entity.getFunctionId() == 200){
Properties msgProp = getMsgProp();
if(cfg.getAction().equals(2)) {
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("intercept"));
if(cfg.getAction().equals(1)) {
cfg.setUserRegion5(msgProp.getProperty("intercept"));
}else if(cfg.getAction().equals(48)) {
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("action_spoofing"));
cfg.setUserRegion5(msgProp.getProperty("action_spoofing"));
}else if(cfg.getAction().equals(128)) {
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty("bypass"));
cfg.setUserRegion5(msgProp.getProperty("bypass"));
}else {
pxyInterceptCfgs.get(index).setUserRegion5(msgProp.getProperty(DictUtils.getDictLabels("SERVICE_ACTION", cfg.getAction().toString(), cfg.getAction().toString())));
cfg.setUserRegion5(msgProp.getProperty(DictUtils.getDictLabels("SERVICE_ACTION", cfg.getAction().toString(), cfg.getAction().toString())));
}
}
if (214==entity.getFunctionId()) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
}
}
index++;
}
//为何多循环一次???
/*if (214==entity.getFunctionId()) {
if (214==entity.getFunctionId()) {
for (CfgIndexInfo cfg : ipLists) {
if (!StringUtil.isBlank(cfg.getUserRegion1())) {
cfg.setUserRegion1(DictUtils.getDictLabels("SPOOFING_IP_TYPE", cfg.getUserRegion1(),cfg.getUserRegion1()));
}
}
}*/
}
pktBinList = BaseStringCfg.replaceBaseKeyList(pktBinList);
httpUrlList = BaseStringCfg.baseHexList(httpUrlList);
if(entity.getFunctionId().equals(200)) {
dataMap.put(entity.getMenuNameCode(), pxyInterceptCfgs);
}else {
dataMap.put(entity.getMenuNameCode(), ipLists);
}
dataMap.put(entity.getMenuNameCode(), ipLists);
if (entity.getFunctionId() == 212) { // IP Payload
cfgIndexInfoNoExport = ",policy_name,group_name,userregion4,userregion5,&userregion1:replace_zone-userregion2:replaced_content-userregion3:replace_content-";
titleList.add("PXY_INTERCEPT_IP");
@@ -669,15 +422,11 @@ public class InterceptController extends CommonController {
dataMap.put("PXY_INTERCEPT_IP", ipList);
dataMap.put("PXY_INTERCEPT_PKT_BIN", pktBinList);
} else if (entity.getFunctionId() == 200) {// IP拦截
cfgIndexInfoNoExport = ",log_total,userRegion1,userRegion5,do_log,policy_name,group_name,userregion3,userregion4,block_type,&userregion2:ratelimit-userregion5:block_type";
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,block_type,&userregion1:intercept_file_strategy-userregion2:ratelimit-userregion5:block_type";
titleList.add("PXY_INTERCEPT_IP");
classMap.put("PXY_INTERCEPT_IP", IpPortCfg.class);
noExportMap.put("PXY_INTERCEPT_IP", ipPortInfoNoExport);
dataMap.put("PXY_INTERCEPT_IP", ipList);
titleList.add("PXY_INTERCEPT_DOMAIN");
classMap.put("PXY_INTERCEPT_DOMAIN", HttpUrlCfg.class);
noExportMap.put("PXY_INTERCEPT_DOMAIN", httpUrlCfgNoExport);
dataMap.put("PXY_INTERCEPT_DOMAIN", httpUrlList);
} else if (entity.getFunctionId() == 201) {// 域名拦截
cfgIndexInfoNoExport = ",policy_name,group_name,userregion3,userregion4,&userregion2:ratelimit-userregion1:intercept_file_strategy-userregion5:intercept_intensity-";
titleList.add("NTC_HTTP_URL");

View File

@@ -1,565 +0,0 @@
package com.nis.web.controller.configuration.proxy;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.alibaba.fastjson.JSON;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.Page;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.domain.callback.ProxyFileStrategyCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.ManipulatCfgExport;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
import jersey.repackaged.com.google.common.collect.Lists;
/**
* 操控策略业务
*/
@Controller
@RequestMapping("${adminPath}/proxy/control/manipulatPolicy")
public class ManipulatPolicyController extends BaseController {
@RequestMapping("list")
public String list(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, HttpServletRequest request, HttpServletResponse response) {
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<CfgIndexInfo> page = manipulatPolicyService.getPolicyList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model, cfg);
// 获取所有的响应文件内容Block可以选择
/*List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);*/
manipulatPolicyService.setFileRegion(model);
return "/cfg/proxy/control/manipulatPolicyList";
}
@RequestMapping("form")
public String form(Model model, @ModelAttribute("cfg") CfgIndexInfo entity, HttpServletRequest request, HttpServletResponse response, String ids) {
if (StringUtils.isNotBlank(ids)) {
entity = manipulatPolicyService.getPolicyCfg(Long.parseLong(ids), null);
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
entity.setHttpUrl(urlCfg);
HttpReqHeadCfg reqHdrCfg = new HttpReqHeadCfg();
reqHdrCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_HEAD_REGION);
entity.setHttpReqHdr(reqHdrCfg);
HttpResHeadCfg resHdrCfg = new HttpResHeadCfg();
resHdrCfg.setCfgType(Constants.HTTP_REDIRECT_RES_HEAD_REGION);
entity.setHttpResHdr(resHdrCfg);
HttpBodyCfg reqBodyCfg = new HttpBodyCfg();
reqBodyCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION);
entity.setHttpReqBody(reqBodyCfg);
HttpBodyCfg resBodyCfg = new HttpBodyCfg();
resBodyCfg.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION);
entity.setHttpResBody(resBodyCfg);
IpPortCfg ipPortCfg = new IpPortCfg();
ipPortCfg.setCfgType(Constants.HTTP_REDIRECT_IP_REGION);
entity.setIpPort(ipPortCfg);
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
if (entity.getHttpUrlList().size() == 0) {
entity.getHttpUrlList().add(urlCfg);
}
if (entity.getHttpReqHdrList().size() == 0) {
entity.getHttpReqHdrList().add(reqHdrCfg);
}
if (entity.getHttpResHdrList().size() == 0) {
entity.getHttpResHdrList().add(resHdrCfg);
}
if (entity.getHttpReqBodyList().size() == 0) {
entity.getHttpReqBodyList().add(reqBodyCfg);
}
if (entity.getHttpResBodyList().size() == 0) {
entity.getHttpResBodyList().add(resBodyCfg);
}
if (entity.getIpPortList().size() == 0) {
entity.getIpPortList().add(ipPortCfg);
}
if (entity.getNtcSubscribeIdCfgList().size() == 0) {
entity.getNtcSubscribeIdCfgList().add(subscribeIdCfg);
}
initUpdateFormCondition(model, entity);
manipulatPolicyService.setFileRegion(model);
} else {
// 设置http各类配置的配置域类型
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_REDIRECT_URL_REGION);
entity.setHttpUrl(urlCfg);
HttpReqHeadCfg reqHdrCfg = new HttpReqHeadCfg();
reqHdrCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_HEAD_REGION);
entity.setHttpReqHdr(reqHdrCfg);
HttpResHeadCfg resHdrCfg = new HttpResHeadCfg();
resHdrCfg.setCfgType(Constants.HTTP_REDIRECT_RES_HEAD_REGION);
entity.setHttpResHdr(resHdrCfg);
HttpBodyCfg reqBodyCfg = new HttpBodyCfg();
reqBodyCfg.setCfgType(Constants.HTTP_REDIRECT_REQ_BODY_REGION);
entity.setHttpReqBody(reqBodyCfg);
HttpBodyCfg resBodyCfg = new HttpBodyCfg();
resBodyCfg.setCfgType(Constants.HTTP_REDIRECT_RES_BODY_REGION);
entity.setHttpResBody(resBodyCfg);
IpPortCfg ipPortCfg = new IpPortCfg();
ipPortCfg.setCfgType(Constants.HTTP_IP_REGION);
entity.setIpPort(ipPortCfg);
// subscribeId
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
subscribeIdCfg.setCfgType(Constants.PXY_CRTL_SUBSCRIBE_ID_REGION);
entity.setNtcSubscribeIdCfg(subscribeIdCfg);
List<HttpUrlCfg> urlList = new ArrayList<HttpUrlCfg>();
urlList.add(urlCfg);
entity.setHttpUrlList(urlList);
List<HttpReqHeadCfg> reqHdrList = new ArrayList<HttpReqHeadCfg>();
reqHdrList.add(reqHdrCfg);
entity.setHttpReqHdrList(reqHdrList);
List<HttpResHeadCfg> resHdrList = new ArrayList<HttpResHeadCfg>();
resHdrList.add(resHdrCfg);
entity.setHttpResHdrList(resHdrList);
List<HttpBodyCfg> reqBodyList = new ArrayList<HttpBodyCfg>();
reqBodyList.add(reqBodyCfg);
entity.setHttpReqBodyList(reqBodyList);
List<HttpBodyCfg> resBodyList = new ArrayList<HttpBodyCfg>();
resBodyList.add(resBodyCfg);
entity.setHttpResBodyList(resBodyList);
List<IpPortCfg> ipPortList = new ArrayList<IpPortCfg>();
ipPortList.add(ipPortCfg);
entity.setIpPortList(ipPortList);
List<NtcSubscribeIdCfg> subscribeCfgList = Lists.newArrayList();
subscribeCfgList.add(subscribeIdCfg);
entity.setNtcSubscribeIdCfgList(subscribeCfgList);
initFormCondition(model, entity);
}
// 获取所有的响应文件内容Block可以选择
/*List<ProxyFileStrategyCfg> allProxyFileStrategys = proxyFileStrategyService.getProxyFileStrategyCfgList(new ProxyFileStrategyCfg());
model.addAttribute("allProxyFileStrategys", allProxyFileStrategys);*/
model.addAttribute("_cfg", entity);
return "/cfg/proxy/control/manipulatPolicyForm";
}
@RequestMapping("saveOrUpdate")
public String saveOrUpdate(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
manipulatPolicyService.savePolicyCfg(cfg);
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) { // 配置仅保存
addMessage(redirectAttributes, "success", "save_success");
}else { // 配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (Exception e) {
logger.error("save_failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/proxy/control/manipulatPolicy/list?functionId=" + cfg.getFunctionId();
}
@RequestMapping("ajaxPolicySubList")
public String ajaxPolicySubList(Model model, Long cfgId, Integer index, Integer compileId) {
CfgIndexInfo cfg = manipulatPolicyService.getPolicyCfg(cfgId, compileId);
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
return "/cfg/proxy/control/httpRedirectSubList";
}
@RequestMapping("delete")
public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")CfgIndexInfo cfg) {
try {
if (!StringUtil.isEmpty(ids)) {
manipulatPolicyService.updatePolicyCfgValid(isValid, ids, functionId);
addMessage(redirectAttributes, "success", "delete_success");
}else {
// 批量删除
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
deleteAll(searchPage, functionId, cfg);
}
} catch (Exception e) {
logger.error("配置删除失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "delete_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/proxy/control/manipulatPolicy/list?functionId=" + functionId;
}
@RequestMapping("audit")
public String audit(Model model, @ModelAttribute("cfg") CfgIndexInfo cfg, Integer isValid, Integer isAudit, String ids,
Integer functionId, RedirectAttributes redirectAttributes, HttpServletResponse response,HttpServletRequest request) {
if (!StringUtil.isEmpty(ids)) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for (String id : idArray) {
entity = manipulatPolicyService.getPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
manipulatPolicyService.auditPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
logger.info("http重定向配置下发失败" + e.getMessage());
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
} else {// 条件下所有配置审核
Page<CfgIndexInfo> searchPage = new Page<CfgIndexInfo>(request, response, "a");
Page<CfgIndexInfo> auditPage = new Page<CfgIndexInfo>(request, response, "a");
BeanUtils.copyProperties(searchPage, auditPage);
try {
auditAll(auditPage, isValid, cfg);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("配置下发失败:", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "audit_failed");
LogUtils.saveLog(request, null, e, null);
}
}
return list(model, cfg, request, response);
}
return "redirect:" + adminPath + "/proxy/control/manipulatPolicy/list?functionId=" + functionId;
}
// 配置导出
@RequestMapping(value = "exportPolicy")
public void exportPolicy(Model model,@ModelAttribute("cfg") CfgIndexInfo entity, String ids, RedirectAttributes redirectAttributes,
HttpServletRequest request, HttpServletResponse response) {
try {
// export data info
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
List<CfgIndexInfo> ipLists = new ArrayList<CfgIndexInfo>();
// 导出选中记录
if (!StringUtil.isEmpty(ids)) {
ipLists = ipCfgService.getByIdsList(ids);
} else {
Page<CfgIndexInfo> pageInfo = new Page<CfgIndexInfo>(request, response, "a");
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
Page<CfgIndexInfo> page = manipulatPolicyService.getPolicyList(pageInfo, entity);
ipLists = page.getList();
}
//日志总量
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids
Set<Integer> set=new HashSet<Integer>();//服务ids
Map<String, String> blockDict = DictUtils.getDictMap("RESPONSE_CODE"); // Block
Map<String, String> redirectDict = DictUtils.getDictMap("REDIRECT_RESPONSE_CODE"); // Redirect
Map<String, String> replaceDict = DictUtils.getDictMap("CONTROL_REPLACE_ZONE"); // Replace
// 用于检索引用的文件配置信息
ProxyFileResponsePageCfg searchResponseFile = new ProxyFileResponsePageCfg();
ProxyFileHijackCfg searchHijackFile = new ProxyFileHijackCfg();
ProxyFileInsertScriptCfg searchInsertFile = new ProxyFileInsertScriptCfg();
Properties prop = getMsgProp();
List<ManipulatCfgExport> baseLists = new ArrayList<ManipulatCfgExport>();
for (CfgIndexInfo source : ipLists) {
ManipulatCfgExport str = new ManipulatCfgExport();
BeanUtils.copyProperties(source, str);
str.setActionExport("action_manipulate");
if(str.getUserRegion5().equals("85")) {
str.setMethodExport("action_hijack");
}else if(str.getUserRegion5().equals("90")) {
str.setMethodExport("action_insert");
}else {
str.setMethodExport(str.getUserRegion5());
}
if(str.getIsAudit()!=0){
set.add(str.getServiceId());
compileIds.append(str.getCompileId()+",");
}else{
Map<String,Object> logTotal=new HashMap<String,Object>();
logTotal.put("compileId", str.getCompileId()+"");
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
if (!str.getUserRegion5().equals("85") && !str.getUserRegion5().equals("90")) {
String value = "";
/*if(str.getUserRegion5().equals("16")) {// Block
value = blockDict.get(str.getUserRegion1());
str.setResponseCode(prop.getProperty(value));
str.setUserRegion1(str.getUserRegion2());
str.setUserRegion2(null);
}else*/
if(str.getUserRegion5().equals("48")) {// Redirect
value = redirectDict.get(str.getUserRegion1());
str.setResponseCode(prop.getProperty(value));
str.setUserRegion1(null);
}else if(str.getUserRegion5().equals("80")) {// Replace
value = replaceDict.get(str.getUserRegion1());
str.setUserRegion5(str.getUserRegion3());
str.setUserRegion3(prop.getProperty(value));
str.setUserRegion4(str.getUserRegion2());
str.setUserRegion1(null);
str.setUserRegion2(null);
}
/*if (str.getUserRegion5().equals("16") || str.getUserRegion5().equals("48")) {
if (!StringUtil.isEmpty(str.getUserRegion3())) { // 是否存在文件策略
searchResponseFile.setCompileId(Integer.valueOf(str.getUserRegion3()));
List<ProxyFileResponsePageCfg> allProxyFileStrategys = proxyFileResponsePageService.getProxyFileResponsePageCfgList(searchResponseFile);
if (allProxyFileStrategys != null && allProxyFileStrategys.size() > 0) {
str.setUserRegion1(allProxyFileStrategys.get(0).getFileDesc());
}
str.setUserRegion3(null);
}
}*/
}
if(str.getUserRegion5().equals("48") || str.getUserRegion5().equals("85") ||
str.getUserRegion5().equals("90")) {
if(str.getUserRegion5().equals("85")) {
searchHijackFile.setCompileId(Integer.parseInt(source.getUserRegion4()));
Page<ProxyFileHijackCfg> page = proxyFileHijackService.findPage(new Page<ProxyFileHijackCfg>(request, response, "a"), searchHijackFile);
List<ProxyFileHijackCfg> list = page.getList();
if(list != null && list.size() > 0) {
str.setProfileInfo(list.get(0).getCfgDesc());
}
//str.setUserRegion1(null);
str.setUserRegion4(null);
}else if(str.getUserRegion5().equals("90")) {
searchInsertFile.setCompileId(Integer.parseInt(source.getUserRegion4()));
Page<ProxyFileInsertScriptCfg> page = proxyFileInsertScriptService.findPage(new Page<ProxyFileInsertScriptCfg>(request, response, "a"), searchInsertFile);
List<ProxyFileInsertScriptCfg> list = page.getList();
if(list != null && list.size() > 0) {
str.setProfileInfo(list.get(0).getCfgDesc());
}
str.setUserRegion4(null);
}
str.setUserRegion5(null);
}
baseLists.add(str);
}
//获取日志总量
StringBuilder serviceIds=new StringBuilder(",");
if(set.size()>0) {
for (Integer id : set) {
serviceIds.append(id+",");
}
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
}
}
String cfgIndexInfoNoExport = ",log_total,policy_name,group_name,userregion1,&method_export:method-responseCode:response_code-userregion2:redirect_url-userregion3:replace_zone-userregion4:replaced_content-userregion5:replace_content-";
String httpUrlCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpReqHeadCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpResHeadCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpReqBodyCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
String httpResBodyCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
String ipPortCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
String ntcSubscribeIdCfgNoExport = ",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {
cfgIndexInfoNoExport = ",config_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_edit_time_start() == null && entity.getSearch_edit_time_end() == null) {
cfgIndexInfoNoExport = ",edit_time" + cfgIndexInfoNoExport;
}
if (entity.getSearch_audit_time_start() == null && entity.getSearch_audit_time_end() == null) {
cfgIndexInfoNoExport = ",audit_time" + cfgIndexInfoNoExport;
}
if (!StringUtil.isEmpty(entity.gethColumns())) {
cfgIndexInfoNoExport = "," + entity.gethColumns() + "," + cfgIndexInfoNoExport;
}
List<BaseStringCfg> httpUrlList = new ArrayList<>();
List<ComplexkeywordCfg> httpReqHdrList = new ArrayList<>();
List<ComplexkeywordCfg> httpResHdrList = new ArrayList<>();
List<BaseStringCfg> httpReqBodyList = new ArrayList<>();
List<BaseStringCfg> httpResBodyList = new ArrayList<>();
List<IpPortCfg> ipPortList = new ArrayList<>();
List<BaseStringCfg> subscribeIdList = new ArrayList<>();
for (ManipulatCfgExport cfg : baseLists) {
Map<String, List> maps = manipulatPolicyService.exportHttpCfg(cfg);
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum"));
break;
}
}
}
httpUrlList = BaseStringCfg.replaceBaseKeyList(httpUrlList);
httpReqHdrList = ComplexkeywordCfg.replaceComplexKeyList(httpReqHdrList);
httpResHdrList = ComplexkeywordCfg.replaceComplexKeyList(httpResHdrList);
httpReqBodyList = BaseStringCfg.replaceBaseKeyList(httpReqBodyList);
httpResBodyList = BaseStringCfg.replaceBaseKeyList(httpResBodyList);
subscribeIdList = BaseStringCfg.baseHexList(subscribeIdList);
titleList.add(entity.getMenuNameCode());
titleList.add("NTC_HTTP_URL");
titleList.add("NTC_HTTP_REQ_HDR");
classMap.put(entity.getMenuNameCode(), ManipulatCfgExport.class);
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
noExportMap.put(entity.getMenuNameCode(), cfgIndexInfoNoExport);
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
dataMap.put(entity.getMenuNameCode(), baseLists);
dataMap.put("NTC_HTTP_URL", httpUrlList);
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
titleList.add("NTC_HTTP_RES_HDR");
titleList.add("NTC_HTTP_REQ_BODY");
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
titleList.add("NTC_UNIVERSAL_IP");
titleList.add("NTC_SUBSCRIBE_ID");
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList);
String timeRange = initTimeMap(entity);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(entity.getExType())) {
this._exportCsv(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, entity.getMenuNameCode(), titleList,
classMap, dataMap, noExportMap);
}
} catch (Exception e) {
logger.error("http export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
@ResponseBody
@RequestMapping("ajaxGetProfileInfo")
public List<BaseCfg> ajaxGetProfileInfo(Integer source, HttpServletRequest request, HttpServletResponse response){
return manipulatPolicyService.getProfileInfo(source);
}
}

View File

@@ -13,7 +13,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -27,15 +26,13 @@ import javax.net.ssl.TrustManagerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.BeanUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@@ -63,7 +60,6 @@ import com.nis.util.JsonMapper;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
/**
* 拦截策略
@@ -214,7 +210,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = publicKeyFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
file = File.createTempFile("file_" + prefix, suffix);
publicKeyFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
@@ -238,7 +234,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = privateKeyFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
file = File.createTempFile("file_" + prefix, suffix);
privateKeyFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
@@ -296,13 +292,6 @@ public class PxyObjKeyringController extends BaseController {
* @throws Exception
*/
public boolean validCertFileContent(MultipartFile file,MultipartFile privateFile, String validateType) throws Exception {
boolean delTempFile=true;
//内置可信证书列表不允许删除
if("-incacert".equals(validateType)) {
delTempFile=false;
validateType="-incert";
}
String os = System.getProperty("os.name").toLowerCase();
if (!os.contains("windows") && file != null) {
// 证书文件临时保存路径
@@ -330,7 +319,7 @@ public class PxyObjKeyringController extends BaseController {
// 验证文件
logger.info(x509Shell + " " + validateType + " " + filePath+ " " + privateFilePath);
Map<String, Object> resultMap = this.execShell(x509Shell, validateType, filePath, privateFilePath);
if (resultMap == null || StringUtil.isEmpty(resultMap.get("out"))) {
// 临时文件删除
logger.info("delete file" + filePath);
@@ -353,15 +342,9 @@ public class PxyObjKeyringController extends BaseController {
return false;
}
// 临时文件删除
if(!delTempFile) {
this.certInfoMap.put("certFilePath", filePath);
logger.info("证书列表文件目录"+certInfoMap.get("certFilePath"));
}else {
logger.info("delete file" + filePath);
FileUtils.deleteFile(filePath);
}
logger.info("delete file" + filePath);
FileUtils.deleteFile(filePath);
}
return true;
}
@@ -372,23 +355,6 @@ public class PxyObjKeyringController extends BaseController {
// 查询时left join policyGroup
Page<PxyObjKeyring> page = pxyObjKeyringService.findPage(new Page<PxyObjKeyring>(request, response, "r"),
entity);
//查询是否存在内置配置
PxyObjKeyring searchEntity0=new PxyObjKeyring();
searchEntity0.setCompileId(0);
PxyObjKeyring searchEntity1=new PxyObjKeyring();
searchEntity1.setCompileId(1);
Page<PxyObjKeyring> searchPage=new Page<PxyObjKeyring>();
Page<PxyObjKeyring> builtInPage0 = pxyObjKeyringService.findPage(searchPage,
searchEntity0);
Page<PxyObjKeyring> builtInPage1 = pxyObjKeyringService.findPage(searchPage,
searchEntity1);
if((builtInPage0 != null && !StringUtil.isEmpty(builtInPage0.getList())) || (builtInPage1 != null && !StringUtil.isEmpty(builtInPage1.getList()))) {
model.addAttribute("hasBuiltIn", true);
}else {
model.addAttribute("hasBuiltIn", false);
}
model.addAttribute("page", page);
initPageCondition(model, entity);
return "/cfg/intercept/strateagy/list";
@@ -569,12 +535,9 @@ public class PxyObjKeyringController extends BaseController {
Page<PxyObjTrustedCaCert> page = pxyObjKeyringService.findTrustedCertPage(pageInfo, entity);
ipLists = page.getList();
}
Properties prop = getMsgProp();
for (PxyObjTrustedCaCert cert : ipLists) {
if (!StringUtil.isEmpty(cert.getCompileId())) {
cert.setCrlFile(ConfigDictUtils.getTrustedCrlByCerId(cert.getCompileId()));
cert.setBuiltInExp(prop.getProperty(cert.getBuiltIn()==0?"no":"yes"));
}
}
titleList.add(entity.getMenuNameCode());
@@ -622,20 +585,6 @@ public class PxyObjKeyringController extends BaseController {
@ModelAttribute("cfg") PxyObjTrustedCaCert entity, RedirectAttributes redirectAttributes) {
Page<PxyObjTrustedCaCert> page = pxyObjKeyringService
.findTrustedCertPage(new Page<PxyObjTrustedCaCert>(request, response, "r"), entity);
//判断是否存在内置证书,不存在则按钮开放。
PxyObjTrustedCaCert searchBuiltIn=new PxyObjTrustedCaCert();
searchBuiltIn.setBuiltIn(1);
searchBuiltIn.setIsValid(1);
searchBuiltIn.setIsAudit(1);
Page<PxyObjTrustedCaCert> searchPage =new Page<PxyObjTrustedCaCert>();
Page<PxyObjTrustedCaCert> builtInReslt = pxyObjKeyringService
.findTrustedCertPage(searchPage, searchBuiltIn);
if(builtInReslt != null && !StringUtil.isEmpty(builtInReslt.getList())) {
model.addAttribute("hasBuiltIn", true);
}else {
model.addAttribute("hasBuiltIn", false);
}
model.addAttribute("page", page);
initPageCondition(model, entity);
return "/cfg/intercept/strateagy/trustedCertList";
@@ -717,7 +666,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = certFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
file = File.createTempFile("file_" + prefix, suffix);
certFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
@@ -797,7 +746,7 @@ public class PxyObjKeyringController extends BaseController {
LogUtils.saveLog(request, null, e, null);
}
}
try {
if (validFlag) {
validFlag = true;
@@ -813,7 +762,7 @@ public class PxyObjKeyringController extends BaseController {
} else {
cfg.setIssuer(issuer);
}
}
} else {
logger.error("crl的issuser为空");
@@ -838,7 +787,7 @@ public class PxyObjKeyringController extends BaseController {
String filename = crlFileI.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
file = File.createTempFile("file_" + prefix, suffix);
crlFileI.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
@@ -858,10 +807,10 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.trustedCrlsaveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
}
} catch (Exception e) {
logger.error("crl上传失败", e);
if (e instanceof MaatConvertException) {
@@ -875,414 +824,8 @@ public class PxyObjKeyringController extends BaseController {
LogUtils.saveLog(request, null, e, null);
}
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
}
/**
* 内置可信证书导入
* @param model
* @param request
* @param response
* @param cfg
* @param crlFileI
* @param redirectAttributes
* @return
*/
@RequestMapping(value = { "/addBuiltInCert" })
public String trustedCertBuiltIn(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") PxyObjTrustedCaCert cfg, MultipartFile crlFileI,
RedirectAttributes redirectAttributes) {
logger.info("证书列表开始校验");
boolean validFlag = true;
try {
if(crlFileI != null) {
//校验证书格式
boolean certFileflag = validCertFileContent(crlFileI,null, "-incacert");
logger.info("证书列表校验结果"+certFileflag);
if (!certFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
throw new MultiPartNewException(this.getMsgProp().getProperty("cert_file_error"));
}
}
} catch (Exception e) {
validFlag = false;
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
logger.info("证书列表开始解析");
//2、调用脚本生成pem文件
//./cacert.sh tls-ca-bundle.pem /home/ddm/cacert
String certFilePath="";
String resultDirPath="";
try {
if(validFlag && !certInfoMap.isEmpty() && !StringUtil.isEmpty(certInfoMap.get("certFilePath"))) {
certFilePath=certInfoMap.get("certFilePath").toString();
logger.info("证书列表解析文件"+certFilePath);
String cacert = Thread.currentThread().getContextClassLoader()
.getResource(File.separator + "shell" + File.separator + Constants.CA_CERT_FILE).getPath();
this.execShell("", "chmod", "+x", cacert);
logger.info(Constants.CA_CERT_FILE+"脚本分配可执行权限:" + "chmod" + " " + "+x" + " " + cacert);
FileUtils.createDirectory(Constants.CA_CERT_DIR);
resultDirPath = Constants.CA_CERT_DIR;
logger.info("证书列表解析结果目录"+resultDirPath);
this.execShell(cacert, certFilePath,resultDirPath);
logger.info("内置证书文件生成:"+cacert + " " + certFilePath+" "+resultDirPath);
}
//删除临时文件
if(!StringUtil.isEmpty(certFilePath)) {
logger.info("delete file" + certFilePath);
FileUtils.deleteFile(certFilePath);
}
} catch (Exception e) {
validFlag = false;
logger.error("可信证书列表解析失败", e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
logger.info("所有证书开始校验");
//校验内置证书并获取issuer信息
File fileDir=null;
Map<String,String> issuerMap=new HashMap<>();
if(validFlag && !StringUtil.isEmpty(resultDirPath)) {
logger.info("证书列表文件解析结果目录:"+resultDirPath);
fileDir=new File(resultDirPath);
try {
if(validFlag) {
for (File file : fileDir.listFiles()) {
FileInputStream fileInputStream = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(),fileInputStream);
//校验证书格式
boolean validResult = validCertFileContent(multipartFile,null, "-incacert");
logger.info("证书校验结果"+validResult);
if (validResult && !certInfoMap.isEmpty() && !StringUtil.isEmpty(certInfoMap.get("ca issuer"))) {
String issuer=certInfoMap.get("ca issuer").toString();
issuerMap.put(file.getName(), issuer);
}else{
addMessage(redirectAttributes, "error", "save_failed");
logger.error(crlFileI.getOriginalFilename() + " file non crl file format ");
throw new MultiPartNewException(this.getMsgProp().getProperty("cert_file_error"));
}
}
}
} catch (Exception e) {
validFlag = false;
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
logger.info("所有证书开始上传minio");
List<PxyObjTrustedCaCert> caCertList=new ArrayList<PxyObjTrustedCaCert>();
if(validFlag && fileDir != null && !StringUtil.isEmpty(fileDir.listFiles())) {
int index=1;
for (File file : fileDir.listFiles()) {
File newFile = null;
String filename ="";
try {
FileInputStream fileInputStream = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(),fileInputStream);
PxyObjTrustedCaCert cacertBuitIn=new PxyObjTrustedCaCert();
cfg.setBuiltIn(1);
BeanUtils.copyProperties(cfg, cacertBuitIn);
filename = file.getName();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
newFile = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
multipartFile.transferTo(newFile);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("可信证书内置证书 文件上传响应信息:" + JsonMapper.toJsonString(result));
String crlFileAccessUrl = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
crlFileAccessUrl = data.getAccessUrl();
cacertBuitIn.setCertFile(crlFileAccessUrl);
}
cacertBuitIn.setIssuer(issuerMap.get(file.getName()));
cacertBuitIn.setCfgDesc("built-in_cert"+index);
caCertList.add(cacertBuitIn);
} catch (Exception e) {
validFlag = false;
logger.error("内置可信证书"+filename+"上传minio失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
index++;
}
}
logger.info("所有证书信息开始入库并下发");
//入库并下发
if(validFlag){
try {
if(!StringUtil.isEmpty(caCertList)){
pxyObjKeyringService.caCertSaveAndAudit(caCertList);
}
}catch (Exception e) {
validFlag = false;
logger.error("内置可信证书下发失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
}else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
}
/**
* 内置Keyring 导入功能
* @param model
* @param request
* @param response
* @param cfg
* @param certFileI
* @param redirectAttributes
* @return
*/
@RequestMapping(value = { "/addKeyRingBuiltInCert" })
public String addKeyRingBuiltInCert(Model model, HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("cfg") PxyObjKeyring cfg, @RequestParam("certFileI")MultipartFile[] certFileI,
RedirectAttributes redirectAttributes) {
logger.info("keyring内置证书开始校验");
boolean validFlag = true;
//每个证书文件的内容
Map<String, Map> fileCertMap=new HashMap<>();
try {
if(certFileI != null && certFileI.length > 0) {
for (MultipartFile multipartFile : certFileI) {
//校验证书格式
boolean certFileflag = validCertFileContent(multipartFile,null, "-incert");
logger.info("证书列表校验结果"+certFileflag);
if (!certFileflag) {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(multipartFile.getOriginalFilename() + " file non crl file format ");
throw new MultiPartNewException(this.getMsgProp().getProperty("cert_file_error"));
}else {
if(!certInfoMap.isEmpty()) {
String issuer = StringUtil.isEmpty(certInfoMap.get("ca issuer")) ? ""
: certInfoMap.get("ca issuer").toString();// 颁发者
String fingerprint = StringUtil.isEmpty(certInfoMap.get("ca fingerprint")) ? ""
: certInfoMap.get("ca fingerprint").toString();// 指纹
if(!StringUtil.isEmpty(issuer) && !StringUtil.isEmpty(fingerprint)) {
if(Constants.KEYRING_BUILT_IN_ISSER.contains("||"+issuer+"||")
&& Constants.KEYRING_BUILT_IN_FINGERPRINT.contains("||"+fingerprint+"||")) {
fileCertMap.put(multipartFile.getOriginalFilename(), certInfoMap);
}else {
validFlag=false;
break;
}
}else {
validFlag=false;
break;
}
}else {
validFlag=false;
break;
}
}
}
}else {
addMessage(redirectAttributes, "error", "save_failed");
logger.error(" keyring is null ");
throw new Exception();
}
} catch (Exception e) {
validFlag = false;
logger.error("证书文件校验失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
LogUtils.saveLog(request, null, e, null);
} else {
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
}
List<PxyObjKeyring> keyringList=new ArrayList<PxyObjKeyring>();
//是keyring内置证书且验证通过进行证书文件上传
try {
if(validFlag) {
File file=null;
for (MultipartFile certFile :certFileI) {
PxyObjKeyring keyring=new PxyObjKeyring();
BeanUtils.copyProperties(cfg, keyring);
/**************************证书信息获取*************************************/
String issuer = StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca issuer")) ? ""
: fileCertMap.get(certFile.getOriginalFilename()).get("ca issuer").toString();// 颁发者
String subject = StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca subjectname")) ? ""
: fileCertMap.get(certFile.getOriginalFilename()).get("ca subjectname").toString();// 颁发给
String notBeforeStr = "";
if (!StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca notbefore"))) {
Date notBeforeTime = new Date(fileCertMap.get(certFile.getOriginalFilename()).get("ca notbefore").toString());// 开始时间
notBeforeStr = sdf.format(notBeforeTime);
}
String notAfterStr = "";
if (!StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca notafter"))) {
Date notAfterTime = new Date(fileCertMap.get(certFile.getOriginalFilename()).get("ca notafter").toString());// 结束时间
notAfterStr = sdf.format(notAfterTime);
}
String cn = "";// CN
// CN精确信息获取
if (!StringUtil.isEmpty(subject)) {
for (String cnStr : subject.split(",")) {
cnStr = StringUtil.isEmpty(cnStr) ? "" : cnStr.trim();
if (cnStr.split("=").length > 1) {
cn = cnStr.split("=")[1];
cn = StringUtil.isEmpty(cn) ? "" : cn.trim();
}
}
}
String altName = StringUtil.isEmpty(fileCertMap.get(certFile.getOriginalFilename()).get("ca altname")) ? ""
: fileCertMap.get(certFile.getOriginalFilename()).get("ca altname").toString();// SAN
keyring.setIssuer(issuer);
keyring.setSubject(subject);
keyring.setCn(cn);
keyring.setAltName(altName);
keyring.setNotBeforeTime(notBeforeStr);
keyring.setNotAfterTime(notAfterStr);
keyring.setKeyringType("root");
keyring.setExpireAfter(30);
keyring.setCrl("");
keyring.setPublicKeyAlgo("");
/**************************公私钥文件上传*************************************/
if (certFile != null) {
String filename = certFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
keyring.setKeyringName(prefix);
keyring.setCfgDesc(prefix);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
certFile.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("proxy 证书文件策略公钥 文件上传响应信息:" + JsonMapper.toJsonString(result));
String publicKeyFileAccessUrl = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
publicKeyFileAccessUrl = data.getAccessUrl();
keyring.setPublicKeyFile(publicKeyFileAccessUrl);
}
}
if (certFile != null) {
String filename = certFile.getOriginalFilename();
String prefix = FileUtils.getPrefix(filename, false);
String suffix = FileUtils.getSuffix(filename, false);
file = File.createTempFile("file_" + prefix, FileUtils.getSuffix(filename, true));
certFile.transferTo(file);// 复制文件
String md5 = FileUtils.getFileMD5(file);
Map<String, Object> srcMap = Maps.newHashMap();
srcMap.put("filetype", suffix);
srcMap.put("datatype", "dbSystem");// 源文件存入数据中心
srcMap.put("createTime", new Date());
srcMap.put("key", prefix);
srcMap.put("fileName", filename);
srcMap.put("checksum", md5);
ToMaatResult result = ConfigServiceUtil.postFileCfg(null, file, JsonMapper.toJsonString(srcMap));
logger.info("proxy 证书文件策略私钥 上传响应信息:" + JsonMapper.toJsonString(result));
String privateKeyFileAccessUrl = null;
if (!StringUtil.isEmpty(result)) {
ResponseData data = result.getData();
privateKeyFileAccessUrl = data.getAccessUrl();
keyring.setPrivateKeyFile(privateKeyFileAccessUrl);
;
}
}
logger.info(keyring.getPublicKeyFile());
logger.info(keyring.getPrivateKeyFile());
keyringList.add(keyring);
}
}
} catch (MultiPartNewException e) {
logger.error("证书文件上传失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (MaatConvertException e) {
logger.error("策略配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("策略配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
try {
if(!StringUtil.isEmpty(keyringList)) {
pxyObjKeyringService.saveAndAuditKeyring(keyringList);
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MaatConvertException e) {
logger.error("策略配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
LogUtils.saveLog(request, null, e, null);
} catch (Exception e) {
logger.error("策略配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
LogUtils.saveLog(request, null, e, null);
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();
}
/**
@@ -1469,4 +1012,31 @@ public class PxyObjKeyringController extends BaseController {
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId;
}
/**
* 验证Keyring是否有被使用
*
* @param entity
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping(value = { "/ajaxKeyinfIsUsed" })
public boolean ajaxKeyinfIsUsed(String[] compileIds, HttpServletRequest request, HttpServletResponse response) {
for(String compileId:compileIds){
CfgIndexInfo cfg = new CfgIndexInfo();
cfg.setIsAudit(1);
cfg.setIsValid(1);
cfg.setFunctionId(200);//代理拦截策略
cfg.setServiceId(512);
cfg.setUserRegion1(compileId);
List<CfgIndexInfo> list = httpRedirectCfgService.getCfgIndexInfos(cfg);
if (list.size() > 0) {
return false;
}
}
return true;
}
}

View File

@@ -1,99 +0,0 @@
package com.nis.web.controller.configuration.proxy;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.web.controller.BaseController;
import com.nis.web.service.BaseService;
import com.nis.web.service.configuration.StatusOfUsedService;
@Controller
@RequestMapping("${adminPath}/proxy/statusOfUsed")
public class StatusOfUsedController extends BaseController{
@Autowired
protected StatusOfUsedService statusOfUsedService;
@ResponseBody
@RequestMapping(value = { "/ajaxRequest" })
public boolean statusOfUsed(String[] compileIds, HttpServletRequest request, HttpServletResponse response) {
Integer isValid = Integer.parseInt(request.getParameter("isValid"));
Integer ServiceId = Integer.parseInt(request.getParameter("serviceId"));
Integer functionId = 0;
String key = "";
//拦截证书策略
if(ServiceId==520){
functionId = 200;
ServiceId = 512;
key = "keyring";
}//流量转发目的地址
if(ServiceId==645){
functionId = 200;
ServiceId = 512;
key = "mirror_profile";
}
//劫持文件、注入脚本文件
else if(ServiceId==643 || ServiceId==644){
functionId = 215;
ServiceId = 656;
}//访问阻断页面
else if(ServiceId==646){
functionId = 207;
ServiceId = 576;
}
if(ServiceId == 576 || ServiceId==656){
for(String compileId:compileIds){
CfgIndexInfo cfg = new CfgIndexInfo();
if(ServiceId==656){
cfg.setUserRegion4(compileId);
}else if(ServiceId==576){
cfg.setUserRegion3(compileId);
}
cfg.setIsValid(isValid);
cfg.setFunctionId(functionId);
cfg.setServiceId(ServiceId);
List<CfgIndexInfo> list = statusOfUsedService.getStatusOfUsed(cfg);
if (list.size() > 0) {
return false;
}
}
return true;
}else if(ServiceId==512){
CfgIndexInfo cfg = new CfgIndexInfo();
cfg.setIsValid(isValid);
cfg.setFunctionId(functionId);
cfg.setServiceId(ServiceId);
List<CfgIndexInfo> list = statusOfUsedService.getStatusOfUsed(cfg);
Map<String,Map<String,Object>> tempMap = new HashMap<>();
for(CfgIndexInfo temp:list){
tempMap = BaseService.gsonFromJson(temp.getUserRegion1(), Map.class);
String value = "";
if("keyring".equals(key)){
value = String.valueOf(tempMap.get(key));
}else if("mirror_profile".equals(key)){
value = String.valueOf(tempMap.get("decrypt_mirror").get("mirror_profile"));
}
for(String s: compileIds){
if(s.equals(value))
return false;
}
}
return true;
}
return true;
}
}

View File

@@ -1,385 +0,0 @@
package com.nis.web.controller.log.pxy;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.PageLog;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysUser;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.log.BaseLogEntity;
import com.nis.domain.log.PxyHttpLog;
import com.nis.domain.log.PxyHttpManipulationLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/log/pxy")
public class PxyHttpBlockLogController extends BaseController{
@RequestMapping(value = "/httpBlockList")
public String list(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, HttpServletRequest request,
HttpServletResponse response,Integer searchAction) {
try {
List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if(searchAction !=null){
log.setAction(searchAction);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
if(log.getCfgId()!=null && log.getPolicyId() ==null){
log.setPolicyId(log.getCfgId());
}
if (StringUtils.isNotBlank(log.getAppId())) {
params.put("searchAppId", log.getAppId());
}
if (StringUtils.isNotBlank(log.getProtocolId())) {
params.put("searchProtocolId", log.getProtocolId());
}
initLogSearchValues(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
model.addAttribute("appList", appCodeList);
model.addAttribute("protocolList", protocolCodeList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
page.setCount(data.getCount());
page.setLast(data.getLast());
page.setList(data.getList());
List<PxyHttpManipulationLog> list = page.getList();
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
// setLogAction(l, serviceList);
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
for (CodeResult code : appCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
l.setAppName(code.getItem());
break;
}
}
for (CodeResult code : protocolCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
l.setProtocolName(code.getItem());
break;
}
}
}
}
model.addAttribute("page", page);
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/pxy/pxyHttpBlockList";
}
// 导出
@RequestMapping(value = "exportPxyHttpBlock")
public void exportPxy(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, String hColumns, String type,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
// ---------------------------
List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(request, response);
page.setPageNo(1);
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
initLogSearchValues(log, params);
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
if (StringUtils.isNotBlank(log.getAppId())) {
params.put("searchAppId", log.getAppId());
}
if (StringUtils.isNotBlank(log.getProtocolId())) {
params.put("searchProtocolId", log.getProtocolId());
}
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
List<PxyHttpManipulationLog> list = new ArrayList<PxyHttpManipulationLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
list = data.getList();
}
}
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
for (CodeResult code : appCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
l.setAppName(code.getItem());
break;
}
}
for (CodeResult code : protocolCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
l.setProtocolName(code.getItem());
break;
}
}
}
titleList.add("http_manipulation");
classMap.put("http_manipulation", PxyHttpManipulationLog.class);
SysUser user = UserUtils.getUser();
if (!user.isAdmin()) {
hColumns += ",scene_file,";
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = ",req_header,resp_header,inner_smac,inner_dmac,nest_addr_list,scene_file,"
+ ",found_time,"
+ hColumns;
noExportMap.put("http_manipulation", cfgIndexInfoNoExport);
dataMap.put("http_manipulation", list);
String timeRange= initLogMaps(log,"http_manipulation");
noExportMap.put("timeRange", timeRange);
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, "http_manipulation", titleList, classMap,
dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, "http_manipulation", titleList, classMap, dataMap,
noExportMap);
}
} catch (Exception e) {
logger.error("Http Manipulation export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
public void initLogSearchValues(PxyHttpManipulationLog entry, Map<String, Object> params) {
if (StringUtils.isNotBlank(entry.getSearchFoundStartTime())
&& StringUtils.isNotBlank(entry.getSearchFoundEndTime())) {
params.put("searchStartRecvTime", date2TimeStamp(entry.getSearchFoundStartTime(),"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(entry.getSearchFoundEndTime(),"yyyy-MM-dd HH:mm:ss"));
} else {
// 判断是否是从配置界面过来的日志查询
if (StringUtils.isNotBlank(entry.getIsLogTotalSearch())) {
Calendar time = Calendar.getInstance();
String searchEndTime = DateUtils.formatDateTime(time.getTime());
time.add(Calendar.MINUTE, -(Constants.LOG_TIME_RANGE/1000/60));
String searchStartTime = DateUtils.formatDateTime(time.getTime());
params.put("searchStartRecvTime", date2TimeStamp(searchStartTime,"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(searchEndTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(searchStartTime);
entry.setSearchFoundEndTime(searchEndTime);
} else {
// 设置默认查询当前时间及前五分钟
String endTime = DateUtils.getDateTime();
Date dateStart = new Date(new Date().getTime() - Constants.LOG_TIME_INTERVAL);
String startTime = DateUtils.formatDateTime(dateStart);
params.put("searchStartRecvTime", String.valueOf(dateStart.getTime()/1000));
params.put("searchEndRecvTime", date2TimeStamp(endTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(startTime);
entry.setSearchFoundEndTime(endTime);
}
logger.info("searchStartRecvTime" + params.get("searchStartRecvTime"));
logger.info("searchEndRecvTime" + params.get("searchEndRecvTime"));
}
if (StringUtils.isNotBlank(entry.getTransProto())) {
params.put("searchTransProto", entry.getTransProto());
}
/* if (entry.getService() != null) {
params.put("searchService", entry.getService());
} else if (entry.getAction() != null) {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
for (FunctionServiceDict dict : serviceList) {
if (dict.getAction().intValue() == entry.getAction().intValue()
&& dict.getFunctionId().intValue() == entry.getFunctionId().intValue()) {
entry.setService(dict.getServiceId());
params.put("searchService", dict.getServiceId());
}
}
}*/
if (StringUtils.isNotBlank(entry.getServerIp())) {
params.put("searchServerIp", entry.getServerIp());
}
if (StringUtils.isNotBlank(entry.getClientIp())) {
params.put("searchClientIp", entry.getClientIp());
}
if (StringUtils.isNotBlank(entry.getCapIp())) {
params.put("searchCapIp", entry.getCapIp());
}
if (entry.getDirection() != null) {
params.put("searchDirection", entry.getDirection());
}
if (entry.getEntranceId() != null) {
params.put("searchEntranceId", entry.getEntranceId());
}
if (entry.getPolicyId() != null) {
params.put("searchPolicyId", entry.getPolicyId());
}
if (entry.getAction() != null) {
params.put("searchAction", entry.getAction());
}
if (entry.getAddrType() != null) {
params.put("searchAddrType", entry.getAddrType());
}
if (StringUtils.isNotBlank(entry.getIsp())) {
params.put("searchIsp", entry.getIsp());
}
if (StringUtils.isNotBlank(entry.getServerLocation())) {
params.put("searchServerLocation", entry.getServerLocation());
}
if (StringUtils.isNotBlank(entry.getClientLocation())) {
params.put("searchClientLocation", entry.getClientLocation());
}
if (StringUtils.isNotBlank(entry.getHost())) {
params.put("searchHost", entry.getHost());
}
if (StringUtils.isNotBlank(entry.getSni())) {
params.put("searchSni", entry.getSni());
}
if (StringUtils.isNotBlank(entry.getSan())) {
params.put("searchSan", entry.getSan());
}
if (StringUtils.isNotBlank(entry.getCn())) {
params.put("searchCn", entry.getCn());
}
if (StringUtils.isNotBlank(entry.getOrderBy())) {
params.put("orderBy", entry.getOrderBy());
}
if (StringUtils.isNotBlank(entry.getFields())) {
params.put("fields", entry.getFields());
}
}
public String initLogMaps(PxyHttpManipulationLog log,String title){
Properties msgProp = getMsgProp();
String logTime=msgProp.getProperty(title,title);;
if(log.getSearchFoundStartTime()!=null){
logTime+=" "+msgProp.getProperty("begin_date")+""+log.getSearchFoundStartTime();
}
if(log.getSearchFoundEndTime()!=null){
logTime+=" "+msgProp.getProperty("end_date")+""+log.getSearchFoundEndTime();
}
return logTime;
}
/**
* 日期格式字符串转换成时间戳
* @param date 字符串日期
* @param format 如yyyy-MM-dd HH:mm:ss
* @return
*/
public static String date2TimeStamp(String date_str,String format){
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return String.valueOf(sdf.parse(date_str).getTime()/1000);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* 时间戳转换成日期格式字符串
* @param seconds 精确到秒的字符串
* @param formatStr
* @return
*/
public static String timeStamp2Date(String seconds,String format) {
if(seconds == null || seconds.isEmpty() || seconds.equals("null")){
return "";
}
if(format == null || format.isEmpty()) format = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(new Date(Long.valueOf(seconds+"000")));
}
}

View File

@@ -1,393 +0,0 @@
package com.nis.web.controller.log.pxy;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.PageLog;
import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.SysUser;
import com.nis.domain.configuration.AppIpCfg;
import com.nis.domain.log.BaseLogEntity;
import com.nis.domain.log.PxyHttpLog;
import com.nis.domain.log.PxyHttpManipulationLog;
import com.nis.domain.maat.LogRecvData;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.util.CodeDicUtils;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.LogUtils;
import com.nis.util.StringUtil;
import com.nis.util.httpclient.HttpClientUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.dashboard.codedic.CodeResult;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/log/pxy")
public class PxyHttpManipulLogController extends BaseController{
@RequestMapping(value = {"/httpManipulList", "/httpBlockLists", "/httpMonitLists"})
public String list(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, HttpServletRequest request,
HttpServletResponse response,Integer searchAction) {
try {
// List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
// List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(request, response);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if(searchAction !=null){
log.setAction(searchAction);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
if(log.getCfgId()!=null && log.getPolicyId() ==null){
log.setPolicyId(log.getCfgId());
}
// if (StringUtils.isNotBlank(log.getAppId())) {
// params.put("searchAppId", log.getAppId());
// }
// if (StringUtils.isNotBlank(log.getProtocolId())) {
// params.put("searchProtocolId", log.getProtocolId());
// }
initLogSearchValues(log, params);
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
// model.addAttribute("appList", appCodeList);
// model.addAttribute("protocolList", protocolCodeList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
page.setCount(data.getCount());
page.setLast(data.getLast());
page.setList(data.getList());
List<PxyHttpManipulationLog> list = page.getList();
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
// setLogAction(l, serviceList);
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
/*for (CodeResult code : appCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
l.setAppName(code.getItem());
break;
}
}
for (CodeResult code : protocolCodeList) {
Integer value3 = Integer.valueOf(code.getCode());
if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
l.setProtocolName(code.getItem());
break;
}
}*/
}
}
model.addAttribute("page", page);
} catch (Exception e) {
logger.error("查询失败", e);
addMessageLog(model, e.getMessage());
LogUtils.saveLog(request, null, e, null);
}
return "/log/pxy/pxyHttpManipulationList";
}
// 导出
@RequestMapping(value = "exportPxyHttpManipul")
public void exportPxy(@ModelAttribute("log") PxyHttpManipulationLog log, Model model, String hColumns, String type,
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
try {
List<String> titleList = new ArrayList<String>();
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
Map<String, List> dataMap = new HashMap<String, List>();
Map<String, String> noExportMap = new HashMap<String, String>();
// ---------------------------
// List<CodeResult> protocolCodeList = CodeDicUtils.getCodeList("protocolCode");
// List<CodeResult> appCodeList = CodeDicUtils.getCodeList("appCode");
PageLog<PxyHttpManipulationLog> page = new PageLog<PxyHttpManipulationLog>(request, response);
page.setPageNo(1);
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageSize", page.getPageSize());
params.put("pageNo", page.getPageNo());
if (StringUtils.isNotBlank(log.getsIp())) {
log.setClientIp(log.getsIp());
}
if (StringUtils.isNotBlank(log.getdIp())) {
log.setServerIp(log.getdIp());
}
initLogSearchValues(log, params);
if (StringUtils.isNotBlank(log.getUrl())) {
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
params.put("searchUrl", httpurl);
}
if (StringUtils.isNotBlank(log.getDomain())) {
String domain = StringEscapeUtils.unescapeHtml(log.getDomain());
params.put("searchDomain", domain);
}
// if (StringUtils.isNotBlank(log.getAppId())) {
// params.put("searchAppId", log.getAppId());
// }
// if (StringUtils.isNotBlank(log.getProtocolId())) {
// params.put("searchProtocolId", log.getProtocolId());
// }
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
model.addAttribute("serviceList", serviceList);
String url = Constants.LOG_BASE_URL + Constants.POLICY_EVENT;
String recv = HttpClientUtil.getMsg(url, params, request);
List<PxyHttpManipulationLog> list = new ArrayList<PxyHttpManipulationLog>();
if (StringUtils.isNotBlank(recv)) {
Gson gson = new GsonBuilder().create();
LogRecvData<PxyHttpManipulationLog> fromJson = gson.fromJson(recv, new TypeToken<LogRecvData<PxyHttpManipulationLog>>() {
}.getType());
if (fromJson.getStatus().intValue() == 200) {
Page<PxyHttpManipulationLog> data = fromJson.getData();
list = data.getList();
}
}
for (PxyHttpManipulationLog l : list) {
l.setFunctionId(log.getFunctionId());
l.setStartTime(timeStamp2Date(l.getStartTime(),null));
l.setEndTime(timeStamp2Date(l.getEndTime(),null));
l.setRecvTime(timeStamp2Date(l.getRecvTime(),null));
// for (CodeResult code : appCodeList) {
// Integer value3 = Integer.valueOf(code.getCode());
// if(StringUtils.isNotBlank(l.getAppId()) && l.getAppId().equals(code.getCode())){
// l.setAppName(code.getItem());
// break;
// }
// }
// for (CodeResult code : protocolCodeList) {
// Integer value3 = Integer.valueOf(code.getCode());
// if(StringUtils.isNotBlank(l.getProtocolId()) && l.getProtocolId().equals(code.getCode())){
// l.setProtocolName(code.getItem());
// break;
// }
// }
}
String title="";
if(log.getAction().equals(1)){//监测
title="http_monit";
}else if(log.getAction().equals(16)){//阻断
title="http_block";
}else if(log.getAction().equals(48)){//操控
title="http_manipulation";
}
titleList.add(title);
classMap.put(title, PxyHttpManipulationLog.class);
SysUser user = UserUtils.getUser();
if (!user.isAdmin()) {
hColumns += ",scene_file,";
} else {
hColumns += ",";
}
String cfgIndexInfoNoExport = ",req_header,resp_header,inner_smac,inner_dmac,nest_addr_list,scene_file,"
+ ",found_time,"
+ hColumns;
noExportMap.put(title, cfgIndexInfoNoExport);
dataMap.put(title, list);
String timeRange= initLogMaps(log,title);
noExportMap.put("timeRange", timeRange);
if ("csv".equals(type)) {
this._exportCsv(model, request, response, redirectAttributes, title, titleList, classMap,
dataMap, noExportMap);
} else {
this._export(model, request, response, redirectAttributes, title, titleList, classMap, dataMap,
noExportMap);
}
} catch (Exception e) {
logger.error("Http Manipulation export failed", e);
addMessage(redirectAttributes, "error", "export_failed");
LogUtils.saveLog(request, null, e, null);
}
}
public void initLogSearchValues(PxyHttpManipulationLog entry, Map<String, Object> params) {
if (StringUtils.isNotBlank(entry.getSearchFoundStartTime())
&& StringUtils.isNotBlank(entry.getSearchFoundEndTime())) {
params.put("searchStartRecvTime", date2TimeStamp(entry.getSearchFoundStartTime(),"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(entry.getSearchFoundEndTime(),"yyyy-MM-dd HH:mm:ss"));
} else {
// 判断是否是从配置界面过来的日志查询
if (StringUtils.isNotBlank(entry.getIsLogTotalSearch())) {
Calendar time = Calendar.getInstance();
String searchEndTime = DateUtils.formatDateTime(time.getTime());
time.add(Calendar.MINUTE, -(Constants.LOG_TIME_RANGE/1000/60));
String searchStartTime = DateUtils.formatDateTime(time.getTime());
params.put("searchStartRecvTime", date2TimeStamp(searchStartTime,"yyyy-MM-dd HH:mm:ss"));
params.put("searchEndRecvTime", date2TimeStamp(searchEndTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(searchStartTime);
entry.setSearchFoundEndTime(searchEndTime);
} else {
// 设置默认查询当前时间及前五分钟
String endTime = DateUtils.getDateTime();
Date dateStart = new Date(new Date().getTime() - Constants.LOG_TIME_INTERVAL);
String startTime = DateUtils.formatDateTime(dateStart);
params.put("searchStartRecvTime", String.valueOf(dateStart.getTime()/1000));
params.put("searchEndRecvTime", date2TimeStamp(endTime,"yyyy-MM-dd HH:mm:ss"));
entry.setSearchFoundStartTime(startTime);
entry.setSearchFoundEndTime(endTime);
}
logger.info("searchStartRecvTime" + params.get("searchStartRecvTime"));
logger.info("searchEndRecvTime" + params.get("searchEndRecvTime"));
}
if (StringUtils.isNotBlank(entry.getTransProto())) {
params.put("searchTransProto", entry.getTransProto());
}
/* if (entry.getService() != null) {
params.put("searchService", entry.getService());
} else if (entry.getAction() != null) {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entry.getFunctionId());
for (FunctionServiceDict dict : serviceList) {
if (dict.getAction().intValue() == entry.getAction().intValue()
&& dict.getFunctionId().intValue() == entry.getFunctionId().intValue()) {
entry.setService(dict.getServiceId());
params.put("searchService", dict.getServiceId());
}
}
}*/
if (StringUtils.isNotBlank(entry.getServerIp())) {
params.put("searchServerIp", entry.getServerIp());
}
if (StringUtils.isNotBlank(entry.getClientIp())) {
params.put("searchClientIp", entry.getClientIp());
}
if (StringUtils.isNotBlank(entry.getCapIp())) {
params.put("searchCapIp", entry.getCapIp());
}
if (entry.getDirection() != null) {
params.put("searchDirection", entry.getDirection());
}
if (entry.getEntranceId() != null) {
params.put("searchEntranceId", entry.getEntranceId());
}
if (entry.getPolicyId() != null) {
params.put("searchPolicyId", entry.getPolicyId());
}
if (entry.getAction() != null) {
params.put("searchAction", entry.getAction());
}
if (entry.getAddrType() != null) {
params.put("searchAddrType", entry.getAddrType());
}
if (StringUtils.isNotBlank(entry.getIsp())) {
params.put("searchIsp", entry.getIsp());
}
if (StringUtils.isNotBlank(entry.getServerLocation())) {
params.put("searchServerLocation", entry.getServerLocation());
}
if (StringUtils.isNotBlank(entry.getClientLocation())) {
params.put("searchClientLocation", entry.getClientLocation());
}
if (StringUtils.isNotBlank(entry.getHost())) {
params.put("searchHost", entry.getHost());
}
if (StringUtils.isNotBlank(entry.getSni())) {
params.put("searchSni", entry.getSni());
}
if (StringUtils.isNotBlank(entry.getSan())) {
params.put("searchSan", entry.getSan());
}
if (StringUtils.isNotBlank(entry.getCn())) {
params.put("searchCn", entry.getCn());
}
if (StringUtils.isNotBlank(entry.getOrderBy())) {
params.put("orderBy", entry.getOrderBy());
}
if (StringUtils.isNotBlank(entry.getFields())) {
params.put("fields", entry.getFields());
}
}
public String initLogMaps(PxyHttpManipulationLog log,String title){
Properties msgProp = getMsgProp();
String logTime=msgProp.getProperty(title,title);;
if(log.getSearchFoundStartTime()!=null){
logTime+=" "+msgProp.getProperty("begin_date")+""+log.getSearchFoundStartTime();
}
if(log.getSearchFoundEndTime()!=null){
logTime+=" "+msgProp.getProperty("end_date")+""+log.getSearchFoundEndTime();
}
return logTime;
}
/**
* 日期格式字符串转换成时间戳
* @param date 字符串日期
* @param format 如yyyy-MM-dd HH:mm:ss
* @return
*/
public static String date2TimeStamp(String date_str,String format){
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return String.valueOf(sdf.parse(date_str).getTime()/1000);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* 时间戳转换成日期格式字符串
* @param seconds 精确到秒的字符串
* @param formatStr
* @return
*/
public static String timeStamp2Date(String seconds,String format) {
if(seconds == null || seconds.isEmpty() || seconds.equals("null")){
return "";
}
if(format == null || format.isEmpty()) format = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(new Date(Long.valueOf(seconds+"000")));
}
}

View File

@@ -1,40 +0,0 @@
package com.nis.web.dao.basics;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.CommonGroupInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
List<CommonGroupInfo> findCommonGroupInfoList(CommonGroupInfo commonGroupInfo);
CommonGroupInfo getById(int id);
List<CommonGroupInfo> findCommonGroupInfosByType(int groupType);
List<CommonGroupInfo> findGroupInfoList(@Param("ids")String ids);
void updateGroupStatus(@Param("serviceGroupId")String serviceGroupId, @Param("udFlag")Integer udFlag, @Param("groupType")Integer groupType);
CommonGroupInfo getGroupInfo(CommonGroupInfo searchCfg);
Integer getCompileIdByGroupId(String groupId);
// 校验是否是当前引用Group的最后一条配置
public Integer ajaxCheckIsLastOneCfg(@Param("groupId")Integer groupId, @Param("cfgIds")String CfgIds, @Param("tableName")String indextable);
Set<String> getCountByGroupName(@Param("groupNameSet")Set<String> set, @Param("groupType")Integer groupType);
Integer getGroupIdByGroupName(@Param("groupName")String groupName, @Param("groupType")Integer groupType);
int insertBatch(List<CommonGroupInfo> list);
void reLoadGroupInfo(@Param("groupType")String groupType);
void deleteGroupRegionInfo(@Param("tableName")String tableName);
}

View File

@@ -1,274 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.CommonGroupManageDao" >
<resultMap id="CommonGroupInfoMap" type="com.nis.domain.basics.CommonGroupInfo" >
<id column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
<result column="group_type" property="groupType" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="ud_flag" property="udFlag" jdbcType="INTEGER" />
</resultMap>
<sql id="CommonGroupInfoColumns">
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
r.creator_id,r.editor_id,r.service_group_id,r.description, ud_flag
</sql>
<!-- 查出所有 有效数据-->
<select id="findCommonGroupInfoList" resultMap="CommonGroupInfoMap">
SELECT
<include refid="CommonGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="groupName != null and groupName != ''">
AND r.group_name like concat(concat('%',#{groupName,jdbcType=VARCHAR}),'%')
</if>
<if test="groupType != null">
AND r.group_type =#{groupType }
</if>
<if test="groupType == null">
AND r.group_type IN(5,7,8,9)
</if>
AND r.IS_VALID =1
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<!-- 数据范围过滤 -->
<!-- ${sqlMap.dsf} -->
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.group_id desc
</otherwise>
</choose>
</select>
<select id="getById" resultType="com.nis.domain.basics.CommonGroupInfo">
SELECT
<include refid="CommonGroupInfoColumns"/>
FROM
policy_group_info r
WHERE
r.group_id = #{groupId}
</select>
<insert id="insert" parameterType="com.nis.domain.basics.CommonGroupInfo" >
INSERT INTO policy_group_info(
IS_VALID,
CREATOR_ID,
CREATE_TIME,
GROUP_NAME,
GROUP_TYPE,
SERVICE_GROUP_ID,
DESCRIPTION
)values (
1,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{groupName,jdbcType=VARCHAR},
#{groupType,jdbcType=INTEGER},
#{serviceGroupId,jdbcType=INTEGER},
#{description,jdbcType=VARCHAR}
)
</insert>
<insert id="insertBatch">
INSERT INTO policy_group_info(
IS_VALID,
CREATOR_ID,
CREATE_TIME,
GROUP_NAME,
GROUP_TYPE,
SERVICE_GROUP_ID,
DESCRIPTION,
UD_FLAG
)values
<foreach collection ="list" item="info" separator =",">
(
1,
#{info.creatorId,jdbcType=INTEGER},
#{info.createTime,jdbcType=TIMESTAMP},
#{info.groupName,jdbcType=VARCHAR},
#{info.groupType,jdbcType=INTEGER},
#{info.serviceGroupId,jdbcType=INTEGER},
#{info.description,jdbcType=VARCHAR},
#{info.udFlag,jdbcType=INTEGER}
)
</foreach>
</insert>
<update id="update" parameterType="com.nis.domain.basics.CommonGroupInfo" >
UPDATE policy_group_info
<set>
<trim suffixOverrides=",">
<if test="groupName != null and groupName != ''" >
group_name = #{groupName,jdbcType=VARCHAR},
</if>
<if test="groupType != null" >
group_type = #{groupType,jdbcType=INTEGER},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
</trim>
</set>
<where>
<if test="groupId != null" >
and group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="serviceGroupId != null" >
and service_group_id = #{serviceGroupId,jdbcType=INTEGER}
</if>
</where>
</update>
<select id="findCommonGroupInfosByType" resultMap="CommonGroupInfoMap">
SELECT
<include refid="CommonGroupInfoColumns"/>
FROM
policy_group_info r
WHERE
r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
</select>
<select id="findGroupInfoList" resultMap="CommonGroupInfoMap">
SELECT
<include refid="CommonGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM
policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
WHERE
r.group_id IN (${ids})
</select>
<update id="updateGroupStatus">
UPDATE
policy_group_info
SET
ud_flag = #{udFlag,jdbcType=INTEGER}
WHERE
service_group_id IN (${serviceGroupId}) AND group_type = #{groupType}
</update>
<select id="getGroupInfo" resultType="com.nis.domain.basics.CommonGroupInfo">
SELECT
<include refid="CommonGroupInfoColumns"/>
FROM
policy_group_info r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="groupName != null and groupName != ''" >
AND group_name = #{groupName,jdbcType=VARCHAR}
</if>
<if test="groupType != null" >
AND group_type = #{groupType,jdbcType=INTEGER}
</if>
<if test="serviceGroupId != null" >
AND service_group_id = #{serviceGroupId,jdbcType=INTEGER}
</if>
<if test="isValid != null" >
AND is_valid = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null" >
AND is_valid != 0
</if>
</trim>
</select>
<select id="getCompileIdByGroupId" resultType="java.lang.Integer">
SELECT
compile_id
FROM
cfg_index_info
WHERE
common_group_ids = #{groupId,jdbcType=VARCHAR} AND is_valid != -1 AND is_audit = 1
</select>
<select id="ajaxCheckIsLastOneCfg" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
${tableName} r
WHERE
r.group_id = #{groupId} AND r.cfg_id NOT IN(${cfgIds})
</select>
<select id="getCountByGroupName" resultType="java.lang.String">
SELECT
r.group_name
FROM
policy_group_info r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<foreach collection="groupNameSet" index="index" item="item" open="(" separator="OR" close=")">
r.group_name = #{item,jdbcType=VARCHAR}
</foreach>
<if test="groupType != null" >
AND r.group_type = #{groupType,jdbcType=INTEGER}
</if>
AND r.is_valid != 0
</trim>
</select>
<select id="getGroupIdByGroupName" resultType="java.lang.Integer">
SELECT
r.service_group_id
FROM
policy_group_info r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="groupName != null and groupName != ''" >
AND r.group_name = #{groupName,jdbcType=VARCHAR}
</if>
<if test="groupType != null" >
AND r.group_type = #{groupType,jdbcType=INTEGER}
</if>
AND is_valid != 0
</trim>
</select>
<update id="reLoadGroupInfo" parameterType="java.lang.String">
UPDATE
policy_group_info
SET
ud_flag = 0
WHERE
is_valid != 0 AND group_type IN(${groupType})
</update>
<delete id="deleteGroupRegionInfo" parameterType="java.lang.String">
DELETE FROM ${tableName}
</delete>
</mapper>

View File

@@ -1,38 +0,0 @@
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface DomainCommGroupDao extends CrudDao<DomainCommCfg>{
// 查询列表
public List<DomainCommCfg> findAllPageList(DomainCommCfg entity);
public List<DomainCommCfg> findByPage(@Param("ids")String ids);
public List<DomainCommCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
//新增
public int insertCommGroupCfg(DomainCommCfg entity);
//修改
public int update(DomainCommCfg entity);
//删除
public int delete(@Param("ids")String ids);
public List<DomainCommCfg> getByIds(@Param("ids")String ids);
public Integer getGroupIdCount(@Param("groupId")String groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<DomainCommCfg> getGroupIds(DomainCommCfg cfg);
}

View File

@@ -1,525 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.DomainCommGroupDao">
<resultMap id="domainCommGroupCfgMap" type="com.nis.domain.basics.DomainCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
r.user_region3,r.user_region4,r.user_region5
</sql>
<select id="findAllPageList" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
</trim>
FROM
domain_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.is_audit,r.create_time desc
</otherwise>
</choose>
</select>
<select id="findByPage" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
</trim>
FROM
domain_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
where r.CFG_ID in (${ids})
</select>
<select id="findInfoByCfgId" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
where r.CFG_ID =#{cfgId}
</select>
<!-- 修改时检索 -->
<select id="get" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
domain_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertCommGroupCfg" parameterType="com.nis.domain.basics.DomainCommCfg">
insert into domain_comm_cfg (
CFG_DESC,
cfg_keywords,
action,
is_valid,
is_audit,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
service_id,
request_id,
compile_id,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
expr_type,
match_method,
is_hexbin,
area_effective_ids,
function_id,
cfg_region_code,
cfg_type,
ratelimit,
region_id,
group_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{ratelimit,jdbcType=VARCHAR},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.basics.DomainCommCfg" >
update domain_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="cfgKeywords != null and cfgKeywords != ''" >
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null and compileId != ''" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="exprType != null" >
expr_type = #{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null" >
match_method = #{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null" >
is_hexbin = #{isHexbin,jdbcType=INTEGER},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null and ratelimit != ''" >
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from domain_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getByIds" resultMap="domainCommGroupCfgMap">
select
<include refid="columns"></include>
from domain_comm_cfg r
where r.cfg_id in (${ids}) and is_valid !=-1
</select>
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from domain_comm_cfg
WHERE user_region3= #{groupId}
and is_valid=1
</select>
<select id="findAllList" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.DomainCommCfg" resultMap="domainCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
domain_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
</trim>
</select>
</mapper>

View File

@@ -1,35 +0,0 @@
package com.nis.web.dao.basics;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.Varibles;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface IpCommGroupCfgDao extends CrudDao<IpCommCfg>{
public List<IpCommCfg> findPage(IpCommCfg cfg);
public List<IpCommCfg> findByPage(@Param("ids")String ids);
public void delete(@Param("ids")String ids);
public void updateIssued(IpCommCfg cfg);
public List<IpCommCfg> getByIds(@Param("ids")String ids);
public List<IpCommCfg> findAllList(IpCommCfg cfg);
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
public int insertBatch(List<IpCommCfg> list);
public Varibles getVaribles(@Param("name")String name);
public void ajaxDeleteAsnIp(@Param("ids")String ids);
public IpCommCfg getOne(IpCommCfg cfg);
public List<Object[]> findAllIpCommGroupCfgList();
public void insertIpCommGroupCfg(IpCommCfg ipPortCfg);
public int getGroupIdCount(int groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<IpCommCfg> getGroupIds(IpCommCfg cfg);
public void deleteCfgByGroupIds(@Param("groupIds")String groupIds);
}

View File

@@ -1,728 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.IpCommGroupCfgDao">
<resultMap id="IpCommGroupCfgMap" type="com.nis.domain.basics.IpCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_type,r.cfg_region_code,r.ip_type,r.src_ip_pattern,r.src_ip_address,r.dest_ip_pattern,r.dest_ip_address,
r.src_port_pattern,r.src_port,r.dest_port_pattern,r.dest_port
,r.protocol,r.protocol_id,r.direction,r.action
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.user_region1
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.compile_id,r.region_id,r.group_id
</sql>
<select id="findPage" resultMap="IpCommGroupCfgMap">
select
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
</trim>
from ip_comm_cfg r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="regionId != null">
AND r.region_id=#{regionId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="userRegion3 != null">
AND r.user_region3 like concat(concat('%',#{userRegion3,jdbcType=VARCHAR}),'%')
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>
<!-- 配置修改时检索 -->
<select id="get" resultMap="IpCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
ip_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
ip_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<select id="getByIds" resultMap="IpCommGroupCfgMap">
select
<include refid="columns"></include>
from ip_comm_cfg r
where r.cfg_id in (${ids}) and r.is_valid !=-1
</select>
<select id="getByAsnNo" resultMap="IpCommGroupCfgMap" parameterType="java.lang.Long" >
select
<include refid="columns"></include>
from ip_comm_cfg r where r.is_valid!=-1 and r.user_region1=#{asnId}
</select>
<insert id="insertIpCommGroupCfg" parameterType="com.nis.domain.basics.IpCommCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ip_comm_cfg (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
REGION_ID,
GROUP_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
FUNCTION_ID,
IP_TYPE,
SRC_IP_ADDRESS,
SRC_IP_PATTERN,
DEST_IP_PATTERN,
SRC_PORT_PATTERN,
DEST_PORT_PATTERN,
SRC_PORT,
PROTOCOL,
PROTOCOL_ID,
DIRECTION,
DEST_PORT,
DEST_IP_ADDRESS,
CFG_TYPE,
CFG_REGION_CODE,
USER_REGION1,
USER_REGION2,
USER_REGION3,
USER_REGION4,
USER_REGION5,
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<insert id="insertForBatch" parameterType="com.nis.domain.basics.IpCommCfg" >
insert into ip_comm_cfg (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
REGION_ID,
GROUP_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
FUNCTION_ID,
IP_TYPE,
SRC_IP_ADDRESS,
SRC_IP_PATTERN,
DEST_IP_PATTERN,
SRC_PORT_PATTERN,
DEST_PORT_PATTERN,
SRC_PORT,
PROTOCOL,
PROTOCOL_ID,
DIRECTION,
DEST_PORT,
DEST_IP_ADDRESS,
CFG_TYPE,
CFG_REGION_CODE,
USER_REGION1,
USER_REGION2,
USER_REGION3,
USER_REGION4,
USER_REGION5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.basics.IpCommCfg" >
update ip_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
CFG_DESC = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
ACTION = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
IS_VALID = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
IS_AUDIT = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
EDITOR_ID = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
EDIT_TIME = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
REQUEST_ID = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
IS_AREA_EFFECTIVE = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
CLASSIFY = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
ATTRIBUTE = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
LABLE = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
AREA_EFFECTIVE_IDS = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
FUNCTION_ID = #{functionId,jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
SERVICE_ID = #{serviceId,jdbcType=INTEGER},
</if>
<if test="ipType != null" >
IP_TYPE = #{ipType,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null and srcIpAddress != ''" >
SRC_IP_ADDRESS = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="srcIpPattern != null" >
SRC_IP_PATTERN = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="destIpPattern != null" >
DEST_IP_PATTERN =#{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
SRC_PORT_PATTERN = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
DEST_PORT_PATTERN = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
SRC_PORT = #{srcPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null" >
PROTOCOL = #{protocol,jdbcType=INTEGER},
</if>
<if test="protocolId != null" >
PROTOCOL_ID = #{protocolId,jdbcType=INTEGER},
</if>
<if test="direction != null" >
DIRECTION = #{direction,jdbcType=INTEGER},
</if>
<if test="destPort != null and destPort != ''" >
DEST_PORT = #{destPort,jdbcType=VARCHAR},
</if>
<if test="destIpAddress != null and destIpAddress != ''" >
DEST_IP_ADDRESS = #{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="cfgType != null and cfgType != ''" >
CFG_TYPE = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
CFG_REGION_CODE = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
USER_REGION2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
USER_REGION3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
USER_REGION4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
USER_REGION5 = #{userRegion5,jdbcType=VARCHAR},
</if>
<if test="groupId != null" >
GROUP_ID = #{groupId,jdbcType=INTEGER},
</if>
<if test="regionId != null" >
REGION_ID = #{regionId,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from ip_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getGroupIdCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from ip_comm_cfg
WHERE group_id= #{groupId}
and is_valid=1
</select>
<select id="findAllList" resultMap="IpCommGroupCfgMap">
select
<include refid="columns"></include>
from ip_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="regionId != null">
AND r.region_id=#{regionId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="userRegion1 != null">
AND r.user_region1 like concat(concat('%',#{userRegion1,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion2 != null">
AND r.user_region2 like concat(concat('%',#{userRegion2,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion3 != null">
AND r.user_region3 like concat(concat('%',#{userRegion3,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion4 != null">
AND r.user_region4 like concat(concat('%',#{userRegion4,jdbcType=VARCHAR}),'%')
</if>
<if test="userRegion5 != null">
AND r.user_region5 like concat(concat('%',#{userRegion5,jdbcType=VARCHAR}),'%')
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.IpCommCfg" resultMap="IpCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
ip_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
</trim>
</select>
<delete id="deleteCfgByGroupIds" parameterType="java.lang.String" >
delete from ip_comm_cfg where group_id in (${groupIds})
</delete>
</mapper>

View File

@@ -26,10 +26,4 @@ public interface PolicyGroupInfoDao extends CrudDao<PolicyGroupInfo> {
PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo);
List<PolicyGroupInfo> findPolicyByGroupInfoList(@Param("ids")String ids);
List<PolicyGroupInfo> findPolicyByGroupInfoListByGroupIds(@Param("serviceGroupIds")String ids);
List<PolicyGroupInfo> findPolicyGroupInfosByTypeForUD(@Param("groupType")Integer groupType,@Param("flag")Integer flag);
List<PolicyGroupInfo> findLimitedPolicyGroupInfosByTypeForUD(@Param("groupType")Integer groupType,@Param("flag")Integer flag,@Param("limit")Integer limit);
void updateUdFlag(@Param("groupIds")String groupIds,@Param("udFlag")int udFlag,@Param("groupType")Integer groupType);
List<PolicyGroupInfo> findPolicyByServiceGroupInfoList(@Param("ids")String ids);
}

View File

@@ -17,7 +17,7 @@
</resultMap>
<sql id="PolicyGroupInfoColumns">
r.group_id,r.group_name,r.group_type,r.is_valid,r.create_time,r.edit_time,
r.creator_id,r.editor_id,r.service_group_id,r.asn_no,r.description,r.ud_flag
r.creator_id,r.editor_id,r.service_group_id,r.asn_no,r.description
</sql>
<!-- 查出所有 有效数据-->
@@ -266,64 +266,6 @@
WHERE
r.group_id IN (${ids})
</select>
<!-- 查出所有 有效数据-->
<select id="findPolicyByGroupInfoListByGroupIds" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM
policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
WHERE
r.group_id IN (${serviceGroupIds})
</select>
<select id="findPolicyByServiceGroupInfoList" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
<trim prefix="," prefixOverrides=",">
, s.name as creator_name
,e.name as editor_name
</trim>
FROM
policy_group_info r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
WHERE
r.service_group_id IN (${ids})
</select>
<select id="findPolicyGroupInfosByTypeForUD" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
FROM policy_group_info r
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
<if test="flag!=null">
and ud_flag=#{flag}
</if>
</select>
<select id="findLimitedPolicyGroupInfosByTypeForUD" resultMap="PolicyGroupInfoMap">
SELECT
<include refid="PolicyGroupInfoColumns"/>
FROM policy_group_info r
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
<if test="flag!=null">
and ud_flag=#{flag}
</if>
<if test="flag!=null">
limit #{limit}
</if>
</select>
<update id="updateUdFlag">
UPDATE policy_group_info SET ud_flag =#{udFlag}
WHERE service_group_id in (${groupIds})
<if test="groupType!=null">
and group_type=#{groupType}
</if>
</update>
</mapper>

View File

@@ -1,37 +0,0 @@
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface ScriberIdCommGroupDao extends CrudDao<ScriberIdCommCfg>{
// 查询列表
public List<ScriberIdCommCfg> findAllPageList(ScriberIdCommCfg entity);
public List<ScriberIdCommCfg> findByPage(@Param("ids")String ids);
public List<ScriberIdCommCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
//新增
public int insertCommGroupCfg(ScriberIdCommCfg entity);
//修改
public int update(ScriberIdCommCfg entity);
//删除
public int delete(@Param("ids")String ids);
public List<ScriberIdCommCfg> getByIds(@Param("ids")String ids);
public Integer getGroupIdCount(@Param("groupId")String groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<ScriberIdCommCfg> getGroupIds(ScriberIdCommCfg cfg);
}

View File

@@ -1,525 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.ScriberIdCommGroupDao">
<resultMap id="commGroupCfgMap" type="com.nis.domain.basics.ScriberIdCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
r.user_region3,r.user_region4,r.user_region5
</sql>
<select id="findAllPageList" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
</trim>
FROM
scriberid_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.is_audit,r.create_time desc
</otherwise>
</choose>
</select>
<select id="findByPage" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
</trim>
FROM
scriberid_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
where r.CFG_ID in (${ids})
</select>
<select id="findInfoByCfgId" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
where r.CFG_ID =#{cfgId}
</select>
<!-- 修改时检索 -->
<select id="get" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
scriberid_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertCommGroupCfg" parameterType="com.nis.domain.basics.ScriberIdCommCfg">
insert into scriberid_comm_cfg (
CFG_DESC,
cfg_keywords,
action,
is_valid,
is_audit,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
service_id,
request_id,
compile_id,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
expr_type,
match_method,
is_hexbin,
area_effective_ids,
function_id,
cfg_region_code,
cfg_type,
ratelimit,
region_id,
group_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{ratelimit,jdbcType=VARCHAR},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.basics.ScriberIdCommCfg" >
update scriberid_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="cfgKeywords != null and cfgKeywords != ''" >
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null and compileId != ''" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="exprType != null" >
expr_type = #{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null" >
match_method = #{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null" >
is_hexbin = #{isHexbin,jdbcType=INTEGER},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null and ratelimit != ''" >
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from scriberid_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getByIds" resultMap="commGroupCfgMap">
select
<include refid="columns"></include>
from scriberid_comm_cfg r
where r.cfg_id in (${ids}) and is_valid !=-1
</select>
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from scriberid_comm_cfg
WHERE user_region3= #{groupId}
and is_valid=1
</select>
<select id="findAllList" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.ScriberIdCommCfg" resultMap="commGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
scriberid_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
</trim>
</select>
</mapper>

View File

@@ -1,42 +0,0 @@
package com.nis.web.dao.basics;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface UrlCommGroupDao extends CrudDao<UrlCommCfg>{
// 查询列表
public List<UrlCommCfg> findAllPageList(UrlCommCfg entity);
public List<UrlCommCfg> findByPage(@Param("ids")String ids);
public List<UrlCommCfg> findInfoByCfgId(@Param("cfgId")Long cfgId);
//新增
public int insertUrlCommGroupCfg(UrlCommCfg entity);
public Integer findUrlUdFlag(@Param("groupId")Integer groupId);
public int updateUrlUdFlag(@Param("groupId")Integer groupId,@Param("udFlag")Integer udFlag);
//修改
public int update(UrlCommCfg entity);
//删除
public int delete(@Param("ids")String ids);
public List<UrlCommCfg> getByIds(@Param("ids")String ids);
public Integer getGroupIdCount(@Param("groupId")String groupId);
// 校验分组是否被引用
public Integer getCfgInfoByGroupIds(@Param("ids")String ids);
public List<UrlCommCfg> getGroupIds(UrlCommCfg cfg);
}

View File

@@ -1,534 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.basics.UrlCommGroupDao">
<resultMap id="urlCommGroupCfgMap" type="com.nis.domain.basics.UrlCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.cfg_region_code,r.cfg_type,r.ratelimit, r.region_id, r.group_id,r.user_region1,r.user_region2,
r.user_region3,r.user_region4,r.user_region5
</sql>
<select id="findAllPageList" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name,c.group_name
</trim>
FROM
url_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
LEFT JOIN policy_group_info c ON c.service_group_id=r.user_region3
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.is_audit,r.create_time desc
</otherwise>
</choose>
</select>
<select id="findByPage" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name AS creator_name,e.name AS editor_name,u.name AS auditor_name
</trim>
FROM
url_comm_cfg r
LEFT JOIN sys_user s ON r.creator_id = s.id
LEFT JOIN sys_user e ON r.editor_id = e.id
LEFT JOIN sys_user u ON r.auditor_id = u.id
where r.CFG_ID in (${ids})
</select>
<select id="findInfoByCfgId" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
where r.CFG_ID =#{cfgId}
</select>
<!-- 修改时检索 -->
<select id="get" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
WHERE
r.cfg_id = #{ids} AND r.is_valid != -1
</select>
<select id="getCfgInfoByGroupIds" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
url_comm_cfg r
WHERE
r.group_id IN(${ids}) AND r.is_valid != -1
</select>
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommCfg">
insert into url_comm_cfg (
CFG_DESC,
cfg_keywords,
action,
is_valid,
is_audit,
creator_id,
create_time,
editor_id,
edit_time,
auditor_id,
audit_time,
service_id,
request_id,
compile_id,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
expr_type,
match_method,
is_hexbin,
area_effective_ids,
function_id,
cfg_region_code,
cfg_type,
ratelimit,
region_id,
group_id,
user_region1,
user_region2,
user_region3,
user_region4,
user_region5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{cfgKeywords,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgRegionCode,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{ratelimit,jdbcType=VARCHAR},
#{regionId,jdbcType=INTEGER},
#{groupId,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
)
</insert>
<select id="findUrlUdFlag" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT ud_flag from policy_group_info
where service_group_id=#{groupId}
and group_type=11
</select>
<update id="updateUrlUdFlag" parameterType="java.lang.Integer">
UPDATE policy_group_info SET ud_flag =#{udFlag}
WHERE service_group_id=#{groupId}
and group_type=11
</update>
<update id="update" parameterType="com.nis.domain.basics.UrlCommCfg" >
update url_comm_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="cfgKeywords != null and cfgKeywords != ''" >
cfg_keywords = #{cfgKeywords,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="compileId != null and compileId != ''" >
compile_id = #{compileId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="exprType != null" >
expr_type = #{exprType,jdbcType=INTEGER},
</if>
<if test="matchMethod != null" >
match_method = #{matchMethod,jdbcType=INTEGER},
</if>
<if test="isHexbin != null" >
is_hexbin = #{isHexbin,jdbcType=INTEGER},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="ratelimit != null and ratelimit != ''" >
ratelimit = #{ratelimit,jdbcType=VARCHAR},
</if>
<if test="groupId != null">
group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="userRegion2 != null and userRegion2 != ''" >
user_region2 = #{userRegion2,jdbcType=VARCHAR},
</if>
<if test="userRegion3 != null and userRegion3 != ''" >
user_region3 = #{userRegion3,jdbcType=VARCHAR},
</if>
<if test="userRegion4 != null and userRegion4 != ''" >
user_region4 = #{userRegion4,jdbcType=VARCHAR},
</if>
<if test="userRegion5 != null and userRegion5 != ''" >
user_region5 = #{userRegion5,jdbcType=VARCHAR},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
<delete id="delete" parameterType="java.lang.String" >
delete from url_comm_cfg where cfg_id in (${ids})
</delete>
<select id="getByIds" resultMap="urlCommGroupCfgMap">
select
<include refid="columns"></include>
from url_comm_cfg r
where r.cfg_id in (${ids}) and is_valid !=-1
</select>
<select id="getGroupIdCount" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(cfg_id) groupCount from url_comm_cfg
WHERE user_region3= #{groupId}
and is_valid=1
</select>
<select id="findAllList" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
<if test="commonGroupIds != null">
AND r.group_id in(${commonGroupIds})
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
</select>
<select id="getGroupIds" parameterType="com.nis.domain.basics.UrlCommCfg" resultMap="urlCommGroupCfgMap">
SELECT
<include refid="columns"></include>
FROM
url_comm_cfg r
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgKeywords != null and cfgKeywords != ''">
AND r.cfg_keywords like concat(concat('%',#{cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{cfgType,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<if test="groupId != null">
AND r.group_id = #{groupId,jdbcType=INTEGER}
</if>
</trim>
</select>
</mapper>

View File

@@ -2,9 +2,13 @@ package com.nis.web.dao.configuration;
import java.util.List;
import com.nis.domain.configuration.*;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CachePolicyUserRegion;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.web.dao.MyBatisDao;
@@ -43,16 +47,4 @@ public interface CommonPolicyDao {
@Param("compileIds")List compileIds);
public void clearPolicies(@Param("tableName")String tableName);
List<CfgIndexInfo> getObjGroupListByGroupIds(@Param("groupIds")String groupIds,@Param("functionId")Integer functionId,@Param("isValid") Integer isValid);
void updateCfgIndexCommonGroupIds(CfgIndexInfo cfgIndexInfo);
List<ObjGroupCfg> getObjGroupList(@Param("ids")String ids);
List<ObjGroupCfg> getObjGroupPagedList(ObjGroupCfg entity);
void cancelScheduCfg(@Param("compileIds")String compileIds,@Param("tableName")String tableName);
// 分组域配置管理 批量删除时使用
void updateCfgIndexCommonGroupIdsBatch(CfgIndexInfo cfgIndexInfo);
}

View File

@@ -74,7 +74,7 @@
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -164,16 +164,13 @@
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ObjMap" type="com.nis.domain.configuration.ObjGroupCfg" extends="CfgIndexInfoMap" >
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
</resultMap>
<sql id="ConfigIndex_Column" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.source_compile_id,a.cancel_request_id,
a.do_blacklist,a.common_group_ids
a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
@@ -343,14 +340,6 @@
</where>
)
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND
<foreach collection="userRegion5.split(',')" index="index" item="item" open="(" separator="OR" close=")">
<if test="item != ''">
a.common_group_ids LIKE concat(concat('%',#{item,jdbcType=VARCHAR}),'%')
</if>
</foreach>
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
@@ -458,8 +447,7 @@
user_region5,
do_log,
source_compile_id,
do_blacklist,
common_group_ids
do_blacklist
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
@@ -488,8 +476,7 @@
#{userRegion5,jdbcType=VARCHAR},
#{doLog,jdbcType=INTEGER},
#{sourceCompileId,jdbcType=INTEGER},
#{doBlackList,jdbcType=INTEGER},
#{commonGroupIds,jdbcType=VARCHAR}
#{doBlackList,jdbcType=INTEGER}
)
</insert>
@@ -773,30 +760,10 @@
user_region3 = #{userRegion3,jdbcType=VARCHAR},
user_region4 = #{userRegion4,jdbcType=VARCHAR},
user_region5 = #{userRegion5,jdbcType=VARCHAR},
<if test="commonGroupIds != null">
common_group_ids= #{commonGroupIds,jdbcType=VARCHAR},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<update id="updateCfgIndexCommonGroupIds" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update cfg_index_info
<set >
<trim suffixOverrides=",">
<if test="commonGroupIds != null">
common_group_ids= #{commonGroupIds,jdbcType=VARCHAR},
</if>
<if test="isValid != null">
is_valid= #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null">
is_audit= #{isAudit,jdbcType=INTEGER},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 删除子配置 -->
<delete id="deleteIpPortCfg" >
@@ -1114,176 +1081,5 @@
SET is_valid = -1, is_audit = 0
WHERE is_valid != -1
</update>
<select id="getObjGroupListByGroupIds" resultMap="CfgIndexInfoMap">
SELECT
<include refid="ConfigIndex_Column" />
FROM cfg_index_info a
<trim prefix="WHERE" prefixOverrides="AND">
<if test="groupIds!=null">
AND (
<foreach collection="groupIds.split(',')" index="index" item="item" >
<if test="index==0">
a.common_group_ids like concat('%,',#{item,jdbcType=INTEGER},',%')
</if>
<if test="index!=0">
OR a.common_group_ids like concat('%,',#{item,jdbcType=INTEGER},',%')
</if>
</foreach>
)
</if>
<if test="functionId!=null" >
AND function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="isValid!=null" >
AND is_valid=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid==null" >
AND is_valid !=-1
</if>
</trim>
</select>
<select id="getObjGroupList" resultMap="ObjMap" parameterType="com.nis.domain.configuration.ObjGroupCfg" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM cfg_index_info a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
<select id="getObjGroupPagedList" resultMap="ObjMap" parameterType="com.nis.domain.configuration.ObjGroupCfg" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM cfg_index_info a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}, a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<delete id="cancelScheduCfg" >
delete from schedule_cfg
where table_name= #{tableName}
and compile_id in(${compileIds})
</delete>
<update id="updateCfgIndexCommonGroupIdsBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
UPDATE
cfg_index_info a
SET
a.common_group_ids = #{commonGroupIds,jdbcType=VARCHAR}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="isValid != null">
AND a.IS_VALID = #{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="userRegion5 != null and userRegion5 != ''">
AND
<foreach collection="userRegion5.split(',')" index="index" item="item" open="(" separator="OR" close=")">
<if test="item != ''">
a.common_group_ids LIKE concat(concat('%',#{item,jdbcType=VARCHAR}),'%')
</if>
</foreach>
</if>
</trim>
</update>
</mapper>

View File

@@ -4,11 +4,11 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import com.nis.domain.basics.*;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.configuration.AppByteCfg;
import com.nis.domain.configuration.AppComplexKeywordCfg;
import com.nis.domain.configuration.AppDomainCfg;
@@ -106,8 +106,4 @@ public interface ConfigSynchronizationDao {
public void updateCfgStatus(BaseCfg entity);
public PxyObjSpoofingIpPool getPxyObjSpoofingIpPool(Long cfgId);
List<IpCommCfg> getIpCommCfgPortList(@Param("groupIds")List groupIds);
List<UrlCommCfg> getUrlCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
List<ScriberIdCommCfg> getSubscribeIdCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
List<DomainCommCfg> getDomainCommCfgPortList(@Param("groupIds")List<Integer> groupIds);
}

View File

@@ -80,7 +80,7 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
@@ -241,7 +241,7 @@
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -378,13 +378,12 @@
<result column="source_compile_id" property="sourceCompileId" jdbcType="INTEGER" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
<result column="common_group_ids" property="commonGroupIds" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -415,10 +414,6 @@
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ipCommMap" type="com.nis.domain.basics.IpCommCfg" extends="ipPortMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
@@ -451,18 +446,6 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
</resultMap>
<resultMap id="urlCommMap" type="com.nis.domain.basics.UrlCommCfg" extends="stringCfgMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="scriberIdCommMap" type="com.nis.domain.basics.ScriberIdCommCfg" extends="stringCfgMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="domainCommMap" type="com.nis.domain.basics.DomainCommCfg" extends="stringCfgMap">
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
@@ -721,7 +704,7 @@
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
@@ -804,10 +787,6 @@
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id
</sql>
<sql id="IpCommCfg_Column" >
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id,a.region_id,a.group_id
</sql>
<sql id="IpCfg_AllColumn" >
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time,
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
@@ -833,10 +812,6 @@
a.cfg_keywords,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
</sql>
<sql id="CommStrCfg_Column" >
a.cfg_keywords,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id,a.region_id,a.group_id
</sql>
<sql id="ComplexCfg_Column" >
a.cfg_keywords,a.district,a.cfg_type,
a.expr_type,a.match_method,a.is_hexbin,a.compile_id
@@ -1050,7 +1025,7 @@
SELECT
<include refid="BaseCfg_Column" />
<trim prefix="," prefixOverrides=",">
,a.common_group_ids, s.name as creator_name,u.name as auditor_name
, s.name as creator_name,u.name as auditor_name
<if test="serviceId !=null and serviceId == 18">
,dns.cfg_desc as dns_strategy_name
</if>
@@ -1121,16 +1096,16 @@
ORDER BY a.CFG_ID
</select>
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ${tableName} a
<where>
and a.compile_id in
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
</where>
</select>
SELECT
<include refid="IpCfg_Column" />
FROM ${tableName} a
<where>
and a.compile_id in
<foreach collection="compileIds" index="index" item="compileId" open="(" separator="," close=")">
#{compileId}
</foreach>
</where>
</select>
<select id="getIpDropList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpDropCfg_Column" />
@@ -1951,48 +1926,4 @@
</if>
</trim>
</select> -->
<select id="getIpCommCfgPortList" resultMap="ipCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCommCfg_Column" />
FROM ip_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
<select id="getUrlCommCfgPortList" resultMap="urlCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="CommStrCfg_Column" />
FROM url_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
<select id="getSubscribeIdCommCfgPortList" resultMap="scriberIdCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="CommStrCfg_Column" />
FROM scriberid_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
<select id="getDomainCommCfgPortList" resultMap="domainCommMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="CommStrCfg_Column" />
FROM domain_comm_cfg a
<where>
and a.group_id in
<foreach collection="groupIds" index="index" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
</where>
</select>
</mapper>

View File

@@ -1,23 +0,0 @@
package com.nis.web.dao.configuration;
import com.nis.domain.basics.DomainCommCfg;
import com.nis.domain.basics.IpCommCfg;
import com.nis.domain.basics.ScriberIdCommCfg;
import com.nis.domain.basics.UrlCommCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@MyBatisDao
public interface ObjectGroupDao extends CrudDao<CfgIndexInfo> {
public CfgIndexInfo getObjectGroupConfig(@Param("cfgId")Long cfgId,@Param("compileId")Integer compileId);
List<UrlCommCfg> getUrlCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
List<ScriberIdCommCfg> getScriberIdCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
List<DomainCommCfg> getDomainCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
List<IpCommCfg> getIpCommonList(@Param("groupIds")String groupIds, @Param("compileId")Long compileId);
}

View File

@@ -1,326 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ObjectGroupDao" >
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
<result column="do_blacklist" property="doBlackList" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="IpCommGroupCfgMap" type="com.nis.domain.basics.IpCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="urlCommGroupCfgMap" type="com.nis.domain.basics.UrlCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="domainCommGroupCfgMap" type="com.nis.domain.basics.DomainCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="scribeIdCommGroupCfgMap" type="com.nis.domain.basics.ScriberIdCommCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type" property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="ratelimit" property="ratelimit" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
</resultMap>
<sql id="ConfigIndex_Column" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist,a.common_group_ids
</sql>
<sql id="Cfg_Column_List" >
CFG_DESC,CFG_REGION_CODE,CFG_TYPE,ACTION,
IS_VALID,IS_AUDIT,CREATOR_ID,
CREATE_TIME,EDITOR_ID,EDIT_TIME,
AUDITOR_ID,AUDIT_TIME,SERVICE_ID,
REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,
CLASSIFY,ATTRIBUTE,LABLE,
AREA_EFFECTIVE_IDS,FUNCTION_ID,RATELIMIT,
DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
</sql>
<sql id="Cfg_Value_List" >
#{cfgDesc,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{cfgType,jdbcType=VARCHAR},#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP},#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},#{compileId,jdbcType=INTEGER},#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},#{attribute,jdbcType=VARCHAR},#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR}, #{functionId,jdbcType=INTEGER}, #{ratelimit,jdbcType=VARCHAR},
#{dnsStrategyId,jdbcType=INTEGER},#{irType,jdbcType=INTEGER},
#{userRegion1,jdbcType=VARCHAR},
#{userRegion2,jdbcType=VARCHAR},
#{userRegion3,jdbcType=VARCHAR},
#{userRegion4,jdbcType=VARCHAR},
#{userRegion5,jdbcType=VARCHAR}
</sql>
<sql id="IpCfg_Column">
r.cfg_id,r.cfg_desc,r.cfg_type,r.cfg_region_code,r.ip_type,r.src_ip_pattern,r.src_ip_address,r.dest_ip_pattern,r.dest_ip_address,
r.src_port_pattern,r.src_port,r.dest_port_pattern,r.dest_port
,r.protocol,r.protocol_id,r.direction,r.action
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.user_region1
,r.user_region2,r.user_region3,r.user_region4,r.user_region5,r.compile_id,r.region_id,r.group_id
</sql>
<sql id="StringCfg_Column">
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.action,r.is_valid,r.is_audit,r.creator_id,
r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time,r.service_id,
r.request_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,
r.ratelimit,r.user_region1,r.user_region2,r.user_region3,r.user_region4,r.user_region5,
r.compile_id,r.region_id,r.group_id
</sql>
<select id="getObjectGroupConfig" resultMap="CfgIndexInfoMap">
SELECT
<include refid="ConfigIndex_Column" />
FROM CFG_INDEX_INFO a
<where>
<if test="cfgId !=null">
CFG_ID = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId != null">
AND COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cfg_index_info (
<include refid="Cfg_Column_List" />
)values (
<include refid="Cfg_Value_List" />
)
</insert>
<insert id="insertForBatch" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
insert into ${tableName} (
<include refid="Cfg_Column_List" />
)values (
<include refid="Cfg_Column_List" />
)
</insert>
<select id="getIpCommonList" resultMap="IpCommGroupCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ip_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select>
<select id="getUrlCommonList" resultMap="urlCommGroupCfgMap" >
SELECT
<include refid="StringCfg_Column" />
FROM url_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select><select id="getScriberIdCommonList" resultMap="scribeIdCommGroupCfgMap" >
SELECT
<include refid="StringCfg_Column" />
FROM scriberid_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select><select id="getDomainCommonList" resultMap="domainCommGroupCfgMap" >
SELECT
<include refid="StringCfg_Column" />
FROM domain_comm_cfg r
<where>
<if test="compileId != null">
AND r.compile_id =#{compileId}
</if>
<if test="groupIds != null and groupIds !=''">
AND r.group_id in (${groupIds})
</if>
</where>
</select>
<!--<select id="getComplexStringList" resultMap="complexCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="ComplexCfg_Column" />
FROM complex_keyword_cfg a
<where>
<if test="compileId != null">
AND a.compile_id =#{compileId}
</if>
<if test="functionId != null">
AND a.function_id =#{functionId}
</if>
<if test="cfgType != null and cfgType !='' ">
AND a.cfg_type =#{cfgType}
</if>
</where>
</select>-->
</mapper>

View File

@@ -1,29 +0,0 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
/**
* 劫持文件处理
* @author lenovo
*
*/
@MyBatisDao
public interface ProxyFileHijackDao extends CrudDao<ProxyFileHijackCfg>{
public List<ProxyFileHijackCfg> findPage(ProxyFileHijackCfg entity) ;
public ProxyFileHijackCfg getCfgById(@Param("cfgId")Long cfgId);
public int insert(ProxyFileHijackCfg entity);
public int update(ProxyFileHijackCfg entity);
List<ProxyFileHijackCfg> findByList(@Param("ids")String ids);
public List<ProxyFileHijackCfg> findHijackFiles(ProxyFileHijackCfg hijackSearch);
}

View File

@@ -1,346 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ProxyFileHijackDao" >
<resultMap id="ProxyFileHijackCfg" type="com.nis.domain.callback.ProxyFileHijackCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
<result column="content_type" property="contentType" jdbcType="VARCHAR" />
<result column="content_name" property="contentName" jdbcType="VARCHAR" />
<result column="path" property="path" jdbcType="VARCHAR" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
</resultMap>
<sql id="ProxyFileHijackCfgColumn" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
a.CONTENT_TYPE,a.CONTENT_NAME,a.PATH,a.CANCEL_REQUEST_ID
</sql>
<!-- voip条件查询列表信息 -->
<select id="findPage" resultMap="ProxyFileHijackCfg" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" >
SELECT
<include refid="ProxyFileHijackCfgColumn" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_HIJACK_FILES a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getCfgById" resultMap="ProxyFileHijackCfg">
SELECT
<include refid="ProxyFileHijackCfgColumn" />
FROM PXY_PROFILE_HIJACK_FILES a
<where>
<if test="cfgId != null">
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileHijackCfg">
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into PXY_PROFILE_HIJACK_FILES (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
cfg_type,
cfg_region_code,
path,
content_type,
content_name
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{path,jdbcType=VARCHAR},
#{contentType,jdbcType=VARCHAR},
#{contentName,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" >
update PXY_PROFILE_HIJACK_FILES
<set>
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null" >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="path != null" >
path = #{path,jdbcType=VARCHAR},
</if>
<if test="contentType != null" >
content_type = #{contentType,jdbcType=VARCHAR},
</if>
<if test="contentName != null" >
content_name = #{contentName,jdbcType=VARCHAR},
</if>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 查出所有 有效数据-->
<select id="findByList" resultMap="ProxyFileHijackCfg">
SELECT
<include refid="ProxyFileHijackCfgColumn"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_HIJACK_FILES a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
<select id="findHijackFiles" parameterType="com.nis.domain.callback.ProxyFileHijackCfg" resultMap="ProxyFileHijackCfg">
SELECT
<include refid="ProxyFileHijackCfgColumn" />
FROM
pxy_profile_hijack_files a
<where>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</where>
</select>
</mapper>

View File

@@ -1,32 +0,0 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileHijackCfg;
import com.nis.domain.callback.ProxyFileInsertScriptCfg;
import com.nis.domain.configuration.PxyObjKeyring;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
/**
* 注入脚本文件
* @author lenovo
*
*/
@MyBatisDao
public interface ProxyFileInsertScriptDao extends CrudDao<ProxyFileInsertScriptCfg> {
public List<ProxyFileInsertScriptCfg> findPage(ProxyFileInsertScriptCfg entity);
public ProxyFileInsertScriptCfg getCfgById(@Param("cfgId")Long cfgId);
public int insert(ProxyFileInsertScriptCfg entity);
public int update(ProxyFileInsertScriptCfg entity);
List<ProxyFileInsertScriptCfg> findByList(@Param("ids")String ids);
public List<ProxyFileInsertScriptCfg> findInsertFiles(ProxyFileInsertScriptCfg insertSearch);
}

View File

@@ -1,340 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ProxyFileInsertScriptDao" >
<resultMap id="ProxyFileInsertScriptCfg" type="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="format" property="format" jdbcType="VARCHAR" />
<result column="path" property="path" jdbcType="VARCHAR" />
<result column="cancel_request_id" property="cancelRequestId" jdbcType="INTEGER" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
</resultMap>
<sql id="ProxyFileInsertScriptCfgColumn" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
a.FORMAT,a.PATH,a.cancel_request_id
</sql>
<!-- voip条件查询列表信息 -->
<select id="findPage" resultMap="ProxyFileInsertScriptCfg" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
SELECT
<include refid="ProxyFileInsertScriptCfgColumn" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_INSERT_SCRIPTS a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getCfgById" resultMap="ProxyFileInsertScriptCfg">
SELECT
<include refid="ProxyFileInsertScriptCfgColumn" />
FROM PXY_PROFILE_INSERT_SCRIPTS a
<where>
<if test="cfgId != null">
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg">
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into PXY_PROFILE_INSERT_SCRIPTS (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
cfg_type,
cfg_region_code,
path,
format
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{path,jdbcType=VARCHAR},
#{format,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" >
update PXY_PROFILE_INSERT_SCRIPTS
<set>
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null" >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="path != null" >
path = #{path ,jdbcType=VARCHAR},
</if>
<if test="format != null" >
format = #{format ,jdbcType=VARCHAR},
</if>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 查出所有 有效数据-->
<select id="findByList" resultMap="ProxyFileInsertScriptCfg">
SELECT
<include refid="ProxyFileInsertScriptCfgColumn"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM PXY_PROFILE_INSERT_SCRIPTS a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
<select id="findInsertFiles" parameterType="com.nis.domain.callback.ProxyFileInsertScriptCfg" resultMap="ProxyFileInsertScriptCfg">
SELECT
<include refid="ProxyFileInsertScriptCfgColumn" />
FROM
pxy_profile_insert_scripts a
<where>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</where>
</select>
</mapper>

View File

@@ -1,25 +0,0 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileResponsePageCfg;
import com.nis.web.dao.MyBatisDao;
/**
* 特定协议相关配置数据处理类
* @author dell
*
*/
@MyBatisDao
public interface ProxyFileResponsePageDao {
public List<ProxyFileResponsePageCfg> findPage(ProxyFileResponsePageCfg entity) ;
public ProxyFileResponsePageCfg getCfgById(@Param("cfgId")Long cfgId);
public void insert(ProxyFileResponsePageCfg entity);
public void update(ProxyFileResponsePageCfg entity);
List<ProxyFileResponsePageCfg> findByList(@Param("ids")String ids);
}

View File

@@ -1,346 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.ProxyFileResponsePageDao" >
<resultMap id="ProxyFileResponsePageCfg" type="com.nis.domain.callback.ProxyFileResponsePageCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="file_desc" property="fileDesc" jdbcType="VARCHAR" />
<result column="url" property="url" jdbcType="VARCHAR" />
<result column="content_type" property="contentType" jdbcType="VARCHAR" />
<result column="content_length" property="contentLength" jdbcType="VARCHAR" />
<result column="md5" property="md5" jdbcType="VARCHAR" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="level" property="level" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
</resultMap>
<sql id="ProxyFileResponsePageCfgColumn" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.cfg_type,a.cfg_region_code,
a.FILE_DESC,a.URL,a.CONTENT_TYPE,a.CONTENT_LENGTH,a.MD5
</sql>
<!-- voip条件查询列表信息 -->
<select id="findPage" resultMap="ProxyFileResponsePageCfg" parameterType="com.nis.domain.callback.ProxyFileResponsePageCfg" >
SELECT
<include refid="ProxyFileResponsePageCfgColumn" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM pxy_profile_response_pages a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND a.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND a.AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="fileDesc != null and fileDesc != ''">
AND a.file_desc like concat(concat('%',#{fileDesc,jdbcType=VARCHAR}),'%')
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy},a.is_audit,a.CFG_ID desc
</when>
<otherwise>
ORDER BY a.is_audit,a.CFG_ID desc
</otherwise>
</choose>
</select>
<!-- 根据Id获取ProxyFileResponsePageCfg信息 -->
<select id="getCfgById" resultMap="ProxyFileResponsePageCfg">
SELECT
<include refid="ProxyFileResponsePageCfgColumn" />
FROM pxy_profile_response_pages a
<where>
<if test="cfgId != null">
and a.CFG_ID=#{cfgId,jdbcType=INTEGER}
</if>
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileResponsePageCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pxy_profile_response_pages (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
cfg_type,
cfg_region_code,
file_desc,
url,
content_type,
content_length,
md5
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{fileDesc,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR},
#{contentType,jdbcType=VARCHAR},
#{contentLength,jdbcType=INTEGER},
#{md5,jdbcType=VARCHAR}
)
</insert>
<update id="update" parameterType="com.nis.domain.callback.ProxyFileResponsePageCfg" >
update pxy_profile_response_pages
<set>
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="auditorId != null" >
auditor_id = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
audit_time = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="cfgRegionCode != null" >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
<if test="cfgType != null" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="fileDesc != null" >
file_desc = #{fileDesc ,jdbcType=VARCHAR},
</if>
<if test="url != null" >
url = #{url ,jdbcType=VARCHAR},
</if>
<if test="contentType != null" >
content_type = #{contentType ,jdbcType=VARCHAR},
</if>
<if test="contentLength != null" >
content_length = #{contentLength ,jdbcType=BIGINT},
</if>
<if test="md5 != null" >
md5 = #{md5 ,jdbcType=VARCHAR},
</if>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 查出所有 有效数据-->
<select id="findByList" resultMap="ProxyFileResponsePageCfg">
SELECT
<include refid="ProxyFileResponsePageCfgColumn"/>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM pxy_profile_response_pages a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
where a.CFG_ID in (${ids})
</select>
</mapper>

View File

@@ -21,5 +21,5 @@ public interface ProxyFileStrategyDao {
public void insert(ProxyFileStrategyCfg entity);
public void update(ProxyFileStrategyCfg entity);
public List<ProxyFileStrategyCfg> fingResPages(ProxyFileStrategyCfg entity);
}

View File

@@ -74,31 +74,15 @@
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchValidValue != null and batchValidValue != ''">
AND a.IS_VALID in (${batchValidValue})
</when>
<otherwise>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
</otherwise>
</choose>
<choose>
<!-- 判断是否批量操作 -->
<when test="batchAuditValue != null and batchAuditValue != ''">
AND a.IS_AUDIT in(${batchAuditValue})
</when>
<otherwise>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</otherwise>
</choose>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND a.CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
@@ -117,25 +101,6 @@
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="compileIdNew != null and compileIdNew != '' and compileIdNew.indexOf('-') != -1">
<foreach collection="compileIdNew.split('-')" index="index" item="item" >
<if test="index == 0">
AND a.COMPILE_ID &gt;= #{item,jdbcType=INTEGER}
</if>
<if test="index == 1">
AND a.COMPILE_ID &lt;= #{item,jdbcType=INTEGER}
</if>
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') != -1">
AND a.COMPILE_ID in
<foreach collection="compileIdNew.split(',')" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="compileIdNew !=null and compileIdNew != '' and compileIdNew.indexOf(',') == -1 and compileIdNew.indexOf('-') == -1">
AND a.COMPILE_ID=#{compileIdNew,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
@@ -183,9 +148,6 @@
</select>
<insert id="insert" parameterType="com.nis.domain.callback.ProxyFileStrategyCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into proxy_file_strategy_cfg (
CFG_DESC,
ACTION,
@@ -217,8 +179,8 @@
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},
#{isAudit,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
@@ -327,22 +289,6 @@
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<select id="fingResPages" parameterType="com.nis.domain.callback.ProxyFileStrategyCfg" resultMap="ProxyFileStrategyCfg">
SELECT
<include refid="ProxyFileStrategyCfgColumn" />
FROM
pxy_profile_response_pages a
<where>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
</where>
</select>
</mapper>

View File

@@ -1,21 +0,0 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.callback.ProxyFileTrafficMirrorCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface ProxyFileTrafficMirrorDao extends CrudDao<ProxyFileTrafficMirrorCfg>{
public List<ProxyFileTrafficMirrorCfg> findPage(ProxyFileTrafficMirrorCfg entity) ;
public ProxyFileTrafficMirrorCfg getCfgById(@Param("cfgId")Long cfgId);
List<ProxyFileTrafficMirrorCfg> findByList(@Param("ids")String ids);
List<ProxyFileTrafficMirrorCfg> findMirrorList(@Param("compileIds")String compileIds, @Param("isValid")Integer isValid, @Param("isAudit")Integer isAudit);
}

Some files were not shown because too many files have changed in this diff Show More