diff --git a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java index fcc77f7c4..fa2a07844 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckComplexStringFormatThread.java @@ -111,7 +111,11 @@ public class CheckComplexStringFormatThread implements Callable{ } // 代理HTTP(s)阻断 if (regionDict.getFunctionId().equals(207)) { + if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { + baseStringCfg.setUserRegion1("404"); + } String userRegion1 = baseStringCfg.getUserRegion1();// 应答码 + String userRegion2 = baseStringCfg.getUserRegion2();// 响应内容 if (StringUtils.isNotBlank(userRegion1)) { List dicts = DictUtils.getDictList("RESPONSE_CODE"); boolean has = false; @@ -126,6 +130,9 @@ public class CheckComplexStringFormatThread implements Callable{ prop.getProperty("response_code") + " ") + ";"); } } + if(StringUtils.isNotBlank(userRegion2) && userRegion2.length() > 1024) { + errInfo.append(prop.getProperty("response_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } } // 代理 HTTP(s)重定向 @@ -165,7 +172,13 @@ public class CheckComplexStringFormatThread implements Callable{ } // 代理HTTP(s)替换 if (regionDict.getFunctionId().equals(209)) { + if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { + baseStringCfg.setUserRegion1("http_resp_body"); + } String userRegion1 = baseStringCfg.getUserRegion1();// 搜索区域 + String userRegion2 = baseStringCfg.getUserRegion2();// 发现内容 + String userRegion3 = baseStringCfg.getUserRegion3();// 替换内容 + if (StringUtils.isNotBlank(userRegion1)) { List dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE"); boolean has = false; @@ -180,6 +193,19 @@ public class CheckComplexStringFormatThread implements Callable{ prop.getProperty("replace_zone") + " ") + ";"); } } + if (StringUtils.isBlank(userRegion2)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content") + " ") + ";"); + }else if(userRegion2.length() > 1024) { + errInfo.append(prop.getProperty("replaced_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } + + if (StringUtils.isBlank(userRegion3)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content") + " ") + ";"); + }else if(userRegion3.length() > 1024) { + errInfo.append(prop.getProperty("replace_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } } diff --git a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java index f8180d2fd..6ce938705 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckIpFormatThread.java @@ -385,7 +385,11 @@ public class CheckIpFormatThread implements Callable{ } // 代理HTTP(s)阻断 if (regionDict.getFunctionId().equals(207)) { + if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) { + baseIpCfg.setUserRegion1("404"); + } String userRegion1 = baseIpCfg.getUserRegion1();// 应答码 + String userRegion2 = baseIpCfg.getUserRegion2();// 响应内容 if (StringUtils.isNotBlank(userRegion1)) { List dicts = DictUtils.getDictList("RESPONSE_CODE"); boolean has = false; @@ -400,6 +404,9 @@ public class CheckIpFormatThread implements Callable{ prop.getProperty("response_code") + " ") + ";"); } } + if(StringUtils.isNotBlank(userRegion2) && userRegion2.length() > 1024) { + errInfo.append(prop.getProperty("response_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } } // 代理 HTTP(s)重定向 @@ -439,8 +446,14 @@ public class CheckIpFormatThread implements Callable{ } // 代理HTTP(s)替换 if (regionDict.getFunctionId().equals(209)) { + if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) { + baseIpCfg.setUserRegion1("http_resp_body"); + } String userRegion1 = baseIpCfg.getUserRegion1();// 搜索区域 - if (StringUtils.isNotBlank(userRegion1)) { + String userRegion2 = baseIpCfg.getUserRegion2();// 发现内容 + String userRegion3 = baseIpCfg.getUserRegion3();// 替换内容 + + if (StringUtils.isNotBlank(userRegion1)) { List dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE"); boolean has = false; for (SysDataDictionaryItem dict : dicts) { @@ -454,7 +467,19 @@ public class CheckIpFormatThread implements Callable{ prop.getProperty("replace_zone") + " ") + ";"); } } + if (StringUtils.isBlank(userRegion2)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content") + " ") + ";"); + }else if(userRegion2.length() > 1024) { + errInfo.append(prop.getProperty("replaced_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } + if (StringUtils.isBlank(userRegion3)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content") + " ") + ";"); + }else if(userRegion3.length() > 1024) { + errInfo.append(prop.getProperty("replace_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } } // 拦截策略(限速) diff --git a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java index 164561309..eead68a72 100644 --- a/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java +++ b/src/main/java/com/nis/util/excel/thread/CheckStringFormatThread.java @@ -159,7 +159,11 @@ public class CheckStringFormatThread implements Callable{ } // 代理HTTP(s)阻断 if (regionDict.getFunctionId().equals(207)) { + if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { + baseStringCfg.setUserRegion1("404"); + } String userRegion1 = baseStringCfg.getUserRegion1();// 应答码 + String userRegion2 = baseStringCfg.getUserRegion2();// 响应内容 if (StringUtils.isNotBlank(userRegion1)) { List dicts = DictUtils.getDictList("RESPONSE_CODE"); boolean has = false; @@ -174,6 +178,9 @@ public class CheckStringFormatThread implements Callable{ prop.getProperty("response_code") + " ") + ";"); } } + if(StringUtils.isNotBlank(userRegion2) && userRegion2.length() > 1024) { + errInfo.append(prop.getProperty("response_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } } // 代理 HTTP(s)重定向 @@ -213,7 +220,13 @@ public class CheckStringFormatThread implements Callable{ } // 代理HTTP(s)替换 if (regionDict.getFunctionId().equals(209)) { + if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) { + baseStringCfg.setUserRegion1("http_resp_body"); + } String userRegion1 = baseStringCfg.getUserRegion1();// 搜索区域 + String userRegion2 = baseStringCfg.getUserRegion2();// 发现内容 + String userRegion3 = baseStringCfg.getUserRegion3();// 替换内容 + if (StringUtils.isNotBlank(userRegion1)) { List dicts = DictUtils.getDictList("CONTROL_REPLACE_ZONE"); boolean has = false; @@ -228,6 +241,19 @@ public class CheckStringFormatThread implements Callable{ prop.getProperty("replace_zone") + " ") + ";"); } } + if (StringUtils.isBlank(userRegion2)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content") + " ") + ";"); + }else if(userRegion2.length() > 1024) { + errInfo.append(prop.getProperty("replaced_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } + + if (StringUtils.isBlank(userRegion3)) { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content") + " ") + ";"); + }else if(userRegion3.length() > 1024) { + errInfo.append(prop.getProperty("replace_content")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":1024") + ";"); + } }