ddos定时任务修改
This commit is contained in:
@@ -248,7 +248,7 @@ public class ConfigConvertUtil {
|
|||||||
List<Integer> regionIdList = Lists.newArrayList();
|
List<Integer> regionIdList = Lists.newArrayList();
|
||||||
T srcCfg = srcList.get(i);
|
T srcCfg = srcList.get(i);
|
||||||
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
BaseIpCfg baseIpCfg = new BaseIpCfg();
|
||||||
BeanUtils.copyProperties(srcCfg, baseIpCfg);
|
BeanUtils.copyProperties(srcCfg, baseIpCfg,new String[]{"menuNameCode"});
|
||||||
regionIdList.add(baseIpCfg.getRegionId());
|
regionIdList.add(baseIpCfg.getRegionId());
|
||||||
IpCfg cfg = new IpCfg();
|
IpCfg cfg = new IpCfg();
|
||||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||||
@@ -325,10 +325,10 @@ public class ConfigConvertUtil {
|
|||||||
} else if (cfgType == 4) {
|
} else if (cfgType == 4) {
|
||||||
for (int i = 0; i < srcList.size(); i++) {
|
for (int i = 0; i < srcList.size(); i++) {
|
||||||
BaseCfg baseCfg = new BaseCfg();
|
BaseCfg baseCfg = new BaseCfg();
|
||||||
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
|
BeanUtils.copyProperties(srcList.get(i), baseCfg,new String[]{"menuNameCode"});//拷贝公共属性
|
||||||
// 一条业务配置创建一个分组
|
// 一条业务配置创建一个分组
|
||||||
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
|
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
|
||||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
|
||||||
GroupCfg group = new GroupCfg();
|
GroupCfg group = new GroupCfg();
|
||||||
group.setGroupId(baseCfg.getGroupId());
|
group.setGroupId(baseCfg.getGroupId());
|
||||||
group.setCompileId(baseCfg.getCompileId());
|
group.setCompileId(baseCfg.getCompileId());
|
||||||
@@ -344,10 +344,10 @@ public class ConfigConvertUtil {
|
|||||||
} else if (cfgType == 5) {
|
} else if (cfgType == 5) {
|
||||||
for (int i = 0; i < srcList.size(); i++) {
|
for (int i = 0; i < srcList.size(); i++) {
|
||||||
BaseCfg baseCfg = new BaseCfg();
|
BaseCfg baseCfg = new BaseCfg();
|
||||||
BeanUtils.copyProperties(srcList.get(i), baseCfg);//拷贝公共属性
|
BeanUtils.copyProperties(srcList.get(i), baseCfg,new String[]{"menuNameCode"});//拷贝公共属性
|
||||||
// 一条业务配置创建一个分组
|
// 一条业务配置创建一个分组
|
||||||
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
||||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
BeanUtils.copyProperties(srcList.get(i), cfg,new String[]{"menuNameCode"});
|
||||||
GroupCfg group = new GroupCfg();
|
GroupCfg group = new GroupCfg();
|
||||||
group.setGroupId(baseCfg.getGroupId());
|
group.setGroupId(baseCfg.getGroupId());
|
||||||
group.setCompileId(baseCfg.getCompileId());
|
group.setCompileId(baseCfg.getCompileId());
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.nis.domain.basics.AsnIpCfg;
|
import com.nis.domain.basics.AsnIpCfg;
|
||||||
import com.nis.domain.callback.InlineIp;
|
import com.nis.domain.callback.InlineIp;
|
||||||
import com.nis.domain.configuration.AppPolicyCfg;
|
import com.nis.domain.configuration.AppPolicyCfg;
|
||||||
@@ -384,8 +385,8 @@ public class SchedulerTaskUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号),分组复用的域配置不需要重新获取regionId,groupId
|
//批量获取regionId,groupId(相同编译下的IP类配置多条ip只获取一个组号),分组复用的域配置不需要重新获取regionId,groupId
|
||||||
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
List<Integer> regionIds = ConfigServiceUtil.getId(3, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
|
||||||
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size());
|
List<Integer> groupIds = ConfigServiceUtil.getId(2, ipList.size()+strList.size()+complexStrList.size()+numList.size()+fileList.size()+list.size());
|
||||||
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
entity.setIsValid(isValid);//将最新的配置状态赋给配置对象
|
||||||
entity.setAuditTime(updateTime);
|
entity.setAuditTime(updateTime);
|
||||||
for(int i=0;i<list.size();i++){
|
for(int i=0;i<list.size();i++){
|
||||||
@@ -404,7 +405,8 @@ public class SchedulerTaskUtil {
|
|||||||
areaIpRegionList = new ArrayList();
|
areaIpRegionList = new ArrayList();
|
||||||
List<DdosIpCfg> list1 = new ArrayList();
|
List<DdosIpCfg> list1 = new ArrayList();
|
||||||
String userRegion = "";
|
String userRegion = "";
|
||||||
//处理自定义域
|
//处理自定义域【DDOS自定义域组成json结构】
|
||||||
|
Map ddosUserRegion= new HashMap();
|
||||||
if(userRegionList!=null){
|
if(userRegionList!=null){
|
||||||
for(Map<String,Object> n:userRegionList){
|
for(Map<String,Object> n:userRegionList){
|
||||||
Object userRegionPosition = n.get("userRegionPosition");
|
Object userRegionPosition = n.get("userRegionPosition");
|
||||||
@@ -421,17 +423,23 @@ public class SchedulerTaskUtil {
|
|||||||
Field field = aClass.getDeclaredField(regionColumn);
|
Field field = aClass.getDeclaredField(regionColumn);
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
value = field.get(cfg);
|
value = field.get(cfg);
|
||||||
|
|
||||||
if(!StringUtil.isEmpty(value)){
|
if(!StringUtil.isEmpty(value)){
|
||||||
if(StringUtil.isEmpty(n.get("regionKey"))){
|
if(StringUtil.isEmpty(n.get("regionKey"))){
|
||||||
userRegion = value.toString();
|
userRegion = value.toString();
|
||||||
}else{
|
}else{
|
||||||
userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
//userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||||
|
ddosUserRegion.put(n.get("regionKey"), value);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
ddosUserRegion.put(n.get("regionKey"), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
|
if(userRegion.endsWith(Constants.USER_REGION_SPLIT)){
|
||||||
userRegion = userRegion.substring(0, userRegion.length()-1);
|
userRegion = userRegion.substring(0, userRegion.length()-1);
|
||||||
|
}else if(!StringUtil.isEmpty(ddosUserRegion)){
|
||||||
|
userRegion = new Gson().toJson(ddosUserRegion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list1.add(cfg);
|
list1.add(cfg);
|
||||||
|
|||||||
@@ -1324,6 +1324,8 @@ public class ConfigSynchronizationService extends BaseService{
|
|||||||
//userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
//userRegion += n.get("regionKey")+"="+value+Constants.USER_REGION_SPLIT;
|
||||||
ddosUserRegion.put(n.get("regionKey"), value);
|
ddosUserRegion.put(n.get("regionKey"), value);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
ddosUserRegion.put(n.get("regionKey"), "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user