(1)复用类型Ip导入验证修复
(2)隧道类配置IP导入模板修改 (3)IP拦截配置导入模板修改 (4)IPSCIP配置导入验证逻辑修改,当action为drop的时候,输入50或者51,监测的时候为0 (5)IP拦截配置导入模板修改
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class IpAddrTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class IpCfgTemplate {
|
||||
* userRegion1
|
||||
* @return userRegion1
|
||||
*/
|
||||
@ExcelField(title="userregion1",align=2,sort=77)
|
||||
// @ExcelField(title="userregion1",align=2,sort=77)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class IpCfgTemplate {
|
||||
* userRegion2
|
||||
* @return userRegion2
|
||||
*/
|
||||
@ExcelField(title="userregion2",align=2,sort=78)
|
||||
// @ExcelField(title="userregion2",align=2,sort=78)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class IpCfgTemplate {
|
||||
* userRegion3
|
||||
* @return userRegion3
|
||||
*/
|
||||
@ExcelField(title="userregion3",align=2,sort=79)
|
||||
// @ExcelField(title="userregion3",align=2,sort=79)
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class IpCfgTemplate {
|
||||
* userRegion4
|
||||
* @return userRegion4
|
||||
*/
|
||||
@ExcelField(title="userregion4",align=2,sort=80)
|
||||
// @ExcelField(title="userregion4",align=2,sort=80)
|
||||
public String getUserRegion4() {
|
||||
return userRegion4;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class IpCfgTemplate {
|
||||
* userRegion5
|
||||
* @return userRegion5
|
||||
*/
|
||||
@ExcelField(title="userregion5",align=2,sort=81)
|
||||
// @ExcelField(title="userregion5",align=2,sort=81)
|
||||
public String getUserRegion5() {
|
||||
return userRegion5;
|
||||
}
|
||||
|
||||
@@ -43,33 +43,4 @@ public class IpMultiplexPolicyTemplate extends IpCfgTemplate {
|
||||
return super.getDestIpAddress();
|
||||
}
|
||||
|
||||
public String getUserRegion1() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion1();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion2() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion2();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion3() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion3();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion4() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion4();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion5() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion5();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class IpRateLimitTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class IpsecTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class TunnelIpTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getRatelimit() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getProtocol() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,33 +62,4 @@ public class WhiteListIpTemplate extends IpCfgTemplate {
|
||||
return super.getRatelimit();
|
||||
}
|
||||
|
||||
public String getUserRegion1() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion1();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion2() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion2();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion3() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion3();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion4() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion4();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserRegion5() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getUserRegion5();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ public class BaseController {
|
||||
params.put("searchCfgId", entry.getCfgId());
|
||||
}
|
||||
}
|
||||
public void checkIpCfg(int functionId ,List<IpCfgTemplate> list) throws ServiceException{
|
||||
public void checkIpCfg(int action,int functionId ,List<IpCfgTemplate> list) throws ServiceException{
|
||||
Properties prop=this.getMsgProp();
|
||||
List<SysDataDictionaryItem> ipTypeList = DictUtils.getDictList("IP_TYPE");
|
||||
List<SysDataDictionaryItem> ipPatternList = DictUtils.getDictList("IP_PATTERN");
|
||||
@@ -872,15 +872,21 @@ public class BaseController {
|
||||
}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(action==Constants.DROP_ACTION.intValue()) {
|
||||
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(protocol!=0) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}else if("tunnel".equals(specialItem)){
|
||||
for(SysDataDictionaryItem protocolItem:tunnelProrocolList){
|
||||
@@ -1001,7 +1007,7 @@ public class BaseController {
|
||||
}else {
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem irTypeItem:irTypeList){
|
||||
if(Integer.parseInt(irTypeItem.getItemCode())==protocol.intValue()){
|
||||
if(Integer.parseInt(irTypeItem.getItemCode())==irType.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class CommonController extends BaseController {
|
||||
try {
|
||||
ImportExcel ei = new ImportExcel(file, 0, 0);
|
||||
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
|
||||
this.checkIpCfg(ipCfg.getFunctionId(),list);
|
||||
this.checkIpCfg(ipCfg.getAction().intValue(),ipCfg.getFunctionId(),list);
|
||||
List<BaseIpCfg> ipList = new ArrayList<>();
|
||||
Date date=new Date();
|
||||
for(IpCfgTemplate cfg : list){
|
||||
@@ -245,7 +245,7 @@ public class CommonController extends BaseController {
|
||||
try {
|
||||
ImportExcel ei = new ImportExcel(file, 0, 0);
|
||||
List<IpCfgTemplate> list = ei.getDataList(clazz);
|
||||
this.checkIpCfg(ipCfg.getFunctionId(),list);
|
||||
this.checkIpCfg(ipCfg.getAction().intValue(),ipCfg.getFunctionId(),list);
|
||||
List<BaseIpCfg> ipList = new ArrayList<>();
|
||||
Date date=new Date();
|
||||
for(IpCfgTemplate cfg : list){
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
|
||||
/**
|
||||
@@ -114,7 +115,7 @@ public class RatelimitController extends CommonController {
|
||||
@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg);
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpRateLimitTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/manipulation/ratelimit/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:ratelimit");
|
||||
return "redirect:" + adminPath +"/manipulation/ratelimit/ip/list?functionId="+cfg.getFunctionId();
|
||||
@@ -122,7 +123,7 @@ public class RatelimitController extends CommonController {
|
||||
@RequestMapping(value = "/ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpRateLimitTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "/ip/export")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -13,8 +15,14 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.template.IpAddrTemplate;
|
||||
import com.nis.domain.configuration.template.IpsecTemplate;
|
||||
import com.nis.domain.configuration.template.TunnelIpTemplate;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
|
||||
/**
|
||||
@@ -37,6 +45,7 @@ public class IpController extends CommonController{
|
||||
@RequiresPermissions(value={"iplist:config"})
|
||||
public String form(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
this._ipForm(cfgName, model, ids, functionId, entity);
|
||||
model.addAttribute("dropAction",Constants.DROP_ACTION);
|
||||
model.addAttribute("urlPrefix","/ntc/iplist");
|
||||
model.addAttribute("requiresPermissionPrefix","iplist");
|
||||
return "/cfg/common/ipForm";
|
||||
@@ -68,14 +77,44 @@ public class IpController extends CommonController{
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
redirectAttributes.addAttribute("urlPrefix","/ntc/iplist");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","iplist");
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg);
|
||||
List<SysDataDictionaryItem> specialFunctionIdList = DictUtils.getDictList("SPECIAL_FUNCTION_ID");
|
||||
String specialFunctionId=null;
|
||||
for(SysDataDictionaryItem item:specialFunctionIdList) {
|
||||
if(Integer.parseInt(item.getItemCode())==cfg.getFunctionId().intValue()) {
|
||||
specialFunctionId= item.getItemValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(specialFunctionId==null) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpAddrTemplate.class);
|
||||
}else if("tunnel".equals(specialFunctionId)) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,TunnelIpTemplate.class);
|
||||
}else if("ipsec".equals(specialFunctionId)) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpsecTemplate.class);
|
||||
}
|
||||
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
//ip模板下载
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
List<SysDataDictionaryItem> specialFunctionIdList = DictUtils.getDictList("SPECIAL_FUNCTION_ID");
|
||||
String specialFunctionId=null;
|
||||
for(SysDataDictionaryItem item:specialFunctionIdList) {
|
||||
if(Integer.parseInt(item.getItemCode())==functionId.intValue()) {
|
||||
specialFunctionId= item.getItemValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(specialFunctionId==null) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpAddrTemplate.class);
|
||||
}else if("tunnel".equals(specialFunctionId)) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,TunnelIpTemplate.class);
|
||||
}else if("ipsec".equals(specialFunctionId)) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpsecTemplate.class);
|
||||
}
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "export")
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.template.IpAddrTemplate;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
|
||||
/**
|
||||
@@ -104,7 +105,7 @@ public class InterceptController extends CommonController{
|
||||
@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg);
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg,IpAddrTemplate.class);
|
||||
redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+cfg.getFunctionId();
|
||||
@@ -112,7 +113,7 @@ public class InterceptController extends CommonController{
|
||||
@RequestMapping(value = "/ip/import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpAddrTemplate.class);
|
||||
}
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "/ip/export")
|
||||
|
||||
@@ -67,7 +67,6 @@ public class NtcPzReportController extends BaseController{
|
||||
data.put("compileId", compileId.intValue());
|
||||
String json=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, String.valueOf(compileId), String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
|
||||
List<NtcPzReport> list=getList(json);
|
||||
System.out.println("list size "+list.size());
|
||||
if(list!=null&&list.size()>0){
|
||||
data.put("sum",list.get(0).getSum().longValue());
|
||||
}else {
|
||||
|
||||
@@ -46,7 +46,18 @@ $(function(){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if('${specialProtocol}'&&'${specialProtocol}'=='ipsec'){
|
||||
alert(222);
|
||||
$("[name='action']").on("change",function(){
|
||||
if($(this).is(":checked")){
|
||||
if($(this).val()==32){
|
||||
alert(111);
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#ipCfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
@@ -267,4 +278,7 @@ $(function(){
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user