develop

Conflicts:
	src/main/resources/messages/message_en.properties
	src/main/resources/messages/message_ru.properties
	src/main/resources/messages/message_zh_CN.properties
	excel导入提示信息补全,单个字典数据不需要导入
	去掉是否表达式的导入,根据关键词单个和多个区分
This commit is contained in:
duandongmei
2018-10-23 14:14:08 +08:00
84 changed files with 908 additions and 1441 deletions

View File

@@ -31,6 +31,7 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
*/
private static final long serialVersionUID = -5679998383250783571L;
private static final String tableName="app_policy_cfg";
private String indexTable="app_policy_cfg";
@Expose
@ExcelField(title="cfg_id",sort=0)
private Integer compileId;
@@ -268,5 +269,13 @@ public class AppPolicyCfg extends BaseCfg<AppPolicyCfg> {
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -9,6 +9,7 @@ public class AvFileSampleCfg extends BaseCfg<AvFileSampleCfg> {
*
*/
private static final long serialVersionUID = -2356472662189941874L;
private String indexTable="av_file_sample_cfg";
@Expose
@SerializedName("srcFile")
@ExcelField(title="src_file",sort=2)
@@ -94,5 +95,11 @@ public class AvFileSampleCfg extends BaseCfg<AvFileSampleCfg> {
public void setResultPath(String resultPath) {
this.resultPath = resultPath;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -139,6 +139,10 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
* 来函id
*/
protected Integer requestId;
/**
* 取消审核来函id
*/
protected Integer cancelRequestId;
/**
* 来函
*/
@@ -884,5 +888,11 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
public Integer getCancelRequestId() {
return cancelRequestId;
}
public void setCancelRequestId(Integer cancelRequestId) {
this.cancelRequestId = cancelRequestId;
}
}

View File

@@ -37,6 +37,7 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
super();
// TODO Auto-generated constructor stub
}
private String indexTable="ip_port_cfg";
/**
* ip类型
*/
@@ -307,5 +308,11 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
public void setNtcSubscribeIdCfg(NtcSubscribeIdCfg ntcsSubscribeIdCfg) {
this.ntcSubscribeIdCfg = ntcsSubscribeIdCfg;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -28,6 +28,7 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
*/
private static final long serialVersionUID = 2796500715438264119L;
private static final String tableName="cfg_index_info";
private String indexTable="cfg_index_info";
private List<AvVoipAccountCfg> voipAccounts;//Add表单使用
private List<AsnIpCfg> asnIpCfgs;//Add表单使用
private List<AvVoipIpCfg> voipIps; //Add表单使用
@@ -308,4 +309,11 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public static String getTablename() {
return tableName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -22,6 +22,7 @@ public class DdosIpCfg extends BaseIpCfg {
*
*/
private static final long serialVersionUID = -5446903784736960824L;
private String indexTable="ddos_ip_cfg";
@ExcelField(title="antiddos_protocol",sort=41)
private String antiddosProtocol;//目前支持TCP_SYN, DNS, NTP
@ExcelField(title="bps_threadshold",sort=42)
@@ -47,6 +48,12 @@ public class DdosIpCfg extends BaseIpCfg {
public void setPpsThreadshold(Long ppsThreadshold) {
this.ppsThreadshold = ppsThreadshold;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -26,6 +26,7 @@ public class DnsIpCfg extends BaseIpCfg {
*
*/
private static final long serialVersionUID = 8149437730819674317L;
private String indexTable="dns_ip_cfg";
private String dnsStrategyName;
private Integer dnsStrategyId;
@@ -41,5 +42,11 @@ public class DnsIpCfg extends BaseIpCfg {
public void setDnsStrategyName(String dnsStrategyName) {
this.dnsStrategyName = dnsStrategyName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -12,6 +12,7 @@ public class DnsResStrategy extends BaseCfg<DnsResStrategy> {
*
*/
private static final long serialVersionUID = -2720862431960415564L;
private String indexTable="dns_res_strategy";
private Integer resGroup1Id;
private Integer resGroup1Num;
private Integer resGroup2Id;
@@ -114,4 +115,11 @@ public class DnsResStrategy extends BaseCfg<DnsResStrategy> {
public void setGroup1Name(String group1Name) {
this.group1Name = group1Name;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -28,6 +28,7 @@ public class FileDigestCfg extends BaseCfg<FileDigestCfg> {
*/
private static final long serialVersionUID = 2796500715438264119L;
private static final String tableName="file_digest_cfg";
private String indexTable="file_digest_cfg";
@ExcelField(title="raw_len",sort=3)
private Long rawLen;
@ExcelField(title="digest",sort=2)
@@ -82,5 +83,11 @@ public class FileDigestCfg extends BaseCfg<FileDigestCfg> {
public void setNtcSubscribeIdCfgList(List<NtcSubscribeIdCfg> ntcSubscribeIdCfgList) {
this.ntcSubscribeIdCfgList = ntcSubscribeIdCfgList;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -17,6 +17,7 @@ public class IpMultiplexPoolCfg extends BaseCfg<IpMultiplexPoolCfg> {
*
*/
private static final long serialVersionUID = -5902468971425910528L;
private String indexTable="ip_multiplex_pool_cfg";
@Expose
@SerializedName("cfgId")
private Integer compileId;
@@ -102,5 +103,11 @@ public class IpMultiplexPoolCfg extends BaseCfg<IpMultiplexPoolCfg> {
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -17,6 +17,7 @@ package com.nis.domain.configuration;
*/
public class IpPortCfg extends BaseIpCfg {
private static final String tableName="ip_port_cfg";
private String indexTable="ip_port_cfg";
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
@@ -53,6 +54,12 @@ public class IpPortCfg extends BaseIpCfg {
public static String getTablename() {
return tableName;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -13,7 +13,7 @@ public class PxyObjKeyring extends BaseCfg<PxyObjKeyring> {
*
*/
private static final long serialVersionUID = -2720862431960415564L;
private String indexTable="pxy_obj_keyring";
private String keyringType;
private String privateKeyFile;
private String publicKeyFile;
@@ -84,6 +84,12 @@ public class PxyObjKeyring extends BaseCfg<PxyObjKeyring> {
public void setSubject(String subject) {
this.subject = subject;
}
public String getIndexTable() {
return indexTable;
}
public void setIndexTable(String indexTable) {
this.indexTable = indexTable;
}
}

View File

@@ -18,7 +18,6 @@ public class ComplexStringAllTemplate {
private String district;
private String cfgKeywords;
private Integer exprType ;
private Integer matchMethod ;
private Integer isHex;
private Integer isCaseInsenstive;
@@ -44,13 +43,6 @@ public class ComplexStringAllTemplate {
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=13)
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=14)
public Integer getMatchMethod() {
return matchMethod;

View File

@@ -17,7 +17,6 @@ public class StringAllTemplate {
private String cfgDesc;
private String cfgKeywords;
private Integer exprType ;
private Integer matchMethod ;
private Integer isHex;
private Integer isCaseInsenstive;
@@ -36,13 +35,6 @@ public class StringAllTemplate {
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=12)
public Integer getExprType() {
return exprType;
}
public void setExprType(Integer exprType) {
this.exprType = exprType;
}
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=13)
public Integer getMatchMethod() {
return matchMethod;

View File

@@ -22,7 +22,7 @@ public final class Constants {
* iP默认值
*/
public static String IPV4_DEFAULT_IP_VALUE=Configurations.getStringProperty("ipv4_default_ip_value", "0.0.0.0");
public static String IPV6_DEFAULT_IP_VALUE=Configurations.getStringProperty("ipv4_default_ip_value", "::");
public static String IPV6_DEFAULT_IP_VALUE=Configurations.getStringProperty("ipv6_default_ip_value", "::");
public static String IPV4_DEFAULT_IP_SUBNET_VALUE=Configurations.getStringProperty("ipv4_default_ip_subnet_value", "0.0.0.0/32");
public static String IPV6_DEFAULT_IP_SUBNET_VALUE=Configurations.getStringProperty("ipv6_default_ip_subnet_value", "::/128");
public static String IPV4_DEFAULT_IP_RANGE_VALUE=Configurations.getStringProperty("ipv4_default_ip_range_value", "0.0.0.0-0.0.0.0");

View File

@@ -174,10 +174,10 @@ public class ExportExcel {
if(interceptReplaceZone !=null && interceptReplaceZone.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : interceptReplaceZone) {
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+sysDataDictionaryItem.getItemValue()+"\n";
index++;
}else{
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
index++;
}
}
@@ -203,7 +203,7 @@ public class ExportExcel {
commentStr="";
}else{
for (DnsResStrategy dnsResStrategy : resStrategys) {
commentStr=commentStr+dnsResStrategy.getCfgId()+":"+dnsResStrategy.getCfgDesc()+"\n";
commentStr=commentStr+dnsResStrategy.getCfgId()+""+dnsResStrategy.getCfgDesc()+"\n";
index++;
}
}
@@ -239,11 +239,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
index++;
}
}
@@ -253,11 +253,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
index++;
}
}
@@ -269,13 +269,10 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
index++;
/**TODO
规则:
index++;
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
1、源ip和目的ip不能相等
index++;
@@ -288,6 +285,37 @@ public class ExportExcel {
5、IPv6 Mask 掩码范围2-128
index++;
*/
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、源IP和目的IP不能相同
commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same")
, msgProp.getProperty("clientip")
,msgProp.getProperty("serverip"))+"\n";
index++;
index++;
//2、源IP和目的IP IP类型和IP格式必须一致
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
index++;
index++;
//3、IP Range 开始IP和结束IP必须在同一网段
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
//4、IP Range 开始IP必须小于结束IP
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n";
index++;
index++;
//5、IPv4 Mask 掩码范围16-32
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
index++;
//6、IPv6 Mask 掩码范围2-128
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n";
index++;
index++;
}
}
@@ -300,11 +328,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_mask")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
index++;
}
}
@@ -314,11 +342,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
index++;
}
}
@@ -330,22 +358,37 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
/**TODO
规则:
index++;
1、源ip和目的ip不能相等
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
2、源ip和目的ip格式必须一致
//1、源IP和目的IP不能相同
commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same")
, msgProp.getProperty("clientip")
,msgProp.getProperty("serverip"))+"\n";
index++;
3、IPv4 Range 必须是C段IP
index++;
4、IPv4 Mask 掩码范围16-32
//2、源IP和目的IP IP类型和IP格式必须一致
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
index++;
index++;
//3、IP Range 开始IP和结束IP必须在同一网段
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
//4、IP Range 开始IP必须小于结束IP
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n";
index++;
index++;
//5、IPv4 Mask 掩码范围16-32
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
index++;
//6、IPv6 Mask 掩码范围2-128
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n";
index++;
5、IPv6 Mask 掩码范围2-128
index++;
*/
}
}
if("client_port".equals(headerStr)){
@@ -356,7 +399,7 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_subnet")+""+"\n";
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
index++;
}
}else{
@@ -367,20 +410,23 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
/**TODO
规则:
index++;
1、源端口和目的端口格式必须一致
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
2、端口范围0-65535
//1、源端口、目的端口格式必须一致
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
3、端口掩码范围0-65535
index++;
4、非TCP、UDP、ALL协议端口必须为0
//2、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
index++;
//2、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n";
index++;
index++;
*/
}
}
if("server_port".equals(headerStr)){
@@ -391,25 +437,32 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_subnet")+""+"\n";
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
index++;
}
}else{
headerStr="";
commentStr="";
}
/**TODO
规则:
index++;
1、源端口和目的端口格式必须一致
index++;
2、端口范围0-65535
index++;
3、端口掩码范围0-65535
index++;
4、非TCP、UDP、ALL协议端口必须为0
index++;
*/
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
index++;
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n";
index++;
index++;
}
}
}
//导入的Protocol
@@ -418,15 +471,20 @@ public class ExportExcel {
commentStr="";
//ip block tcp
if(service.getAction().equals(16) ){
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
/**
*block 只有TCP不需要导入
* */
headerStr="";
commentStr="";
/*List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
if(sysDataDictionaryItem.getItemCode().equals(6)){
if(sysDataDictionaryItem.getItemCode().equals("6")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+sysDataDictionaryItem.getItemValue()+""+"\n";
index++;
}
}
}
}*/
}else{
commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
@@ -468,7 +526,8 @@ public class ExportExcel {
}
}
}
if(StringUtil.isEmpty(commentStr)){
if(StringUtil.isEmpty(commentStr)
||(region.getConfigProtocol().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -479,7 +538,8 @@ public class ExportExcel {
//Direction
if("direction".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDirection())){
if(StringUtil.isEmpty(region.getConfigDirection())
||(region.getConfigDirection().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -515,12 +575,16 @@ public class ExportExcel {
}else if(region.getRegionType().equals(2) || region.getRegionType().equals(3)){
if(region.getRegionType().equals(3)){
if("district".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDistrict())){
if(StringUtil.isEmpty(region.getConfigDistrict())
||(region.getConfigDistrict().split(",").length==1)){
headerStr="";
commentStr="";
}else{
commentStr=region.getConfigDistrict();
index++;
for (String districtStr : region.getConfigDistrict().split(",")) {
commentStr=commentStr+districtStr+"\n";
index++;
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
@@ -532,8 +596,39 @@ public class ExportExcel {
}
}
//expr type
if("key_word".equals(headerStr)){
if(!StringUtil.isEmpty(region.getConfigMultiKeywords())){
if(region.getConfigMultiKeywords().equals(1)){//多关键字输入TODO
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//允许输入多关键字,多个关键字用换行表示
commentStr=commentStr+""+msgProp.getProperty("multi_keywords_tip")+"\n";
index++;
index++;
//单个关键字不允许输入不可见字符
commentStr=commentStr+""+msgProp.getProperty("visible_keyword_tip")+"\n";
index++;
index++;
}else{
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
index++;
//只允许输入单个关键字
commentStr=commentStr+""+msgProp.getProperty("single_keyword_tip")+"\n";
index++;
index++;
//单个关键字不允许输入不可见字符
commentStr=commentStr+""+msgProp.getProperty("visible_keyword_tip")+"\n";
index++;
}
}
}
//expr type
if("expression_type".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigExprType())){
if(StringUtil.isEmpty(region.getConfigExprType())
||(region.getConfigExprType().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -562,7 +657,8 @@ public class ExportExcel {
}
//match method
if("match_method".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigMatchMethod())){
if(StringUtil.isEmpty(region.getConfigMatchMethod())
||(region.getConfigMatchMethod().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -591,6 +687,7 @@ public class ExportExcel {
}
//ishex
if("is_hex".equals(headerStr)){
List<String> list=new ArrayList<String>();
if(StringUtil.isEmpty(region.getConfigHex())){
headerStr="";
commentStr="";
@@ -602,14 +699,22 @@ public class ExportExcel {
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
if(sysDataDictionaryItem.getItemCode().equals("1")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
list.add(sysDataDictionaryItem.getItemCode());
index++;
}
if(region.getConfigHex().split(",").length>1){
if(sysDataDictionaryItem.getItemCode().equals("0")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
list.add(sysDataDictionaryItem.getItemCode());
index++;
}
}
}
}
if(!((","+region.getConfigHex()+",").indexOf(",1,") >-1)){
}else{
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
if(sysDataDictionaryItem.getItemCode().equals("0")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
list.add(sysDataDictionaryItem.getItemCode());
index++;
}
}
@@ -617,7 +722,7 @@ public class ExportExcel {
}
}
if(StringUtil.isEmpty(commentStr)){
if(StringUtil.isEmpty(commentStr) || (!StringUtil.isEmpty(list) && list.size()==1)){
headerStr="";
commentStr="";
}else{
@@ -626,6 +731,7 @@ public class ExportExcel {
}
}
if("is_case_insenstive".equals(headerStr)){
List<String> list=new ArrayList<String>();
if(StringUtil.isEmpty(region.getConfigHex())){
headerStr="";
commentStr="";
@@ -633,17 +739,22 @@ public class ExportExcel {
commentStr="";
List<SysDataDictionaryItem> isCaseSenstive=DictUtils.getDictList("CASE_INSENSTIVE");
if(isCaseSenstive !=null && isCaseSenstive.size()>0){
if(((","+region.getConfigHex()+",").indexOf(",2,") >-1)){
if(((","+region.getConfigHex()+",").indexOf(",0,") >-1)){
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
if(sysDataDictionaryItem.getItemCode().equals("1")){
if(sysDataDictionaryItem.getItemCode().equals("0")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
index++;
}
if(region.getConfigHex().split(",").length>1){
if(sysDataDictionaryItem.getItemCode().equals("1")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
index++;
}
}
}
}
if(!((","+region.getConfigHex()+",").indexOf(",2,") >-1)){
}else{
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
if(sysDataDictionaryItem.getItemCode().equals("0")){
if(sysDataDictionaryItem.getItemCode().equals("1")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
index++;
}
@@ -652,7 +763,7 @@ public class ExportExcel {
}
}
if(StringUtil.isEmpty(commentStr)){
if(StringUtil.isEmpty(commentStr) || (!StringUtil.isEmpty(list) && list.size()==1)){
headerStr="";
commentStr="";
}else{

View File

@@ -1097,8 +1097,16 @@ public class BaseController {
if(serviceDict.getFunctionId().intValue()==5&&serviceDict.getAction().intValue()==64) {
String userRegion1=baseIpCfg.getUserRegion1();
try {
Double ratelimt= Double.parseDouble(userRegion1);
if(ratelimt>0.009||ratelimt<0.001) {
// Double ratelimt= Double.parseDouble(userRegion1);
List<SysDataDictionaryItem> ratelimtList=DictUtils.getDictList("RATE_LIMIT");
boolean has=false;
for(SysDataDictionaryItem ratelimit:ratelimtList) {
if(ratelimit.getItemCode().equals(userRegion1)) {
has=true;
break;
}
}
if(!has) {
errInfo.append(prop.getProperty("ratelimit")+"."+String.format(prop.getProperty("must_between"),0.001,0.009)+";");
}
} catch (Exception e) {
@@ -1142,7 +1150,7 @@ public class BaseController {
}
if (regionDict.getRegionType().equals(1)) {
// 校验必填的IP端口
for (String code : configIpPortShow.split(",")) {
/*for (String code : configIpPortShow.split(",")) {
if ("1".equals(code)) {// 源IP
if (StringUtil.isEmpty(baseIpCfg.getSrcIpAddress())) {
errInfo.append(String.format(prop.getProperty("can_not_null"),
@@ -1164,48 +1172,58 @@ public class BaseController {
prop.getProperty("server_port", "Server Port")) + ";");
}
}
}
}*/
boolean srcIpEmpty = false;
boolean destIpEmpty = false;
boolean srcPortEmpty = false;
boolean destPortEmpty = false;
if (StringUtil.isEmpty(baseIpCfg.getSrcIpAddress())) {
srcIpEmpty = true;
}
if (StringUtil.isEmpty(baseIpCfg.getDestIpAddress())) {
if (srcIpEmpty) {// 全部为空,填值
if (canIPv4 && canIPFormat) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
baseIpCfg.setIpType(4);
baseIpCfg.setIpPattern(3);
} else if (canIPv6 && canIPFormat) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
baseIpCfg.setIpType(6);
baseIpCfg.setIpPattern(3);
} else if (canIPv4 && canIPSubnetFormat) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpType(4);
baseIpCfg.setIpPattern(3);
} else if (canIPv6 && canIPSubnetFormat) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpType(6);
baseIpCfg.setIpPattern(3);
} else if (canIPv4 && canIPRangeFormat) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpType(4);
baseIpCfg.setIpPattern(3);
} else if (canIPv6 && canIPRangeFormat) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpType(6);
baseIpCfg.setIpPattern(3);
}
} else {
// 目的IP为空
destIpEmpty = true;
}
if (StringUtil.isEmpty(baseIpCfg.getSrcPort())) {
srcPortEmpty = true;
}
if (StringUtil.isEmpty(baseIpCfg.getDestPort())) {
destPortEmpty = true;
}
if(srcIpEmpty&&destIpEmpty) {
if(configIpPortShow.indexOf("1")>-1&&configIpPortShow.indexOf("3")>-1) {
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("client_ip", "Client IP")) + ";");
}else if(configIpPortShow.indexOf("1")>-1) {
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("client_ip", "Client IP")) + ";");
}else if(configIpPortShow.indexOf("3")>-1) {
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("server_ip", "Server IP")) + ";");
}
}else if (destIpEmpty) {// 目的IP为空
if(configIpPortShow.indexOf("3")>-1&&configIpPortShow.indexOf("1")==-1) {//目的IP必填
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("server_ip", "Server IP")) + ";");
}else if(configIpPortShow.indexOf("1")>-1){
/*if(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getSrcIpAddress())) {
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"'")+";");
}else if(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getSrcIpAddress())) {
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"'")+";");
}else if(Constants.IPV6_DEFAULT_IP_VALUE.equals(baseIpCfg.getSrcIpAddress())) {
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV6_DEFAULT_IP_VALUE+"'")+";");
}else if(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getSrcIpAddress())) {
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"'")+";");
}else if(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getSrcIpAddress())) {
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"'")+";");
}else if(Constants.IPV4_DEFAULT_IP_VALUE.equals(baseIpCfg.getSrcIpAddress())) {
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV4_DEFAULT_IP_VALUE+"'")+";");
}*/
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(),
ipType, ipPattern);
if (matchType.startsWith("IPV6")) {
@@ -1215,8 +1233,8 @@ public class BaseController {
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("client_ip") + String.format("can_not_be",
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0]));
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
@@ -1224,8 +1242,8 @@ public class BaseController {
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(prop.getProperty("client_ip") + String.format("can_not_be",
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0]));
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";");
}
} else {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
@@ -1233,7 +1251,7 @@ public class BaseController {
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("client_ip")
+ String.format("can_not_be", Constants.IPV6_DEFAULT_IP_VALUE));
+ String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)+";");
}
}
baseIpCfg.setIpType(6);
@@ -1245,8 +1263,8 @@ public class BaseController {
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("client_ip") + String.format("can_not_be",
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0]));
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
@@ -1254,8 +1272,8 @@ public class BaseController {
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(prop.getProperty("client_ip") + String.format("can_not_be",
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0]));
errInfo.append(prop.getProperty("client_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";");
}
} else {
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
@@ -1263,14 +1281,37 @@ public class BaseController {
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("client_ip")
+ String.format("can_not_be", Constants.IPV4_DEFAULT_IP_VALUE));
+ String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)+";");
}
}
baseIpCfg.setIpType(4);
}
}
} else {
if (srcIpEmpty) {// 源IP为空
} else if (srcIpEmpty) {// 源IP为空
if(configIpPortShow.indexOf("1")>-1&&configIpPortShow.indexOf("3")==-1) {//源IP必填
errInfo.append(String.format(prop.getProperty("can_not_null"),
prop.getProperty("client_ip", "Client IP")) + ";");
}else if(configIpPortShow.indexOf("3")>-1){
/*if(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"'")+";");
}else if(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"'")+";");
}else if(Constants.IPV6_DEFAULT_IP_VALUE.equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV6_DEFAULT_IP_VALUE+"'")+";");
}else if(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"'")+";");
}else if(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"'")+";");
}else if(Constants.IPV4_DEFAULT_IP_VALUE.equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
"'"+Constants.IPV4_DEFAULT_IP_VALUE+"'")+";");
}*/
String matchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(),
ipType, ipPattern);
if (matchType.startsWith("IPV6")) {
@@ -1280,8 +1321,8 @@ public class BaseController {
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("server_ip") + String.format("can_not_be",
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0]));
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
@@ -1289,8 +1330,8 @@ public class BaseController {
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(prop.getProperty("server_ip") + String.format("can_not_be",
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0]));
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";");
}
} else {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
@@ -1298,7 +1339,7 @@ public class BaseController {
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("server_ip")
+ String.format("can_not_be", Constants.IPV6_DEFAULT_IP_VALUE));
+ String.format(prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE)+";");
}
}
baseIpCfg.setIpType(6);
@@ -1312,8 +1353,8 @@ public class BaseController {
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("server_ip") + String.format("can_not_be",
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0]));
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])+";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
@@ -1321,8 +1362,8 @@ public class BaseController {
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(prop.getProperty("server_ip") + String.format("can_not_be",
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0]));
errInfo.append(prop.getProperty("server_ip") + String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])+";");
}
} else {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
@@ -1330,65 +1371,61 @@ public class BaseController {
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("server_ip")
+ String.format("can_not_be", Constants.IPV4_DEFAULT_IP_VALUE));
+ String.format(prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE)+";");
}
}
baseIpCfg.setIpType(4);
}
}
} else {//全不为空
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(),
ipType, ipPattern);
String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(),
ipType, ipPattern);
if (StringUtils.isNotBlank(matchType)&&StringUtils.isNotBlank(matchType1)&&
!matchType.equals(matchType1)) {
errInfo.append(prop.get("the_same_ip_type_pattern") + ";");
}
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if (matchType.startsWith("IPV6")) {
baseIpCfg.setIpType(6);
} else {
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(),
ipType, ipPattern);
String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(),
ipType, ipPattern);
if (StringUtils.isNotBlank(matchType)&&StringUtils.isNotBlank(matchType1)&&
!matchType.equals(matchType1)) {
errInfo.append(prop.get("the_same_ip_type_pattern") + ";");
baseIpCfg.setIpType(4);
}
if (matchType.endsWith("RANGE")) {
if (matchType.startsWith("IPV4")) {
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
}
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if (matchType.startsWith("IPV6")) {
baseIpCfg.setIpType(6);
} else {
baseIpCfg.setIpType(4);
}
if (matchType.endsWith("RANGE")) {
if (matchType.startsWith("IPV4")) {
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
}
if (baseIpCfg.getSrcIpAddress().split("-")[0]
.equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("-")[0],
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
}
baseIpCfg.setIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
if (baseIpCfg.getSrcIpAddress().split("/")[0]
.equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("/")[0],
baseIpCfg.getDestIpAddress().split("/")[0]) + ";");
}
baseIpCfg.setIpPattern(1);
} else {
if (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
prop.getProperty("client_ip"), prop.getProperty("server_ip")) + ";");
}
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().split("-")[0]
.equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("-")[0],
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
}
baseIpCfg.setIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
if (baseIpCfg.getSrcIpAddress().split("/")[0]
.equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("/")[0],
baseIpCfg.getDestIpAddress().split("/")[0]) + ";");
}
baseIpCfg.setIpPattern(1);
} else {
if (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
prop.getProperty("client_ip"), prop.getProperty("server_ip")) + ";");
}
baseIpCfg.setIpPattern(3);
}
}
// TODO 判断源IP和目的IP的值
// TODO 判断源IP和目的IP格式
if (StringUtil.isEmpty(baseIpCfg.getSrcPort())) {
srcPortEmpty = true;
}
if (StringUtil.isEmpty(baseIpCfg.getDestPort())) {
if (destPortEmpty) {
if (srcPortEmpty) {
baseIpCfg.setSrcPort("0");
baseIpCfg.setDestPort("0");

View File

@@ -3,6 +3,8 @@ package com.nis.web.controller.basics;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -15,7 +17,9 @@ import org.apache.zookeeper.ZooDefs.Ids;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
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;
@@ -24,6 +28,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.RequestInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigDictUtils;
import com.nis.util.Configurations;
import com.nis.util.StringUtil;
@@ -46,6 +52,63 @@ public class ServiceDictInfoController extends BaseController {
}
@RequestMapping(value="requestSelectInfo")
public String requestSelectInfo(Model model){
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
model.addAttribute("requestInfos", requestInfos);
return "/basics/requestSelectInfo";
}
@ResponseBody
@RequestMapping(value="requestCancleInfoAjax", method = RequestMethod.POST)
public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable){
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
for(String id :idArray){
try {
serviceDictInfoService.auditCancleRequestInfo(cancelRequestId,indexTable,id);
} catch (Exception e) {
e.printStackTrace();
logger.error("审核添加取消来函信息失败",e);
return "false";
}
}
}
return "true";
}
/**
*
* 根据id获取取消审核时的来函号信息
* @param ids
* @param indexTable
* @return
*/
@ResponseBody
@RequestMapping(value="requestCancleInfoNumber")
public Map requestCancleInfoNumber(String ids,String indexTable){
List list = new ArrayList();
String requestTitle="";
Map map=new HashMap();
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
// for(String id :idArray){
try {
Integer cancelRequestId= serviceDictInfoService.requestCancleInfoNumber(indexTable.trim(),Long.parseLong(ids));
if(cancelRequestId!=null) {
requestTitle = requestInfoService.getRequestTitleById(cancelRequestId.longValue());
if(StringUtils.isBlank(requestTitle)) {
return map;
}
}
} catch (Exception e) {
e.printStackTrace();
logger.error("查询取消审核来函信息失败",e);
return map;
}
// }
}
map.put("requestTitle", requestTitle);
return map;
}
/**
* 查询业务辅助表-业务字典信息列表(无条件分页查询)

View File

@@ -144,6 +144,8 @@ public class IpMultiplexController extends CommonController {
@RequestMapping(value = {"/saveOrUpdateSnat"})
public String saveOrUpdateSnat(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
// 设置生效区域信息
groupAreaService.setAreaEffective(cfg);
this._saveOrUpdateIp(cfgName,model, cfg);
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
}
@@ -191,6 +193,8 @@ public class IpMultiplexController extends CommonController {
@RequestMapping(value = {"/saveOrUpdateDnat"})
public String saveOrUpdateDnat(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
// 设置生效区域信息
groupAreaService.setAreaCodeByGroupId(cfg);
this._saveOrUpdateIp(cfgName,model, cfg);
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
}

View File

@@ -76,6 +76,9 @@ public interface ServiceDictInfoDao extends CrudDao<ServiceDictInfo> {
List<ServiceDictInfo> findItemDict(@Param("itemType")int itemType,@Param("isValid")int isValid,@Param("isLeaf")Integer isLeaf);
List<ServiceDictInfo> findAllItemDictByItemType(@Param("itemType")int itemType,@Param("isLeaf")Integer isLeaf);
void auditCancleRequestInfo(@Param("cancelRequestId")Integer cancelRequestId, @Param("indexTable")String indexTable,@Param("id") String id);
Integer requestCancleInfoNumber(@Param("indexTable")String indexTable,@Param("id")Long id);

View File

@@ -306,9 +306,12 @@
<sql id="menuJoins">
LEFT JOIN service_dict_info p ON p.service_dict_id = s.parent_id
</sql>
<update id="auditCancleRequestInfo">
UPDATE ${indexTable} SET cancel_request_id = #{cancelRequestId} WHERE cfg_id = #{id}
</update>
<select id="requestCancleInfoNumber" resultType="Integer">
select cancel_request_id cancelRequestId from ${indexTable} where cfg_id = #{id}
</select>
</mapper>

View File

@@ -17,6 +17,6 @@ public interface IpMultiplexPoolCfgDao extends CrudDao<IpMultiplexPoolCfg> {
IpMultiplexPoolCfg getCfgInfo(IpMultiplexPoolCfg cfg);
String getIspByGroupId(Integer groupId);
List<IpMultiplexPoolCfg> getIspByGroupId(Integer groupId);
}

View File

@@ -328,13 +328,13 @@
</trim>
</select>
<select id="getIspByGroupId" resultType="java.lang.String">
<select id="getIspByGroupId" resultMap="IpMultiplexPoolCfgMap">
SELECT
area_effective_ids
<include refid="IpMultiplexPoolCfgColumns"/>
FROM
ip_multiplex_pool_cfg
ip_multiplex_pool_cfg r
WHERE
policy_group = #{groupId} AND is_valid != -1
r.POLICY_GROUP = #{groupId} AND r.IS_VALID != -1
</select>
</mapper>

View File

@@ -24,6 +24,8 @@ public interface RequestInfoDao extends CrudDao {
List<TaskInfo> showTask(TaskInfo taskInfo);
void delete(@Param("id") Long id);
String getRequestTitleById(@Param("id")Long id);
}

View File

@@ -217,4 +217,8 @@
<include refid="Base_Column_List" />
from request_info
</select>
<select id="getRequestTitleById" resultType="string">
select request_title requestTitle from request_info where id=#{id}
</select>
</mapper>

View File

@@ -300,6 +300,23 @@ public class ServiceDictInfoService extends BaseService{
public List<ServiceDictInfo> findAllLableDict() {
return serviceDictInfoDao.findAllItemDictByItemType(Constants.ITEM_TYPE_LABEL,null);
}
/**
*
* 取消审核的时候增加取消来函
* @param cancelRequestId
* @param indexTable
* @param id
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void auditCancleRequestInfo(Integer cancelRequestId, String indexTable, String id) {
serviceDictInfoDao.auditCancleRequestInfo(cancelRequestId, indexTable, id);
}
public Integer requestCancleInfoNumber(String indexTable, Long id) {
Integer cancleRequestId = serviceDictInfoDao.requestCancleInfoNumber( indexTable, id);
return cancleRequestId;
}

View File

@@ -85,21 +85,49 @@ public class GroupAreaService extends BaseService{
return policyGroups;
}
// SNAT策略 组织生效区域信息
public void setAreaCodeByGroupId(IpPortCfg cfg){
Integer areaCode = groupAreaDao.getAreaCodeByGroupId(cfg.getDnsStrategyId());
cfg.setAreaEffectiveIds(areaCode+"");
}
// snat策略 设置生效区域信息
public void setAreaEffective(IpPortCfg cfg) {
String areaEffectiveIds = "";
if(cfg.getDnsStrategyId() != 0){// 已选择分组
// 1.获取该分组的省份信息
Integer areaCode = groupAreaDao.getAreaCodeByGroupId(cfg.getDnsStrategyId());
// 1.设置省份信息
this.setAreaCodeByGroupId(cfg);
areaEffectiveIds = cfg.getAreaEffectiveIds();
// 2.获取该分组下的IP复用地址池配置的ISP
IpMultiplexPoolCfgService poolCfgService = SpringContextHolder.getBean(IpMultiplexPoolCfgService.class);
String ispInfo = poolCfgService.getIspByGroupId(cfg.getDnsStrategyId());
if(ispInfo.indexOf(":") != -1){
ispInfo = ispInfo.substring(ispInfo.indexOf(":"));
List<IpMultiplexPoolCfg> cfgsList = poolCfgService.getIspByGroupId(cfg.getDnsStrategyId());
String newAreaEffectiveIds = "";
List<String> ispList = new ArrayList<>();
if(cfgsList.size() != 0){
for (IpMultiplexPoolCfg poolCfg : cfgsList) {
String areaIsp = poolCfg.getAreaEffectiveIds();
if(areaIsp.contains(":")){
areaIsp = areaIsp.substring(areaIsp.indexOf(":")+1);
}
ispList.add(areaIsp);
}
}
areaEffectiveIds = areaCode + ispInfo;
// 3.组织格式
if(ispList.size() != 0){
for (int i = 0; i < ispList.size(); i++) {
if(i < ispList.size()-1){
newAreaEffectiveIds += cfg.getAreaEffectiveIds()+":"+ispList.get(i)+",";
}else{
newAreaEffectiveIds += cfg.getAreaEffectiveIds()+":"+ispList.get(i);
}
}
areaEffectiveIds = newAreaEffectiveIds;
}
}else{
areaEffectiveIds = cfg.getAreaEffectiveIds();
}
cfg.setAreaEffectiveIds(areaEffectiveIds);
}
// IP复用地址池 设置省份信息

View File

@@ -181,7 +181,7 @@ public class IpMultiplexPoolCfgService extends BaseService{
* @param groupId
* @return
*/
public String getIspByGroupId(Integer groupId){
public List<IpMultiplexPoolCfg> getIspByGroupId(Integer groupId){
return ipMultiplexStrategyDao.getIspByGroupId(groupId);
};
}

View File

@@ -118,4 +118,9 @@ public class RequestInfoService extends BaseService{
public List<TaskInfo> showTask(TaskInfo taskInfo) {
return taskInfoDao.findList(taskInfo);
}
public String getRequestTitleById(Long id) {
return requestInfoDao.getRequestTitleById(id);
}
}