소스 검색

模板创建任务 里程碑默认生成执行人

yurk 3 년 전
부모
커밋
7a621cf11c

+ 17 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskGroupServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.StagesService;
+import com.management.platform.service.TaskExecutorService;
 import com.management.platform.service.TaskGroupService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.TaskService;
@@ -44,6 +45,8 @@ public class TaskGroupServiceImpl extends ServiceImpl<TaskGroupMapper, TaskGroup
     private TaskService taskService;
     @Resource
     private UserMapper userMapper;
+    @Resource
+    private TaskExecutorService taskExecutorService;
 
     @Override
     public void saveGroupIncharger(TaskGroup taskGroup) {
@@ -87,6 +90,7 @@ public class TaskGroupServiceImpl extends ServiceImpl<TaskGroupMapper, TaskGroup
                             .orderByAsc("seq"));
             if (gtemplateTaskList.size() > 0) {
                 List<Task> taskList = new ArrayList<>();
+                List<TaskExecutor> taskExecutorList = new ArrayList<>();
                 gtemplateTaskList.forEach(gt->{
                     Task task = gt.toTask();
                     task.setProjectId(projectId);
@@ -100,6 +104,19 @@ public class TaskGroupServiceImpl extends ServiceImpl<TaskGroupMapper, TaskGroup
                     taskList.add(task);
                 });
                 taskService.saveBatch(taskList);
+                taskList.forEach(tl->{
+                    TaskExecutor taskExecutor=new TaskExecutor();
+                    //当为里程碑任务时
+                    if(tl.getTaskType()==1){
+                        taskExecutor.setTaskId(tl.getId());
+                        taskExecutor.setExecutorId(user.getId());
+                        taskExecutor.setExecutorName(user.getName());
+                        taskExecutor.setExecutorColor(user.getColor());
+                        taskExecutor.setProjectId(projectId);
+                        taskExecutorList.add(taskExecutor);
+                    }
+                });
+                taskExecutorService.saveBatch(taskExecutorList);
             }
         }