Commit 4148de28 authored by shiyu's avatar shiyu

校验重复关注

parent dbd33291
......@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.awt.*;
import java.text.SimpleDateFormat;
......@@ -103,6 +104,7 @@ public class MessageServiceImpl implements MessageService {
@Override
public Result findList(MessageRequestDto messageRequestDto) {
try {
List<MessageVo> messageVos = new ArrayList<>();
MessageRecordRequestDto messageRecordRequestDto = new MessageRecordRequestDto();
messageRecordRequestDto.setReceiverId(messageRequestDto.getReceiverId());
messageRecordRequestDto.setType(messageRequestDto.getType());
......@@ -110,10 +112,13 @@ public class MessageServiceImpl implements MessageService {
PageInfo<MessageRecord> pageInfo = new PageInfo<>(list);
//消息id
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);
Map<Integer, MessageContent> messageContentMap = messageContentList.stream().collect(Collectors.toMap(MessageContent::getId, Function.identity()));
List<MessageVo> messageVos = new ArrayList<>();
list.forEach(m -> {
MessageVo messageVo = new MessageVo();
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