Merge branch 'temp' of http://1.14.125.6:3000/mianbin/ops-pro into temp
This commit is contained in:
commit
fa2fdf4873
@ -0,0 +1,149 @@
|
|||||||
|
package cd.casic.ci.common.pipeline.req.pipeline;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName PipelineReq
|
||||||
|
* @Author hopeli
|
||||||
|
* @Date 2025/5/10 10:53
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PipelineUpdateReq {
|
||||||
|
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
|
||||||
|
* @pi.desc:流水线类型 1.多任务 2.多阶段
|
||||||
|
* @pi.value: 1
|
||||||
|
*/
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:state
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:运行状态 1.未运行 2.运行中
|
||||||
|
* @pi.value:1
|
||||||
|
*/
|
||||||
|
private int state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:power
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:项目作用域 1.全局 2.项目
|
||||||
|
* @pi.value:1
|
||||||
|
*/
|
||||||
|
private int power;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:color
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:颜色 1~5随机生成
|
||||||
|
* @pi.value:2
|
||||||
|
*/
|
||||||
|
private int color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:template
|
||||||
|
* @pi.dataType:string
|
||||||
|
* @pi.desc:流水线模板
|
||||||
|
* @pi.value:template
|
||||||
|
*/
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
private String targetId;
|
||||||
|
|
||||||
|
private String targetType;
|
||||||
|
|
||||||
|
private String pipelineTag;
|
||||||
|
|
||||||
|
private String resourceId;
|
||||||
|
|
||||||
|
private String remake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pi.name:collect
|
||||||
|
* @pi.dataType:Integer
|
||||||
|
* @pi.desc:收藏 0.未收藏 1.收藏
|
||||||
|
* @pi.value:2
|
||||||
|
*/
|
||||||
|
private int collect;
|
||||||
|
|
||||||
|
private String executeUserId;
|
||||||
|
|
||||||
|
private LocalDateTime executeTime;
|
||||||
|
|
||||||
|
private String pipelineTriggerMode;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -2,8 +2,10 @@ 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.PipelineCreateReq;
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||||
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineUpdateReq;
|
||||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||||
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
import cd.casic.ci.process.process.dataObject.pipeline.PipPipeline;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
@ -22,4 +24,10 @@ public interface PipelineService extends IService<PipPipeline> {
|
|||||||
List<PipelineFindResp> findPipelineList(@Valid PipelineQueryReq pipelineQueryReq);
|
List<PipelineFindResp> findPipelineList(@Valid PipelineQueryReq pipelineQueryReq);
|
||||||
|
|
||||||
void deletePipeline(String pipelineId);
|
void deletePipeline(String pipelineId);
|
||||||
|
|
||||||
|
void updatePipeline(@Valid PipelineUpdateReq pipeline);
|
||||||
|
|
||||||
|
Page<PipelineFindResp> findPipelinePage(@Valid PipelineQueryReq query);
|
||||||
|
|
||||||
|
void pipelineClone(String pipelineId, String pipelineName);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ 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.PipelineCreateReq;
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineQueryReq;
|
||||||
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineUpdateReq;
|
||||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
||||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||||
import cd.casic.ci.process.process.converter.PipelineConverter;
|
import cd.casic.ci.process.process.converter.PipelineConverter;
|
||||||
@ -22,6 +23,7 @@ import cd.casic.framework.commons.exception.enums.GlobalErrorCodeConstants;
|
|||||||
import cd.casic.framework.commons.util.object.BeanUtils;
|
import cd.casic.framework.commons.util.object.BeanUtils;
|
||||||
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -307,4 +309,112 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
|||||||
pipResourceDao.deleteByIds(list);
|
pipResourceDao.deleteByIds(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updatePipeline(PipelineUpdateReq pipeline) {
|
||||||
|
PipPipeline pipPipeline = new PipPipeline();
|
||||||
|
BeanUtils.copyProperties(pipeline,pipPipeline);
|
||||||
|
pipelineDao.updateById(pipPipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<PipelineFindResp> findPipelinePage(PipelineQueryReq query) {
|
||||||
|
Page<PipelineFindResp> respPage = new Page<>();
|
||||||
|
|
||||||
|
QueryWrapper<PipPipeline> wrapper = new QueryWrapper<>();
|
||||||
|
if (!ObjectUtils.isEmpty(query.getId())){
|
||||||
|
wrapper.eq("id",query.getId());
|
||||||
|
}
|
||||||
|
if (!ObjectUtils.isEmpty(query.getIdList())){
|
||||||
|
wrapper.in("id",query.getId());
|
||||||
|
}
|
||||||
|
if (!ObjectUtils.isEmpty(query.getName())){
|
||||||
|
wrapper.like("name",query.getName());
|
||||||
|
}
|
||||||
|
if (!ObjectUtils.isEmpty(query.getCreateUserId())){
|
||||||
|
wrapper.eq("create_user_id",query.getCreateUserId());
|
||||||
|
}
|
||||||
|
if (!ObjectUtils.isEmpty(query.getCollect())){
|
||||||
|
wrapper.eq("collect",query.getCollect());
|
||||||
|
}
|
||||||
|
if (!ObjectUtils.isEmpty(query.getGroupId())){
|
||||||
|
wrapper.eq("group_id",query.getGroupId());
|
||||||
|
}
|
||||||
|
Page<PipPipeline> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
|
Page<PipPipeline> pipPipelinePage = pipelineDao.selectPage(page, wrapper);
|
||||||
|
|
||||||
|
if (ObjectUtils.isEmpty(pipPipelinePage)){
|
||||||
|
return new Page<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PipelineFindResp> respList = PipelineConverter.INSTANCE.toRespList(pipPipelinePage.getRecords());
|
||||||
|
|
||||||
|
//对流水线进行流水线信息赋值
|
||||||
|
respList.forEach(this::setStageAndTask);
|
||||||
|
respPage.setRecords(respList);
|
||||||
|
return respPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pipelineClone(String pipelineId, String pipelineName) {
|
||||||
|
PipPipeline pipeline = pipelineDao.selectById(pipelineId);
|
||||||
|
if (ObjectUtils.isEmpty(pipeline)){
|
||||||
|
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"数据错误,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
//复制pipeline
|
||||||
|
pipeline.setId(null);
|
||||||
|
pipeline.setName(pipelineName);
|
||||||
|
this.save(pipeline);
|
||||||
|
|
||||||
|
//复制stage
|
||||||
|
//复制阶段
|
||||||
|
PipStage pipStage = new PipStage();
|
||||||
|
pipStage.setPipelineId(pipelineId);
|
||||||
|
pipStage.setParentId("-1");
|
||||||
|
List<PipStage> pipStageParentList = stageService.getPipStageList(pipStage);
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(pipStageParentList)){
|
||||||
|
pipStageParentList.forEach(o->{
|
||||||
|
|
||||||
|
//根据阶段id查询下游并行节点
|
||||||
|
PipStage childStage = new PipStage();
|
||||||
|
childStage.setPipelineId(pipelineId);
|
||||||
|
childStage.setParentId(o.getStageId());
|
||||||
|
List<PipStage> pipStageChildList = stageService.getPipStageList(pipStage);
|
||||||
|
|
||||||
|
//对查询结束的stage进行复制
|
||||||
|
o.setStageId(null);
|
||||||
|
o.setPipelineId(pipeline.getId());
|
||||||
|
stageService.save(o);
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(pipStageChildList)){
|
||||||
|
pipStageChildList.forEach(j->{
|
||||||
|
|
||||||
|
//根据stageId查询串行节点
|
||||||
|
PipTask pipTask = new PipTask();
|
||||||
|
pipTask.setPipelineId(pipelineId);
|
||||||
|
pipTask.setStageId(j.getStageId());
|
||||||
|
List<PipTask> taskList = taskService.getTask(pipTask);
|
||||||
|
|
||||||
|
//对查询结束的并行节点进行复制
|
||||||
|
j.setStageId(null);
|
||||||
|
j.setParentId(o.getStageId());
|
||||||
|
j.setPipelineId(pipeline.getId());
|
||||||
|
stageService.save(j);
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(taskList)){
|
||||||
|
taskList.forEach(k->{
|
||||||
|
k.setTaskId(null);
|
||||||
|
k.setStageId(j.getStageId());
|
||||||
|
k.setPipelineId(pipeline.getId());
|
||||||
|
});
|
||||||
|
taskService.saveBatch(taskList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,9 @@ package cd.casic.ci.process.process.service.stage.impl;
|
|||||||
|
|
||||||
|
|
||||||
import cd.casic.ci.common.pipeline.req.stage.StageCreateReq;
|
import cd.casic.ci.common.pipeline.req.stage.StageCreateReq;
|
||||||
import cd.casic.ci.common.pipeline.req.stage.StageReq;
|
|
||||||
import cd.casic.ci.common.pipeline.req.stage.StageUpdateReq;
|
import cd.casic.ci.common.pipeline.req.stage.StageUpdateReq;
|
||||||
import cd.casic.ci.common.pipeline.req.task.TaskCreateReq;
|
import cd.casic.ci.common.pipeline.req.task.TaskCreateReq;
|
||||||
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
import cd.casic.ci.common.pipeline.resp.stage.StageResp;
|
||||||
|
|
||||||
import cd.casic.ci.process.process.dal.pipeline.PipStageDao;
|
import cd.casic.ci.process.process.dal.pipeline.PipStageDao;
|
||||||
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
import cd.casic.ci.process.process.dataObject.stage.PipStage;
|
||||||
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
import cd.casic.ci.process.process.dataObject.task.PipTask;
|
||||||
@ -17,10 +15,8 @@ import cd.casic.framework.commons.exception.enums.GlobalErrorCodeConstants;
|
|||||||
import cd.casic.framework.commons.util.object.BeanUtils;
|
import cd.casic.framework.commons.util.object.BeanUtils;
|
||||||
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
import cd.casic.framework.commons.util.util.WebFrameworkUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -31,8 +27,6 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cd.casic.ci.process.constant.PipelineFinalConstant.TASK_TYPE_CODE;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class StageServiceImpl extends ServiceImpl<PipStageDao, PipStage> implements StageService {
|
public class StageServiceImpl extends ServiceImpl<PipStageDao, PipStage> implements StageService {
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -2,11 +2,9 @@ package cd.casic.server.controller;
|
|||||||
|
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineCreateReq;
|
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.PipelineQueryReq;
|
||||||
import cd.casic.ci.common.pipeline.req.pipeline.PipelineReq;
|
import cd.casic.ci.common.pipeline.req.pipeline.PipelineUpdateReq;
|
||||||
import cd.casic.ci.common.pipeline.resp.pipeline.PipelineFindResp;
|
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.ci.process.process.service.pipeline.PipelineService;
|
||||||
import cd.casic.framework.commons.dataobject.User;
|
|
||||||
import cd.casic.framework.commons.pojo.CommonResult;
|
import cd.casic.framework.commons.pojo.CommonResult;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -18,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,172 +59,32 @@ public class PipelineController {
|
|||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(path="/findOnePipeline")
|
|
||||||
public CommonResult<List<PipelineResp>> findOnePipeline(@NotNull String pipelineId){
|
|
||||||
|
|
||||||
// Pipeline pipeline = pipelineService.findOnePipeline(pipelineId);
|
|
||||||
List<PipelineResp> pipelineRespList = new ArrayList<>(0);
|
|
||||||
PipelineResp pipeline = new PipelineResp();
|
|
||||||
pipeline.setId("1");
|
|
||||||
pipeline.setName("test数据交互测试");
|
|
||||||
pipelineRespList.add(pipeline);
|
|
||||||
|
|
||||||
return CommonResult.success(pipelineRespList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping(path="/findPipelineNoQuery")
|
|
||||||
public CommonResult<PipelineResp> findPipelineNoQuery(@NotNull String pipelineId){
|
|
||||||
|
|
||||||
// Pipeline pipeline = pipelineService.findPipelineNoQuery(pipelineId);
|
|
||||||
|
|
||||||
PipelineResp pipeline = new PipelineResp();
|
|
||||||
pipeline.setId("1");
|
|
||||||
pipeline.setName("test数据交互测试");
|
|
||||||
|
|
||||||
return CommonResult.success(pipeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @RequestMapping(path="/updatePipelineRootUser",method = RequestMethod.POST)
|
|
||||||
// // @ApiMethod(name = "updatePipelineRootUser",desc = "更新流水线负责人")
|
|
||||||
// // @ApiParam(name = "dmRolePatch",desc = "流水线负责人信息",required = true)
|
|
||||||
// public Result<Void> updatePipelineRootUser(@RequestBody @NotNull @Valid DmRolePatch dmRolePatch){
|
|
||||||
//
|
|
||||||
// pipelineService.updatePipelineRootUser(dmRolePatch);
|
|
||||||
//
|
|
||||||
// return Result.ok();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(path="/updatePipeline")
|
@PostMapping(path="/updatePipeline")
|
||||||
public CommonResult<Void> updatePipeline(@RequestBody @NotNull @Valid PipelineReq pipeline){
|
public CommonResult<Void> updatePipeline(@RequestBody @NotNull @Valid PipelineUpdateReq pipeline){
|
||||||
|
|
||||||
// pipelineService.updatePipeline(pipeline);
|
pipelineService.updatePipeline(pipeline);
|
||||||
|
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(path="/findUserPipelinePage")
|
@PostMapping(path="/findPipelinePage")
|
||||||
public CommonResult<Page<PipelineResp>> findUserPipelinePage(@RequestBody @NotNull @Valid PipelineQueryReq query){
|
public CommonResult<Page<PipelineFindResp>> findPipelinePage(@RequestBody @NotNull @Valid PipelineQueryReq query){
|
||||||
|
|
||||||
|
Page<PipelineFindResp> pipelineRespPage = pipelineService.findPipelinePage(query);
|
||||||
|
|
||||||
// Pagination<Pipeline> userPipeline = pipelineService.findUserPipelinePage(query);
|
|
||||||
Page<PipelineResp> pipelineRespPage = new Page<>();
|
|
||||||
List<PipelineResp> pipelineRespList = new ArrayList<>(0);
|
|
||||||
PipelineResp pipeline = new PipelineResp();
|
|
||||||
pipeline.setId("1");
|
|
||||||
pipeline.setName("test数据交互测试");
|
|
||||||
pipelineRespList.add(pipeline);
|
|
||||||
pipelineRespPage.setRecords(pipelineRespList);
|
|
||||||
return CommonResult.success(pipelineRespPage);
|
return CommonResult.success(pipelineRespPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(path="/findUserPipeline")
|
|
||||||
public CommonResult<List<PipelineResp>> findAllUserPipeline(@RequestBody @NotNull @Valid PipelineQueryReq query){
|
|
||||||
// List<Pipeline> userPipeline = pipelineService.findUserPipeline(query);
|
|
||||||
|
|
||||||
List<PipelineResp> pipelineRespList = new ArrayList<>(0);
|
|
||||||
PipelineResp pipeline = new PipelineResp();
|
|
||||||
pipeline.setId("1");
|
|
||||||
pipeline.setName("test数据交互测试");
|
|
||||||
pipelineRespList.add(pipeline);
|
|
||||||
return CommonResult.success(pipelineRespList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(path="/findPipelineUser")
|
|
||||||
public CommonResult<List<User>> findPipelineUser(@NotNull String pipelineId){
|
|
||||||
|
|
||||||
// List<User> dmUser = pipelineService.findPipelineUser(pipelineId);
|
|
||||||
List<User> userList = new ArrayList<>(0);
|
|
||||||
User user = new User();
|
|
||||||
user.setId("1");
|
|
||||||
user.setName("test数据交互测试");
|
|
||||||
userList.add(user);
|
|
||||||
return CommonResult.success(userList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(path="/pipelineClone")
|
@PostMapping(path="/pipelineClone")
|
||||||
public CommonResult<Void> pipelineClone(@NotNull String pipelineId,@NotNull String pipelineName){
|
public CommonResult<Void> pipelineClone(@NotNull String pipelineId,@NotNull String pipelineName){
|
||||||
|
|
||||||
// pipelineService.pipelineClone(pipelineId,pipelineName);
|
pipelineService.pipelineClone(pipelineId,pipelineName);
|
||||||
|
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(path="/findPipelineCloneName")
|
|
||||||
public CommonResult<String> findPipelineCloneName(@NotNull String pipelineId){
|
|
||||||
|
|
||||||
// String name = pipelineService.findPipelineCloneName(pipelineId);
|
|
||||||
String name = "test";
|
|
||||||
|
|
||||||
return CommonResult.success(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @pi.name:获取最近打开的流水线
|
|
||||||
// * @pi.url:/findRecentlyPipeline
|
|
||||||
// * @pi.methodType:post
|
|
||||||
// * @pi.request-type: formdata
|
|
||||||
// * @pi.param: name=number;dataType=Integer;value=查询数量;
|
|
||||||
// * @pi.param: name=pipelineId;dataType=String;value=流水线id;
|
|
||||||
// */
|
|
||||||
// @RequestMapping(path="/findRecentlyPipeline",method = RequestMethod.POST)
|
|
||||||
// public Result<String> findRecentlyPipeline(@NotNull Integer number,@NotNull String pipelineId){
|
|
||||||
//
|
|
||||||
// List<Pipeline> pipelineList = pipelineService.findRecentlyPipeline(number,pipelineId);
|
|
||||||
//
|
|
||||||
// return Result.ok(pipelineList);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @pi.name:流水线导出为Yaml格式
|
|
||||||
// * @pi.url:/importPipelineYaml
|
|
||||||
// * @pi.methodType:post
|
|
||||||
// * @pi.request-type: formdata
|
|
||||||
// * @pi.param: name=request;dataType=HttpServletResponse;value=请求;
|
|
||||||
// * @pi.param: name=response;dataType=HttpServletRequest;value=请求体;
|
|
||||||
// */
|
|
||||||
// @RequestMapping(path="/importPipelineYaml",method = RequestMethod.POST)
|
|
||||||
// public ResponseEntity<Object> importPipelineYaml(HttpServletRequest request, HttpServletResponse response) {
|
|
||||||
// try {
|
|
||||||
// Map<String, String[]> parameterMap = request.getParameterMap();
|
|
||||||
//
|
|
||||||
// String pipelineId = Arrays.toString(parameterMap.get("pipelineId")).replace("[","").replace("]","");
|
|
||||||
//
|
|
||||||
// String yamlString = yamlService.importPipelineYaml(pipelineId);
|
|
||||||
//
|
|
||||||
// Pipeline pipeline = pipelineService.findPipelineById(pipelineId);
|
|
||||||
//
|
|
||||||
// String tempFile = PipelineFileUtil.createTempFile(yamlString, ".yaml");
|
|
||||||
// File file = new File(tempFile);
|
|
||||||
// BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
|
||||||
//
|
|
||||||
// ServletOutputStream outputStream = response.getOutputStream();
|
|
||||||
// response.setHeader("Content-Disposition", "attachment; filename="+pipeline.getName());
|
|
||||||
// response.setContentLength((int) file.length());
|
|
||||||
//
|
|
||||||
// int buf_size = 1024;
|
|
||||||
// byte[] buffer = new byte[buf_size];
|
|
||||||
// int len = 0;
|
|
||||||
// while (-1 != (len = in.read(buffer, 0, buf_size))) {
|
|
||||||
// outputStream.write(buffer,0,len);
|
|
||||||
// }
|
|
||||||
// in.close();
|
|
||||||
// outputStream.close();
|
|
||||||
//
|
|
||||||
// file.delete();
|
|
||||||
//
|
|
||||||
// return ResponseEntity.ok().build();
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(Result.error(1000,"下载失败"));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user