增加 SuperAgent 邮件会话查询接口
This commit is contained in:
@@ -110,6 +110,30 @@ public class MybatisSourceMessageInboxRepository implements SourceMessageInboxRe
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定来源和渠道下的同一外部会话,避免不同接入方会话 ID 偶然相同导致串数据。
|
||||
*/
|
||||
@Override
|
||||
public List<SourceMessageInboxSnapshot> findByExternalConversationId(
|
||||
String hotelId,
|
||||
String provider,
|
||||
String channel,
|
||||
String externalConversationId) {
|
||||
if (!hasText(hotelId) || !hasText(provider) || !hasText(channel) || !hasText(externalConversationId)) {
|
||||
return List.of();
|
||||
}
|
||||
return inboxMapper.selectList(Wrappers.<SourceMessageInboxEntity>lambdaQuery()
|
||||
.eq(SourceMessageInboxEntity::getHotelId, trim(hotelId))
|
||||
.eq(SourceMessageInboxEntity::getProvider, trim(provider))
|
||||
.eq(SourceMessageInboxEntity::getChannel, trim(channel))
|
||||
.eq(SourceMessageInboxEntity::getExternalConversationId, trim(externalConversationId))
|
||||
.orderByAsc(SourceMessageInboxEntity::getReceivedAt)
|
||||
.orderByAsc(SourceMessageInboxEntity::getId))
|
||||
.stream()
|
||||
.map(this::toSnapshot)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 SourceMessage 幂等键读取已有记录,用于重复投递判断。
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,15 @@ public interface SourceMessageInboxRepository {
|
||||
*/
|
||||
List<SourceMessageInboxSnapshot> findByExternalConversationId(String hotelId, String externalConversationId);
|
||||
|
||||
/**
|
||||
* 按酒店、来源、渠道和外部邮件会话 ID 查询同一会话全部 Inbox 安全快照。
|
||||
*/
|
||||
List<SourceMessageInboxSnapshot> findByExternalConversationId(
|
||||
String hotelId,
|
||||
String provider,
|
||||
String channel,
|
||||
String externalConversationId);
|
||||
|
||||
/**
|
||||
* 按酒店、来源、渠道、外部邮件 ID 查询幂等记录。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user