实现前端P0订单任务查询接口
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
package cn.nianxx.thhotel.platform.message.repository;
|
||||
|
||||
import cn.nianxx.thhotel.platform.message.common.request.CaptureSourceMessageMedia;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageInboxDraft;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageInboxSnapshot;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageOriginalAccessAuditDraft;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageOriginalContent;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageOriginalMediaItem;
|
||||
import cn.nianxx.thhotel.platform.message.common.result.SourceMessagePageResult;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.SourceMessageQueryRequest;
|
||||
import cn.nianxx.thhotel.platform.message.common.enums.SourceMessageBodyContentType;
|
||||
import cn.nianxx.thhotel.platform.message.common.enums.SourceMessageCaptureStatus;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.CaptureSourceMessageMedia;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.SourceMessageQueryRequest;
|
||||
import cn.nianxx.thhotel.platform.message.common.result.SourceMessagePageResult;
|
||||
import cn.nianxx.thhotel.platform.message.domain.SourceMessageBodyEntity;
|
||||
import cn.nianxx.thhotel.platform.message.domain.SourceMessageInboxEntity;
|
||||
import cn.nianxx.thhotel.platform.message.domain.SourceMessageMediaEntity;
|
||||
@@ -112,6 +112,34 @@ public class MybatisSourceMessageInboxRepository implements SourceMessageInboxRe
|
||||
return new SourceMessagePageResult<>(items, page.getTotal(), pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按安全摘要关键词查询 SourceMessage ID。这里只查询列表可展示字段,不触碰正文、HTML、附件 URL 或 payload。
|
||||
*/
|
||||
@Override
|
||||
public List<Long> findIdsBySafeKeyword(String hotelId, String keyword, int limit) {
|
||||
if (!hasText(keyword) || limit < 1) {
|
||||
return List.of();
|
||||
}
|
||||
String trimmedKeyword = trim(keyword);
|
||||
Page<SourceMessageInboxEntity> page = inboxMapper.selectPage(Page.of(1, limit),
|
||||
Wrappers.<SourceMessageInboxEntity>lambdaQuery()
|
||||
.eq(hasText(hotelId), SourceMessageInboxEntity::getHotelId, trim(hotelId))
|
||||
.and(wrapper -> wrapper
|
||||
.like(SourceMessageInboxEntity::getExternalMessageId, trimmedKeyword)
|
||||
.or()
|
||||
.like(SourceMessageInboxEntity::getExternalConversationId, trimmedKeyword)
|
||||
.or()
|
||||
.like(SourceMessageInboxEntity::getSenderSummary, trimmedKeyword)
|
||||
.or()
|
||||
.like(SourceMessageInboxEntity::getSubject, trimmedKeyword)
|
||||
.or()
|
||||
.like(SourceMessageInboxEntity::getSafeSnippet, trimmedKeyword))
|
||||
.orderByDesc(SourceMessageInboxEntity::getReceivedAt));
|
||||
return page.getRecords().stream()
|
||||
.map(SourceMessageInboxEntity::getId)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入 Inbox 主记录及原始 payload;RECEIVED 状态额外保存正文和媒体引用。
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageOriginalConten
|
||||
import cn.nianxx.thhotel.platform.message.common.result.SourceMessagePageResult;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.SourceMessageQueryRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,11 @@ public interface SourceMessageInboxRepository {
|
||||
int pageNum,
|
||||
int pageSize);
|
||||
|
||||
/**
|
||||
* 按来源消息安全摘要关键词查询内部 SourceMessage ID,只匹配普通列表可展示字段。
|
||||
*/
|
||||
List<Long> findIdsBySafeKeyword(String hotelId, String keyword, int limit);
|
||||
|
||||
/**
|
||||
* 插入 Inbox 及其 payload/body/media 子记录,返回内部 SourceMessage ID。
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.nianxx.thhotel.platform.message.service;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageSummaryResponse;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.SourceMessageQueryRequest;
|
||||
import cn.nianxx.thhotel.platform.message.common.result.SourceMessagePageResult;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -18,6 +19,15 @@ public interface SourceMessageQueryService {
|
||||
*/
|
||||
SourceMessagePageResult<SourceMessageSummaryResponse> query(SourceMessageQueryRequest request);
|
||||
|
||||
/**
|
||||
* 按来源消息安全摘要关键词查询内部 SourceMessage ID,供业务列表做安全关联过滤。
|
||||
*
|
||||
* @param hotelId 酒店上下文 ID
|
||||
* @param keyword 来源消息安全摘要关键词
|
||||
* @return 匹配的内部 SourceMessage ID 列表
|
||||
*/
|
||||
List<Long> findIdsBySafeKeyword(String hotelId, String keyword);
|
||||
|
||||
/**
|
||||
* 按内部 SourceMessage ID 读取单条安全摘要。
|
||||
*
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package cn.nianxx.thhotel.platform.message.service.impl;
|
||||
|
||||
import cn.nianxx.thhotel.platform.message.repository.SourceMessageInboxRepository;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageInboxSnapshot;
|
||||
import cn.nianxx.thhotel.platform.message.common.result.SourceMessagePageResult;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.SourceMessageQueryRequest;
|
||||
import cn.nianxx.thhotel.platform.message.service.SourceMessageQueryService;
|
||||
import cn.nianxx.thhotel.platform.message.common.dto.SourceMessageSummaryResponse;
|
||||
import cn.nianxx.thhotel.platform.message.common.request.SourceMessageQueryRequest;
|
||||
import cn.nianxx.thhotel.platform.message.common.result.SourceMessagePageResult;
|
||||
import cn.nianxx.thhotel.platform.message.repository.SourceMessageInboxRepository;
|
||||
import cn.nianxx.thhotel.platform.message.service.SourceMessageQueryService;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
@@ -22,6 +22,7 @@ public class SourceMessageQueryServiceImpl implements SourceMessageQueryService
|
||||
private static final int DEFAULT_PAGE_NUM = 1;
|
||||
private static final int DEFAULT_PAGE_SIZE = 20;
|
||||
private static final int MAX_PAGE_SIZE = 100;
|
||||
private static final int MAX_SAFE_KEYWORD_MATCHES = 500;
|
||||
|
||||
private final SourceMessageInboxRepository inboxRepository;
|
||||
|
||||
@@ -44,6 +45,14 @@ public class SourceMessageQueryServiceImpl implements SourceMessageQueryService
|
||||
return new SourceMessagePageResult<>(items, page.total(), pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询匹配来源消息安全摘要关键词的内部 SourceMessage ID,供业务查询做关联过滤。
|
||||
*/
|
||||
@Override
|
||||
public List<Long> findIdsBySafeKeyword(String hotelId, String keyword) {
|
||||
return inboxRepository.findIdsBySafeKeyword(hotelId, keyword, MAX_SAFE_KEYWORD_MATCHES);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取单条 SourceMessage 安全摘要,不返回正文、HTML、媒体 URL 或原始 payload。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user