修正SuperAgent任务结果来源消息定位

This commit is contained in:
andy
2026-07-12 14:53:54 +08:00
parent bf796946f9
commit eee37315a0
18 changed files with 789 additions and 86 deletions

View File

@@ -157,6 +157,24 @@ public class MybatisSourceMessageInboxRepository implements SourceMessageInboxRe
return Optional.ofNullable(entity).map(this::toSnapshot);
}
/**
* 根据酒店和外部邮件 ID 查询所有候选 Inbox 记录,调用方负责处理零条或多条的业务语义。
*/
@Override
public List<SourceMessageInboxSnapshot> findByExternalMessageId(String hotelId, String externalMessageId) {
if (!hasText(hotelId) || !hasText(externalMessageId)) {
return List.of();
}
return inboxMapper.selectList(Wrappers.<SourceMessageInboxEntity>lambdaQuery()
.eq(SourceMessageInboxEntity::getHotelId, trim(hotelId))
.eq(SourceMessageInboxEntity::getExternalMessageId, trim(externalMessageId))
.orderByDesc(SourceMessageInboxEntity::getReceivedAt)
.orderByDesc(SourceMessageInboxEntity::getId))
.stream()
.map(this::toSnapshot)
.toList();
}
/**
* 执行 SourceMessage 安全摘要分页查询,只读取列表和详情需要的索引字段。
*/

View File

@@ -50,6 +50,11 @@ public interface SourceMessageInboxRepository {
String channel,
String externalMessageId);
/**
* 按酒店和外部邮件 ID 查询 Inbox 快照,用于外部回调只携带 AgentBus external_message_id 的场景。
*/
List<SourceMessageInboxSnapshot> findByExternalMessageId(String hotelId, String externalMessageId);
/**
* 按查询条件分页读取 Inbox 快照,分页参数已经由 Service 层归一化。
*/