IP配置导入调整,协议验证增加隧道协议,IPSEC的特殊验证
This commit is contained in:
@@ -538,13 +538,22 @@ public class BaseController {
|
|||||||
params.put("searchCfgId", entry.getCfgId());
|
params.put("searchCfgId", entry.getCfgId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void checkIpCfg(List<IpCfgTemplate> list) throws ServiceException{
|
public void checkIpCfg(int functionId ,List<IpCfgTemplate> list) throws ServiceException{
|
||||||
Properties prop=this.getMsgProp();
|
Properties prop=this.getMsgProp();
|
||||||
List<SysDataDictionaryItem> ipTypeList = DictUtils.getDictList("IP_TYPE");
|
List<SysDataDictionaryItem> ipTypeList = DictUtils.getDictList("IP_TYPE");
|
||||||
List<SysDataDictionaryItem> ipPatternList = DictUtils.getDictList("IP_PATTERN");
|
List<SysDataDictionaryItem> ipPatternList = DictUtils.getDictList("IP_PATTERN");
|
||||||
List<SysDataDictionaryItem> portPatternList = DictUtils.getDictList("PORT_PATTERN");
|
List<SysDataDictionaryItem> portPatternList = DictUtils.getDictList("PORT_PATTERN");
|
||||||
List<SysDataDictionaryItem> directionList = DictUtils.getDictList("DIRECTION");
|
List<SysDataDictionaryItem> directionList = DictUtils.getDictList("DIRECTION");
|
||||||
List<SysDataDictionaryItem> protocolList = DictUtils.getDictList("PROTOCOL");
|
List<SysDataDictionaryItem> protocolList = DictUtils.getDictList("PROTOCOL");
|
||||||
|
List<SysDataDictionaryItem> ipsecProrocolList = DictUtils.getDictList("IPSEC_PROTOCOL");
|
||||||
|
List<SysDataDictionaryItem> tunnelProrocolList = DictUtils.getDictList("TUNNEL_PROTOCOL");
|
||||||
|
List<SysDataDictionaryItem> specialFunctionIdList = DictUtils.getDictList("SPECIAL_FUNCTION_ID");
|
||||||
|
String specialItem=null;
|
||||||
|
for(SysDataDictionaryItem sfuncItem:specialFunctionIdList){
|
||||||
|
if(functionId==Integer.parseInt(sfuncItem.getItemCode())){
|
||||||
|
specialItem=sfuncItem.getItemValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
StringBuffer msg=new StringBuffer();
|
StringBuffer msg=new StringBuffer();
|
||||||
int line=1;
|
int line=1;
|
||||||
for(IpCfgTemplate value:list){
|
for(IpCfgTemplate value:list){
|
||||||
@@ -660,6 +669,30 @@ public class BaseController {
|
|||||||
Integer protocol= value.getProtocol();
|
Integer protocol= value.getProtocol();
|
||||||
if(protocol==null){
|
if(protocol==null){
|
||||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol"))+";");
|
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol"))+";");
|
||||||
|
}else{
|
||||||
|
if(specialItem!=null&&("ipsec".equals(specialItem)||"tunnel".equals(specialItem))){
|
||||||
|
if("ipsec".equals(specialItem)){
|
||||||
|
boolean has=false;
|
||||||
|
for(SysDataDictionaryItem protocolItem:ipsecProrocolList){
|
||||||
|
if(Integer.parseInt(protocolItem.getItemCode())==protocol.intValue()){
|
||||||
|
has=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!has){
|
||||||
|
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||||
|
}
|
||||||
|
}else if("tunnel".equals(specialItem)){
|
||||||
|
for(SysDataDictionaryItem protocolItem:tunnelProrocolList){
|
||||||
|
if("default".equals(protocolItem.getItemValue())){
|
||||||
|
if(protocol.intValue()!=Integer.parseInt(protocolItem.getItemCode())){
|
||||||
|
errInfo.append(String.format(prop.getProperty("must_be"), prop.getProperty("protocol"),Integer.parseInt(protocolItem.getItemCode()))+";");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
boolean has=false;
|
boolean has=false;
|
||||||
for(SysDataDictionaryItem protocolItem:protocolList){
|
for(SysDataDictionaryItem protocolItem:protocolList){
|
||||||
@@ -672,6 +705,8 @@ public class BaseController {
|
|||||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
//protocol check end
|
//protocol check end
|
||||||
// requestId check start
|
// requestId check start
|
||||||
Integer requestId=value.getRequestId();
|
Integer requestId=value.getRequestId();
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class CommonController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
ImportExcel ei = new ImportExcel(file, 0, 0);
|
ImportExcel ei = new ImportExcel(file, 0, 0);
|
||||||
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
|
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
|
||||||
this.checkIpCfg(list);
|
this.checkIpCfg(ipCfg.getFunctionId(),list);
|
||||||
List<BaseIpCfg> ipList = new ArrayList<>();
|
List<BaseIpCfg> ipList = new ArrayList<>();
|
||||||
Date date=new Date();
|
Date date=new Date();
|
||||||
for(IpCfgTemplate cfg : list){
|
for(IpCfgTemplate cfg : list){
|
||||||
|
|||||||
@@ -721,4 +721,5 @@ must_between=must between %s and %s
|
|||||||
not_number=%s is not a number
|
not_number=%s is not a number
|
||||||
id_not_exists=the id %s of %s is not valid
|
id_not_exists=the id %s of %s is not valid
|
||||||
num_split_by_comma=%s must be numbers split by comma
|
num_split_by_comma=%s must be numbers split by comma
|
||||||
|
must_be=%s must be %s
|
||||||
#=============some validation===========
|
#=============some validation===========
|
||||||
@@ -705,4 +705,5 @@ must_between=must between %s and %s
|
|||||||
not_number=%s is not a number
|
not_number=%s is not a number
|
||||||
id_not_exists=the id %s of %s is not valid
|
id_not_exists=the id %s of %s is not valid
|
||||||
num_split_by_comma=%s must be numbers split by comma
|
num_split_by_comma=%s must be numbers split by comma
|
||||||
|
must_be=%s must be %s
|
||||||
#=============some validation===========
|
#=============some validation===========
|
||||||
@@ -815,4 +815,5 @@ id_not_exists=id\u4E3A%s\u7684%s\u4E0D\u5B58\u5728
|
|||||||
id_not_valid=id\u4E3A%s\u7684%s\u65E0\u6548
|
id_not_valid=id\u4E3A%s\u7684%s\u65E0\u6548
|
||||||
num_split_by_comma=%s\u4E3A\u9017\u53F7\u5206\u9694\u7684\u6570\u5B57
|
num_split_by_comma=%s\u4E3A\u9017\u53F7\u5206\u9694\u7684\u6570\u5B57
|
||||||
no_data=\u65E0\u76F8\u5173\u6570\u636E
|
no_data=\u65E0\u76F8\u5173\u6570\u636E
|
||||||
|
must_be=%s\u7684\u503C\u5FC5\u987B\u4E3A%s
|
||||||
#=============region_value,config form title=================
|
#=============region_value,config form title=================
|
||||||
Reference in New Issue
Block a user