Commit 4148de28 authored by shiyu's avatar shiyu

校验重复关注

parent dbd33291
...@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.awt.*; import java.awt.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -103,6 +104,7 @@ public class MessageServiceImpl implements MessageService { ...@@ -103,6 +104,7 @@ public class MessageServiceImpl implements MessageService {
@Override @Override
public Result findList(MessageRequestDto messageRequestDto) { public Result findList(MessageRequestDto messageRequestDto) {
try { try {
List<MessageVo> messageVos = new ArrayList<>();
MessageRecordRequestDto messageRecordRequestDto = new MessageRecordRequestDto(); MessageRecordRequestDto messageRecordRequestDto = new MessageRecordRequestDto();
messageRecordRequestDto.setReceiverId(messageRequestDto.getReceiverId()); messageRecordRequestDto.setReceiverId(messageRequestDto.getReceiverId());
messageRecordRequestDto.setType(messageRequestDto.getType()); messageRecordRequestDto.setType(messageRequestDto.getType());
...@@ -110,10 +112,13 @@ public class MessageServiceImpl implements MessageService { ...@@ -110,10 +112,13 @@ public class MessageServiceImpl implements MessageService {
PageInfo<MessageRecord> pageInfo = new PageInfo<>(list); PageInfo<MessageRecord> pageInfo = new PageInfo<>(list);
//消息id //消息id
List<Integer> idList = list.stream().map(MessageRecord::getMessageId).collect(Collectors.toList()); List<Integer> idList = list.stream().map(MessageRecord::getMessageId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(idList)) {
return Result.success(PageSearchResult.of(pageInfo, messageVos));
}
//查询消息内容 //查询消息内容
List<MessageContent> messageContentList = messageContentDao.findListByIds(idList); List<MessageContent> messageContentList = messageContentDao.findListByIds(idList);
Map<Integer, MessageContent> messageContentMap = messageContentList.stream().collect(Collectors.toMap(MessageContent::getId, Function.identity())); Map<Integer, MessageContent> messageContentMap = messageContentList.stream().collect(Collectors.toMap(MessageContent::getId, Function.identity()));
List<MessageVo> messageVos = new ArrayList<>();
list.forEach(m -> { list.forEach(m -> {
MessageVo messageVo = new MessageVo(); MessageVo messageVo = new MessageVo();
messageVo.setMessageRecordId(m.getId()); messageVo.setMessageRecordId(m.getId());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment