|  | @@ -113,6 +113,9 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 | 
	
		
			
				|  |  |          //获取数据
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          page = tMonitoringRetrievalPlanMapper.selectPageList(page, tMonitoringRetrievalPlan);
 | 
	
		
			
				|  |  | +        page.getRecords().forEach(p->{
 | 
	
		
			
				|  |  | +            boolean isComplete = this.getIsComplete(p.getId());p.setIsComplete(isComplete);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |          return TableDataInfo.build(page);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -159,9 +162,10 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public int distribute(Long id) throws ParseException {
 | 
	
		
			
				|  |  | +    public int distribute(Long id,Boolean immediateEffect) throws ParseException {
 | 
	
		
			
				|  |  |          //查询
 | 
	
		
			
				|  |  |          TMonitoringRetrievalPlan tMonitoringRetrievalPlan = tMonitoringRetrievalPlanMapper.selectById(id);
 | 
	
		
			
				|  |  | +        tMonitoringRetrievalPlan.setImmediately(immediateEffect);
 | 
	
		
			
				|  |  |          tMonitoringRetrievalPlan.setIsDistribute("1");
 | 
	
		
			
				|  |  |          tMonitoringRetrievalPlan.setPlanStatus(1);
 | 
	
		
			
				|  |  |          tMonitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
 | 
	
	
		
			
				|  | @@ -491,8 +495,6 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public int withdraw(Long id) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        DateRange startAndEnd;
 | 
	
		
			
				|  |  |          TMonitoringRetrievalPlan plan = baseMapper.selectById(id);
 | 
	
		
			
				|  |  |          QueryWrapper queryWrapper = new QueryWrapper();
 | 
	
		
			
				|  |  |          queryWrapper.eq(PARENT_ID, id);
 | 
	
	
		
			
				|  | @@ -568,6 +570,41 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 | 
	
		
			
				|  |  |          return baseMapper.updateById(plan);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public boolean getIsComplete(Long id) {
 | 
	
		
			
				|  |  | +        QueryWrapper queryWrapper = new QueryWrapper();
 | 
	
		
			
				|  |  | +        queryWrapper.eq(PARENT_ID, id);
 | 
	
		
			
				|  |  | +        List<TMonitoringRetrievalPlan> list1 = tMonitoringRetrievalPlanMapper.selectList(queryWrapper);
 | 
	
		
			
				|  |  | +        List<Long> collect = new ArrayList<>();
 | 
	
		
			
				|  |  | +        //如果有子计划
 | 
	
		
			
				|  |  | +        Boolean isComplete=false;
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(list1)) {
 | 
	
		
			
				|  |  | +            collect = list1.stream().map(TMonitoringRetrievalPlan::getId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            List<String>status=new ArrayList<>();
 | 
	
		
			
				|  |  | +            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(collect, null);
 | 
	
		
			
				|  |  | +            status.add("0");
 | 
	
		
			
				|  |  | +            status.add("1");
 | 
	
		
			
				|  |  | +            status.add("3");
 | 
	
		
			
				|  |  | +            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks1 = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(collect, status);
 | 
	
		
			
				|  |  | +            if (coreMonitoringRetrievalTasks.size()==coreMonitoringRetrievalTasks1.size()){
 | 
	
		
			
				|  |  | +                isComplete=true;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            List<String>status=new ArrayList<>();
 | 
	
		
			
				|  |  | +            List<Long>ids=new ArrayList<>();
 | 
	
		
			
				|  |  | +            ids.add(id);
 | 
	
		
			
				|  |  | +            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(ids, null);
 | 
	
		
			
				|  |  | +            status.add("0");
 | 
	
		
			
				|  |  | +            status.add("1");
 | 
	
		
			
				|  |  | +            status.add("3");
 | 
	
		
			
				|  |  | +            List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks1 = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(ids, status);
 | 
	
		
			
				|  |  | +            if (coreMonitoringRetrievalTasks.size()==coreMonitoringRetrievalTasks1.size()){
 | 
	
		
			
				|  |  | +                isComplete=true;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return isComplete;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private int getDayNum(int monthsToAdd) {
 | 
	
		
			
				|  |  |          LocalDate lastDayOfMonth;
 | 
	
		
			
				|  |  |          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
	
		
			
				|  | @@ -667,7 +704,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
 | 
	
		
			
				|  |  |                  SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
 | 
	
		
			
				|  |  |                  List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
 | 
	
		
			
				|  |  |                  if (sysOrg1.getType() == 1 && plan.getIsDistribute().equals("1")) {
 | 
	
		
			
				|  |  | -                    distribute(plan.getId());
 | 
	
		
			
				|  |  | +                    distribute(plan.getId(),false);
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      SysOrg sysOrg = new SysOrg();
 | 
	
		
			
				|  |  |                      sysOrg.setPath(plan.getOrgPath());
 |