域清空的时候,当任务是有效的时候删除定时任务,当任务是未生效状态时候也要删除定时任务

This commit is contained in:
wangxin
2019-07-26 10:39:59 +08:00
parent e37128e2c8
commit 94cf096be4

View File

@@ -3318,7 +3318,7 @@ public abstract class BaseService {
ScriberIdCommGroupDao scriberIdCommGroupDao=SpringContextHolder.getBean(ScriberIdCommGroupDao.class);
DomainCommGroupDao domainCommGroupDao=SpringContextHolder.getBean(DomainCommGroupDao.class);
CommonPolicyDao commonPolicyDao=SpringContextHolder.getBean(CommonPolicyDao.class);
SchedulerDao schedulerDao=SpringContextHolder.getBean(SchedulerDao.class);
//SchedulerDao schedulerDao=SpringContextHolder.getBean(SchedulerDao.class);
AreaIpCfgDao areaIpCfgDao=SpringContextHolder.getBean(AreaIpCfgDao.class);
Set<String> ipDeletedGroups=new HashSet<>();
Set<String> urlDeletedGroups=new HashSet<>();
@@ -3356,6 +3356,7 @@ public abstract class BaseService {
realGroupIds.deleteCharAt(realGroupIds.toString().length()-1);
}
List<CfgIndexInfo> toUpdateCfgIndexInfos=new ArrayList<>();
List<CfgIndexInfo> toDelSchedualCfgIndexInfos=new ArrayList<>();
List<CfgIndexInfo> toCancelCfgIndexInfos=new ArrayList<>();
//没有
if(StringUtils.isBlank(realGroupIds.toString())){
@@ -3399,6 +3400,7 @@ public abstract class BaseService {
cfgIndexInfo.setCommonGroupIds("");
if(cfgIndexInfo.getIsValid()==Constants.VALID_NO){//未生效,直接更新配置,不用下发
toUpdateCfgIndexInfos.add(cfgIndexInfo);
toDelSchedualCfgIndexInfos.add(cfgIndexInfo);
}else{//生效,需要取消配置
cfgIndexInfo.setIsValid(Constants.VALID_NO);
cfgIndexInfo.setIsAudit(Constants.AUDIT_NOT_YES);
@@ -3597,22 +3599,22 @@ public abstract class BaseService {
//查询定时任务,失效定时任务
if(ids.toString().length()>0){
ids.deleteCharAt(ids.toString().length()-1);
schedulerDao.inValidByCompileIds(ids.toString());
commonPolicyDao.cancelScheduCfg(ids.toString(),CfgIndexInfo.getTablename());
}
}
if(toUpdateCfgIndexInfos.size()>0){
if(toDelSchedualCfgIndexInfos.size()>0){
StringBuffer ids=new StringBuffer();
for(CfgIndexInfo info:toUpdateCfgIndexInfos){
for(CfgIndexInfo info:toDelSchedualCfgIndexInfos){
commonPolicyDao.updateCfgIndexCommonGroupIds(info);
if(StringUtils.isBlank(info.getCommonGroupIds())){
ids.append(info.getCompileId()+",");
}
}
//查询定时任务,失效定时任务
// if(ids.toString().length()>0){
// ids.deleteCharAt(ids.toString().length()-1);
// commonPolicyDao.cancelScheduCfg(ids.toString(),CfgIndexInfo.getTablename());
// }
if(ids.toString().length()>0){
ids.deleteCharAt(ids.toString().length()-1);
commonPolicyDao.cancelScheduCfg(ids.toString(),CfgIndexInfo.getTablename());
}
}
//向maat发送配置
if(CollectionUtils.isNotEmpty(cancelMaatBean.getConfigCompileList())){