REQ-2655: 分类统计时对分类进行排序
This commit is contained in:
parent
53e199872d
commit
e1fc4dad26
@ -85,6 +85,7 @@ public class GroupTemplateService {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
leafNodes.sort(NodeComparator.INSTANCE);
|
||||
return leafNodes;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package cn.axzo.msg.center.message.service.group;
|
||||
|
||||
import cn.axzo.maokai.api.vo.response.tree.ValueNode;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
*/
|
||||
class NodeComparator implements Comparator<ValueNode<NodeWrapper>> {
|
||||
|
||||
static final NodeComparator INSTANCE = new NodeComparator();
|
||||
|
||||
private NodeComparator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(ValueNode<NodeWrapper> n1, ValueNode<NodeWrapper> n2) {
|
||||
Long id1 = n1.getValue().unwrap().getId();
|
||||
Long id2 = n2.getValue().unwrap().getId();
|
||||
return Long.compare(id1, id2);
|
||||
}
|
||||
}
|
||||
@ -58,6 +58,7 @@ public class RootNodeWrapper {
|
||||
.map(this::findValueNode)
|
||||
.map(node -> node.orElse(null))
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(NodeComparator.INSTANCE)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
|
||||
@ -269,6 +269,7 @@ public class TodoRangeQueryService {
|
||||
GroupStat groupStat = new GroupStat();
|
||||
stats.add(groupStat);
|
||||
MessageGroupNode node = valueNode.getValue().unwrap();
|
||||
groupStat.setNodeId(node.getId());
|
||||
groupStat.setGroupCode(node.getCode());
|
||||
groupStat.setGroupName(node.getName());
|
||||
groupStat.setGroupIcon(node.getIcon());
|
||||
|
||||
@ -65,9 +65,11 @@ public class PendingMessageStatisticResponseV2 implements Serializable {
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class GroupStat {
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private Long nodeId;
|
||||
/**
|
||||
* 分类名称
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user