forked from Gitlink/microservices
Merge pull request '完善产品中的需求规格功能开发' (#746) from otto/microservices:product_refact into product_refact
This commit is contained in:
commit
83e86c89ad
|
|
@ -1,10 +1,14 @@
|
|||
package com.microservices.pms.product.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
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.product.service.IPmsProductRequirementService;
|
||||
import com.microservices.pms.project.service.IPmsProjectTestcaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
|
@ -16,8 +20,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品需求规格相关接口
|
||||
*
|
||||
|
|
@ -35,6 +37,8 @@ public class ProductReqTrackingController extends BaseController {
|
|||
private IPmsProductReqOperationRecordService pmsProductReqOperationRecordService;
|
||||
@Autowired
|
||||
private IPmsProjectTestcaseService pmsProjectTestcaseService;
|
||||
@Autowired
|
||||
private IPmsProductRequirementService pmsProductRequirementService;
|
||||
|
||||
/**
|
||||
* 查询用户需求变更记录
|
||||
|
|
@ -42,9 +46,9 @@ public class ProductReqTrackingController extends BaseController {
|
|||
@ApiOperation(value = "查询用户需求变更记录")
|
||||
@RequiresPermissions("pms:pmsProduct:show")
|
||||
@GetMapping("/{userReqId}/userReqChangeRecord")
|
||||
public List<ProductReqOperationRecordDataVo> getUserReqChangeRecordList(
|
||||
public GenericsTableDataInfo<ProductReqOperationRecordDataVo> getUserReqChangeRecordList(
|
||||
@PathVariable("userReqId") Long userReqId) {
|
||||
return pmsProductReqOperationRecordService.selectUserReqChangeRecordList(userReqId);
|
||||
return getGenericsDataTable(pmsProductReqOperationRecordService.selectUserReqChangeRecordList(userReqId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,19 +57,24 @@ public class ProductReqTrackingController extends BaseController {
|
|||
@ApiOperation(value = "查询需求规格变更记录")
|
||||
@RequiresPermissions("pms:pmsProduct:show")
|
||||
@GetMapping("/{reqSpecsId}/reqSpecsChangeRecord")
|
||||
public List<ProductReqOperationRecordDataVo> getReqSpecsChangeRecordList(
|
||||
public GenericsTableDataInfo<ProductReqOperationRecordDataVo> getReqSpecsChangeRecordList(
|
||||
@PathVariable("reqSpecsId") Long reqSpecsId) {
|
||||
return pmsProductReqOperationRecordService.selectReqSpecsChangeRecordList(reqSpecsId);
|
||||
return getGenericsDataTable(pmsProductReqOperationRecordService.selectReqSpecsChangeRecordList(reqSpecsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户需求变更记录
|
||||
*/
|
||||
@ApiOperation(value = "查询关联的测试用例")
|
||||
@ApiOperation(value = "查询需求规格关联的测试用例")
|
||||
@RequiresPermissions("pms:pmsProduct:show")
|
||||
@GetMapping("/{reqSpecsId}/associatedTestcase")
|
||||
public List<ProductReqSpecsAssociatedTestcaseDataVo> getReqSpecsAssociatedTestcaseList(
|
||||
public GenericsTableDataInfo<ProductReqSpecsAssociatedTestcaseDataVo> getReqSpecsAssociatedTestcaseList(
|
||||
@PathVariable("reqSpecsId") Long reqSpecsId) {
|
||||
return pmsProjectTestcaseService.selectReqSpecsAssociatedTestcaseList(reqSpecsId);
|
||||
return getGenericsDataTable(pmsProjectTestcaseService.selectReqSpecsAssociatedTestcaseList(reqSpecsId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询需求规格关联的计划")
|
||||
@RequiresPermissions("pms:pmsProduct:show")
|
||||
@GetMapping("/{reqSpecsId}/associatedPlan")
|
||||
public GenericsAjaxResult<JSONObject> getReqSpecsAssociatedPlanData(
|
||||
@PathVariable("reqSpecsId") Long reqSpecsId) {
|
||||
return GenericsAjaxResult.success(pmsProductRequirementService.selectReqSpecsAssociatedPlanData(reqSpecsId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.microservices.pms.product.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.pms.product.domain.PmsProductRequirement;
|
||||
import com.microservices.pms.product.domain.vo.*;
|
||||
|
|
@ -122,4 +123,6 @@ public interface IPmsProductRequirementService
|
|||
List<ReqStatusCommonVo> selectReqSpecsStatusList();
|
||||
|
||||
List<EnumCommonVo> selectReqSpecsTypeList();
|
||||
|
||||
JSONObject selectReqSpecsAssociatedPlanData(Long reqSpecsId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.microservices.common.core.utils.PageUtils;
|
|||
import com.microservices.common.core.utils.PinYinStringUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.pms.common.service.IPmsCommonService;
|
||||
import com.microservices.pms.enterprise.domain.PmsEnterprise;
|
||||
|
|
@ -25,6 +26,7 @@ import com.microservices.pms.project.domain.vo.PmsProjectIssuesInputVo;
|
|||
import com.microservices.pms.project.service.IPmsProjectService;
|
||||
import com.microservices.pms.project.service.PmsProjectIssuesService;
|
||||
import com.microservices.pms.utils.PmsConstants;
|
||||
import com.microservices.pms.utils.PmsGitLinkRequestUrl;
|
||||
import com.microservices.pms.utils.PmsUtils;
|
||||
import com.microservices.system.api.RemoteFileService;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
|
|
@ -74,6 +76,8 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
private IPmsJournalsService pmsJournalsService;
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
@Autowired
|
||||
private GitLinkRequestHelper gitLinkRequestHelper;
|
||||
|
||||
@Override
|
||||
public PmsProductRequirement selectPmsProductRequirementById(Long id, boolean checkRole) {
|
||||
|
|
@ -255,8 +259,9 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
PmsProductRequirement oldPmsProductRequirement = selectPmsProductRequirementById(id, true);
|
||||
|
||||
if (!ProductReqStatus.PENDING_REVIEW_REQ_SPECS.getKey().equals(oldPmsProductRequirement.getStatus()) &&
|
||||
!ProductReqStatus.CHANGING_REQ_SPECS.getKey().equals(oldPmsProductRequirement.getStatus())) {
|
||||
throw new ServiceException("只有待审核和变更中状态的需求规格才能被删除");
|
||||
!ProductReqStatus.CHANGING_REQ_SPECS.getKey().equals(oldPmsProductRequirement.getStatus()) &&
|
||||
!ProductReqStatus.REJECTED_REQ_SPECS.getKey().equals(oldPmsProductRequirement.getStatus())) {
|
||||
throw new ServiceException("只有待审核、变更中和已拒绝状态的需求规格才能被删除");
|
||||
}
|
||||
if (ProductReqStatus.CHANGING_REQ_SPECS.getKey().equals(oldPmsProductRequirement.getStatus())) {
|
||||
// 变更中需求规格被删除时需将原需求还原状态
|
||||
|
|
@ -528,7 +533,7 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
JSONObject projectIssue = pmsProjectIssuesService.insertPmsProjectIssues(pmsProjectIssuesInputVo);
|
||||
reqSpecs.setPmsProjectId(project.getId());
|
||||
reqSpecs.setProjectReqId(projectIssue.getLong("id"));
|
||||
reqSpecs.setStatus(ProductReqStatus.PLANNED_REQ_SPECS_CHANGING.getKey());
|
||||
reqSpecs.setStatus(ProductReqStatus.PLANNED_REQ_SPECS.getKey());
|
||||
int success = updateRequirement(reqSpecs, reqSpecs.getPmsProductIdentifier());
|
||||
pmsProductReqOperationRecordService.insertPmsProductReqOperationRecord(
|
||||
productReqSpecsActivePlanVo.toPmsProductReqOperationRecord(reqSpecs)
|
||||
|
|
@ -551,6 +556,17 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
return ProductReqSpecsType.getReqSpecsTypeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject selectReqSpecsAssociatedPlanData(Long reqSpecsId) {
|
||||
PmsProductRequirement reqSpecs = selectPmsProductRequirementById(reqSpecsId, true);
|
||||
if (reqSpecs.getPmsProjectId() == null) {
|
||||
return null;
|
||||
}
|
||||
return gitLinkRequestHelper.doGet(
|
||||
PmsGitLinkRequestUrl.GET_REQ_SPECS_LINK_ISSUES(reqSpecs.getProjectReqId(), reqSpecs.getPmsProjectId())
|
||||
);
|
||||
}
|
||||
|
||||
private ProductReqSpecsDetailVo toProductReqSpecsDetailVo(PmsProductRequirement pmsProductRequirement) {
|
||||
ProductReqSpecsDataVo productReqSpecsDataVo = toProductReqSpecsDataVo(pmsProductRequirement, null);
|
||||
ProductReqSpecsDetailVo productReqSpecsDetailVo = productReqSpecsDataVo.toProductReqSpecsDetailVo();
|
||||
|
|
|
|||
|
|
@ -362,4 +362,8 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
public static GitLinkRequestUrl SAVE_PIPELINE_YAML(String owner, String repoIdentifier) {
|
||||
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/pipelines/save_yaml", owner, repoIdentifier));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_REQ_SPECS_LINK_ISSUES(Long reqSpecsIssueId, Long projectId) {
|
||||
return getGitLinkRequestUrl(String.format("/api/pm/issues/%d/link_issues?pm_project_id=%d", reqSpecsIssueId, projectId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue