修复邮件会话隐藏技术订单展示
This commit is contained in:
@@ -7,6 +7,7 @@ import cn.nianxx.thhotel.platform.message.service.SourceMessageRelatedContextPro
|
||||
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationAiQueryOrderSnapshot;
|
||||
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationAiQueryTaskSnapshot;
|
||||
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationOrderKeyType;
|
||||
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationOrderVisibility;
|
||||
import cn.nianxx.thhotel.workflows.reservation.repository.ReservationAiWorkflowRepository;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -54,16 +55,27 @@ public class ReservationSourceMessageRelatedContextProvider implements SourceMes
|
||||
List<ReservationAiQueryTaskSnapshot> tasks) {
|
||||
Map<Long, ReservationAiQueryOrderSnapshot> ordersById = new LinkedHashMap<>();
|
||||
workflowRepository.findAiQueryOrdersBySourceMessageIds(hotelId, List.of(sourceMessageId))
|
||||
.stream()
|
||||
.filter(this::isVisibleBusinessOrder)
|
||||
.forEach(order -> ordersById.put(order.id(), order));
|
||||
List<Long> taskOrderIds = tasks.stream()
|
||||
.map(ReservationAiQueryTaskSnapshot::orderId)
|
||||
.distinct()
|
||||
.toList();
|
||||
workflowRepository.findAiQueryOrdersByIds(hotelId, taskOrderIds)
|
||||
.stream()
|
||||
.filter(this::isVisibleBusinessOrder)
|
||||
.forEach(order -> ordersById.put(order.id(), order));
|
||||
return ordersById;
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件会话只展示真实业务订单,S000/S999 等隐藏技术订单只通过任务摘要可见。
|
||||
*/
|
||||
private boolean isVisibleBusinessOrder(ReservationAiQueryOrderSnapshot order) {
|
||||
return order != null && !ReservationOrderVisibility.HIDDEN_SYSTEM.name().equals(order.orderVisibility());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换订单快照为 SourceMessage 会话可展示的关联订单摘要。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user