|
@@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
+import com.ruoyi.common.core.text.Convert;
|
|
|
import com.ruoyi.common.exception.user.ProjectException;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.ServletUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.generator.domain.Community.CommunityReturnRecord;
|
|
|
import com.ruoyi.generator.domain.Community.CommunityUserBlock;
|
|
@@ -62,6 +65,11 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
public AjaxResult chatRecord(Long otherUserId, String type) {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
List<CommunityChatMsgVo> chatMsgVos = new ArrayList<>();
|
|
|
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
|
|
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
|
|
+ int offset = (pageNum - 1) * pageSize;
|
|
|
+
|
|
|
+
|
|
|
try {
|
|
|
List<CommunityUserBlock> communityUserBlocks = communityUserBlockMapper.selectList(new QueryWrapper<CommunityUserBlock>()
|
|
|
.eq("user_id", userId)
|
|
@@ -84,7 +92,7 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
})
|
|
|
.orderByDesc("create_time")
|
|
|
);*/
|
|
|
- List<CommunityChatMsg> chatMsgList = communitychatMsgMapper.getChatMsgRecord(userId, otherUserId, type);
|
|
|
+ List<CommunityChatMsg> chatMsgList = communitychatMsgMapper.getChatMsgRecord(userId, otherUserId, type,offset,pageSize);
|
|
|
|
|
|
//更新该消息标记为已读
|
|
|
List<Long> msgId = chatMsgList.stream()
|
|
@@ -250,12 +258,15 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
@GetMapping("/getReturnRecord")
|
|
|
public AjaxResult getReturnRecord(String status, String searchValue) {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
|
|
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
|
|
+ int offset = (pageNum - 1) * pageSize;
|
|
|
List<SysUserVo> sysUserChatVos = null;
|
|
|
List<CommunityReturnRecord> returnRecords = communityReturnRecordService
|
|
|
.getReturnRecord(userId, status);
|
|
|
if (returnRecords != null && !returnRecords.isEmpty()) {
|
|
|
List<Long> returnIds = returnRecords.stream().map(CommunityReturnRecord::getId).collect(Collectors.toList());
|
|
|
- sysUserChatVos = communityChatMsgService.getChatListWithLatestMessage(userId, "anonymous", searchValue, returnIds);
|
|
|
+ sysUserChatVos = communityChatMsgService.getChatListWithLatestMessage(userId, "anonymous", searchValue, returnIds,offset,pageSize);
|
|
|
if (!sysUserChatVos.isEmpty()) {
|
|
|
for (SysUserVo sysUserChatVo : sysUserChatVos) {
|
|
|
CommunityReturnRecord returnRecord = communityReturnRecordService.getOne(new QueryWrapper<CommunityReturnRecord>().eq("id", sysUserChatVo.getReturnRecordId()));
|