fix: 解决标签排序问题

This commit is contained in:
songyuanlun 2024-01-15 12:12:51 +08:00
parent b970633fd2
commit 9e12811bc5

View File

@ -45,11 +45,11 @@ public class NotifyChannelServiceImpl implements INotifyService {
userProfileMap.put("accountType", AccountTypeEnum.ROBOT.getCode());
List<RobotTagResp> robotTags = robotInfoResp.getRobotTagList();
if (CollectionUtils.isNotEmpty(robotTags)) {
robotTags = robotTags.stream().sorted(Comparator.comparing(RobotTagResp::getWeight).reversed()
.thenComparing(RobotTagResp::getId))
.collect(Collectors.toList());
robotTags = robotTags.stream().sorted(
Comparator.comparing(RobotTagResp::getWeight, Comparator.reverseOrder())
.thenComparing(RobotTagResp::getId, Comparator.reverseOrder()))
.collect(Collectors.toList());
robotTags.forEach(robotTagResp -> {
robotTagResp.setId(null);
robotTagResp.setUseCount(null);
robotTagResp.setWeight(null);
});