Merge branch 'temp' of http://1.14.125.6:3000/mianbin/ops-pro into temp
This commit is contained in:
commit
8eb38f3c30
@ -3,6 +3,8 @@ package cd.casic.ci.common.pipeline.req.pipeline;
|
||||
import cd.casic.ci.common.pipeline.req.resource.ResourceReq;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName PipelineReq
|
||||
* @Author hopeli
|
||||
@ -15,19 +17,17 @@ public class PipelineCreateReq {
|
||||
|
||||
private String name;
|
||||
|
||||
private String userId;
|
||||
private String createUserId;
|
||||
|
||||
private String updateUserId;
|
||||
|
||||
private String envId;
|
||||
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* @pi.name:createTime
|
||||
* @pi.dataType:string
|
||||
* @pi.desc:流水线创建时间
|
||||
* @pi.value:createTime
|
||||
*/
|
||||
private String createTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* @pi.name:type
|
||||
@ -87,6 +87,14 @@ public class PipelineCreateReq {
|
||||
*/
|
||||
private int collect;
|
||||
|
||||
private String executeUserId;
|
||||
|
||||
private LocalDateTime executeTime;
|
||||
|
||||
private String pipelineTriggerMode;
|
||||
|
||||
private String executeStatus;
|
||||
|
||||
|
||||
// // 以下为统计信息
|
||||
//
|
||||
|
@ -1,8 +1,10 @@
|
||||
package cd.casic.ci.common.pipeline.req.pipeline;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cd.casic.framework.commons.pojo.PageParam;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PipelineQueryReq
|
||||
* @Author hopeli
|
||||
@ -10,39 +12,33 @@ import lombok.Data;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PipelineQueryReq {
|
||||
private String userId;
|
||||
public class PipelineQueryReq extends PageParam {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
// 创建人
|
||||
private List<String> idList;
|
||||
|
||||
/**
|
||||
* 流水线名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 创建人用户id
|
||||
*/
|
||||
private String createUserId;
|
||||
|
||||
private String pipelineName;
|
||||
|
||||
/**
|
||||
* 流水线状态 1.运行中 2.未运行,3.等待执行
|
||||
* 是否收藏 0.未收藏 1.收藏
|
||||
*/
|
||||
private Integer pipelineState;
|
||||
private Integer collect;
|
||||
|
||||
/**
|
||||
* 流水线类型 1.多任务 2.多阶段
|
||||
* 流水线组id
|
||||
*/
|
||||
private Integer pipelineType;
|
||||
|
||||
private Integer pipelinePower;
|
||||
|
||||
private Integer pipelineFollow;
|
||||
|
||||
private String[] idString;
|
||||
|
||||
private boolean eqName;
|
||||
|
||||
// 环境
|
||||
private String envId;
|
||||
|
||||
// 分组
|
||||
private String groupId;
|
||||
|
||||
|
||||
private Page pageParam= new Page();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,67 @@
|
||||
package cd.casic.ci.common.pipeline.resp.pipeline;
|
||||
|
||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PipelineFindResp
|
||||
* @Author hopeli
|
||||
* @Date 2025/5/10 10:53
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PipelineFindResp {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
//创建人id
|
||||
private String createUserId;
|
||||
|
||||
//创建人姓名
|
||||
private String createUserName;
|
||||
|
||||
//最后修改人id
|
||||
private String updateUserId;
|
||||
|
||||
//最后修改人姓名
|
||||
private String updateUserName;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否收藏 0.未收藏 1.收藏
|
||||
*/
|
||||
private Integer collect;
|
||||
|
||||
|
||||
/**
|
||||
* 执行人id
|
||||
*/
|
||||
private String executeUserId;
|
||||
|
||||
/**
|
||||
* 执行时间
|
||||
*/
|
||||
private LocalDateTime executeTime;
|
||||
|
||||
/**
|
||||
* 流水线触发方式
|
||||
*/
|
||||
private String pipelineTriggerMode;
|
||||
|
||||
/**
|
||||
* 执行状态
|
||||
*/
|
||||
private String executeStatus;
|
||||
|
||||
private List<StageResp> stageList;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cd.casic.ci.process.process.converter;
|
||||
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HopeLi
|
||||
* @version v1.0
|
||||
* @ClassName PipelineConverter
|
||||
* @Date: 2025/5/13 14:39
|
||||
* @Description:
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PipelineConverter {
|
||||
PipelineConverter INSTANCE = Mappers.getMapper(PipelineConverter.class);
|
||||
|
||||
PipelineFindResp toResp(PipPipeline pipPipeline);
|
||||
List<PipelineFindResp> toRespList(List<PipPipeline> pipPipelines);
|
||||
|
||||
}
|
@ -17,15 +17,19 @@ public class PipPipeline {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
* 创建人用户id
|
||||
*/
|
||||
private String userId;
|
||||
private String createUserId;
|
||||
|
||||
private String updateUserId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 流水线类型 1.多任务 2.多阶段
|
||||
*/
|
||||
@ -52,7 +56,7 @@ public class PipPipeline {
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 是否收藏 0.未收藏/1.收藏
|
||||
* 是否收藏 0.未收藏 1.收藏
|
||||
*/
|
||||
private Integer collect;
|
||||
|
||||
@ -85,4 +89,24 @@ public class PipPipeline {
|
||||
* 流水线环境
|
||||
*/
|
||||
private String envId;
|
||||
|
||||
/**
|
||||
* 执行人id
|
||||
*/
|
||||
private String executeUserId;
|
||||
|
||||
/**
|
||||
* 执行时间
|
||||
*/
|
||||
private LocalDateTime executeTime;
|
||||
|
||||
/**
|
||||
* 流水线触发方式
|
||||
*/
|
||||
private String pipelineTriggerMode;
|
||||
|
||||
/**
|
||||
* 执行状态
|
||||
*/
|
||||
private String executeStatus;
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
package cd.casic.ci.process.process.service.pipeline;
|
||||
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author HopeLi
|
||||
@ -12,5 +17,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @Description:
|
||||
*/
|
||||
public interface PipelineService extends IService<PipPipeline> {
|
||||
String createPipeline(PipelineCreateReq pipelineReq);
|
||||
String createPipeline(@Valid PipelineCreateReq pipelineReq);
|
||||
|
||||
List<PipelineFindResp> findPipelineList(@Valid PipelineQueryReq pipelineQueryReq);
|
||||
}
|
||||
|
@ -1,17 +1,21 @@
|
||||
package cd.casic.ci.process.process.service.pipeline.impl;
|
||||
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||
import cd.casic.ci.process.process.dal.pipeline.PipelineDao;
|
||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||
import cd.casic.ci.process.process.dataObject.resource.PipResource;
|
||||
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||
import cd.casic.ci.process.process.converter.PipelineConverter;
|
||||
import cd.casic.ci.process.process.service.pipeline.PipelineService;
|
||||
import cd.casic.ci.process.process.service.resource.impl.ResourceServiceImpl;
|
||||
import cd.casic.ci.process.process.service.stage.impl.StageServiceImpl;
|
||||
import cd.casic.ci.process.process.service.task.impl.TaskServiceImpl;
|
||||
import cd.casic.framework.commons.util.object.BeanUtils;
|
||||
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -20,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -41,6 +47,9 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
@Resource
|
||||
private ResourceServiceImpl resourceService;
|
||||
|
||||
@Resource
|
||||
private PipelineDao pipelineDao;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createPipeline(PipelineCreateReq pipelineReq) {
|
||||
@ -52,9 +61,9 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
pipeline.setColor(randomNumber);
|
||||
|
||||
pipeline.setCreateTime(LocalDateTime.now());
|
||||
if (Objects.isNull(pipeline.getUserId())){
|
||||
if (Objects.isNull(pipeline.getCreateUserId())){
|
||||
String loginUserId = String.valueOf(WebFrameworkUtils.getLoginUserId());
|
||||
pipeline.setUserId(loginUserId);
|
||||
pipeline.setCreateUserId(loginUserId);
|
||||
}
|
||||
|
||||
pipeline.setState(1);
|
||||
@ -192,4 +201,35 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
}
|
||||
return pipeline.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PipelineFindResp> findPipelineList(PipelineQueryReq pipelineQueryReq) {
|
||||
QueryWrapper<PipPipeline> wrapper = new QueryWrapper<>();
|
||||
if (!ObjectUtils.isEmpty(pipelineQueryReq.getId())){
|
||||
wrapper.eq("id",pipelineQueryReq.getId());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(pipelineQueryReq.getIdList())){
|
||||
wrapper.in("id",pipelineQueryReq.getId());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(pipelineQueryReq.getName())){
|
||||
wrapper.like("name",pipelineQueryReq.getName());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(pipelineQueryReq.getCreateUserId())){
|
||||
wrapper.eq("create_user_id",pipelineQueryReq.getCreateUserId());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(pipelineQueryReq.getCollect())){
|
||||
wrapper.eq("collect",pipelineQueryReq.getCollect());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(pipelineQueryReq.getGroupId())){
|
||||
wrapper.eq("group_id",pipelineQueryReq.getGroupId());
|
||||
}
|
||||
// Page<PipPipeline> page = new Page<>(pipelineQueryReq.getPageNo(), pipelineQueryReq.getPageSize());
|
||||
// Page<PipPipeline> pipPipelinePage = pipelineDao.selectPage(page, wrapper);
|
||||
|
||||
List<PipPipeline> pipPipelines = pipelineDao.selectList(wrapper);
|
||||
if (ObjectUtils.isEmpty(pipPipelines)){
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return PipelineConverter.INSTANCE.toRespList(pipPipelines);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cd.casic.server.controller;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineResp;
|
||||
import cd.casic.ci.process.process.service.pipeline.PipelineService;
|
||||
import cd.casic.framework.commons.dataobject.User;
|
||||
@ -45,13 +46,12 @@ public class PipelineController {
|
||||
|
||||
|
||||
@PermitAll
|
||||
@PostMapping(path="/findAllPipeline")
|
||||
public CommonResult<List<PipelineResp>> findAllPipeline(){
|
||||
@PostMapping(path="/findPipelineList")
|
||||
public CommonResult<List<PipelineFindResp>> findPipelineList(@RequestBody @Valid PipelineQueryReq pipelineQueryReq){
|
||||
|
||||
// List<PipelineResp> selectAllPipeline = pipelineService.findAllPipeline();
|
||||
List<PipelineFindResp> respList = pipelineService.findPipelineList(pipelineQueryReq);
|
||||
|
||||
List<PipelineResp> selectAllPipeline = new ArrayList<>(0);
|
||||
return CommonResult.success(selectAllPipeline);
|
||||
return CommonResult.success(respList);
|
||||
}
|
||||
|
||||
@PostMapping(path="/deletePipeline")
|
||||
|
10
pom.xml
10
pom.xml
@ -95,16 +95,16 @@
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<!-- 编译参数写在 arg 内,解决 Spring Boot 3.2 的 Parameter Name Discovery 问题 -->
|
||||
<debug>false</debug>
|
||||
|
Loading…
x
Reference in New Issue
Block a user