|  | @@ -31,6 +31,7 @@ import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.domain.AjaxResult;
 | 
	
		
			
				|  |  |  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.CoreEduTrainingTaskMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.core.edu.mapper.CoreEduTrainingTaskToRoleMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.core.edu.mapper.CoreEduTrainingTaskToUserMapper;
 | 
	
	
		
			
				|  | @@ -81,6 +82,8 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
 | 
	
		
			
				|  |  |      private CoreEduTrainingTaskToUserMapper taskToUserMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ICoreEduTrainingTaskToUserService coreEduTrainingTaskToUserService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private CoreEduTrainingPlanMapper coreEduTrainingPlanMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public TableDataInfo<CoreEduTrainingTaskPageVo> selectPage(CoreEduTrainingTaskPageDto request) {
 | 
	
	
		
			
				|  | @@ -404,6 +407,42 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return resource + File.separator + fileName;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public String buildEduTask(Integer cycle, Date date) {
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNull(date)) {
 | 
	
		
			
				|  |  | +            date = new Date();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<Integer> cycleList = DateUtils.checkDate(date);
 | 
	
		
			
				|  |  | +        List<CoreEduTrainingPlan> planList;
 | 
	
		
			
				|  |  | +        if (null == cycle) {
 | 
	
		
			
				|  |  | +            planList = coreEduTrainingPlanMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingPlan>()
 | 
	
		
			
				|  |  | +                    .eq(CoreEduTrainingPlan::getStandard, 0)
 | 
	
		
			
				|  |  | +                    .in(CoreEduTrainingPlan::getPlanCycle, cycleList)
 | 
	
		
			
				|  |  | +                    .eq(CoreEduTrainingPlan::getDeleted, 0)
 | 
	
		
			
				|  |  | +                    .select(CoreEduTrainingPlan::getId, CoreEduTrainingPlan::getPlanCycle));
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            planList = coreEduTrainingPlanMapper.selectList(new LambdaQueryWrapper<CoreEduTrainingPlan>()
 | 
	
		
			
				|  |  | +                    .eq(CoreEduTrainingPlan::getStandard, 0)
 | 
	
		
			
				|  |  | +                    .eq(CoreEduTrainingPlan::getPlanCycle, cycle)
 | 
	
		
			
				|  |  | +                    .eq(CoreEduTrainingPlan::getDeleted, 0)
 | 
	
		
			
				|  |  | +                    .select(CoreEduTrainingPlan::getId, CoreEduTrainingPlan::getPlanCycle));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isEmpty(planList)) {
 | 
	
		
			
				|  |  | +            return "没有需要生成的任务";
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        Date finalDate = date;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //此list中Plan对象仅id与planCycle字段有值,
 | 
	
		
			
				|  |  | +        for (CoreEduTrainingPlan plan : planList) {
 | 
	
		
			
				|  |  | +            CompletableFuture.runAsync(() -> {
 | 
	
		
			
				|  |  | +                CoreEduTrainingPlanDataVo detailPlanData = coreEduTrainingPlanMapper.getDetailPlanData(plan.getId());
 | 
	
		
			
				|  |  | +                DateRange range = DateUtils.getStartAndEnd(finalDate, plan.getPlanCycle());
 | 
	
		
			
				|  |  | +                this.createTaskForNow(detailPlanData, range.getStartTime(), range.getEndTime());
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return "创建成功";
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |