优化
This commit is contained in:
@@ -92,7 +92,7 @@ public class FinanceFeeSourceEventService {
|
||||
snapshot.sourceType(), snapshot.feeId());
|
||||
jdbc.update("UPDATE fin_cost SET status='VOIDED',voided_at=CURRENT_TIMESTAMP(3),void_reason='来源版本已替代',version=version+1,updated_by=0 WHERE cost_origin='FIRSTLEG_DIRECT_PAID' AND source_system='FIRSTLEG' AND source_type=? AND source_fee_id=? AND status='CONFIRMED'",
|
||||
snapshot.sourceType(), snapshot.feeId());
|
||||
jdbc.update("INSERT INTO fin_fee_source(source_system,source_fee_id,source_fee_version,customer_id,source_type,source_no,direction,order_id,inbound_id,container_id,container_booking_id,fee_item_code,fee_item_name,amount,currency_code,settlement_mode,paid_at,payment_method,payment_reference_no,payment_voucher_file_ids,source_hash,source_snapshot,status) VALUES ('FIRSTLEG',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'AVAILABLE')",
|
||||
jdbc.update("INSERT INTO fin_fee_source(source_system,source_fee_id,source_fee_version,customer_id,source_type,source_no,direction,order_id,inbound_id,container_id,container_booking_id,fee_item_code,fee_item_name,amount,currency_code,settlement_mode,paid_at,payment_method,payment_reference_no,payment_voucher_file_ids,source_hash,source_snapshot,review_status,status) VALUES ('FIRSTLEG',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'APPROVED','AVAILABLE')",
|
||||
snapshot.feeId(), snapshot.feeVersion(), snapshot.customerId(), snapshot.sourceType(),
|
||||
snapshot.inboundCode() == null || snapshot.inboundCode().isBlank() ? snapshot.containerNo() : snapshot.inboundCode(),
|
||||
snapshot.direction(), snapshot.orderId(), snapshot.inboundId(), snapshot.containerId(),
|
||||
|
||||
@@ -50,7 +50,8 @@ class FinanceFeeSourceEventServiceTest {
|
||||
|
||||
assertThat(service.consume(event)).isEqualTo(101L);
|
||||
verify(firstleg).inbound("test-token", 21, 31, 1);
|
||||
verify(jdbc).update(startsWith("INSERT INTO fin_fee_source"), any(Object[].class));
|
||||
verify(jdbc).update(argThat(sql -> sql.startsWith("INSERT INTO fin_fee_source")
|
||||
&& sql.contains("review_status,status") && sql.contains("'APPROVED','AVAILABLE'")), any(Object[].class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,7 +64,8 @@ class FinanceFeeSourceEventServiceTest {
|
||||
verify(firstleg).container("test-token", 41, 31, 1);
|
||||
verify(jdbc).update(contains("status='SUPERSEDED'"), eq("CONTAINER_FEE"), eq(31L));
|
||||
ArgumentCaptor<Object[]> values = ArgumentCaptor.forClass(Object[].class);
|
||||
verify(jdbc).update(startsWith("INSERT INTO fin_fee_source"), values.capture());
|
||||
verify(jdbc).update(argThat(sql -> sql.startsWith("INSERT INTO fin_fee_source")
|
||||
&& sql.contains("review_status,status") && sql.contains("'APPROVED','AVAILABLE'")), values.capture());
|
||||
assertThat(values.getValue()[8]).as("fin_fee_source.container_id keeps loadingPlanId")
|
||||
.isEqualTo(41L);
|
||||
assertThat(values.getValue()[9]).as("fin_fee_source.container_booking_id stores physical container")
|
||||
@@ -107,7 +109,8 @@ class FinanceFeeSourceEventServiceTest {
|
||||
verify(supplierValidator).requireActive(71L, "TRUCKING");
|
||||
verify(jdbc, never()).update(startsWith("INSERT INTO fin_cost"), any(Object[].class));
|
||||
ArgumentCaptor<Object[]> values = ArgumentCaptor.forClass(Object[].class);
|
||||
verify(jdbc).update(startsWith("INSERT INTO fin_fee_source"), values.capture());
|
||||
verify(jdbc).update(argThat(sql -> sql.startsWith("INSERT INTO fin_fee_source")
|
||||
&& sql.contains("review_status,status") && sql.contains("'APPROVED','AVAILABLE'")), values.capture());
|
||||
assertThat(values.getValue()[20].toString())
|
||||
.contains("\"supplierId\":71", "\"supplierName\":\"现有供应商\"", "\"supplierCategory\":\"TRUCKING\"");
|
||||
}
|
||||
@@ -145,7 +148,8 @@ class FinanceFeeSourceEventServiceTest {
|
||||
assertThat(service.consume(event)).isEqualTo(101L);
|
||||
|
||||
ArgumentCaptor<Object[]> values = ArgumentCaptor.forClass(Object[].class);
|
||||
verify(jdbc).update(startsWith("INSERT INTO fin_fee_source"), values.capture());
|
||||
verify(jdbc).update(argThat(sql -> sql.startsWith("INSERT INTO fin_fee_source")
|
||||
&& sql.contains("review_status,status") && sql.contains("'APPROVED','AVAILABLE'")), values.capture());
|
||||
assertThat(values.getValue()[14]).isEqualTo("DIRECT_PAID");
|
||||
assertThat(values.getValue()[16]).isEqualTo("BANK_TRANSFER");
|
||||
assertThat(values.getValue()[18]).isEqualTo("[901]");
|
||||
@@ -171,7 +175,8 @@ class FinanceFeeSourceEventServiceTest {
|
||||
|
||||
assertThat(service.consume(event)).isEqualTo(101L);
|
||||
verify(jdbc).update(contains("status='SUPERSEDED'"), eq("INBOUND_FEE"), eq(31L));
|
||||
verify(jdbc).update(startsWith("INSERT INTO fin_fee_source"), any(Object[].class));
|
||||
verify(jdbc).update(argThat(sql -> sql.startsWith("INSERT INTO fin_fee_source")
|
||||
&& sql.contains("review_status,status") && sql.contains("'APPROVED','AVAILABLE'")), any(Object[].class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user