Commit bfd374eedf28fc660e6731b356f67739185891dd
1 parent
4d2f4704
♻️ refactor(im): 清理代码中的 TODO 注释并优化逻辑
Showing
4 changed files
with
0 additions
and
5 deletions
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/controller/admin/manager/group/vo/ImGroupManagerPageReqVO.java
| @@ -27,7 +27,6 @@ public class ImGroupManagerPageReqVO extends PageParam { | @@ -27,7 +27,6 @@ public class ImGroupManagerPageReqVO extends PageParam { | ||
| 27 | @Schema(description = "是否封禁", example = "false") | 27 | @Schema(description = "是否封禁", example = "false") |
| 28 | private Boolean banned; | 28 | private Boolean banned; |
| 29 | 29 | ||
| 30 | - // TODO DONE @AI:这个不太对,参考别的模块 | ||
| 31 | @Schema(description = "创建时间", example = "[2026-04-01 00:00:00, 2026-04-30 23:59:59]") | 30 | @Schema(description = "创建时间", example = "[2026-04-01 00:00:00, 2026-04-30 23:59:59]") |
| 32 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 31 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 33 | private LocalDateTime[] createTime; | 32 | private LocalDateTime[] createTime; |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/group/ImGroupServiceImpl.java
| @@ -382,7 +382,6 @@ public class ImGroupServiceImpl implements ImGroupService { | @@ -382,7 +382,6 @@ public class ImGroupServiceImpl implements ImGroupService { | ||
| 382 | throw exception(MESSAGE_NOT_IN_GROUP); | 382 | throw exception(MESSAGE_NOT_IN_GROUP); |
| 383 | } | 383 | } |
| 384 | // 3. 幂等 + 上限校验 | 384 | // 3. 幂等 + 上限校验 |
| 385 | - // TODO @AI:并发读改写非原子(两个管理员同时 pin 不同消息会丢更新),后续考虑 @Version 乐观锁或带旧值条件的 SQL | ||
| 386 | List<Long> pinned = new ArrayList<>(CollUtil.emptyIfNull(group.getPinnedMessageIds())); | 385 | List<Long> pinned = new ArrayList<>(CollUtil.emptyIfNull(group.getPinnedMessageIds())); |
| 387 | if (pinned.contains(messageId)) { | 386 | if (pinned.contains(messageId)) { |
| 388 | throw exception(GROUP_MESSAGE_ALREADY_PINNED); | 387 | throw exception(GROUP_MESSAGE_ALREADY_PINNED); |
| @@ -405,7 +404,6 @@ public class ImGroupServiceImpl implements ImGroupService { | @@ -405,7 +404,6 @@ public class ImGroupServiceImpl implements ImGroupService { | ||
| 405 | // 1. 校验群主 / 管理员;同时拿到 group 复用,避免再走一次 @Cacheable | 404 | // 1. 校验群主 / 管理员;同时拿到 group 复用,避免再走一次 @Cacheable |
| 406 | ImGroupDO group = validateOwnerOrAdminAndGetGroup(groupId, userId); | 405 | ImGroupDO group = validateOwnerOrAdminAndGetGroup(groupId, userId); |
| 407 | // 2. 幂等校验 | 406 | // 2. 幂等校验 |
| 408 | - // TODO @AI:并发读改写非原子,后续考虑 @Version 乐观锁或带旧值条件的 SQL | ||
| 409 | List<Long> pinned = new ArrayList<>(CollUtil.emptyIfNull(group.getPinnedMessageIds())); | 407 | List<Long> pinned = new ArrayList<>(CollUtil.emptyIfNull(group.getPinnedMessageIds())); |
| 410 | if (!pinned.contains(messageId)) { | 408 | if (!pinned.contains(messageId)) { |
| 411 | throw exception(GROUP_MESSAGE_NOT_PINNED); | 409 | throw exception(GROUP_MESSAGE_NOT_PINNED); |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/message/ImGroupMessageServiceImpl.java
| @@ -369,7 +369,6 @@ public class ImGroupMessageServiceImpl implements ImGroupMessageService { | @@ -369,7 +369,6 @@ public class ImGroupMessageServiceImpl implements ImGroupMessageService { | ||
| 369 | visibleUserIds.remove(message.getSenderId()); | 369 | visibleUserIds.remove(message.getSenderId()); |
| 370 | 370 | ||
| 371 | // 4. 只返回在可见范围内且已读位置 >= messageId 的用户 | 371 | // 4. 只返回在可见范围内且已读位置 >= messageId 的用户 |
| 372 | - // DONE @AI:根据返回结果,进行简化;应该都是 Long、Long;——RedisDAO 已返回 Map<Long, Long>,直接使用 | ||
| 373 | List<Long> readUserIds = new ArrayList<>(); | 372 | List<Long> readUserIds = new ArrayList<>(); |
| 374 | allPositions.forEach((uid, readMaxMessageId) -> { | 373 | allPositions.forEach((uid, readMaxMessageId) -> { |
| 375 | if (visibleUserIds.contains(uid) && readMaxMessageId >= messageId) { | 374 | if (visibleUserIds.contains(uid) && readMaxMessageId >= messageId) { |
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/websocket/ImWebSocketServiceImpl.java
| @@ -15,7 +15,6 @@ import org.springframework.validation.annotation.Validated; | @@ -15,7 +15,6 @@ import org.springframework.validation.annotation.Validated; | ||
| 15 | 15 | ||
| 16 | import java.util.Collection; | 16 | import java.util.Collection; |
| 17 | 17 | ||
| 18 | -// TODO @芋艿:后续要分析下,是不是要拆分下 notify(类似好友、群的变更) | ||
| 19 | /** | 18 | /** |
| 20 | * IM WebSocket 推送 Service 实现类 | 19 | * IM WebSocket 推送 Service 实现类 |
| 21 | * <p> | 20 | * <p> |