1、细化业务状态码;
2、修改serviceTable.properties,将PXY_CTRL_HTTP_REQ_BODY由增强字符串域改为字符串域; 3、修改commonSources.xml,业务ID为832的配置添加addrType属性
This commit is contained in:
@@ -5,6 +5,11 @@ package com.nis.restful;
|
||||
*/
|
||||
public enum RestBusinessCode {
|
||||
|
||||
|
||||
/**
|
||||
* 服务内部异常
|
||||
*/
|
||||
service_runtime_error (30000, "服务内部异常!"),
|
||||
/**
|
||||
* 未知错误
|
||||
*/
|
||||
@@ -48,7 +53,394 @@ public enum RestBusinessCode {
|
||||
|
||||
update_success(2002, "数据更新操作成功"),
|
||||
|
||||
delete_success(2003, "数据删除操作成功");
|
||||
delete_success(2003, "数据删除操作成功"),
|
||||
/**
|
||||
* 完整性验证 10000 编译:10000 分组:10100 数值类:10200 IP类:10300 字符串类:10400 摘要类:10500 回调类:10600
|
||||
* 配置格式验证 20000 编译:20000 分组:20100 数值类:20200 IP类:20300 字符串类:20400 摘要类:20500 回调类:20600
|
||||
*/
|
||||
|
||||
/**
|
||||
* 编译配置不能为空
|
||||
*/
|
||||
CompileIsNull(10001, "Maat配置不能为空"),
|
||||
/**
|
||||
* 编译配置的的compileId不能为空
|
||||
*/
|
||||
CompileIdIsNull(10002, "Maat配置的compileId字段不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的的service不能为空
|
||||
*/
|
||||
ServiceIsNull(10003, "配置的service属性不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的action不能为空
|
||||
*/
|
||||
ActionIsNull(10004, "Maat配置的action不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的的compileId不能为空
|
||||
*/
|
||||
DoBlacklistIsNull(10005, "Maat配置的doBlacklist不能为空"),
|
||||
/**
|
||||
* 编译配置的的compileId不能为空
|
||||
*/
|
||||
DoBlacklistIsWrongRange(10006, "Maat配置的doBlacklist的值不在有效范围"),
|
||||
|
||||
/**
|
||||
* 编译配置的的doLog不能为空
|
||||
*/
|
||||
DoLogIsNull(10007, "Maat配置的doLog不能为空"),
|
||||
/**
|
||||
* 编译配置的的doLog不能为空
|
||||
*/
|
||||
DoLogIsWrongRange(10008, "Maat配置的doLog的值不在有效范围"),
|
||||
/**
|
||||
* 编译配置的effectiveRange不能为空
|
||||
*/
|
||||
EffectiveRangeIsNull(10009, "Maat配置的effectiveRange不能为空"),
|
||||
/**
|
||||
* 编译配置的startTime不能为空
|
||||
*/
|
||||
StartTimeIsNull(10010, "Maat配置的startTime不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的的endTime不能为空
|
||||
*/
|
||||
EndTimeIsNull(10011, "Maat配置的endTime不能为空"),
|
||||
|
||||
/**
|
||||
* 配置的isValid不能为空
|
||||
*/
|
||||
IsValidIsNull(10013, "配置isValid属性不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的groupNum不能为空
|
||||
*/
|
||||
GroupNumIsNull(10016, "Maat配置groupNum属性,不能为空"),
|
||||
/**
|
||||
* 编译配置的的fatherCfgId不能为空
|
||||
*/
|
||||
FatherCfgIdIsNull(10017, "Maat配置的fatherCfgId不能为空"),
|
||||
/**
|
||||
* 编译配置的缺少配置分组信息
|
||||
*/
|
||||
CompileGroupIsNull(10018, "Maat配置的缺少groupRelationList"),
|
||||
|
||||
/**
|
||||
* 编译配置的opTime不能为空
|
||||
*/
|
||||
OpTimeIsNull(10019, "Maat配置的opTime不能为空"),
|
||||
|
||||
//分组配置数据完整性业务码10100~
|
||||
|
||||
/**
|
||||
* 编译配置的的配置分组的CompileId不能为空
|
||||
*/
|
||||
GroupsCompileIdIsNull(10100, "Maat配置的配置分组的compileId不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的的配置分组的groupId不能为空
|
||||
*/
|
||||
GroupIdIsNull(10101, "Maat配置的的配置分组的groupId不能为空"),
|
||||
|
||||
/**
|
||||
* 编译配置的的配置分组的isValid不能为空
|
||||
*/
|
||||
GroupsIsValidIsNull(10102, "编译配置的的配置分组的isValid不能为空"),
|
||||
|
||||
// /**
|
||||
// * 编译配置的的配置分组的opTime不能为空
|
||||
// */
|
||||
// GroupsOpTimeIsNull(1037, "编译配置的的配置分组的opTime不能为空"),
|
||||
|
||||
/**
|
||||
* 域配置的groupid在配置分组关系中不存在
|
||||
*/
|
||||
RegionsGroupIdIsNotFound(10103, "域配置的groupid在配置分组关系中不存在"),
|
||||
/**
|
||||
*域配置的regionId不能为空
|
||||
*/
|
||||
RegionIdIsNull(10104, "域配置的regionId不能为空"),
|
||||
|
||||
/**
|
||||
*域配置的groupId不能为空
|
||||
*/
|
||||
RegionsGroupIdIsNull(10105, "域配置的groupId不能为空"),
|
||||
|
||||
//数值类域数据完整性业务码10200~
|
||||
/**
|
||||
* 编译配置中缺少数值类域配置信息
|
||||
*/
|
||||
NumRegionIsNull(10200, "Maat配置中不能缺少数值类域配置信息"),
|
||||
|
||||
/**
|
||||
*数值域配置的lowBoundary不能为空
|
||||
*/
|
||||
LowBoundaryIsNull(10201, "数值域配置的lowBoundary不能为空"),
|
||||
/**
|
||||
*数值域配置的upBoundary不能为空
|
||||
*/
|
||||
UpBoundaryIsNull(10202, "数值域配置的upBoundary不能为空"),
|
||||
|
||||
//数值类域数据完整性业务码10300~
|
||||
/**
|
||||
* 编译配置中缺少IP类域配置信息
|
||||
*/
|
||||
IpRegionIsNull(10300, "Maat配置中不能缺少IP类域配置信息"),
|
||||
|
||||
/**
|
||||
* IP类域配置的addrType不能为空
|
||||
*/
|
||||
AddrTypeIsNull(10301,"IP类域配置的addrType不能为空"),
|
||||
/**
|
||||
* IP类域配置的srcIp不能为空
|
||||
*/
|
||||
SrcIpIsNull(10302,"IP类域配置的srcIp不能为空"),
|
||||
/**
|
||||
* IP类域配置的maskSrcIp不能为空
|
||||
*/
|
||||
MaskSrcIpIsNull(10303,"IP类域配置的maskSrcIp不能为空"),
|
||||
|
||||
/**
|
||||
* IP类域配置的srcPort不能为空
|
||||
*/
|
||||
SrcPortIsNull(10304,"IP类域配置的srcPort不能为空"),
|
||||
/**
|
||||
* IP类域配置的maskSrcPort不能为空
|
||||
*/
|
||||
MaskSrcPortIsNull(10305,"IP类域配置的maskSrcPort不能为空"),
|
||||
/**
|
||||
* IP类域配置的dstIp不能为空
|
||||
*/
|
||||
DstIpIsNull(10306,"IP类域配置的dstIp不能为空"),
|
||||
/**
|
||||
* IP类域配置的maskDstIp不能为空
|
||||
*/
|
||||
MaskDstIpIsNull(10307,"IP类域配置的maskDstIp不能为空"),
|
||||
|
||||
/**
|
||||
* IP类域配置的dstPort不能为空
|
||||
*/
|
||||
DstPortIsNull(10308,"IP类域配置的dstPort不能为空"),
|
||||
/**
|
||||
* IP类域配置的maskDstPort不能为空
|
||||
*/
|
||||
MaskDstPortIsNull(10309,"IP类域配置的maskDstPort不能为空"),
|
||||
/**
|
||||
* IP类域配置的protocol不能为空
|
||||
*/
|
||||
ProtocolIsNull(10310,"IP类域配置的protocol不能为空"),
|
||||
/**
|
||||
* IP类域配置的direction不能为空
|
||||
*/
|
||||
DirectionIsNull(10311,"IP类域配置的direction不能为空"),
|
||||
|
||||
//数值类域数据完整性业务码10400~
|
||||
/**
|
||||
* 编译配置中缺少字符串类域配置信息
|
||||
*/
|
||||
StrRegionIsNull(10400, "Maat配置中不能缺少字符串类域配置信息"),
|
||||
/**
|
||||
* 字符串类域配置的keywords不能为空
|
||||
*/
|
||||
KeywordsIsNull(10401,"字符串类域配置的keywords不能为空"),
|
||||
/**
|
||||
* 字符串类域配置的district不能为空
|
||||
*/
|
||||
DistrictIsNull(10402,"字符串类域配置的district不能为空"),
|
||||
/**
|
||||
* 字符串类域配置的exprType不能为空
|
||||
*/
|
||||
ExprTypeIsNull(10403,"字符串类域配置的keywords不能为空"),
|
||||
|
||||
/**
|
||||
* 字符串类域配置的matchMethod不能为空
|
||||
*/
|
||||
MatchMethodIsNull(10404,"字符串类域配置的matchMethod不能为空"),
|
||||
|
||||
/**
|
||||
* 字符串类域配置的isHexbin不能为空
|
||||
*/
|
||||
IsHexbinIsNull(10405,"字符串类域配置的isHexbin不能为空"),
|
||||
|
||||
//摘要类域数据完整性业务码10500~
|
||||
/**
|
||||
* 摘要类域配置的rawLen不能为空
|
||||
*/
|
||||
RawLenIsNull(10500,"摘要类域配置的rawLen不能为空"),
|
||||
/**
|
||||
* 摘要类域配置的digest的值只能是1到10
|
||||
*/
|
||||
DigestIsNull(10501,"摘要类域配置的digest不能为空"),
|
||||
|
||||
/**
|
||||
* 摘要类域配置的cfdsLevel不能为空
|
||||
*/
|
||||
CfdsLevelIsNull(10502,"摘要类域配置的cfdsLevel不能为空"),
|
||||
|
||||
/**
|
||||
* 回调类配置的cfgId字段不能为空
|
||||
*/
|
||||
CfgIdIsNull(10600,"配置的cfgId字段不能为空"),
|
||||
/**
|
||||
* 回调类配置的属性不能为空
|
||||
*/
|
||||
FieldIsNull(10601,"配置属性不能为空"),
|
||||
/**
|
||||
* 回调类上传文件不能为空
|
||||
*/
|
||||
FileIsNull(10602,"上传文件不能为空"),
|
||||
|
||||
/**
|
||||
* 回调类checksum与文件MD5值不一致
|
||||
*/
|
||||
CheckSumIsWrong(10603,"checksum与文件MD5值不一致"),
|
||||
|
||||
//配置业务格式验证 20000
|
||||
/**
|
||||
* 编译配置的groupNum属性值等于0
|
||||
*/
|
||||
GroupNumIsZero(20001, "Maat配置groupNum属性值,不能等于0"),
|
||||
/**
|
||||
* 编译配置的groupNum属性值大于8
|
||||
*/
|
||||
GroupNumGtEight(20002, "Maat配置的groupNum属性值大于8"),
|
||||
|
||||
/**
|
||||
* 编译配置的groupNum属性值与groupRelationList长度不相等
|
||||
*/
|
||||
GroupNumNEQGroupList(20003, "Maat配置的groupNum属性值与groupRelationList长度不等"),
|
||||
/**
|
||||
* 编译配置的的fatherCfgId不能为空
|
||||
*/
|
||||
FatherCfgIdIsWrongRange(20004, "Maat配置的fatherCfgId值不在有效范围"),
|
||||
/**
|
||||
* 编译配置的service与action不匹配
|
||||
*/
|
||||
ServiceUnmatchAction(20005, "Maat配置的service与action不匹配"),
|
||||
/**
|
||||
* 编译配置的的startTime不能晚于endTime
|
||||
*/
|
||||
EndTimeGTStartTime(20006, "Maat配置的startTime不能晚于endTime"),
|
||||
/**
|
||||
* 配置的isValid在添加时不能为无效
|
||||
*/
|
||||
IsValidIsT(20007, "配置增加操作,isValid值不能无效"),
|
||||
/**
|
||||
* 配置的isValid在配置取消时不能为有效
|
||||
*/
|
||||
IsValidIsF(20008, "配置取消操作,isValid值不能为有效"),
|
||||
// /**
|
||||
// * 编译配置的groupRelationList的配置在添加时不能为无效
|
||||
// */
|
||||
// GroupRegionIsValid(1021, "编译配置的分组配置在添加时不能为无效"),
|
||||
//
|
||||
// /**
|
||||
// * 编译配置的groupRelationList的配置在添加时不能为有效
|
||||
// */
|
||||
// GroupRegionIsNotValid(1021, "编译配置的分组配置在修改时不能为有效"),
|
||||
|
||||
/**
|
||||
* 配置分组与编译配置的compileId不一致
|
||||
*/
|
||||
CompileIdIsNeq(20009,"Maat配置分组与编译配置的compileId不一致"),
|
||||
|
||||
/**
|
||||
* 配置分组中同一groupId出现多次
|
||||
*/
|
||||
GroupIdIsRepeat(20100,"Maat配置分组中同一groupId不能出现多次"),
|
||||
|
||||
/**
|
||||
* tableName与编译配置业务类型不一致
|
||||
*/
|
||||
TableNameUnmatchService(20101, "tableName与编译配置业务类型不匹配"),
|
||||
|
||||
/**
|
||||
*数值域配置的lowBoundary值不在有效范围内
|
||||
*/
|
||||
LowBoundaryIsWrongRange(20200, "数值域配置的lowBoundary值不在有效范围内"),
|
||||
/**
|
||||
*数值域配置的upBoundary值不在有效范围内
|
||||
*/
|
||||
UpBoundaryIsWrongRange(20201, "数值域配置的upBoundary值不在有效范围内"),
|
||||
/**
|
||||
*数值域配置的lowBoundary大于upBoundary值
|
||||
*/
|
||||
LowBoundaryGTUpBoundary(20202, "数值域配置的lowBoundary大于upBoundary值"),
|
||||
|
||||
/**
|
||||
* IP类域配置的direction的值不在有效范围
|
||||
*/
|
||||
DirectionIsWrongRange(20300,"Maat配置的direction的值只能是0或1"),
|
||||
|
||||
/**
|
||||
* IP类域配置的IP或IpMask与addrType不一致
|
||||
*/
|
||||
IPUnMatchAddrType(20301,"Maat配置IP或IpMask与addrType不一致"),
|
||||
/**
|
||||
* IP类域配置的port格式不正确
|
||||
*/
|
||||
PortIsNotVal(20302,"配置port或portMask格式不正确"),
|
||||
/**
|
||||
* IP类域配置的srcIp和dstIp不能相同
|
||||
*/
|
||||
SrcIpEQDstIp(20303,"Maat配置的srcIp和dstIp不能相同"),
|
||||
|
||||
/**
|
||||
* 字符串域配置的exprType的值只能是0(无表达式)或者1(与表达式)
|
||||
*/
|
||||
ExprTypeIsWrongRange(20400,"Maat配置的exprType的值只能是0(无表达式)或者1(与表达式)"),
|
||||
|
||||
/**
|
||||
* 字符串域配置的matchMethod的值只能是0(无表达式)或者1(与表达式)
|
||||
*/
|
||||
MatchMethodIsWrongRange(20401,"Maat配置的matchMethod的值只能是0(子串匹配),1(右匹配),2(左匹配),3(完全匹配)"),
|
||||
|
||||
/**
|
||||
* 字符串域配置的isHexbin的值只能是0(大小写不敏感,且非HEX)或者1(HEX)或者2(大小写敏感,且非HEX)
|
||||
*/
|
||||
IsHexbinIsWrongRange(20402,"Maat配置的isHexbin的值只能是0(大小写不敏感,且非HEX)或者1(HEX)或者2(大小写敏感,且非HEX)"),
|
||||
/**
|
||||
* 摘要类域配置的cfdsLevel的值只能是1到10
|
||||
*/
|
||||
CfdsLevelIsWrongRange(20500,"Maat配置cfdsLevel的值只能是1到10"),
|
||||
|
||||
|
||||
//回调类
|
||||
/**
|
||||
* 回调类service配置不正确
|
||||
*/
|
||||
ServiceIsWrong(20600,"service的值配置不正确"),
|
||||
|
||||
/**
|
||||
* 回调类ipType属性只能为4(IPV4)、6(IPV6)
|
||||
*/
|
||||
IpTypeIsWrong(20601,"ipType属性只能为4(IPV4)、6(IPV6)"),
|
||||
|
||||
/**
|
||||
* 回调类的XX属性不是数值类型
|
||||
*/
|
||||
MastNumberic(20602,"属性值不是数值类型"),
|
||||
/**
|
||||
* 回调类的XX属性不是数值类型
|
||||
*/
|
||||
MastDate(20602,"属性值不是日期类型"),
|
||||
/**
|
||||
* 回调类的XX属性不是数值类型
|
||||
*/
|
||||
IpIsUnMatchType(20603,"配置IP或Mask与addrType不一致"),
|
||||
/**
|
||||
* 回调类的XX属性取值不在Range范围内
|
||||
*/
|
||||
ValueInWrongRange(20604,"属性取值不在Range范围内"),
|
||||
/**
|
||||
* 回调类的XX属性取值符合正则表达式验证
|
||||
*/
|
||||
ValueInWrongRegexp(20605,"属性值与正则表达式不匹配"),
|
||||
|
||||
IsValidInWrongRange(20606,"isValid属性格式不正确"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,11 +13,24 @@ import com.nis.domain.restful.IpRegion;
|
||||
import com.nis.domain.restful.NumRegion;
|
||||
import com.nis.domain.restful.StrRegion;
|
||||
import com.nis.listener.SystemConfigListener;
|
||||
import com.nis.restful.CompileJudgeCode;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.web.service.restful.ConfigSourcesService;
|
||||
|
||||
public class CompileVal {
|
||||
|
||||
private static Integer businessCode = null;
|
||||
/**
|
||||
* @param businessCode the businessCode to set
|
||||
*/
|
||||
public static void setBusinessCode(Integer businessCode) {
|
||||
CompileVal.businessCode = businessCode;
|
||||
}
|
||||
/**
|
||||
* @return the businessCode
|
||||
*/
|
||||
public static Integer getBusinessCode() {
|
||||
return businessCode;
|
||||
}
|
||||
/**
|
||||
* 判断当前编译配置中的groupNum属性值与配置分组groupList大小是否小于等于8且大于0
|
||||
*
|
||||
@@ -37,76 +50,44 @@ public class CompileVal {
|
||||
return valCompile;
|
||||
}
|
||||
}
|
||||
if (null == configCompile.getCompileId()) {
|
||||
return "compileId字段不能为空";
|
||||
}
|
||||
|
||||
if (null == configCompile.getGroupNum()) {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupNumIsNull.getErrorReason();
|
||||
}
|
||||
|
||||
if (null != configCompile.getGroupNum() && configCompile.getGroupNum() > 8) {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupNumGtEight.getErrorReason();
|
||||
}
|
||||
if (null != configCompile.getGroupNum() && configCompile.getGroupNum() <= 0) {
|
||||
businessCode = RestBusinessCode.GroupNumIsZero.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupNumEQZero.getErrorReason();
|
||||
+ RestBusinessCode.GroupNumIsZero.getErrorReason();
|
||||
}
|
||||
if (null != configCompile.getGroupNum() && configCompile.getGroupNum() > 8) {
|
||||
businessCode = RestBusinessCode.GroupNumGtEight.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ RestBusinessCode.GroupNumGtEight.getErrorReason();
|
||||
}
|
||||
|
||||
|
||||
if (null == configCompile.getGroupRelationList()) {
|
||||
if (null == configCompile.getGroupRelationList()||configCompile.getGroupRelationList().size()==0) {
|
||||
businessCode = RestBusinessCode.CompileGroupIsNull.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.CompileGroupIsNull.getErrorReason();
|
||||
}
|
||||
if (null != configCompile.getGroupRelationList() && configCompile.getGroupRelationList().size() <= 0) {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupListEQZero.getErrorReason();
|
||||
}
|
||||
if (null != configCompile.getGroupRelationList() && configCompile.getGroupRelationList().size() > 8) {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupListGtEight.getErrorReason();
|
||||
+ RestBusinessCode.CompileGroupIsNull.getErrorReason();
|
||||
}
|
||||
|
||||
if (configCompile.getGroupRelationList().size() != configCompile.getGroupNum()) {
|
||||
businessCode = RestBusinessCode.GroupNumNEQGroupList.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupNumNEQGroupList.getErrorReason();
|
||||
+ RestBusinessCode.GroupNumNEQGroupList.getErrorReason();
|
||||
}
|
||||
|
||||
// int sizeCount = 0;
|
||||
// if (configCompile.getIpRegionList() == null &&
|
||||
// configCompile.getStrRegionList() == null
|
||||
// && configCompile.getNumRegionList() == null) {
|
||||
// return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
// + CompileJudgeCode.CompileNotNull.getErrorReason();
|
||||
// } else {
|
||||
// if (configCompile.getIpRegionList() != null) {
|
||||
// sizeCount += configCompile.getIpRegionList().size();
|
||||
// }
|
||||
// if (configCompile.getStrRegionList() != null) {
|
||||
// sizeCount += configCompile.getStrRegionList().size();
|
||||
// }
|
||||
// if (configCompile.getNumRegionList() != null) {
|
||||
// sizeCount += configCompile.getNumRegionList().size();
|
||||
// }
|
||||
//
|
||||
// if (sizeCount == 0) {
|
||||
// return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
// + CompileJudgeCode.CompileNotNull.getErrorReason();
|
||||
// }
|
||||
// }
|
||||
if (!isUpdate) {
|
||||
if (configCompile.getIsValid() != 1) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置在添加时不能为无效";
|
||||
}
|
||||
} else {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
if (configCompile.getIsValid() != 0) {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置在修改时不能为有效";
|
||||
}
|
||||
}
|
||||
return CompileJudgeCode.GroupNumAndListLtEight.getErrorReason();
|
||||
return "ok";
|
||||
} else {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的" + CompileJudgeCode.CompileIsNull.getErrorReason();
|
||||
return RestBusinessCode.CompileIsNull.getErrorReason();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -134,10 +115,12 @@ public class CompileVal {
|
||||
if (groupRelationList.size() > 0) {
|
||||
for (ConfigGroupRelation configGroupRelation : groupRelationList) {
|
||||
if (!isUpdate && (null == configGroupRelation.getIsValid() || configGroupRelation.getIsValid() != 1)) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置groupRelationList字段中的groupId为"
|
||||
+ configGroupRelation.getGroupId() + "的配置在添加时不能为无效";
|
||||
}
|
||||
if (isUpdate && (null == configGroupRelation.getIsValid() || configGroupRelation.getIsValid() != 0)) {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置groupRelationList字段中的groupId为"
|
||||
+ configGroupRelation.getGroupId() + "的配置在修改时不能为有效";
|
||||
}
|
||||
@@ -150,26 +133,30 @@ public class CompileVal {
|
||||
}
|
||||
|
||||
if (!configGroupRelation.getCompileId().equals(compileId)) {
|
||||
businessCode = RestBusinessCode.CompileIdIsNeq.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中groupRelationList字段中的groupId为"
|
||||
+ configGroupRelation.getGroupId() + "的配置分组与编译配置id不一致";
|
||||
}
|
||||
if (!groupList.contains(configGroupRelation.getGroupId())) {
|
||||
groupList.add(configGroupRelation.getGroupId());
|
||||
} else {
|
||||
businessCode = RestBusinessCode.GroupIdIsRepeat.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中groupRelationList存在多个groupId为"
|
||||
+ configGroupRelation.getGroupId() + "的配置分组";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.GroupListEQZero.getErrorReason();
|
||||
}
|
||||
// else {
|
||||
// return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
// + CompileJudgeCode.GroupListEQZero.getErrorReason();
|
||||
// }
|
||||
|
||||
List<Long> regionGroupIdList = new ArrayList<Long>();// 所有域配置中groupId的集合,不重复
|
||||
List<NumRegion> numRegionList = configCompile.getNumRegionList();
|
||||
if (numRegionList == null) {
|
||||
businessCode = RestBusinessCode.NumRegionIsNull.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.NumRegionIsNull.getErrorReason();
|
||||
+ RestBusinessCode.NumRegionIsNull.getErrorReason();
|
||||
}
|
||||
if (numRegionList.size() > 0) {
|
||||
for (NumRegion numRegion : numRegionList) {
|
||||
@@ -178,19 +165,23 @@ public class CompileVal {
|
||||
|
||||
if (!StringUtil.isEmpty(numRegion.getTableName())
|
||||
&& !type2TableNameIsOk(configCompile.getService(), numRegion.getTableName())) {
|
||||
businessCode = RestBusinessCode.TableNameUnmatchService.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为"
|
||||
+ numRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致";
|
||||
}
|
||||
if (!isUpdate && numRegion.getIsValid() != 1) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为"
|
||||
+ numRegion.getRegionId() + "的域配置在添加时不能为无效";
|
||||
}
|
||||
if (isUpdate && numRegion.getIsValid() != 0) {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为"
|
||||
+ numRegion.getRegionId() + "的域配置在修改时不能为有效";
|
||||
}
|
||||
|
||||
if (groupList.size() > 0 && !groupList.contains(numRegion.getGroupId())) {
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中numRegionList中的regionid为"
|
||||
+ numRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在";
|
||||
}
|
||||
@@ -216,8 +207,9 @@ public class CompileVal {
|
||||
|
||||
List<StrRegion> strRegionList = configCompile.getStrRegionList();
|
||||
if (strRegionList == null) {
|
||||
businessCode = RestBusinessCode.StrRegionIsNull.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ CompileJudgeCode.StrRegionIsNull.getErrorReason();
|
||||
+ RestBusinessCode.StrRegionIsNull.getErrorReason();
|
||||
}
|
||||
if (strRegionList != null && strRegionList.size() > 0) {
|
||||
for (StrRegion strRegion : strRegionList) {
|
||||
@@ -225,19 +217,23 @@ public class CompileVal {
|
||||
// !regionGroupIdList.contains(strRegion.getGroupId())) {
|
||||
if (!StringUtil.isEmpty(strRegion.getTableName())
|
||||
&& !type2TableNameIsOk(configCompile.getService(), strRegion.getTableName())) {
|
||||
businessCode = RestBusinessCode.TableNameUnmatchService.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为"
|
||||
+ strRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致";
|
||||
}
|
||||
if (!isUpdate && strRegion.getIsValid() != 1) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为"
|
||||
+ strRegion.getRegionId() + "的域配置在添加时不能为无效";
|
||||
}
|
||||
if (isUpdate && strRegion.getIsValid() != 0) {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为"
|
||||
+ strRegion.getRegionId() + "的域配置在修改时不能为有效";
|
||||
}
|
||||
|
||||
if (groupList.size() > 0 && !groupList.contains(strRegion.getGroupId())) {
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中strRegionList中的regionid为"
|
||||
+ strRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在";
|
||||
}
|
||||
@@ -266,7 +262,9 @@ public class CompileVal {
|
||||
List<IpRegion> ipRegionList = configCompile.getIpRegionList();
|
||||
|
||||
if (ipRegionList == null) {
|
||||
return CompileJudgeCode.IpRegionIsNull.getErrorReason();
|
||||
businessCode = RestBusinessCode.IpRegionIsNull.getValue();
|
||||
return "编译配置id为" + configCompile.getCompileId() + "的配置中"
|
||||
+ RestBusinessCode.IpRegionIsNull.getErrorReason();
|
||||
}
|
||||
if (ipRegionList != null && ipRegionList.size() > 0) {
|
||||
for (IpRegion ipRegion : ipRegionList) {
|
||||
@@ -274,20 +272,24 @@ public class CompileVal {
|
||||
// !regionGroupIdList.contains(ipRegion.getGroupId())) {
|
||||
if (!StringUtil.isEmpty(ipRegion.getTableName())
|
||||
&& !type2TableNameIsOk(configCompile.getService(), ipRegion.getTableName())) {
|
||||
businessCode = RestBusinessCode.TableNameUnmatchService.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致";
|
||||
}
|
||||
|
||||
if (!isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 1)) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的域配置在添加时不能为无效";
|
||||
}
|
||||
if (isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 0)) {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的域配置在修改时不能为有效";
|
||||
}
|
||||
|
||||
if (groupList.size() > 0 && !groupList.contains(ipRegion.getGroupId())) {
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipRegionList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在";
|
||||
}
|
||||
@@ -321,15 +323,18 @@ public class CompileVal {
|
||||
// 不验证表名和业务类型是否对应
|
||||
|
||||
if (!isUpdate && digestRegion.getIsValid() != 1) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为"
|
||||
+ digestRegion.getRegionId() + "的域配置在添加时不能为无效";
|
||||
}
|
||||
if (isUpdate && digestRegion.getIsValid() != 0) {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegionList中的regionid为"
|
||||
+ digestRegion.getRegionId() + "的域配置在修改时不能为有效";
|
||||
}
|
||||
|
||||
if (groupList.size() > 0 && !groupList.contains(digestRegion.getGroupId())) {
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中digestRegion中的regionid为"
|
||||
+ digestRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在";
|
||||
}
|
||||
@@ -361,20 +366,24 @@ public class CompileVal {
|
||||
// !regionGroupIdList.contains(ipRegion.getGroupId())) {
|
||||
if (!StringUtil.isEmpty(ipRegion.getTableName())
|
||||
&& !type2TableNameIsOk(configCompile.getService(), ipRegion.getTableName())) {
|
||||
businessCode = RestBusinessCode.TableNameUnmatchService.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的域配置tableName与编译配置业务类型不一致";
|
||||
}
|
||||
|
||||
if (!isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 1)) {
|
||||
businessCode = RestBusinessCode.IsValidIsT.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的域配置在添加时不能为无效";
|
||||
}
|
||||
if (isUpdate && (null == ipRegion.getIsValid() || ipRegion.getIsValid() != 0)) {
|
||||
businessCode = RestBusinessCode.IsValidIsF.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的域配置在修改时不能为有效";
|
||||
}
|
||||
|
||||
if (groupList.size() > 0 && !groupList.contains(ipRegion.getGroupId())) {
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNotFound.getValue();
|
||||
return "配置id为" + configCompile.getCompileId() + "的配置中ipClientRangeList中的regionid为"
|
||||
+ ipRegion.getRegionId() + "的配置的groupid在配置分组关系中不存在";
|
||||
}
|
||||
@@ -397,7 +406,7 @@ public class CompileVal {
|
||||
}
|
||||
}
|
||||
}
|
||||
return CompileJudgeCode.CompileGroupSizeGtZero.getErrorReason();
|
||||
return "ok";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -449,12 +458,12 @@ public class CompileVal {
|
||||
public static String compileIsOk(ConfigCompile configCompile, boolean isUpdate, StringBuffer sb) {
|
||||
|
||||
String msg1 = groupNumAndListIsOk(configCompile, isUpdate);
|
||||
if (msg1 != CompileJudgeCode.GroupNumAndListLtEight.getErrorReason()) {
|
||||
if (!"ok".equals(msg1)) {
|
||||
return msg1;
|
||||
}
|
||||
|
||||
String msg2 = compileGroupSizeIsGtZero(configCompile, isUpdate, sb);
|
||||
if (msg2 != CompileJudgeCode.CompileGroupSizeGtZero.getErrorReason()) {
|
||||
if (!"ok".equals(msg2)) {
|
||||
return msg2;
|
||||
}
|
||||
String latentMsg = ",数据中可能存在的问题:";
|
||||
@@ -463,7 +472,7 @@ public class CompileVal {
|
||||
sb.setLength(0);
|
||||
sb.append(latentMsg);
|
||||
}
|
||||
return CompileJudgeCode.CompileIsOk.getErrorReason();
|
||||
return "ok";
|
||||
}
|
||||
|
||||
public static void setSbStr(String str, StringBuffer sb) {
|
||||
@@ -475,44 +484,56 @@ public class CompileVal {
|
||||
public static String valCompile(ConfigCompile configCompile) {
|
||||
Long compileId = configCompile.getCompileId();
|
||||
if (null == compileId) {
|
||||
return "compileId字段不能为空";
|
||||
businessCode = RestBusinessCode.CompileIdIsNull.getValue();
|
||||
return RestBusinessCode.CompileIdIsNull.getErrorReason();
|
||||
}
|
||||
if (null == configCompile.getService()) {
|
||||
return "id为" + compileId + "的编译配置中service不能为空";
|
||||
businessCode = RestBusinessCode.ServiceIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中service不能为空";
|
||||
}
|
||||
|
||||
if (null == configCompile.getAction()) {
|
||||
return "id为" + compileId + "的编译配置中action不能为空";
|
||||
businessCode = RestBusinessCode.ActionIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中action不能为空";
|
||||
}
|
||||
if (null == configCompile.getDoBlacklist()) {
|
||||
return "id为" + compileId + "的编译配置中doBlacklist不能为空";
|
||||
businessCode = RestBusinessCode.DoBlacklistIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中doBlacklist不能为空";
|
||||
}
|
||||
if (null == configCompile.getDoLog()) {
|
||||
return "id为" + compileId + "的编译配置中doLog不能为空";
|
||||
businessCode = RestBusinessCode.DoLogIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中doLog不能为空";
|
||||
}
|
||||
if (null == configCompile.getEffectiveRange() || configCompile.getEffectiveRange().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中effectiveRange不能为空";
|
||||
businessCode = RestBusinessCode.EffectiveRangeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中effectiveRange不能为空";
|
||||
}
|
||||
if (null == configCompile.getStartTime()) {
|
||||
return "id为" + compileId + "的编译配置中startTime不能为空";
|
||||
businessCode = RestBusinessCode.StartTimeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中startTime不能为空";
|
||||
}
|
||||
if (null == configCompile.getEndTime()) {
|
||||
return "id为" + compileId + "的编译配置中endTime不能为空";
|
||||
businessCode = RestBusinessCode.EndTimeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中endTime不能为空";
|
||||
}
|
||||
// if (null == configCompile.getUserRegion() || configCompile.getUserRegion().equals("")) {
|
||||
// return "id为" + compileId + "的编译配置中userRegion不能为空";
|
||||
// return "编译配置id为" + compileId + "的编译配置中userRegion不能为空";
|
||||
// }
|
||||
if (null == configCompile.getIsValid()) {
|
||||
return "id为" + compileId + "的编译配置中isValid不能为空";
|
||||
businessCode = RestBusinessCode.IsValidIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中isValid不能为空";
|
||||
}
|
||||
if (null == configCompile.getGroupNum()) {
|
||||
return "id为" + compileId + "的编译配置中groupNum不能为空";
|
||||
businessCode = RestBusinessCode.GroupNumIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中groupNum不能为空";
|
||||
}
|
||||
if (null == configCompile.getFatherCfgId()) {
|
||||
return "id为" + compileId + "的编译配置中fatherCfgId不能为空";
|
||||
businessCode = RestBusinessCode.FatherCfgIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中fatherCfgId不能为空";
|
||||
}
|
||||
if (null == configCompile.getOpTime()) {
|
||||
return "id为" + compileId + "的编译配置中opTime不能为空";
|
||||
businessCode = RestBusinessCode.OpTimeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中opTime不能为空";
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
@@ -520,67 +541,84 @@ public class CompileVal {
|
||||
public static String valCompileGroup(ConfigGroupRelation configGroupRelation, Long compileId) {
|
||||
Long groupId = configGroupRelation.getGroupId();
|
||||
if (null == groupId) {
|
||||
return "id为" + compileId + "的编译配置中的配置分组的groupId不能为空";
|
||||
businessCode = RestBusinessCode.GroupIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的配置分组的groupId不能为空";
|
||||
}
|
||||
|
||||
if (null == configGroupRelation.getCompileId()) {
|
||||
return "id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置compileId不能为空";
|
||||
businessCode = RestBusinessCode.GroupsCompileIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置compileId不能为空";
|
||||
}
|
||||
if (null == configGroupRelation.getIsValid()) {
|
||||
return "id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置isValid不能为空";
|
||||
businessCode = RestBusinessCode.GroupsIsValidIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置isValid不能为空";
|
||||
}
|
||||
|
||||
if (null == configGroupRelation.getOpTime()) {
|
||||
return "id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置opTime不能为空";
|
||||
businessCode = RestBusinessCode.OpTimeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的配置分组id为" + groupId + "的配置opTime不能为空";
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
|
||||
public static String valIpRegion(IpRegion ipRegion, Long compileId) {
|
||||
|
||||
Long regionId = ipRegion.getRegionId();
|
||||
if (null == regionId) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置的regionId不能为空";
|
||||
businessCode = RestBusinessCode.RegionIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置的regionId不能为空";
|
||||
}
|
||||
if (null == ipRegion.getGroupId()) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
}
|
||||
if (null == ipRegion.getAddrType()) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置addrType不能为空";
|
||||
businessCode = RestBusinessCode.AddrTypeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置addrType不能为空";
|
||||
}
|
||||
if (null == ipRegion.getSrcIp() || ipRegion.getSrcIp().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcIp不能为空";
|
||||
businessCode = RestBusinessCode.SrcIpIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcIp不能为空";
|
||||
}
|
||||
|
||||
if (null == ipRegion.getMaskSrcIp() || ipRegion.getMaskSrcIp().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcIp不能为空";
|
||||
businessCode = RestBusinessCode.MaskSrcIpIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcIp不能为空";
|
||||
}
|
||||
if (null == ipRegion.getSrcPort() || ipRegion.getSrcPort().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcPort不能为空";
|
||||
businessCode = RestBusinessCode.SrcPortIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置srcPort不能为空";
|
||||
}
|
||||
if (null == ipRegion.getMaskSrcPort() || ipRegion.getMaskSrcPort().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcPort不能为空";
|
||||
businessCode = RestBusinessCode.MaskSrcPortIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskSrcPort不能为空";
|
||||
}
|
||||
if (null == ipRegion.getDstIp() || ipRegion.getDstIp().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstIp不能为空";
|
||||
businessCode = RestBusinessCode.DstIpIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstIp不能为空";
|
||||
}
|
||||
if (null == ipRegion.getMaskDstIp() || ipRegion.getMaskDstIp().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstIp不能为空";
|
||||
businessCode = RestBusinessCode.MaskDstIpIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstIp不能为空";
|
||||
}
|
||||
if (null == ipRegion.getDstPort() || ipRegion.getDstPort().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstPort不能为空";
|
||||
businessCode = RestBusinessCode.DstPortIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置dstPort不能为空";
|
||||
}
|
||||
if (null == ipRegion.getMaskDstPort() || ipRegion.getMaskDstPort().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstPort不能为空";
|
||||
businessCode = RestBusinessCode.MaskDstPortIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置maskDstPort不能为空";
|
||||
}
|
||||
if (null == ipRegion.getProtocol()) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置protocol不能为空";
|
||||
businessCode = RestBusinessCode.ProtocolIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置protocol不能为空";
|
||||
}
|
||||
if (null == ipRegion.getDirection()) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置direction不能为空";
|
||||
businessCode = RestBusinessCode.DirectionIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置direction不能为空";
|
||||
}
|
||||
if (null == ipRegion.getIsValid()) {
|
||||
return "id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置isValid不能为空";
|
||||
businessCode = RestBusinessCode.IsValidIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的ip类域配置id为" + regionId + "的配置isValid不能为空";
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
@@ -588,16 +626,20 @@ public class CompileVal {
|
||||
public static String valNumRegion(NumRegion numRegion, Long compileId) {
|
||||
Long regionId = numRegion.getRegionId();
|
||||
if (null == regionId) {
|
||||
return "id为" + compileId + "的编译配置中的数值类域配置的regionId不能为空";
|
||||
businessCode = RestBusinessCode.RegionIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的数值类域配置的regionId不能为空";
|
||||
}
|
||||
if (null == numRegion.getGroupId()) {
|
||||
return "id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
}
|
||||
if (null == numRegion.getLowBoundary()) {
|
||||
return "id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置lowBoundary不能为空";
|
||||
businessCode = RestBusinessCode.LowBoundaryIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置lowBoundary不能为空";
|
||||
}
|
||||
if (null == numRegion.getUpBoundary()) {
|
||||
return "id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置upBoundary不能为空";
|
||||
businessCode = RestBusinessCode.UpBoundaryIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的数值类域配置id为" + regionId + "的配置upBoundary不能为空";
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
@@ -605,28 +647,35 @@ public class CompileVal {
|
||||
public static String valStrRegion(StrRegion strRegion, Long compileId, boolean isDirtrict) {
|
||||
Long regionId = strRegion.getRegionId();
|
||||
if (null == regionId) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置的regionId不能为空";
|
||||
businessCode = RestBusinessCode.RegionIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置的regionId不能为空";
|
||||
}
|
||||
if (null == strRegion.getGroupId()) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
}
|
||||
if (isDirtrict && (null == strRegion.getDistrict() || strRegion.getDistrict().equals(""))) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置district不能为空";
|
||||
businessCode = RestBusinessCode.DistrictIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置district不能为空";
|
||||
}
|
||||
|
||||
if (null == strRegion.getKeywords() || strRegion.getKeywords().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置keywords不能为空";
|
||||
businessCode = RestBusinessCode.KeywordsIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置keywords不能为空";
|
||||
}
|
||||
|
||||
if (null == strRegion.getExprType()) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置exprType不能为空";
|
||||
businessCode = RestBusinessCode.ExprTypeIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置exprType不能为空";
|
||||
}
|
||||
|
||||
if (null == strRegion.getMatchMethod()) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置matchMethod不能为空";
|
||||
businessCode = RestBusinessCode.MatchMethodIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置matchMethod不能为空";
|
||||
}
|
||||
if (null == strRegion.getIsHexbin()) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置isHexbin不能为空";
|
||||
businessCode = RestBusinessCode.MatchMethodIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置isHexbin不能为空";
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
@@ -634,65 +683,80 @@ public class CompileVal {
|
||||
public static String valDigestRegion(DigestRegion digestRegion, Long compileId) {
|
||||
Long regionId = digestRegion.getRegionId();
|
||||
if (null == regionId) {
|
||||
return "id为" + compileId + "的编译配置中的摘要类域配置的regionId不能为空";
|
||||
businessCode = RestBusinessCode.RegionIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的摘要类域配置的regionId不能为空";
|
||||
}
|
||||
if (null == digestRegion.getGroupId()) {
|
||||
return "id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
businessCode = RestBusinessCode.RegionsGroupIdIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置groupId不能为空";
|
||||
}
|
||||
if (null == digestRegion.getRawLen()) {
|
||||
return "id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置rawLen不能为空";
|
||||
businessCode = RestBusinessCode.RawLenIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置rawLen不能为空";
|
||||
}
|
||||
if (null == digestRegion.getDigest() || digestRegion.getDigest().equals("")) {
|
||||
return "id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置digest不能为空";
|
||||
businessCode = RestBusinessCode.DigestIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的摘要类域配置id为" + regionId + "的配置digest不能为空";
|
||||
}
|
||||
if (null == digestRegion.getCfdsLevel()) {
|
||||
return "id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置cfdsLevel不能为空";
|
||||
businessCode = RestBusinessCode.CfdsLevelIsNull.getValue();
|
||||
return "编译配置id为" + compileId + "的编译配置中的字符串类域配置id为" + regionId + "的配置cfdsLevel不能为空";
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
|
||||
public static String serviceIpClientRegionVal(IpRegion ipRegion, Long compileId) {
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置srcIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskSrcIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置dstIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskDstIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getSrcPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() + "的域配置srcPort的格式不正确";
|
||||
}
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskSrcPort())) {
|
||||
// if (!BasicProvingUtil.isIntType(ipRegion.getMaskSrcPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskSrcPort的格式不正确";
|
||||
}
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getDstPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId() + "的域配置dstPort的格式不正确";
|
||||
}
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskDstPort())) {
|
||||
// if (!BasicProvingUtil.isIntType(ipRegion.getMaskDstPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskDstPort的格式不正确";
|
||||
}
|
||||
|
||||
if (ipRegion.getSrcIp().equals(ipRegion.getDstIp())) {
|
||||
businessCode = RestBusinessCode.SrcIpEQDstIp.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置srcIp和dstIp不能相同";
|
||||
}
|
||||
if (ipRegion.getDirection() != 1 && ipRegion.getDirection() != 0) {
|
||||
businessCode = RestBusinessCode.DirectionIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipClientRangeList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置direction的值不正确,只能是0或1";
|
||||
}
|
||||
@@ -717,46 +781,56 @@ public class CompileVal {
|
||||
|
||||
public static String serviceIpRegionVal(IpRegion ipRegion, Long compileId) {
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getSrcIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置srcIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskSrcIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskSrcIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getDstIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置dstIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
if (!BasicProvingUtil.isIpOrIpMask(ipRegion.getMaskDstIp(), ipRegion.getAddrType())) {
|
||||
businessCode = RestBusinessCode.IPUnMatchAddrType.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskDstIp的格式不正确或与addrType不一致";
|
||||
}
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getSrcPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() + "的域配置srcPort的格式不正确";
|
||||
}
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskSrcPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
// if (!BasicProvingUtil.isIntType(ipRegion.getMaskSrcPort())) {
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskSrcPort的格式不正确";
|
||||
}
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getDstPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId() + "的域配置dstPort的格式不正确";
|
||||
}
|
||||
|
||||
if (!BasicProvingUtil.isPortOrPortMask(ipRegion.getMaskDstPort())) {
|
||||
// if (!BasicProvingUtil.isIntType(ipRegion.getMaskDstPort())) {
|
||||
businessCode = RestBusinessCode.PortIsNotVal.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置maskDstPort的格式不正确";
|
||||
}
|
||||
|
||||
if (ipRegion.getSrcIp().equals(ipRegion.getDstIp())) {
|
||||
businessCode = RestBusinessCode.SrcIpEQDstIp.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置srcIp和dstIp不能相同";
|
||||
}
|
||||
if (ipRegion.getDirection() != 1 && ipRegion.getDirection() != 0) {
|
||||
businessCode = RestBusinessCode.DirectionIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中ipRegionList中regionId为" + ipRegion.getRegionId()
|
||||
+ "的域配置direction的值不正确,只能是0或1";
|
||||
}
|
||||
@@ -784,14 +858,17 @@ public class CompileVal {
|
||||
Long upBoundary = numRegion.getUpBoundary();
|
||||
if (lowBoundary <= upBoundary) {
|
||||
if (lowBoundary > 4294967295l || lowBoundary < 0l) {
|
||||
businessCode = RestBusinessCode.LowBoundaryIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId()
|
||||
+ "的域配置lowBoundary的值不能大于2的32次方减一(4294967295)或者小于0";
|
||||
}
|
||||
if (upBoundary > 4294967295l || upBoundary < 0l) {
|
||||
businessCode = RestBusinessCode.UpBoundaryIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId()
|
||||
+ "的域配置upBoundary的值不能大于2的32次方减一(4294967295)或者小于0";
|
||||
}
|
||||
} else {
|
||||
businessCode = RestBusinessCode.LowBoundaryGTUpBoundary.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中numRegionList中regionId为" + numRegion.getRegionId()
|
||||
+ "的域配置lowBoundary的值大于upBoundary,应该是小于或等于";
|
||||
}
|
||||
@@ -802,23 +879,26 @@ public class CompileVal {
|
||||
public static String serviceConfigCompileVal(ConfigCompile configCompile) {
|
||||
Long compileId = configCompile.getCompileId();
|
||||
Integer action = ServiceAndRDBIndexReal.getActionByService(configCompile.getService());
|
||||
if (StringUtil.isEmpty(action)) {
|
||||
return "编译配置id为" + compileId + "的配置中service的值为" + configCompile.getService() + "时action不存在";
|
||||
} else if (action.compareTo(configCompile.getAction()) != 0) {
|
||||
if (action.compareTo(configCompile.getAction()) != 0) {
|
||||
businessCode = RestBusinessCode.ServiceUnmatchAction.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中service的值为" + configCompile.getService() + "时action只能为" + action;
|
||||
}
|
||||
if (configCompile.getDoBlacklist() != 1) {
|
||||
businessCode = RestBusinessCode.DoBlacklistIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中doBlacklist的值只能是1";
|
||||
}
|
||||
|
||||
if (configCompile.getDoLog() != 0 && configCompile.getDoLog() != 1 && configCompile.getDoLog() != 2) {
|
||||
businessCode = RestBusinessCode.DoLogIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中doLog的值只能是0(不需要),1(需要),2(只记录结构化日志,不记录非结构化日志)";
|
||||
}
|
||||
|
||||
if (configCompile.getFatherCfgId() != 0) {
|
||||
businessCode = RestBusinessCode.FatherCfgIdIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中fatherCfgId的值只能是0";
|
||||
}
|
||||
if (configCompile.getStartTime().getTime() > configCompile.getEndTime().getTime()) {
|
||||
businessCode = RestBusinessCode.EndTimeGTStartTime.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中startTime不能比endTime晚";
|
||||
}
|
||||
return "ok";
|
||||
@@ -830,15 +910,18 @@ public class CompileVal {
|
||||
Integer matchMethod = strRegion.getMatchMethod();
|
||||
Integer isHexbin = strRegion.getIsHexbin();
|
||||
if (exprType != 0 && exprType != 1) {
|
||||
businessCode = RestBusinessCode.ExprTypeIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId()
|
||||
+ "的域配置exprType的值只能是0(无表达式)或者1(与表达式)";
|
||||
}
|
||||
if (matchMethod != 0 && matchMethod != 1 && matchMethod != 2 && matchMethod != 3) {
|
||||
businessCode = RestBusinessCode.MatchMethodIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId()
|
||||
+ "的域配置matchMethod的值只能是0(子串匹配),1(右匹配),2(左匹配),3(完全匹配)";
|
||||
}
|
||||
|
||||
if (isHexbin != 0 && isHexbin != 1 && isHexbin != 2) {
|
||||
businessCode = RestBusinessCode.IsHexbinIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中strRegionList中regionId为" + strRegion.getRegionId()
|
||||
+ "的域配置isHexbin的值只能是0(大小写不敏感,且非HEX)或者1(HEX)或者2(大小写敏感,且非HEX)";
|
||||
}
|
||||
@@ -851,6 +934,7 @@ public class CompileVal {
|
||||
|
||||
Integer cfdsLevel = digestRegion.getCfdsLevel();
|
||||
if (!(cfdsLevel >= 1 && cfdsLevel <= 10)) {
|
||||
businessCode = RestBusinessCode.CfdsLevelIsWrongRange.getValue();
|
||||
return "编译配置id为" + compileId + "的配置中digestRegionList中regionId为" + digestRegion.getRegionId()
|
||||
+ "的域配置cfdsLevel的值只能是1到10";
|
||||
}
|
||||
|
||||
@@ -179,11 +179,11 @@ public class ServiceAndRDBIndexReal {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if (index!=-1) {
|
||||
if (index!=-1&&tableList!=null) {
|
||||
return tableList.get(index);
|
||||
} else {
|
||||
logger.error("未从业务类型和表对应关系中,找到业务类型:{},配置类型:{}表名:{}对应的真实表名", service, type, tableName);
|
||||
throw new RuntimeException("未从业务类型和表对应关系中,找到业务类型:"+service+",配置类型:"+type+"表名:"+tableName+"对应的真实表名");
|
||||
throw new RuntimeException("后台错误:未从业务类型和表对应关系中,找到业务类型:"+service+",配置类型:"+type+"表名:"+tableName+"对应的真实表名");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.nis.domain.restful.FileDesc;
|
||||
import com.nis.domain.restful.MaatConfig;
|
||||
import com.nis.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestServiceException;
|
||||
import com.nis.util.CompileVal;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.FileUtils;
|
||||
import com.nis.util.OracleErrorCodeUtil;
|
||||
@@ -324,7 +325,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
@ApiParam(value = "业务配置数据源", name = "configSource", required = true)
|
||||
public Map createConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
CompileVal.setBusinessCode(null);
|
||||
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
@@ -342,7 +343,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if ("error".equals(msg)) {
|
||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"存储编译配置时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
"存储编译配置时出现异常" + exception.getMessage(),CompileVal.getBusinessCode());
|
||||
}
|
||||
Long endSaveTime = System.currentTimeMillis();
|
||||
Long time = (endSaveTime - benginTime) / 1000;
|
||||
@@ -362,6 +363,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
@ApiParam(value = "业务配置数据源", name = "configSource", required = true)
|
||||
public Map updateConfigSource(@RequestBody ConfigSource configSource, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
CompileVal.setBusinessCode(null);
|
||||
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request,
|
||||
@@ -383,7 +385,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (msg.equals("error")) {
|
||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"修改编译配置状态时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
"修改编译配置状态时出现异常" + exception.getMessage(),CompileVal.getBusinessCode());
|
||||
}
|
||||
// configSourcesService.updateConfigSource(thread, start,
|
||||
// configSource.getConfigCompileList(),
|
||||
@@ -551,17 +553,17 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
@ApiOperation(value = "回调配置存储", httpMethod = "POST", response = Map.class, notes = "回调配置存储服务")
|
||||
public Map createCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
CompileVal.setBusinessCode(null);
|
||||
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
null);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
String msg = configSourcesService.saveCommonSources(thread, start, jsonString, sb);
|
||||
if (msg.equals("error")) {
|
||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"存储回调配置时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
"存储回调配置时出现异常" + exception.getMessage(), CompileVal.getBusinessCode());
|
||||
}
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置数据插入成功",
|
||||
Constants.IS_DEBUG ? jsonString : null);
|
||||
@@ -572,17 +574,17 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
@ApiParam(value = "回调配置状态修改", name = "updateStatConfigSource", required = true)
|
||||
public Map updateCommonConfigSource(@RequestBody String jsonString, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
CompileVal.setBusinessCode(null);
|
||||
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request,
|
||||
jsonString);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
String msg = configSourcesService.updateCommonSources(thread, start, jsonString, new Date(), sb);
|
||||
if (msg.equals("error")) {
|
||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||
"修改回调配置状态时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||
"修改回调配置状态时出现异常" + exception.getMessage(), CompileVal.getBusinessCode());
|
||||
}
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置状态修改成功",
|
||||
Constants.IS_DEBUG ? jsonString : null);
|
||||
@@ -604,7 +606,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (null == file) {
|
||||
thread.setExceptionInfo("请选择上传文件到file参数");
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请选择上传文件到file参数",
|
||||
RestBusinessCode.missing_args.getValue());
|
||||
RestBusinessCode.FileIsNull.getValue());
|
||||
|
||||
}
|
||||
if (!StringUtil.isEmpty(fileDesc.getChecksum())) {
|
||||
@@ -615,7 +617,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (!md5.equals(fileDesc.getChecksum())) {
|
||||
thread.setExceptionInfo("checksum与文件MD5值不一致");
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致",
|
||||
RestBusinessCode.config_integrity_error.getValue());
|
||||
RestBusinessCode.CheckSumIsWrong.getValue());
|
||||
}
|
||||
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||
@@ -650,7 +652,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (file == null) {
|
||||
thread.setExceptionInfo("请上传获取摘要的文件到file");
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请上传获取摘要的文件到file参数",
|
||||
RestBusinessCode.missing_args.getValue());
|
||||
RestBusinessCode.FileIsNull.getValue());
|
||||
}
|
||||
JSONObject resultObject = new JSONObject();
|
||||
FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")),
|
||||
@@ -664,7 +666,7 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
if (!md5.equals(fileDesc.getChecksum())) {
|
||||
thread.setExceptionInfo("checksum与文件MD5值不一致");
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致",
|
||||
RestBusinessCode.config_integrity_error.getValue());
|
||||
RestBusinessCode.CheckSumIsWrong.getValue());
|
||||
}
|
||||
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user