Commit 92cdf0fb by songyinghui

feat: 取当前用户分享朋友圈最近的一个

parent 4ba0c821
......@@ -488,19 +488,11 @@ public class GroupMessageServiceImpl implements GroupMessageService {
}
long filterTime = createTime.getTime() / 1000;
Optional<QywxMomentRespDTO.QywxMomentInfoDTO> before = serviceResponse.getResult().getQywxMomentInfos()
Optional<QywxMomentRespDTO.QywxMomentInfoDTO> min = serviceResponse.getResult().getQywxMomentInfos()
.stream()
.filter(item -> item.getCreateTime() - filterTime <= 0)
.min((first, second) -> (int) (second.getCreateTime() - first.getCreateTime()));
if (before.isPresent()) {
return this.queryMomentSendResultList(corpid, userId, before.get().getMomentId());
}
Optional<QywxMomentRespDTO.QywxMomentInfoDTO> after = serviceResponse.getResult().getQywxMomentInfos()
.stream()
.filter(item -> item.getCreateTime() - filterTime >= 0)
.min((first, second) -> (int) (second.getCreateTime() - first.getCreateTime()));
if (after.isPresent()) {
return this.queryMomentSendResultList(corpid, userId, after.get().getMomentId());
.min((first, second) -> (int) (Math.abs(first.getCreateTime() - filterTime) - Math.abs(second.getCreateTime() - filterTime)));
if (min.isPresent()) {
return this.queryMomentSendResultList(corpid, userId, min.get().getMomentId());
}
return Collections.emptyList();
}
......
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