REQ-2405: 处理重复分类问题

This commit is contained in:
yanglin 2024-04-28 18:39:18 +08:00
parent 46184636b9
commit d2ca950d27
3 changed files with 13 additions and 3 deletions

View File

@ -253,7 +253,12 @@ public class TodoRangeQueryService {
.get();
for (GroupStat stat : stats)
resp.addGroupStat(stat);
// 一个端可能会有重复分类
resp.setTotalStat();
// 一个端不包含重复分类
int uniqueExecutableCount = countStatByNodes(request, nodes, TodoType.EXECUTABLE);
int uniqueCopiedToMeCount = countStatByNodes(request, nodes, TodoType.COPIED_TO_ME);
resp.setUniqueTotalStat(new Stat(uniqueExecutableCount, uniqueCopiedToMeCount));
return resp;
} catch (Exception e) {
log.warn("分类统计异常, request={}", request, e);
@ -267,7 +272,7 @@ public class TodoRangeQueryService {
public Integer countStat(MessageGroupNodeStatisticParam request) {
PendingMessageStatisticResponseV2 nodeStat = nodeStatCache
.getCacheResponseOrReload(request, () -> countStatGroupedImpl(request));
Stat totalStat = nodeStat.getTotalStat();
Stat totalStat = nodeStat.getUniqueTotalStat();
return totalStat == null ? 0 : totalStat.getPendingCount();
}

View File

@ -95,7 +95,7 @@ public class NodeStatCache {
private static String buildCacheKey(MessageGroupNodeStatisticParam request) {
StringBuffer buf = new StringBuffer();
buf.append("msg-center:node-stat:v1");
buf.append("msg-center:node-stat:v2");
Consumer<Object> appender = value -> {
if (value != null)
buf.append(":").append(value);

View File

@ -28,10 +28,15 @@ public class PendingMessageStatisticResponseV2 implements Serializable {
private static final long serialVersionUID = 972200410809186003L;
/**
* 统计情况总数 (各分类相加)
* 统计总数 (各分类相加)
*/
private Stat totalStat;
/**
* 统计总数 (一个端分类配置重复了也没有关系)
*/
private Stat uniqueTotalStat;
/**
* 分类情况
*/