Commit fa5dedba by 王祖波

获取时间最相近的一条

parent 85f61540
...@@ -898,13 +898,17 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -898,13 +898,17 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
if(qwDTO.needOpenUserId3th()) { if(qwDTO.needOpenUserId3th()) {
wxUserId = staff.getWxOpenUseId() ; wxUserId = staff.getWxOpenUseId() ;
} }
Long sendTimeSec = sendTime.getTime() / 1000;
// 发送到群 // 发送到群
List<QywxGroupMessageInfoDTO> msgList = this.queryGroupMsg(groupMsgChatType,startTime, endTime, qwDTO, wxUserId); List<QywxGroupMessageInfoDTO> msgList = this.queryGroupMsg(groupMsgChatType,startTime, endTime, qwDTO, wxUserId);
if(CollectionUtils.isNotEmpty(msgList)) { if(CollectionUtils.isNotEmpty(msgList)) {
if(msgList.size()==0) { if(msgList.size()==0) {
return msgList.get(0).getMsgId() ; return msgList.get(0).getMsgId() ;
}else { }else {
return msgList.get(msgList.size()-1).getMsgId() ; return msgList.stream()
.min(Comparator.comparingLong(msg -> Math.abs(msg.getCreateTime() - sendTimeSec)))
.map(QywxGroupMessageInfoDTO::getMsgId)
.orElse(null);
} }
} }
return null ; return null ;
......
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