stage部分方法
This commit is contained in:
parent
19f9ad32a9
commit
2a5dddfb68
@ -113,7 +113,7 @@ public interface StageService {
|
||||
* @param stageId 阶段id
|
||||
* @return 阶段信息
|
||||
*/
|
||||
StageResp findOneStages(String stageId);
|
||||
PipStage findOneStages(String stageId);
|
||||
|
||||
/**
|
||||
* 查询所有阶段
|
||||
|
@ -19,6 +19,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cd.casic.ci.process.constant.PipelineFinalConstant.TASK_TYPE_CODE;
|
||||
|
||||
@Service
|
||||
public class StageServiceImpl implements StageService {
|
||||
@Resource
|
||||
@ -44,7 +46,7 @@ public class StageServiceImpl implements StageService {
|
||||
// TODO 查询是否为已知worker
|
||||
taskService.taskTypeExist(taskType);
|
||||
//是否为源码
|
||||
if (taskType.equals(PipelineFinal.TASK_TYPE_CODE)){
|
||||
if (TASK_TYPE_CODE.equals(taskType)){
|
||||
//判断是否存在代码源(目标)节点
|
||||
findTargetTasks(pipelineId);
|
||||
|
||||
@ -200,7 +202,7 @@ public class StageServiceImpl implements StageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageResp findOneStages(String stageId) {
|
||||
public PipStage findOneStages(String stageId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -218,11 +220,11 @@ public class StageServiceImpl implements StageService {
|
||||
* @param pipelineId 流水线id
|
||||
*/
|
||||
private void findTargetTasks(String pipelineId) {
|
||||
List<StageResp> allStage = findAllMainStage(pipelineId);
|
||||
List<PipStage> allStage = findAllMainStage(pipelineId);
|
||||
if (allStage.isEmpty()){
|
||||
return;
|
||||
}
|
||||
for (StageResp stage : allStage) {
|
||||
for (PipStage stage : allStage) {
|
||||
if (stage.isCode()){
|
||||
throw new ServiceException(50001,"代码源已存在,无法再次创建。");
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ package cd.casic.ci.process.process.service.task.impl;
|
||||
import cd.casic.ci.common.pipeline.annotation.Plugin;
|
||||
import cd.casic.ci.common.pipeline.constant.PipelineDateUtilConstant;
|
||||
import cd.casic.ci.common.pipeline.utils.PipelineDateUtil;
|
||||
import cd.casic.ci.process.process.dal.pipeline.PipStageDao;
|
||||
import cd.casic.ci.process.process.dal.pipeline.PipTaskDao;
|
||||
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
import cd.casic.ci.process.process.service.task.TaskService;
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
@ -29,6 +31,8 @@ public class TaskServiceImpl implements TaskService {
|
||||
private Set<BeanDefinition> candidates;
|
||||
@Resource
|
||||
private PipTaskDao taskDao;
|
||||
@Resource
|
||||
private PipStageDao stageDao;
|
||||
|
||||
public TaskServiceImpl() {
|
||||
System.out.println("");
|
||||
@ -70,12 +74,12 @@ public class TaskServiceImpl implements TaskService {
|
||||
if (stageId != null){
|
||||
sort = initSort(stageId, taskSort, taskType,2);
|
||||
}
|
||||
|
||||
//后置任务
|
||||
String postprocessId = tasks.getPostprocessId();
|
||||
if (postprocessId != null){
|
||||
sort = initSort(postprocessId, taskSort, taskType,3);
|
||||
}
|
||||
// TODO 后置任务暂时空置
|
||||
// //后置任务
|
||||
// String postprocessId = tasks.getPostprocessId();
|
||||
// if (postprocessId != null){
|
||||
// sort = initSort(postprocessId, taskSort, taskType,3);
|
||||
// }
|
||||
|
||||
tasks.setTaskSort(sort);
|
||||
// 初始化名称
|
||||
@ -130,14 +134,14 @@ public class TaskServiceImpl implements TaskService {
|
||||
list = finAllPipelineTask(id);
|
||||
}
|
||||
if (type == 2){
|
||||
list = finAllStageTask(id);
|
||||
}
|
||||
if (type == 3){
|
||||
PipTask postTask = findOnePostTask(id);
|
||||
if (postTask!= null){
|
||||
list.add(postTask);
|
||||
}
|
||||
list = findAllStageTask(id);
|
||||
}
|
||||
// if (type == 3){
|
||||
// PipTask postTask = findOnePostTask(id);
|
||||
// if (postTask!= null){
|
||||
// list.add(postTask);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (list.isEmpty()){
|
||||
return 1;
|
||||
@ -178,4 +182,16 @@ public class TaskServiceImpl implements TaskService {
|
||||
taskDao.insert(tasks);
|
||||
return tasks.getTaskId();
|
||||
}
|
||||
/**
|
||||
* 根据stageId查询task
|
||||
* */
|
||||
private List<PipTask> findAllStageTask(String stageId) {
|
||||
// TasksQuery tasksQuery = new TasksQuery();
|
||||
// tasksQuery.setStageId(stageId);
|
||||
// List<TasksEntity> tasksEntityList = tasksDao.findTaskList(tasksQuery);
|
||||
// return BeanMapper.mapList(tasksEntityList, Tasks.class);
|
||||
LambdaQueryWrapper<PipTask> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PipTask::getStageId,stageId);
|
||||
return taskDao.selectList(wrapper);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user