|  | @@ -12,9 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.constant.ErrorMsgConstants;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.constant.SecurityConstants;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.IdName;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlanToExecOrg;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlanToRole;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.domain.edu.domain.*;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.edu.dto.CoreEduTrainingPlanEditDto;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.edu.dto.CoreEduTrainingPlanInsertDto;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.edu.dto.CoreEduTrainingPlanPageDto;
 | 
	
	
		
			
				|  | @@ -26,10 +24,7 @@ import com.xunmei.common.core.exception.SystemException;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.page.TableDataInfo;
 | 
	
		
			
				|  |  |  import com.xunmei.common.security.utils.SecurityUtils;
 | 
	
		
			
				|  |  | -import com.xunmei.core.edu.mapper.CoreEduTrainingPlanMapper;
 | 
	
		
			
				|  |  | -import com.xunmei.core.edu.mapper.CoreEduTrainingPlanToExecOrgMapper;
 | 
	
		
			
				|  |  | -import com.xunmei.core.edu.mapper.CoreEduTrainingPlanToRoleMapper;
 | 
	
		
			
				|  |  | -import com.xunmei.core.edu.mapper.CoreEduTrainingTaskMapper;
 | 
	
		
			
				|  |  | +import com.xunmei.core.edu.mapper.*;
 | 
	
		
			
				|  |  |  import com.xunmei.core.edu.service.ICoreEduTrainingPlanService;
 | 
	
		
			
				|  |  |  import com.xunmei.core.edu.service.ICoreEduTrainingPlanToExecOrgService;
 | 
	
		
			
				|  |  |  import com.xunmei.core.edu.service.ICoreEduTrainingPlanToRoleService;
 | 
	
	
		
			
				|  | @@ -75,12 +70,14 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private CoreEduTrainingTaskMapper coreEduTrainingTaskMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | +    private CoreEduTrainingTaskToRoleMapper coreEduTrainingTaskToRoleMapper;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  |      private RemoteOrgService orgService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private RemoteRoleService remoteRoleService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public TableDataInfo selectPage(CoreEduTrainingPlanPageDto request) {
 | 
	
		
			
				|  |  | +    public TableDataInfo selectPage(CoreEduTrainingPlanPageDto request) throws InterruptedException {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //下穿
 | 
	
		
			
				|  |  |          if (request.getCheckSub()) {
 | 
	
	
		
			
				|  | @@ -245,31 +242,65 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          plan.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getId().toString());
 | 
	
		
			
				|  |  |          coreEduTrainingPlanToRoleMapper.deleteByMap(MapUtil.of("plan_id", plan.getId()));
 | 
	
		
			
				|  |  |          coreEduTrainingPlanToExecOrgMapper.deleteByMap(MapUtil.of("plan_id", plan.getId()));
 | 
	
		
			
				|  |  | -        batchSavePlanToRole(request.getPlanRoleId(), plan.getId());
 | 
	
		
			
				|  |  | -        batchSavePlanToExecOrg(request.getPlanExecOrgIdList(), plan.getId());
 | 
	
		
			
				|  |  | +        List<CoreEduTrainingPlanToRole> trainingPlanToRoleList = batchSavePlanToRole(request.getPlanRoleId(), plan.getId());
 | 
	
		
			
				|  |  | +        List<CoreEduTrainingPlanToExecOrg> trainingPlanToExecOrgList = batchSavePlanToExecOrg(request.getPlanExecOrgIdList(), plan.getId());
 | 
	
		
			
				|  |  |          final int i = coreEduTrainingPlanMapper.updateById(plan);
 | 
	
		
			
				|  |  | +        if (plan.getStandard() == 1) {
 | 
	
		
			
				|  |  | +            //如果标准计划可以修改,那么需要删除所有计划与任务,重新创建计划任务
 | 
	
		
			
				|  |  | +            updateStandardPlan(plan, trainingPlanToRoleList, trainingPlanToExecOrgList);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            //普通计划
 | 
	
		
			
				|  |  | +            updateCommonPlan(plan);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return i;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void updateStandardPlan(CoreEduTrainingPlan plan, List<CoreEduTrainingPlanToRole> trainingPlanToRoleList, List<CoreEduTrainingPlanToExecOrg> trainingPlanToExecOrgList) {
 | 
	
		
			
				|  |  | +        Long planId = plan.getId();
 | 
	
		
			
				|  |  | +        //删除原有数据, 然后重新生成计划,任务
 | 
	
		
			
				|  |  | +        List<Long> planIdList = coreEduTrainingPlanMapper.selectIdByParentId(planId);
 | 
	
		
			
				|  |  | +        coreEduTrainingPlanMapper.deleteBatchIds(planIdList);
 | 
	
		
			
				|  |  | +        coreEduTrainingPlanToExecOrgMapper.delete(new LambdaQueryWrapper<CoreEduTrainingPlanToExecOrg>().in(CoreEduTrainingPlanToExecOrg::getPlanId, planIdList));
 | 
	
		
			
				|  |  | +        coreEduTrainingPlanToRoleMapper.delete(new LambdaQueryWrapper<CoreEduTrainingPlanToRole>().in(CoreEduTrainingPlanToRole::getPlanId, planIdList));
 | 
	
		
			
				|  |  | +        List<CoreEduTrainingTask> taskIdList = coreEduTrainingTaskMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingTask>().in(CoreEduTrainingTask::getPlanId, planIdList).select(CoreEduTrainingTask::getId));
 | 
	
		
			
				|  |  | +        List<Long> collect = taskIdList.stream().map(CoreEduTrainingTask::getId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        coreEduTrainingTaskMapper.deleteBatchIds(collect);
 | 
	
		
			
				|  |  | +        coreEduTrainingTaskToRoleMapper.delete(new LambdaQueryWrapper<CoreEduTrainingTaskToRole>().in(CoreEduTrainingTaskToRole::getEduTrainingTaskId, collect));
 | 
	
		
			
				|  |  | +        List<CoreEduTrainingPlan> planList = buildPlanData(plan, trainingPlanToRoleList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (CoreEduTrainingPlan trainingPlan : planList) {
 | 
	
		
			
				|  |  | +            CoreEduTrainingPlanDataVo dataVo = getCoreEduTrainingPlanDataVo(trainingPlan.getId());
 | 
	
		
			
				|  |  | +            CompletableFuture.runAsync(() -> {
 | 
	
		
			
				|  |  | +                //说明有任务并且都没执行过,需要重新生成任务
 | 
	
		
			
				|  |  | +                coreEduTrainingTaskService.createTaskForNow(dataVo, plan.getStartDate(), plan.getEndDate());
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void updateCommonPlan(CoreEduTrainingPlan plan) {
 | 
	
		
			
				|  |  |          /*
 | 
	
		
			
				|  |  | -          判断能否修改: 如果上面返回了true; 说明两种情况
 | 
	
		
			
				|  |  | +                   判断能否修改: 如果上面返回了true; 说明两种情况
 | 
	
		
			
				|  |  |                     1:计划生成了任务,但是未执行:  此时需要删除所有任务,修改计划数据后重新创建任务
 | 
	
		
			
				|  |  |                     2:计划生成了任务且执行了,但是没有修改到关键信息,此时则不能删除任务,只允许修改计划信息
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  |          final Integer done = coreEduTrainingTaskMapper.checkHasTaskIsDone(Arrays.asList(plan.getId()));
 | 
	
		
			
				|  |  |          if (ObjectUtil.equal(1, done)) {
 | 
	
		
			
				|  |  |              //此为情况二, 计划生成了任务且执行 不能删除任务,只允许修改计划信息,所以直接返回
 | 
	
		
			
				|  |  |              //TODO 考虑是否同步修改已生成的任务的名称
 | 
	
		
			
				|  |  | -            return i;
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // final Integer hasTask = coreEduTrainingTaskMapper.checkHasTask(plan.getId());
 | 
	
		
			
				|  |  |          //此为情况一,计划没有生成任务或者生成了任务但未执行
 | 
	
		
			
				|  |  | -        final CoreEduTrainingPlanDataVo dataVo = getCoreEduTrainingPlanDataVo(request.getId());
 | 
	
		
			
				|  |  | +        final CoreEduTrainingPlanDataVo dataVo = getCoreEduTrainingPlanDataVo(plan.getId());
 | 
	
		
			
				|  |  |          if (ObjectUtil.equal(1, plan.getBuildTaskNow()) && ObjectUtil.equal(0, plan.getPlanStatus())) {
 | 
	
		
			
				|  |  | -            coreEduTrainingTaskMapper.deleteByMap(MapUtil.of("plan_id", request.getId()));
 | 
	
		
			
				|  |  | +            coreEduTrainingTaskMapper.deleteByMap(MapUtil.of("plan_id", plan.getId()));
 | 
	
		
			
				|  |  |              CompletableFuture.runAsync(() -> {
 | 
	
		
			
				|  |  |                  //说明有任务并且都没执行过,需要重新生成任务
 | 
	
		
			
				|  |  |                  coreEduTrainingTaskService.createTaskForNow(dataVo, plan.getStartDate(), plan.getEndDate());
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        return i;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private Boolean checkCanUpdate(CoreEduTrainingPlanEditDto request, CoreEduTrainingPlan plan) {
 | 
	
	
		
			
				|  | @@ -286,7 +317,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          final Integer done = coreEduTrainingTaskMapper.checkHasTaskIsDone(Arrays.asList(planId));
 | 
	
		
			
				|  |  |          //判断标准计划能否修改:存在下发的计划生成了任务且任务存在已执行
 | 
	
		
			
				|  |  |          Integer standardPlanHasDone = coreEduTrainingTaskMapper.checkHasTaskIsDoneByPlanParentId(planId);
 | 
	
		
			
				|  |  | -        if (standardPlanHasDone!=null){
 | 
	
		
			
				|  |  | +        if (standardPlanHasDone != null) {
 | 
	
		
			
				|  |  |              throw new RuntimeException("该计划下存在任务已执行的情况,无法修改!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //计划周期
 | 
	
	
		
			
				|  | @@ -321,7 +352,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |                  break;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        return null != done && !flag && null != standardPlanHasDone;
 | 
	
		
			
				|  |  | +        return null == done || flag;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -331,10 +362,10 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          return dataVo;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public void batchSavePlanToRole(List<Long> roleIdList, Long planId) {
 | 
	
		
			
				|  |  | +    public List<CoreEduTrainingPlanToRole> batchSavePlanToRole(List<Long> roleIdList, Long planId) {
 | 
	
		
			
				|  |  |          roleIdList.removeIf(Objects::isNull);
 | 
	
		
			
				|  |  |          if (ObjectUtil.isEmpty(roleIdList)) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            return new ArrayList<>();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<CoreEduTrainingPlanToRole> planRoleList = new ArrayList<>();
 | 
	
		
			
				|  |  |          for (Long roleId : roleIdList) {
 | 
	
	
		
			
				|  | @@ -346,12 +377,13 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          if (CollectionUtil.isNotEmpty(planRoleList)) {
 | 
	
		
			
				|  |  |              coreEduTrainingPlanToRoleService.saveBatch(planRoleList);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        return planRoleList;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public void batchSavePlanToExecOrg(List<Long> orgIdList, Long planId) {
 | 
	
		
			
				|  |  | +    public List<CoreEduTrainingPlanToExecOrg> batchSavePlanToExecOrg(List<Long> orgIdList, Long planId) {
 | 
	
		
			
				|  |  |  //        orgIdList.removeIf(Objects::isNull);
 | 
	
		
			
				|  |  |          if (ObjectUtil.isEmpty(orgIdList)) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            return new ArrayList<>();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<CoreEduTrainingPlanToExecOrg> planOrgList = new ArrayList<CoreEduTrainingPlanToExecOrg>();
 | 
	
		
			
				|  |  |          for (Long orgId : orgIdList) {
 | 
	
	
		
			
				|  | @@ -360,7 +392,11 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |              org.setPlanId(planId);
 | 
	
		
			
				|  |  |              planOrgList.add(org);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        coreEduTrainingPlanToExecOrgService.saveBatch(planOrgList);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotEmpty(planOrgList)) {
 | 
	
		
			
				|  |  | +            coreEduTrainingPlanToExecOrgService.saveBatch(planOrgList);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return planOrgList;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -425,7 +461,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |              return RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectByOrgIdList(list, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        return null;
 | 
	
		
			
				|  |  | +        return new ArrayList<>();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -440,12 +476,35 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 下发 按钮显示逻辑:仅省联社安全保卫管理人员进入且由省联社管理安全保卫人员创建的计划才显示
 | 
	
		
			
				|  |  |          //todo 判断当前人的角色信息
 | 
	
		
			
				|  |  | +        List<CoreEduTrainingPlan> list = buildPlanData(plan, new ArrayList<>());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //获取执行角色
 | 
	
		
			
				|  |  | -        LambdaQueryWrapper<CoreEduTrainingPlanToRole> ros = new LambdaQueryWrapper<>();
 | 
	
		
			
				|  |  | -        ros.eq(CoreEduTrainingPlanToRole::getPlanId, plan.getId());
 | 
	
		
			
				|  |  | -        List<CoreEduTrainingPlanToRole> planRoleList = coreEduTrainingPlanToRoleMapper.selectList(ros);
 | 
	
		
			
				|  |  | +        plan.setIssue(1);
 | 
	
		
			
				|  |  | +        this.updateById(plan);
 | 
	
		
			
				|  |  | +        //事务提交后执行
 | 
	
		
			
				|  |  | +        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
 | 
	
		
			
				|  |  | +            @Override
 | 
	
		
			
				|  |  | +            public void afterCommit() {
 | 
	
		
			
				|  |  | +                for (CoreEduTrainingPlan trainingPlan : list) {
 | 
	
		
			
				|  |  | +                    CompletableFuture.runAsync(() -> {
 | 
	
		
			
				|  |  | +                        //如果不是省联社或者办事处,状态启用,并且是无周期或者立即生效
 | 
	
		
			
				|  |  | +                        if ((ObjectUtil.equal(0, plan.getPlanStatus()) && (ObjectUtil.equal(0, plan.getPlanCycle()) || ObjectUtil.equal(1, plan.getBuildTaskNow())))) {
 | 
	
		
			
				|  |  | +                            CoreEduTrainingPlanDataVo detailPlanData = getCoreEduTrainingPlanDataVo(trainingPlan.getId());
 | 
	
		
			
				|  |  | +                            coreEduTrainingTaskService.createTaskForNow(detailPlanData, plan.getStartDate(), plan.getEndDate());
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private List<CoreEduTrainingPlan> buildPlanData(CoreEduTrainingPlan plan, List<CoreEduTrainingPlanToRole> planRoleList) {
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isEmpty(planRoleList)) {
 | 
	
		
			
				|  |  | +            //获取执行角色
 | 
	
		
			
				|  |  | +            LambdaQueryWrapper<CoreEduTrainingPlanToRole> ros = new LambdaQueryWrapper<>();
 | 
	
		
			
				|  |  | +            ros.eq(CoreEduTrainingPlanToRole::getPlanId, plan.getId());
 | 
	
		
			
				|  |  | +            planRoleList = coreEduTrainingPlanToRoleMapper.selectList(ros);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          //获取计划具体执行机构
 | 
	
		
			
				|  |  |          final List<SysOrg> planExecOrgList = this.getPlanExecOrg(plan);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -466,13 +525,12 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |              CoreEduTrainingPlan coreEduTrainingPlan = new CoreEduTrainingPlan();
 | 
	
		
			
				|  |  |              BeanUtils.copyProperties(plan, coreEduTrainingPlan);
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setId(IdWorker.getId());
 | 
	
		
			
				|  |  | -//            coreEduTrainingPlan.setBuildTaskNow(plan.getBuildTaskNow());
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setBelongOrgId(sysOrg.getId());
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setBelongOrgName(sysOrg.getName());
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setBelongOrgPath(sysOrg.getPath());
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setStandard(0);
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setIssue(0);
 | 
	
		
			
				|  |  | -            coreEduTrainingPlan.setParentId(planId);
 | 
	
		
			
				|  |  | +            coreEduTrainingPlan.setParentId(plan.getId());
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setCreateTime(new Date());
 | 
	
		
			
				|  |  |              coreEduTrainingPlan.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |              list.add(coreEduTrainingPlan);
 | 
	
	
		
			
				|  | @@ -489,7 +547,6 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          if (planToExecOrgs.size() > 0) {
 | 
	
		
			
				|  |  |              coreEduTrainingPlanToExecOrgService.saveBatch(planToExecOrgs);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          List<CoreEduTrainingPlanToRole> insertPlanRoleList = new ArrayList<>();
 | 
	
		
			
				|  |  |          for (CoreEduTrainingPlan coreEduTrainingPlan : list) {
 | 
	
		
			
				|  |  |              //保存执行角色
 | 
	
	
		
			
				|  | @@ -503,28 +560,11 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 | 
	
		
			
				|  |  |          if (list.size() > 0) {
 | 
	
		
			
				|  |  |              this.saveBatch(list);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          if (insertPlanRoleList.size() > 0) {
 | 
	
		
			
				|  |  |              coreEduTrainingPlanToRoleService.saveBatch(insertPlanRoleList);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        plan.setIssue(1);
 | 
	
		
			
				|  |  | -        this.updateById(plan);
 | 
	
		
			
				|  |  | -        //事务提交后执行
 | 
	
		
			
				|  |  | -        TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
 | 
	
		
			
				|  |  | -            @Override
 | 
	
		
			
				|  |  | -            public void afterCommit() {
 | 
	
		
			
				|  |  | -                for (CoreEduTrainingPlan trainingPlan : list) {
 | 
	
		
			
				|  |  | -                    CompletableFuture.runAsync(() -> {
 | 
	
		
			
				|  |  | -                        //如果不是省联社或者办事处,状态启用,并且是无周期或者立即生效
 | 
	
		
			
				|  |  | -                        if ((ObjectUtil.equal(0, plan.getPlanStatus()) && (ObjectUtil.equal(0, plan.getPlanCycle()) || ObjectUtil.equal(1, plan.getBuildTaskNow())))) {
 | 
	
		
			
				|  |  | -                            CoreEduTrainingPlanDataVo detailPlanData = getCoreEduTrainingPlanDataVo(trainingPlan.getId());
 | 
	
		
			
				|  |  | -                            coreEduTrainingTaskService.createTaskForNow(detailPlanData, plan.getStartDate(), plan.getEndDate());
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    });
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        return list;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 |