多条配置批量下发maat
This commit is contained in:
@@ -268,8 +268,12 @@ public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
|
|||||||
*/
|
*/
|
||||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||||
public int auditAppCfg(String[] cfgIds,Integer auditState) throws Exception{
|
public int auditAppCfg(String[] cfgIds,Integer auditState) throws Exception{
|
||||||
|
List<AppMaatCfg> jsonList = new ArrayList();
|
||||||
|
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||||
|
.excludeFieldsWithoutExposeAnnotation()
|
||||||
|
.create();
|
||||||
|
boolean sendFlag = false;
|
||||||
for(String id:cfgIds){
|
for(String id:cfgIds){
|
||||||
boolean sendFlag = false;
|
|
||||||
AppIdCfg appCfg = appCfgDao.getById(Long.parseLong(id));
|
AppIdCfg appCfg = appCfgDao.getById(Long.parseLong(id));
|
||||||
|
|
||||||
//给需要修改的配置字段赋值
|
//给需要修改的配置字段赋值
|
||||||
@@ -293,12 +297,6 @@ public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
|
|||||||
List<SpecificServiceHostCfg> hostList =new ArrayList();
|
List<SpecificServiceHostCfg> hostList =new ArrayList();
|
||||||
List<BaseIpCfg> areaList = new ArrayList();
|
List<BaseIpCfg> areaList = new ArrayList();
|
||||||
ConfigGroupInfo group = null;
|
ConfigGroupInfo group = null;
|
||||||
|
|
||||||
|
|
||||||
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
|
||||||
.excludeFieldsWithoutExposeAnnotation()
|
|
||||||
.create();
|
|
||||||
|
|
||||||
//配置审核状态即将改变后的状态
|
//配置审核状态即将改变后的状态
|
||||||
if(Constants.AUDIT_NOT_YES==auditState||
|
if(Constants.AUDIT_NOT_YES==auditState||
|
||||||
Constants.AUDIT_YES==auditState){//审核通过,取消审核通过需要发到maat
|
Constants.AUDIT_YES==auditState){//审核通过,取消审核通过需要发到maat
|
||||||
@@ -427,10 +425,18 @@ public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
|
|||||||
maatCfg.setAttribute(appCfg.getAttribute()==null?"":appCfg.getAttribute());
|
maatCfg.setAttribute(appCfg.getAttribute()==null?"":appCfg.getAttribute());
|
||||||
maatCfg.setClassify(appCfg.getClassify()==null?"":appCfg.getClassify());
|
maatCfg.setClassify(appCfg.getClassify()==null?"":appCfg.getClassify());
|
||||||
maatCfg.setLable(appCfg.getLable()==null?"":appCfg.getLable());
|
maatCfg.setLable(appCfg.getLable()==null?"":appCfg.getLable());
|
||||||
String json=gson.toJson(maatCfg);
|
jsonList.add(maatCfg);
|
||||||
//下发maat
|
|
||||||
// new ConvertTool().saveAppConfig(json);
|
//修改appId配置审核下发状态
|
||||||
sendFlag = true;
|
appCfgDao.audit(appCfg);
|
||||||
|
//修改特定服务IP分组下发状态
|
||||||
|
specificServiceCfgDao.updateConfigGroupInfobyGroupId(group);
|
||||||
|
//修改特征表配置审核下发状态
|
||||||
|
for(AppFeaturesIndex cfg:featuresTableList){
|
||||||
|
appCfgDao.auditFeaturesTable(cfg.getFeaturesTable(), cfg.getFeaturesCompileId(), appCfg.getIsValid(),
|
||||||
|
appCfg.getIsAudit(), appCfg.getAuditorId(), appCfg.getAuditTime());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}else{//取消审核通过
|
}else{//取消审核通过
|
||||||
AppMaatCfg maatCfg = new AppMaatCfg();
|
AppMaatCfg maatCfg = new AppMaatCfg();
|
||||||
@@ -483,32 +489,34 @@ public class AppCfgService extends CrudService<AppCfgDao,AppIdCfg> {
|
|||||||
maatCfg.setComplexStrCfg(complexList);
|
maatCfg.setComplexStrCfg(complexList);
|
||||||
}
|
}
|
||||||
|
|
||||||
String json=gson.toJson(maatCfg);
|
jsonList.add(maatCfg);
|
||||||
//下发maat
|
|
||||||
// new ConvertTool().saveAppConfig(json);
|
//修改appId配置审核下发状态
|
||||||
sendFlag = true;
|
appCfgDao.audit(appCfg);
|
||||||
|
//修改特定服务IP分组下发状态
|
||||||
|
specificServiceCfgDao.updateConfigGroupInfobyGroupId(group);
|
||||||
|
//修改特征表配置审核下发状态
|
||||||
|
for(AppFeaturesIndex cfg:featuresTableList){
|
||||||
|
appCfgDao.auditFeaturesTable(cfg.getFeaturesTable(), cfg.getFeaturesCompileId(), appCfg.getIsValid(),
|
||||||
|
appCfg.getIsAudit(), appCfg.getAuditorId(), appCfg.getAuditTime());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
|
||||||
sendFlag = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sendFlag){
|
|
||||||
//修改appId配置审核下发状态
|
|
||||||
appCfgDao.audit(appCfg);
|
|
||||||
//修改特定服务IP分组下发状态
|
|
||||||
specificServiceCfgDao.updateConfigGroupInfobyGroupId(group);
|
|
||||||
//修改特征表配置审核下发状态
|
|
||||||
for(AppFeaturesIndex cfg:featuresTableList){
|
|
||||||
appCfgDao.auditFeaturesTable(cfg.getFeaturesTable(), cfg.getFeaturesCompileId(), appCfg.getIsValid(),
|
|
||||||
appCfg.getIsAudit(), appCfg.getAuditorId(), appCfg.getAuditTime());
|
|
||||||
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 1;
|
String json=gson.toJson(jsonList);
|
||||||
|
//下发maat
|
||||||
|
// new ConvertTool().saveConfig(json);
|
||||||
|
sendFlag = true;
|
||||||
|
if(sendFlag){
|
||||||
|
return 1;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user