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

完善用户需求评审接口:用户需求评审通过时创建一条对应的需求规格

Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
OTTO 2024-11-30 17:03:39 +08:00
parent a2b1e49610
commit 553d4a1887
2 changed files with 26 additions and 3 deletions

View File

@ -169,6 +169,15 @@ public class PmsProductRequirement extends BaseEntity
return target;
}
public PmsProductRequirement userReqToReqSpecs() {
PmsProductRequirement target = new PmsProductRequirement();
BeanUtils.copyProperties(this, target);
target.setId(null);
target.setFromId(this.id);
target.setStatus(ProductReqStatus.REVIEWED_REQ_SPECS.getKey());
return target;
}
public PmsProductRequirement toChangeReqSpecs(ProductReqSpecsUpdateVo productReqSpecsUpdateVo) {
PmsProductRequirement target = new PmsProductRequirement();
BeanUtils.copyProperties(this, target);

View File

@ -296,20 +296,34 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
if (!ProductReqStatus.PENDING_REVIEW_USER_REQ.getKey().equals(userReq.getStatus())) {
throw new ServiceException("只有待审核状态的用户需求才能进行审核");
}
PmsProductReqOperationRecord pmsProductReqOperationRecord
= productUserReqReviewVo.toPmsProductReqOperationRecord(SecurityUtils.getUsername());
if (ProductReqReviewStatus.PASS.getKey().equals(productUserReqReviewVo.getReviewStatus())) {
userReq.setStatus(ProductReqStatus.REVIEWED_USER_REQ.getKey());
//TODO:已通过的用户需求需创建一条对应的需求规格
userReqToReqSpecs(userReq, pmsProductReqOperationRecord);
} else if (ProductReqReviewStatus.REJECTED.getKey().equals(productUserReqReviewVo.getReviewStatus())) {
userReq.setStatus(ProductReqStatus.REJECTED_USER_REQ.getKey());
} else {
throw new ServiceException("请选择正确的审核意见");
}
// 记录评审意见
pmsProductReqOperationRecordService.insertPmsProductReqOperationRecord(
productUserReqReviewVo.toPmsProductReqOperationRecord(SecurityUtils.getUsername()));
pmsProductReqOperationRecordService.insertPmsProductReqOperationRecord(pmsProductReqOperationRecord);
return updateRequirement(userReq, userReq.getPmsProductIdentifier());
}
/**
* 用户需求转换为需求规格
*/
private void userReqToReqSpecs(PmsProductRequirement userReq, PmsProductReqOperationRecord record) {
PmsProductRequirement reqSpecs =
userReq.userReqToReqSpecs();
reqSpecs.setIdentifier(genReqSpecsIdentifier(userReq.getPmsProductIdentifier(), userReq.getTitle()));
reqSpecs.setCreateAndUpdate(SecurityUtils.getUsername());
pmsProductRequirementMapper.insertPmsProductRequirement(reqSpecs);
record.setProductRequirementId(reqSpecs.getId());
pmsProductReqOperationRecordService.insertPmsProductReqOperationRecord(record);
}
@Override
public GenericsTableDataInfo<ProductReqSpecsDataVo> selectReqSpecsList(ProductReqSpecsSearchVo productReqSpecsSearchVo) {
pmsProductService.selectPmsProductByIdentifier(productReqSpecsSearchVo.getPmsProductIdentifier());