IP复用地址池配置
拆分为两个子菜单:SNAT地址池管理和DNAT地址池管理
This commit is contained in:
@@ -27,7 +27,7 @@ public class IpMultiplexPoolCfg extends BaseCfg<IpMultiplexPoolCfg> {
|
||||
private Integer protocol;
|
||||
@Expose
|
||||
@SerializedName("ip")
|
||||
private String srcIpAddress;
|
||||
private String destIpAddress;
|
||||
@Expose
|
||||
private String port;
|
||||
@Expose
|
||||
@@ -58,11 +58,12 @@ public class IpMultiplexPoolCfg extends BaseCfg<IpMultiplexPoolCfg> {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
public String getPort() {
|
||||
return port;
|
||||
|
||||
@@ -47,9 +47,8 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
}
|
||||
|
||||
//查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(2);
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(3);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/ipMultiplexPool/form";
|
||||
}
|
||||
@@ -92,7 +91,6 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes,"delete_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@@ -125,4 +123,89 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatlist"})
|
||||
public String snatlist(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")IpMultiplexPoolCfg entity){
|
||||
//查询时left join policyGroup
|
||||
Page<IpMultiplexPoolCfg> page = ipMultiplexPoolCfgService.findPage(new Page<IpMultiplexPoolCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,entity);
|
||||
return "/cfg/maintenance/ipMultiplexPool/snatlist";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatform"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatfrom(Model model,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
String ids,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
if(cfg == null){
|
||||
cfg=new IpMultiplexPoolCfg();
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
initFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
|
||||
//查询ip复用地址池配置的policyGroup列表
|
||||
List<PolicyGroupInfo> policyGroups=policyGroupInfoService.findPolicyGroupInfosByType(2);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/maintenance/ipMultiplexPool/snatform";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/snatsaveOrUpdate"})
|
||||
@RequiresPermissions(value={"ip:mulitiplex:pool:config"})
|
||||
public String snatsaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"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 {
|
||||
ipMultiplexPoolCfgService.audit(isAudit,isValid,functionId,id,auditTime);
|
||||
} catch (MaatConvertException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("SNAT地址池管理配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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)){
|
||||
ipMultiplexPoolCfgService.delete(isAudit,isValid,ids,functionId);
|
||||
}
|
||||
addMessage(redirectAttributes,"delete_success");
|
||||
}catch(Exception e){
|
||||
addMessage(redirectAttributes,"delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
|
||||
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="ip" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="ip" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="port" property="port" jdbcType="VARCHAR" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="user_region" property="userRegion" jdbcType="VARCHAR" />
|
||||
@@ -72,8 +72,8 @@
|
||||
<if test="cfgDesc != null and cfgDesc != ''">
|
||||
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress != ''">
|
||||
AND r.ip like concat(concat('%',#{srcIpAddress,jdbcType=VARCHAR}),'%')
|
||||
<if test="destIpAddress != null and destIpAddress != ''">
|
||||
AND r.ip like concat(concat('%',#{destIpAddress,jdbcType=VARCHAR}),'%')
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
AND a.group_name like concat(concat('%',#{groupName,jdbcType=VARCHAR}),'%')
|
||||
@@ -204,7 +204,7 @@
|
||||
#{functionId,jdbcType=INTEGER},
|
||||
#{ipType,jdbcType=INTEGER},
|
||||
#{protocol,jdbcType=INTEGER},
|
||||
#{srcIpAddress,jdbcType=VARCHAR},
|
||||
#{destIpAddress,jdbcType=VARCHAR},
|
||||
#{port,jdbcType=VARCHAR},
|
||||
#{direction,jdbcType=INTEGER},
|
||||
#{userRegion,jdbcType=VARCHAR},
|
||||
@@ -277,8 +277,8 @@
|
||||
<if test="protocol != null" >
|
||||
protocol = #{protocol,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="srcIpAddress != null and srcIpAddress!=''" >
|
||||
ip = #{srcIpAddress,jdbcType=VARCHAR},
|
||||
<if test="destIpAddress != null and destIpAddress!=''" >
|
||||
ip = #{destIpAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="port != null and port!=''" >
|
||||
port = #{port,jdbcType=VARCHAR},
|
||||
|
||||
Reference in New Issue
Block a user