S/DNAT复用策略配置修改.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user