Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop
This commit is contained in:
@@ -100,6 +100,7 @@ import com.nis.web.service.configuration.DnsIpCfgService;
|
||||
import com.nis.web.service.configuration.DnsResStrategyService;
|
||||
import com.nis.web.service.configuration.DomainService;
|
||||
import com.nis.web.service.configuration.FileTransferCfgService;
|
||||
import com.nis.web.service.configuration.GroupAreaService;
|
||||
import com.nis.web.service.configuration.HttpRedirectCfgService;
|
||||
import com.nis.web.service.configuration.InterceptCfgService;
|
||||
import com.nis.web.service.configuration.IpCfgService;
|
||||
@@ -221,6 +222,8 @@ public class BaseController {
|
||||
protected AsnPolicyCfgService asnPolicyCfgService;// asn 策略 service
|
||||
@Autowired
|
||||
protected AppMultiFeatureCfgService appMultiFeatureCfgService;
|
||||
@Autowired
|
||||
protected GroupAreaService groupAreaService;// 分组区域管理 service
|
||||
/**
|
||||
* 管理基础路径
|
||||
*/
|
||||
|
||||
@@ -58,6 +58,8 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
// 设置省份信息
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
@@ -145,7 +147,7 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
}
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg = ipMultiplexPoolCfgService.getIpMultiplexPoolCfg(Long.valueOf(ids),null);
|
||||
initFormCondition(model, cfg);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model, cfg);
|
||||
}
|
||||
@@ -162,7 +164,10 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
public String snatsaveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes,
|
||||
@ModelAttribute("cfg")IpMultiplexPoolCfg cfg){
|
||||
try{
|
||||
|
||||
// 设置省份信息
|
||||
if(!StringUtil.isEmpty(cfg.getPolicyGroup())){
|
||||
groupAreaService.setAreaCodeByGroupId(cfg);
|
||||
}
|
||||
ipMultiplexPoolCfgService.saveOrUpdate(cfg);
|
||||
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
@@ -208,4 +213,29 @@ public class IpMultiplexPoolCfgController extends BaseController {
|
||||
return "redirect:" + adminPath +"/maintenance/ipMultiplexPoolCfg/snatlist?functionId="+functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验IP是否已存在
|
||||
* @param cfg
|
||||
* @param redirectAttributes
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = {"/checkIp"})
|
||||
public boolean checkIp(IpMultiplexPoolCfg cfg, HttpServletRequest request, HttpServletResponse response){
|
||||
// 修改
|
||||
if(!StringUtil.isEmpty(cfg.getCfgId())){
|
||||
IpMultiplexPoolCfg poolCfg = ipMultiplexPoolCfgService.getCfgInfo(cfg);
|
||||
if(poolCfg != null && poolCfg.getDestIpAddress().equals(cfg.getDestIpAddress())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cfg.setCfgId(null);
|
||||
IpMultiplexPoolCfg poolCfg = ipMultiplexPoolCfgService.getCfgInfo(cfg);
|
||||
if(poolCfg != null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ public interface GroupAreaDao extends CrudDao<GroupAreaInfo>{
|
||||
|
||||
List<GroupAreaInfo> findGroupAreaInfoList(GroupAreaInfo entity);
|
||||
|
||||
GroupAreaInfo getInfoById(int groupId);
|
||||
GroupAreaInfo getInfoById(int id);
|
||||
|
||||
Integer getAreaCodeByGroupId(Integer groupId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
FROM
|
||||
group_area_info r
|
||||
WHERE
|
||||
r.id = #{Id}
|
||||
r.id = #{Id} AND is_valid = 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.nis.domain.configuration.GroupAreaInfo" >
|
||||
@@ -124,4 +124,13 @@
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<!-- 获取该分组的区域信息 -->
|
||||
<select id="getAreaCodeByGroupId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
area_code
|
||||
FROM
|
||||
group_area_info
|
||||
WHERE
|
||||
group_id = #{groupId} AND is_valid = 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -15,4 +15,8 @@ public interface IpMultiplexPoolCfgDao extends CrudDao<IpMultiplexPoolCfg> {
|
||||
,@Param("isAudit")Integer isAudit
|
||||
,@Param("isValid")Integer isValid);
|
||||
|
||||
IpMultiplexPoolCfg getCfgInfo(IpMultiplexPoolCfg cfg);
|
||||
|
||||
String getIspByGroupId(Integer groupId);
|
||||
|
||||
}
|
||||
@@ -304,5 +304,37 @@
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getCfgInfo" parameterType="com.nis.domain.configuration.IpMultiplexPoolCfg" resultMap="IpMultiplexPoolCfgMap">
|
||||
SELECT
|
||||
<include refid="IpMultiplexPoolCfgColumns"/>
|
||||
FROM ip_multiplex_pool_cfg r
|
||||
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
||||
<if test="cfgId != null">
|
||||
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="isValid !=null">
|
||||
AND r.is_valid =#{isValid,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="isValid == null">
|
||||
AND r.IS_VALID != -1
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="destIpAddress != null and destIpAddress!=''" >
|
||||
AND r.ip = #{destIpAddress,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="getIspByGroupId" resultType="java.lang.String">
|
||||
SELECT
|
||||
area_effective_ids
|
||||
FROM
|
||||
ip_multiplex_pool_cfg
|
||||
WHERE
|
||||
policy_group = #{groupId} AND is_valid != -1
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,11 +9,15 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.GroupAreaInfo;
|
||||
import com.nis.domain.configuration.IpMultiplexPoolCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.configuration.GroupAreaDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
@Service
|
||||
public class GroupAreaService extends BaseService{
|
||||
@@ -28,8 +33,8 @@ public class GroupAreaService extends BaseService{
|
||||
return page;
|
||||
}
|
||||
|
||||
public GroupAreaInfo getInfoById(int groupId) {
|
||||
GroupAreaInfo GroupAreaInfo=groupAreaDao.getInfoById(groupId);
|
||||
public GroupAreaInfo getInfoById(int id) {
|
||||
GroupAreaInfo GroupAreaInfo=groupAreaDao.getInfoById(id);
|
||||
return GroupAreaInfo;
|
||||
}
|
||||
|
||||
@@ -79,5 +84,40 @@ public class GroupAreaService extends BaseService{
|
||||
}
|
||||
return policyGroups;
|
||||
}
|
||||
|
||||
|
||||
// SNAT策略 组织生效区域信息
|
||||
public void setAreaEffective(IpPortCfg cfg) {
|
||||
String areaEffectiveIds = "";
|
||||
if(cfg.getDnsStrategyId() != 0){// 已选择分组
|
||||
// 1.获取该分组的省份信息
|
||||
Integer areaCode = groupAreaDao.getAreaCodeByGroupId(cfg.getDnsStrategyId());
|
||||
// 2.获取该分组下的IP复用地址池配置的ISP
|
||||
IpMultiplexPoolCfgService poolCfgService = SpringContextHolder.getBean(IpMultiplexPoolCfgService.class);
|
||||
String ispInfo = poolCfgService.getIspByGroupId(cfg.getDnsStrategyId());
|
||||
if(ispInfo.indexOf(":") != -1){
|
||||
ispInfo = ispInfo.substring(ispInfo.indexOf(":"));
|
||||
}
|
||||
areaEffectiveIds = areaCode + ispInfo;
|
||||
}
|
||||
cfg.setAreaEffectiveIds(areaEffectiveIds);
|
||||
}
|
||||
|
||||
// IP复用地址池 设置省份信息
|
||||
public void setAreaCodeByGroupId(IpMultiplexPoolCfg cfg){
|
||||
Integer areaCode = groupAreaDao.getAreaCodeByGroupId(cfg.getPolicyGroup());
|
||||
if(!StringUtil.isEmpty(areaCode)){
|
||||
// 判断是否有ISP
|
||||
if(StringUtil.isEmpty(cfg.getAreaIsp())){
|
||||
List<AreaBean> areaIsp = new ArrayList<>();
|
||||
AreaBean areaBean = new AreaBean();
|
||||
areaBean.setArea(areaCode+"");
|
||||
areaIsp.add(areaBean);
|
||||
cfg.setAreaIsp(areaIsp);
|
||||
}else{
|
||||
cfg.getAreaIsp().get(0).setArea(areaCode+"");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -166,6 +166,24 @@ public class IpMultiplexPoolCfgService extends BaseService{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
* @param cfg
|
||||
* @return
|
||||
*/
|
||||
public IpMultiplexPoolCfg getCfgInfo(IpMultiplexPoolCfg cfg){
|
||||
return ipMultiplexStrategyDao.getCfgInfo(cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该分组下的ISP信息
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public String getIspByGroupId(Integer groupId){
|
||||
return ipMultiplexStrategyDao.getIspByGroupId(groupId);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ $(function(){
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||
<input type="hidden" id="compileId" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="1">
|
||||
<input type="hidden" id="areaType" name="areaType" value="1">
|
||||
<!-- 配置域类型 -->
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
@@ -86,7 +87,7 @@ $(function(){
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="policyGroup" class="selectpicker show-tick form-control required">
|
||||
<option value="" <c:if test="${empty _cfg.policyGroup }">selected</c:if>><spring:message code="select"/></option>
|
||||
<option value="0" <c:if test="${empty _cfg.policyGroup }">selected</c:if>><spring:message code="select"/></option>
|
||||
<c:forEach items="${policyGroups}" var="policyGroup">
|
||||
<option value="${policyGroup.groupId}" <c:if test="${_cfg.policyGroup==policyGroup.groupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
@@ -156,9 +157,10 @@ $(function(){
|
||||
<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"
|
||||
<input class="form-control required ipCheck ipUnique" type="text"
|
||||
name="destIpAddress"
|
||||
value="${_cfg.destIpAddress}">
|
||||
value="${_cfg.destIpAddress}"
|
||||
ctx="${ctx}">
|
||||
</div>
|
||||
<div for="destIpAddress"></div>
|
||||
</div>
|
||||
|
||||
@@ -52,7 +52,8 @@ $(function(){
|
||||
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||
<input type="hidden" id="compileId" name="compileId" value="${_cfg.compileId}">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="1">
|
||||
<input type="hidden" id="areaType" name="areaType" value="1">
|
||||
<!-- 配置域类型 -->
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
@@ -83,10 +84,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 name="policyGroup" class="selectpicker show-tick form-control required">
|
||||
<option value="" <c:if test="${empty _cfg.policyGroup }">selected</c:if>><spring:message code="select"/></option>
|
||||
<select name="policyGroup" class="selectpicker show-tick form-control">
|
||||
<option value="0" <c:if test="${empty _cfg.policyGroup }">selected</c:if>><spring:message code="select"/></option>
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option value="${policyGroup.groupId}" <c:if test="${_cfg.policyGroup==policyGroup.groupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
@@ -142,13 +143,45 @@ $(function(){
|
||||
<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"
|
||||
<input class="form-control required ipCheck ipUnique" type="text"
|
||||
name="destIpAddress"
|
||||
value="${_cfg.destIpAddress}">
|
||||
value="${_cfg.destIpAddress}"
|
||||
ctx="${ctx}">
|
||||
</div>
|
||||
<div for="destIpAddress"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ISP -->
|
||||
<div class="col-md-6 ">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="isp"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="areaIsp[0].isp" class="selectpicker form-control required" data-live-search="true" data-live-search-placeholder="search" >
|
||||
<option value="" ><spring:message code="select"/></option>
|
||||
<c:choose>
|
||||
<c:when test="${!empty _areaIsps }">
|
||||
<c:forEach items="${isps}" var="isp">
|
||||
<c:forEach items="${_areaIsps}" var="areaIsp">
|
||||
<option value="${isp.itemCode}"
|
||||
<c:if test="${isp.itemCode==areaIsp.isp}">selected</c:if>
|
||||
>${isp.itemValue}</option>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<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>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</select>
|
||||
</div>
|
||||
<div for="areaIsp[0].isp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="span1"></span>
|
||||
</div>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-6 ">
|
||||
|
||||
@@ -911,4 +911,22 @@ var fillIp=function (ip){
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
||||
jQuery.validator.addMethod("ipUnique",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 result = true;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
async:false,
|
||||
url: url,
|
||||
data:{"cfgId":cfgId,"functionId":functionId,"destIpAddress":value},
|
||||
success:function(data){
|
||||
result = data;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
});
|
||||
@@ -75,6 +75,7 @@
|
||||
input:"Please Enter ",
|
||||
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,ALL protocol has no limit",
|
||||
netAddress:"The class C type of IP addresses must has the same network number bit field"
|
||||
netAddress:"The class C type of IP addresses must has the same network number bit field",
|
||||
ipUnique:"IP already exists."
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
input:"Please Enter ",
|
||||
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,ALL protocol has no limit",
|
||||
netAddress:"C类IP地址网络位必须相同"
|
||||
netAddress:"C类IP地址网络位必须相同",
|
||||
ipUnique:"IP already exists."
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
input:"请输入 ",
|
||||
protocolPort:"端口大于0时必须选择TCP协议或者UDP协议",
|
||||
protocolPort1:"只有tcp,udp协议端口号可以不为0,全部协议无限制",
|
||||
netAddress:"C类IP地址网络位必须相同"
|
||||
netAddress:"C类IP地址网络位必须相同",
|
||||
ipUnique:"IP已存在"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
Reference in New Issue
Block a user