Merge branch 'product_refact' of code.gitlink.org.cn:Gitlink/microservices into product_refact

# Conflicts:
#	microservices-modules/microservices-modules-pms/src/main/java/com/microservices/pms/pipeline/service/impl/PmsCiPipelinesServiceImpl.java
This commit is contained in:
OTTO 2025-02-11 15:51:02 +08:00
commit d58e359798
26 changed files with 296 additions and 32 deletions

View File

@ -35,6 +35,8 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.microservices.pms.utils.PmsConstants.PRODUCT_PLAN_CLOSED_STATUS_NAME;
@RestController
@RequestMapping("/{enterpriseIdentifier}/dashboard")
@Api(tags = "项目管理-工作台")
@ -84,6 +86,11 @@ public class PmsDashboardController extends BaseController {
pmsProductRequirement.setCreateBy(SecurityUtils.getUsername());
Integer requirementCount = pmsProductRequirementService.selectProductReqSpecsCount(pmsProductRequirement);
myDashboardVo.setProductRequirementCount(requirementCount);
long assignedMeProductCount = pmsProductList.stream()
.filter(pmsProduct -> pmsProduct.getProductAssigneeGitlinkIds().contains(String.valueOf(SecurityUtils.getGitlinkUserId())))
.count();
myDashboardVo.setAssignedMeProductCount((int) assignedMeProductCount);
}
return success(myDashboardVo);
}
@ -186,7 +193,7 @@ public class PmsDashboardController extends BaseController {
PmsProductStatVo statVo = new PmsProductStatVo();
String pmsProductIdentifier = e.getProductIdentifier();
Integer requirementCount = pmsProductRequirementService.countByIdentifierAndStatus(pmsProductIdentifier, getUserReqList());
Integer reqSpecsCount = pmsProductRequirementService.countByIdentifierAndStatus(pmsProductIdentifier, getReqSpecsList());
Integer reqSpecsCount = pmsProductRequirementService.countByIdentifierAndStatus(pmsProductIdentifier, getTotalReqSpecsList());
BeanUtils.copyProperties(e, statVo);
statVo.setReqSpecsCount(reqSpecsCount);
statVo.setUserReqCount(requirementCount);
@ -219,8 +226,7 @@ public class PmsDashboardController extends BaseController {
PmsRequirementStatResVo pmsRequirementStatResVo = buildPmsRequirementStatResVo(
productIdentifier,
getReqSpecsList(),
ProductReqStatus.REVIEWED_REQ_SPECS);
ProductReqStatus.COMPLETED_REQ_SPECS);
return R.ok(pmsRequirementStatResVo);
}
@ -233,7 +239,7 @@ public class PmsDashboardController extends BaseController {
PmsProductStatus pmsProductStatus = new PmsProductStatus();
pmsProductStatus.setType(1);
List<PmsTypeDataVo> pmsTypeDataVos = pmsProductStatusService.selectPmsProductStatusList(pmsProductStatus);
List<ReqStatusStatVo> statusStatVos = pmsTypeDataVos.stream().map(e -> {
List<ReqStatusStatVo> statusStatVos = pmsTypeDataVos.stream().filter(e -> !PRODUCT_PLAN_CLOSED_STATUS_NAME.equals(e.getName())).map(e -> {
ReqStatusStatVo vo = new ReqStatusStatVo();
vo.setKey(String.valueOf(e.getId()));
vo.setNum(status2NumMap.getOrDefault(String.valueOf(e.getId()), 0));
@ -248,19 +254,32 @@ public class PmsDashboardController extends BaseController {
/**
* 获取 需求规格状态list
* 获取 统计饼图所需的需求规格状态list
* @return 需求规格状态list
*/
private List<String> getReqSpecsList() {
return Stream.of(ProductReqStatus.PENDING_REVIEW_REQ_SPECS.getKey(),
ProductReqStatus.PLANNED_REQ_SPECS.getKey(),
ProductReqStatus.REJECTED_CHANGE_REQ_SPECS.getKey(),
ProductReqStatus.REJECTED_REQ_SPECS.getKey(),
ProductReqStatus.REVIEWED_REQ_SPECS.getKey(),
ProductReqStatus.COMPLETED_REQ_SPECS.getKey(),
ProductReqStatus.CHANGED_REQ_SPECS.getKey())
ProductReqStatus.COMPLETED_REQ_SPECS.getKey())
.collect(Collectors.toList());
}
/**
* 获取Count总数时需求规格的状态list
* @return 需求规格状态list
*/
private List<String> getTotalReqSpecsList() {
return Stream.of(ProductReqStatus.PENDING_REVIEW_REQ_SPECS.getKey(),
ProductReqStatus.PLANNED_REQ_SPECS.getKey(),
ProductReqStatus.REJECTED_REQ_SPECS.getKey(),
ProductReqStatus.REVIEWED_REQ_SPECS.getKey(),
ProductReqStatus.COMPLETED_REQ_SPECS.getKey(),
ProductReqStatus.CHANGING_REQ_SPECS.getKey())
.collect(Collectors.toList());
}
/**
* 获取 用户需求状态list
* @return 用户需求状态list
@ -298,9 +317,11 @@ public class PmsDashboardController extends BaseController {
resVo.setRatio(0);
//计算 各自的比率
int sum = statusStatVos.stream().mapToInt(ReqStatusStatVo::getNum).sum();
if (sum > 0){
Integer reviewedUserReqCount = status2NumMap.getOrDefault(productReqStatus.getName(), 0);
resVo.setRatio(reviewedUserReqCount/sum * 100);
if (sum > 0) {
Integer completedReqSpecsCount = status2NumMap.getOrDefault(productReqStatus.getKey(), 0);
double ratioDouble = (double) completedReqSpecsCount / sum * 100;
int ratio = (int) Math.round(ratioDouble);
resVo.setRatio(ratio);
}
return resVo;
}

View File

@ -11,4 +11,7 @@ public class MyDashboardVo extends IssueTypeTotalCountVo {
@ApiModelProperty(value = "产品需求数")
private int productRequirementCount;
@ApiModelProperty(value = "我负责的产品数")
private int assignedMeProductCount;
}

View File

@ -36,10 +36,10 @@ public class PmsDocumentUserFavoriteController extends BaseController
* 查询用户收藏文档列表
*/
@GetMapping("/list")
public GenericsTableDataInfo<PmsDocumentVo> list(PmsDocumentFavoriteSearchVo pmsDocumentFavoriteSearchVo)
public GenericsTableDataInfo<PmsDocumentVo> list(@PathVariable String enterpriseIdentifier, PmsDocumentFavoriteSearchVo pmsDocumentFavoriteSearchVo)
{
return pmsDocumentUserFavoriteService.selectPmsDocumentUserFavoriteList(pmsDocumentFavoriteSearchVo);
return pmsDocumentUserFavoriteService.selectPmsDocumentUserFavoriteList(enterpriseIdentifier, pmsDocumentFavoriteSearchVo);
}
/**

View File

@ -1,5 +1,6 @@
package com.microservices.pms.document.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.microservices.common.core.annotation.Excel;
import com.microservices.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -56,6 +57,7 @@ public class PmsDocument extends BaseEntity
/** 权限 1-私有 2-全员读 3-全员读写 */
@Excel(name = "权限 1-私有 2-全员读 3-全员读写")
@JsonIgnore
private Integer permission;
public void setId(Long id)

View File

@ -60,7 +60,7 @@ public class PmsDocumentDetailVo
private Integer isTop;
/** 权限 1-私有 2-全员读 3-全员读写 */
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写")
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", hidden = true)
private Integer permission;
@ApiModelProperty(value = "文档创建者")

View File

@ -30,4 +30,8 @@ public class PmsDocumentFavoriteSearchVo extends BaseEntity
@JsonIgnore
@ApiModelProperty(value = "用户id", hidden = true)
private Long currentUserId;
@JsonIgnore
@ApiModelProperty(value = "企业id", hidden = true)
private Long pmsEnterpriseId;
}

View File

@ -60,9 +60,8 @@ public class PmsDocumentInputVo
private Integer isTop;
/** 权限 1-私有 2-全员读 3-全员读写 */
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", required = true)
@NotNull
private Integer permission;
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", hidden = true)
private Integer permission = 3;
public PmsDocument toPmsDocument() {
PmsDocument pmsDocument = new PmsDocument();

View File

@ -47,8 +47,8 @@ public class PmsDocumentUpdateVo
private Integer isTop;
/** 权限 1-私有 2-全员读 3-全员读写 */
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写")
private Integer permission;
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", hidden = true)
private Integer permission = 3;
public PmsDocument toPmsDocument() {
PmsDocument pmsDocument = new PmsDocument();

View File

@ -55,7 +55,7 @@ public class PmsDocumentVo
private Integer isTop;
/** 权限 1-私有 2-全员读 3-全员读写 */
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写")
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", hidden = true)
private Integer permission;
@ApiModelProperty(value = "文档创建者")

View File

@ -45,7 +45,6 @@ public class PmsFileTypeDocumentInputVo
private String[] attachmentIdentifiers;
/** 权限 1-私有 2-全员读 3-全员读写 */
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", required = true)
@NotNull
private Integer permission;
@ApiModelProperty(value = "权限 1-私有 2-全员读 3-全员读写", hidden = true)
private Integer permission = 3;
}

View File

@ -79,7 +79,7 @@ public interface PmsDocumentMapper
int countChildDocByIds(@Param("ids") Long[] ids);
int countDocumentByNameAndTypeAndParenId(@Param("name") String name, @Param("docType") Integer docType, @Param("parenId") Long parenId, @Param("pmsProjectId") Long pmsProjectId);
int countDocumentByNameAndTypeAndParenId(@Param("name") String name, @Param("docType") Integer docType, @Param("parenId") Long parenId, @Param("pmsProjectId") Long pmsProjectId, @Param("pmsEnterpriseId") Long pmsEnterpriseId);
int deletePmsDocumentByIdWithoutAuthCheck(@Param("docId") Long docId);

View File

@ -29,5 +29,5 @@ public interface IPmsDocumentUserFavoriteService
*/
public int deletePmsDocumentUserFavoriteByDocId(Long documentId);
GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentUserFavoriteList(PmsDocumentFavoriteSearchVo pmsDocumentFavoriteSearchVo);
GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentUserFavoriteList(String enterpriseIdentifier, PmsDocumentFavoriteSearchVo pmsDocumentFavoriteSearchVo);
}

View File

@ -150,7 +150,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
checkPmsProjectById(pmsDocument.getPmsProjectId());
checkAuthAndReturnAdminStatus(pmsDocument.getPmsEnterpriseId());
String currentUserName = SecurityUtils.getUsername();
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId());
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId(), pmsDocument.getPmsEnterpriseId());
pmsDocument.setCreateTime(DateUtils.getNowDate());
pmsDocument.setCreateBy(currentUserName);
return pmsDocumentMapper.insertPmsDocument(pmsDocument);
@ -311,7 +311,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
pmsDocument.setCreateTime(DateUtils.getNowDate());
pmsDocument.setUpdateTime(DateUtils.getNowDate());
pmsDocument.setCreateBy(currentUserName);
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId());
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId(), pmsDocument.getPmsEnterpriseId());
pmsDocumentList.add(pmsDocument);
}
return pmsDocumentMapper.batchInsertPmsDocument(pmsDocumentList);
@ -324,8 +324,8 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
}
}
private void checkForSameDocumentExistence(String name, Integer docType, Long parentId, Long pmsProjectId) {
if (pmsDocumentMapper.countDocumentByNameAndTypeAndParenId(name, docType, parentId, pmsProjectId) > 0) {
private void checkForSameDocumentExistence(String name, Integer docType, Long parentId, Long pmsProjectId, Long pmsEnterpriseId) {
if (pmsDocumentMapper.countDocumentByNameAndTypeAndParenId(name, docType, parentId, pmsProjectId, pmsEnterpriseId) > 0) {
throw new ServiceException("当前目录已存在同名文档:[%s]", name);
}
}

View File

@ -11,6 +11,8 @@ import com.microservices.pms.document.domain.vo.PmsDocumentVo;
import com.microservices.pms.document.mapper.PmsDocumentMapper;
import com.microservices.pms.document.mapper.PmsDocumentUserFavoriteMapper;
import com.microservices.pms.document.service.IPmsDocumentUserFavoriteService;
import com.microservices.pms.enterprise.service.IPmsEnterpriseService;
import com.microservices.pms.enterprise.service.impl.PmsEnterpriseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,6 +38,9 @@ public class PmsDocumentUserFavoriteServiceImpl implements IPmsDocumentUserFavor
@Autowired
private PmsDocumentServiceImpl pmsDocumentService;
@Autowired
private IPmsEnterpriseService pmsEnterpriseService;
/**
* 新增用户收藏文档
*
@ -67,8 +72,9 @@ public class PmsDocumentUserFavoriteServiceImpl implements IPmsDocumentUserFavor
}
@Override
public GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentUserFavoriteList(PmsDocumentFavoriteSearchVo pmsDocumentFavoriteSearchVo) {
public GenericsTableDataInfo<PmsDocumentVo> selectPmsDocumentUserFavoriteList(String enterpriseIdentifier, PmsDocumentFavoriteSearchVo pmsDocumentFavoriteSearchVo) {
pmsDocumentFavoriteSearchVo.setCurrentUserId(SecurityUtils.getUserId());
pmsDocumentFavoriteSearchVo.setPmsEnterpriseId(pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier).getId());
List<PmsDocument> pmsDocumentList = pmsDocumentMapper.selectPmsFavoriteDocumentList(pmsDocumentFavoriteSearchVo);
return toPage(pmsDocumentList,pmsDocumentService::buildPmsDocumentVo);
}

View File

@ -46,6 +46,26 @@ public class PmsCiPipelinesController extends BaseController {
return pmsCiPipelinesService.selectPmsCiPipelinesList(enterpriseIdentifier, pipelineName, pipelineType);
}
/**
* 查询流水线卡片列表
*/
// @RequiresPermissions("pms:pipelines:list")
@GetMapping("/cardList")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "当前记录起始索引", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "orderByColumn", value = "排序列更新时间updateTime创建时间createTime", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
})
@ApiOperation("流水线卡片列表")
public GenericsTableDataInfo<PmsCiPipelinesCardVo> cardList(@ApiParam(name = "enterpriseIdentifier", value = "企业标识") @PathVariable String enterpriseIdentifier,
@ApiParam("流水线名称搜索") @RequestParam(required = false) String pipelineName,
@ApiParam("流水线构建类型 1-声明式流水线 2-图形化流水线") @RequestParam(required = false) Integer pipelineType)
{
return pmsCiPipelinesService.selectPmsCiPipelinesCardList(enterpriseIdentifier, pipelineName, pipelineType);
}
/**
* 获取流水线详细信息
*/

