feat(项目管理产品需求重构): 完善产品中的用户需求功能开发

新增用户需求和需求规格状态获取接口

Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
OTTO 2024-12-04 16:03:48 +08:00
parent 33a7f4c069
commit e2dfb6a5d7
9 changed files with 102 additions and 40 deletions

View File

@ -17,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 产品需求规格相关接口
*
@ -120,4 +122,14 @@ public class ProductReqSpecsController extends BaseController {
public AjaxResult activePlan(@RequestBody @Validated ProductReqSpecsActivePlanVo productReqSpecsActivePlanVo) {
return toAjax(pmsProductRequirementService.activePlan(productReqSpecsActivePlanVo));
}
/**
* 查询需求规格状态列表
*/
@ApiOperation(value = "查询需求规格状态列表")
@RequiresPermissions("pms:pmsProduct:show")
@GetMapping("/statusList")
public List<ReqStatusCommonVo> statusList() {
return pmsProductRequirementService.selectReqSpecsStatusList();
}
}

View File

@ -17,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 产品用户需求相关接口
*
@ -98,4 +100,14 @@ public class ProductUserReqController extends BaseController {
public AjaxResult review(@RequestBody @Validated ProductReqReviewVo productReqReviewVo) {
return toAjax(pmsProductRequirementService.reviewUserReq(productReqReviewVo));
}
/**
* 查询用户需求状态列表
*/
@ApiOperation(value = "查询用户需求状态列表")
@RequiresPermissions("pms:pmsProduct:show")
@GetMapping("/statusList")
public List<ReqStatusCommonVo> statusList() {
return pmsProductRequirementService.selectUserReqStatusList();
}
}

View File

@ -1,20 +0,0 @@
package com.microservices.pms.product.domain.enums;
import lombok.Data;
/**
* @author OTTO
*/
@Data
public class CommonEnumType {
private String key;
private String name;
public CommonEnumType() {
}
public CommonEnumType(String key, String name) {
this.key = key;
this.name = name;
}
}

View File

