feat(项目管理产品需求重构): 完善产品中的需求规格功能开发
完善需求规格更新接口:修改需求规格 Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
parent
882dd33346
commit
4d0c043197
|
|
@ -73,8 +73,8 @@ public class ProductReqSpecsController extends BaseController {
|
|||
@Log(title = "需求规格", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改需求规格")
|
||||
public AjaxResult edit(@RequestBody @Validated ProductUserReqUpdateVo productUserReqUpdateVo) {
|
||||
return toAjax(pmsProductRequirementService.updateUserReq(productUserReqUpdateVo));
|
||||
public AjaxResult edit(@RequestBody @Validated ProductReqSpecsUpdateVo productReqSpecsUpdateVo) {
|
||||
return toAjax(pmsProductRequirementService.updateReqSpecs(productReqSpecsUpdateVo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqStatus;
|
||||
import com.microservices.pms.product.domain.vo.PmsProductRequirementDataVo;
|
||||
import com.microservices.pms.product.domain.vo.ProductReqSpecsDataVo;
|
||||
import com.microservices.pms.product.domain.vo.ProductUserReqDataVo;
|
||||
|
|
@ -165,4 +166,13 @@ public class PmsProductRequirement extends BaseEntity
|
|||
BeanUtils.copyProperties(this, target);
|
||||
return target;
|
||||
}
|
||||
|
||||
public PmsProductRequirement toChangeReqSpecs() {
|
||||
PmsProductRequirement target = new PmsProductRequirement();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
target.setId(null);
|
||||
target.setFromId(this.id);
|
||||
target.setStatus(ProductReqStatus.CHANGING_REQ_SPECS.getKey());
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import lombok.Getter;
|
|||
*/
|
||||
@Getter
|
||||
public enum ProductContentModifyOperation {
|
||||
CHANGING_REQ("changingReq", "需求变更"),
|
||||
CREATE("create", "创建"),
|
||||
EDIT("edit", "编辑");
|
||||
private final String key;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.microservices.pms.product.domain.enums;
|
||||
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
|
|
@ -13,7 +14,9 @@ public enum ProductReqStatus {
|
|||
REJECTED_USER_REQ("rejectedUserReq", "已拒绝", "已拒绝的用户需求"),
|
||||
REVIEWED_USER_REQ("reviewedUserReq", "已评审", "已评审的用户需求"),
|
||||
PENDING_REVIEW_REQ_SPECS("pendingReviewReqSpecs", "待评审", "待评审的需求规格"),
|
||||
CHANGING_REQ_SPECS("changingReqSpecs", "变更中", "变更中的需求规格"),
|
||||
REVIEWED_REQ_SPECS_CHANGING("reviewedReqSpecsChanging", "已评审(变更中)", "已评审的需求规格(变更中)"),
|
||||
PLANNED_REQ_SPECS_CHANGING("plannedReqSpecsChanging", "计划中(变更中)", "计划中的需求规格(变更中)"),
|
||||
PLANNED_REQ_SPECS("plannedReqSpecs", "计划中", "计划中的需求规格"),
|
||||
REJECTED_REQ_SPECS("rejectedReqSpecs", "已拒绝", "已拒绝的需求规格"),
|
||||
REVIEWED_REQ_SPECS("reviewedReqSpecs", "已评审", "已评审的需求规格"),
|
||||
|
|
@ -34,7 +37,7 @@ public enum ProductReqStatus {
|
|||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new ServiceException("需求状态错误(需求状态[%s])", key);
|
||||
}
|
||||
|
||||
public static CommonEnumType getTypeByKey(String status) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.microservices.pms.product.domain.vo;
|
||||
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.pms.product.domain.PmsProductReqOperationRecord;
|
||||
import com.microservices.pms.product.domain.PmsProductRequirement;
|
||||
import com.microservices.pms.product.domain.enums.ProductContentModifyOperation;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqOperationType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 产品需求对象 pms_product_requirement
|
||||
*
|
||||
* @author otto
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("需求规格更新对象")
|
||||
public class ProductReqSpecsUpdateVo {
|
||||
@ApiModelProperty(value = "需求Id", required = true)
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
@Size(max = 50, message = "长度需要小于50")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "关联产品模块ID")
|
||||
private Long pmsProductModuleId;
|
||||
|
||||
@ApiModelProperty(value = "正文")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "附件标识列表")
|
||||
private String fileIdentifiers;
|
||||
|
||||
@ApiModelProperty(value = "产品需求类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "关联产品计划ID")
|
||||
private Long pmsProductPlanId;
|
||||
|
||||
public PmsProductRequirement toPmsProductRequirement() {
|
||||
PmsProductRequirement target = new PmsProductRequirement();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
return target;
|
||||
}
|
||||
|
||||
public PmsProductReqOperationRecord toPmsProductReqOperationRecord(PmsProductRequirement pmsProductRequirement) {
|
||||
PmsProductReqOperationRecord record = new PmsProductReqOperationRecord();
|
||||
record.setProductRequirementId(pmsProductRequirement.getId());
|
||||
record.setType(ProductReqOperationType.CONTENT_MODIFY.getKey());
|
||||
record.setOperation(ProductContentModifyOperation.EDIT.getKey());
|
||||
record.setOperator(pmsProductRequirement.getUpdateBy());
|
||||
record.setOperatingTime(pmsProductRequirement.getUpdateTime());
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
|
@ -154,4 +154,6 @@ public interface IPmsProductRequirementService
|
|||
ProductReqSpecsDetailVo selectReqSpecsDetailById(Long id);
|
||||
|
||||
Long insertReqSpecs(ProductReqSpecsInputVo productReqSpecsInputVo);
|
||||
|
||||
int updateReqSpecs(ProductReqSpecsUpdateVo productReqSpecsUpdateVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,8 @@ import com.microservices.pms.common.service.IPmsCommonService;
|
|||
import com.microservices.pms.enterprise.domain.PmsEnterprise;
|
||||
import com.microservices.pms.enterprise.service.IPmsEnterpriseService;
|
||||
import com.microservices.pms.journals.service.IPmsJournalsService;
|
||||
import com.microservices.pms.product.domain.PmsProduct;
|
||||
import com.microservices.pms.product.domain.PmsProductModule;
|
||||
import com.microservices.pms.product.domain.PmsProductPlan;
|
||||
import com.microservices.pms.product.domain.PmsProductRequirement;
|
||||
import com.microservices.pms.product.domain.*;
|
||||
import com.microservices.pms.product.domain.enums.ProductContentModifyOperation;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqReviewStatus;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqSpecsType;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqStatus;
|
||||
|
|
@ -121,12 +119,6 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
hashMap
|
||||
, pmsProductPriorityService::selectPmsProductPriorityById
|
||||
, pmsProductRequirement.getPriorityId()));
|
||||
// 设置状态
|
||||
pmsProductRequirementDataVo.setStatus(
|
||||
PmsUtils.getSelectObjectInCache(
|
||||
hashMap
|
||||
, ProductReqStatus::getByKey
|
||||
, pmsProductRequirement.getStatus()));
|
||||
// 设置产品模块
|
||||
if (pmsProductRequirement.getPmsProductModuleId() != null) {
|
||||
pmsProductRequirementDataVo.setPmsProductModule(
|
||||
|
|
@ -381,6 +373,52 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
return pmsProductRequirement.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateReqSpecs(ProductReqSpecsUpdateVo productReqSpecsUpdateVo) {
|
||||
// 通过id检查需修改的产品需求是否存在
|
||||
PmsProductRequirement oldPmsProductRequirement = selectPmsProductRequirementById(productReqSpecsUpdateVo.getId(), true);
|
||||
PmsProductRequirement pmsProductRequirement = productReqSpecsUpdateVo.toPmsProductRequirement();
|
||||
int success = 0;
|
||||
PmsProductReqOperationRecord pmsProductReqOperationRecord;
|
||||
PmsProduct pmsProduct = pmsProductService.selectPmsProductByIdentifier(oldPmsProductRequirement.getPmsProductIdentifier());
|
||||
checkUserReqParameter(pmsProductRequirement, pmsProduct);
|
||||
switch (ProductReqStatus.getByKey(oldPmsProductRequirement.getStatus())) {
|
||||
case PENDING_REVIEW_REQ_SPECS: {
|
||||
// 待审核需求可随意更改
|
||||
success = updateRequirement(pmsProductRequirement, oldPmsProductRequirement.getPmsProductIdentifier());
|
||||
pmsProductReqOperationRecord =
|
||||
productReqSpecsUpdateVo.toPmsProductReqOperationRecord(pmsProductRequirement);
|
||||
break;
|
||||
}
|
||||
case REVIEWED_REQ_SPECS:
|
||||
case PLANNED_REQ_SPECS: {
|
||||
// 已评审或已计划的需规需要进行变更(创建一条对应的需规)
|
||||
if (ProductReqStatus.REVIEWED_REQ_SPECS.getKey().equals(oldPmsProductRequirement.getStatus())) {
|
||||
oldPmsProductRequirement.setStatus(ProductReqStatus.REVIEWED_REQ_SPECS_CHANGING.getKey());
|
||||
} else {
|
||||
oldPmsProductRequirement.setStatus(ProductReqStatus.PLANNED_REQ_SPECS_CHANGING.getKey());
|
||||
}
|
||||
|
||||
success = updateRequirement(oldPmsProductRequirement, oldPmsProductRequirement.getPmsProductIdentifier());
|
||||
pmsProductReqOperationRecord =
|
||||
productReqSpecsUpdateVo.toPmsProductReqOperationRecord(pmsProductRequirement);
|
||||
pmsProductReqOperationRecord.setOperation(ProductContentModifyOperation.CHANGING_REQ.getKey());
|
||||
PmsProductRequirement changingReqSpecs = pmsProductRequirement.toChangeReqSpecs();
|
||||
changingReqSpecs.setUpdateBy(SecurityUtils.getUsername());
|
||||
changingReqSpecs.setUpdateTime(DateUtils.getNowDate());
|
||||
pmsProductRequirementMapper.insertPmsProductRequirement(changingReqSpecs);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
throw new ServiceException("当前状态下的需求规格不允许修改");
|
||||
}
|
||||
}
|
||||
|
||||
pmsProductReqOperationRecordService.insertPmsProductReqOperationRecord(pmsProductReqOperationRecord);
|
||||
return success;
|
||||
}
|
||||
|
||||
private ProductReqSpecsDetailVo toProductReqSpecsDetailVo(PmsProductRequirement pmsProductRequirement) {
|
||||
ProductReqSpecsDataVo productReqSpecsDataVo = toProductReqSpecsDataVo(pmsProductRequirement, null);
|
||||
ProductReqSpecsDetailVo productReqSpecsDetailVo = productReqSpecsDataVo.toProductReqSpecsDetailVo();
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@
|
|||
</otherwise>
|
||||
</choose>
|
||||
and (`status`= 'pendingReviewReqSpecs' or `status`= 'plannedReqSpecs' or `status` = 'rejectedReqSpecs' or
|
||||
`status` = 'reviewedReqSpecs' or `status` = 'completedReqSpecs')
|
||||
`status` = 'reviewedReqSpecs' or `status` = 'completedReqSpecs' or `status` = 'changingReqSpecs')
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue