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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user