Merge branch 'cherry-pick-94cf096b' into 'develop_no_common_group'

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

See merge request K18_NTCS_WEB/NTC!50
This commit is contained in:
王鑫
2019-07-26 10:41:07 +08:00

View File

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