diff --git a/src/main/java/com/sa/zentao/entity/ZtStory.java b/src/main/java/com/sa/zentao/entity/ZtStory.java index 87d99e3..1e20c4f 100644 --- a/src/main/java/com/sa/zentao/entity/ZtStory.java +++ b/src/main/java/com/sa/zentao/entity/ZtStory.java @@ -191,10 +191,8 @@ public class ZtStory implements Serializable { //结束日期 测试结束 private Date endDate; //内部验收时间 - @TableField(exist = false) private Date innerYsTime; //测试提交验收时间 - @TableField(exist = false) private Date testSubmitYsTime; private Integer project; //1通过 2不通过 diff --git a/src/main/java/com/sa/zentao/service/impl/ZtStoryServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtStoryServiceImpl.java index 981ee4b..ef005f3 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtStoryServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtStoryServiceImpl.java @@ -996,6 +996,31 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if(!ObjectUtil.equal(ztStory.getInnerYsFlag(),1)){ throw new BusinessException("无需内部验收,不需要提交,需求ID: " + qo.getId()); } + //产品验收中 + this.doEnterProductWaitVerified(ztStory); + } + + @Override + public void storyProductUserYs(ZtStoryDTO qo) { + ZtStory ztStory = this.baseMapper.selectById(qo.getId()); + if(ztStory==null){ + throw new BusinessException("未查询到需求,需求ID: " + qo.getId()); + } + if(!StoryStatusEnums.active.getValue().equals(ztStory.getStatus())){ + throw new BusinessException("需求状态不是激活状态,无法验收,当前状态: " + ztStory.getStatus() + ",需求ID: " + qo.getId()); + } + if(!StoryStageEnums.productWaitVerified.getValue().equals(ztStory.getStage())){ + throw new BusinessException("需求阶段不是待验收状态,无法验收,当前阶段: " + ztStory.getStage() + ",需求ID: " + qo.getId()); + } + //产品已验收 + this.doEnterProductVerified(ztStory); + } + + /** + * 进入"产品验收中"的核心动作:写阶段+提交验收时间+看板同步+操作日志。 + * testSubmitVerified(流程按钮) 与 changeStatus(编辑/批量改阶段) 共用,验收语义单一来源。 + */ + private void doEnterProductWaitVerified(ZtStory ztStory) { //产品验收中 ztStory.setStage(StoryStageEnums.productWaitVerified.getValue()); ztStory.setTestSubmitYsTime(new Date()); @@ -1015,19 +1040,12 @@ public class ZtStoryServiceImpl extends ServiceImpl impl RiskUserThreadLocal.get().getName(), "", ""); } - @Override - public void storyProductUserYs(ZtStoryDTO qo) { - ZtStory ztStory = this.baseMapper.selectById(qo.getId()); - if(ztStory==null){ - throw new BusinessException("未查询到需求,需求ID: " + qo.getId()); - } - if(!StoryStatusEnums.active.getValue().equals(ztStory.getStatus())){ - throw new BusinessException("需求状态不是激活状态,无法验收,当前状态: " + ztStory.getStatus() + ",需求ID: " + qo.getId()); - } - if(!StoryStageEnums.productWaitVerified.getValue().equals(ztStory.getStage())){ - throw new BusinessException("需求阶段不是待验收状态,无法验收,当前阶段: " + ztStory.getStage() + ",需求ID: " + qo.getId()); - } - //产品验收中 + /** + * 进入"产品已验收"的核心动作:写阶段+验收时间+看板同步+操作日志。 + * storyProductUserYs(流程按钮) 与 changeStatus(编辑/批量改阶段) 共用,验收语义单一来源。 + */ + private void doEnterProductVerified(ZtStory ztStory) { + //产品已验收 ztStory.setStage(StoryStageEnums.productVerified.getValue()); ztStory.setLasteditedby(RiskUserThreadLocal.get().getName()); ztStory.setLastediteddate(new Date()); @@ -1732,6 +1750,19 @@ public class ZtStoryServiceImpl extends ServiceImpl impl throw new BusinessException("当前无迭代,不可以更改"); } + //编辑/批量改阶段到产品验收状态时,复用验收流程核心(时间字段+看板+日志与流程按钮一致) + if (StoryStageEnums.productWaitVerified.getValue().equalsIgnoreCase(dto.getStage())) { + if (!ObjectUtil.equal(ztStory.getInnerYsFlag(), 1)) { + throw new BusinessException("无需内部验收,不允许进入产品验收中,需求ID: " + ztStory.getId()); + } + this.doEnterProductWaitVerified(ztStory); + continue; + } + if (StoryStageEnums.productVerified.getValue().equalsIgnoreCase(dto.getStage())) { + this.doEnterProductVerified(ztStory); + continue; + } + String oldStatus = ztStory.getStage();