修改获取静态阈值逻辑,根据默认指定vsysID获取

This commit is contained in:
徐鹏飞
2022-06-13 18:00:57 +08:00
parent 3dc29a07be
commit 2d98c3b6e6

View File

@@ -101,7 +101,7 @@ public class ParseStaticThreshold {
} }
/** /**
* 获取vsysId配置列表只需要拿到id的集合输出出去即可 * 获取vsysId配置列表
* *
* @return vsysIdList * @return vsysIdList
*/ */
@@ -143,22 +143,23 @@ public class ParseStaticThreshold {
} }
/** /**
* 获取静态阈值配置列表遍历id的集合并将每个id放入请求体中 * 根据vsysId获取静态阈值配置列表
* *
* @return thresholds * @return thresholds
*/ */
private static ArrayList<DosDetectionThreshold> getDosDetectionThreshold() { private static ArrayList<DosDetectionThreshold> getDosDetectionThreshold() {
ArrayList<DosDetectionThreshold> thresholds = null; ArrayList<DosDetectionThreshold> thresholds = null;
ArrayList<DosVsysId> vsysId = getVsysId(); // ArrayList<DosVsysId> vsysId = getVsysId();
try { try {
if (vsysId != null){ // if (vsysId != null){
for (DosVsysId dosVsysId : vsysId) { // for (DosVsysId dosVsysId : vsysId) {
URIBuilder uriBuilder = new URIBuilder(CommonConfig.BIFANG_SERVER_URI); URIBuilder uriBuilder = new URIBuilder(CommonConfig.BIFANG_SERVER_URI);
HashMap<String, Object> parms = new HashMap<>(); HashMap<String, Object> parms = new HashMap<>();
parms.put("pageSize", -1); parms.put("pageSize", -1);
parms.put("orderBy", "profileId asc"); parms.put("orderBy", "profileId asc");
parms.put("isValid", 1); parms.put("isValid", 1);
parms.put("vsysId", dosVsysId.getVsysId()); // parms.put("vsysId", dosVsysId.getVsysId());
parms.put("vsysId", 1);
HttpClientUtils.setUrlWithParams(uriBuilder, CommonConfig.BIFANG_SERVER_POLICY_THRESHOLD_PATH, parms); HttpClientUtils.setUrlWithParams(uriBuilder, CommonConfig.BIFANG_SERVER_POLICY_THRESHOLD_PATH, parms);
String token = CommonConfig.BIFANG_SERVER_TOKEN; String token = CommonConfig.BIFANG_SERVER_TOKEN;
if (!HttpClientUtils.ERROR_MESSAGE.equals(token)) { if (!HttpClientUtils.ERROR_MESSAGE.equals(token)) {
@@ -183,8 +184,8 @@ public class ParseStaticThreshold {
} }
} }
} }
} // }
} // }
} catch (Exception e) { } catch (Exception e) {
logger.error("获取静态阈值配置失败,请检查bifang服务或登录配置信息 ", e); logger.error("获取静态阈值配置失败,请检查bifang服务或登录配置信息 ", e);
} }
@@ -247,8 +248,6 @@ public class ParseStaticThreshold {
} }
public static void main(String[] args) { public static void main(String[] args) {
// ArrayList<DosVsysId> vsysId = getVsysId();
// vsysId.forEach(System.out::println);
ArrayList<DosDetectionThreshold> dosDetectionThreshold = getDosDetectionThreshold(); ArrayList<DosDetectionThreshold> dosDetectionThreshold = getDosDetectionThreshold();
dosDetectionThreshold.forEach(System.out::println); dosDetectionThreshold.forEach(System.out::println);