feat(项目管理产品需求重构): 完善产品中的用户需求功能开发
新增接口:评审用户需求 Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
parent
56a4621aff
commit
85388b896e
|
|
@ -91,4 +91,15 @@ public class ProductUserReqController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pmsProductRequirementService.deleteUserReqByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 评审用户需求
|
||||
*/
|
||||
@RequiresPermissions("pms:pmsProductRequirement:edit")
|
||||
@Log(title = "用户需求", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/review")
|
||||
@ApiOperation(value = "评审用户需求")
|
||||
public AjaxResult review(@RequestBody @Validated ProductUserReqReviewVo productUserReqReviewVo) {
|
||||
return toAjax(pmsProductRequirementService.reviewUserReq(productUserReqReviewVo));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.microservices.pms.product.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
|
@ -14,6 +14,7 @@ import java.util.Date;
|
|||
* @author otto
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@Data
|
||||
public class PmsProductReqOperationRecord extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -25,38 +26,38 @@ public class PmsProductReqOperationRecord extends BaseEntity {
|
|||
/**
|
||||
* 操作人用户名
|
||||
*/
|
||||
@Excel(name = "操作人用户名")
|
||||
@ApiModelProperty(value = "操作人用户名")
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Excel(name = "类型")
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
@Excel(name = "操作")
|
||||
@ApiModelProperty(value = "操作")
|
||||
private String operation;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "操作时间")
|
||||
private Date operatingTime;
|
||||
|
||||
/**
|
||||
* 关联需求ID
|
||||
*/
|
||||
@Excel(name = "关联需求ID")
|
||||
@ApiModelProperty(value = "关联需求ID")
|
||||
private Long productRequirementId;
|
||||
|
||||
/**
|
||||
* 操作内容
|
||||
*/
|
||||
@Excel(name = "操作内容")
|
||||
@ApiModelProperty(value = "操作内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
|
|
@ -64,145 +65,15 @@ public class PmsProductReqOperationRecord extends BaseEntity {
|
|||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 预留字段1
|
||||
*/
|
||||
@Excel(name = "预留字段1")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String reservedField1;
|
||||
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
@Excel(name = "预留字段2")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String reservedField2;
|
||||
|
||||
/**
|
||||
* 预留字段3
|
||||
*/
|
||||
@Excel(name = "预留字段3")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String reservedField3;
|
||||
|
||||
/**
|
||||
* 预留字段4
|
||||
*/
|
||||
@Excel(name = "预留字段4")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String reservedField4;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public Date getOperatingTime() {
|
||||
return operatingTime;
|
||||
}
|
||||
|
||||
public void setOperatingTime(Date operatingTime) {
|
||||
this.operatingTime = operatingTime;
|
||||
}
|
||||
|
||||
public Long getProductRequirementId() {
|
||||
return productRequirementId;
|
||||
}
|
||||
|
||||
public void setProductRequirementId(Long productRequirementId) {
|
||||
this.productRequirementId = productRequirementId;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getReservedField1() {
|
||||
return reservedField1;
|
||||
}
|
||||
|
||||
public void setReservedField1(String reservedField1) {
|
||||
this.reservedField1 = reservedField1;
|
||||
}
|
||||
|
||||
public String getReservedField2() {
|
||||
return reservedField2;
|
||||
}
|
||||
|
||||
public void setReservedField2(String reservedField2) {
|
||||
this.reservedField2 = reservedField2;
|
||||
}
|
||||
|
||||
public String getReservedField3() {
|
||||
return reservedField3;
|
||||
}
|
||||
|
||||
public void setReservedField3(String reservedField3) {
|
||||
this.reservedField3 = reservedField3;
|
||||
}
|
||||
|
||||
public String getReservedField4() {
|
||||
return reservedField4;
|
||||
}
|
||||
|
||||
public void setReservedField4(String reservedField4) {
|
||||
this.reservedField4 = reservedField4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("operator", getOperator())
|
||||
.append("type", getType())
|
||||
.append("operation", getOperation())
|
||||
.append("operatingTime", getOperatingTime())
|
||||
.append("productRequirementId", getProductRequirementId())
|
||||
.append("content", getContent())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("reservedField1", getReservedField1())
|
||||
.append("reservedField2", getReservedField2())
|
||||
.append("reservedField3", getReservedField3())
|
||||
.append("reservedField4", getReservedField4())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.microservices.pms.product.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 产品需求状态
|
||||
*
|
||||
* @author OTTO
|
||||
*/
|
||||
@Getter
|
||||
public enum ProductReqOperationType {
|
||||
CONTENT_MODIFY("contentModify", "内容修改"),
|
||||
REVIEW_USER_REQ("reviewUserReq", "用户需求评审"),
|
||||
REVIEW_REQ_SPECS("reviewUserReq", "需求规格评审");
|
||||
private final String key;
|
||||
private final String name;
|
||||
|
||||
ProductReqOperationType(String key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.microservices.pms.product.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 产品需求状态
|
||||
*
|
||||
* @author OTTO
|
||||
*/
|
||||
@Getter
|
||||
public enum ProductReqReviewStatus {
|
||||
PASS("pass", "已通过"),
|
||||
REJECTED("rejected", "已拒绝");
|
||||
private final String key;
|
||||
private final String name;
|
||||
|
||||
ProductReqReviewStatus(String key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.microservices.pms.product.domain;
|
||||
package com.microservices.pms.product.domain.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
|
|
@ -5,7 +5,7 @@ import com.microservices.common.core.utils.bean.BeanUtils;
|
|||
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.ProductReqStatus;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqStatus;
|
||||
import com.microservices.pms.project.domain.vo.BaseEntityVo;
|
||||
import com.microservices.system.api.domain.SimpleSysUser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.microservices.pms.product.domain.vo;
|
||||
|
||||
import com.microservices.pms.product.domain.PmsProductReqOperationRecord;
|
||||
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 java.util.Date;
|
||||
|
||||
/**
|
||||
* 产品需求对象 pms_product_requirement
|
||||
*
|
||||
* @author otto
|
||||
* @date 2023-10-10
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户需求评审对象")
|
||||
public class ProductUserReqReviewVo {
|
||||
|
||||
@ApiModelProperty(value = "需求Id", required = true)
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "评审意见", required = true)
|
||||
@NotNull
|
||||
private String reviewStatus;
|
||||
|
||||
@ApiModelProperty(value = "评审时间(前端默认取当前时间)", required = true)
|
||||
@NotNull
|
||||
private Date reviewTime;
|
||||
|
||||
@ApiModelProperty(value = "评审结论", required = true)
|
||||
@NotNull
|
||||
private String reviewContent;
|
||||
|
||||
public PmsProductReqOperationRecord toPmsProductReqOperationRecord(String operator) {
|
||||
PmsProductReqOperationRecord record = new PmsProductReqOperationRecord();
|
||||
record.setProductRequirementId(id);
|
||||
record.setType(ProductReqOperationType.REVIEW_USER_REQ.getKey());
|
||||
record.setOperation(reviewStatus);
|
||||
record.setOperator(operator);
|
||||
record.setOperatingTime(reviewTime);
|
||||
record.setContent(reviewContent);
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public class ProductUserReqUpdateVo {
|
|||
/**
|
||||
* 需求Id
|
||||
*/
|
||||
@ApiModelProperty(value = "需求Id")
|
||||
@ApiModelProperty(value = "需求Id", required = true)
|
||||
@NotNull
|
||||
private Long id;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -147,4 +147,6 @@ public interface IPmsProductRequirementService
|
|||
int updateUserReq(ProductUserReqUpdateVo productUserReqUpdateVo);
|
||||
|
||||
int deleteUserReqByIds(Long[] ids);
|
||||
|
||||
int reviewUserReq(ProductUserReqReviewVo productUserReqReviewVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ 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.*;
|
||||
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.enums.ProductReqReviewStatus;
|
||||
import com.microservices.pms.product.domain.enums.ProductReqStatus;
|
||||
import com.microservices.pms.product.domain.vo.*;
|
||||
import com.microservices.pms.product.mapper.PmsProductRequirementMapper;
|
||||
import com.microservices.pms.product.service.*;
|
||||
|
|
@ -56,7 +61,7 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
@Autowired
|
||||
private IPmsProductPriorityService pmsProductPriorityService;
|
||||
@Autowired
|
||||
private IPmsProductStatusService pmsProductStatusService;
|
||||
private IPmsProductReqOperationRecordService pmsProductReqOperationRecordService;
|
||||
@Autowired
|
||||
private IPmsCommonService pmsCommonService;
|
||||
@Autowired
|
||||
|
|
@ -233,13 +238,18 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
// 检查附件列表是否有异常数据
|
||||
pmsCommonService.getAllFileByFileIdentifiers(pmsProductRequirement.getFileIdentifiers());
|
||||
|
||||
return updateRequirement(pmsProductRequirement, oldPmsProductRequirement.getPmsProductIdentifier());
|
||||
}
|
||||
|
||||
private int updateRequirement(PmsProductRequirement pmsProductRequirement, String productIdentifier) {
|
||||
pmsProductRequirement.setUpdateBy(SecurityUtils.getUsername());
|
||||
pmsProductRequirement.setUpdateTime(DateUtils.getNowDate());
|
||||
pmsProductService.updatePmsProductChange(oldPmsProductRequirement.getPmsProductIdentifier());
|
||||
pmsProductService.updatePmsProductChange(productIdentifier);
|
||||
return pmsProductRequirementMapper.updatePmsProductRequirement(pmsProductRequirement);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteUserReqByIds(Long[] ids) {
|
||||
int success = 0;
|
||||
for (Long id : ids) {
|
||||
|
|
@ -248,6 +258,28 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
return success;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = ServiceException.class)
|
||||
public int reviewUserReq(ProductUserReqReviewVo productUserReqReviewVo) {
|
||||
// 通过id检查需修改的产品需求是否存在
|
||||
PmsProductRequirement userReq = selectPmsProductRequirementById(productUserReqReviewVo.getId(), true);
|
||||
if (!ProductReqStatus.PENDING_REVIEW_USER_REQ.getKey().equals(userReq.getStatus())) {
|
||||
throw new ServiceException("只有待审核状态的用户需求才能进行审核");
|
||||
}
|
||||
if (ProductReqReviewStatus.PASS.getKey().equals(productUserReqReviewVo.getReviewStatus())) {
|
||||
userReq.setStatus(ProductReqStatus.REVIEWED_USER_REQ.getKey());
|
||||
//TODO:已通过的用户需求需创建一条对应的需求规格
|
||||
} 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()));
|
||||
return updateRequirement(userReq, userReq.getPmsProductIdentifier());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除产品需求信息
|
||||
|
|
@ -259,7 +291,7 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
|
|||
public int deleteUserReqById(Long id) {
|
||||
PmsProductRequirement oldPmsProductRequirement = selectPmsProductRequirementById(id, true);
|
||||
if (!ProductReqStatus.PENDING_REVIEW_USER_REQ.getKey().equals(oldPmsProductRequirement.getStatus())) {
|
||||
throw new ServiceException("只有待审核状态的用户需求才能被删除");
|
||||
throw new ServiceException("只有待审核状态的用户需求可以被删除");
|
||||
}
|
||||
pmsJournalsService.deletePmsJournalsByTypeAndJournalId(PmsConstants.JOURNAL_TYPE_PRODUCT_REQUIREMENT, id);
|
||||
pmsProductService.updatePmsProductChange(oldPmsProductRequirement.getPmsProductIdentifier());
|
||||
|
|
|
|||
Loading…
Reference in New Issue