diff --git a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageRequest.java b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageRequest.java index b060856..5678087 100644 --- a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageRequest.java +++ b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageRequest.java @@ -4,6 +4,7 @@ import lombok.Data; @Data public class PageRequest { + // 普通分页参数 private Long current = 1L; private Long size = 10L; } diff --git a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageResponse.java b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageResponse.java index 6f1793f..e8e8e42 100644 --- a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageResponse.java +++ b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/PageResponse.java @@ -13,8 +13,9 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor public class PageResponse { - private Long current; - private Long size = 10L; + // 普通分页参数 + private Long current; // 当前页数,适用于普通分页 private Long total; + private Long size = 10L; private List records = Collections.emptyList(); } diff --git a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/ScrollPageRequest.java b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/ScrollPageRequest.java new file mode 100644 index 0000000..8ae8784 --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/ScrollPageRequest.java @@ -0,0 +1,14 @@ +package com.luojia_channel.common.domain.page; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ScrollPageRequest { + private Long lastVal; // 上次查询的最小值(用于游标分页) + private Integer offset = 0; // 偏移量(用于分页位置标记) + private Long size = 10L; // 每页数量 +} diff --git a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/ScrollPageResponse.java b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/ScrollPageResponse.java new file mode 100644 index 0000000..87031b1 --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/domain/page/ScrollPageResponse.java @@ -0,0 +1,20 @@ +package com.luojia_channel.common.domain.page; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +// 滚动分页请求 +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class ScrollPageResponse { + private Long lastVal; // 上次查询的最小值(用于游标分页) + private Integer offset = 0; // 偏移量(用于分页位置标记) + private Long size = 10L; // 每页数量 + private List records; // 数据列表 +} diff --git a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/utils/RedisUtil.java b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/utils/RedisUtil.java index f04f258..2e8da6a 100644 --- a/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/utils/RedisUtil.java +++ b/珞珈岛-项目相关文件/luojia-island/common/src/main/java/com/luojia_channel/common/utils/RedisUtil.java @@ -1,5 +1,9 @@ package com.luojia_channel.common.utils; +import com.luojia_channel.common.domain.page.PageRequest; +import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageRequest; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -9,10 +13,12 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ZSetOperations; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -42,7 +48,9 @@ public class RedisUtil { return value != null ? type.cast(value) : null; } - public T safeGet(String key, Class type, Supplier cacheLoader, long timeout, TimeUnit timeUnit) { + // 安全地从缓存中取值 + public T safeGet(String key, Class type, Supplier cacheLoader, + long timeout, TimeUnit timeUnit) { T result = get(key, type); if(result != null){ return result; @@ -65,6 +73,42 @@ public class RedisUtil { return get(key, type); } + // 封装基于redis zset的滚动分页查询 + public ScrollPageResponse scrollPageQuery(String key, Class type, + ScrollPageRequest pageRequest, + Function, List> dbFallback) { + long max = pageRequest.getLastVal(); + long offset = pageRequest.getOffset(); + long size = pageRequest.getSize(); + Set> typedTuples = redisTemplate.opsForZSet() + .reverseRangeByScoreWithScores(key, 0, max, offset, size); + if(typedTuples == null || typedTuples.isEmpty()){ + return ScrollPageResponse.builder().build(); + } + // 获取返回的offset与minTime + List ids = new ArrayList<>(); + int returnOffset = 1; + long min = 0; + for (ZSetOperations.TypedTuple tuple : typedTuples) { + Long id = (Long)tuple.getValue(); + ids.add(id); + long lastVal = tuple.getScore().longValue(); + if(lastVal == min){ + returnOffset++; + }else{ + returnOffset = 1; + min = lastVal; + } + } + List dbList = dbFallback.apply(ids); + return ScrollPageResponse.builder() + .records(dbList) + .size(pageRequest.getSize()) + .offset(returnOffset) + .lastVal(min) + .build(); + } + public void set(String key, Object value) { redisTemplate.opsForValue().set(key, value, DEFAULT_TIMEOUT, DEFAULT_TIME_UNIT); } @@ -200,4 +244,27 @@ public class RedisUtil { } + public List> zRevRangeWithScores(String key, long count) { + return zRevRangeWithScores(key, 0, count - 1); + } + + + public List> zRevRangeWithScores(String key, long start, long end) { + Set> tuples = redisTemplate.opsForZSet().reverseRangeWithScores(key, start, end); + return convertTuples(tuples); + } + + + public T zRevMaxValue(String key) { + List> items = zRevRangeWithScores(key, 1); + return items.isEmpty() ? null : items.get(0).getValue(); + } + + + public ZSetItem zRevMaxItem(String key) { + List> items = zRevRangeWithScores(key, 1); + return items.isEmpty() ? null : items.get(0); + } + + } \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/config/RedisConfig.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/config/RedisConfig.class index 658a2e9..10d6bc4 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/config/RedisConfig.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/config/RedisConfig.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/Result.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/Result.class index 01b0a6a..0292b1a 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/Result.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/Result.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO$UserDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO$UserDTOBuilder.class index c9d7c99..6c5d7b1 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO$UserDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO$UserDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO.class index 17f4da3..de8ef17 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/UserDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageRequest.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageRequest.class index 0f1b2e9..1a6409b 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageRequest.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageRequest.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse$PageResponseBuilder.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse$PageResponseBuilder.class index 9fc0167..56c906f 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse$PageResponseBuilder.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse$PageResponseBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse.class index 3de0d3d..fae755e 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/domain/page/PageResponse.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/interceptor/AuthInterceptor.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/interceptor/AuthInterceptor.class index 0f5c82c..8ee05b1 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/interceptor/AuthInterceptor.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/interceptor/AuthInterceptor.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/JWTUtil.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/JWTUtil.class index 96e8a6e..2810290 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/JWTUtil.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/JWTUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/PageUtil.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/PageUtil.class index 041869d..49acd38 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/PageUtil.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/PageUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil$ZSetItem.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil$ZSetItem.class index a2cec13..3aa31a2 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil$ZSetItem.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil$ZSetItem.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil.class index 792a00e..6f92bd9 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/RedisUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/UserContext.class b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/UserContext.class index 700abd7..c140c14 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/UserContext.class and b/珞珈岛-项目相关文件/luojia-island/common/target/classes/com/luojia_channel/common/utils/UserContext.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/ChatController.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/ChatController.java index 4a79a87..ded9eb2 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/ChatController.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/ChatController.java @@ -1,34 +1,41 @@ package com.luojia_channel.modules.interact.controller; -import com.luojia_channel.modules.message.dto.MessageRequest; -import com.luojia_channel.modules.message.server.WebSocketServer; +import com.luojia_channel.common.domain.Result; +import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; +import com.luojia_channel.modules.interact.dto.ChatItemDTO; +import com.luojia_channel.modules.interact.dto.ChatPageQueryDTO; +import com.luojia_channel.modules.interact.service.ChatService; +import com.luojia_channel.modules.message.dto.MessageResponse; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + @RestController +@RequestMapping("/message") @RequiredArgsConstructor -@Tag(name = "聊天模块", description = "好友聊天模块相关接口") public class ChatController { + private final ChatService chatService; - private WebSocketServer webSocketServer; + @Operation( + summary = "聊天列表", + description = "传入分页参数,查询私信用户列表(带最新消息)", + tags = {"私信模块"} + ) + + @GetMapping("/chat-list") + public Result> getChatList(@RequestBody ChatPageQueryDTO chatPageQueryDTO) { + return Result.success(chatService.getChatList(chatPageQueryDTO)); + } - @PostMapping("/sendPrivateMessage") @Operation( - summary = "发送私信", - description = "发送私信给指定用户", - tags = {"聊天模块"} + summary = "历史记录", + description = "传入分页参数,获取与特定用户的完整聊天记录", + tags = {"关注模块"} ) - public String sendPrivateMessage(@RequestParam Long senderId, @RequestBody MessageRequest request) { - try { - webSocketServer.sendPrivateMessage(senderId, request); - return "私信发送成功"; - } catch (Exception e) { - return "私信发送失败: " + e.getMessage(); - } + @GetMapping("/history") + public Result> getChatHistory(@RequestBody ChatPageQueryDTO chatPageQueryDTO) { + return Result.success(chatService.getChatHistory(chatPageQueryDTO)); } } \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/FollowController.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/FollowController.java index 0a96dbe..d033986 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/FollowController.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/controller/FollowController.java @@ -2,7 +2,11 @@ package com.luojia_channel.modules.interact.controller; import com.luojia_channel.common.domain.Result; import com.luojia_channel.common.domain.UserDTO; +import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.modules.interact.service.FollowService; +import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; +import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; @@ -39,11 +43,21 @@ public class FollowController { } @GetMapping("/common/{id}") @Operation( - summary = "关注列表", - description = "传入用户id,返回该用户的关注列表", + summary = "共同关注", + description = "传入用户id,返回该与该用户的共同关注", tags = {"关注模块"} ) public Result> followCommons(@PathVariable("id") Long id){ return Result.success(followService.followCommons(id)); } + + @GetMapping("/post") + @Operation( + summary = "关注收件箱", + description = "传入分页参数,查询关注的人的发帖推送", + tags = {"关注模块"} + ) + public Result> queryPostFollow(@RequestBody PostPageQueryDTO postPageQueryDTO){ + return Result.success(followService.queryPostFollow(postPageQueryDTO)); + } } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/dto/ChatItemDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/dto/ChatItemDTO.java new file mode 100644 index 0000000..b7e5c6f --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/dto/ChatItemDTO.java @@ -0,0 +1,51 @@ +package com.luojia_channel.modules.interact.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Schema(description = "聊天列表项DTO") +public class ChatItemDTO { + @Schema( + description = "聊天对象的用户ID", + required = true, + example = "123456" + ) + private Long chatUserId; + + @Schema( + description = "聊天对象的头像URL", + example = "https://example.com/avatar.jpg" + ) + private String avatar; + + @Schema( + description = "聊天对象的用户名", + required = true, + example = "张三" + ) + private String username; + + @Schema( + description = "最新消息内容", + required = true, + maxLength = 500, + example = "今天下午开会" + ) + private String latestMessage; + + @Schema( + description = "最新消息时间", + required = true, + example = "2023-10-15T14:30:00" + ) + private LocalDateTime latestTime; +} diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/dto/ChatPageQueryDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/dto/ChatPageQueryDTO.java new file mode 100644 index 0000000..8bc958c --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/dto/ChatPageQueryDTO.java @@ -0,0 +1,9 @@ +package com.luojia_channel.modules.interact.dto; + +import com.luojia_channel.common.domain.page.ScrollPageRequest; +import lombok.Data; + +@Data +public class ChatPageQueryDTO extends ScrollPageRequest { + private Long chatUserId; +} diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/ChatService.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/ChatService.java new file mode 100644 index 0000000..d1e679c --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/ChatService.java @@ -0,0 +1,17 @@ +package com.luojia_channel.modules.interact.service; + +import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; +import com.luojia_channel.modules.interact.dto.ChatItemDTO; +import com.luojia_channel.modules.interact.dto.ChatPageQueryDTO; +import com.luojia_channel.modules.message.dto.MessageResponse; +import com.luojia_channel.modules.message.entity.MessageDO; + +import java.util.List; + +public interface ChatService { + + ScrollPageResponse getChatList(ChatPageQueryDTO chatPageQueryDTO); + + ScrollPageResponse getChatHistory(ChatPageQueryDTO chatPageQueryDTO); +} diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/FollowService.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/FollowService.java index 76ff904..60bea56 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/FollowService.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/FollowService.java @@ -2,7 +2,11 @@ package com.luojia_channel.modules.interact.service; import com.baomidou.mybatisplus.extension.service.IService; import com.luojia_channel.common.domain.UserDTO; +import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.modules.interact.entity.Follow; +import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; +import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; import java.util.List; @@ -14,4 +18,6 @@ public interface FollowService extends IService { boolean isFollow(Long followUserId); List followCommons(Long id); + + ScrollPageResponse queryPostFollow(PostPageQueryDTO postPageQueryDTO); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/ChatServiceImpl.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/ChatServiceImpl.java new file mode 100644 index 0000000..8a2a3ae --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/ChatServiceImpl.java @@ -0,0 +1,128 @@ +package com.luojia_channel.modules.interact.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.luojia_channel.common.domain.page.ScrollPageResponse; +import com.luojia_channel.common.utils.PageUtil; +import com.luojia_channel.common.utils.RedisUtil; +import com.luojia_channel.common.utils.UserContext; +import com.luojia_channel.modules.interact.dto.ChatItemDTO; +import com.luojia_channel.modules.interact.dto.ChatPageQueryDTO; +import com.luojia_channel.modules.interact.service.ChatService; +import com.luojia_channel.modules.message.dto.MessageResponse; +import com.luojia_channel.modules.message.entity.MessageDO; +import com.luojia_channel.modules.message.mapper.MessageMapper; +import com.luojia_channel.modules.user.entity.User; +import com.luojia_channel.modules.user.mapper.UserMapper; +import lombok.RequiredArgsConstructor; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + + +@Service +@RequiredArgsConstructor +public class ChatServiceImpl implements ChatService { + + private final MessageMapper messageMapper; + private final UserMapper userMapper; + private final RedisUtil redisUtil; + + @Override + public ScrollPageResponse getChatList(ChatPageQueryDTO chatPageQueryDTO) { + /* + Long userId = UserContext.getUserId(); + IPage chatPage = messageMapper.selectChatList(PageUtil.convert(chatPageQueryDTO), userId); + return PageResponse.builder() + .current(chatPage.getCurrent()) + .size(chatPage.getSize()) + .total(chatPage.getTotal()) + .records(chatPage.getRecords()) + .build(); + */ + Long userId = UserContext.getUserId(); + String key = "chat:user_list:" + userId; + + return redisUtil.scrollPageQuery(key, ChatItemDTO.class, chatPageQueryDTO, + (chatUserIds) -> { + List chatItems = new ArrayList<>(); + List latestMessageIds = new ArrayList<>(); + List users = userMapper.selectByIdsOrderByField(chatUserIds); + for(Long chatUserId : chatUserIds){ + String messageKey = "chat:history:" + Math.min(userId, chatUserId) + ":" +Math.max(userId, chatUserId); + // 获取zset中最新的messageId + Long latestMessageId = redisUtil.zRevMaxValue(messageKey); + latestMessageIds.add(latestMessageId); + } + List messageDOS = messageMapper.selectByIdsOrderByField(latestMessageIds); + int i=0; + for(User user : users){ + ChatItemDTO chatItemDTO = ChatItemDTO.builder() + .chatUserId(user.getId()) + .avatar(user.getAvatar()) + .username(user.getUsername()) + .latestMessage(messageDOS.get(i).getContent()) + .latestTime(messageDOS.get(i).getCreateTime()) + .build(); + chatItems.add(chatItemDTO); + i++; + } + + return chatItems; + }); + } + + @Override + public ScrollPageResponse getChatHistory(ChatPageQueryDTO chatPageQueryDTO) { + /* + Long userId = UserContext.getUserId(); + Long chatUserId = chatPageQueryDTO.getChatUserId(); + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(MessageDO.class) + .eq(MessageDO::getSenderId, userId) + .eq(MessageDO::getReceiverId, chatUserId) + .or() + .eq(MessageDO::getReceiverId, userId) + .eq(MessageDO::getSenderId, chatUserId) + .orderByDesc(MessageDO::getCreateTime); + // 查询的是私信消息 + queryWrapper.eq(MessageDO::getMessageType, 1); + IPage page = messageMapper.selectPage(PageUtil.convert(chatPageQueryDTO), queryWrapper); + User chatUser = userMapper.selectById(chatUserId); + return PageUtil.convert(page, (message) -> { + MessageResponse messageResponse = BeanUtil.copyProperties(message, MessageResponse.class); + if(messageResponse.getSenderId().equals(userId)) { + messageResponse.setSenderAvatar(UserContext.getAvatar()); + messageResponse.setSenderName(UserContext.getUsername()); + }else{ + messageResponse.setSenderAvatar(chatUser.getAvatar()); + messageResponse.setSenderName(chatUser.getUsername()); + } + return messageResponse; + }); + */ + + // 改成滚动分页查询 + Long userId = UserContext.getUserId(); + Long chatUserId = chatPageQueryDTO.getChatUserId(); + String key = "chat:history:" + Math.min(userId, chatUserId) + ":" +Math.max(userId, chatUserId); + return redisUtil.scrollPageQuery(key, MessageResponse.class, chatPageQueryDTO, + (messageIds) -> { + List messageDOS = messageMapper.selectByIdsOrderByField(messageIds); + User chatUser = userMapper.selectById(chatUserId); + List messageResponses = new ArrayList<>(); + for(MessageDO message : messageDOS){ + MessageResponse messageResponse = BeanUtil.copyProperties(message, MessageResponse.class); + if(messageResponse.getSenderId().equals(userId)) { + messageResponse.setSenderAvatar(UserContext.getAvatar()); + messageResponse.setSenderName(UserContext.getUsername()); + }else{ + messageResponse.setSenderAvatar(chatUser.getAvatar()); + messageResponse.setSenderName(chatUser.getUsername()); + } + messageResponses.add(messageResponse); + } + return messageResponses; + }); + } +} diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.java index 5fee543..9b1b33f 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.java @@ -3,19 +3,25 @@ package com.luojia_channel.modules.interact.service.impl; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.luojia_channel.common.domain.UserDTO; +import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; +import com.luojia_channel.common.utils.RedisUtil; import com.luojia_channel.common.utils.UserContext; import com.luojia_channel.modules.interact.entity.Follow; import com.luojia_channel.modules.interact.mapper.FollowMapper; import com.luojia_channel.modules.interact.service.FollowService; +import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; +import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; +import com.luojia_channel.modules.post.entity.Post; +import com.luojia_channel.modules.post.mapper.PostMapper; +import com.luojia_channel.modules.user.entity.User; import com.luojia_channel.modules.user.mapper.UserMapper; import lombok.RequiredArgsConstructor; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; @@ -25,6 +31,9 @@ public class FollowServiceImpl extends ServiceImpl impleme private final FollowMapper followMapper; private final UserMapper userMapper; private final RedisTemplate redisTemplate; + private final RedisUtil redisUtil; + private final PostMapper postMapper; + @Override public void follow(Long followUserId, Boolean isFollow) { Long userId = UserContext.getUserId(); @@ -70,4 +79,29 @@ public class FollowServiceImpl extends ServiceImpl impleme return userDTOS; } + + @Override + public ScrollPageResponse queryPostFollow(PostPageQueryDTO postPageQueryDTO) { + Long userId = UserContext.getUserId(); + String key = "post:follow_of:" + userId; + return redisUtil.scrollPageQuery(key, PostBasicInfoDTO.class, postPageQueryDTO, + (postIds) -> { + List posts = postMapper.selectBatchIds(postIds); + List userIds = posts.stream().map(Post::getUserId).toList(); + List users = userMapper.selectBatchIds(userIds); + Map userMap = users.stream() + .collect(Collectors.toMap(User::getId, user -> user)); + List postBasicInfoDTOS = new ArrayList<>(); + for(Post post : posts){ + User user = userMap.getOrDefault(post.getUserId(), new User()); + PostBasicInfoDTO postBasicInfoDTO = BeanUtil.copyProperties(post, PostBasicInfoDTO.class); + postBasicInfoDTO.setUserName(user.getUsername()); + postBasicInfoDTO.setUserAvatar(user.getAvatar()); + postBasicInfoDTOS.add(postBasicInfoDTO); + } + // 按照发布时间倒序排序 + postBasicInfoDTOS.sort(Comparator.comparing(PostBasicInfoDTO::getCreateTime).reversed()); + return postBasicInfoDTOS; + }); + } } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mapper/MessageMapper.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mapper/MessageMapper.java index d33f5f7..092a0ee 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mapper/MessageMapper.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mapper/MessageMapper.java @@ -1,10 +1,21 @@ package com.luojia_channel.modules.message.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.luojia_channel.modules.interact.dto.ChatItemDTO; import com.luojia_channel.modules.message.entity.MessageDO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; @Mapper public interface MessageMapper extends BaseMapper { + /** + * 查询用户的所有聊天对象(带最新消息预览) + */ + IPage selectChatList(IPage page, @Param("userId") Long userId); + + List selectByIdsOrderByField(@Param("ids") List ids); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mq/consumer/NotificationListener.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mq/consumer/NotificationListener.java index cf0b89b..d9f297a 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mq/consumer/NotificationListener.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/mq/consumer/NotificationListener.java @@ -33,7 +33,7 @@ public class NotificationListener { NotificationMessage message = wrapper.getMessage(); MessageRequest request = BeanUtil.copyProperties(message, MessageRequest.class); Integer messageType = message.getMessageType(); - if (messageType != null && messageType == 0) { + if (messageType != null && !messageType.equals(0)) { webSocketServer.sendPrivateMessage(message.getSenderId(), request); } else { webSocketServer.sendSystemNotification(request); diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/server/WebSocketServer.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/server/WebSocketServer.java index 32bcdf8..4813a44 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/server/WebSocketServer.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/server/WebSocketServer.java @@ -2,14 +2,15 @@ package com.luojia_channel.modules.message.server; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; +import com.luojia_channel.common.utils.RedisUtil; import com.luojia_channel.modules.message.dto.MessageRequest; import com.luojia_channel.modules.message.dto.MessageResponse; import com.luojia_channel.modules.message.entity.MessageDO; import com.luojia_channel.modules.message.mapper.MessageMapper; +import com.luojia_channel.modules.message.util.WebSocketContext; import jakarta.websocket.*; import jakarta.websocket.server.PathParam; import jakarta.websocket.server.ServerEndpoint; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -21,11 +22,9 @@ import java.util.concurrent.ConcurrentHashMap; @ServerEndpoint(value = "/connect/{userId}") @Slf4j @Component -@RequiredArgsConstructor public class WebSocketServer { // 存储在线用户会话 private final static Map CLIENTS = new ConcurrentHashMap<>(); - private final MessageMapper messageMapper; @OnOpen public void onOpen(@PathParam("userId") String userId, @@ -60,16 +59,10 @@ public class WebSocketServer { try { // 解析客户端发送的 JSON 消息 MessageRequest request = JSON.parseObject(message, MessageRequest.class); - switch (request.getMessageType()) { - case 0: - sendPrivateMessage(Long.parseLong(senderId), request); - break; - case 1: - sendSystemNotification(request); - break; - default: - log.warn("未知消息类型: {}", request.getMessageType()); + case 0 -> sendSystemNotification(request); + case 1 -> sendPrivateMessage(Long.parseLong(senderId), request); + default -> log.warn("未知消息类型: {}", request.getMessageType()); } } catch (Exception e) { log.error("消息处理失败: {}", e.getMessage()); @@ -83,7 +76,7 @@ public class WebSocketServer { Session receiverSession = CLIENTS.get(receiverId.toString()); // 构建私信响应 MessageResponse response = MessageResponse.builder() - .messageType(0) + .messageType(request.getMessageType()) .content(request.getContent()) .senderId(senderId) .senderName(request.getSenderName()) @@ -99,14 +92,27 @@ public class WebSocketServer { log.info("接收方 [{}] 不在线,消息无法即时送达", receiverId); } MessageDO message = BeanUtil.copyProperties(response, MessageDO.class); + MessageMapper messageMapper = WebSocketContext.getBean(MessageMapper.class); + RedisUtil redisUtil = WebSocketContext.getBean(RedisUtil.class); messageMapper.insert(message); sendMessage(CLIENTS.get(senderId.toString()), JSON.toJSONString(response)); + // 存储消息至redis + if(request.getMessageType().equals(1)){ + String key = "chat:history:" + Math.min(senderId, receiverId) + ":" +Math.max(senderId, receiverId); + redisUtil.zAdd(key, message.getId(), System.currentTimeMillis()); + String chatListKey = "chat:user_list:" + senderId; + redisUtil.zAdd(chatListKey, receiverId, System.currentTimeMillis()); + chatListKey = "chat:user_list:" + receiverId; + redisUtil.zAdd(chatListKey, senderId, System.currentTimeMillis()); + } } // 发送系统通知 public void sendSystemNotification(MessageRequest request) { MessageResponse response = MessageResponse.builder() - .messageType(1) + .senderId(0L) + .receiverId(0L) + .messageType(request.getMessageType()) .content(request.getContent()) .createTime(LocalDateTime.now()) .build(); @@ -115,6 +121,7 @@ public class WebSocketServer { sendMessage(session, JSON.toJSONString(response)); } MessageDO message = BeanUtil.copyProperties(response, MessageDO.class); + MessageMapper messageMapper = WebSocketContext.getBean(MessageMapper.class); messageMapper.insert(message); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/util/WebSocketContext.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/util/WebSocketContext.java new file mode 100644 index 0000000..b187f63 --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/message/util/WebSocketContext.java @@ -0,0 +1,43 @@ +package com.luojia_channel.modules.message.util; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class WebSocketContext implements ApplicationContextAware { + private static ApplicationContext applicationContext; + + @Override + @Autowired + public void setApplicationContext(ApplicationContext inApplicationContext) throws BeansException { + applicationContext = inApplicationContext; + } + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + public static Object getBean(String name) { + return getApplicationContext().getBean(name); + } + + public static T getBean(Class clazz) { + return getApplicationContext().getBean(clazz); + } + + public static T getBean(String name, Class clazz) { + return getApplicationContext().getBean(name, clazz); + } + + + public static String getActiveProfile() { + String[] activeProfiles = getApplicationContext().getEnvironment().getActiveProfiles(); + if (activeProfiles.length == 0) { + return null; + } + return activeProfiles[0]; + } +} diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/CommentController.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/CommentController.java index f8ef058..a37f304 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/CommentController.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/CommentController.java @@ -2,6 +2,7 @@ package com.luojia_channel.modules.post.controller; import com.luojia_channel.common.domain.Result; import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.common.utils.UserContext; import com.luojia_channel.modules.post.dto.req.CommentPageQueryDTO; import com.luojia_channel.modules.post.dto.req.CommentSaveDTO; @@ -37,9 +38,8 @@ public class CommentController { @ApiResponse(responseCode = "200", description = "创建成功"), @ApiResponse(responseCode = "500", description = "创建失败,请稍后重试") }) - public Result saveComment(@RequestBody CommentSaveDTO commentSaveDTO) { - commentService.saveComment(commentSaveDTO); - return Result.success(); + public Result saveComment(@RequestBody CommentSaveDTO commentSaveDTO) { + return Result.success(commentService.saveComment(commentSaveDTO)); } // 更新评论 @@ -82,8 +82,8 @@ public class CommentController { @ApiResponse(responseCode = "200", description = "获取成功"), @ApiResponse(responseCode = "500", description = "获取失败,帖子ID不合法") }) - public Result> getCommentsByPostId(@RequestBody CommentPageQueryDTO commentPageQueryDTO) { - PageResponse commentList = commentService.getCommentsByPostId(commentPageQueryDTO); + public Result> getCommentsByPostId(@RequestBody CommentPageQueryDTO commentPageQueryDTO) { + ScrollPageResponse commentList = commentService.getCommentsByPostId(commentPageQueryDTO); return Result.success(commentList); } @@ -98,8 +98,8 @@ public class CommentController { @ApiResponse(responseCode = "200", description = "获取成功"), @ApiResponse(responseCode = "500", description = "获取失败,评论ID不合法") }) - public Result> getReplyById(@RequestBody CommentPageQueryDTO commentPageQueryDTO) { - PageResponse commentInfoDTOList = commentService.getReplyById(commentPageQueryDTO); + public Result> getReplyById(@RequestBody CommentPageQueryDTO commentPageQueryDTO) { + ScrollPageResponse commentInfoDTOList = commentService.getReplyById(commentPageQueryDTO); return Result.success(commentInfoDTOList); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/PostController.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/PostController.java index 8bd6860..30c6bc2 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/PostController.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/controller/PostController.java @@ -3,6 +3,7 @@ package com.luojia_channel.modules.post.controller; import com.luojia_channel.common.domain.Result; import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.modules.post.dto.req.PostSaveDTO; import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; @@ -34,9 +35,8 @@ public class PostController { @ApiResponse(responseCode = "200", description = "创建成功"), @ApiResponse(responseCode = "500", description = "创建失败,请稍后重试") }) - public Result savePost(@RequestBody PostSaveDTO postSaveDTO) { - postService.savePost(postSaveDTO); - return Result.success(); + public Result savePost(@RequestBody PostSaveDTO postSaveDTO) { + return Result.success(postService.savePost(postSaveDTO)); } // 设置帖子封面 @@ -107,22 +107,22 @@ public class PostController { @ApiResponse(responseCode = "200", description = "获取成功"), @ApiResponse(responseCode = "500", description = "获取失败,请稍后重试") }) - public Result> pagePost(@RequestBody PostPageQueryDTO postPageQueryDTO) { + public Result> pagePost(@RequestBody PostPageQueryDTO postPageQueryDTO) { return Result.success(postService.pagePost(postPageQueryDTO)); } - // 查看自己的帖子 - @GetMapping("/of/me") + // 查看用户的帖子 + @GetMapping("/user") @Operation( - summary = "查看自己的帖子", + summary = "查看用户的帖子", tags = {"帖子模块"} ) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "获取成功"), @ApiResponse(responseCode = "500", description = "获取失败,请稍后重试") }) - public Result> pagePostOfMe(@RequestBody PostPageQueryDTO postPageQueryDTO) { - return Result.success(postService.pagePostOfMe(postPageQueryDTO)); + public Result> pagePostOfUser(@RequestBody PostPageQueryDTO postPageQueryDTO) { + return Result.success(postService.pagePostOfUser(postPageQueryDTO)); } // 点赞帖子 diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.java index 6fe1058..df85dae 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.java @@ -1,15 +1,20 @@ package com.luojia_channel.modules.post.dto.req; import com.luojia_channel.common.domain.page.PageRequest; +import com.luojia_channel.common.domain.page.ScrollPageRequest; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @Data @Schema(title = "分页查询评论请求DTO") -public class CommentPageQueryDTO extends PageRequest { +public class CommentPageQueryDTO extends ScrollPageRequest { @Schema(title = "帖子ID") private Long postId; @Schema(title = "评论ID") - private Long commentId; + private Long parentCommentId; + + private Boolean orderByTime = true; + + private Boolean orderByHot = false; } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.java index 4a67bc2..8cd5a20 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.java @@ -34,12 +34,8 @@ public class CommentSaveDTO { private Long postId; @Schema( - description = "该评论的父评论id" + description = "该评论的父评论id,若不是回复则传入空值" ) private Long parentCommentId; - @Schema( - description = "该评论的顶级评论id" - ) - private Long topId; } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.java index e0a8e68..d2616d9 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.java @@ -1,9 +1,14 @@ package com.luojia_channel.modules.post.dto.req; import com.luojia_channel.common.domain.page.PageRequest; +import com.luojia_channel.common.domain.page.ScrollPageRequest; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @Data -public class PostPageQueryDTO extends PageRequest { - +public class PostPageQueryDTO extends ScrollPageRequest { + @Schema( + description = "想要查看的用户的id,输入空时为自己的id" + ) + private Long userId; } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.java index d5ab265..b1a27bf 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.java @@ -3,6 +3,8 @@ package com.luojia_channel.modules.post.dto.resp; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.time.LocalDateTime; + @Data @Schema(description = "帖子基本信息") public class PostBasicInfoDTO { @@ -62,4 +64,8 @@ public class PostBasicInfoDTO { description = "匿名情况下用户头像" ) private String userAvatar; + @Schema( + description = "帖子创建时间" + ) + private LocalDateTime createTime; } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.java index 4a7963a..6aa07a1 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.java @@ -3,6 +3,8 @@ package com.luojia_channel.modules.post.dto.resp; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.time.LocalDateTime; + @Data @Schema(description = "修改帖子信息") public class PostInfoDTO { @@ -72,4 +74,8 @@ public class PostInfoDTO { description = "匿名情况下用户头像" ) private String userAvatar; + @Schema( + description = "帖子创建时间" + ) + private LocalDateTime createTime; } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/CommentMapper.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/CommentMapper.java index af525e2..a8804c4 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/CommentMapper.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/CommentMapper.java @@ -2,7 +2,11 @@ package com.luojia_channel.modules.post.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.luojia_channel.modules.post.entity.Comment; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; @Mapper public interface CommentMapper extends BaseMapper { + List selectByIdsOrderByField(@Param("ids") List ids); } \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/PostMapper.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/PostMapper.java index d8f4dea..8a0ba62 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/PostMapper.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/mapper/PostMapper.java @@ -4,7 +4,11 @@ package com.luojia_channel.modules.post.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.luojia_channel.modules.post.entity.Post; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; @Mapper public interface PostMapper extends BaseMapper { + List selectByIdsOrderByField(@Param("ids")List ids); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/CommentService.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/CommentService.java index 3bcb599..be5c0a0 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/CommentService.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/CommentService.java @@ -1,6 +1,7 @@ package com.luojia_channel.modules.post.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.modules.post.dto.req.CommentPageQueryDTO; import com.luojia_channel.modules.post.dto.req.CommentSaveDTO; import com.luojia_channel.modules.post.dto.resp.CommentInfoDTO; @@ -12,15 +13,15 @@ import java.util.List; @Service public interface CommentService { - void saveComment(CommentSaveDTO commentSaveDTO); + Long saveComment(CommentSaveDTO commentSaveDTO); void updateComment(CommentSaveDTO commentSaveDTO); void deleteComment(Long id); - PageResponse getCommentsByPostId(CommentPageQueryDTO commentPageQueryDTO); + ScrollPageResponse getCommentsByPostId(CommentPageQueryDTO commentPageQueryDTO); - PageResponse getReplyById(CommentPageQueryDTO commentPageQueryDTO); + ScrollPageResponse getReplyById(CommentPageQueryDTO commentPageQueryDTO); void likeComment(Long id); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/PostService.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/PostService.java index da9b84b..5be7b4e 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/PostService.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/PostService.java @@ -2,6 +2,7 @@ package com.luojia_channel.modules.post.service; import com.baomidou.mybatisplus.extension.service.IService; import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.modules.post.dto.req.PostSaveDTO; import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; @@ -10,7 +11,7 @@ import com.luojia_channel.modules.post.entity.Post; import org.springframework.web.multipart.MultipartFile; public interface PostService extends IService { - void savePost(PostSaveDTO postSaveDTO); + Long savePost(PostSaveDTO postSaveDTO); String setCover(MultipartFile file); @@ -20,9 +21,9 @@ public interface PostService extends IService { PostInfoDTO getPostDetail(Long id); - PageResponse pagePost(PostPageQueryDTO postPageQueryDTO); + ScrollPageResponse pagePost(PostPageQueryDTO postPageQueryDTO); - PageResponse pagePostOfMe(PostPageQueryDTO postPageQueryDTO); + ScrollPageResponse pagePostOfUser(PostPageQueryDTO postPageQueryDTO); void likePost(Long id); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.java index 548139e..de6dc45 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.common.exception.PostException; import com.luojia_channel.common.exception.UserException; import com.luojia_channel.common.utils.PageUtil; @@ -54,75 +55,102 @@ public class CommentServiceImpl extends ServiceImpl impl @Override @Transactional(rollbackFor = Exception.class) - public void saveComment(CommentSaveDTO commentSaveDTO) { + public Long saveComment(CommentSaveDTO commentSaveDTO) { Long userId = UserContext.getUserId(); - if(userId == null){ + if (userId == null) { throw new UserException("用户未登录"); } validatePostUtil.validateComment(commentSaveDTO); + Comment comment = BeanUtil.copyProperties(commentSaveDTO, Comment.class); - comment.setUserId(UserContext.getUserId()); + comment.setUserId(userId); comment.setCreateTime(LocalDateTime.now()); comment.setUpdateTime(LocalDateTime.now()); - if(!save(comment)){ + if (!save(comment)) { throw new PostException("创建评论失败"); } - Long postId = commentSaveDTO.getPostId(); + // 保存成功后,若为根级评论,设置 topId 为评论 id + if (comment.getParentCommentId() == null) { + comment.setTopId(comment.getId()); + comment.setParentCommentId(0L); + if (!updateById(comment)) { + throw new PostException("更新根级评论 topId 失败"); + } + // 同时,更新帖子的zset列表 + String key = "post:comment_by_time:" + comment.getPostId(); + redisUtil.zAdd(key, comment.getId(), System.currentTimeMillis()); + } + // 帖子的回复数加一 + + Long postId = comment.getPostId(); Post post = postMapper.selectById(postId); if (post == null) { throw new PostException("回复的帖子不存在"); } + post.setCommentCount(post.getCommentCount() + 1); + if(postMapper.updateById(post) <= 0){ + throw new PostException("回复帖子失败"); + } + Long receiveUserId = post.getUserId(); - Long parentCommentId = commentSaveDTO.getParentCommentId(); + Long parentCommentId = comment.getParentCommentId(); // 消息通知,回复帖子 - if(!userId.equals(receiveUserId) && parentCommentId == null) { + if (!userId.equals(receiveUserId) && parentCommentId == 0) { String content = String.format("%s 回复了你的帖子: %s", UserContext.getUsername(), StringUtils.abbreviate(commentSaveDTO.getContent(), 20)); NotificationMessage notificationMessage = NotificationMessage.builder() - .senderId(UserContext.getUserId()) + .senderId(userId) .senderName(UserContext.getUsername()) .senderAvatar(UserContext.getAvatar()) .receiverId(receiveUserId) .content(content) - .messageType(0) + .messageType(2) .build(); notificationProducer.sendMessage(notificationMessage); } - if(parentCommentId != null){ + + if (parentCommentId != 0) { // 是回复的评论 - Comment partentComment = commentMapper.selectById(parentCommentId); - partentComment.setReplyCount(partentComment.getReplyCount() + 1); - int update = commentMapper.updateById(partentComment); - if(update <= 0) { - throw new PostException("回复评论失败"); + Comment parentComment = commentMapper.selectById(parentCommentId); + if (parentComment == null) { + throw new PostException("父评论不存在"); } - Long topId = commentSaveDTO.getTopId(); - // 更新顶级评论回复数 - if(!parentCommentId.equals(topId)){ - LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Comment.class) - .eq(Comment::getId, topId) - .setSql("reply_count = reply_count + 1"); - update = commentMapper.update(null, updateWrapper); - if(update <= 0) { - throw new PostException("回复顶级评论失败"); - } + // 设置顶级评论id + comment.setTopId(parentComment.getTopId()); + updateById(comment); + + // 更新评论的zset回复列表 + String buildKey = String.format("%d_%d", comment.getPostId(), comment.getParentCommentId()); + String key = "comment:reply_by_time:" + buildKey; + + redisUtil.zAdd(key, comment.getId(), System.currentTimeMillis()); + + // 更新顶级评论回复数,当顶级评论与回复评论不同时 + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Comment.class) + .eq(Comment::getId, comment.getTopId()) + .setSql("reply_count = reply_count + 1"); + int update = commentMapper.update(null, updateWrapper); + if (update <= 0) { + throw new PostException("回复顶级评论失败"); } + // 消息通知,回复评论 String content = String.format("%s 回复了你的评论: %s", UserContext.getUsername(), StringUtils.abbreviate(commentSaveDTO.getContent(), 20)); NotificationMessage notificationMessage = NotificationMessage.builder() - .senderId(UserContext.getUserId()) + .senderId(userId) .senderName(UserContext.getUsername()) .senderAvatar(UserContext.getAvatar()) - .receiverId(partentComment.getUserId()) + .receiverId(parentComment.getUserId()) .content(content) - .messageType(0) + .messageType(2) .build(); notificationProducer.sendMessage(notificationMessage); } + return comment.getId(); } @Override @@ -138,6 +166,7 @@ public class CommentServiceImpl extends ServiceImpl impl } @Override + @Transactional(rollbackFor = Exception.class) public void deleteComment(Long id) { validatePostUtil.validateCommentOwnership(id); LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Comment.class) @@ -146,31 +175,83 @@ public class CommentServiceImpl extends ServiceImpl impl if(delete <= 0) { throw new PostException("删除评论失败"); } + Comment comment = commentMapper.selectById(id); + if(comment.getId().equals(comment.getTopId())) { + redisUtil.zRemove("post:comment_by_time:" + comment.getPostId(), comment.getId()); + redisUtil.delete("comment:reply_by_time:" + comment.getTopId()); + }else{ + redisUtil.zRemove("comment:reply_by_time:" + comment.getTopId(), comment.getId()); + } // TODO 如果根评论删除,那么其他评论怎么办,目前做法是删除其下所有的子评论 } // 分页查询一系列根评论 @Override - public PageResponse getCommentsByPostId(CommentPageQueryDTO commentPageQueryDTO) { + public ScrollPageResponse getCommentsByPostId(CommentPageQueryDTO commentPageQueryDTO) { if(commentPageQueryDTO.getPostId() == null || commentPageQueryDTO.getPostId() < 0){ throw new PostException("帖子id不合法"); } + /* LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Comment.class) .eq(Comment::getPostId, commentPageQueryDTO.getPostId()) .eq(Comment::getParentCommentId, 0L) .orderByDesc(Comment::getCreateTime); return getCommentInfoDTOPageResponse(commentPageQueryDTO, queryWrapper); + */ + String key = "post:comment_by_time:" + commentPageQueryDTO.getPostId(); + return redisUtil.scrollPageQuery(key, CommentInfoDTO.class, commentPageQueryDTO, + (commentIds) -> { + List comments = commentMapper.selectByIdsOrderByField(commentIds); + List userIds = new ArrayList<>(); + comments.forEach(comment -> userIds.add(comment.getUserId())); + List users = userMapper.selectBatchIds(userIds); + Map userMap = users.stream() + .collect(Collectors.toMap(User::getId, user -> user)); + List commentInfoDTOS = new ArrayList<>(); + for(Comment comment : comments){ + CommentInfoDTO commentInfoDTO = BeanUtil.copyProperties(comment, CommentInfoDTO.class); + User user = userMap.getOrDefault(comment.getUserId(), new User()); + commentInfoDTO.setUserAvatar(user.getAvatar()); + commentInfoDTO.setUserName(user.getUsername()); + commentInfoDTO.setIsLike(isLikedComment(comment.getId())); + commentInfoDTOS.add(commentInfoDTO); + } + return commentInfoDTOS; + }); } @Override - public PageResponse getReplyById(CommentPageQueryDTO commentPageQueryDTO) { - if(commentPageQueryDTO.getCommentId() == null || commentPageQueryDTO.getCommentId() < 0){ + public ScrollPageResponse getReplyById(CommentPageQueryDTO commentPageQueryDTO) { + if(commentPageQueryDTO.getParentCommentId() == null || commentPageQueryDTO.getParentCommentId() < 0){ throw new PostException("评论id不合法"); } + /* LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Comment.class) .eq(Comment::getTopId, commentPageQueryDTO.getCommentId()) .orderByDesc(Comment::getCreateTime); return getCommentInfoDTOPageResponse(commentPageQueryDTO, queryWrapper); + */ + String buildKey = String.format("%d_%d", commentPageQueryDTO.getPostId(), commentPageQueryDTO.getParentCommentId()); + String key = "comment:reply_by_time:" + buildKey; + return redisUtil.scrollPageQuery(key, CommentInfoDTO.class, commentPageQueryDTO, + (commentIds) -> { + List comments = commentMapper.selectByIdsOrderByField(commentIds); + List userIds = new ArrayList<>(); + comments.forEach(comment -> userIds.add(comment.getUserId())); + List users = userMapper.selectBatchIds(userIds); + Map userMap = users.stream() + .collect(Collectors.toMap(User::getId, user -> user)); + List commentInfoDTOS = new ArrayList<>(); + for(Comment comment : comments){ + CommentInfoDTO commentInfoDTO = BeanUtil.copyProperties(comment, CommentInfoDTO.class); + User user = userMap.getOrDefault(comment.getUserId(), new User()); + commentInfoDTO.setUserAvatar(user.getAvatar()); + commentInfoDTO.setUserName(user.getUsername()); + commentInfoDTO.setIsLike(isLikedComment(comment.getId())); + commentInfoDTOS.add(commentInfoDTO); + } + return commentInfoDTOS; + }); } @Override @@ -208,6 +289,7 @@ public class CommentServiceImpl extends ServiceImpl impl return commentMapper.update(null, updateWrapper) > 0; } + /* 适用于旧版普通分页的转换方法 private PageResponse getCommentInfoDTOPageResponse(CommentPageQueryDTO commentPageQueryDTO, LambdaQueryWrapper queryWrapper) { IPage commentPage = commentMapper.selectPage(PageUtil.convert(commentPageQueryDTO), queryWrapper); List userIds = new ArrayList<>(); @@ -224,6 +306,7 @@ public class CommentServiceImpl extends ServiceImpl impl return commentInfoDTO; }); } + */ private List convertToDTO(List commentList) { List dtos = new ArrayList<>(); diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/PostServiceImpl.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/PostServiceImpl.java index 05b0ade..fb7bebc 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/PostServiceImpl.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/service/impl/PostServiceImpl.java @@ -6,12 +6,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.luojia_channel.common.domain.page.PageResponse; +import com.luojia_channel.common.domain.page.ScrollPageResponse; import com.luojia_channel.common.exception.PostException; import com.luojia_channel.common.exception.UserException; import com.luojia_channel.common.utils.PageUtil; import com.luojia_channel.common.utils.RedisUtil; import com.luojia_channel.common.utils.UserContext; import com.luojia_channel.modules.file.service.impl.FileServiceImpl; +import com.luojia_channel.modules.interact.entity.Follow; +import com.luojia_channel.modules.interact.mapper.FollowMapper; +import com.luojia_channel.modules.interact.service.impl.FollowServiceImpl; +import com.luojia_channel.modules.message.mq.domain.NotificationMessage; import com.luojia_channel.modules.post.dto.req.PostSaveDTO; import com.luojia_channel.modules.post.dto.req.PostPageQueryDTO; import com.luojia_channel.modules.post.dto.resp.PostBasicInfoDTO; @@ -23,8 +28,10 @@ import com.luojia_channel.modules.post.utils.ValidatePostUtil; import com.luojia_channel.modules.user.entity.User; import com.luojia_channel.modules.user.mapper.UserMapper; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.time.LocalDateTime; import java.util.ArrayList; @@ -46,9 +53,12 @@ public class PostServiceImpl extends ServiceImpl implements Po // 匿名用户名与匿名头像 private static final String ANONYMOUS_NAME = "匿名用户"; private static final String ANONYMOUS_AVATAR = ""; + private final FollowMapper followMapper; + private final FollowServiceImpl followService; @Override - public void savePost(PostSaveDTO postSaveDTO) { + @Transactional(rollbackFor = Exception.class) + public Long savePost(PostSaveDTO postSaveDTO) { Long userId = UserContext.getUserId(); if(userId == null){ throw new UserException("用户未登录"); @@ -62,7 +72,21 @@ public class PostServiceImpl extends ServiceImpl implements Po throw new PostException("创建帖子失败"); } redisUtil.delete("post:detail:" + postSaveDTO.getId()); - redisUtil.delete("post:of:user:" + UserContext.getUserId()); + //redisUtil.delete("post:of:user:" + UserContext.getUserId()); + // 非匿名帖子推送给粉丝 + if(post.getStatus().equals(0)){ + List follows = followMapper.selectList(Wrappers.lambdaQuery(Follow.class) + .eq(Follow::getFollowUserId, userId)); + for(Follow follow : follows){ + Long fansId = follow.getUserId(); + String key = "post:follow_of:" + fansId; + redisUtil.zAdd(key, post.getId(), System.currentTimeMillis()); + } + // TODO 消息通知? + } + redisUtil.zAdd("post:time:", post.getId(), System.currentTimeMillis()); + redisUtil.zAdd("post:user:" + userId, post.getId(), System.currentTimeMillis()); + return post.getId(); } @Override @@ -80,23 +104,31 @@ public class PostServiceImpl extends ServiceImpl implements Po if(!updateById(post)){ throw new PostException("更新帖子失败"); } - redisUtil.delete("post:detail:" + postSaveDTO.getId()); - redisUtil.delete("post:of:user:" + UserContext.getUserId()); + // redisUtil.delete("post:detail:" + postSaveDTO.getId()); + // redisUtil.delete("post:of:user:" + UserContext.getUserId()); } @Override public void deletePost(Long id) { validatePostUtil.validatePostOwnership(id); + Long userId = UserContext.getUserId(); int delete = postMapper.deleteById(id); if(delete <= 0){ throw new PostException("删除帖子失败"); } - redisUtil.delete("post:detail:" + id.toString()); - redisUtil.delete("post:of:user:" + UserContext.getUserId()); + // redisUtil.delete("post:detail:" + id.toString()); + // redisUtil.delete("post:of:user:" + UserContext.getUserId()); + redisUtil.delete("post:detail:" + id); + redisUtil.zRemove("post:time:", id); + redisUtil.zRemove("post:user:" + userId, id); } @Override public PostInfoDTO getPostDetail(Long id) { + // TODO + Post oldPost = getById(id); + oldPost.setViewCount(oldPost.getViewCount() + 1); + updateById(oldPost); return redisUtil.safeGet("post:detail:" + id, PostInfoDTO.class, () -> { Post post = getById(id); @@ -119,8 +151,9 @@ public class PostServiceImpl extends ServiceImpl implements Po } @Override - public PageResponse pagePost(PostPageQueryDTO postPageQueryDTO) { + public ScrollPageResponse pagePost(PostPageQueryDTO postPageQueryDTO) { // TODO 目前分页查询直接按照创建时间顺序排序了,未来考虑加入多种规则 + /* 旧版分页逻辑 LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Post.class) .orderByDesc(Post::getCreateTime); IPage postPage = postMapper.selectPage(PageUtil.convert(postPageQueryDTO), queryWrapper); @@ -141,27 +174,58 @@ public class PostServiceImpl extends ServiceImpl implements Po } return postBasicInfoDTO; }); + */ + String key = "post:time:"; + return redisUtil.scrollPageQuery(key, PostBasicInfoDTO.class, postPageQueryDTO, + (postIds) -> { + List userIds = new ArrayList<>(); + List posts = postMapper.selectByIdsOrderByField(postIds); + posts.forEach(comment -> userIds.add(comment.getUserId())); + List users = userMapper.selectBatchIds(userIds); + Map userMap = users.stream() + .collect(Collectors.toMap(User::getId, user -> user)); + // 组装用户头像与名称,批量查询只要查一次数据库 + List postBasicInfoDTOS = new ArrayList<>(); + posts.forEach(post -> { + PostBasicInfoDTO postBasicInfoDTO = BeanUtil.copyProperties(post, PostBasicInfoDTO.class); + User user = userMap.getOrDefault(post.getUserId(), new User()); + postBasicInfoDTO.setUserAvatar(user.getAvatar()); + postBasicInfoDTO.setUserName(user.getUsername()); + if (post.getStatus() == 1) { // 匿名帖子 + postBasicInfoDTO.setUserName(ANONYMOUS_NAME); + postBasicInfoDTO.setUserAvatar(ANONYMOUS_AVATAR); + } + postBasicInfoDTOS.add(postBasicInfoDTO); + }); + return postBasicInfoDTOS; + }); } @Override - public PageResponse pagePostOfMe(PostPageQueryDTO postPageQueryDTO) { - Long userId = UserContext.getUserId(); - if(userId == null){ + public ScrollPageResponse pagePostOfUser(PostPageQueryDTO postPageQueryDTO) { + Long myUserId = UserContext.getUserId(); + if(myUserId == null){ throw new UserException("用户未登录"); } + Long userId = postPageQueryDTO.getUserId()==null ? myUserId : postPageQueryDTO.getUserId(); + /* // 构建包含分页信息的缓存键 String cacheKey = "post:of:user:" + userId + ":page:" + postPageQueryDTO.getCurrent() + ":size:" + postPageQueryDTO.getSize(); return redisUtil.safeGet(cacheKey, PageResponse.class, () -> { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(Post.class) - .eq(Post::getUserId, userId) - .orderByDesc(Post::getCreateTime); + .eq(Post::getUserId, userId); + // 当查询别人时,不显示匿名帖子 + if(!myUserId.equals(userId)){ + queryWrapper.eq(Post::getStatus, 0); + } + queryWrapper.orderByDesc(Post::getCreateTime); IPage postPage = postMapper.selectPage(PageUtil.convert(postPageQueryDTO), queryWrapper); return PageUtil.convert(postPage, post -> { PostBasicInfoDTO postBasicInfoDTO = BeanUtil.copyProperties(post, PostBasicInfoDTO.class); postBasicInfoDTO.setUserAvatar(UserContext.getAvatar()); postBasicInfoDTO.setUserName(UserContext.getUsername()); - if (post.getStatus() == 1) { // 匿名帖子 + if (post.getStatus() == 1) { // 自己的匿名帖子 postBasicInfoDTO.setUserName(ANONYMOUS_NAME); postBasicInfoDTO.setUserAvatar(ANONYMOUS_AVATAR); } @@ -169,6 +233,34 @@ public class PostServiceImpl extends ServiceImpl implements Po }); }, 60, TimeUnit.MINUTES); + */ + String key = "post:user:" + userId; + return redisUtil.scrollPageQuery(key, PostBasicInfoDTO.class, postPageQueryDTO, + (postIds) -> { + List userIds = new ArrayList<>(); + List posts = postMapper.selectByIdsOrderByField(postIds); + posts.forEach(comment -> userIds.add(comment.getUserId())); + List users = userMapper.selectBatchIds(userIds); + Map userMap = users.stream() + .collect(Collectors.toMap(User::getId, user -> user)); + // 组装用户头像与名称,批量查询只要查一次数据库 + List postBasicInfoDTOS = new ArrayList<>(); + for(Post post : posts){ + PostBasicInfoDTO postBasicInfoDTO = BeanUtil.copyProperties(post, PostBasicInfoDTO.class); + User user = userMap.getOrDefault(post.getUserId(), new User()); + postBasicInfoDTO.setUserAvatar(user.getAvatar()); + postBasicInfoDTO.setUserName(user.getUsername()); + if (post.getStatus() == 1) { // 自己的匿名帖子 + if(!userId.equals(user.getId())){ + continue; + } + postBasicInfoDTO.setUserName(ANONYMOUS_NAME); + postBasicInfoDTO.setUserAvatar(ANONYMOUS_AVATAR); + } + postBasicInfoDTOS.add(postBasicInfoDTO); + } + return postBasicInfoDTOS; + }); } private boolean isLikedPost(Long postId){ diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/utils/ValidatePostUtil.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/utils/ValidatePostUtil.java index aa073e4..aa4c809 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/utils/ValidatePostUtil.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/post/utils/ValidatePostUtil.java @@ -65,9 +65,6 @@ public class ValidatePostUtil { if(commentSaveDTO.getParentCommentId() != null && commentSaveDTO.getParentCommentId() < 0){ throw new PostException("父评论id不合法"); } - if(commentSaveDTO.getTopId() != null && commentSaveDTO.getTopId() <= 0){ - throw new PostException("顶级评论id不合法"); - } } public void validateCommentOwnership(Long id) { diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/user/mapper/UserMapper.java b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/user/mapper/UserMapper.java index fdd724e..17e4ad1 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/user/mapper/UserMapper.java +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/java/com/luojia_channel/modules/user/mapper/UserMapper.java @@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.luojia_channel.modules.user.entity.User; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface UserMapper extends BaseMapper { + List selectByIdsOrderByField(List ids); } diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/application-local.yaml b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/application-local.yaml index 4fbcddd..c163548 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/application-local.yaml +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/application-local.yaml @@ -1,36 +1,36 @@ #本地开发环境 - lj: - db: - host: localhost - password: 123456 - redis: - host: localhost - port: 6379 - password: 123456 - rabbitmq: - host: localhost - port: 15672 - username: root - password: 123456 - minio: - endpoint: http://localhost:9000 - accessKey: minioadmin - secretKey: minioadmin +# lj: +# db: +# host: localhost +# password: 123456 +# redis: +# host: localhost +# port: 6379 +# password: 123456 +# rabbitmq: +# host: localhost +# port: 15672 +# username: root +# password: 123456 +# minio: +# endpoint: http://localhost:9000 +# accessKey: minioadmin +# secretKey: minioadmin -#lj: -# db: -# host: 192.168.59.129 -# password: Forely123! -# redis: -# host: 192.168.59.129 -# port: 6379 -# password: Forely123! -# rabbitmq: -# host: 192.168.59.129 -# port: 5672 -# username: admin -# password: Forely123! -# minio: -# endpoint: http://192.168.59.129:9000 -# accessKey: forely -# secretKey: Forely123! +lj: + db: + host: 192.168.59.129 + password: Forely123! + redis: + host: 192.168.59.129 + port: 6379 + password: Forely123! + rabbitmq: + host: 192.168.59.129 + port: 5672 + username: admin + password: Forely123! + minio: + endpoint: http://192.168.59.129:9000 + accessKey: forely + secretKey: Forely123! diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/data.sql b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/data.sql index 56204a5..e69de29 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/data.sql +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/data.sql @@ -1,22 +0,0 @@ -INSERT INTO `post` (`title`, `image`, `content`, `status`, `like_count`, `comment_count`, `favorite_count`, `view_count`, `user_id`, `category_id`) -VALUES - ('秋日散步记', 'http://example.com/images/post1.jpg', '今天去公园散步,看到了很多美丽的景色...', 0, 15, 8, 5, 100, 1, 1), - ('美食推荐', 'http://example.com/images/post2.jpg', '这家餐厅的披萨非常好吃,强烈推荐给大家...', 1, 20, 12, 7, 150, 2, 2), - ('旅行计划', 'http://example.com/images/post3.jpg', '计划下个月去云南旅游,期待已久的旅程...', 0, 10, 5, 3, 80, 3, 3), - ('学习心得', 'http://example.com/images/post4.jpg', '最近学到了一个新的编程技巧,感觉很有用...', 0, 25, 18, 10, 200, 4, 4), - ('电影分享', 'http://example.com/images/post5.jpg', '昨晚看了《无间道》,剧情非常精彩...', 1, 30, 20, 12, 250, 5, 5), - ('健身日常', 'http://example.com/images/post6.jpg', '每天坚持锻炼身体,保持健康的生活方式...', 0, 5, 2, 1, 30, 6, 1), - ('宠物趣事', 'http://example.com/images/post7.jpg', '我家的小狗今天做了件搞笑的事情...', 0, 8, 4, 2, 40, 7, 2), - ('读书笔记', 'http://example.com/images/post8.jpg', '最近读了一本书,《活着》让人深思...', 1, 12, 6, 4, 60, 8, 3), - ('科技前沿', 'http://example.com/images/post9.jpg', '最新的AI技术真的太神奇了,改变了我们的生活...', 0, 18, 9, 6, 90, 9, 4), - ('摄影技巧', 'http://example.com/images/post10.jpg', '分享几个摄影小技巧,让你的照片更加出色...', 0, 22, 11, 8, 110, 10, 5), - ('音乐分享', 'http://example.com/images/post11.jpg', '最近发现了一首好听的歌,一起来听听吧...', 1, 7, 3, 2, 50, 1, 1), - ('烹饪食谱', 'http://example.com/images/post12.jpg', '教大家做一道简单的家常菜...', 0, 14, 7, 5, 70, 2, 2), - ('游戏体验', 'http://example.com/images/post13.jpg', '玩了一个新出的游戏,超级好玩...', 0, 21, 10, 7, 120, 3, 3), - ('时尚搭配', 'http://example.com/images/post14.jpg', '分享我的最新穿搭,希望对你有所帮助...', 1, 9, 4, 3, 45, 4, 4), - ('户外运动', 'http://example.com/images/post15.jpg', '周末和朋友们一起去徒步,真的很放松...', 0, 17, 8, 6, 85, 5, 5), - ('艺术欣赏', 'http://example.com/images/post16.jpg', '欣赏了一些印象派画作,感受到了不一样的美...', 0, 11, 5, 2, 60, 6, 1), - ('创业故事', 'http://example.com/images/post17.jpg', '一位朋友刚刚开始了他的创业之旅,很激动人心...', 1, 13, 6, 4, 75, 7, 2), - ('健康饮食', 'http://example.com/images/post18.jpg', '分享一些健康的饮食习惯,让我们一起变得更健康...', 0, 19, 9, 7, 100, 8, 3), - ('科技创新', 'http://example.com/images/post19.jpg', '最新的科技成果真是令人惊叹,未来可期...', 0, 24, 12, 8, 130, 9, 4), - ('心灵感悟', 'http://example.com/images/post20.jpg', '写下了自己的内心感受,希望能够激励更多的人...', 1, 6, 3, 2, 55, 10, 5); \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/luojia_channel.sql b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/luojia_channel.sql index ac2a900..180d95b 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/luojia_channel.sql +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/db/luojia_channel.sql @@ -157,7 +157,7 @@ CREATE TABLE `view_record` ( DROP TABLE IF EXISTS `message`; CREATE TABLE message ( id BIGINT AUTO_INCREMENT PRIMARY KEY, - message_type TINYINT NOT NULL COMMENT '0-私聊, 1-系统消息', + message_type TINYINT NOT NULL COMMENT '0系统消息,1私信消息,2评论通知', content TEXT NOT NULL, sender_id BIGINT NOT NULL, receiver_id BIGINT NOT NULL, diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/message/MessageMapper.xml b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/message/MessageMapper.xml new file mode 100644 index 0000000..4eb17a5 --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/message/MessageMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/post/CommentMapper.xml b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/post/CommentMapper.xml new file mode 100644 index 0000000..72368c7 --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/post/CommentMapper.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/post/PostMapper.xml b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/post/PostMapper.xml new file mode 100644 index 0000000..26827f9 --- /dev/null +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/post/PostMapper.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/user/UserMapper.xml b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/user/UserMapper.xml index 52fee41..4bd83c3 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/user/UserMapper.xml +++ b/珞珈岛-项目相关文件/luojia-island/service/src/main/resources/mapper/user/UserMapper.xml @@ -2,5 +2,11 @@ - + \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/application-local.yaml b/珞珈岛-项目相关文件/luojia-island/service/target/classes/application-local.yaml index 4fbcddd..c163548 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/target/classes/application-local.yaml +++ b/珞珈岛-项目相关文件/luojia-island/service/target/classes/application-local.yaml @@ -1,36 +1,36 @@ #本地开发环境 - lj: - db: - host: localhost - password: 123456 - redis: - host: localhost - port: 6379 - password: 123456 - rabbitmq: - host: localhost - port: 15672 - username: root - password: 123456 - minio: - endpoint: http://localhost:9000 - accessKey: minioadmin - secretKey: minioadmin +# lj: +# db: +# host: localhost +# password: 123456 +# redis: +# host: localhost +# port: 6379 +# password: 123456 +# rabbitmq: +# host: localhost +# port: 15672 +# username: root +# password: 123456 +# minio: +# endpoint: http://localhost:9000 +# accessKey: minioadmin +# secretKey: minioadmin -#lj: -# db: -# host: 192.168.59.129 -# password: Forely123! -# redis: -# host: 192.168.59.129 -# port: 6379 -# password: Forely123! -# rabbitmq: -# host: 192.168.59.129 -# port: 5672 -# username: admin -# password: Forely123! -# minio: -# endpoint: http://192.168.59.129:9000 -# accessKey: forely -# secretKey: Forely123! +lj: + db: + host: 192.168.59.129 + password: Forely123! + redis: + host: 192.168.59.129 + port: 6379 + password: Forely123! + rabbitmq: + host: 192.168.59.129 + port: 5672 + username: admin + password: Forely123! + minio: + endpoint: http://192.168.59.129:9000 + accessKey: forely + secretKey: Forely123! diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO$CompleteUploadDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO$CompleteUploadDTOBuilder.class index 5fdce66..08e5e9d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO$CompleteUploadDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO$CompleteUploadDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO.class index e7e5572..e12c4ea 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/CompleteUploadDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO$UploadChunkDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO$UploadChunkDTOBuilder.class index 2190746..6fb9feb 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO$UploadChunkDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO$UploadChunkDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO.class index 7158ade..7c6b1d8 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadChunkDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO$UploadFileDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO$UploadFileDTOBuilder.class index 0b1c7bf..f24cc7f 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO$UploadFileDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO$UploadFileDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO.class index 55b8640..00e35ec 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/dto/UploadFileDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile$LjFileBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile$LjFileBuilder.class index b7bf51f..d2d69f7 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile$LjFileBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile$LjFileBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile.class index f5d7a2e..016ed9f 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/entity/LjFile.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/service/impl/FileServiceImpl.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/service/impl/FileServiceImpl.class index 0543b86..1f614e4 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/service/impl/FileServiceImpl.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/service/impl/FileServiceImpl.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/utils/ValidateFileUtil.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/utils/ValidateFileUtil.class index 0c6409e..173e9f7 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/utils/ValidateFileUtil.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/file/utils/ValidateFileUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/ChatController.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/ChatController.class index 935aabf..60e4aef 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/ChatController.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/ChatController.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/FollowController.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/FollowController.class index 1179ab3..b27532a 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/FollowController.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/controller/FollowController.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/entity/Follow.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/entity/Follow.class index 9f48183..cb30d4d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/entity/Follow.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/entity/Follow.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/FollowService.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/FollowService.class index 41761a5..4f73808 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/FollowService.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/FollowService.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.class index 274f92a..8b9c27e 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/interact/service/impl/FollowServiceImpl.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest$MessageRequestBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest$MessageRequestBuilder.class index 8fb836b..281ac1d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest$MessageRequestBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest$MessageRequestBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest.class index 9d5b67e..2afa86d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageRequest.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse$MessageResponseBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse$MessageResponseBuilder.class index 87e59f3..9243d62 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse$MessageResponseBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse$MessageResponseBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse.class index e373231..96c789a 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/dto/MessageResponse.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/entity/MessageDO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/entity/MessageDO.class index 1347a1d..84847ae 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/entity/MessageDO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/entity/MessageDO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mapper/MessageMapper.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mapper/MessageMapper.class index 31ea2eb..b4c0911 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mapper/MessageMapper.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mapper/MessageMapper.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/AbstractSendProduceTemplate.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/AbstractSendProduceTemplate.class index 9d10011..cb56f9d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/AbstractSendProduceTemplate.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/AbstractSendProduceTemplate.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO$BaseSendExtendDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO$BaseSendExtendDTOBuilder.class index acad21c..e01512b 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO$BaseSendExtendDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO$BaseSendExtendDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO.class index c1f317a..4a1f3d2 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/BaseSendExtendDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper$MessageWrapperBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper$MessageWrapperBuilder.class index 19d371c..a62f142 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper$MessageWrapperBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper$MessageWrapperBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper.class index 68ade87..17c6378 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/MessageWrapper.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/consumer/NotificationListener.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/consumer/NotificationListener.class index 46dc55c..18d9e6b 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/consumer/NotificationListener.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/consumer/NotificationListener.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage$NotificationMessageBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage$NotificationMessageBuilder.class index 87221b3..4b2e805 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage$NotificationMessageBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage$NotificationMessageBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage.class index 69fa888..d535fb2 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/mq/domain/NotificationMessage.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/server/WebSocketServer.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/server/WebSocketServer.class index 11faa8d..362c2be 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/server/WebSocketServer.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/message/server/WebSocketServer.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/CommentController.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/CommentController.class index ef7c8ec..e2063b7 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/CommentController.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/CommentController.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/PostController.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/PostController.class index c7ee98b..570f733 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/PostController.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/controller/PostController.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.class index 7e59974..69d29c3 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentPageQueryDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO$CommentSaveDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO$CommentSaveDTOBuilder.class index e85115d..257b14f 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO$CommentSaveDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO$CommentSaveDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.class index f0bb006..b7f6fa4 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/CommentSaveDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.class index ca965bb..9b83d83 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostPageQueryDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostSaveDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostSaveDTO.class index b265d63..cf61e46 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostSaveDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/req/PostSaveDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO$CommentInfoDTOBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO$CommentInfoDTOBuilder.class index 8e887e3..3775f2c 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO$CommentInfoDTOBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO$CommentInfoDTOBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO.class index 2166613..75735d3 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/CommentInfoDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.class index 4e76f42..fd95817 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostBasicInfoDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.class index 1d14de0..56161c4 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/dto/resp/PostInfoDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment$CommentBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment$CommentBuilder.class index 38040fc..6f7d7fa 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment$CommentBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment$CommentBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment.class index ebe5d44..31431b9 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Comment.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post$PostBuilder.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post$PostBuilder.class index 6a40318..045d2f8 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post$PostBuilder.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post$PostBuilder.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post.class index e659d75..3d64655 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/entity/Post.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/CommentMapper.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/CommentMapper.class index 03448b5..b36f04a 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/CommentMapper.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/CommentMapper.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/PostMapper.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/PostMapper.class index 9eb6284..3311768 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/PostMapper.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/mapper/PostMapper.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/CommentService.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/CommentService.class index 3587a11..10ab430 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/CommentService.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/CommentService.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/PostService.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/PostService.class index a82b2f1..f82c73d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/PostService.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/PostService.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.class index 84bea48..d3c7681 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/CommentServiceImpl.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/PostServiceImpl.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/PostServiceImpl.class index 69b44e2..5cfc0b7 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/PostServiceImpl.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/service/impl/PostServiceImpl.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/utils/ValidatePostUtil.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/utils/ValidatePostUtil.class index 2336248..fd4d286 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/utils/ValidatePostUtil.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/post/utils/ValidatePostUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserChangeInfoDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserChangeInfoDTO.class index b267107..89d1e74 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserChangeInfoDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserChangeInfoDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserLoginDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserLoginDTO.class index a446c9e..b1c90bb 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserLoginDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserLoginDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserRegisterDTO.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserRegisterDTO.class index fa0acf3..e331e0b 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserRegisterDTO.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/dto/UserRegisterDTO.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/entity/User.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/entity/User.class index 2a6f89d..0dac3fc 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/entity/User.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/entity/User.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/mapper/UserMapper.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/mapper/UserMapper.class index 2d727d7..7c03b30 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/mapper/UserMapper.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/mapper/UserMapper.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/service/impl/UserLoginServiceImpl.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/service/impl/UserLoginServiceImpl.class index 59625b9..c303f83 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/service/impl/UserLoginServiceImpl.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/service/impl/UserLoginServiceImpl.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/AnonymousUserUtil.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/AnonymousUserUtil.class index 99b7971..e5ccb7d 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/AnonymousUserUtil.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/AnonymousUserUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/ValidateUserUtil.class b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/ValidateUserUtil.class index 0a61216..3414faa 100644 Binary files a/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/ValidateUserUtil.class and b/珞珈岛-项目相关文件/luojia-island/service/target/classes/com/luojia_channel/modules/user/utils/ValidateUserUtil.class differ diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/data.sql b/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/data.sql index 56204a5..e69de29 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/data.sql +++ b/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/data.sql @@ -1,22 +0,0 @@ -INSERT INTO `post` (`title`, `image`, `content`, `status`, `like_count`, `comment_count`, `favorite_count`, `view_count`, `user_id`, `category_id`) -VALUES - ('秋日散步记', 'http://example.com/images/post1.jpg', '今天去公园散步,看到了很多美丽的景色...', 0, 15, 8, 5, 100, 1, 1), - ('美食推荐', 'http://example.com/images/post2.jpg', '这家餐厅的披萨非常好吃,强烈推荐给大家...', 1, 20, 12, 7, 150, 2, 2), - ('旅行计划', 'http://example.com/images/post3.jpg', '计划下个月去云南旅游,期待已久的旅程...', 0, 10, 5, 3, 80, 3, 3), - ('学习心得', 'http://example.com/images/post4.jpg', '最近学到了一个新的编程技巧,感觉很有用...', 0, 25, 18, 10, 200, 4, 4), - ('电影分享', 'http://example.com/images/post5.jpg', '昨晚看了《无间道》,剧情非常精彩...', 1, 30, 20, 12, 250, 5, 5), - ('健身日常', 'http://example.com/images/post6.jpg', '每天坚持锻炼身体,保持健康的生活方式...', 0, 5, 2, 1, 30, 6, 1), - ('宠物趣事', 'http://example.com/images/post7.jpg', '我家的小狗今天做了件搞笑的事情...', 0, 8, 4, 2, 40, 7, 2), - ('读书笔记', 'http://example.com/images/post8.jpg', '最近读了一本书,《活着》让人深思...', 1, 12, 6, 4, 60, 8, 3), - ('科技前沿', 'http://example.com/images/post9.jpg', '最新的AI技术真的太神奇了,改变了我们的生活...', 0, 18, 9, 6, 90, 9, 4), - ('摄影技巧', 'http://example.com/images/post10.jpg', '分享几个摄影小技巧,让你的照片更加出色...', 0, 22, 11, 8, 110, 10, 5), - ('音乐分享', 'http://example.com/images/post11.jpg', '最近发现了一首好听的歌,一起来听听吧...', 1, 7, 3, 2, 50, 1, 1), - ('烹饪食谱', 'http://example.com/images/post12.jpg', '教大家做一道简单的家常菜...', 0, 14, 7, 5, 70, 2, 2), - ('游戏体验', 'http://example.com/images/post13.jpg', '玩了一个新出的游戏,超级好玩...', 0, 21, 10, 7, 120, 3, 3), - ('时尚搭配', 'http://example.com/images/post14.jpg', '分享我的最新穿搭,希望对你有所帮助...', 1, 9, 4, 3, 45, 4, 4), - ('户外运动', 'http://example.com/images/post15.jpg', '周末和朋友们一起去徒步,真的很放松...', 0, 17, 8, 6, 85, 5, 5), - ('艺术欣赏', 'http://example.com/images/post16.jpg', '欣赏了一些印象派画作,感受到了不一样的美...', 0, 11, 5, 2, 60, 6, 1), - ('创业故事', 'http://example.com/images/post17.jpg', '一位朋友刚刚开始了他的创业之旅,很激动人心...', 1, 13, 6, 4, 75, 7, 2), - ('健康饮食', 'http://example.com/images/post18.jpg', '分享一些健康的饮食习惯,让我们一起变得更健康...', 0, 19, 9, 7, 100, 8, 3), - ('科技创新', 'http://example.com/images/post19.jpg', '最新的科技成果真是令人惊叹,未来可期...', 0, 24, 12, 8, 130, 9, 4), - ('心灵感悟', 'http://example.com/images/post20.jpg', '写下了自己的内心感受,希望能够激励更多的人...', 1, 6, 3, 2, 55, 10, 5); \ No newline at end of file diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/luojia_channel.sql b/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/luojia_channel.sql index ac2a900..180d95b 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/luojia_channel.sql +++ b/珞珈岛-项目相关文件/luojia-island/service/target/classes/db/luojia_channel.sql @@ -157,7 +157,7 @@ CREATE TABLE `view_record` ( DROP TABLE IF EXISTS `message`; CREATE TABLE message ( id BIGINT AUTO_INCREMENT PRIMARY KEY, - message_type TINYINT NOT NULL COMMENT '0-私聊, 1-系统消息', + message_type TINYINT NOT NULL COMMENT '0系统消息,1私信消息,2评论通知', content TEXT NOT NULL, sender_id BIGINT NOT NULL, receiver_id BIGINT NOT NULL, diff --git a/珞珈岛-项目相关文件/luojia-island/service/target/classes/mapper/user/UserMapper.xml b/珞珈岛-项目相关文件/luojia-island/service/target/classes/mapper/user/UserMapper.xml index 52fee41..4bd83c3 100644 --- a/珞珈岛-项目相关文件/luojia-island/service/target/classes/mapper/user/UserMapper.xml +++ b/珞珈岛-项目相关文件/luojia-island/service/target/classes/mapper/user/UserMapper.xml @@ -2,5 +2,11 @@ - + \ No newline at end of file