修改业务类型和表名是否对应的关系从tableservice.pro里面获取

This commit is contained in:
RenKaiGe-Office
2018-06-02 14:55:42 +08:00
parent ba4e1ec4ef
commit 226cab3796
4 changed files with 82 additions and 56 deletions

View File

@@ -73,27 +73,28 @@ public class CompileVal {
+ CompileJudgeCode.GroupNumNEQGroupList.getErrorReason(); + CompileJudgeCode.GroupNumNEQGroupList.getErrorReason();
} }
// int sizeCount = 0; // int sizeCount = 0;
// if (configCompile.getIpRegionList() == null && configCompile.getStrRegionList() == null // if (configCompile.getIpRegionList() == null &&
// && configCompile.getNumRegionList() == null) { // configCompile.getStrRegionList() == null
// return "编译配置id为" + configCompile.getCompileId() + "的配置中" // && configCompile.getNumRegionList() == null) {
// + CompileJudgeCode.CompileNotNull.getErrorReason(); // return "编译配置id为" + configCompile.getCompileId() + "的配置中"
// } else { // + CompileJudgeCode.CompileNotNull.getErrorReason();
// if (configCompile.getIpRegionList() != null) { // } else {
// sizeCount += configCompile.getIpRegionList().size(); // if (configCompile.getIpRegionList() != null) {
// } // sizeCount += configCompile.getIpRegionList().size();
// if (configCompile.getStrRegionList() != null) { // }
// sizeCount += configCompile.getStrRegionList().size(); // if (configCompile.getStrRegionList() != null) {
// } // sizeCount += configCompile.getStrRegionList().size();
// if (configCompile.getNumRegionList() != null) { // }
// sizeCount += configCompile.getNumRegionList().size(); // if (configCompile.getNumRegionList() != null) {
// } // sizeCount += configCompile.getNumRegionList().size();
// // }
// if (sizeCount == 0) { //
// return "编译配置id为" + configCompile.getCompileId() + "的配置中" // if (sizeCount == 0) {
// + CompileJudgeCode.CompileNotNull.getErrorReason(); // return "编译配置id为" + configCompile.getCompileId() + "的配置中"
// } // + CompileJudgeCode.CompileNotNull.getErrorReason();
// } // }
// }
if (!isUpdate) { if (!isUpdate) {
if (configCompile.getIsValid() != 1) { if (configCompile.getIsValid() != 1) {
return "编译配置id为" + configCompile.getCompileId() + "的配置在添加时不能为无效"; return "编译配置id为" + configCompile.getCompileId() + "的配置在添加时不能为无效";
@@ -307,15 +308,14 @@ public class CompileVal {
} }
List<DigestRegion> digestRegionList = configCompile.getDigestRegionList(); List<DigestRegion> digestRegionList = configCompile.getDigestRegionList();
//不判断是否为空 // 不判断是否为空
//验证 // 验证
if (digestRegionList != null && digestRegionList.size() > 0) { if (digestRegionList != null && digestRegionList.size() > 0) {
for (DigestRegion digestRegion : digestRegionList) { for (DigestRegion digestRegion : digestRegionList) {
//不验证表名和业务类型是否对应 // 不验证表名和业务类型是否对应
if (!isUpdate && digestRegion.getIsValid() != 1) { if (!isUpdate && digestRegion.getIsValid() != 1) {
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为" return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为"
+ digestRegion.getRegionId() + "的域配置在添加时不能为无效"; + digestRegion.getRegionId() + "的域配置在添加时不能为无效";
@@ -360,14 +360,19 @@ public class CompileVal {
*/ */
public static boolean type2TableNameIsOk(Integer serviceType, String tableName) { public static boolean type2TableNameIsOk(Integer serviceType, String tableName) {
if (null != serviceType && null != tableName && !tableName.equals("")) { if (null != serviceType && null != tableName && !tableName.equals("")) {
Map<Integer, Map<String, String>> tableRelation = ConfigSourcesService.getTableRelation(); List<String> list = new ArrayList<String>();
Map<String, String> map = tableRelation.get(serviceType.intValue()); Map<Integer, String> sercieNameMap = ServiceAndRDBIndexReal.getSercieNameMap().get(serviceType);
if (null != map) { if (sercieNameMap != null && sercieNameMap.size() > 0) {
if (map.containsKey(tableName.toUpperCase())) { for (Integer type : sercieNameMap.keySet()) {
return true; list.add(sercieNameMap.get(type).toLowerCase());
} else {
return false;
} }
}
// Map<Integer, Map<String, String>> tableRelation =
// ConfigSourcesService.getTableRelation();
// Map<String, String> map = tableRelation.get(serviceType.intValue());
if (list.contains(tableName.toLowerCase())) {
return true;
} else { } else {
return false; return false;
} }
@@ -569,7 +574,7 @@ public class CompileVal {
} }
return "ok"; return "ok";
} }
public static String valDigestRegion(DigestRegion digestRegion, Long compileId) { public static String valDigestRegion(DigestRegion digestRegion, Long compileId) {
Long regionId = digestRegion.getRegionId(); Long regionId = digestRegion.getRegionId();
if (null == regionId) { if (null == regionId) {
@@ -636,19 +641,21 @@ public class CompileVal {
+ "的域配置direction的值不正确,只能是0或1"; + "的域配置direction的值不正确,只能是0或1";
} }
//zdx protocol验证 // zdx protocol验证
// if (ipRegion.getTableName().toLowerCase().equals("dj_ip_port")) { // if (ipRegion.getTableName().toLowerCase().equals("dj_ip_port")) {
// if (ipRegion.getProtocol() < 0 || ipRegion.getProtocol() > 255) { // if (ipRegion.getProtocol() < 0 || ipRegion.getProtocol() > 255) {
// return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() // return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" +
// + "的域配置tableName为dj_ip_port时,protocol的取值范围只能是0-255"; // ipRegion.getRegionId()
// } // + "的域配置tableName为dj_ip_port时,protocol的取值范围只能是0-255";
// } else { // }
// if (ipRegion.getProtocol() != 0) { // } else {
// return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() + "的域配置tableName为" // if (ipRegion.getProtocol() != 0) {
// + ipRegion.getTableName() + "时,protocol的值只能是0"; // return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" +
// } // ipRegion.getRegionId() + "的域配置tableName为"
// // + ipRegion.getTableName() + "时,protocol的值只能是0";
// } // }
//
// }
return "ok"; return "ok";
} }
@@ -718,17 +725,17 @@ public class CompileVal {
} }
public static String serviceDigestRegionVal(DigestRegion digestRegion, Long compileId) { public static String serviceDigestRegionVal(DigestRegion digestRegion, Long compileId) {
Integer cfdsLevel = digestRegion.getCfdsLevel(); Integer cfdsLevel = digestRegion.getCfdsLevel();
if (!(cfdsLevel>=1&&cfdsLevel<=10)) { if (!(cfdsLevel >= 1 && cfdsLevel <= 10)) {
return "编译配置id为" + compileId + "的配置中digestRegionList中regionId为" + digestRegion.getRegionId() return "编译配置id为" + compileId + "的配置中digestRegionList中regionId为" + digestRegion.getRegionId()
+ "的域配置cfdsLevel的值只能是1到10"; + "的域配置cfdsLevel的值只能是1到10";
} }
return "ok"; return "ok";
} }
/** /**
* 禁配词业务校验 * 禁配词业务校验
* *

View File

@@ -1,7 +1,6 @@
package com.nis.util; package com.nis.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -89,4 +88,24 @@ public class ServiceAndRDBIndexReal {
} }
} }
public static Map<Integer, Map<Integer, String>> getSercieNameMap() {
return sercieNameMap;
}
public static void setSercieNameMap(Map<Integer, Map<Integer, String>> sercieNameMap) {
ServiceAndRDBIndexReal.sercieNameMap = sercieNameMap;
}
public static Map<Integer, List<Integer>> getServiceDBIndexmap() {
return serviceDBIndexmap;
}
public static void setServiceDBIndexmap(Map<Integer, List<Integer>> serviceDBIndexmap) {
ServiceAndRDBIndexReal.serviceDBIndexmap = serviceDBIndexmap;
}
} }

View File

@@ -45,7 +45,7 @@
</p:expressions> </p:expressions>
</p:maatType> </p:maatType>
<p:maatType service="3;15;80;82;84;144;146;148"> <p:maatType service="3;1;80;82;84;144;146;148">
<p:expressions> <p:expressions>
<p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[compile_id]</p:keyExpression> <p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[compile_id]</p:keyExpression>
<p:valueExpression>[compile_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time]</p:valueExpression> <p:valueExpression>[compile_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time]</p:valueExpression>

View File

@@ -5,12 +5,12 @@
####3:例如:80=10:MM_COMPILE;11:MM_GROUP;12:AV_CONT_IP_PORT ####3:例如:80=10:MM_COMPILE;11:MM_GROUP;12:AV_CONT_IP_PORT
####4:type中10代表是编译配置,11代表是分组配置,12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置,16代表是文件摘要类域配置,17代表是文本相似性域配置 ####4:type中10代表是编译配置,11代表是分组配置,12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置,16代表是文件摘要类域配置,17代表是文本相似性域配置
################################################################################# #################################################################################
service=3;15;80;81;82;83;84;85;144;145;146;147;148;149 service=3;1;80;81;82;83;84;85;144;145;146;147;148;149
3=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP 3=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP
15=10:WHITE_LIST_COMPILE;11:WHITE_LIST_GROUP;12:WHITE_LIST_IP 1=10:WHITE_LIST_COMPILE;11:WHITE_LIST_GROUP;12:WHITE_LIST_IP
80=10:MM_COMPILE;11:MM_GROUP;12:MM_AV_IP 80=10:MM_COMPILE;11:MM_GROUP;12:MM_AV_IP
81=10:MM_COMPILE;11:MM_GROUP;14:MM_AV_URL 81=10:MM_COMPILE;11:MM_GROUP;14:MM_AV_URL
82=10:MM_COMPILE;11:MM_GROUP;12:MM_PIC_IP 82=10:MM_COMPILE;11:MM_GROUP;12:MM_PIC_IP
@@ -31,7 +31,7 @@ service=3;15;80;81;82;83;84;85;144;145;146;147;148;149
##各业务类型对应的redisdb,业务类型:redisdb,多个业务以“;”分隔,多个db以“,”数量不能超过6个 ##各业务类型对应的redisdb,业务类型:redisdb,多个业务以“;”分隔,多个db以“,”数量不能超过6个
serviceDBIndex=3:2,3;15:2;80:2;81:2;82:2;83:2;84:2;85:2;144:2;145:2;146:2;147:2;148:2;149:2;96:3;97:3;98:3;99:3;160:3,4;161:3;162:3;163:3;100:3;101:3;164:3;165:3 serviceDBIndex=3:2,3;1:2;80:2;81:2;82:2;83:2;84:2;85:2;144:2;145:2;146:2;147:2;148:2;149:2;96:3;97:3;98:3;99:3;160:3,4;161:3;162:3;163:3;100:3;101:3;164:3;165:3