Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git
into develop Conflicts: src/main/java/com/nis/domain/configuration/CfgIndexInfo.java src/main/resources/nis.properties src/main/webapp/WEB-INF/tags/sys/delRow.tag asn相关功能更改: IP ADDR:增加asn域 1、新增IP ADDR可选asn,如果asn未下发过(is_used=0),下发时asn的group需要标记为commonGroup(groupId为asn组织的groupId,regionId为asn的regionId)。 2、如果所选的asn组(asn组织的groupId)已经下发过(is_used=1),则下发maat时,asn域不需要下发。 3、策略取消时,如果有需要保留的公共组(commongRroupIds),需要将公共组的组号下发。 ASN GROUP: 1、新增asn,如果此asn的组织groupId已下发过(is_used=1),且此组织的groupId已被策略标记过全选(is_audit_all=1),则需要调用公共组域新增的接口,将新增的asn关键字下发。 2、修改asn,如果此asn的组织groupId已下发过(is_used=1),则需要调用公共组域修改的接口,修改已经下发的asn关键字域。 3、删除asn,如果此asn的组织groupId已下发过(is_used=1),则需要调用公共组域删除的接口,删除已经下发的asn关键字域。 ASN IP CFG: 1、新增asn ip,所选asn no的组首次下发(is_valid=0),需要将asn no的groupId标记为公共组;如果asn no非首次下发(is_valid=1),直接调用公共组新增域的接口。 2、修改 生效状态asn ip修改,调用公共组修改域接口直接修改 3、失效 直接调用公共组删除域接口,失效asn ip域
This commit is contained in:
@@ -130,9 +130,7 @@ public class ExcelCsv {
|
||||
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
|
||||
for (String title : titleList) {
|
||||
String noExportField=noExportMap.get(title);
|
||||
if(noExportField.contains("do_log")){
|
||||
noExportField=",do_blacklist,"+noExportField;
|
||||
}
|
||||
noExportField=",do_blacklist,"+noExportField;
|
||||
List<Object[]> annotationList = Lists.newArrayList();
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
|
||||
@@ -143,6 +143,16 @@ public class ExportExcel {
|
||||
String defaultValue="";
|
||||
int index=0;
|
||||
String[] titleInfo=new String[3];
|
||||
|
||||
// Rule Name
|
||||
if("config_describe".equals(headerStr)) {
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
}
|
||||
|
||||
//p2p_hash_type
|
||||
if("p2p_hash_type".equals(headerStr)){
|
||||
commentStr="";
|
||||
@@ -403,13 +413,17 @@ public class ExportExcel {
|
||||
if("bps_threadshold".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+msgProp.getProperty("input_integer")+"\n";
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("input_integer")+"\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("min_value")+"1000000\n";
|
||||
index++;
|
||||
}
|
||||
if("pps_threadshold".equals(headerStr)){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
commentStr=commentStr+msgProp.getProperty("input_integer")+"\n";
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("input_integer")+"\n";
|
||||
index++;
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("min_value")+"1000\n";
|
||||
index++;
|
||||
}
|
||||
if("group".equals(headerStr)) {
|
||||
@@ -490,6 +504,70 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
|
||||
// doLog
|
||||
if("do_log".equals(headerStr)) {
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_LOG");
|
||||
if(dict !=null && dict.size()>0){
|
||||
if(StringUtil.isEmpty(service.getConfigDoLog())){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
String configDoLog = service.getConfigDoLog();
|
||||
String doLogOption = configDoLog.substring(configDoLog.indexOf(";"), configDoLog.lastIndexOf(";"));
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
if(doLogOption.contains(itemCode)) {
|
||||
commentStr=commentStr+itemCode+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
}
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
if(!StringUtil.isEmpty(defaultValue)){
|
||||
//1、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/** Ip Spoofing **/
|
||||
if("spoofing".equals(headerStr) && (region.getFunctionId().equals(214))){
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("SPOOFING_IP_TYPE");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue=dict.get(0).getItemCode();
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
index++;
|
||||
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
if(!StringUtil.isEmpty(defaultValue)){
|
||||
//1、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if(("With".equals(headerStr)) && (region.getFunctionId().equals(214))){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
}
|
||||
|
||||
if(region.getRegionType().equals(1)){//IP配置
|
||||
//ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction
|
||||
//确定需要导入的srcIp srcPort destIp destPort信息
|
||||
@@ -1035,6 +1113,7 @@ public class ExportExcel {
|
||||
if(StringUtil.isEmpty(defaultValue)){
|
||||
defaultValue="0";
|
||||
}
|
||||
defaultValue = region.getFunctionId().equals(301)?"1":defaultValue;
|
||||
}
|
||||
/*}*/
|
||||
/*if(StringUtil.isEmpty(commentStr)){
|
||||
@@ -1260,7 +1339,11 @@ public class ExportExcel {
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//2、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
|
||||
if(region.getDictId().equals(159)) { // P2P文件标识配置
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":1\n";
|
||||
}else {
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -1290,10 +1373,19 @@ public class ExportExcel {
|
||||
}
|
||||
}else{
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("1")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
list.add(sysDataDictionaryItem.getItemCode());
|
||||
index++;
|
||||
if(region.getDictId().equals(159)) { // P2P文件标识配置
|
||||
if(sysDataDictionaryItem.getItemCode().equals("0")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
list.add(sysDataDictionaryItem.getItemCode());
|
||||
index++;
|
||||
}
|
||||
}else {
|
||||
if(sysDataDictionaryItem.getItemCode().equals("1")){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n";
|
||||
list.add(sysDataDictionaryItem.getItemCode());
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2161,8 +2253,8 @@ public class ExportExcel {
|
||||
}
|
||||
}
|
||||
// If is dict, get dict label
|
||||
String valStr=val==null?"":val.toString();
|
||||
if (StringUtils.isNotBlank(ef.dictType())){
|
||||
String valStr=val==null?"":val.toString();
|
||||
if("type".equals(ef.dictType()) || "attribute".equals(ef.dictType())
|
||||
|| "label".equals(ef.dictType())){
|
||||
// Get basic info
|
||||
@@ -2175,6 +2267,16 @@ public class ExportExcel {
|
||||
}
|
||||
|
||||
}
|
||||
if(ef.title().equals("whether_area_block")&&!StringUtil.isEmpty(val)){
|
||||
Integer whetherAreaBlock=Integer.parseInt(valStr);
|
||||
if(whetherAreaBlock.equals(0)){
|
||||
val = msgProp.getProperty("all","all");
|
||||
}else if(whetherAreaBlock.equals(1)){
|
||||
val = msgProp.getProperty("selective","selective");
|
||||
}else{
|
||||
val ="";
|
||||
}
|
||||
}
|
||||
if(ef.title().equals("is_hex") && !StringUtil.isEmpty(val)){
|
||||
Integer isHex=Integer.parseInt(val.toString());
|
||||
if(isHex.equals(0) || isHex.equals(2)){
|
||||
@@ -2350,9 +2452,7 @@ public class ExportExcel {
|
||||
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
|
||||
for (String title : titleList) {
|
||||
String noExportField=noExportMap.get(title);
|
||||
if(noExportField.contains("do_log")){
|
||||
noExportField=",do_blacklist,"+noExportField;
|
||||
}
|
||||
noExportField=",do_blacklist,"+noExportField;
|
||||
List<Object[]> annotationList = Lists.newArrayList();
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
|
||||
@@ -19,6 +19,7 @@ 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.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.util.Constants;
|
||||
@@ -101,7 +102,10 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){
|
||||
errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseStringCfg,errInfo);
|
||||
|
||||
if (regionDict.getRegionType().equals(3)) {
|
||||
if (regionDict.getFunctionId().equals(7)) {
|
||||
Long dnsStrategyId = baseStringCfg.getDnsStrategyId();
|
||||
@@ -438,4 +442,28 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
logger.warn("validate complexString data finish,cost:"+(end-start));
|
||||
return stringList;
|
||||
}
|
||||
|
||||
/**
|
||||
* doLog属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoLog(ComplexkeywordCfg baseStringCfg, StringBuffer errInfo) {
|
||||
|
||||
String configDoLog = serviceDict.getConfigDoLog();
|
||||
if(StringUtils.isNotBlank(configDoLog)) {
|
||||
String defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
String doLogOption = configDoLog.substring(configDoLog.indexOf(";")+1, configDoLog.lastIndexOf(";"));
|
||||
if(baseStringCfg.getDoLog() == null) {
|
||||
baseStringCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}
|
||||
Integer doLog = baseStringCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,14 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
if(regionDict.getFunctionId().equals(200)) {
|
||||
if(!serviceDict.getAction().equals(1)) {
|
||||
baseIpCfg.setDoLog(0);
|
||||
}
|
||||
}
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
|
||||
@@ -97,6 +98,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(200)) {
|
||||
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();
|
||||
@@ -491,4 +500,28 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
logger.warn("validate stringCfg data finish,cost:"+(end-start));
|
||||
return stringList;
|
||||
}
|
||||
|
||||
/**
|
||||
* doLog属性校验
|
||||
* @param baseStringCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoLog(BaseStringCfg baseStringCfg, StringBuffer errInfo) {
|
||||
|
||||
String configDoLog = serviceDict.getConfigDoLog();
|
||||
if(StringUtils.isNotBlank(configDoLog)) {
|
||||
String defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
String doLogOption = configDoLog.substring(configDoLog.indexOf(";")+1, configDoLog.lastIndexOf(";"));
|
||||
if(baseStringCfg.getDoLog() == null) {
|
||||
baseStringCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}
|
||||
Integer doLog = baseStringCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
while(!asnNos.isEmpty()) {
|
||||
asnNos.drainTo(asnNoList,5);
|
||||
for(Long asnNo:asnNoList) {
|
||||
AsnGroupInfo configGroupInfo=AsnCacheUtils.get(asnNo);
|
||||
AsnGroupInfo configGroupInfo=null;//AsnCacheUtils.get(asnNo);
|
||||
if(configGroupInfo==null) {
|
||||
configGroupInfo=new AsnGroupInfo();
|
||||
configGroupInfo.setAsnId(asnNo);
|
||||
@@ -85,7 +85,7 @@ public class DeleteAsnIpTread implements Callable<Throwable> {
|
||||
}
|
||||
sb.deleteCharAt(sb.toString().lastIndexOf(","));
|
||||
asnIpCfgDao.delete(sb.toString());
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(listPage, Constants.VALID_NO);
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(listPage, Constants.VALID_NO,1);
|
||||
transactionManager.commit(status);
|
||||
listPage.clear();
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -112,7 +112,7 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
_cfg.setAsnIpGroup(asnNoMaps.get(1).get(Long.parseLong(_cfg.getUserRegion1())));
|
||||
}else {
|
||||
// ConfigGroupInfo info=asnIpCfgService.getConfigGroupInfoByAsnNo(Long.parseLong(_cfg.getUserRegion1()));
|
||||
AsnGroupInfo info=AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
AsnGroupInfo info=null;//AsnCacheUtils.get(Long.parseLong(_cfg.getUserRegion1()));
|
||||
if(info==null) {
|
||||
info=new AsnGroupInfo();
|
||||
info.setAsnId(Long.parseLong(_cfg.getUserRegion1()));
|
||||
@@ -166,7 +166,7 @@ public class SaveAsnIpThread implements Callable<Throwable>{
|
||||
this.save(cfgs);
|
||||
// splitAndSend(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
if(toAddRegionAsnIpCfgs.size()>0) {
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES);
|
||||
new AsnIpCfgService().asnIPRegionSendToMaat(toAddRegionAsnIpCfgs,Constants.VALID_YES,1);
|
||||
}
|
||||
cfgs.clear();
|
||||
toAddRegionAsnIpCfgs.clear();
|
||||
|
||||
Reference in New Issue
Block a user