From 41955cff3f3212cf3aad50bc04f242084bf95ede Mon Sep 17 00:00:00 2001 From: guoqibing Date: Thu, 22 Oct 2026 10:46:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E7=BC=96=E8=BE=91=E6=89=80?= =?UTF-8?q?=E5=A4=84=E9=98=B6=E6=AE=B5=E6=94=AF=E6=8C=81=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E4=B8=AD/=E4=BA=A7=E5=93=81=E5=B7=B2?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=EF=BC=8C=E5=A4=8D=E7=94=A8=E9=AA=8C=E6=94=B6?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E6=A0=B8=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 抽取 doEnterProductWaitVerified/doEnterProductVerified 私有核心(原样搬自 testSubmitVerified/storyProductUserYs),接口方法改为校验+调核心,行为不变 - changeStatus 命中两个验收状态时走流程核心(innerYs=1 校验/迭代校验沿用),编辑与批量接口与流程按钮语义一致 - 修复 ZtStory.innerYsTime/testSubmitYsTime 误标 @TableField(exist=false) 导致验收时间从未落库的存量问题 Co-Authored-By: Claude Fable 5 --- .../java/com/sa/zentao/entity/ZtStory.java | 2 - .../service/impl/ZtStoryServiceImpl.java | 57 ++++++++++++++----- 2 files changed, 44 insertions(+), 15 deletions(-) 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();