From 1e7dce869c134210627b4af409571917ffd3712b Mon Sep 17 00:00:00 2001 From: zhangwq Date: Wed, 28 Nov 2018 17:50:33 +0800 Subject: [PATCH] =?UTF-8?q?SNAT=E5=9C=B0=E5=9D=80=E6=B1=A0=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8F=90=E4=BA=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/domain/callback/IpAddrPool.java | 37 ++ .../domain/configuration/IpAddrPoolCfg.java | 78 +++ .../maintenance/IpAddrPoolController.java | 163 ++++++ .../IpMultiplexPoolCfgController.java | 4 +- .../web/dao/basics/PolicyGroupInfoDao.java | 3 + .../nis/web/dao/basics/PolicyGroupInfoDao.xml | 33 ++ .../dao/configuration/IpAddrPoolCfgDao.java | 36 ++ .../dao/configuration/IpAddrPoolCfgDao.xml | 442 ++++++++++++++++ .../configuration/IpMultiplexPoolCfgDao.java | 4 + .../configuration/IpMultiplexPoolCfgDao.xml | 125 ++++- .../web/dao/configuration/UserManageDao.java | 2 + .../web/dao/configuration/UserManageDao.xml | 6 + .../basics/PolicyGroupInfoService.java | 9 + .../configuration/IpAddrPoolCfgService.java | 285 ++++++++++ .../configuration/UserManageService.java | 3 + .../resources/messages/message_en.properties | 6 +- .../resources/messages/message_ru.properties | 6 +- .../messages/message_zh_CN.properties | 6 +- .../maintenance/ipMultiplexPool/snatform2.jsp | 491 ++++++++++++++++++ .../maintenance/ipMultiplexPool/snatlist2.jsp | 439 ++++++++++++++++ .../1.11.0/jquery.validate.method.js | 8 +- .../1.11.0/localization/messages_en.js | 2 +- .../1.11.0/localization/messages_ru.js | 2 +- .../1.11.0/localization/messages_zh.js | 2 +- .../webapp/static/global/scripts/common.js | 2 +- 25 files changed, 2179 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/nis/domain/callback/IpAddrPool.java create mode 100644 src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java create mode 100644 src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java create mode 100644 src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java create mode 100644 src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml create mode 100644 src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java create mode 100644 src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatform2.jsp create mode 100644 src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp diff --git a/src/main/java/com/nis/domain/callback/IpAddrPool.java b/src/main/java/com/nis/domain/callback/IpAddrPool.java new file mode 100644 index 000000000..5c3df3afd --- /dev/null +++ b/src/main/java/com/nis/domain/callback/IpAddrPool.java @@ -0,0 +1,37 @@ +package com.nis.domain.callback; + +import com.google.gson.annotations.Expose; + +public class IpAddrPool extends InlineIp{ + + @Expose + private Integer regionId; + @Expose + private Integer groupId; + @Expose + private Integer addrPoolId; + + public Integer getRegionId() { + return regionId; + } + + public void setRegionId(Integer regionId) { + this.regionId = regionId; + } + + public Integer getGroupId() { + return groupId; + } + + public void setGroupId(Integer groupId) { + this.groupId = groupId; + } + + public Integer getAddrPoolId() { + return addrPoolId; + } + + public void setAddrPoolId(Integer addrPoolId) { + this.addrPoolId = addrPoolId; + } +} diff --git a/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java b/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java new file mode 100644 index 000000000..cb144871e --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/IpAddrPoolCfg.java @@ -0,0 +1,78 @@ +package com.nis.domain.configuration; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +/** + * IP复用地址池实体 + * @author dell + * + */ +public class IpAddrPoolCfg extends BaseCfg{ + + private static final long serialVersionUID = 1392197458744667669L; + private String indexTable="ip_reuse_addr_pool"; + + private Integer addrPoolId; // 地址池ID + private String addrPoolName; // 地址池名称 + private Integer ipTotal; // IP总数 + private Integer availableIpTotal; // 可用IP总数 + private String description; // 描述信息 + + private List ipCfgs; // 地址池IP信息 + + @SerializedName("cfgId") + private Integer compileId; + + public String getIndexTable() { + return indexTable; + } + public void setIndexTable(String indexTable) { + this.indexTable = indexTable; + } + public Integer getAddrPoolId() { + return addrPoolId; + } + public void setAddrPoolId(Integer addrPoolId) { + this.addrPoolId = addrPoolId; + } + public String getAddrPoolName() { + return addrPoolName; + } + public void setAddrPoolName(String addrPoolName) { + this.addrPoolName = addrPoolName; + } + public Integer getIpTotal() { + return ipTotal; + } + public void setIpTotal(Integer ipTotal) { + this.ipTotal = ipTotal; + } + public Integer getAvailableIpTotal() { + return availableIpTotal; + } + public void setAvailableIpTotal(Integer availableIpTotal) { + this.availableIpTotal = availableIpTotal; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public List getIpCfgs() { + return ipCfgs; + } + public void setIpCfgs(List ipCfgs) { + this.ipCfgs = ipCfgs; + } + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + + +} diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java new file mode 100644 index 000000000..3d76f6f8e --- /dev/null +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/IpAddrPoolController.java @@ -0,0 +1,163 @@ +package com.nis.web.controller.configuration.maintenance; + +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +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.ResponseBody; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.nis.domain.Page; +import com.nis.domain.basics.PolicyGroupInfo; +import com.nis.domain.configuration.IpAddrPoolCfg; +import com.nis.domain.configuration.IpMultiplexPoolCfg; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.StringUtil; +import com.nis.web.controller.BaseController; +import com.nis.web.service.configuration.IpAddrPoolCfgService; + + +/** + * IP复用地址池配置 + * @author dell + * + */ +@Controller +@RequestMapping("${adminPath}/maintenance/ipMultiplexPoolCfg") +public class IpAddrPoolController extends BaseController{ + + @Autowired + private IpAddrPoolCfgService ipAddrPoolCfgService; + + @RequestMapping(value = {"/snatlist"}) + public String snatlist(Model model,HttpServletRequest request,HttpServletResponse response, + @ModelAttribute("cfg")IpAddrPoolCfg entity){ + Page page = ipAddrPoolCfgService.findPage(new Page(request, response,"r"), entity); + model.addAttribute("page", page); + initFormCondition(model,entity); + return "/cfg/maintenance/ipMultiplexPool/snatlist2"; + } + + @RequestMapping(value = {"/snatform"}) + @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) + public String snatfrom(Model model, String ids, HttpServletRequest request, HttpServletResponse response, + @ModelAttribute("cfg")IpAddrPoolCfg cfg){ + if(cfg == null){ + cfg=new IpAddrPoolCfg(); + } + if(!StringUtil.isEmpty(ids)){ + cfg = ipAddrPoolCfgService.getIpAddrPoolCfg(Long.valueOf(ids),null); + PolicyGroupInfo groupInfo = policyGroupInfoService.getById(cfg.getAddrPoolId()); + cfg.setAddrPoolName(groupInfo.getGroupName()); + initUpdateFormCondition(model, cfg); + }else{ + initFormCondition(model, cfg); + } + + model.addAttribute("_cfg", cfg); + return "/cfg/maintenance/ipMultiplexPool/snatform2"; + } + + @RequestMapping(value = {"/snatSaveOrUpdate"}) + @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) + public String snatSaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes, + @ModelAttribute("cfg")IpAddrPoolCfg cfg){ + try{ + // 保存地址池信息 -> policy_group_info + PolicyGroupInfo entity = new PolicyGroupInfo(); + if(cfg.getAddrPoolId() != null){ + entity.setGroupId(cfg.getAddrPoolId()); + } + entity.setGroupType(2); + entity.setGroupName(cfg.getAddrPoolName()); + entity.setDescription(cfg.getDescription()); + policyGroupInfoService.saveOrUpdate(entity); + cfg.setAddrPoolId(policyGroupInfoService.getGroupIdByGroupName(cfg.getAddrPoolName())); + + ipAddrPoolCfgService.saveOrUpdate(cfg, request, response); + addMessage(redirectAttributes,"success","save_success"); + }catch(Exception e) { + e.printStackTrace(); + if(e instanceof MaatConvertException) { + addMessage(redirectAttributes,"error", "request_service_failed"); + }else { + addMessage(redirectAttributes,"error", "save_failed"); + } + } + + return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+cfg.getFunctionId(); + } + + @RequestMapping(value = {"/snatAudit"}) + @RequiresPermissions(value={"ip:mulitiplex:pool:confirm"}) + public String snataudit(Integer isAudit,Integer isValid,String ids,Integer functionId,RedirectAttributes redirectAttributes) { + if(!StringUtil.isEmpty(ids)){ + String[] idArray = ids.split(","); + Date auditTime=new Date(); + for(String id :idArray){ + try { + ipAddrPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime); + } catch (Exception e) { + e.printStackTrace(); + logger.error("SNAT地址池配置下发失败:"+e.getMessage()); + if(e instanceof MaatConvertException) { + addMessage(redirectAttributes,"error", "request_service_failed"); + }else { + addMessage(redirectAttributes,"error", "audit_failed"); + } + } + } + + } + return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; + } + + @RequestMapping(value = {"/snatDelete"}) + @RequiresPermissions(value={"ip:mulitiplex:pool:config"}) + public String snatdelete(Integer isAudit,Integer isValid,String ids,Integer functionId,Model model,RedirectAttributes redirectAttributes + ,HttpServletRequest request,HttpServletResponse response){ + try{ + if(!StringUtil.isEmpty(ids)){ + // ?未被任何策略引用的地址池可删除 + ipAddrPoolCfgService.delete(isAudit,isValid,ids,functionId); + } + addMessage(redirectAttributes,"success","delete_success"); + }catch(Exception e){ + logger.error(e); + addMessage(redirectAttributes,"error","delete_failed"); + } + return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; + } + + /** + * 校验地址池 + * @param cfg + * @param request + * @param response + * @return + */ + @ResponseBody + @RequestMapping(value = {"/checkAddrPool"}) + public boolean checkAddrPool(IpAddrPoolCfg cfg, HttpServletRequest request, HttpServletResponse response){ + // 修改 + if(!StringUtil.isEmpty(cfg.getCfgId())){ + IpAddrPoolCfg poolCfg = ipAddrPoolCfgService.getCfgInfo(cfg); + if(poolCfg != null && poolCfg.getAddrPoolName().equals(cfg.getAddrPoolName())){ + return true; + } + } + cfg.setCfgId(null); + IpAddrPoolCfg poolCfg = ipAddrPoolCfgService.getCfgInfo(cfg); + if(poolCfg != null){ + return false; + } + return true; + } +} diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java index 31d3269f3..1f8bd42f5 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/IpMultiplexPoolCfgController.java @@ -142,7 +142,7 @@ public class IpMultiplexPoolCfgController extends BaseController { } } - @RequestMapping(value = {"/snatlist"}) + /*@RequestMapping(value = {"/snatlist"}) public String snatlist(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){ //查询时left join policyGroup Page page = ipMultiplexPoolCfgService.findPage(new Page(request, response,"r"), entity); @@ -236,7 +236,7 @@ public class IpMultiplexPoolCfgController extends BaseController { addMessage(redirectAttributes,"error","delete_failed"); } return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId; - } + }*/ /** * 校验IP是否已存在 diff --git a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java index 4176f3971..efeb90a0a 100644 --- a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java +++ b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.java @@ -20,4 +20,7 @@ public interface PolicyGroupInfoDao extends CrudDao { PolicyGroupInfo getInfoByAsnNo(PolicyGroupInfo policyGroupInfo); List getHasAreaPolicyGroups(int groupType); int insertBatch(List list); + + Integer getGroupIdByGroupName(String groupName); + PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml index 16a1929e7..055946bec 100644 --- a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml +++ b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml @@ -213,4 +213,37 @@ SELECT ga.group_id FROM group_area_info ga WHERE ga.is_valid != -1 ) + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java new file mode 100644 index 000000000..96f266959 --- /dev/null +++ b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.java @@ -0,0 +1,36 @@ +package com.nis.web.dao.configuration; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.nis.domain.configuration.BaseIpCfg; +import com.nis.domain.configuration.IpAddrPoolCfg; +import com.nis.web.dao.CrudDao; +import com.nis.web.dao.MyBatisDao; + +@MyBatisDao +public interface IpAddrPoolCfgDao extends CrudDao{ + + List findPage(IpAddrPoolCfg entity); + + List findList(@Param("cfgId")Long cfgId + ,@Param("isAudit")Integer isAudit + ,@Param("isValid")Integer isValid); + + + void saveAddrPoolCfg(IpAddrPoolCfg cfg); + + void updateAddrPoolCfg(IpAddrPoolCfg entity); + + void saveReuseIpCfgs(BaseIpCfg ipCfg); + + List getReuseIpCfgs(@Param("addrPoolId")Integer addrPoolId); + + void deleteReuseIpCfgs(@Param("addrPoolId")Integer addrPoolId); + + Integer getAddrPoolId(@Param("cfgId")Long cfgId); + + IpAddrPoolCfg getCfgInfo(IpAddrPoolCfg cfg); + +} diff --git a/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml new file mode 100644 index 000000000..b1d1a6149 --- /dev/null +++ b/src/main/java/com/nis/web/dao/configuration/IpAddrPoolCfgDao.xml @@ -0,0 +1,442 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + r.CFG_ID,r.ADDR_POOL_ID,r.IP_TOTAL,r.AVAILABLE_IP_TOTAL,r.ACTION,r.IS_VALID,r.IS_AUDIT, + r.CFG_REGION_CODE,r.CFG_TYPE,r.FUNCTION_ID,r.SERVICE_ID,r.COMPILE_ID,r.REQUEST_ID, + r.CLASSIFY,r.ATTRIBUTE,r.LABLE, + r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, + r.DESCRIPTION,r.CANCEL_REQUEST_ID,r.IS_AREA_EFFECTIVE,r.AREA_EFFECTIVE_IDS, + r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5 + + + + a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port + ,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address + ,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id + ,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id, + a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable + ,a.area_effective_ids,a.function_id,a.cfg_region_code + + + + + + + + + + INSERT INTO ip_reuse_ip_cfg ( + CFG_DESC, + 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, + function_id, + ip_type, + src_ip_address, + ip_pattern, + port_pattern, + src_port, + protocol, + protocol_id, + direction, + dest_port, + dest_ip_address, + cfg_type, + cfg_region_code, + user_region1, + user_region2, + user_region3, + user_region4, + user_region5 + )VALUES ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{ipType,jdbcType=INTEGER}, + #{srcIpAddress,jdbcType=VARCHAR}, + #{ipPattern,jdbcType=INTEGER}, + #{portPattern,jdbcType=INTEGER}, + #{srcPort,jdbcType=VARCHAR}, + #{protocol,jdbcType=INTEGER}, + #{protocolId,jdbcType=INTEGER}, + #{direction,jdbcType=INTEGER}, + #{destPort,jdbcType=VARCHAR}, + #{destIpAddress,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{userRegion1,jdbcType=VARCHAR}, + #{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR}, + #{userRegion4,jdbcType=VARCHAR}, + #{userRegion5,jdbcType=VARCHAR} + ) + + + + INSERT INTO ip_reuse_addr_pool( + addr_pool_id, + addr_pool_name, + ip_total, + available_ip_total, + action, + is_valid, + is_audit, + cfg_type, + cfg_region_code, + function_id, + service_id, + compile_id, + is_area_effective, + area_effective_ids, + request_id, + classify, + attribute, + lable, + creator_id, + create_time, + editor_id, + edit_time, + auditor_id, + audit_time, + description, + user_region1, + user_region2, + user_region3, + user_region4, + user_region5 + )VALUES ( + #{addrPoolId,jdbcType=INTEGER}, + #{addrPoolName,jdbcType=VARCHAR}, + #{ipTotal,jdbcType=INTEGER}, + #{availableIpTotal,jdbcType=INTEGER}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{functionId,jdbcType=INTEGER}, + #{serviceId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{requestId,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{description,jdbcType=VARCHAR}, + #{userRegion1,jdbcType=VARCHAR}, + #{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR}, + #{userRegion4,jdbcType=VARCHAR}, + #{userRegion5,jdbcType=VARCHAR} + ) + + + + + + + + DELETE FROM ip_reuse_ip_cfg WHERE user_region1 = #{addrPoolId} + + + + update ip_reuse_addr_pool + + + + addr_pool_id = #{addrPoolId,jdbcType=INTEGER}, + + + ip_total = #{ipTotal,jdbcType=INTEGER}, + + + available_ip_total = #{availableIpTotal,jdbcType=INTEGER}, + + + action = #{action,jdbcType=INTEGER}, + + + is_valid = #{isValid,jdbcType=INTEGER}, + + + is_audit = #{isAudit,jdbcType=INTEGER}, + + + creator_id = #{creatorId,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + editor_id = #{editorId,jdbcType=INTEGER}, + + + edit_time = #{editTime,jdbcType=TIMESTAMP}, + + + auditor_id = #{auditorId,jdbcType=INTEGER}, + + + audit_time = #{auditTime,jdbcType=TIMESTAMP}, + + + service_id = #{serviceId,jdbcType=INTEGER}, + + + request_id = #{requestId,jdbcType=INTEGER}, + + + is_area_effective = #{isAreaEffective,jdbcType=INTEGER}, + + + classify = #{classify,jdbcType=VARCHAR}, + + + attribute = #{attribute,jdbcType=VARCHAR}, + + + lable = #{lable,jdbcType=VARCHAR}, + + + area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR}, + + + function_id = #{functionId,jdbcType=INTEGER}, + + + description = #{description,jdbcType=VARCHAR}, + + + + where cfg_id = #{cfgId,jdbcType=BIGINT} + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.java b/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.java index d82bdf849..7382ac981 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.java @@ -4,6 +4,7 @@ import java.util.List; import org.apache.ibatis.annotations.Param; +import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.IpMultiplexPoolCfg; import com.nis.web.dao.CrudDao; import com.nis.web.dao.MyBatisDao; @@ -19,4 +20,7 @@ public interface IpMultiplexPoolCfgDao extends CrudDao { List getIspByGroupId(Integer groupId); + // 保存IP信息 + void saveReuseIps(BaseIpCfg ipCfg); + } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml index 49b47a412..019981f1b 100644 --- a/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/IpMultiplexPoolCfgDao.xml @@ -44,7 +44,50 @@ ,r.is_area_effective,r.classify,r.attribute,r.lable ,r.area_effective_ids,r.function_id,r.cfg_region_code,r.compile_id - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + r.CFG_ID,r.ADDR_POOL_ID,r.IP_TOTAL,r.AVAILABLE_IP_TOTAL,r.ACTION,r.IS_VALID,r.IS_AUDIT, + r.CFG_REGION_CODE,r.CFG_TYPE,r.FUNCTION_ID,r.SERVICE_ID,r.COMPILE_ID,r.REQUEST_ID, + r.CLASSIFY,r.ATTRIBUTE,r.LABLE,r.IS_AREA_EFFECTIVE,r.AREA_EFFECTIVE_IDS, + r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, + r.DESCRIPTION,r.CANCEL_REQUEST_ID, + r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5 + + + + + insert into ip_reuse_ip_cfg ( + CFG_DESC, + 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, + function_id, + ip_type, + src_ip_address, + ip_pattern, + port_pattern, + src_port, + protocol, + protocol_id, + direction, + dest_port, + dest_ip_address, + cfg_type, + cfg_region_code, + user_region1, + user_region2, + user_region3, + user_region4, + user_region5 + )values ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{ipType,jdbcType=INTEGER}, + #{srcIpAddress,jdbcType=VARCHAR}, + #{ipPattern,jdbcType=INTEGER}, + #{portPattern,jdbcType=INTEGER}, + #{srcPort,jdbcType=VARCHAR}, + #{protocol,jdbcType=INTEGER}, + #{protocolId,jdbcType=INTEGER}, + #{direction,jdbcType=INTEGER}, + #{destPort,jdbcType=VARCHAR}, + #{destIpAddress,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{userRegion1,jdbcType=VARCHAR}, + #{userRegion2,jdbcType=VARCHAR}, + #{userRegion3,jdbcType=VARCHAR}, + #{userRegion4,jdbcType=VARCHAR}, + #{userRegion5,jdbcType=VARCHAR} + ) + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/configuration/UserManageDao.java b/src/main/java/com/nis/web/dao/configuration/UserManageDao.java index 55eea2025..11f5c2d50 100644 --- a/src/main/java/com/nis/web/dao/configuration/UserManageDao.java +++ b/src/main/java/com/nis/web/dao/configuration/UserManageDao.java @@ -15,4 +15,6 @@ public interface UserManageDao extends CrudDao{ UserManage getUserByLoginName(@Param("userName") String userName); List findList(UserManage entity); UserManage getUserById(@Param("id") String id); + + List findUsers(); } diff --git a/src/main/java/com/nis/web/dao/configuration/UserManageDao.xml b/src/main/java/com/nis/web/dao/configuration/UserManageDao.xml index cedffc199..077d4a12e 100644 --- a/src/main/java/com/nis/web/dao/configuration/UserManageDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/UserManageDao.xml @@ -151,4 +151,10 @@ from user_manage r where r.is_valid !=-1 and r.id=#{id} + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java b/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java index f0d46a0a7..6a1caf43f 100644 --- a/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java +++ b/src/main/java/com/nis/web/service/basics/PolicyGroupInfoService.java @@ -160,4 +160,13 @@ public class PolicyGroupInfoService extends BaseService{ public List getHasAreaPolicyGroups(int groupType) { return policyGroupInfoDao.getHasAreaPolicyGroups(groupType); } + + public Integer getGroupIdByGroupName(String groupName){ + return policyGroupInfoDao.getGroupIdByGroupName(groupName); + } + + public PolicyGroupInfo getGroupInfo(PolicyGroupInfo policyGroupInfo){ + return policyGroupInfoDao.getGroupInfo(policyGroupInfo); + } + } diff --git a/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java b/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java new file mode 100644 index 000000000..8320a748b --- /dev/null +++ b/src/main/java/com/nis/web/service/configuration/IpAddrPoolCfgService.java @@ -0,0 +1,285 @@ +package com.nis.web.service.configuration; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.beust.jcommander.internal.Lists; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.nis.domain.Page; +import com.nis.domain.callback.InlineIp; +import com.nis.domain.callback.IpAddrPool; +import com.nis.domain.configuration.BaseIpCfg; +import com.nis.domain.configuration.IpAddrPoolCfg; +import com.nis.domain.configuration.IpMultiplexPoolCfg; +import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.maat.ToMaatResult; +import com.nis.domain.maat.MaatCfg.IpCfg; +import com.nis.exceptions.MaatConvertException; +import com.nis.util.ConfigServiceUtil; +import com.nis.util.StringUtils; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.dao.configuration.IpAddrPoolCfgDao; +import com.nis.web.security.UserUtils; +import com.nis.web.service.BaseService; +import com.nis.web.service.SpringContextHolder; +import com.nis.web.service.basics.PolicyGroupInfoService; + +import jersey.repackaged.com.google.common.collect.Maps; + +@Service +public class IpAddrPoolCfgService extends BaseService{ + + @Autowired + private IpAddrPoolCfgDao ipAddrPoolCfgDao; + + /** + * 列表分页查询 + * @param page + * @param entity + * @return + */ + public Page findPage(Page page, IpAddrPoolCfg entity) { + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.setPage(page); + List list=ipAddrPoolCfgDao.findPage(entity); + page.setList(list); + return page; + } + + /** + * 获取数据跳转表单 + * @param id + * @param isValid + * @return + */ + public IpAddrPoolCfg getIpAddrPoolCfg(Long id, Integer isValid) { + // 1.获取地址池配置信息 + List list=ipAddrPoolCfgDao.findList(id,isValid,null); + IpAddrPoolCfg addrPoolCfg=null; + if(list != null && list.size()>0){ + addrPoolCfg=list.get(0); + } + + // 2.获取地址池内IP信息 + List ipCfgs = ipAddrPoolCfgDao.getReuseIpCfgs(addrPoolCfg.getAddrPoolId()); + if(ipCfgs != null && ipCfgs.size()>0){ + addrPoolCfg.setIpCfgs(ipCfgs); + } + return addrPoolCfg; + } + + /** + * 更新配置数据 + * @param res + * @param req + * @param cfg + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void saveOrUpdate(IpAddrPoolCfg entity, HttpServletRequest req, HttpServletResponse res) { + + // 可用IP数(需调用CGI接口查询) + /*Map params = new HashMap(); + params.put("cmd", "IpNumGet"); + params.put("addr_pool_id", entity.getAddrPoolId()); + try { + String resJson = HttpClientUtil.getMsg("", params, req); + } catch (Exception e1) { + e1.printStackTrace(); + }*/ + + // 1.更新配置信息 + Date time = new Date(); + entity.setIsValid(0); + entity.setIsAudit(0); + setAreaEffectiveIds(entity); + entity.setIpTotal(entity.getIpCfgs().size()); + if(entity.getCfgId()==null){ + entity.initDefaultValue(); + entity.setCreateTime(time); + entity.setCreatorId(UserUtils.getUser().getId()); + //调用服务接口获取compileId + try { + List compileIds = ConfigServiceUtil.getId(1,1); + if(compileIds != null && compileIds.size() > 0 ){ + entity.setCompileId(compileIds.get(0)); + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + ipAddrPoolCfgDao.saveAddrPoolCfg(entity); + + }else{ + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(time); + ipAddrPoolCfgDao.updateAddrPoolCfg(entity); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + } + ipAddrPoolCfgDao.deleteReuseIpCfgs(entity.getAddrPoolId()); + + // 2.保存IP信息 -> ip_reuse_ip_cfg(该表user_region1字段 存放 地址池ID) + for (BaseIpCfg IpCfg : entity.getIpCfgs()) { + BeanUtils.copyProperties(entity, IpCfg); + IpCfg.setUserRegion1(entity.getAddrPoolId()+""); + ipAddrPoolCfgDao.saveReuseIpCfgs(IpCfg); + } + + } + + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void delete(Integer isAudit, Integer isValid, String ids, Integer functionId) { + String[] idArray = ids.split(","); + String groupIds = ""; + for(String id :idArray){ + IpAddrPoolCfg entity = new IpAddrPoolCfg(); + entity.setCfgId(Long.valueOf(id)); + entity.setFunctionId(functionId); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + Integer addrPoolId = ipAddrPoolCfgDao.getAddrPoolId(entity.getCfgId()); + groupIds += addrPoolId+","; + ipAddrPoolCfgDao.deleteReuseIpCfgs(addrPoolId); + + ipAddrPoolCfgDao.updateAddrPoolCfg(entity); + + } + PolicyGroupInfoService groupInfoService = SpringContextHolder.getBean(PolicyGroupInfoService.class); + groupInfoService.deldete(groupIds, isValid); + } + + /** + * 配置审核 + * @param isAudit + * @param isValid + * @param functionId + * @param id + * @param auditTime + */ + @Transactional(readOnly=false,rollbackFor=RuntimeException.class) + public void audit(Integer isAudit, Integer isValid, Integer functionId, String id, Date auditTime) { + IpAddrPoolCfg cfg=new IpAddrPoolCfg(); + cfg.setCfgId(Long.valueOf(id)); + cfg.setIsValid(isValid); + cfg.setIsAudit(isAudit); + cfg.setAuditorId(UserUtils.getUser().getId()); + cfg.setAuditTime(auditTime); + ipAddrPoolCfgDao.updateAddrPoolCfg(cfg);// 更新配置审核状态 + + cfg=getIpAddrPoolCfg(cfg.getCfgId(), null); + String json=""; + if(cfg.getIsAudit()==1){ + List resStrategyList=new ArrayList(); + for(BaseIpCfg ipcfg : cfg.getIpCfgs()) { + IpAddrPool ip = new IpAddrPool(); + BeanUtils.copyProperties(cfg, ipcfg, new String[]{"cfgId"}); + List cfgs = BaseService.ipConvert(new IpCfg(), ipcfg); + if (cfgs.size() > 1) { + throw new RuntimeException("CallBack IP did not support IP range!"); + } + IpCfg c = cfgs.get(0); + ip.setRegionId(ipcfg.getCompileId()); + //ip.setGroupId(ipcfg.getCompileId()); + + ip.setAddrType(ipcfg.getIpType()); + ip.setSrcIp(c.getSrcIp()); + ip.setMaskSrcIp(c.getSrcIpMask()); + ip.setSrcPort(c.getSrcPort()); + ip.setMaskSrcPort(c.getSrcPortMask()); + ip.setDstIp(c.getDstIp()); + ip.setMaskDstIp(c.getDstIpMask()); + ip.setDstPort(c.getDstPort()); + ip.setMaskDstPort(c.getDstPortMask()); + ip.setProtocol(ipcfg.getProtocol()); + ip.setDirection(ipcfg.getDirection()); + + ip.setIsValid(cfg.getIsValid()); + ip.setAction(ipcfg.getAction()); + ip.setService(ipcfg.getServiceId()); + ip.setAddrPoolId(cfg.getAddrPoolId()); + ip.setOpTime(auditTime); + ip.setAreaEffectiveIds(cfg.getAreaEffectiveIds());//添加区域管控 + + resStrategyList.add(ip); + } + //调用服务接口下发配置数据 + json=gsonToJson(resStrategyList); + logger.info("SNAT地址池配置下发配置参数:"+json); + //调用服务接口下发配置 + try { + ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); + if(result!=null){ + logger.info("SNAT地址池配置下发响应信息:"+result.getMsg()); + } + } catch (Exception e) { + logger.error("SNAT地址池配置下发失败",e); + throw e; + } + + }else if(cfg.getIsAudit()==3){ + List resStrategyList=new ArrayList(); + for(BaseIpCfg ipcfg : cfg.getIpCfgs()) { + IpAddrPool ip = new IpAddrPool(); + BeanUtils.copyProperties(cfg, ipcfg, new String[]{"cfgId"}); + List cfgs = BaseService.ipConvert(new IpCfg(), ipcfg); + if (cfgs.size() > 1) { + throw new RuntimeException("CallBack IP did not support IP range!"); + } + IpCfg c = cfgs.get(0); + ip.setRegionId(ipcfg.getCompileId()); + ip.setAddrType(ipcfg.getIpType()); + ip.setSrcIp(c.getSrcIp()); + ip.setMaskSrcIp(c.getSrcIpMask()); + ip.setSrcPort(c.getSrcPort()); + ip.setMaskSrcPort(c.getSrcPortMask()); + ip.setDstIp(c.getDstIp()); + ip.setMaskDstIp(c.getDstIpMask()); + ip.setDstPort(c.getDstPort()); + ip.setMaskDstPort(c.getDstPortMask()); + ip.setProtocol(ipcfg.getProtocol()); + ip.setDirection(ipcfg.getDirection()); + ip.setIsValid(cfg.getIsValid()); + ip.setAction(ipcfg.getAction()); + ip.setService(ipcfg.getServiceId()); + ip.setAddrPoolId(cfg.getAddrPoolId()); + ip.setOpTime(auditTime); + ip.setAreaEffectiveIds(cfg.getAreaEffectiveIds()); + resStrategyList.add(ip); + } + //调用服务接口取消配置 + json=gsonToJson(resStrategyList); + logger.info("SNAT地址池配置配置参数:"+json); + //调用服务接口取消配置 + try { + ToMaatResult result = ConfigServiceUtil.put(json, 2); + logger.info("SNAT地址池配置响应信息:"+result.getMsg()); + } catch (Exception e) { + e.printStackTrace(); + logger.info("SNAT地址池配置配置失败"); + throw e; + } + + } + + } + + public IpAddrPoolCfg getCfgInfo(IpAddrPoolCfg cfg) { + return ipAddrPoolCfgDao.getCfgInfo(cfg); + } + +} diff --git a/src/main/java/com/nis/web/service/configuration/UserManageService.java b/src/main/java/com/nis/web/service/configuration/UserManageService.java index 3665a8a70..6da3f6346 100644 --- a/src/main/java/com/nis/web/service/configuration/UserManageService.java +++ b/src/main/java/com/nis/web/service/configuration/UserManageService.java @@ -181,4 +181,7 @@ public class UserManageService extends BaseService{ } } } + public List findUsers() { + return userManageDao.findUsers(); + } } diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 380b3f25b..b50e49b3a 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1330,4 +1330,8 @@ outgoing_broadcast_total_size=Outgoing Broadcast Total Size incoming_unicast_packets=Incoming Unicast_packets incoming_unicast_total_size=Incoming Unicast Total Size incoming_broadcast_packets=Incoming Broadcast Packets -incoming_broadcast_total_size=Incoming Broadcast Total Size \ No newline at end of file +incoming_broadcast_total_size=Incoming Broadcast Total Size +address_pool=Address Pool +ip_total=IP Total +available_ip_total=Available IP Total +address_pool_id=Address Pool ID \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index c10472627..17460b785 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1330,4 +1330,8 @@ outgoing_broadcast_total_size=Outgoing Broadcast Total Size incoming_unicast_packets=Incoming Unicast_packets incoming_unicast_total_size=Incoming Unicast Total Size incoming_broadcast_packets=Incoming Broadcast Packets -incoming_broadcast_total_size=Incoming Broadcast Total Size \ No newline at end of file +incoming_broadcast_total_size=Incoming Broadcast Total Size +address_pool=Address Pool +ip_total=IP Total +available_ip_total=Available IP Total +address_pool_id=Address Pool ID \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 477054eee..b65141967 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1326,4 +1326,8 @@ outgoing_broadcast_total_size=\u8F93\u51FA\u5E7F\u64AD\u603B\u5927\u5C0F incoming_unicast_packets=\u8F93\u5165\u5355\u5305 incoming_unicast_total_size=\u8F93\u5165\u5355\u64AD\u603B\u5927\u5C0F incoming_broadcast_packets=\u8F93\u5165\u5E7F\u64AD\u6570\u636E\u5305 -incoming_broadcast_total_size=\u8F93\u5165\u5E7F\u64AD\u603B\u5927\u5C0F \ No newline at end of file +incoming_broadcast_total_size=\u8F93\u5165\u5E7F\u64AD\u603B\u5927\u5C0F +address_pool=\u5730\u5740\u6C60 +ip_total=IP\u603B\u6570 +available_ip_total=\u53EF\u7528IP\u6570 +address_pool_id=\u5730\u5740\u6C60ID \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatform2.jsp b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatform2.jsp new file mode 100644 index 000000000..3b3e7b5b1 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatform2.jsp @@ -0,0 +1,491 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+

+ +

+
+
+
+
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+ + +
+
+
+
+ +
+
+ +
+ +
+
+
+
+ +
hidden"> + +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+ + + + +
+
+
+
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ + +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+ + + + +
+
+
+
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+ +
+ <%@include file="/WEB-INF/include/form/areaInfo.jsp"%> +
+ <%@include file="/WEB-INF/include/form/basicInfo.jsp" %> +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp new file mode 100644 index 000000000..425f8e27f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/maintenance/ipMultiplexPool/snatlist2.jsp @@ -0,0 +1,439 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+ + + + + + + + + + + +
+
+ + + + + + + <%-- --%> + +
+ +
+
+
+ + + + + +
+ + +
+ + + + + + + + + + + +
+
+
+
+ + + +
+
+ + + + <%-- --%> + + +
+ + +
+
+ href="javascript:;"> + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+ + +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
${cfg.addrPoolId } + + ${fns:abbr(cfg.addrPoolName,20)} + + ${cfg.ipTotal }${cfg.availableIpTotal } + + + + + + + + + + + + + + + + + + + + + + + + ${cfg.requestName } + + + + + + + + + + + + + + + ${fns:abbr(classify,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(attribute,20)} + + + + + + + + + + + + + + + + + ${fns:abbr(lableInfo,20)} + + + + + ${cfg.creatorName }${cfg.editorName }${cfg.auditorName }
+
${page}
+
+
+
+
+
+ + +<%@include file="/WEB-INF/include/excel/importModal.jsp" %> + + \ No newline at end of file diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js index d23919f22..e46ce9b8e 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js @@ -924,18 +924,18 @@ var fillIp=function (ip){ } return ip; } -// snat复用地址池ip唯一 -jQuery.validator.addMethod("ipUnique",function(value, element) { +// 地址池校验 +jQuery.validator.addMethod("addrPoolUnique",function(value, element) { var ctx=$(element).attr("ctx"); var cfgId= $("[name='cfgId']").val(); var functionId= $("[name='functionId']").val(); - var url = ctx+"/maintenance/ipMultiplexPoolCfg/checkIp"; + var url = ctx+"/maintenance/ipMultiplexPoolCfg/checkAddrPool"; var result = true; $.ajax({ type:'post', async:false, url: url, - data:{"cfgId":cfgId,"functionId":functionId,"destIpAddress":value}, + data:{"cfgId":cfgId,"functionId":functionId,"addrPoolName":value}, success:function(data){ result = data; } diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js index 7b5654630..c22344565 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js @@ -76,7 +76,7 @@ protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0", protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0", netAddress:"The class C type of IP addresses must has the same network number bit field", - ipUnique:"IP already exists.", + addrPoolUnique:"Address Pool already exists.", asnNoUnique:"ASN already exists.", areaUnique:"Area already exists." }); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js index fc35517de..5b562d3bd 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js @@ -76,7 +76,7 @@ protocolPort:"Если порт больше 0, необходимо выбрать протокол TCP или протокол UDP", protocolPort1:"Только при выборе протокола TCP или протокола UDP порт может быть больше 0", netAddress:"Тип IP-адресов класса C должен иметь один и тот же номер сети бит поля.", - ipUnique:"IP уже существует.", + addrPoolUnique:"Address Pool уже существует.", asnNoUnique:"ASN уже существует.", areaUnique:"Регион уже существует." }); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js index 27b0cbec0..4285164e7 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js @@ -76,7 +76,7 @@ protocolPort:"端口大于0时必须选择TCP协议或者UDP协议", protocolPort1:"只有tcp,udp协议端口号可以不为0", netAddress:"C类IP地址网络位必须相同", - ipUnique:"IP已存在", + addrPoolUnique:"地址池已存在", asnNoUnique:"ASN号已存在", areaUnique:"该区域已存在" }); diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index ace13807a..bdab68fc1 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -33,7 +33,7 @@ $(function(){ $("form input[name$='cfgKeywords']").attr("maxlength","1024"); $("form input[class~='domainCheck']").attr("maxlength","1024"); //截取过长的文字 使用id选择器;例如:tab对象->tr->td对象. 排除日志table .logTb - $("#contentTable").find("td").each(function(i,element){ + $("#contentTable").find("td").not(":has(a)").each(function(i,element){ //获取td当前对象的文本,如果长度大于25; if(!$(element).find(".tooltips").length>0){ var tdclass= $(this).attr("class");//no_substr 不进行截取