6 Commits
Author SHA1 Message Date
guoqibing 53e8017ac8 优化需求口径,统计产品绩效 2026-11-04 07:18:38 +05:30
guoqibingandClaude Fable 5 1c75f47657 fix: 迭代编辑补充负责人pm字段落库
editImplement 未持久化 pm,编辑弹窗「迭代负责人」修改后不生效

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-22 19:29:10 +08:00
guoqibingandClaude Fable 5 aa64c89a36 feat: AI建任务动态文案与校验提示改为贡献值口径(禅道需求9541)
- aiBatchAdd 动态文案「工时xx h」→「贡献值xx pv」
- 两处「请检查工时」校验提示→「请检查贡献值」
- ZtTaskAiBatchDTO 注释同步;接口协议与 aiEvaluationTime 字段名不变

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-22 19:29:10 +08:00
guoqibingandClaude Fable 5 461f17713f chore: 开发/本地环境数据源指向与发版抄送调整
- application-dev/application-local slave 数据源改指开发库(192.168.1.161 / 127.0.0.1 zentao_dev)
- local 主库注释块补充 zentao_dev_2026 备选指向
- xfx.release 发版通知抄送移除 zhangyamei

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-22 13:02:54 +08:00
guoqibingandClaude Fable 5 5eb8534986 refactor: 绩效计算器产品范围口径统一委托 ProductScopeResolver
- AbstractWorkloadRateCalculator.currentProgramProductIds 删除内联实现,
  委托 ProductScopeResolver.programProductIds,与 projectPunctualityRate 同口径
- ProjectPunctualityRateCalculator 项目准时率接入 scopeProductIds:
  选中产品集优先,未选中退回本人执行关联产品,不再全公司统计;
  当月无关联产品范围时明细提示并返回 0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-22 13:02:54 +08:00
guoqibingandClaude Fable 5 0b8150eeac feat: 项目绩效统计新增当月规划/准时上线指标并修复准时率口径
- ProgramCountDTO +2 字段:planReleaseStoryNum / onTimeNum
- IZtCountService.monthScopeByProgram 接入 storyReleaseOnTimeByProducts
  (自然月1~31口径,复用产品经理绩效同款 SQL,老 ±15 天口径不动)
- IZtCountService 团队准时率:零任务成员(无分配工时)不参与平均,
  避免个人准时率按 0 拉低团队值
