forked from Gitlink/microservices
feat(项目管理产品需求重构): 完善产品中的需求规格功能开发
新增需求规格关联测试用例及其执行结果查询 Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
parent
f3f051dc5b
commit
44069a7c55
|
|
@ -3,7 +3,9 @@ package com.microservices.pms.product.controller;
|
|||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.pms.product.domain.vo.ProductReqOperationRecordDataVo;
|
||||
import com.microservices.pms.product.domain.vo.ProductReqSpecsAssociatedTestcaseDataVo;
|
||||
import com.microservices.pms.product.service.IPmsProductReqOperationRecordService;
|
||||
import com.microservices.pms.project.service.IPmsProjectTestcaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -31,6 +33,8 @@ import java.util.List;
|
|||
public class ProductReqTrackingController extends BaseController {
|
||||
@Autowired
|
||||
private IPmsProductReqOperationRecordService pmsProductReqOperationRecordService;
|
||||
@Autowired
|
||||
private IPmsProjectTestcaseService pmsProjectTestcaseService;
|
||||
|
||||
/**
|
||||
* 查询用户需求变更记录
|
||||
|
|
@ -53,4 +57,15 @@ public class ProductReqTrackingController extends BaseController {
|
|||
@PathVariable("reqSpecsId") Long reqSpecsId) {
|
||||
return pmsProductReqOperationRecordService.selectReqSpecsChangeRecordList(reqSpecsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户需求变更记录
|
||||
*/
|
||||
@ApiOperation(value = "查询关联的测试用例")
|
||||
@RequiresPermissions("pms:pmsProduct:show")
|
||||
@GetMapping("/{reqSpecsId}/associatedTestcase")
|
||||
public List<ProductReqSpecsAssociatedTestcaseDataVo> getReqSpecsAssociatedTestcaseList(
|
||||
@PathVariable("reqSpecsId") Long reqSpecsId) {
|
||||
return pmsProjectTestcaseService.selectReqSpecsAssociatedTestcaseList(reqSpecsId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.microservices.pms.product.domain.vo;
|
||||
|
||||
import com.microservices.pms.enums.TestCaseStatus;
|
||||
import com.microservices.pms.project.domain.PmsProjectTestsheetCases;
|
||||
import com.microservices.system.api.domain.SimpleSysUser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品需求对象 pms_product_requirement
|
||||
*
|
||||
* @author otto
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("需求规格关联测试用例数据对象")
|
||||
public class ProductReqSpecsAssociatedTestcaseDataVo {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "用例维护人")
|
||||
private SimpleSysUser assigneeUser;
|
||||
|
||||
@ApiModelProperty(value = "执行次数")
|
||||
private Long executeCount;
|
||||
|
||||
@ApiModelProperty(value = "未执行次数")
|
||||
private Long unExecuteCount;
|
||||
|
||||
@ApiModelProperty(value = "通过次数")
|
||||
private Long executePassCount;
|
||||
|
||||
@ApiModelProperty(value = "跳过次数")
|
||||
private Long executeSkipCount;
|
||||
|
||||
@ApiModelProperty(value = "阻塞次数")
|
||||
private Long executeBlockCount;
|
||||
|
||||
@ApiModelProperty(value = "失败次数")
|
||||
private Long executeFailCount;
|
||||
|
||||
public void setCountData(List<PmsProjectTestsheetCases> testsheetCasesList) {
|
||||
this.setUnExecuteCount(testsheetCasesList.stream().filter(x -> TestCaseStatus.INIT.ordinal() == x.getTestStatus().intValue()).count());
|
||||
this.setExecutePassCount(testsheetCasesList.stream().filter(x -> TestCaseStatus.PASS.ordinal() == x.getTestStatus().intValue()).count());
|
||||
this.setExecuteFailCount(testsheetCasesList.stream().filter(x -> TestCaseStatus.FAIL.ordinal() == x.getTestStatus().intValue()).count());
|
||||
this.setExecuteBlockCount(testsheetCasesList.stream().filter(x -> TestCaseStatus.BLOCKING.ordinal() == x.getTestStatus().intValue()).count());
|
||||
this.setExecuteSkipCount(testsheetCasesList.stream().filter(x -> TestCaseStatus.SKIP.ordinal() == x.getTestStatus().intValue()).count());
|
||||
this.setExecuteCount((long) testsheetCasesList.size());
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.microservices.pms.project.service;
|
|||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.pms.product.domain.vo.ProductReqSpecsAssociatedTestcaseDataVo;
|
||||
import com.microservices.pms.project.domain.PmsProjectTestcase;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectTestcaseDataVo;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectTestcaseDetailVo;
|
||||
|
|
@ -113,4 +114,6 @@ public interface IPmsProjectTestcaseService {
|
|||
* @return 测试用例列表
|
||||
*/
|
||||
List<PmsProjectTestcase> selectPmsProjectTestcaseList(PmsProjectTestcase pmsProjectTestcaseSearch);
|
||||
|
||||
List<ProductReqSpecsAssociatedTestcaseDataVo> selectReqSpecsAssociatedTestcaseList(Long reqSpecsId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.microservices.common.core.exception.ServiceException;
|
|||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.JSONUtils;
|
||||
import com.microservices.common.core.utils.PageUtils;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.pms.common.service.IPmsCommonService;
|
||||
|
|
@ -13,13 +14,11 @@ import com.microservices.pms.enterprise.service.IPmsEnterpriseService;
|
|||
import com.microservices.pms.product.domain.PmsProductModule;
|
||||
import com.microservices.pms.product.domain.PmsProductRequirement;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqStatus;
|
||||
import com.microservices.pms.product.domain.vo.ProductReqSpecsAssociatedTestcaseDataVo;
|
||||
import com.microservices.pms.product.service.IPmsProductModuleService;
|
||||
import com.microservices.pms.product.service.IPmsProductRequirementService;
|
||||
import com.microservices.pms.product.service.IPmsProductRequirementTagService;
|
||||
import com.microservices.pms.project.domain.PmsProject;
|
||||
import com.microservices.pms.project.domain.PmsProjectTestcase;
|
||||
import com.microservices.pms.project.domain.PmsProjectTestcaseStep;
|
||||
import com.microservices.pms.project.domain.PmsProjectTestcaseType;
|
||||
import com.microservices.pms.project.domain.*;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectTestcaseBatchUpdateVo;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectTestcaseDataVo;
|
||||
import com.microservices.pms.project.domain.vo.PmsProjectTestcaseDetailVo;
|
||||
|
|
@ -35,6 +34,7 @@ import com.microservices.system.api.domain.SysUser;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -192,6 +192,34 @@ public class PmsProjectTestcaseServiceImpl implements IPmsProjectTestcaseService
|
|||
return pmsProjectTestcaseMapper.selectPmsProjectTestcaseList(pmsProjectTestcaseSearch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductReqSpecsAssociatedTestcaseDataVo> selectReqSpecsAssociatedTestcaseList(Long reqSpecsId) {
|
||||
List<ProductReqSpecsAssociatedTestcaseDataVo> reqSpecsTestcaseDataVoList = new ArrayList<>();
|
||||
PmsProductRequirement pmsProductRequirement = pmsProductRequirementService.selectPmsProductRequirementById(reqSpecsId, false);
|
||||
if (ProductReqStatus.isUserReqStatus(pmsProductRequirement.getStatus())) {
|
||||
throw new ServiceException("用户需求无法查询关联的测试用例");
|
||||
}
|
||||
PmsProjectTestcase testcaseSearch = new PmsProjectTestcase();
|
||||
testcaseSearch.setProductReqSpecsId(reqSpecsId);
|
||||
List<PmsProjectTestcase> reqSpecsTestcaseList = pmsProjectTestcaseMapper.selectPmsProjectTestcaseList(testcaseSearch);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
for (PmsProjectTestcase pmsProjectTestcase : reqSpecsTestcaseList) {
|
||||
ProductReqSpecsAssociatedTestcaseDataVo reqSpecsTestcaseDataVo = new ProductReqSpecsAssociatedTestcaseDataVo();
|
||||
BeanUtils.copyProperties(pmsProjectTestcase, reqSpecsTestcaseDataVo);
|
||||
reqSpecsTestcaseDataVo.setAssigneeUser(
|
||||
PmsUtils.getSelectObjectInCache(
|
||||
hashMap
|
||||
, pmsCommonService::getSimpleSysUserByGitlinkUserId
|
||||
, pmsProjectTestcase.getAssigneeGitlinkId()));
|
||||
PmsProjectTestsheetCases projectTestSheetCasesSearch = new PmsProjectTestsheetCases();
|
||||
projectTestSheetCasesSearch.setProjectTestcaseId(pmsProjectTestcase.getId());
|
||||
List<PmsProjectTestsheetCases> testsheetCasesList = pmsProjectTestsheetCasesMapper.selectPmsProjectTestsheetCasesList(projectTestSheetCasesSearch);
|
||||
reqSpecsTestcaseDataVo.setCountData(testsheetCasesList);
|
||||
reqSpecsTestcaseDataVoList.add(reqSpecsTestcaseDataVo);
|
||||
}
|
||||
return reqSpecsTestcaseDataVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增测试用例管理
|
||||
*
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@
|
|||
<if test="typeId != null ">and type_id = #{typeId}</if>
|
||||
<if test="tagId != null and tagId != ''">and FIND_IN_SET(#{tagId},tag_ids)</if>
|
||||
<if test="index != null ">and `index` = #{index}</if>
|
||||
<if test="productReqSpecsId != null ">and `product_req_specs_id` = #{productReqSpecsId}</if>
|
||||
<choose>
|
||||
<when test="childrenModuleIdList != null">
|
||||
<if test="childrenModuleIdList != null ">
|
||||
|
|
|
|||
Loading…
Reference in New Issue