Compare commits
No commits in common. "56d33181580d7dbdaa03817f5a6bcc218792d7d6" and "fa2fdf48739f9c9574144eca85d8989d4431b536" have entirely different histories.
56d3318158
...
fa2fdf4873
@ -13,11 +13,22 @@ import java.time.LocalDateTime;
|
||||
*/
|
||||
@Data
|
||||
public class PipelineCreateReq {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String createUserId;
|
||||
|
||||
private String updateUserId;
|
||||
|
||||
private String envId;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* @pi.name:type
|
||||
* @pi.dataType:Integer
|
||||
@ -64,7 +75,7 @@ public class PipelineCreateReq {
|
||||
|
||||
private String pipelineTag;
|
||||
|
||||
private String projectId;
|
||||
private String resourceId;
|
||||
|
||||
private String remake;
|
||||
|
||||
@ -84,5 +95,57 @@ public class PipelineCreateReq {
|
||||
|
||||
private String executeStatus;
|
||||
|
||||
|
||||
// // 以下为统计信息
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @pi.model:execUser
|
||||
// * @pi.desc:用户(执行人)
|
||||
// */
|
||||
// private User execUser;
|
||||
//
|
||||
// /**
|
||||
// * @pi.name:number
|
||||
// * @pi.dataType:Integer
|
||||
// * @pi.desc:执行次数
|
||||
// * @pi.value:2
|
||||
// */
|
||||
// private Integer number;
|
||||
//
|
||||
// /**
|
||||
// * @pi.name:instanceId
|
||||
// * @pi.dataType:string
|
||||
// * @pi.desc:实例id
|
||||
// * @pi.value:instanceId
|
||||
// */
|
||||
// private String instanceId;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @pi.name:buildStatus
|
||||
// * @pi.dataType:string
|
||||
// * @pi.desc:最近构建状态
|
||||
// * @pi.value:buildStatus
|
||||
// */
|
||||
// private String buildStatus;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @pi.name:lastBuildTime
|
||||
// * @pi.dataType:string
|
||||
// * @pi.desc:最近构建时间
|
||||
// * @pi.value:lastBuildTime
|
||||
// */
|
||||
// private String lastBuildTime;
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @pi.name:isExec
|
||||
// * @pi.dataType:boolean
|
||||
// * @pi.desc:是否可以执行
|
||||
// * @pi.value:true
|
||||
// */
|
||||
// private Boolean isExec;
|
||||
private ResourceReq resourceReq;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package cd.casic.ci.common.pipeline.req.pipeline;
|
||||
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -12,7 +11,6 @@ import java.util.List;
|
||||
* @Date 2025/5/10 9:54
|
||||
* @Version 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PipelineQueryReq extends PageParam {
|
||||
/**
|
||||
|
@ -109,14 +109,4 @@ public class PipPipeline {
|
||||
* 执行状态
|
||||
*/
|
||||
private String executeStatus;
|
||||
|
||||
/**
|
||||
* 流水线标签
|
||||
*/
|
||||
private String pipelineTag;
|
||||
|
||||
/**
|
||||
* 所属项目id
|
||||
*/
|
||||
private String projectId;
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -86,18 +85,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
}
|
||||
|
||||
pipeline.setState(1);
|
||||
|
||||
//新增对应的配置类数据
|
||||
if (!ObjectUtils.isEmpty(pipelineReq.getResourceReq())){
|
||||
PipResource resource = new PipResource();
|
||||
BeanUtils.copyProperties(pipelineReq.getResourceReq(),resource);
|
||||
resource.setCreateUserId(pipeline.getCreateUserId());
|
||||
resource.setCreateTime(LocalDateTime.now());
|
||||
resourceService.save(resource);
|
||||
|
||||
pipeline.setResourceId(resource.getId());
|
||||
}
|
||||
|
||||
this.save(pipeline);
|
||||
|
||||
//TODO 根据模板覆写对应的阶段信息以及节点信息
|
||||
@ -110,7 +97,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
stageReq1.setPipelineId(pipeline.getId());
|
||||
stageReq1.setStageName("阶段-1");
|
||||
stageReq1.setCreateTime(LocalDateTime.now());
|
||||
stageReq1.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
stageReq1.setStageSort(1);
|
||||
stageReq1.setParentId("-1");
|
||||
stageReq1.setCode(true);
|
||||
@ -120,7 +106,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
childStage1.setPipelineId(pipeline.getId());
|
||||
childStage1.setStageName("源码");
|
||||
childStage1.setCreateTime(LocalDateTime.now());
|
||||
childStage1.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childStage1.setStageSort(1);
|
||||
childStage1.setCode(false);
|
||||
childStage1.setParentId(stageReq1.getStageId());
|
||||
@ -131,7 +116,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
stageReq2.setPipelineId(pipeline.getId());
|
||||
stageReq2.setStageName("阶段-2");
|
||||
stageReq2.setCreateTime(LocalDateTime.now());
|
||||
stageReq2.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
stageReq2.setStageSort(2);
|
||||
stageReq2.setParentId("-1");
|
||||
stageReq2.setCode(true);
|
||||
@ -142,7 +126,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
childStage21.setStageName("并行阶段-2-1");
|
||||
childStage21.setPipelineId(pipeline.getId());
|
||||
childStage21.setCreateTime(LocalDateTime.now());
|
||||
childStage21.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childStage21.setStageSort(1);
|
||||
childStage21.setCode(false);
|
||||
childStage21.setParentId(stageReq2.getStageId());
|
||||
@ -153,7 +136,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
childTask21.setPipelineId(pipeline.getId());
|
||||
childTask21.setTaskName("串行任务-2-1");
|
||||
childTask21.setCreateTime(LocalDateTime.now());
|
||||
childTask21.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childTask21.setTaskType("test");
|
||||
childTask21.setTaskSort(1);
|
||||
childTask21.setStageId(childStage21.getStageId());
|
||||
@ -164,7 +146,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
childStage22.setStageName("并行阶段-2-2");
|
||||
childStage22.setPipelineId(pipeline.getId());
|
||||
childStage22.setCreateTime(LocalDateTime.now());
|
||||
childStage22.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childStage22.setStageSort(2);
|
||||
childStage22.setCode(false);
|
||||
childStage22.setParentId(stageReq2.getStageId());
|
||||
@ -172,7 +153,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
|
||||
PipTask childTask22 = new PipTask();
|
||||
childTask22.setCreateTime(LocalDateTime.now());
|
||||
childTask22.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childTask22.setTaskName("串行任务-2-2");
|
||||
childTask22.setPipelineId(pipeline.getId());
|
||||
childTask22.setTaskType("test");
|
||||
@ -185,7 +165,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
stageReq3.setPipelineId(pipeline.getId());
|
||||
stageReq3.setStageName("阶段-3");
|
||||
stageReq3.setCreateTime(LocalDateTime.now());
|
||||
stageReq3.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
stageReq3.setStageSort(3);
|
||||
stageReq3.setParentId("-1");
|
||||
stageReq3.setCode(true);
|
||||
@ -195,7 +174,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
childStage31.setStageName("并行任务-3-1");
|
||||
childStage31.setPipelineId(pipeline.getId());
|
||||
childStage31.setCreateTime(LocalDateTime.now());
|
||||
childStage31.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childStage31.setStageSort(1);
|
||||
childStage31.setCode(false);
|
||||
childStage31.setParentId(stageReq3.getStageId());
|
||||
@ -203,7 +181,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
|
||||
PipTask childTask31 = new PipTask();
|
||||
childTask31.setCreateTime(LocalDateTime.now());
|
||||
childTask31.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childTask31.setTaskName("串行任务-3-1");
|
||||
childTask31.setPipelineId(pipeline.getId());
|
||||
childTask31.setTaskType("test");
|
||||
@ -216,7 +193,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
stageReq4.setPipelineId(pipeline.getId());
|
||||
stageReq4.setStageName("阶段-4");
|
||||
stageReq4.setCreateTime(LocalDateTime.now());
|
||||
stageReq4.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
stageReq4.setStageSort(4);
|
||||
stageReq4.setParentId("-1");
|
||||
stageReq4.setCode(true);
|
||||
@ -226,7 +202,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
childStage41.setStageName("并行任务-4-1");
|
||||
childStage41.setPipelineId(pipeline.getId());
|
||||
childStage41.setCreateTime(LocalDateTime.now());
|
||||
childStage41.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childStage41.setStageSort(1);
|
||||
childStage41.setCode(false);
|
||||
childStage41.setParentId(stageReq4.getStageId());
|
||||
@ -234,7 +209,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
|
||||
PipTask childTask41 = new PipTask();
|
||||
childTask41.setCreateTime(LocalDateTime.now());
|
||||
childTask41.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
childTask41.setTaskName("串行任务-4-1");
|
||||
childTask41.setPipelineId(pipeline.getId());
|
||||
childTask41.setTaskType("test");
|
||||
@ -244,6 +218,14 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
|
||||
//TODO 创建对应的鉴权关系
|
||||
//TODO 创建对应的消息分发
|
||||
|
||||
//新增对应的配置类数据
|
||||
if (!ObjectUtils.isEmpty(pipelineReq.getResourceReq())){
|
||||
PipResource resource = new PipResource();
|
||||
BeanUtils.copyProperties(pipelineReq.getResourceReq(),resource);
|
||||
resource.setPipelineId(pipeline.getId());
|
||||
resourceService.save(resource);
|
||||
}
|
||||
return pipeline.getId();
|
||||
}
|
||||
|
||||
@ -319,12 +301,12 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
}
|
||||
|
||||
//删除resource表数据
|
||||
if (StringUtils.isNotEmpty(pipeline.getResourceId())){
|
||||
PipResource pipResource = pipResourceDao.selectById(pipeline.getResourceId());
|
||||
|
||||
if (!ObjectUtils.isEmpty(pipResource)){
|
||||
pipResourceDao.deleteById(pipeline.getResourceId());
|
||||
}
|
||||
QueryWrapper<PipResource> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("pipeline_id",pipelineId);
|
||||
List<PipResource> pipResources = pipResourceDao.selectList(wrapper);
|
||||
if (!CollectionUtils.isEmpty(pipResources)){
|
||||
List<String> list = pipResources.stream().map(PipResource::getId).toList();
|
||||
pipResourceDao.deleteByIds(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -332,8 +314,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
public void updatePipeline(PipelineUpdateReq pipeline) {
|
||||
PipPipeline pipPipeline = new PipPipeline();
|
||||
BeanUtils.copyProperties(pipeline,pipPipeline);
|
||||
pipPipeline.setUpdateTime(LocalDateTime.now());
|
||||
pipPipeline.setUpdateUserId(String.valueOf(WebFrameworkUtils.getLoginUserId()));
|
||||
pipelineDao.updateById(pipPipeline);
|
||||
}
|
||||
|
||||
@ -385,8 +365,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
//复制pipeline
|
||||
pipeline.setId(null);
|
||||
pipeline.setName(pipelineName);
|
||||
pipeline.setCreateTime(LocalDateTime.now());
|
||||
pipeline.setCreateUserId(String.valueOf(WebFrameworkUtils.getLoginUserId()));
|
||||
this.save(pipeline);
|
||||
|
||||
//复制stage
|
||||
@ -408,8 +386,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
//对查询结束的stage进行复制
|
||||
o.setStageId(null);
|
||||
o.setPipelineId(pipeline.getId());
|
||||
o.setCreateTime(LocalDateTime.now());
|
||||
o.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
stageService.save(o);
|
||||
|
||||
if (!CollectionUtils.isEmpty(pipStageChildList)){
|
||||
@ -425,8 +401,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
j.setStageId(null);
|
||||
j.setParentId(o.getStageId());
|
||||
j.setPipelineId(pipeline.getId());
|
||||
j.setCreateTime(LocalDateTime.now());
|
||||
j.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
stageService.save(j);
|
||||
|
||||
if (!CollectionUtils.isEmpty(taskList)){
|
||||
@ -434,8 +408,6 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
k.setTaskId(null);
|
||||
k.setStageId(j.getStageId());
|
||||
k.setPipelineId(pipeline.getId());
|
||||
k.setCreateTime(LocalDateTime.now());
|
||||
k.setCreateUserId(WebFrameworkUtils.getLoginUserId());
|
||||
});
|
||||
taskService.saveBatch(taskList);
|
||||
}
|
||||
@ -444,7 +416,5 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//TODO 复制状态下资源处理不明确,暂时只做resourceId的继承保留
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user