修复邮件会话隐藏技术订单展示
This commit is contained in:
@@ -197,6 +197,28 @@ class SourceMessageControllerTest {
|
||||
org.assertj.core.api.Assertions.assertThat(auditCount).isEqualTo(2L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldHideSystemOrderFromConversationRelatedOrders() throws Exception {
|
||||
SourceMessageCaptureResult sourceMessage = captureService.capture(conversationCommand(
|
||||
"mail-conversation-hidden-order-001",
|
||||
"conversation-hidden-order-001",
|
||||
"Information only message.",
|
||||
"<html><body><p>Information only message.</p></body></html>",
|
||||
List.of()));
|
||||
Long orderId = 940000000000000401L;
|
||||
Long transitionId = 940000000000000501L;
|
||||
Long taskId = 940000000000000601L;
|
||||
insertHiddenRelatedOrder(orderId, sourceMessage.inboxId());
|
||||
insertRelatedTransition(transitionId, sourceMessage.inboxId(), "TMP-HIDDEN-CONVERSATION-001");
|
||||
insertRelatedTask(taskId, orderId, sourceMessage.inboxId(), transitionId);
|
||||
|
||||
mockMvc.perform(get("/api/source-messages/{sourceMessageId}/conversation", sourceMessage.inboxId()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.messages[0].related_orders.length()").value(0))
|
||||
.andExpect(jsonPath("$.messages[0].related_tasks[0].task_id").value(taskId.toString()))
|
||||
.andExpect(content().string(not(containsString("TMP-HIDDEN-CONVERSATION-001"))));
|
||||
}
|
||||
|
||||
private CaptureSourceMessageCommand command(
|
||||
String externalMessageId,
|
||||
String externalConversationId,
|
||||
@@ -275,6 +297,18 @@ class SourceMessageControllerTest {
|
||||
""", orderId, groupCode, groupCode, "TMP-" + orderId, groupCode, sourceMessageId);
|
||||
}
|
||||
|
||||
private void insertHiddenRelatedOrder(Long orderId, Long sourceMessageId) {
|
||||
jdbcTemplate.update("""
|
||||
INSERT INTO workflow_reservation_order (
|
||||
id, hotel_id, order_key_type, order_business_key, active_business_key,
|
||||
temporary_order_code, order_status, order_visibility, business_key_source, display_name,
|
||||
source_message_id, version, created_at, updated_at
|
||||
)
|
||||
VALUES (?, 'HOTEL-TEST', 'TEMPORARY', NULL, NULL, ?, 'TEMPORARY',
|
||||
'HIDDEN_SYSTEM', 'AI_CANDIDATE', ?, ?, 0, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
|
||||
""", orderId, "TMP-HIDDEN-CONVERSATION-001", "TMP-HIDDEN-CONVERSATION-001", sourceMessageId);
|
||||
}
|
||||
|
||||
private void insertRelatedTransition(Long transitionId, Long sourceMessageId, String groupCode) {
|
||||
jdbcTemplate.update("""
|
||||
INSERT INTO workflow_reservation_ai_transition (
|
||||
|
||||
Reference in New Issue
Block a user