Merge branch 'develop' of http://10.0.6.99/common/maat_service.git into develop
This commit is contained in:
@@ -407,6 +407,10 @@ public enum RestBusinessCode {
|
||||
*/
|
||||
SrcIpEQDstIp(4002303,"IP类域-srcIp和dstIp不能相同"),
|
||||
|
||||
/**
|
||||
* IP类域配置的addrType的值只能为4(IPV4)、6(IPV6)、46(4OVER6隧道)、64(6OVER4隧道)、10(全部)
|
||||
*/
|
||||
AddrTypeIsWrongRange(4002304,"IP类域配置的addrType的值只能为4(IPV4)、6(IPV6)、46(4OVER6隧道)、64(6OVER4隧道)、10(全部)"),
|
||||
/**
|
||||
* 字符串域配置的exprType的值只能是0(无表达式)或者1(与表达式)
|
||||
*/
|
||||
|
||||
@@ -766,7 +766,12 @@ public class CompileVal {
|
||||
}
|
||||
|
||||
public static void serviceIpRegionVal(IpRegion ipRegion, Long compileId, String listName) throws Exception {
|
||||
|
||||
int addrType = ipRegion.getAddrType().intValue();
|
||||
if (!(addrType == 4|| addrType == 6 || addrType == 46|| addrType == 64 || addrType ==10)) {
|
||||
throw new RestServiceException("编译配置id为" + compileId + "的配置中" + listName + "中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置addrType的值只能为4(IPV4)、6(IPV6)、46(4OVER6隧道)、64(6OVER4隧道)、10(全部)",
|
||||
RestBusinessCode.AddrTypeIsWrongRange.getValue());
|
||||
}
|
||||
validateIpAndMask(ipRegion, compileId, listName);
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getSrcPort())) {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class GroupReuseVal {
|
||||
List<NumRegion> numRegionList = groupReuse.getNumRegionList();
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
if (!StringUtil.isEmpty(numRegion.getTableName())
|
||||
&& groupReuseRegionMap.get("numRegion").contains(numRegion.getTableName())) {
|
||||
&& !groupReuseRegionMap.get("numRegion").contains(numRegion.getTableName())) {
|
||||
throw new RestServiceException("numRegionList中的regionId为"
|
||||
+ numRegion.getRegionId()
|
||||
+ "的域配置tableName不是分组复用的域表",
|
||||
@@ -64,7 +64,7 @@ public class GroupReuseVal {
|
||||
// {
|
||||
|
||||
if (!StringUtil.isEmpty(strRegion.getTableName())
|
||||
&& groupReuseRegionMap.get("strRegion").contains(strRegion.getTableName())) {
|
||||
&& !groupReuseRegionMap.get("strRegion").contains(strRegion.getTableName())) {
|
||||
throw new RestServiceException("strRegionList中的regionId为"
|
||||
+ strRegion.getRegionId()
|
||||
+ "的域配置tableName不是分组复用的域表",
|
||||
@@ -99,7 +99,7 @@ public class GroupReuseVal {
|
||||
// !regionGroupIdList.contains(ipRegion.getGroupId())) {
|
||||
|
||||
if (!StringUtil.isEmpty(ipRegion.getTableName())
|
||||
&& groupReuseRegionMap.get("ipRegion").contains(ipRegion.getTableName())) {
|
||||
&& !groupReuseRegionMap.get("ipRegion").contains(ipRegion.getTableName())) {
|
||||
throw new RestServiceException("ipRegionList中的regionId为"
|
||||
+ ipRegion.getRegionId()
|
||||
+ "的域配置tableName不是分组复用的域表",
|
||||
@@ -355,6 +355,13 @@ public class GroupReuseVal {
|
||||
|
||||
public static void serviceIpRegionVal(IpRegion ipRegion) throws Exception {
|
||||
|
||||
int addrType = ipRegion.getAddrType().intValue();
|
||||
if (!(addrType == 4|| addrType == 6 || addrType == 46|| addrType == 64 || addrType ==10)) {
|
||||
throw new RestServiceException("ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置addrType的值只能为4(IPV4)、6(IPV6)、46(4OVER6隧道)、64(6OVER4隧道)、10(全部)",
|
||||
RestBusinessCode.AddrTypeIsWrongRange.getValue());
|
||||
}
|
||||
|
||||
validateIpAndMask(ipRegion);
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getSrcPort())) {
|
||||
|
||||
@@ -412,8 +412,10 @@ public class ServiceAndRDBIndexReal {
|
||||
Iterator mapIterator = map.keySet().iterator();
|
||||
while (mapIterator.hasNext()) {
|
||||
String regionName = mapIterator.next().toString();
|
||||
if (StringUtil.isEmpty(groupReuseRegionMap.containsKey(regionName))) {
|
||||
groupReuseRegionMap.put(regionName, map.get(regionName));
|
||||
if (!groupReuseRegionMap.containsKey(regionName)) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.addAll(map.get(regionName));
|
||||
groupReuseRegionMap.put(regionName, list);
|
||||
}else{
|
||||
groupReuseRegionMap.get(regionName).addAll(map.get(regionName));
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
logger.info("摘要获取开始:---------------");
|
||||
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
|
||||
logger.info("摘要获取结束:---------------:"+digestStr);
|
||||
resultObject.put("digest", digestStr);
|
||||
resultObject.put("digest", null==digestStr?"":digestStr);
|
||||
resultObject.put("rawLen", file.getSize());
|
||||
FileUtils.deleteFile(tempFilePath);
|
||||
} catch (Exception e) {
|
||||
@@ -368,7 +368,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
e.printStackTrace();
|
||||
logger.error(RestBusinessCode.GetFileDigestFailure.getValue()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功");
|
||||
thread.setExceptionInfo("摘要获取过程中出现异常:"+e.getMessage()+",请检查摘要获取工具是否安装成功");
|
||||
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.GetFileDigestFailure.getValue()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功",
|
||||
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start, RestBusinessCode.GetFileDigestFailure.getErrorReason()+":"+e.getMessage()+",请检查摘要获取工具是否安装成功",
|
||||
RestBusinessCode.GetFileDigestFailure.getValue());
|
||||
}
|
||||
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "摘要获取成功", resultObject);
|
||||
|
||||
@@ -759,7 +759,7 @@ public class ConfigSourcesService extends BaseService {
|
||||
// System.out.println("----------------chmodCommod:"+chmodCommond);
|
||||
String commondStr = realPath + digestGenToolPath + " -f " + filePath; // 执行
|
||||
// 执行摘要获取命令 digest -f /home/aa.txt
|
||||
// System.out.println("------------commondStr:"+commondStr);
|
||||
logger.info("------------commondStr:"+commondStr);
|
||||
Runtime.getRuntime().exec(chmodCommond);
|
||||
Process p = Runtime.getRuntime().exec(commondStr);
|
||||
byte[] b = new byte[1024];
|
||||
@@ -771,7 +771,10 @@ public class ConfigSourcesService extends BaseService {
|
||||
if (!StringUtil.isBlank(content)) {
|
||||
content = StringUtil.stripAll(content);
|
||||
}
|
||||
// System.out.println("-------------------->>"+content);
|
||||
logger.info("摘要工具获取到的内容-------------------->>"+content);
|
||||
if (StringUtil.isEmpty(content)) {
|
||||
throw new Exception("调用摘要工具获取到的内容为空");
|
||||
}
|
||||
String[] digestGenReslt = content.split(" ");
|
||||
if (digestGenReslt.length >= 4 && !StringUtil.isEmpty(digestGenReslt[3])) {
|
||||
return digestGenReslt[3];
|
||||
@@ -836,7 +839,7 @@ public class ConfigSourcesService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(maatConfig.getStrRegionMapList())) {
|
||||
if (StringUtil.isEmpty(maatConfig.getNumRegionMapList())) {
|
||||
maatConfig.setNumRegionMapList(dstMapList);
|
||||
}else{
|
||||
maatConfig.getNumRegionMapList().addAll(dstMapList);
|
||||
@@ -850,7 +853,7 @@ public class ConfigSourcesService extends BaseService {
|
||||
dstMapList.add(convertObjectToMap(region, IpRegion.class));
|
||||
}
|
||||
}
|
||||
if (StringUtil.isEmpty(maatConfig.getStrRegionMapList())) {
|
||||
if (StringUtil.isEmpty(maatConfig.getIpRegionMapList())) {
|
||||
maatConfig.setIpRegionMapList(dstMapList);
|
||||
}else{
|
||||
maatConfig.getIpRegionMapList().addAll(dstMapList);
|
||||
@@ -946,11 +949,11 @@ public class ConfigSourcesService extends BaseService {
|
||||
hasRegionFlag = true;
|
||||
List<NumRegion> numRegionList = config.getNumRegionList();
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
if (!StringUtil.isEmpty(numRegion.getTableName())
|
||||
&& groupReuseRegionMap.get("numRegion").contains(numRegion.getTableName())) {
|
||||
if (StringUtil.isEmpty(numRegion.getTableName())
|
||||
|| !groupReuseRegionMap.get("numRegion").contains(numRegion.getTableName())) {
|
||||
throw new RestServiceException("numRegionList中的regionId为"
|
||||
+ numRegion.getRegionId()
|
||||
+ "的域配置tableName不是分组复用的域表",
|
||||
+ "的域配置tableName为空或不是分组复用的域表",
|
||||
RestBusinessCode.TableNameUnReuse
|
||||
.getValue());
|
||||
}
|
||||
@@ -964,11 +967,11 @@ public class ConfigSourcesService extends BaseService {
|
||||
hasRegionFlag = true;
|
||||
List<StrRegion> strRegionList = config.getStrRegionList();
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
if (!StringUtil.isEmpty(strRegion.getTableName())
|
||||
&& groupReuseRegionMap.get("strRegion").contains(strRegion.getTableName())) {
|
||||
if (StringUtil.isEmpty(strRegion.getTableName())
|
||||
|| !groupReuseRegionMap.get("strRegion").contains(strRegion.getTableName())) {
|
||||
throw new RestServiceException("strRegionList中的regionId为"
|
||||
+ strRegion.getRegionId()
|
||||
+ "的域配置tableName不是分组复用的域表",
|
||||
+ "的域配置tableName为空或不是分组复用的域表",
|
||||
RestBusinessCode.TableNameUnReuse
|
||||
.getValue());
|
||||
}
|
||||
@@ -984,11 +987,11 @@ public class ConfigSourcesService extends BaseService {
|
||||
List<IpRegion> ipRegionList = config.getIpRegionList();
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
|
||||
if (!StringUtil.isEmpty(ipRegion.getTableName())
|
||||
&& groupReuseRegionMap.get("ipRegion").contains(ipRegion.getTableName())) {
|
||||
if (StringUtil.isEmpty(ipRegion.getTableName())
|
||||
|| !groupReuseRegionMap.get("ipRegion").contains(ipRegion.getTableName())) {
|
||||
throw new RestServiceException("ipRegionList中的regionId为"
|
||||
+ ipRegion.getRegionId()
|
||||
+ "的域配置tableName不是分组复用的域表",
|
||||
+ "的域配置tableName为空或不是分组复用的域表",
|
||||
RestBusinessCode.TableNameUnReuse
|
||||
.getValue());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user