补充订单列表V4入口回归验证

This commit is contained in:
andy
2026-07-20 11:00:31 +07:00
parent 4b05cabd13
commit dfafd2c095
3 changed files with 52 additions and 12 deletions

View File

@@ -26,6 +26,7 @@ import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationOrderSnapsh
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationTaskDraft;
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationV4OrderTaskDraft;
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationV4OrderTaskSnapshot;
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationV4SourceNotificationDraft;
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationV4TaskCardDraft;
import cn.nianxx.thhotel.workflows.reservation.common.dto.ReservationV4TaskCardSnapshot;
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationOrderKeyType;
@@ -34,9 +35,11 @@ import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationOrderVisi
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationTaskStatus;
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationV4CardStatus;
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationV4CardType;
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationV4NotificationStatus;
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationV4OrderTaskStatus;
import cn.nianxx.thhotel.workflows.reservation.common.enums.ReservationV4TargetResolutionStatus;
import cn.nianxx.thhotel.workflows.reservation.repository.ReservationAiWorkflowRepository;
import cn.nianxx.thhotel.workflows.reservation.repository.ReservationV4SourceNotificationRepository;
import cn.nianxx.thhotel.workflows.reservation.repository.ReservationV4WorkflowRepository;
import java.sql.Timestamp;
import java.time.Instant;
@@ -86,6 +89,9 @@ class ReservationFrontendQueryControllerTest {
@Autowired
private ReservationV4WorkflowRepository v4WorkflowRepository;
@Autowired
private ReservationV4SourceNotificationRepository sourceNotificationRepository;
@Autowired
private JdbcTemplate jdbcTemplate;
@@ -640,6 +646,11 @@ class ReservationFrontendQueryControllerTest {
ReservationV4CardStatus.PENDING_CONFIRM.name(), null, "{}");
insertV4TaskCard(basicFirstOrderTask, ReservationV4CardType.ROOM_INFORMATION.name(), "NEW_BOOKING", 1, 30,
ReservationV4CardStatus.REVIEW_REQUIRED.name(), "PENDING", "{}");
insertV4SourceNotification(
source.inboxId(),
930000000000004901L,
"S10",
Instant.parse("2026-07-08T06:45:00Z"));
ReservationV4OrderTaskSnapshot laterOrderTask = insertV4OrderTask(
930000000000004102L,
source,
@@ -700,6 +711,15 @@ class ReservationFrontendQueryControllerTest {
completedOrderTask.id(),
ReservationV4OrderTaskStatus.COMPLETED.name(),
completedOrderTask.updatedAt());
SourceMessageCaptureResult standaloneNotificationSource = captureSourceMessage(
"mail-frontend-order-list-v4-cp14-s99-standalone",
"GRP-FRONTEND-V4-CP14-S99 standalone notification",
Instant.parse("2026-07-08T11:30:00Z"));
insertV4SourceNotification(
standaloneNotificationSource.inboxId(),
930000000000004902L,
"S99",
Instant.parse("2026-07-08T11:30:00Z"));
performAuthorized(mockMvc, adminToken(), get("/api/reservation/orders")
.param("hotel_id", HOTEL_ID)
@@ -707,6 +727,7 @@ class ReservationFrontendQueryControllerTest {
.param("page_num", "1")
.param("page_size", "20"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.page.total").value(5))
.andExpect(jsonPath("$.items[?(@.order_id=='" + basicFirstOrderId + "')].next_processable_task_id")
.value(contains(legacyTaskId.toString())))
.andExpect(jsonPath("$.items[?(@.order_id=='" + basicFirstOrderId + "')].v4_open_order_task_count")
@@ -857,6 +878,25 @@ class ReservationFrontendQueryControllerTest {
now));
}
private void insertV4SourceNotification(
Long sourceMessageId,
Long aiBatchId,
String routeCode,
Instant sourceReceivedAt) {
sourceNotificationRepository.findOrCreateSourceNotification(new ReservationV4SourceNotificationDraft(
HOTEL_ID,
sourceMessageId,
aiBatchId,
null,
routeCode,
ReservationV4NotificationStatus.ACK_REQUIRED.name(),
"""
{"route_code":"%s","source_message":{"body":"S10/S99 notification should stay outside orders"}}
""".formatted(routeCode),
LocalDateTime.ofInstant(sourceReceivedAt, ZoneOffset.UTC),
LocalDateTime.ofInstant(sourceReceivedAt.plusSeconds(20), ZoneOffset.UTC)));
}
private ReservationV4TaskCardSnapshot insertV4TaskCard(
ReservationV4OrderTaskSnapshot orderTask,
String cardType,