3 Commits
Author SHA1 Message Date
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
7 changed files with 48 additions and 25 deletions
@@ -15,6 +15,10 @@ public class ProgramCountDTO implements Serializable {
private BigDecimal finishedStoryCount; private BigDecimal finishedStoryCount;
//上线需求总量 //上线需求总量
private BigDecimal releaseStoryCount; private BigDecimal releaseStoryCount;
//当月规划上线的需求总量(自然月1~31口径:预计完成时间plan_end_date落在当月、按产品过滤、状态非closed)
private BigDecimal planReleaseStoryNum;
//当月准时上线的需求量(上述规划需求中,实际上线时间releasedDate<=预计完成时间plan_end_date)
private BigDecimal onTimeNum;
//完成验收数量 //完成验收数量
private BigDecimal ysStoryCount; private BigDecimal ysStoryCount;
//完成需求验收率 //完成需求验收率
@@ -3427,8 +3427,11 @@ public class IZtCountService {
workTime = workTime.add(performanceDTO.getWorkTime()); workTime = workTime.add(performanceDTO.getWorkTime());
taskCount=taskCount.add(performanceDTO.getTotalTask()); taskCount=taskCount.add(performanceDTO.getTotalTask());
finishPunctuality=finishPunctuality.add(performanceDTO.getFinishPunctuality()); //零任务成员不参与准时率平均:个人无分配工时则准时率按0计,纳入平均会拉低团队值
kfzCount+=1; if (!BigDecimalUtils.isZero(performanceDTO.getAllocationTime())) {
finishPunctuality=finishPunctuality.add(performanceDTO.getFinishPunctuality());
kfzCount+=1;
}
} }
} }
dto.setAllocationTime(allocationTime); dto.setAllocationTime(allocationTime);
@@ -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)); 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率 // //线上bug率
List<ZtBug> prodBugList = bugList.stream().filter(o -> o.getBugType().equals("prod")).collect(Collectors.toList()); List<ZtBug> prodBugList = bugList.stream().filter(o -> o.getBugType().equals("prod")).collect(Collectors.toList());
@@ -45,6 +45,16 @@ public abstract class AbstractWorkloadRateCalculator extends AbstractPerfIndicat
protected com.sa.zentao.service.IZtProductService productService; protected com.sa.zentao.service.IZtProductService productService;
@Autowired @Autowired
protected com.sa.zentao.service.IZtStoryService storyService; 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 表示不限制(团队口径) * 需求范围过滤;返回 null 表示不限制(团队口径)
@@ -150,19 +160,6 @@ public abstract class AbstractWorkloadRateCalculator extends AbstractPerfIndicat
.in(ZtUser::getAccount, accounts)); .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 落当月)的执行列表 * CHG-053 产品 id 集 → 当月窗口内(begin 或 end 落当月)的执行列表
*/ */
@@ -11,10 +11,12 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 项目准时率(产品经理 0.1):Σ(当月准时上线需求量) ÷ Σ(当月规划上线需求总量)。 * 项目准时率(产品经理 0.1):Σ(当月准时上线需求量) ÷ Σ(当月规划上线需求总量)。
* 规划 = zt_story.planEndDate 落在当月;准时 = releaseddate ≤ planEndDate(当日末)。 * 规划 = zt_story.planEndDate 落在当月;准时 = releaseddate ≤ planEndDate(当日末)。
* 产品范围同 workloadRate 口径(CHG-053):选中产品集优先,未选中退回本人执行关联产品,不再全公司统计。
* *
* @author ai * @author ai
* @since 2026-07-28 * @since 2026-07-28
@@ -24,6 +26,8 @@ public class ProjectPunctualityRateCalculator extends AbstractPerfIndicatorCalcu
@Autowired @Autowired
private IZtStoryService storyService; private IZtStoryService storyService;
@Autowired
private ProductScopeResolver productScopeResolver;
@Override @Override
public String key() { public String key() {
@@ -32,7 +36,13 @@ public class ProjectPunctualityRateCalculator extends AbstractPerfIndicatorCalcu
@Override @Override
protected BigDecimal doCompute(String account, String month, JSONObject rule) { 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() List<ZtStory> stories = storyService.list(new QueryWrapper<ZtStory>().lambda()
.in(ZtStory::getProduct, productIds)
.ge(ZtStory::getPlanEndDate, firstDayOfMonth(month)) .ge(ZtStory::getPlanEndDate, firstDayOfMonth(month))
.le(ZtStory::getPlanEndDate, lastDayOfMonth(month))); .le(ZtStory::getPlanEndDate, lastDayOfMonth(month)));
if (CollectionUtils.isEmpty(stories)) { if (CollectionUtils.isEmpty(stories)) {
+5 -5
View File
@@ -17,10 +17,10 @@ spring:
password: PX4fTAAsJ#T! password: PX4fTAAsJ#T!
driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
slave: slave:
url: jdbc:mysql://192.168.3.111:3516/zentao?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true url: jdbc:mysql://127.0.0.1:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
username: root username: oa_user
password: 123456 password: PX4fTAAsJ#T!
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
#spring: #spring:
# datasource: # datasource:
@@ -60,4 +60,4 @@ vx:
# 小飞侠发版通知和催促邮件增加抄送人 # 小飞侠发版通知和催促邮件增加抄送人
xfx: 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 # 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 # username: root
# password: PX4fTAAsJ#T!1 # 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可省略此配置 driver-class-name: com.mysql.cj.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
slave: slave:
url: jdbc:mysql://192.168.3.111:3516/zentao?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&autoReconnect=true url: jdbc:mysql://192.168.1.161:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true
username: root username: devgps
password: 123456 password: dev@2021GPS
driver-class-name: com.mysql.cj.jdbc.Driver 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: file:
baseUrl: http://192.168.1.161:8085 baseUrl: http://192.168.1.161:8085
@@ -1397,6 +1397,7 @@
</foreach>) planReleaseStoryNum, </foreach>) planReleaseStoryNum,
(SELECT count(1) waitRelease from zt_story (SELECT count(1) waitRelease from zt_story
WHERE plan_end_date >=#{startTime} and plan_end_date &lt;=#{endTime} 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;=plan_end_date
and releasedDate &lt;=#{endTime} and releasedDate &lt;=#{endTime}
and status not in ('closed') and status not in ('closed')