View File

@ -0,0 +1,53 @@
package com.microservices.pms.pipeline.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 流水线卡片执行详情对象
*
* @author xxq
* @date 2025-01-23
*/
@Data
@ApiModel("流水线卡片执行详情对象")
public class PmsCiPipelinesCardRunVo {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "总执行数量")
private Long total;
@ApiModelProperty(value = "成功执行数量")
private Long success;
@ApiModelProperty(value = "失败执行数量")
private Long failure;
@ApiModelProperty(value = "是否定时任务")
private Boolean schedule;
@ApiModelProperty(value = "执行状态")
private Long status;
@ApiModelProperty(value = "开始时间")
private Long started;
@ApiModelProperty(value = "结束时间")
private Long stopped;
@ApiModelProperty(value = "执行时长")
private Long length;
@ApiModelProperty(value = "创建时间")
private Long created;
@ApiModelProperty(value = "更新时间")
private Long updated;
}

View File

@ -0,0 +1,43 @@
package com.microservices.pms.pipeline.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 流水线卡片详情对象 pms_ci_pipelines
*
* @author xxq
* @date 2025-01-23
*/
@Data
@ApiModel("流水线卡片详情对象")
public class PmsCiPipelinesCardVo {
private Long id;
/**
* 仓库owner
*/
@ApiModelProperty(value = "仓库owner")
private String owner;
/**
* 仓库标识
*/
@ApiModelProperty(value = "仓库标识")
private String repoIdentifier;
@ApiModelProperty(value = "仓库名")
private String repoName;
@ApiModelProperty(value = "url")
private String url;
@ApiModelProperty(value = "流水线列表")
private List<PmsCiPipelinesDetailVo> pipelinesList;
}

