S/DNAT复用策略配置修改.
This commit is contained in:
@@ -144,6 +144,8 @@ public class IpMultiplexController extends CommonController {
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateSnat"})
|
||||
public String saveOrUpdateSnat(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
// 设置生效区域信息
|
||||
groupAreaService.setAreaEffective(cfg);
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/snatPolicyList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@@ -191,6 +193,8 @@ public class IpMultiplexController extends CommonController {
|
||||
|
||||
@RequestMapping(value = {"/saveOrUpdateDnat"})
|
||||
public String saveOrUpdateDnat(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
// 设置生效区域信息
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/manipulation/ipmulitiplex/dnatPolicyList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public interface IpMultiplexPoolCfgDao extends CrudDao<IpMultiplexPoolCfg> {
|
||||
|
||||
IpMultiplexPoolCfg getCfgInfo(IpMultiplexPoolCfg cfg);
|
||||
|
||||
String getIspByGroupId(Integer groupId);
|
||||
List<IpMultiplexPoolCfg> getIspByGroupId(Integer groupId);
|
||||
|
||||
}
|
||||
@@ -328,13 +328,13 @@
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="getIspByGroupId" resultType="java.lang.String">
|
||||
<select id="getIspByGroupId" resultMap="IpMultiplexPoolCfgMap">
|
||||
SELECT
|
||||
area_effective_ids
|
||||
<include refid="IpMultiplexPoolCfgColumns"/>
|
||||
FROM
|
||||
ip_multiplex_pool_cfg
|
||||
ip_multiplex_pool_cfg r
|
||||
WHERE
|
||||
policy_group = #{groupId} AND is_valid != -1
|
||||
r.POLICY_GROUP = #{groupId} AND r.IS_VALID != -1
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -85,21 +85,49 @@ public class GroupAreaService extends BaseService{
|
||||
return policyGroups;
|
||||
}
|
||||
|
||||
// SNAT策略 组织生效区域信息
|
||||
public void setAreaCodeByGroupId(IpPortCfg cfg){
|
||||
Integer areaCode = groupAreaDao.getAreaCodeByGroupId(cfg.getDnsStrategyId());
|
||||
cfg.setAreaEffectiveIds(areaCode+"");
|
||||
}
|
||||
|
||||
// snat策略 设置生效区域信息
|
||||
public void setAreaEffective(IpPortCfg cfg) {
|
||||
String areaEffectiveIds = "";
|
||||
if(cfg.getDnsStrategyId() != 0){// 已选择分组
|
||||
// 1.获取该分组的省份信息
|
||||
Integer areaCode = groupAreaDao.getAreaCodeByGroupId(cfg.getDnsStrategyId());
|
||||
// 1.设置省份信息
|
||||
this.setAreaCodeByGroupId(cfg);
|
||||
areaEffectiveIds = cfg.getAreaEffectiveIds();
|
||||
|
||||
// 2.获取该分组下的IP复用地址池配置的ISP
|
||||
IpMultiplexPoolCfgService poolCfgService = SpringContextHolder.getBean(IpMultiplexPoolCfgService.class);
|
||||
String ispInfo = poolCfgService.getIspByGroupId(cfg.getDnsStrategyId());
|
||||
if(ispInfo.indexOf(":") != -1){
|
||||
ispInfo = ispInfo.substring(ispInfo.indexOf(":"));
|
||||
List<IpMultiplexPoolCfg> cfgsList = poolCfgService.getIspByGroupId(cfg.getDnsStrategyId());
|
||||
String newAreaEffectiveIds = "";
|
||||
List<String> ispList = new ArrayList<>();
|
||||
if(cfgsList.size() != 0){
|
||||
for (IpMultiplexPoolCfg poolCfg : cfgsList) {
|
||||
String areaIsp = poolCfg.getAreaEffectiveIds();
|
||||
if(areaIsp.contains(":")){
|
||||
areaIsp = areaIsp.substring(areaIsp.indexOf(":")+1);
|
||||
}
|
||||
ispList.add(areaIsp);
|
||||
}
|
||||
}
|
||||
areaEffectiveIds = areaCode + ispInfo;
|
||||
// 3.组织格式
|
||||
if(ispList.size() != 0){
|
||||
for (int i = 0; i < ispList.size(); i++) {
|
||||
if(i < ispList.size()-1){
|
||||
newAreaEffectiveIds += cfg.getAreaEffectiveIds()+":"+ispList.get(i)+",";
|
||||
}else{
|
||||
newAreaEffectiveIds += cfg.getAreaEffectiveIds()+":"+ispList.get(i);
|
||||
}
|
||||
}
|
||||
areaEffectiveIds = newAreaEffectiveIds;
|
||||
}
|
||||
}else{
|
||||
areaEffectiveIds = cfg.getAreaEffectiveIds();
|
||||
}
|
||||
cfg.setAreaEffectiveIds(areaEffectiveIds);
|
||||
|
||||
}
|
||||
|
||||
// IP复用地址池 设置省份信息
|
||||
|
||||
@@ -181,7 +181,7 @@ public class IpMultiplexPoolCfgService extends BaseService{
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public String getIspByGroupId(Integer groupId){
|
||||
public List<IpMultiplexPoolCfg> getIspByGroupId(Integer groupId){
|
||||
return ipMultiplexStrategyDao.getIspByGroupId(groupId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ $(function(){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
//loading('<spring:message code="onloading"/>');
|
||||
loading('<spring:message code="onloading"/>');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox"
|
||||
@@ -51,7 +51,9 @@ $(function(){
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" name="isAreaEffective" value="0">
|
||||
<input type="hidden" name="isAreaEffective" value="1">
|
||||
<input type="hidden" name="areaType" value="1">
|
||||
|
||||
<c:if test="${fn:length(serviceList)==1}">
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
<input type="hidden" name="action" serviceId="${service.serviceId }" protocolId="${service.protocolId }" regionCode="${service.regionCode}" value="${service.action }">
|
||||
@@ -167,7 +169,7 @@ $(function(){
|
||||
</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"/></label>
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required ipCheck" type="text" name="destIpAddress" value="${_cfg.destIpAddress}">
|
||||
</div>
|
||||
@@ -242,7 +244,7 @@ $(function(){
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="port"/></label>
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_port"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required portCheck" type="text" name="destPort" value="${_cfg.destPort}">
|
||||
</div>
|
||||
|
||||
@@ -274,8 +274,9 @@
|
||||
<th class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
|
||||
<th class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
|
||||
<th class="sort-column a.action"><spring:message code="block_type"/></th>
|
||||
<th><spring:message code="ip"/></th>
|
||||
<th><spring:message code="port"/></th>
|
||||
<th><spring:message code="group"/></th>
|
||||
<th><spring:message code="server_ip"/></th>
|
||||
<th><spring:message code="server_port"/></th>
|
||||
<th><spring:message code="protocol"/></th>
|
||||
<%-- <th><spring:message code="do_log"/></th> --%>
|
||||
<%-- <th><spring:message code="whether_area_block"/></th> --%>
|
||||
@@ -309,6 +310,12 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${indexCfg.groupName}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(indexCfg.groupName,20)}
|
||||
</a>
|
||||
</td>
|
||||
<td>${indexCfg.destIpAddress }</td>
|
||||
<td>${indexCfg.destPort }</td>
|
||||
<td>
|
||||
|
||||
@@ -11,16 +11,22 @@ $(function(){
|
||||
$("#serviceId").val($(".action:checked").attr("serviceId"));
|
||||
$("#protocolId").val($(".action:checked").attr("protocolId"));
|
||||
}
|
||||
$(".action").on("change", function() {
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
if($("#dnsStrategyId").val() == 0){
|
||||
$("#areaEffectiveIds").parents(".form-group").removeClass("hidden");
|
||||
}
|
||||
$("#dnsStrategyId").on("change",function(){
|
||||
if($(this).val() != 0){
|
||||
$("#areaEffectiveIds").parents(".form-group").addClass("hidden");
|
||||
}else{
|
||||
$("#areaEffectiveIds").parents(".form-group").removeClass("hidden");
|
||||
}
|
||||
});
|
||||
$("#ipCfgFrom").validate({
|
||||
errorPlacement: function(error,element){
|
||||
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
|
||||
},
|
||||
submitHandler: function(form){
|
||||
//loading('<spring:message code="onloading"/>');
|
||||
loading('<spring:message code="onloading"/>');
|
||||
form.submit();
|
||||
},
|
||||
errorContainer: "#messageBox"
|
||||
@@ -51,7 +57,8 @@ $(function(){
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" name="functionId" value="${_cfg.functionId}">
|
||||
<input type="hidden" name="isAreaEffective" value="0">
|
||||
<input type="hidden" name="isAreaEffective" value="1">
|
||||
<input type="hidden" name="areaType" value="1">
|
||||
<c:if test="${fn:length(serviceList)==1}">
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
<input type="hidden" name="action" serviceId="${service.serviceId }" protocolId="${service.protocolId }" regionCode="${service.regionCode}" value="${service.action }">
|
||||
@@ -92,10 +99,10 @@ $(function(){
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<label class="control-label col-md-3"><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select id="dnsStrategyId" name="dnsStrategyId" class="selectpicker show-tick form-control required">
|
||||
<option value="" <c:if test="${empty _cfg.dnsStrategyId }">selected</c:if>><spring:message code="select"/></option>
|
||||
<select id="dnsStrategyId" name="dnsStrategyId" class="selectpicker show-tick form-control">
|
||||
<option value="0" <c:if test="${empty _cfg.dnsStrategyId }">selected</c:if>><spring:message code="default_group"/></option>
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option value="${policyGroup.groupId}" <c:if test="${_cfg.dnsStrategyId==policyGroup.groupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
@@ -158,7 +165,7 @@ $(function(){
|
||||
</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"/></label>
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control required ipCheck" type="text" name="srcIpAddress" value="${_cfg.srcIpAddress}">
|
||||
</div>
|
||||
@@ -264,6 +271,22 @@ $(function(){
|
||||
<spring:message code="show_more" />
|
||||
</button>
|
||||
</div> --%>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group hidden">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="area"/></label>
|
||||
<div class="col-md-6">
|
||||
<select id="areaEffectiveIds" name="areaEffectiveIds" class="selectpicker show-tick form-control required" 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="${_cfg.areaEffectiveIds == area.itemCode }">selected</c:if> >${area.itemValue}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="areaEffectiveIds"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div class="row ipmulitiplex">
|
||||
|
||||
@@ -274,7 +274,8 @@
|
||||
<th class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
|
||||
<th class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
|
||||
<th class="sort-column a.action"><spring:message code="block_type"/></th>
|
||||
<th><spring:message code="ip"/></th>
|
||||
<th><spring:message code="group"/></th>
|
||||
<th><spring:message code="client_ip"/></th>
|
||||
<%-- <th><spring:message code="do_log"/></th> --%>
|
||||
<%-- <th><spring:message code="whether_area_block"/></th> --%>
|
||||
<th><spring:message code="letter"/></th>
|
||||
@@ -307,6 +308,15 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${indexCfg.groupName}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
${fns:abbr(indexCfg.groupName,20)}
|
||||
<c:if test="${empty indexCfg.groupName }">
|
||||
<spring:message code="default_group"/>
|
||||
</c:if>
|
||||
</a>
|
||||
</td>
|
||||
<td>${indexCfg.srcIpAddress }</td>
|
||||
<%-- <td>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
|
||||
Reference in New Issue
Block a user