(1)IP类配置增加区域GK逻辑
(2)修复编译ID的重复获取BUG (3)监测类配置目前不提供区域管控逻辑
This commit is contained in:
49
src/main/java/com/nis/domain/configuration/AreaBean.java
Normal file
49
src/main/java/com/nis/domain/configuration/AreaBean.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
*@Title: AreaBean.java
|
||||
*@Package com.nis.domain.configuration
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年4月8日 上午10:06:11
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
/**
|
||||
* @ClassName: AreaBean.java
|
||||
* @Description: TODO
|
||||
* @author (dell)
|
||||
* @date 2018年4月8日 上午10:06:11
|
||||
* @version V1.0
|
||||
*/
|
||||
public class AreaBean {
|
||||
private String area;
|
||||
private String isp;
|
||||
/**
|
||||
* area
|
||||
* @return area
|
||||
*/
|
||||
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
/**
|
||||
* @param area the area to set
|
||||
*/
|
||||
public void setArea(String area) {
|
||||
this.area = area;
|
||||
}
|
||||
/**
|
||||
* isp
|
||||
* @return isp
|
||||
*/
|
||||
|
||||
public String getIsp() {
|
||||
return isp;
|
||||
}
|
||||
/**
|
||||
* @param isp the isp to set
|
||||
*/
|
||||
public void setIsp(String isp) {
|
||||
this.isp = isp;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ package com.nis.domain.configuration;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class AreaIpCfg extends BaseIpCfg {
|
||||
private static final String tableName="area_ip_cfg";
|
||||
private static final String maatTable="DF_IP_RANGE";
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
@@ -54,4 +56,22 @@ public class AreaIpCfg extends BaseIpCfg {
|
||||
this.areaEffectiveIds=null;
|
||||
}
|
||||
|
||||
/**
|
||||
* tablename
|
||||
* @return tablename
|
||||
*/
|
||||
|
||||
public static String getTablename() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* maattable
|
||||
* @return maattable
|
||||
*/
|
||||
|
||||
public static String getMaattable() {
|
||||
return maatTable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@@ -22,6 +23,9 @@ import com.nis.domain.BaseEntity;
|
||||
* @version V1.0
|
||||
*/
|
||||
public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
protected Integer areaType;
|
||||
protected List<AreaBean> areaIsp;
|
||||
protected List<AreaIpCfg> areaCfg;
|
||||
protected String showName;//表在界面上展示的名称
|
||||
protected String seltype;//选中类型,页面搜索用
|
||||
protected String tableName;
|
||||
@@ -672,5 +676,60 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
// TODO Auto-generated method stub
|
||||
return super.clone();
|
||||
}
|
||||
/**
|
||||
* areaCfg
|
||||
* @return areaCfg
|
||||
*/
|
||||
|
||||
public List<AreaIpCfg> getAreaCfg() {
|
||||
return areaCfg;
|
||||
}
|
||||
/**
|
||||
* @param areaCfg the areaCfg to set
|
||||
*/
|
||||
public void setAreaCfg(List<AreaIpCfg> areaCfg) {
|
||||
this.areaCfg = areaCfg;
|
||||
}
|
||||
/**
|
||||
* showName
|
||||
* @return showName
|
||||
*/
|
||||
|
||||
public String getShowName() {
|
||||
return showName;
|
||||
}
|
||||
/**
|
||||
* @param showName the showName to set
|
||||
*/
|
||||
public void setShowName(String showName) {
|
||||
this.showName = showName;
|
||||
}
|
||||
/**
|
||||
* areaIsp
|
||||
* @return areaIsp
|
||||
*/
|
||||
|
||||
public List<AreaBean> getAreaIsp() {
|
||||
return areaIsp;
|
||||
}
|
||||
/**
|
||||
* @param areaIsp the areaIsp to set
|
||||
*/
|
||||
public void setAreaIsp(List<AreaBean> areaIsp) {
|
||||
this.areaIsp = areaIsp;
|
||||
}
|
||||
/**
|
||||
* areaType
|
||||
* @return areaType
|
||||
*/
|
||||
|
||||
public Integer getAreaType() {
|
||||
return areaType;
|
||||
}
|
||||
/**
|
||||
* @param areaType the areaType to set
|
||||
*/
|
||||
public void setAreaType(Integer areaType) {
|
||||
this.areaType = areaType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,15 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static final long serialVersionUID = -1939538118388300002L;
|
||||
|
||||
/**
|
||||
* 创建一个新的实例 BaseIpCfg.
|
||||
*
|
||||
*/
|
||||
public BaseIpCfg() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
/**
|
||||
* ip类型
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,16 @@ import java.util.Date;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
public final class Constants {
|
||||
/**
|
||||
* 区域GK类型
|
||||
*/
|
||||
public static final int AREA_EFFECTIVE_TYPE_AREA_ISP = 1;
|
||||
public static final int AREA_EFFECTIVE_TYPE_AREA_IP = 0;
|
||||
/**
|
||||
* 是否区域GK
|
||||
*/
|
||||
public static final int IS_AREA_EFFECTIVE_YES = 1;
|
||||
public static final int IS_AREA_EFFECTIVE_NO = 0;
|
||||
/**
|
||||
* 字典表地域运营商
|
||||
*/
|
||||
|
||||
@@ -89,6 +89,10 @@ public class ComplexStringCfgController extends BaseController{
|
||||
cfg.setTableName(tableName);
|
||||
cfg.initDefaultValue();
|
||||
cfg.setAction(action);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
cfg.setIsAreaEffective(0);
|
||||
}
|
||||
cfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
@@ -171,10 +175,12 @@ public class ComplexStringCfgController extends BaseController{
|
||||
cfg.setTableName(tableName);
|
||||
}
|
||||
}
|
||||
int compileId = new ConvertTool().getCompileId();
|
||||
if(cfg.getCompileId()==null){
|
||||
int compileId = new ConvertTool().getCompileId().intValue();
|
||||
cfg.setCompileId(compileId);
|
||||
}
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setCompileId(compileId);
|
||||
if(cfg.getCfgId()==null){
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(new Date());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.controller.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,14 +13,16 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.basics.SysDictInfo;
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.exceptions.ServiceException;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseController;
|
||||
@@ -124,6 +127,10 @@ public class IpCfgController extends BaseController{
|
||||
ipcfg.setTableName(tableName);
|
||||
ipcfg.initDefaultValue();
|
||||
ipcfg.setAction(action);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
ipcfg.setIsAreaEffective(0);
|
||||
}
|
||||
ipcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", ipcfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
@@ -135,6 +142,18 @@ public class IpCfgController extends BaseController{
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
List<Integer> itTypeList=new ArrayList<Integer>();
|
||||
itTypeList.add(Constants.ITEM_TYPE_AREA);
|
||||
List<SysDictInfo> areas = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null);
|
||||
model.addAttribute("areas", areas);
|
||||
itTypeList.clear();
|
||||
itTypeList.add(Constants.ITEM_TYPE_ISP);
|
||||
List<SysDictInfo> isps = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null);
|
||||
model.addAttribute("isps", isps);
|
||||
//初始化一个默认的地域ip给界面
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
areaIpCfg.initDefaultValue();
|
||||
model.addAttribute("_areaCfg", areaIpCfg);
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.error("打开新增IP窗口失败",e);
|
||||
@@ -172,26 +191,12 @@ public class IpCfgController extends BaseController{
|
||||
model.addAttribute("serviceId", serviceId);
|
||||
model.addAttribute("action", action);
|
||||
model.addAttribute("audit",Constants.CFG_PAGE);
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseIpCfg searchBean=new BaseIpCfg();
|
||||
searchBean.setCfgId(cfgId);
|
||||
searchBean.setTableName(tableName);
|
||||
BaseIpCfg ipCfg=ipCfgService.getIpCfgById(searchBean);
|
||||
model.addAttribute("_cfg", ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
model.addAttribute("fls", fls);
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
}else if(serviceId!=null){
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
tableName=serviceConfigInfo.getTableName();
|
||||
}
|
||||
}
|
||||
if(!StringUtils.isBlank(tableName)){
|
||||
logger.info("table name is "+tableName);
|
||||
BaseIpCfg searchBean=new BaseIpCfg();
|
||||
@@ -200,6 +205,37 @@ public class IpCfgController extends BaseController{
|
||||
BaseIpCfg ipCfg=ipCfgService.getIpCfgById(searchBean);
|
||||
model.addAttribute("_cfg", ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
int compileId=ipCfg.getCompileId();
|
||||
//查询配置对应的地域ip
|
||||
List<AreaIpCfg> areaCfgs=ipCfgService.getAreaCfgByCompileId(compileId);
|
||||
model.addAttribute("areaCfgs", areaCfgs);
|
||||
StringBuffer areaCfgIds=new StringBuffer();
|
||||
for(AreaIpCfg areaCfg:areaCfgs){
|
||||
areaCfgIds.append(areaCfg.getCfgId()+",");
|
||||
}
|
||||
//update时判断是否有删除地域ip
|
||||
model.addAttribute("areaCfgIds", areaCfgIds.toString());
|
||||
//初始化一个默认的地域ip给界面
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
areaIpCfg.initDefaultValue();
|
||||
model.addAttribute("_areaCfg", areaIpCfg);
|
||||
//从区域生效ID中获取区域与运营商
|
||||
String areaEffectiveIds=ipCfg.getAreaEffectiveIds();
|
||||
List<AreaBean> areaIspList=new ArrayList<AreaBean>();
|
||||
if(StringUtils.isNotBlank(areaEffectiveIds)){
|
||||
String[] areaIsps=areaEffectiveIds.split(",");
|
||||
for(String areaIsp:areaIsps){
|
||||
AreaBean area=new AreaBean();
|
||||
if(areaIsp.contains(":")){
|
||||
area.setArea(areaIsp.split(":")[0]);
|
||||
area.setIsp(areaIsp.split(":")[1]);
|
||||
}else{
|
||||
area.setArea(areaIsp);
|
||||
}
|
||||
areaIspList.add(area);
|
||||
}
|
||||
}
|
||||
model.addAttribute("_areaIsps", areaIspList);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getAllRequestInfo();
|
||||
model.addAttribute("requestInfos", requestInfos);
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
@@ -208,9 +244,14 @@ public class IpCfgController extends BaseController{
|
||||
model.addAttribute("xzs", xzs);
|
||||
List<ServiceDictInfo> lables=serviceDictInfoService.findAllLableDict();
|
||||
model.addAttribute("lables", lables);
|
||||
|
||||
}
|
||||
}
|
||||
List<Integer> itTypeList=new ArrayList<Integer>();
|
||||
itTypeList.add(Constants.ITEM_TYPE_AREA);
|
||||
List<SysDictInfo> areas = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null);
|
||||
model.addAttribute("areas", areas);
|
||||
itTypeList.clear();
|
||||
itTypeList.add(Constants.ITEM_TYPE_ISP);
|
||||
List<SysDictInfo> isps = sysDictInfoService.findAllSysDictInfo(new SysDictInfo(),itTypeList,null);
|
||||
model.addAttribute("isps", isps);
|
||||
}else{
|
||||
logger.error("未获取到正确的表名");
|
||||
}
|
||||
@@ -228,7 +269,7 @@ public class IpCfgController extends BaseController{
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RequestMapping(value = {"saveOrUpdateCfg"})
|
||||
public String saveOrUpdateIpCfg(String cfgName,Model model, BaseIpCfg ipCfg) {
|
||||
public String saveOrUpdateIpCfg(String cfgName,Model model, BaseIpCfg ipCfg,String areaCfgIds) {
|
||||
model.addAttribute("cfgName",cfgName);
|
||||
model.addAttribute("cfgType", "ip");
|
||||
model.addAttribute("audit", Constants.CFG_PAGE);
|
||||
@@ -238,6 +279,38 @@ public class IpCfgController extends BaseController{
|
||||
logger.info("saveOrUpdateIpCfg loaded");
|
||||
try{
|
||||
String tableName=ipCfg.getTableName();
|
||||
List<AreaIpCfg> areaCfg=ipCfg.getAreaCfg();
|
||||
List<AreaBean> areaIsps=ipCfg.getAreaIsp();
|
||||
if(Constants.IS_AREA_EFFECTIVE_NO==ipCfg.getIsAreaEffective()){
|
||||
ipCfg.setAreaEffectiveIds("");
|
||||
ipCfg.setAreaType(null);
|
||||
}else if(Constants.IS_AREA_EFFECTIVE_YES==ipCfg.getIsAreaEffective()){
|
||||
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==ipCfg.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
|
||||
StringBuffer areaEffectiveIds=new StringBuffer();
|
||||
for(int i=0;i<areaIsps.size();i++){
|
||||
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
|
||||
}else{
|
||||
areaEffectiveIds.append(areaIsps.get(i).getArea());
|
||||
}
|
||||
if(i!=areaIsps.size()-1){
|
||||
areaEffectiveIds.append(",");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(areaEffectiveIds.toString())){
|
||||
logger.error("区域管控,且按照地域运营商管控,但是地域运营商为空!");
|
||||
addMessage(model,"save_failed");
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
ipCfg.setAreaEffectiveIds(areaEffectiveIds.toString());
|
||||
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==ipCfg.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
|
||||
ipCfg.setAreaEffectiveIds("");
|
||||
}else{
|
||||
logger.error("区域管控,但是地域+ISP以及地域IP全部为空!");
|
||||
addMessage(model,"save_failed");
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
}
|
||||
int serviceId=ipCfg.getServiceId();
|
||||
if(StringUtils.isBlank(tableName)){
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
@@ -246,23 +319,98 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setTableName(tableName);
|
||||
}
|
||||
}
|
||||
if(ipCfg.getCompileId()==null){
|
||||
int compileId=new ConvertTool().getCompileId().intValue();
|
||||
ipCfg.setCompileId(compileId);
|
||||
}
|
||||
Date date=new Date();
|
||||
ipCfg.setIsValid(Constants.VALID_NO);
|
||||
ipCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
ipCfg.setCompileId(compileId);
|
||||
if(ipCfg.getCfgId()==null){
|
||||
ipCfg.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setCreateTime(new Date());
|
||||
ipCfgService.addIpCfg(ipCfg);
|
||||
ipCfg.setCreateTime(date);
|
||||
if(Constants.IS_AREA_EFFECTIVE_YES==ipCfg.getIsAreaEffective()&&areaCfg!=null){
|
||||
for(AreaIpCfg area:areaCfg){
|
||||
area.setTableName(AreaIpCfg.getTablename());
|
||||
area.setServiceId(serviceId);
|
||||
area.setCompileId(ipCfg.getCompileId());
|
||||
area.setAction(ipCfg.getAction());
|
||||
area.setIsValid(Constants.VALID_NO);
|
||||
area.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
area.setRequestId(ipCfg.getRequestId());
|
||||
area.setClassify(ipCfg.getClassify());
|
||||
area.setAttribute(ipCfg.getAttribute());
|
||||
area.setLable(ipCfg.getLable());
|
||||
area.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
area.setCreateTime(date);
|
||||
}
|
||||
}
|
||||
ipCfgService.addIpCfg(ipCfg,areaCfg);
|
||||
}else{
|
||||
ipCfg.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
ipCfg.setEditTime(new Date());
|
||||
ipCfgService.updateIpCfg(ipCfg);
|
||||
List<AreaIpCfg> updateAreaCfg=new ArrayList<>();
|
||||
List<AreaIpCfg> deleteAreaCfg=new ArrayList<>();
|
||||
List<AreaIpCfg> addAreaCfg=new ArrayList<>();
|
||||
String[] cfgIds=null;
|
||||
if(!StringUtils.isBlank(areaCfgIds)){
|
||||
cfgIds=areaCfgIds.split(",");
|
||||
}
|
||||
addMessage(model,"保存成功,正在为您跳转页面...");
|
||||
if(Constants.IS_AREA_EFFECTIVE_YES==ipCfg.getIsAreaEffective()&&areaCfg!=null){
|
||||
for(AreaIpCfg area:areaCfg){
|
||||
area.setTableName(AreaIpCfg.getTablename());
|
||||
area.setServiceId(serviceId);
|
||||
area.setCompileId(ipCfg.getCompileId());
|
||||
area.setAction(ipCfg.getAction());
|
||||
area.setIsValid(Constants.VALID_NO);
|
||||
area.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
area.setRequestId(ipCfg.getRequestId());
|
||||
area.setClassify(ipCfg.getClassify());
|
||||
area.setAttribute(ipCfg.getAttribute());
|
||||
area.setLable(ipCfg.getLable());
|
||||
if(area.getCfgId()==null){
|
||||
area.setCreatorId(ipCfg.getCurrentUser().getId());
|
||||
area.setCreateTime(date);
|
||||
addAreaCfg.add(area);
|
||||
}else if(cfgIds!=null){
|
||||
area.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
area.setEditTime(date);
|
||||
boolean contains=false;
|
||||
for(String cfgId:cfgIds){
|
||||
if(!StringUtils.isBlank(cfgId)&&area.getCfgId().longValue()==Long.parseLong(cfgId)){
|
||||
contains=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(contains){
|
||||
updateAreaCfg.add(area);
|
||||
}else{
|
||||
deleteAreaCfg.add(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(cfgIds!=null){
|
||||
for(String cfgId:cfgIds){
|
||||
if(!StringUtils.isBlank(cfgId)){
|
||||
AreaIpCfg area=new AreaIpCfg();
|
||||
area.setTableName(AreaIpCfg.getTablename());
|
||||
area.setIsValid(Constants.VALID_DEL);
|
||||
area.setCfgId(Long.parseLong(cfgId));
|
||||
area.setEditorId(ipCfg.getCurrentUser().getId());
|
||||
area.setEditTime(date);
|
||||
deleteAreaCfg.add(area);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ipCfgService.updateIpCfg(ipCfg,addAreaCfg,updateAreaCfg,deleteAreaCfg);
|
||||
}
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("保存失败",e);
|
||||
addMessage(model,"保存失败!");
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
@@ -314,15 +462,15 @@ public class IpCfgController extends BaseController{
|
||||
}
|
||||
int result=ipCfgService.auditIpCfg(bean,ipCfg);
|
||||
if(result!=0){
|
||||
addMessage(model,"审核成功!");
|
||||
addMessage(model,"audit_success");
|
||||
}else{
|
||||
addMessage(model, "审核失败");
|
||||
addMessage(model, "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("审核失败", e);
|
||||
addMessage(model, "审核失败");
|
||||
addMessage(model, "audit_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
@@ -361,14 +509,14 @@ public class IpCfgController extends BaseController{
|
||||
ipCfg.setIsValid(Constants.VALID_DEL);
|
||||
int result=ipCfgService.deleteIpCfg(ipCfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
addMessage(model,"删除成功,正在为您跳转页面...");
|
||||
addMessage(model,"delete_success");
|
||||
}else{
|
||||
logger.error("通过审核的配置不能删除!");
|
||||
addMessage(model,"删除失败!");
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("删除失败", e);
|
||||
addMessage(model,"删除失败!");
|
||||
addMessage(model,"delete_failed");
|
||||
}
|
||||
return "/cfg/resultPage";
|
||||
}
|
||||
|
||||
@@ -73,6 +73,10 @@ public class NumCfgController extends BaseController{
|
||||
NumBoundaryCfg cfg=new NumBoundaryCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setAction(action);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
cfg.setIsAreaEffective(0);
|
||||
}
|
||||
cfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
List<RequestInfo> requestInfos=requestInfoService.getValidRequestInfo();
|
||||
@@ -139,10 +143,12 @@ public class NumCfgController extends BaseController{
|
||||
int serviceId=cfg.getServiceId();
|
||||
ServiceConfigInfo serviceConfigInfo=serviceConfigInfoService.findSysServiceConfigInfo(serviceId);
|
||||
if(serviceConfigInfo!=null){
|
||||
if(cfg.getCompileId()==null){
|
||||
int compileId=new ConvertTool().getCompileId();
|
||||
cfg.setCompileId(compileId);
|
||||
}
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setCompileId(compileId);
|
||||
if(cfg.getCfgId()==null){
|
||||
cfg.setCreatorId(cfg.getCurrentUser().getId());
|
||||
cfg.setCreateTime(new Date());
|
||||
|
||||
@@ -90,6 +90,10 @@ public class StringCfgController extends BaseController{
|
||||
stringcfg.setTableName(tableName);
|
||||
stringcfg.initDefaultValue();
|
||||
stringcfg.setAction(action);
|
||||
//监测缺省不需要区域管控
|
||||
if(action==Constants.ACTION_DJ){
|
||||
stringcfg.setIsAreaEffective(0);
|
||||
}
|
||||
stringcfg.setServiceId(serviceId);
|
||||
model.addAttribute("_cfg", stringcfg);
|
||||
model.addAttribute("tableName", tableName);
|
||||
@@ -176,10 +180,12 @@ public class StringCfgController extends BaseController{
|
||||
stringCfg.setTableName(tableName);
|
||||
}
|
||||
}
|
||||
if(stringCfg.getCompileId()==null){
|
||||
int compileId=new ConvertTool().getCompileId();
|
||||
stringCfg.setCompileId(compileId);
|
||||
}
|
||||
stringCfg.setIsValid(Constants.VALID_NO);
|
||||
stringCfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
stringCfg.setCompileId(compileId);
|
||||
if(stringCfg.getCfgId()==null){
|
||||
stringCfg.setCreatorId(stringCfg.getCurrentUser().getId());
|
||||
stringCfg.setCreateTime(new Date());
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.nis.web.dao.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
/**
|
||||
* IP相关配置数据处理类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@MyBatisDao
|
||||
public interface AreaIpCfgDao extends CrudDao<AreaIpCfg>{
|
||||
public AreaIpCfg getById(@Param("cfgId")Long id) ;
|
||||
public List<AreaIpCfg> findList(AreaIpCfg entity) ;
|
||||
public List<AreaIpCfg> getByCompileId(@Param("compileId") int compileId) ;
|
||||
public int insert(AreaIpCfg entity) ;
|
||||
public int updateByPrimaryKeySelective(AreaIpCfg entity) ;
|
||||
public int updateValid(AreaIpCfg entity) ;
|
||||
public int audit(AreaIpCfg entity) ;
|
||||
public int getIsValid(@Param("cfgId")Long id);
|
||||
public int getIsValid(AreaIpCfg entity);
|
||||
public int getIsAudit(@Param("cfgId")Long id);
|
||||
public int getIsAudit(AreaIpCfg entity);
|
||||
public int deleteByCompileId(AreaIpCfg entity);
|
||||
}
|
||||
92
src/main/java/com/nis/web/dao/configuration/AreaIpCfgDao.xml
Normal file
92
src/main/java/com/nis/web/dao/configuration/AreaIpCfgDao.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.nis.web.dao.configuration.AreaIpCfgDao" >
|
||||
<resultMap id="BaseIpMap" type="com.nis.domain.configuration.AreaIpCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="src_ip" property="srcIp" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_mask" property="srcIpMask" jdbcType="VARCHAR" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="src_port_mask" property="srcPortMask" jdbcType="VARCHAR" />
|
||||
<result column="dst_ip" property="dstIp" jdbcType="VARCHAR" />
|
||||
<result column="dst_ip_mask" property="dstIpMask" jdbcType="VARCHAR" />
|
||||
<result column="dst_port" property="dstPort" jdbcType="VARCHAR" />
|
||||
<result column="dst_port_mask" property="dstPortMask" jdbcType="VARCHAR" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<resultMap id="BaseIpMapWithUser" type="com.nis.domain.configuration.AreaIpCfg" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="src_ip" property="srcIp" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_mask" property="srcIpMask" jdbcType="VARCHAR" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="src_port_mask" property="srcPortMask" jdbcType="VARCHAR" />
|
||||
<result column="dst_ip" property="dstIp" jdbcType="VARCHAR" />
|
||||
<result column="dst_ip_mask" property="dstIpMask" jdbcType="VARCHAR" />
|
||||
<result column="dst_port" property="dstPort" jdbcType="VARCHAR" />
|
||||
<result column="dst_port_mask" property="dstPortMask" jdbcType="VARCHAR" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
|
||||
<result column="action" property="action" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
|
||||
<result column="classify" property="classify" jdbcType="VARCHAR" />
|
||||
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
|
||||
<result column="lable" property="lable" jdbcType="VARCHAR" />
|
||||
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
|
||||
<result column="creator_name" property="creatorName" jdbcType="VARCHAR" />
|
||||
<result column="auditor_name" property="auditorName" jdbcType="VARCHAR" />
|
||||
<result column="editor_name" property="editorName" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="AreaIpCfg_Column_List_with_id" >
|
||||
CFG_ID, CFG_DESC, IP_TYPE, SRC_IP, SRC_IP_MASK, SRC_PORT,
|
||||
SRC_PORT_MASK ,DST_IP ,DST_IP_MASK, DST_PORT, DST_PORT_MASK,
|
||||
DIRECTION,PROTOCOL,PROTOCOL_ID,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS
|
||||
</sql>
|
||||
<select id="getByCompileId" resultMap="BaseIpMap" >
|
||||
SELECT
|
||||
<include refid="AreaIpCfg_Column_List_with_id" />
|
||||
FROM area_ip_cfg
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="compileId != null">
|
||||
AND COMPILE_ID=#{compileId,jdbcType=INTEGER}
|
||||
</if>
|
||||
AND IS_VALID!=-1
|
||||
</trim>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -527,7 +527,7 @@
|
||||
<if test="lable != null and lable != ''" >
|
||||
lable = #{lable,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="areaEffectiveIds != null and areaEffectiveIds != ''" >
|
||||
<if test="areaEffectiveIds != null" >
|
||||
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</trim>
|
||||
@@ -553,6 +553,9 @@
|
||||
SELECT IS_AUDIT FROM ${tableName}
|
||||
WHERE CFG_ID = #{cfgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="delete" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where cfg_id = #{cfgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER}, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.nis.domain.maat.UnAuditBean;
|
||||
import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
|
||||
/**
|
||||
* Service基类
|
||||
@@ -124,6 +125,25 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void saveIpBatch(List<AreaIpCfg> areaIpCfgs) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < areaIpCfgs.size();index++){
|
||||
BaseIpCfg t = areaIpCfgs.get(index);
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).insert(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
@@ -135,7 +155,7 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
*
|
||||
* updateBatch(批量更新全部数据)
|
||||
* (这里描述这个方法适用条件 – 可选)
|
||||
* @param data 数据集合
|
||||
* @param areaCfg 数据集合
|
||||
* @param mClass 传入的dao.xml里的mapper
|
||||
* @author wx
|
||||
* @since 1.0.0
|
||||
@@ -153,6 +173,26 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateIpBatch(List<AreaIpCfg> areaCfg) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < areaCfg.size();index++){
|
||||
BaseIpCfg t = areaCfg.get(index);
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).update(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
@@ -183,6 +223,25 @@ public abstract class CrudService<D extends CrudDao<T>, T extends BaseEntity<T>>
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void deleteIpBatch(List<AreaIpCfg> data) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
BaseIpCfg t = data.get(index);
|
||||
((CrudDao<BaseIpCfg>) batchSqlSession.getMapper(IpCfgDao.class)).delete(t);
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
// }catch (Exception e){
|
||||
// batchSqlSession.rollback();
|
||||
// throw e;
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@@ -18,6 +22,8 @@ import com.nis.web.service.CrudService;
|
||||
public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
@Autowired
|
||||
protected IpCfgDao ipCfgDao;
|
||||
@Autowired
|
||||
protected AreaIpCfgDao areaIpCfgDao;
|
||||
/**
|
||||
*
|
||||
* addIpCfg(新增IP类配置)
|
||||
@@ -29,7 +35,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg){
|
||||
public int addIpCfg(BaseIpCfg baseIpCfg,List<AreaIpCfg> areaIpCfgs){
|
||||
if(areaIpCfgs!=null&&areaIpCfgs.size()>0){
|
||||
this.saveIpBatch(areaIpCfgs);
|
||||
}
|
||||
return ipCfgDao.insert(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
@@ -43,7 +52,16 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg){
|
||||
public int updateIpCfg(BaseIpCfg baseIpCfg,List<AreaIpCfg> addAreaCfg,List<AreaIpCfg> updateAreaCfg,List<AreaIpCfg> deleteAreaCfgs){
|
||||
if(addAreaCfg!=null&&addAreaCfg.size()>0){
|
||||
this.saveIpBatch(addAreaCfg);
|
||||
}
|
||||
if(updateAreaCfg!=null&&updateAreaCfg.size()>0){
|
||||
this.updateIpBatch(updateAreaCfg);
|
||||
}
|
||||
if(deleteAreaCfgs!=null&&deleteAreaCfgs.size()>0){
|
||||
this.deleteIpBatch(deleteAreaCfgs);
|
||||
}
|
||||
return ipCfgDao.updateByPrimaryKeySelective(baseIpCfg);
|
||||
}
|
||||
/**
|
||||
@@ -110,4 +128,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
public Integer getIsAudit(String tableName, long id){
|
||||
return ipCfgDao.getIsAudit(tableName,id);
|
||||
}
|
||||
public List<AreaIpCfg> getAreaCfgByCompileId(int compileId){
|
||||
return areaIpCfgDao.getByCompileId(compileId);
|
||||
}
|
||||
}
|
||||
|
||||
432
src/main/webapp/WEB-INF/include/form/areaInfo.jsp
Normal file
432
src/main/webapp/WEB-INF/include/form/areaInfo.jsp
Normal file
@@ -0,0 +1,432 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(".glyphicon-plus").on("click",function(){
|
||||
var obj=$(this).parents(".form-section").next(".container").clone();
|
||||
var len=$(this).parents("div").find(".container:visible").size();
|
||||
if($(this).parent().parent().parent().attr("id")=="areaIp"){
|
||||
obj.find("[id^='_areaCfg']").each(function(){
|
||||
var name=$(this).attr("id").replace("_areaCfg.","");
|
||||
$(this).removeAttr("id");
|
||||
$(this).attr("name","areaCfg["+len+"]."+name);
|
||||
$(this).selectpicker("refresh");
|
||||
});
|
||||
obj.removeClass("hidden");
|
||||
obj.find("select[name$='ipType']").on("change",function(){
|
||||
switchIpType($(this));
|
||||
});
|
||||
obj.appendTo("#areaIp");
|
||||
$("#areaIsp").find(".container").each(function(){
|
||||
if(!$(this).hasClass("hidden")) $(this).remove();
|
||||
});
|
||||
}else if($(this).parent().parent().parent().attr("id")=="areaIsp"){
|
||||
obj.find("[name^='areaCode']").each(function(){
|
||||
$(this).attr("name","areaIsp["+len+"].area");
|
||||
$(this).selectpicker("refresh");
|
||||
});
|
||||
obj.find("[name^='ispCode']").each(function(){
|
||||
$(this).attr("name","areaIsp["+len+"].isp");
|
||||
$(this).selectpicker("refresh");
|
||||
});
|
||||
obj.removeClass("hidden");
|
||||
obj.appendTo("#areaIsp");
|
||||
$("#areaIp").find(".container").each(function(){
|
||||
if(!$(this).hasClass("hidden")) $(this).remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
function delAreaIp(obj){
|
||||
var thisObj=$(obj);
|
||||
thisObj.parents(".container").remove();
|
||||
var len=$("#areaIp").find(".container:visible").size();
|
||||
//调整角标
|
||||
if(len>0){
|
||||
len--;
|
||||
$("#areaIp").find(".container:visible").each(function(){
|
||||
$(this).find("[name^='areaCfg']").each(function(){
|
||||
var name=$(this).attr("name");
|
||||
name=name.substring(name.lastIndexOf(".")+1,name.length);
|
||||
$(this).attr("name","areaCfg["+len+"]."+name);
|
||||
});
|
||||
len--;
|
||||
});
|
||||
}
|
||||
}
|
||||
function delAreaIsp(obj){
|
||||
var thisObj=$(obj);
|
||||
thisObj.parents(".container").remove();
|
||||
var len=$("#areaIsp").find(".container:visible").size();
|
||||
}
|
||||
</script>
|
||||
<div class="hidden" id="areaIsp">
|
||||
<h4 class="form-section"><spring:message code="area"/> <spring:message code="isp"/><small><span class="glyphicon glyphicon-plus" title="add"></span></small></h4>
|
||||
<div class="container hidden">
|
||||
<div class="row">
|
||||
<div class="pull-right">
|
||||
<span class="glyphicon glyphicon-remove" title="remove" onClick="delAreaIsp(this);"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="area"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaCode" class="form-control" data-live-search="true" data-live-search-placeholder="search" >
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:forEach items="${areas}" var="area">
|
||||
<option value="${area.itemCode}">${area.itemValue}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="isp"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="ispCode" class="form-control" data-live-search="true" data-live-search-placeholder="search" >
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:forEach items="${isps}" var="isp">
|
||||
<option value="${isp.itemCode}">${isp.itemValue}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:forEach items="${_areaIsps}" var="areaIsp" varStatus="status">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="pull-right">
|
||||
<span class="glyphicon glyphicon-remove" title="remove" onClick="delAreaIsp(this);"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="area"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaIsp[${status.index}].area" class="form-control" data-live-search="true" data-live-search-placeholder="search" >
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:forEach items="${areas}" var="area">
|
||||
<option value="${area.itemCode}"
|
||||
<c:if test="${area.itemCode==areaIsp.area}">selected</c:if>
|
||||
>${area.itemValue}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="isp"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaIsp[${status.index}].isp" class="form-control" data-live-search="true" data-live-search-placeholder="search" >
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:forEach items="${isps}" var="isp">
|
||||
<option value="${isp.itemCode}"
|
||||
<c:if test="${isp.itemCode==areaIsp.isp}">selected</c:if>
|
||||
>${isp.itemValue}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
|
||||
</div>
|
||||
<div class="hidden" id="areaIp">
|
||||
<h4 class="form-section"><spring:message code="area"/> ip<small><span class="glyphicon glyphicon-plus" title="add"></span></small></h4>
|
||||
<div class="container hidden">
|
||||
<div class="row">
|
||||
<input type="hidden" id="_areaCfg.isAreaEffective" value="${_areaCfg.isAreaEffective}">
|
||||
<div class="pull-right">
|
||||
<span class="glyphicon glyphicon-remove" title="remove" onClick="delAreaIp(this);"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="config_describe"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.cfgDesc" class="form-control" type="text" value="">
|
||||
</div>
|
||||
<div for="_areaCfg.cfgDesc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_type"/></label>
|
||||
<div class="col-md-6">
|
||||
<select id="_areaCfg.ipType" class="show-tick form-control">
|
||||
<option><spring:message code="select"/></option>
|
||||
<option value="4">V4</option>
|
||||
<option value="6">V6</option>
|
||||
</select>
|
||||
</div>
|
||||
<div for="_areaCfg.ipType"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<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.srcIp" class="form-control" type="text" value="${_areaCfg.srcIp}">
|
||||
</div>
|
||||
<div for="_areaCfg.srcIp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_address_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.srcIpMask" class="form-control" type="text" value="${_areaCfg.srcIpMask}">
|
||||
</div>
|
||||
<div for="_areaCfg.srcIpMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.srcPort" class="form-control" type="text" value="${_areaCfg.srcPort}">
|
||||
</div>
|
||||
<div for="_areaCfg.srcPort"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.srcPortMask" class="form-control" type="text" value="${_areaCfg.srcPortMask}">
|
||||
</div>
|
||||
<div for="_areaCfg.srcPortMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.dstIp" class="form-control" type="text" value="${_areaCfg.dstIp}">
|
||||
</div>
|
||||
<div for="_areaCfg.dstIp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_address_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.dstIpMask" class="form-control" type="text" value="${_areaCfg.dstIpMask}">
|
||||
</div>
|
||||
<div for="_areaCfg.dstIpMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.dstPort" class="form-control" type="text" value="${_areaCfg.dstPort}">
|
||||
</div>
|
||||
<div for="_areaCfg.dstPort"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input id="_areaCfg.dstPortMask" class="form-control" type="text" value="${_areaCfg.dstPortMask}">
|
||||
</div>
|
||||
<div for="_areaCfg.dstPortMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
|
||||
<div class="col-md-6">
|
||||
<select id="_areaCfg.protocol" class="show-tick form-control">
|
||||
<option><spring:message code="select"/></option>
|
||||
<option value="6" <c:if test="${_areaCfg.protocol==6}">selected</c:if>>TCP</option>
|
||||
<option value="17" <c:if test="${_areaCfg.protocol==17}">selected</c:if> >UDP</option>
|
||||
<option value="0" <c:if test="${_areaCfg.protocol==0}">selected</c:if> ><spring:message code="arbitrary"/></option>
|
||||
</select>
|
||||
<input type="hidden" id="_areaCfg.protocolId" value="${_areaCfg.protocolId}">
|
||||
</div>
|
||||
<div for="_areaCfg.protocol"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="direction"/></label>
|
||||
<div class="col-md-6">
|
||||
<select id="_areaCfg.direction" class="show-tick form-control" >
|
||||
<option><spring:message code="select"/></option>
|
||||
<option value="0" <c:if test="${_areaCfg.direction==0}">selected</c:if>><spring:message code="twoway"/></option>
|
||||
<option value="1" <c:if test="${_areaCfg.direction==1}">selected</c:if>><spring:message code="oneway"/></option>
|
||||
</select>
|
||||
</div>
|
||||
<div for="_areaCfg.direction"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="areaCfgIds" value="${areaCfgIds}">
|
||||
<c:forEach items="${areaCfgs}" var ="areaCfg" varStatus="status">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<input type="hidden" name="areaCfg[${status.index}].isAreaEffective" value="${areaCfg.isAreaEffective}">
|
||||
<div class="pull-right">
|
||||
<span class="glyphicon glyphicon-remove" title="remove" onClick="delAreaIp(this);"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="config_describe"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].cfgDesc" class="form-control" type="text" value="${areaCfg.cfgDesc}">
|
||||
</div>
|
||||
<div for="areaCfg.cfgDesc"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_type"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaCfg[${status.index}].ipType" class="selectpicker show-tick form-control">
|
||||
<option><spring:message code="select"/></option>
|
||||
<option value="4" <c:if test="${areaCfg.ipType==4}">selected</c:if>>V4</option>
|
||||
<option value="6" <c:if test="${areaCfg.ipType==6}">selected</c:if>>V6</option>
|
||||
</select>
|
||||
</div>
|
||||
<div for="areaCfg.ipType"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<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}].srcIp" class="form-control" type="text" value="${areaCfg.srcIp}">
|
||||
</div>
|
||||
<div for="areaCfg.srcIp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_address_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].srcIpMask" class="form-control" type="text" value="${areaCfg.srcIpMask}">
|
||||
</div>
|
||||
<div for="areaCfg.srcIpMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].srcPort" class="form-control" type="text" value="${areaCfg.srcPort}">
|
||||
</div>
|
||||
<div for="areaCfg.srcPort"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].srcPortMask" class="form-control" type="text" value="${areaCfg.srcPortMask}">
|
||||
</div>
|
||||
<div for="areaCfg.srcPortMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].dstIp" class="form-control" type="text" value="${areaCfg.dstIp}">
|
||||
</div>
|
||||
<div for="areaCfg.dstIp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_address_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].dstIpMask" class="form-control" type="text" value="${areaCfg.dstIpMask}">
|
||||
</div>
|
||||
<div for="areaCfg.dstIpMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].dstPort" class="form-control" type="text" value="${areaCfg.dstPort}">
|
||||
</div>
|
||||
<div for="areaCfg.dstPort"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port_mask"/></label>
|
||||
<div class="col-md-6">
|
||||
<input name="areaCfg[${status.index}].dstPortMask" class="form-control" type="text" value="${areaCfg.dstPortMask}">
|
||||
</div>
|
||||
<div for="areaCfg.dstPortMask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaCfg[${status.index}].protocol" class="selectpicker show-tick form-control">
|
||||
<option><spring:message code="select"/></option>
|
||||
<option value="6" <c:if test="${areaCfg.protocol==6}">selected</c:if>>TCP</option>
|
||||
<option value="17" <c:if test="${areaCfg.protocol==17}">selected</c:if> >UDP</option>
|
||||
<option value="0" <c:if test="${areaCfg.protocol==0}">selected</c:if> ><spring:message code="arbitrary"/></option>
|
||||
</select>
|
||||
<input type="hidden" name="areaCfg[${status.index}].protocolId" value="${areaCfg.protocolId}">
|
||||
</div>
|
||||
<div for="areaCfg.protocol"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="direction"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaCfg[${status.index}].direction" class="selectpicker show-tick form-control" >
|
||||
<option><spring:message code="select"/></option>
|
||||
<option value="0" <c:if test="${areaCfg.direction==0}">selected</c:if>><spring:message code="twoway"/></option>
|
||||
<option value="1" <c:if test="${areaCfg.direction==1}">selected</c:if>><spring:message code="oneway"/></option>
|
||||
</select>
|
||||
</div>
|
||||
<div for="areaCfg.direction"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
</div>
|
||||
@@ -185,24 +185,34 @@
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="isAreaEffective" value="1"
|
||||
<c:if test="${_cfg.isAreaEffective==1}">checked</c:if>
|
||||
<c:if test="${action==2}">disabled</c:if>
|
||||
><spring:message code="yes"/>
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="isAreaEffective" value="0"
|
||||
<c:if test="${_cfg.isAreaEffective==0}">checked</c:if>
|
||||
<c:if test="${action==2}">disabled</c:if>
|
||||
><spring:message code="no"/>
|
||||
</label>
|
||||
<%-- <input class="form-control" type="text" name="isAreaEffective" value="${_cfg.isAreaEffective}"> --%>
|
||||
<c:if test="${action==2}">
|
||||
<input class="form-control" type="hidden" name="isAreaEffective" value="${_cfg.isAreaEffective}">
|
||||
</c:if>
|
||||
</div>
|
||||
<div for="isAreaEffective"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden areaType col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="区域管控类型"/></label>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><spring:message code="area_effect_id"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="areaEffectiveIds" value="${_cfg.areaEffectiveIds}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="areaType" value="1"><spring:message code="area"/> <spring:message code="isp"/>
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="areaType" value="0"><spring:message code="area"/> ip
|
||||
</label>
|
||||
</div>
|
||||
<input class="form-control" type="hidden" name="areaEffectiveIds" value="${_cfg.areaEffectiveIds}">
|
||||
<div for="areaEffectiveIds"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -86,14 +86,18 @@
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="isAreaEffective" value="1"
|
||||
<c:if test="${_cfg.isAreaEffective==1}">checked</c:if>
|
||||
<c:if test="${action==2}">disabled</c:if>
|
||||
><spring:message code="yes"/>
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="isAreaEffective" value="0"
|
||||
<c:if test="${_cfg.isAreaEffective==0}">checked</c:if>
|
||||
<c:if test="${action==2}">disabled</c:if>
|
||||
><spring:message code="no"/>
|
||||
</label>
|
||||
<%-- <input class="form-control" type="text" name="isAreaEffective" value="${_cfg.isAreaEffective}"> --%>
|
||||
<c:if test="${action==2}">
|
||||
<input class="form-control" type="hidden" name="isAreaEffective" value="${_cfg.isAreaEffective}">
|
||||
</c:if>
|
||||
</div>
|
||||
<div for="isAreaEffective"></div>
|
||||
</div>
|
||||
|
||||
@@ -91,6 +91,9 @@ $(function(){
|
||||
<c:if test="${not empty _cfg.cfgId}">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
</c:if>
|
||||
<c:if test="${not empty _cfg.compileId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
</c:if>
|
||||
<input type="hidden" name="audit" value="${audit}">
|
||||
<input type="hidden" name="tableName" value="${_cfg.tableName}">
|
||||
<input type="hidden" name="serviceId" value="${_cfg.serviceId}">
|
||||
|
||||
@@ -6,6 +6,50 @@
|
||||
<link href="${pageContext.request.contextPath}/static/global/plugins/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet"/>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if($("input[name='isAreaEffective']:checked").val()==1){
|
||||
$(".areaType").removeClass("hidden");
|
||||
if($("input[name='areaEffectiveIds']").val()){
|
||||
$(".areaType").find("[value='1']").prop("checked",true);
|
||||
$("#areaIsp").removeClass("hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
}else{
|
||||
$(".areaType").find("[value='0']").prop("checked",true);
|
||||
$("#areaIp").removeClass("hidden");
|
||||
$("#areaIsp").addClass("hidden");
|
||||
}
|
||||
}else{
|
||||
$("input[name='areaEffectiveIds']").val("");
|
||||
}
|
||||
$("input[name='isAreaEffective']").on('change',function(){
|
||||
var val=$(this).val();
|
||||
if(val==1){
|
||||
$(".areaType").removeClass("hidden");
|
||||
if($("input[name='areaType']:checked").val()==1){//areaISP
|
||||
$("#areaIsp").removeClass("hidden");
|
||||
}else if($("input[name='areaType']:checked").val()==0){//areaIp
|
||||
$("#areaIp").removeClass("hidden");
|
||||
}
|
||||
}else{
|
||||
$(".areaType").addClass("hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
$("#areaIsp").addClass("hidden");
|
||||
}
|
||||
});
|
||||
$("input[name='areaType']").on('change',function(){
|
||||
var val=$(this).val();
|
||||
if($(this).is(":visible")){
|
||||
if(val==0){
|
||||
$("#areaIp").removeClass("hidden");
|
||||
$("#areaIsp").addClass("hidden");
|
||||
}else{
|
||||
$("#areaIsp").removeClass("hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
}
|
||||
}else{
|
||||
$("#areaIsp").addClass("hidden");
|
||||
$("#areaIp").addClass("hidden");
|
||||
}
|
||||
});
|
||||
$("#save").on("click",function(){
|
||||
$("#ipCfgFrom").attr("action","${ctx}/cfg/ip/saveOrUpdateCfg");
|
||||
$("#save").submit();
|
||||
@@ -13,53 +57,10 @@ $(function(){
|
||||
$("#cancel").on("click",function(){
|
||||
window.history.back();
|
||||
});
|
||||
$("select[name='ipType']").on("change",function(){
|
||||
var type=$(this).val();
|
||||
if(4==type){
|
||||
if(!$("input[name='srcIpMask']").val()){
|
||||
$("input[name='srcIpMask']").val("255.255.255.255");
|
||||
}else if($("input[name='srcIpMask']").val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
|
||||
$("input[name='srcIpMask']").val("255.255.255.255");
|
||||
}
|
||||
if(!$("input[name='dstIpMask']").val()){
|
||||
$("input[name='dstIpMask']").val("255.255.255.255");
|
||||
}else if($("input[name='dstIpMask']").val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
|
||||
$("input[name='dstIpMask']").val("255.255.255.255");
|
||||
}
|
||||
if(!$("input[name='srcIp']").val()){
|
||||
$("input[name='srcIp']").val("0.0.0.0");
|
||||
}else if($("input[name='srcIp']").val()=="::"){
|
||||
$("input[name='srcIp']").val("0.0.0.0");
|
||||
}
|
||||
if(!$("input[name='dstIp']").val()){
|
||||
$("input[name='dstIp']").val("0.0.0.0");
|
||||
}else if($("input[name='dstIp']").val()=="::"){
|
||||
$("input[name='dstIp']").val("0.0.0.0");
|
||||
}
|
||||
}
|
||||
if(6==type){
|
||||
if(!$("input[name='srcIpMask']").val()){
|
||||
$("input[name='srcIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}else if($("input[name='srcIpMask']").val()=="255.255.255.255"){
|
||||
$("input[name='srcIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if(!$("input[name='dstIpMask']").val()){
|
||||
$("input[name='dstIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}else if($("input[name='dstIpMask']").val()=="255.255.255.255"){
|
||||
$("input[name='dstIpMask']").val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if(!$("input[name='srcIp']").val()){
|
||||
$("input[name='srcIp']").val("::");
|
||||
}else if($("input[name='srcIp']").val()=="0.0.0.0"){
|
||||
$("input[name='srcIp']").val("::");
|
||||
}
|
||||
if(!$("input[name='dstIp']").val()){
|
||||
$("input[name='dstIp']").val("::");
|
||||
}else if($("input[name='dstIp']").val()=="0.0.0.0"){
|
||||
$("input[name='dstIp']").val("::");
|
||||
}
|
||||
}
|
||||
$("select[name$='ipType']").on("change",function(){
|
||||
switchIpType($(this));
|
||||
});
|
||||
|
||||
$("#ipCfgFrom").validate({
|
||||
rules: {
|
||||
ipType: {
|
||||
@@ -182,6 +183,58 @@ $(function(){
|
||||
"请输入正确的IP!"
|
||||
);
|
||||
});
|
||||
var switchIpType=function(obj){
|
||||
var type=$(obj).val();
|
||||
var row=$(obj).parents('.row');
|
||||
var srcIpMask=row.siblings().find("input[name$='srcIpMask']");
|
||||
var dstIpMask=row.siblings().find("input[name$='dstIpMask']");
|
||||
var srcIp=row.siblings().find("input[name$='srcIp']");
|
||||
var dstIp=row.siblings().find("input[name$='dstIp']");
|
||||
if(4==type){
|
||||
if(!$(srcIpMask).val()){
|
||||
$(srcIpMask).val("255.255.255.255");
|
||||
}else if($(srcIpMask).val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
|
||||
$(srcIpMask).val("255.255.255.255");
|
||||
}
|
||||
if(!$(dstIpMask).val()){
|
||||
$(dstIpMask).val("255.255.255.255");
|
||||
}else if($(dstIpMask).val()=="FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"){
|
||||
$(dstIpMask).val("255.255.255.255");
|
||||
}
|
||||
if(!$(srcIp).val()){
|
||||
$(srcIp).val("0.0.0.0");
|
||||
}else if($(srcIp).val()=="::"){
|
||||
$(srcIp).val("0.0.0.0");
|
||||
}
|
||||
if(!$(dstIp).val()){
|
||||
$(dstIp).val("0.0.0.0");
|
||||
}else if($(dstIp).val()=="::"){
|
||||
$(dstIp).val("0.0.0.0");
|
||||
}
|
||||
}
|
||||
if(6==type){
|
||||
if(!$(srcIpMask).val()){
|
||||
$(srcIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}else if($(srcIpMask).val()=="255.255.255.255"){
|
||||
$(srcIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if(!$(dstIpMask).val()){
|
||||
$(dstIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}else if($(dstIpMask).val()=="255.255.255.255"){
|
||||
$(dstIpMask).val("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
|
||||
}
|
||||
if(!$(srcIp).val()){
|
||||
$(srcIp).val("::");
|
||||
}else if($(srcIp).val()=="0.0.0.0"){
|
||||
$(srcIp).val("::");
|
||||
}
|
||||
if(!$(dstIp).val()){
|
||||
$(dstIp).val("::");
|
||||
}else if($(dstIp).val()=="0.0.0.0"){
|
||||
$(dstIp).val("::");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -210,6 +263,9 @@ $(function(){
|
||||
<c:if test="${not empty _cfg.cfgId}">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
</c:if>
|
||||
<c:if test="${not empty _cfg.compileId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
</c:if>
|
||||
<input type="hidden" name="tableName" value="${_cfg.tableName}">
|
||||
<input type="hidden" name="serviceId" value="${serviceId}">
|
||||
<input type="hidden" name="cfgName" value="${cfgName}">
|
||||
@@ -217,14 +273,13 @@ $(function(){
|
||||
<input type="hidden" name="protocolId" value="${_cfg.protocolId}">
|
||||
<c:choose>
|
||||
<c:when test="${action!=5 and action!=8}">
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp" %>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<input type="hidden" name=requestId value="0">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<div class="row">
|
||||
|
||||
@@ -100,6 +100,9 @@ $(function(){
|
||||
<c:if test="${not empty _cfg.cfgId}">
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
</c:if>
|
||||
<c:if test="${not empty _cfg.compileId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
</c:if>
|
||||
<input id="audit" name="audit" type="hidden" value="${audit}"/>
|
||||
<input id="action" name="action" type="hidden" value="${action}"/>
|
||||
<input type="hidden" name="tableName" value="${_cfg.tableName}">
|
||||
@@ -107,6 +110,7 @@ $(function(){
|
||||
<input type="hidden" name="cfgName" value="${cfgName}">
|
||||
<c:choose>
|
||||
<c:when test="${action!=5 and action!=8}">
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp" %>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp" %>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
|
||||
Reference in New Issue
Block a user