增加区域IP验证处理:由于接口源IP目的IP不能相同,且区域IP只能输入源IP.所以对于IP默认值加入了限制。
This commit is contained in:
@@ -161,15 +161,15 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
ipList.add(ip);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(ipList);
|
||||
logger.info("IP管控下发配置参数:"+json);
|
||||
logger.info("IP配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("IP管控配置下发响应信息:"+result.getMsg());
|
||||
logger.info("IP配置配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("IP管控配置下发失败",e);
|
||||
logger.error("IP配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}else{
|
||||
@@ -199,15 +199,15 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(maatBean);
|
||||
logger.info("IP管控下发配置参数:"+json);
|
||||
logger.info("IP配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("IP管控配置下发响应信息:"+result.getMsg());
|
||||
logger.info("IP配置配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("IP管控配置下发失败",e);
|
||||
logger.error("IP配置配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -222,10 +222,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
//调用服务接口取消配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.put(json, 2);
|
||||
logger.info("IP管控取消配置响应信息:"+result.getMsg());
|
||||
logger.info("IP配置取消配置响应信息:"+result.getMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("IP管控取消配置失败");
|
||||
logger.info("IP配置取消配置失败");
|
||||
throw e;
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -202,7 +202,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("域名白名单配置下发失败");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
maatCfg.setCompileId(cfg.getCompileId());
|
||||
@@ -224,7 +224,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("域名白名单取消配置失败");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("域名配置下发失败");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}else if(cfg.getIsAudit()==3){
|
||||
maatCfg.setCompileId(cfg.getCompileId());
|
||||
@@ -324,7 +324,7 @@ public class StringCfgService extends CrudService<StringCfgDao,BaseStringCfg> {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("域名取消配置失败");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ $(function(){
|
||||
<div class="col-md-6">
|
||||
|
||||
<select id="_areaCfg.ipType" class="show-tick form-control required">
|
||||
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
|
||||
<c:forEach items="${fns:getDictList('AREA_IPTYPE')}" var="ipTypeC">
|
||||
<option value="${ipTypeC.itemCode}" <c:if test="${_areaCfg.ipType==ipTypeC.itemCode || (_areaCfg.ipType==null && ipTypeC.itemCode==4)}">selected</c:if>><spring:message code="${ipTypeC.itemValue}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
@@ -171,7 +171,7 @@ $(function(){
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.srcIpAddress" class="form-control required ipCheck" type="text" value="${_areaCfg.srcIpAddress}">
|
||||
<input id="_areaCfg.srcIpAddress" class="form-control required ipCheck areaIp" type="text" value="${_areaCfg.srcIpAddress}">
|
||||
</div>
|
||||
<div for="_areaCfg.srcIpAddress"></div>
|
||||
</div>
|
||||
@@ -295,7 +295,7 @@ $(function(){
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].srcIpAddress" class="form-control required ipCheck" type="text" value="${areaCfg.srcIpAddress}">
|
||||
<input name="areaCfg[${status.index}].srcIpAddress" class="form-control required ipCheck areaIp" type="text" value="${areaCfg.srcIpAddress}">
|
||||
</div>
|
||||
<div for="areaCfg[${status.index}].srcIpAddress"></div>
|
||||
</div>
|
||||
|
||||
@@ -323,6 +323,58 @@ jQuery.validator.addMethod("areaControl",function(value, element) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
jQuery.validator.addMethod("areaIp",function(value, element) {
|
||||
var typeInt=$(element).parents(".row").parent(".row").find("select[name$='ipType']").val();
|
||||
var ipPattern=$(element).parents(".row").parent(".row").find("select[name$='ipPattern']").val();
|
||||
var msg=$.validator.messages.areaIpPrefix;
|
||||
if(typeInt==4){
|
||||
if(ipPattern==3){
|
||||
if(value=='0.0.0.0'){
|
||||
$.validator.messages.areaIp=msg+'0.0.0.0';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==2){
|
||||
if(value=='0.0.0.0-1.1.1.1'){
|
||||
$.validator.messages.areaIp=msg+'0.0.0.0-1.1.1.1';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==1){
|
||||
if(value=='0.0.0.0/8'){
|
||||
$.validator.messages.areaIp=msg+'0.0.0.0/8';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else if(typeInt==6){
|
||||
if(ipPattern==3){
|
||||
if(value=='::'){
|
||||
$.validator.messages.areaIp=msg+'::';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==2){
|
||||
if(value=='::-::'){
|
||||
$.validator.messages.areaIp=msg+'::-::';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}else if(ipPattern==1){
|
||||
if(value=='::/64'){
|
||||
$.validator.messages.areaIp=msg+'::/64';
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//ip v4转数字
|
||||
var ipToNumber=function (ip){
|
||||
var num =0;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
all: "all",
|
||||
ip_subnet: "Subnet",
|
||||
ip_range: "ip Range",
|
||||
timeout:"timeout"
|
||||
timeout:"timeout",
|
||||
areaIpPrefix:"Forbiden value: "
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
all: "all",
|
||||
ip_subnet: "Subnet",
|
||||
ip_range: "ip Range",
|
||||
timeout:"timeout"
|
||||
timeout:"timeout",
|
||||
areaIpPrefix:"Forbiden value: "
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -50,6 +50,7 @@
|
||||
ip_subnet: "Subnet",
|
||||
ip_subnet: "Subnet",
|
||||
ip_range: "ip Range",
|
||||
timeout:"超时"
|
||||
timeout:"超时",
|
||||
areaIpPrefix:"禁止使用的值: "
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
Reference in New Issue
Block a user