@ -1,8 +1,12 @@
package com.microservices.pms.product.domain.enums;
import com.microservices.common.core.exception.ServiceException;
import com.microservices.pms.product.domain.vo.ReqStatusCommonVo;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* 产品需求状态
*
@ -10,27 +14,29 @@ import lombok.Getter;
*/
@Getter
public enum ProductReqStatus {
PENDING_REVIEW_USER_REQ("pendingReviewUserReq", "待评审", "待评审的用户需求"),
REJECTED_USER_REQ("rejectedUserReq", "已拒绝", "已拒绝的用户需求"),
REVIEWED_USER_REQ("reviewedUserReq", "已评审", "已评审的用户需求"),
PENDING_REVIEW_REQ_SPECS("pendingReviewReqSpecs", "待评审", "待评审的需求规格"),
CHANGING_REQ_SPECS("changingReqSpecs", "变更中", "变更中的需求规格"),
CHANGED_REQ_SPECS("changedReqSpecs", "已变更", "已变更的需求规格"),
REJECTED_CHANGE_REQ_SPECS("rejectedChangeReqSpecs", "已拒绝变更", "已拒绝变更的需求规格"),
REVIEWED_REQ_SPECS_CHANGING("reviewedReqSpecsChanging", "已评审(变更中)", "已评审的需求规格(变更中)"),
PLANNED_REQ_SPECS_CHANGING("plannedReqSpecsChanging", "计划中(变更中)", "计划中的需求规格(变更中)"),
PLANNED_REQ_SPECS("plannedReqSpecs", "计划中", "计划中的需求规格"),
REJECTED_REQ_SPECS("rejectedReqSpecs", "已拒绝", "已拒绝的需求规格"),
REVIEWED_REQ_SPECS("reviewedReqSpecs", "已评审", "已评审的需求规格"),
COMPLETED_REQ_SPECS("completedReqSpecs", "已完成", "已完成的需求规格");
PENDING_REVIEW_USER_REQ("pendingReviewUserReq", "待评审", "待评审的用户需求", "#FF6F00"),
REJECTED_USER_REQ("rejectedUserReq", "未通过", "已拒绝的用户需求", "#FF0000"),
REVIEWED_USER_REQ("reviewedUserReq", "已评审", "已评审的用户需求", "#13B33E"),
PENDING_REVIEW_REQ_SPECS("pendingReviewReqSpecs", "待评审", "待评审的需求规格", "#FF6F00"),
CHANGING_REQ_SPECS("changingReqSpecs", "变更中", "变更中的需求规格", "#FF0000"),
CHANGED_REQ_SPECS("changedReqSpecs", "已变更", "已变更的需求规格", null),
REJECTED_CHANGE_REQ_SPECS("rejectedChangeReqSpecs", "已拒绝变更", "已拒绝变更的需求规格", null),
REVIEWED_REQ_SPECS_CHANGING("reviewedReqSpecsChanging", "已评审(变更中)", "已评审的需求规格(变更中)", null),
PLANNED_REQ_SPECS_CHANGING("plannedReqSpecsChanging", "计划中(变更中)", "计划中的需求规格(变更中)", null),
PLANNED_REQ_SPECS("plannedReqSpecs", "计划中", "计划中的需求规格", "#0D5EF8"),
REJECTED_REQ_SPECS("rejectedReqSpecs", "已拒绝", "已拒绝的需求规格", "#B1AAA5"),
REVIEWED_REQ_SPECS("reviewedReqSpecs", "已评审", "已评审的需求规格", "#13B33E"),
COMPLETED_REQ_SPECS("completedReqSpecs", "已完成", "已完成的需求规格", "#13B33E");
private final String key;
private final String name;
private final String remark;
private final String color;
ProductReqStatus(String key, String name, String remark) {
ProductReqStatus(String key, String name, String remark, String color) {
this.key = key;
this.name = name;
this.remark = remark;
this.color = color;
}
public static ProductReqStatus getByKey(String key) {
@ -42,10 +48,10 @@ public enum ProductReqStatus {
throw new ServiceException("需求状态错误(需求状态[%s])", key);
}
public static CommonEnumType getTypeByKey(String status) {
public static ReqStatusCommonVo getTypeByKey(String status) {
for (ProductReqStatus productReqStatus : ProductReqStatus.values()) {
if (productReqStatus.getKey().equals(status)) {
return new CommonEnumType(productReqStatus.getKey(), productReqStatus.getName());
return new ReqStatusCommonVo(productReqStatus);
}
}
return null;
@ -80,4 +86,24 @@ public enum ProductReqStatus {
|| REJECTED_USER_REQ.getKey().equals(key)
|| REVIEWED_USER_REQ.getKey().equals(key);
}
public static List<ReqStatusCommonVo> getUserReqStatusList() {
List<ReqStatusCommonVo> statusCommonVoList = new ArrayList<>();
for (ProductReqStatus productReqStatus : ProductReqStatus.values()) {
if (isUserReqStatus(productReqStatus.getKey()) && productReqStatus.getColor() != null) {
statusCommonVoList.add(new ReqStatusCommonVo(productReqStatus));
}
}
return statusCommonVoList;
}
public static List<ReqStatusCommonVo> getReqSpecsStatusList() {
List<ReqStatusCommonVo> statusCommonVoList = new ArrayList<>();
for (ProductReqStatus productReqStatus : ProductReqStatus.values()) {
if (!isUserReqStatus(productReqStatus.getKey()) && productReqStatus.getColor() != null) {
statusCommonVoList.add(new ReqStatusCommonVo(productReqStatus));
}
}
return statusCommonVoList;
}
}

View File

@ -3,7 +3,6 @@ package com.microservices.pms.product.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.pms.product.domain.PmsProductModule;
import com.microservices.pms.product.domain.enums.CommonEnumType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -28,7 +27,7 @@ public class ProductReqSpecsDataVo {
private String title;
@ApiModelProperty(value = "需求状态")
private CommonEnumType status;
private ReqStatusCommonVo status;
@ApiModelProperty(value = "产品需求类型")
private String type;

View File

@ -3,7 +3,6 @@ package com.microservices.pms.product.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.pms.product.domain.PmsProductModule;
import com.microservices.pms.product.domain.enums.CommonEnumType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -25,7 +24,7 @@ public class ProductUserReqDataVo {
private String title;
@ApiModelProperty(value = "需求状态")
private CommonEnumType status;
private ReqStatusCommonVo status;
@ApiModelProperty(value = "从属产品模块")
private PmsProductModule pmsProductModule;

View File

@ -0,0 +1,20 @@
package com.microservices.pms.product.domain.vo;
import com.microservices.pms.product.domain.enums.ProductReqStatus;
import lombok.Data;
/**
* @author OTTO
*/
@Data
public class ReqStatusCommonVo {
private String key;
private String name;
private String color;
public ReqStatusCommonVo(ProductReqStatus status) {
this.key = status.getKey();
this.name = status.getName();
this.color = status.getColor();
}
}

View File

@ -116,4 +116,8 @@ public interface IPmsProductRequirementService
int changeReqSpecs(ProductReqSpecsChangeVo productReqSpecsChangeVo);
int activePlan(ProductReqSpecsActivePlanVo productReqSpecsActivePlanVo);
List<ReqStatusCommonVo> selectUserReqStatusList();
List<ReqStatusCommonVo> selectReqSpecsStatusList();
}

View File

@ -534,6 +534,16 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
return success;
}
@Override
public List<ReqStatusCommonVo> selectUserReqStatusList() {
return ProductReqStatus.getUserReqStatusList();
}
@Override
public List<ReqStatusCommonVo> selectReqSpecsStatusList() {
return ProductReqStatus.getReqSpecsStatusList();
}
private ProductReqSpecsDetailVo toProductReqSpecsDetailVo(PmsProductRequirement pmsProductRequirement) {
ProductReqSpecsDataVo productReqSpecsDataVo = toProductReqSpecsDataVo(pmsProductRequirement, null);
ProductReqSpecsDetailVo productReqSpecsDetailVo = productReqSpecsDataVo.toProductReqSpecsDetailVo();