This commit is contained in:
2026-08-20 09:49:28 +08:00
parent 7cf4a8d562
commit be5d89a4e6
3 changed files with 37 additions and 7 deletions
@@ -141,8 +141,8 @@ CREATE TABLE IF NOT EXISTS fl_finance_fee_source_command (
reason VARCHAR(500) NOT NULL COMMENT '操作原因',
status VARCHAR(16) NOT NULL COMMENT 'PROCESSING或SUCCEEDED',
result_status VARCHAR(16) NULL COMMENT '成功业务结果;当前为VOIDED',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
completed_at DATETIME(3) NULL,
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '命令创建时间',
completed_at DATETIME(3) NULL COMMENT '命令成功完成时间',
PRIMARY KEY (id),
UNIQUE KEY uk_finance_fee_command_idem (customer_id, operator_id, action, idempotency_key),
KEY idx_finance_fee_command_source (source_type, source_fee_id, source_version, created_at),
@@ -50,7 +50,7 @@ class FinanceFeeSourceCommandServiceTest {
objectMapper = new ObjectMapper().findAndRegisterModules();
service = new FinanceFeeSourceCommandService(commands, inboundFees, pricing,
containerFees, containerFeeService, outbox, objectMapper);
doAnswer(invocation -> {
lenient().doAnswer(invocation -> {
FinanceFeeSourceCommandEntity value = invocation.getArgument(0);
value.setId(901L);
return null;
@@ -80,13 +80,13 @@ class FinanceFeeSourceCommandServiceTest {
VoidRequest request = inboundRequest(700L, 3);
when(inboundFees.findSourceVersion(100L, 700L, 3))
.thenReturn(inboundDetail("FBA_PRICING", 778L, 700L, 3, 9L));
when(pricing.voidSentFee(9L, 100L, 700L, 3, any())).thenReturn(1);
when(pricing.voidSentFee(eq(9L), eq(100L), eq(700L), eq(3), any())).thenReturn(1);
when(pricing.markInboundFeeVoided(9L, 100L)).thenReturn(1);
when(inboundFees.voidApproved(9L, 100L, 778L, 3, 71L)).thenReturn(1);
service.voidSource("void-fba", hash(request), request);
verify(pricing).voidSentFee(9L, 100L, 700L, 3, any());
verify(pricing).voidSentFee(eq(9L), eq(100L), eq(700L), eq(3), any());
verify(pricing).markInboundFeeVoided(9L, 100L);
verify(outbox).publishInbound(org.mockito.ArgumentMatchers.eq(FinanceFeeSourceOutboxService.VOIDED),
org.mockito.ArgumentMatchers.eq(9L), org.mockito.ArgumentMatchers.eq(100L),