S/DNAT复用地址池配置属性修改.
This commit is contained in:
@@ -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+"");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user