停止V4入站双写旧任务

This commit is contained in:
andy
2026-07-20 17:18:28 +07:00
parent d45ff5b4ed
commit 626e87abdb
16 changed files with 438 additions and 69 deletions

View File

@@ -877,6 +877,8 @@ class ReservationFrontendQueryControllerTest {
.value(contains(0)))
.andExpect(jsonPath("$.items[?(@.order_id=='" + completedOnlyOrderId + "')].next_v4_order_task_id")
.value(contains(nullValue())))
.andExpect(jsonPath("$.items[?(@.order_id=='" + completedOnlyOrderId + "')].next_processable_task_id")
.value(contains(nullValue())))
.andExpect(jsonPath("$.items[?(@.order_id=='" + completedOnlyOrderId + "')].next_v4_action_type")
.value(contains("NONE")))
.andExpect(jsonPath("$.items[?(@.order_id=='" + completedOnlyOrderId + "')].next_v4_action_status")

View File

@@ -990,7 +990,7 @@ class SuperAgentTaskResultControllerTest {
}
@Test
void shouldCreateBusinessTasksFromV4OrderContextsAndMessageEventsInOrder() throws Exception {
void shouldCreateV4OrderTaskAndCardsWithoutLegacyTaskDualWrite() throws Exception {
SourceMessageCaptureResult source = captureSourceMessage("mail-v4-business-root-001");
String body = v4BusinessRootBody("mail-v4-business-root-001");
@@ -1003,13 +1003,17 @@ class SuperAgentTaskResultControllerTest {
.andExpect(jsonPath("$.items[0].route_code").value("R02_NEW_GROUP_BLOCK_NORMAL"))
.andExpect(jsonPath("$.items[0].system_task_type").value("NEW_BOOKING"))
.andExpect(jsonPath("$.items[0].task_card_type").value("NEW_BOOKING"))
.andExpect(jsonPath("$.items[0].execution_order").value(1))
.andExpect(jsonPath("$.items[0].task_id").doesNotExist())
.andExpect(jsonPath("$.items[0].task_status").doesNotExist())
.andExpect(jsonPath("$.items[0].execution_order").doesNotExist())
.andExpect(jsonPath("$.items[1].source_event_index").value(2))
.andExpect(jsonPath("$.items[1].array_index").value(2))
.andExpect(jsonPath("$.items[1].route_code").value("R10_PAYMENT_EVIDENCE_NORMAL"))
.andExpect(jsonPath("$.items[1].system_task_type").value("UPDATE_BOOKING"))
.andExpect(jsonPath("$.items[1].task_card_type").value("PAYMENT_EVIDENCE"))
.andExpect(jsonPath("$.items[1].execution_order").value(2))
.andExpect(jsonPath("$.items[1].task_id").doesNotExist())
.andExpect(jsonPath("$.items[1].task_status").doesNotExist())
.andExpect(jsonPath("$.items[1].execution_order").doesNotExist())
.andReturn();
String firstOrderId = com.jayway.jsonpath.JsonPath.read(
@@ -1069,6 +1073,12 @@ class SuperAgentTaskResultControllerTest {
)
""", Long.class, source.inboxId());
assertThat(v4CardStatusCount).isEqualTo(4L);
Long legacyTaskCount = jdbcTemplate.queryForObject("""
SELECT COUNT(*)
FROM workflow_reservation_task
WHERE source_message_id = ?
""", Long.class, source.inboxId());
assertThat(legacyTaskCount).isZero();
String sourceDisplayPayload = jdbcTemplate.queryForObject("""
SELECT display_payload_json
@@ -1115,8 +1125,8 @@ class SuperAgentTaskResultControllerTest {
mockMvc.perform(signedPost(body, "nonce-v4-two-order-refs-001"))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.accepted_count").value(2))
.andExpect(jsonPath("$.items[0].execution_order").value(1))
.andExpect(jsonPath("$.items[1].execution_order").value(1));
.andExpect(jsonPath("$.items[0].execution_order").doesNotExist())
.andExpect(jsonPath("$.items[1].execution_order").doesNotExist());
List<String> orderRefs = jdbcTemplate.queryForList("""
SELECT order_ref
@@ -1148,7 +1158,8 @@ class SuperAgentTaskResultControllerTest {
mockMvc.perform(signedPost(body, "nonce-v4-fit-booking-code-001"))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.accepted_count").value(1))
.andExpect(jsonPath("$.items[0].order_status").value("TEMPORARY"));
.andExpect(jsonPath("$.items[0].order_id").doesNotExist())
.andExpect(jsonPath("$.items[0].order_status").doesNotExist());
Long unresolvedCount = jdbcTemplate.queryForObject("""
SELECT COUNT(*)
@@ -1320,15 +1331,15 @@ class SuperAgentTaskResultControllerTest {
.andExpect(jsonPath("$.items[0].route_code").value("R06_CANCEL_GROUP_BLOCK_NORMAL"))
.andExpect(jsonPath("$.items[0].system_task_type").value("CANCEL_BOOKING"))
.andExpect(jsonPath("$.items[0].task_card_type").value("CANCEL_BOOKING"))
.andExpect(jsonPath("$.items[0].execution_order").value(1))
.andExpect(jsonPath("$.items[0].execution_order").doesNotExist())
.andExpect(jsonPath("$.items[1].route_code").value("R14_GENERAL_REQUEST_NORMAL"))
.andExpect(jsonPath("$.items[1].system_task_type").value("UPDATE_BOOKING"))
.andExpect(jsonPath("$.items[1].task_card_type").value("TRACE_RESERVATION_NOTES"))
.andExpect(jsonPath("$.items[1].execution_order").value(2))
.andExpect(jsonPath("$.items[1].execution_order").doesNotExist())
.andExpect(jsonPath("$.items[2].route_code").value("R11_ROOMING_LIST_NORMAL"))
.andExpect(jsonPath("$.items[2].system_task_type").value("UPDATE_BOOKING"))
.andExpect(jsonPath("$.items[2].task_card_type").value("ROOMING_LIST"))
.andExpect(jsonPath("$.items[2].execution_order").value(3))
.andExpect(jsonPath("$.items[2].execution_order").doesNotExist())
.andReturn();
String firstOrderId = com.jayway.jsonpath.JsonPath.read(
@@ -1554,8 +1565,8 @@ class SuperAgentTaskResultControllerTest {
.andExpect(jsonPath("$.items[0].adapter_error_code").value("PAYMENT_ATTACHMENT_ID_NOT_FOUND"))
.andExpect(jsonPath("$.items[0].task_id").doesNotExist())
.andExpect(jsonPath("$.items[1].route_code").value("R06_CANCEL_GROUP_BLOCK_NORMAL"))
.andExpect(jsonPath("$.items[1].task_id").exists())
.andExpect(jsonPath("$.items[1].execution_order").value(1));
.andExpect(jsonPath("$.items[1].task_id").doesNotExist())
.andExpect(jsonPath("$.items[1].execution_order").doesNotExist());
Long taskCount = jdbcTemplate.queryForObject("""
SELECT COUNT(*)
@@ -1569,7 +1580,7 @@ class SuperAgentTaskResultControllerTest {
AND system_process_category = 'ADAPTER_CONTRACT_ERROR'
AND adapter_error_code = 'PAYMENT_ATTACHMENT_ID_NOT_FOUND'
""", Long.class, source.inboxId());
assertThat(taskCount).isEqualTo(1L);
assertThat(taskCount).isZero();
assertThat(adapterErrorCount).isEqualTo(1L);
List<String> v4CardTypes = jdbcTemplate.queryForList("""