增加APP IP、域名特征属性组件后台逻辑.

This commit is contained in:
zhangwenqing
2019-02-21 18:54:12 +08:00
parent 2900eb1823
commit c028613095
4 changed files with 129 additions and 5 deletions

View File

@@ -346,6 +346,7 @@ public class AppCfgController extends BaseController {
public String ipCfgForm(Model model, String ids, AppIpCfg entity) {
if (StringUtils.isNotBlank(ids)) {
entity = appCfgService.getAppIpCfg(Long.parseLong(ids));
entity.setAppFeaturePropCfgList(appMultiFeatureCfgService.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null));
initUpdateFormCondition(model, entity);
} else {
initFormCondition(model, entity);
@@ -671,6 +672,7 @@ public class AppCfgController extends BaseController {
public String domainCfgForm(Model model, String ids, AppDomainCfg entity) {
if (StringUtils.isNotBlank(ids)) {
entity = appCfgService.getAppDomainCfg(Long.parseLong(ids));
entity.setAppFeaturePropCfgList(appMultiFeatureCfgService.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null));
initUpdateFormCondition(model, entity);
} else {
initFormCondition(model, entity);

View File

@@ -493,11 +493,19 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
// 保存 控管参数和特征属性组件信息
if(entity.getAppFeaturePropCfgList()!=null){
for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){
BeanUtils.copyProperties(entity, cfg);
appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg);
}
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
entity.setIsValid(0);
entity.setIsAudit(0);
appMultiFeatureCfgDao.deleteAppFeaturePropCfg(entity);
appCfgDao.updateAppIpCfg(entity);
// 删除旧的区域IP新增新的区域IP
AreaIpCfg area = new AreaIpCfg();
@@ -517,6 +525,13 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
// 更新 控管参数和特征属性组件信息
if(entity.getAppFeaturePropCfgList()!=null){
for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){
BeanUtils.copyProperties(entity, cfg);
appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg);
}
}
}
}
public void saveAppHttpCfg(List<ComplexkeywordCfg> cfgs) {
@@ -620,6 +635,13 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
// 保存 控管参数和特征属性组件信息
if(entity.getAppFeaturePropCfgList()!=null){
for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){
BeanUtils.copyProperties(entity, cfg);
appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
@@ -630,6 +652,7 @@ public class AppCfgService extends BaseService {
entity.setEditTime(new Date());
entity.setIsValid(0);
entity.setIsAudit(0);
appMultiFeatureCfgDao.deleteAppFeaturePropCfg(entity);
appCfgDao.updateAppDomainCfg(entity);
// 删除旧的区域IP新增新的区域IP
AreaIpCfg area = new AreaIpCfg();
@@ -646,6 +669,13 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
// 更新 控管参数和特征属性组件信息
if(entity.getAppFeaturePropCfgList()!=null){
for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){
BeanUtils.copyProperties(entity, cfg);
appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg);
}
}
}
}
@@ -1268,6 +1298,43 @@ public class AppCfgService extends BaseService {
specificServiceCfg.setOpTime(new Date());
specificServiceCfgDao.update(specificServiceCfg);
}
List<AppFeatureProperties> appFeaturePropCfgList = appMultiFeatureCfgDao.getAppFeaturePropCfg(entitys.get(0).getCompileId(), entitys.get(0).getFunctionId(), null);
String featureUserRegion = "";
if(!StringUtil.isEmpty(appFeaturePropCfgList)){
AppFeatureProperties cfg = appFeaturePropCfgList.get(0);
// 处理下发userRegion
if(!StringUtil.isEmpty(cfg.getDropOpt())){
featureUserRegion += "DKC=10;DKS="+cfg.getDropOpt()+";";
}
if(!StringUtil.isEmpty(cfg.getLoopOpt())){
featureUserRegion += "DKC=4;DKS="+cfg.getLoopOpt()+";";
}
if(!StringUtil.isEmpty(cfg.getExtendScanPktNum())){
featureUserRegion += "DKC=7;DKS="+cfg.getExtendScanPktNum()+";";
}
if(!StringUtil.isEmpty(cfg.getLongStreamLockTime())){
featureUserRegion += "DKC=16;DKS="+cfg.getLongStreamLockTime()+";";
}
if(!StringUtil.isEmpty(cfg.getCorrelationValidTime())){
featureUserRegion += "DKC=3;DKS="+cfg.getCorrelationValidTime()+";";
}
if(!StringUtil.isEmpty(cfg.getWeakFeature())){
featureUserRegion += cfg.getWeakFeature();
}
if(!StringUtil.isEmpty(cfg.getWhitelistFeature())){
featureUserRegion += cfg.getWhitelistFeature();
}
if(!StringUtil.isEmpty(cfg.getCorrelationBlockAfter())){
featureUserRegion += cfg.getCorrelationBlockAfter();
}
AppFeatureProperties appFeatureProp = new AppFeatureProperties();
BeanUtils.copyProperties(entitys.get(0), appFeatureProp, new String[] { "cfgId" });
appFeatureProp.setTableName(AppFeatureProperties.getTablename());
appCfgDao.auditCfg(appFeatureProp);
}
Integer groupId=configGroupInfo.getGroupId();
// 构造提交综合服务参数格式,一条配置提交一次综合服务
if (isAudit == 1) {
@@ -1296,7 +1363,9 @@ public class AppCfgService extends BaseService {
maatCfg.setIsValid(entitys.get(0).getIsValid());
// 设置APP自定义域
String userRegion = "APP_ID=" + entitys.get(0).getAppCode()/*+Constants.USER_REGION_SPLIT+"ASEV_ID="+businessType*/;
maatCfg.setUserRegion(userRegion);
if(!StringUtil.isEmpty(featureUserRegion)){
maatCfg.setUserRegion(userRegion + ";" +featureUserRegion);
}
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entitys.get(0).getAuditTime());
@@ -1504,6 +1573,42 @@ public class AppCfgService extends BaseService {
areaIpRegionList = map.get("dstList");
}
}
List<AppFeatureProperties> appFeaturePropCfgList = appMultiFeatureCfgDao.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null);
String featureUserRegion = "";
if(!StringUtil.isEmpty(appFeaturePropCfgList)){
AppFeatureProperties cfg = appFeaturePropCfgList.get(0);
// 处理下发userRegion
if(!StringUtil.isEmpty(cfg.getDropOpt())){
featureUserRegion += "DKC=10;DKS="+cfg.getDropOpt()+";";
}
if(!StringUtil.isEmpty(cfg.getLoopOpt())){
featureUserRegion += "DKC=4;DKS="+cfg.getLoopOpt()+";";
}
if(!StringUtil.isEmpty(cfg.getExtendScanPktNum())){
featureUserRegion += "DKC=7;DKS="+cfg.getExtendScanPktNum()+";";
}
if(!StringUtil.isEmpty(cfg.getLongStreamLockTime())){
featureUserRegion += "DKC=16;DKS="+cfg.getLongStreamLockTime()+";";
}
if(!StringUtil.isEmpty(cfg.getCorrelationValidTime())){
featureUserRegion += "DKC=3;DKS="+cfg.getCorrelationValidTime()+";";
}
if(!StringUtil.isEmpty(cfg.getWeakFeature())){
featureUserRegion += cfg.getWeakFeature();
}
if(!StringUtil.isEmpty(cfg.getWhitelistFeature())){
featureUserRegion += cfg.getWhitelistFeature();
}
if(!StringUtil.isEmpty(cfg.getCorrelationBlockAfter())){
featureUserRegion += cfg.getCorrelationBlockAfter();
}
AppFeatureProperties appFeatureProp = new AppFeatureProperties();
BeanUtils.copyProperties(entity, appFeatureProp, new String[] { "cfgId" });
appFeatureProp.setTableName(AppFeatureProperties.getTablename());
appCfgDao.auditCfg(appFeatureProp);
}
// 构造提交综合服务参数格式,一条配置提交一次综合服务
if (isAudit == 1) {
maatCfg.initDefaultValue();
@@ -1525,8 +1630,9 @@ public class AppCfgService extends BaseService {
if(!StringUtil.isEmpty(entity.getUserRegion5())){
userRegion+=";"+Constants.INTERCEPT_DOMAN_INTENSITY_USER_REGION_KEY+"="+entity.getUserRegion5();
}
maatCfg.setUserRegion(userRegion);
if(!StringUtil.isEmpty(featureUserRegion)) {
maatCfg.setUserRegion(userRegion + ";" +featureUserRegion);
}
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(entity.getAuditTime());
@@ -1875,6 +1981,13 @@ public class AppCfgService extends BaseService {
cfg.setTableName(AreaIpCfg.getTablename());
appCfgDao.updateCfgValid(cfg);
}
//修改特征属性配置表状态
if (!StringUtil.isEmpty(entity.getAppFeaturePropCfgList())) {
AppFeatureProperties cfg = new AppFeatureProperties();
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
cfg.setTableName(AppFeatureProperties.getTablename());
appMultiFeatureCfgDao.updateCfgValid(cfg);
}
}
@@ -1944,6 +2057,13 @@ public class AppCfgService extends BaseService {
cfg.setTableName(AreaIpCfg.getTablename());
appCfgDao.updateCfgValid(cfg);
}
//修改特征属性配置表状态
if (!StringUtil.isEmpty(entity.getAppFeaturePropCfgList())) {
AppFeatureProperties cfg = new AppFeatureProperties();
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
cfg.setTableName(AppFeatureProperties.getTablename());
appMultiFeatureCfgDao.updateCfgValid(cfg);
}
}

View File

@@ -657,7 +657,10 @@ public class AppMultiFeatureCfgService extends BaseService {
if(!StringUtil.isEmpty(cfg.getCorrelationBlockAfter())){
featureUserRegion += cfg.getCorrelationBlockAfter();
}
AppFeatureProperties appFeatureProp = new AppFeatureProperties();
BeanUtils.copyProperties(entity, appFeatureProp, new String[] { "cfgId" });
appFeatureProp.setTableName(AppFeatureProperties.getTablename());
appMultiFeatureCfgDao.auditCfg(appFeatureProp);
}
// 构造提交综合服务参数格式,一条配置提交一次综合服务

View File

@@ -264,7 +264,6 @@ var delContent = function(contentClassName, addBtnClassName) {
<option value="domain"><spring:message code="Domain"/></option>
<option value="payload"><spring:message code="Payload"/></option>
<option value="http"><spring:message code="HTTP"/></option>
<option value="dns"><spring:message code="DNS"/></option>
<option value="ssl"><spring:message code="SSL"/></option>
</select>
</div>