- ZtStoryMapper storyReleaseOnTimeByProducts 准时子查询增加
  releasedDate >= '2000-01-01' 哨兵,排除禅道历史零日期('0000-00-00')
  导致未发布需求被误计准时的缺陷

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-22 13:02:41 +08:00
10 changed files with 57 additions and 31 deletions
@@ -15,6 +15,10 @@ public class ProgramCountDTO implements Serializable {
private BigDecimal finishedStoryCount;
//上线需求总量
private BigDecimal releaseStoryCount;
//当月规划上线的需求总量(自然月1~31口径:预计完成时间plan_end_date落在当月、按产品过滤、状态非closed)
private BigDecimal planReleaseStoryNum;
//当月准时上线的需求量(上述规划需求中,实际上线时间releasedDate<=预计完成时间plan_end_date)
private BigDecimal onTimeNum;
//完成验收数量
private BigDecimal ysStoryCount;
//完成需求验收率
@@ -29,7 +29,7 @@ public class ZtTaskAiBatchDTO implements Serializable {
private String assignedTo;
//任务描述,可选,写入 zt_task.desc
private String desc;
//AI评估工时,写入 zt_task.estimate
//AI评估贡献值,写入 zt_task.estimate
private Float aiEvaluationTime;
//预计开始,格式 yyyy-MM-dd,写入 zt_task.estStarted
private String planStartDate;
@@ -3427,10 +3427,13 @@ public class IZtCountService {
workTime = workTime.add(performanceDTO.getWorkTime());
taskCount=taskCount.add(performanceDTO.getTotalTask());
//零任务成员不参与准时率平均:个人无分配工时则准时率按0计,纳入平均会拉低团队值
if (!BigDecimalUtils.isZero(performanceDTO.getAllocationTime())) {
finishPunctuality=finishPunctuality.add(performanceDTO.getFinishPunctuality());
kfzCount+=1;
}
}
}
dto.setAllocationTime(allocationTime);
List<ZtBug> devBugList = this.bugService.getDevBugList(bugList);
int devBugCount = devBugList.size();
@@ -3468,6 +3471,10 @@ public class IZtCountService {
// //需求完成验收率
dto.setYsStoryRate((BigDecimalUtils.isZero(dto.getYsStoryCount())||BigDecimalUtils.isZero(dto.getReleaseStoryCount())) ? BigDecimal.ZERO : dto.getYsStoryCount().divide(dto.getReleaseStoryCount(), 2, BigDecimal.ROUND_HALF_UP));
// //当月规划上线/准时上线需求(自然月1~31口径,独立于上方±15天口径;复用产品经理绩效同款SQL,不改动老逻辑)
Map<String,Object> planOnTimeMap = this.storyService.storyReleaseOnTimeByProducts(pIds, firstDayOfMonth, lastDayOfMonth);
dto.setPlanReleaseStoryNum(BigDecimal.valueOf(Integer.valueOf(planOnTimeMap.getOrDefault("planReleaseStoryNum", 0).toString())));
dto.setOnTimeNum(BigDecimal.valueOf(Integer.valueOf(planOnTimeMap.getOrDefault("onTimeNum", 0).toString())));
// //线上bug率
List<ZtBug> prodBugList = bugList.stream().filter(o -> o.getBugType().equals("prod")).collect(Collectors.toList());
@@ -1453,6 +1453,7 @@ public class ZtProjectServiceImpl extends ServiceImpl<ZtProjectMapper, ZtProject
ztProject.setEnd(dto.getEnd());
ztProject.setDays(dto.getDays());
ztProject.setName(dto.getName());
ztProject.setPm(dto.getPm());
ztProject.setLastEditedDate(new Date());
ztProject.setLastEditedBy(RiskUserThreadLocal.get().getName());
this.baseMapper.updateById(ztProject);
@@ -1288,7 +1288,7 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
}
for (ZtTaskDTO d : list) {
if (d.getEstimate() == null) {
throw new BusinessException("请检查工时");
throw new BusinessException("请检查贡献值");
}
ZtTask ztTask = new ZtTask();
@@ -1438,7 +1438,7 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
}
//对齐老接口规则:工时必须录入
if (item.getAiEvaluationTime() == null) {
throw new BusinessException("请检查工时:" + item.getName());
throw new BusinessException("请检查贡献值:" + item.getName());
}
//CHG-076:assignedTo 支持中文姓名——不是既有账号时按昵称查库映射账号(AI 框架传中文名场景)
String assignedTo = item.getAssignedTo();
@@ -1477,7 +1477,7 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
}
//CHG-081:类型中文名按 TaskType 枚举取值(原写死 test→测试/其他→开发,design 放行后会被误记为「开发」)
createdDescs.add(item.getName() + "(" + TaskType.transferType(item.getType()).getValue()
+ ",工时" + item.getAiEvaluationTime() + "h"
+ ",贡献值" + item.getAiEvaluationTime() + "pv"
+ "," + assigneeSeg + ")");
}
@@ -45,6 +45,16 @@ public abstract class AbstractWorkloadRateCalculator extends AbstractPerfIndicat
protected com.sa.zentao.service.IZtProductService productService;
@Autowired
protected com.sa.zentao.service.IZtStoryService storyService;
@Autowired
protected ProductScopeResolver productScopeResolver;
/**
* CHG-053 当前选中产品集(program id)→ 产品 id 集;未选中(null)返回 null。
* 委托 ProductScopeResolver,与 projectPunctualityRate 等产品范围过滤同一份口径。
*/
protected Set<Integer> currentProgramProductIds() {
return productScopeResolver.programProductIds(currentProgram());
}
/**
* 需求范围过滤;返回 null 表示不限制(团队口径)
@@ -150,19 +160,6 @@ public abstract class AbstractWorkloadRateCalculator extends AbstractPerfIndicat
.in(ZtUser::getAccount, accounts));
}
/**
* CHG-053 当前选中产品集(program id)→ 产品 id 集;未选中(null)返回 null
*/
protected Set<Integer> currentProgramProductIds() {
Integer program = currentProgram();
if (program == null) {
return null;
}
return productService.list(new QueryWrapper<com.sa.zentao.entity.ZtProduct>().lambda()
.eq(com.sa.zentao.entity.ZtProduct::getProgram, program)).stream()
.map(com.sa.zentao.entity.ZtProduct::getId).collect(Collectors.toSet());
}
/**
* CHG-053 产品 id 集 → 当月窗口内(begin 或 end 落当月)的执行列表
*/
@@ -11,10 +11,13 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
/**
* 项目准时率(产品经理 0.1):Σ(当月准时上线需求量) ÷ Σ(当月规划上线需求总量)。
* 规划 = zt_story.planEndDate 落在当月;准时 = releaseddate ≤ planEndDate(当日末)。
* 规划 = zt_story.planEndDate 落在当月且未关闭(status != 'closed',与面板 storyReleaseOnTimeByProducts 口径对齐);
* 准时 = releaseddate ≤ planEndDate(当日末)。
* 产品范围同 workloadRate 口径(CHG-053):选中产品集优先,未选中退回本人执行关联产品,不再全公司统计。
*
* @author ai
* @since 2026-07-28
@@ -24,6 +27,8 @@ public class ProjectPunctualityRateCalculator extends AbstractPerfIndicatorCalcu
@Autowired
private IZtStoryService storyService;
@Autowired
private ProductScopeResolver productScopeResolver;
@Override
public String key() {
@@ -32,9 +37,16 @@ public class ProjectPunctualityRateCalculator extends AbstractPerfIndicatorCalcu
@Override
protected BigDecimal doCompute(String account, String month, JSONObject rule) {
Set<Integer> productIds = productScopeResolver.scopeProductIds(currentProgram(), account, month);
if (CollectionUtils.isEmpty(productIds)) {
rawDetail("当月无规划上线需求(无关联产品范围)");
return BigDecimal.ZERO;
}
List<ZtStory> stories = storyService.list(new QueryWrapper<ZtStory>().lambda()
.in(ZtStory::getProduct, productIds)
.ge(ZtStory::getPlanEndDate, firstDayOfMonth(month))
.le(ZtStory::getPlanEndDate, lastDayOfMonth(month)));
.le(ZtStory::getPlanEndDate, lastDayOfMonth(month))
.ne(ZtStory::getStatus, "closed"));
if (CollectionUtils.isEmpty(stories)) {
rawDetail("当月无规划上线需求");
return BigDecimal.ZERO;
+5 -5
View File
@@ -17,10 +17,10 @@ spring:
password: PX4fTAAsJ#T!
driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
slave:
url: jdbc:mysql://192.168.3.111:3516/zentao?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
username: oa_user
password: PX4fTAAsJ#T!
driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
#spring:
# datasource:
@@ -60,4 +60,4 @@ vx:
# 小飞侠发版通知和催促邮件增加抄送人
xfx:
release: gongwenyi@flying-man.cn,juntao.lin@sino-assistance.com,lizhicheng@sino-assistance.com,wangtingting@sino-assistance.com,liang.xie@sino-assistance.com,zhangyamei@sino-assistance.com
release: gongwenyi@flying-man.cn,juntao.lin@sino-assistance.com,lizhicheng@sino-assistance.com,wangtingting@sino-assistance.com,liang.xie@sino-assistance.com
+9 -5
View File
@@ -28,15 +28,19 @@ spring:
# url: jdbc:mysql://192.168.3.200:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
# username: root
# password: PX4fTAAsJ#T!1
# url: jdbc:mysql://192.168.1.161:3306/zentao_dev_2026?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
# username: devgps
# password: dev@2021GPS
driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
slave:
url: jdbc:mysql://192.168.3.111:3516/zentao?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true
username: root
password: 123456
url: jdbc:mysql://192.168.1.161:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
username: devgps
password: dev@2021GPS
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://192.168.3.200:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
# username: root
# password: PX4fTAAsJ#T!1
file:
baseUrl: http://192.168.1.161:8085
@@ -1397,6 +1397,7 @@
</foreach>) planReleaseStoryNum,
(SELECT count(1) waitRelease from zt_story
WHERE plan_end_date >=#{startTime} and plan_end_date &lt;=#{endTime}
and releasedDate &gt;='2000-01-01'
and releasedDate &lt;=plan_end_date
and releasedDate &lt;=#{endTime}
and status not in ('closed')