优化
This commit is contained in:
@@ -396,6 +396,22 @@ class FinanceSettlementBehaviorTest {
|
||||
verify(jdbc, never()).update(any(PreparedStatementCreator.class), any(KeyHolder.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void directPaidSourceCannotEnterPayableSettlement() {
|
||||
JdbcTemplate jdbc = org.mockito.Mockito.mock(JdbcTemplate.class);
|
||||
when(jdbc.queryForList(startsWith("SELECT request_hash"), eq(10L), eq(7L),
|
||||
eq("SETTLEMENT_AP_CREATE"), eq("ap-direct"))).thenReturn(List.of());
|
||||
Map<String, Object> source = payableSource(10L, 20L);
|
||||
source.put("settlement_mode", "DIRECT_PAID");
|
||||
when(jdbc.queryForList(startsWith("SELECT id,customer_id"), eq(31L))).thenReturn(List.of(source));
|
||||
FinanceSettlementService service = service(jdbc, org.mockito.Mockito.mock(FinanceFileClient.class));
|
||||
|
||||
assertCode(() -> service.createPayableSettlement(7L, "ap-direct",
|
||||
new CreatePayableSettlementRequest(10L, 20L, List.of(31L),
|
||||
LocalDate.of(2026, 9, 30), "CNY")), "FIN_409");
|
||||
verify(jdbc, never()).update(startsWith("INSERT INTO fin_settlement"), any(Object[].class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void payableCreationRejectsMixedSupplierIneligibleAndOccupiedSources() {
|
||||
for (String condition : List.of("supplier", "ineligible", "occupied")) {
|
||||
@@ -649,6 +665,7 @@ class FinanceSettlementBehaviorTest {
|
||||
Map.entry("id", 31L), Map.entry("customer_id", customerId), Map.entry("direction", "PAYABLE"),
|
||||
Map.entry("currency_code", "CNY"), Map.entry("status", "AVAILABLE"),
|
||||
Map.entry("amount", new BigDecimal("100.00")), Map.entry("review_status", "APPROVED"),
|
||||
Map.entry("settlement_mode", "ON_ACCOUNT"),
|
||||
Map.entry("supplier_id", supplierId),
|
||||
Map.entry("fee_item_code", "FBA_HEAD_FREIGHT"), Map.entry("fee_item_name", "头程运费"),
|
||||
Map.entry("supplier_name", "供应商20"), Map.entry("source_snapshot",
|
||||
|
||||
Reference in New Issue
Block a user