View File

@ -77,4 +77,6 @@ public class PmsCiPipelinesDetailVo
@ApiModelProperty(value = "流水线模板JSON")
private JSONObject pipelineTemplateJson;
@ApiModelProperty(value = "流水线执行详情")
private PmsCiPipelinesCardRunVo pmsCiPipelinesCardRunVo;
}

View File

@ -30,6 +30,7 @@ public interface PmsCiPipelinesMapper
* @return 流水线集合
*/
public List<PmsCiPipelines> selectPmsCiPipelinesList(PmsCiPipelines pmsCiPipelines);
public List<PmsCiPipelines> selectPmsCiPipelinesCardList(PmsCiPipelines pmsCiPipelines);
/**
* 新增流水线

View File

@ -32,6 +32,7 @@ public interface IPmsCiPipelinesService
* @return 流水线集合
*/
public GenericsTableDataInfo<PmsCiPipelinesDetailVo> selectPmsCiPipelinesList(String enterpriseIdentifier, String pipelineName, Integer pipelineType);
public GenericsTableDataInfo<PmsCiPipelinesCardVo> selectPmsCiPipelinesCardList(String enterpriseIdentifier, String pipelineName, Integer pipelineType);
/**
* 新增流水线

View File

@ -7,6 +7,7 @@ import com.microservices.common.core.exception.ServiceException;
import com.microservices.common.core.utils.DateUtils;
import com.microservices.common.core.utils.StringUtils;
import com.microservices.common.core.utils.YamlValidatorUtils;
import com.microservices.common.core.utils.html.EscapeUtil;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.httpClient.domain.EntryDto;
import com.microservices.common.httpClient.domain.FileEntryDto;
@ -33,6 +34,12 @@ import javax.servlet.http.HttpServletResponse;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.List;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import static com.microservices.common.core.utils.JSONUtils.convertObjectToJSONObject;
import static com.microservices.common.core.utils.PageUtils.startPage;
@ -103,6 +110,28 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService {
return toPage(pipelinesList, this::buildPmsCiPipelinesDetailVo);
}
/**
* 查询流水线卡片列表
*
* @param enterpriseIdentifier 企业标识
* @param pipelineName 流水线名
* @param pipelineType
* @return 流水线
*/
@Override
public GenericsTableDataInfo<PmsCiPipelinesCardVo> selectPmsCiPipelinesCardList(String enterpriseIdentifier, String pipelineName, Integer pipelineType) {
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
PmsCiPipelines pmsCiPipelines = new PmsCiPipelines();
pmsCiPipelines.setPipelineName(pipelineName);
pmsCiPipelines.setPmsEnterpriseId(pmsEnterprise.getId());
pmsCiPipelines.setPipelineType(pipelineType);
startPage();
List<PmsCiPipelines> pipelinesList = pmsCiPipelinesMapper.selectPmsCiPipelinesCardList(pmsCiPipelines);
String workflows = pipelinesList.size() == 0 ? "" : Optional.ofNullable(pipelinesList).orElse(Collections.emptyList()).stream().map(PmsCiPipelines::getFileName).collect(Collectors.joining(","));
List<PmsCiPipelinesCardRunVo> result = pipelinesList.size() == 0 ? Collections.emptyList() : gitLinkRequestHelper.doGetToObjectList(PmsGitLinkRequestUrl.GET_ACTION_RUN_DATA(pipelinesList.get(0).getOwner(), workflows), PmsCiPipelinesCardRunVo.class);
return toPage(pipelinesList, x -> this.buildPmsCiPipelinesCardDetailVo(x, result));
}
private PmsCiPipelinesDetailVo buildPmsCiPipelinesDetailVo(PmsCiPipelines pmsCiPipelines) {
PmsCiPipelinesDetailVo pmsCiPipelinesDetailVo = new PmsCiPipelinesDetailVo();
BeanUtils.copyProperties(pmsCiPipelines, pmsCiPipelinesDetailVo);
@ -110,6 +139,20 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService {
return pmsCiPipelinesDetailVo;
}
private PmsCiPipelinesCardVo buildPmsCiPipelinesCardDetailVo(PmsCiPipelines pmsCiPipelines, List<PmsCiPipelinesCardRunVo> result) {
PmsCiPipelinesCardVo pmsCiPipelinesCardVo = new PmsCiPipelinesCardVo();
BeanUtils.copyProperties(pmsCiPipelines, pmsCiPipelinesCardVo);
pmsCiPipelinesCardVo.setUrl(EscapeUtil.removeExtraSlashOfUrl(gitLinkRequestHelper.gitLinkUrl + "/" + pmsCiPipelines.getOwner() + "/" + pmsCiPipelines.getRepoIdentifier()));
PmsCiPipelines queryCiPipelines = new PmsCiPipelines();
queryCiPipelines.setRepoIdentifier(pmsCiPipelines.getRepoIdentifier());
queryCiPipelines.setOwner(pmsCiPipelines.getOwner());
queryCiPipelines.setPmsEnterpriseId(pmsCiPipelines.getPmsEnterpriseId());
List<PmsCiPipelines> pipelinesList = pmsCiPipelinesMapper.selectPmsCiPipelinesList(queryCiPipelines);
pmsCiPipelinesCardVo.setPipelinesList(Optional.ofNullable(pipelinesList).orElse(Collections.emptyList()).stream().map(this::buildPmsCiPipelinesDetailVo).collect(Collectors.toList()));
pmsCiPipelinesCardVo.getPipelinesList().forEach(x -> x.setPmsCiPipelinesCardRunVo(result.stream().filter(a -> a.getName().equals(x.getFileName())).findFirst().orElse(null)));
return pmsCiPipelinesCardVo;
}
/**
* 新增流水线
*

View File

@ -11,5 +11,5 @@ public class PmsRequirementStatResVo {
private List<ReqStatusStatVo> pmsProductStatVos;
@ApiModelProperty(value = "统计的比率")
private Integer ratio;
private Integer ratio=0;
}

View File

@ -11,5 +11,5 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class ReqStatusStatVo extends EnumCommonVo {
private Integer num;
private Integer num=0;
}

View File

@ -399,4 +399,45 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
public static GitLinkRequestUrl GET_PIPELINE_RUN_RESULTS(String owner, String repoIdentifier, String run){
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/pipelines/run_results.json?run_id=%s", owner, repoIdentifier, run));
}
public static GitLinkRequestUrl GET_ACTION_NODES(String keyword, Integer pageNum, Integer pageSize) {
String path = String.format("/api/action/nodes.json?search=%s", keyword);
if (pageNum != null && pageSize != null) {
path = path + String.format("&page=%s&limit=%s", pageNum, pageSize);
}
return getGitLinkRequestUrl(path);
}
public static GitLinkRequestUrl CREATE_ACTION_NODE(Long actionNodeId) {
return getGitLinkRequestUrl(String.format("/api/action/nodes/%s", actionNodeId));
}
public static GitLinkRequestUrl GET_ACTION_NODE_TYPES(String keyword, Integer pageNum, Integer pageSize){
String path = String.format("/api/action/nodes.json?search=%s", keyword);
if (pageNum != null && pageSize != null) {
path = path + String.format("&page=%s&limit=%s", pageNum, pageSize);
}
return getGitLinkRequestUrl(path);
}
public static GitLinkRequestUrl CREATE_ACTION_NODE_TYPE(Long actionNodeTypeId) {
return getGitLinkRequestUrl(String.format("/api/action/node_types/%s", actionNodeTypeId));
}
public static GitLinkRequestUrl GET_ACTION_TEMPLATES(String keyword, Integer pageNum, Integer pageSize){
String path = String.format("/api/action/templates.json?search=%s", keyword);
if (pageNum != null && pageSize != null) {
path = path + String.format("&page=%s&limit=%s", pageNum, pageSize);
}
return getGitLinkRequestUrl(path);
}
public static GitLinkRequestUrl CREATE_ACTION_TEMPLATE(Long actionTemplateId) {
return getGitLinkRequestUrl(String.format("/api/action/action_templates/%s", actionTemplateId));
}
public static GitLinkRequestUrl GET_ACTION_RUN_DATA(String owner, String workflows) {
return getGitLinkRequestUrl(String.format("/api/pm/action_runs?owner_id=%s&workflows=%s", owner, workflows), "data");
}
}

View File

@ -55,6 +55,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
</where>
</select>
<select id="selectPmsCiPipelinesCardList" parameterType="PmsCiPipelines" resultMap="PmsCiPipelinesResult">
select owner,repo_identifier,repo_name,pms_enterprise_id, GROUP_CONCAT(file_name) file_name, max(update_time) as update_time from pms_ci_pipelines
<where>
<if test="pipelineName != null and pipelineName != ''"> and pipeline_name like concat('%', #{pipelineName}, '%')</if>
<if test="pipelineStatus != null and pipelineStatus != ''"> and pipeline_status = #{pipelineStatus}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="login != null and login != ''"> and login = #{login}</if>
<if test="sync != null "> and sync = #{sync}</if>
<if test="repoName != null and repoName != ''"> and repo_name = #{repoName}</if>
<if test="repoIdentifier != null and repoIdentifier != ''"> and repo_identifier = #{repoIdentifier}</if>
<if test="branch != null and branch != ''"> and branch = #{branch}</if>
<if test="pipelineType != null"> and pipeline_type = #{pipelineType}</if>
<if test="event != null and event != ''"> and event = #{event}</if>
<if test="sha != null and sha != ''"> and sha = #{sha}</if>
<if test="owner != null and owner != ''"> and owner = #{owner}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="pmsEnterpriseId != null "> and pms_enterprise_id = #{pmsEnterpriseId}</if>
<if test="pmsProjectId != null "> and pms_project_id = #{pmsProjectId}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
GROUP BY owner,repo_identifier,repo_name
</select>
<select id="selectPmsCiPipelinesById" parameterType="Long" resultMap="PmsCiPipelinesResult">
<include refid="selectPmsCiPipelinesVo"/>

View File

@ -95,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join pms_document_user_favorite as pduf on pduf.pms_document_id = pd.id
<where>
pduf.user_id = #{currentUserId}
and pd.pms_enterprise_id = #{pmsEnterpriseId}
<if test="name != null and name != ''"> and pd.name like concat('%', #{name}, '%')</if>
<if test="docType != null "> and pd.doc_type = #{docType}</if>
${params.dataScope}
@ -216,6 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where `name` = #{name}
and doc_type = #{docType}
and pms_project_id = #{pmsProjectId}
and pms_enterprise_id = #{pmsEnterpriseId}
<if test="docType != 4">
and parent_id = #{parenId}
</if>