统一财务费用来源入池链路
This commit is contained in:
+18
-9
@@ -12,7 +12,8 @@ import com.baiyue.lastleg.inventory.command.service.InventoryCommandService;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderDetailMapper;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderMapper;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderStatusHistoryMapper;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderFeeMapper;
|
||||
import com.baiyue.lastleg.financefee.entity.OverseasFeeSource;
|
||||
import com.baiyue.lastleg.financefee.service.OverseasFeeSourceService;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderOperationLogMapper;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderManualNodeMapper;
|
||||
import com.baiyue.lastleg.mapper.ReceivingWarehouseOperationMapper;
|
||||
@@ -28,6 +29,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@@ -53,7 +55,7 @@ class LastlegOrderServiceTest {
|
||||
@Mock LastlegOrderMapper orders;
|
||||
@Mock LastlegOrderDetailMapper details;
|
||||
@Mock LastlegOrderStatusHistoryMapper histories;
|
||||
@Mock LastlegOrderFeeMapper fees;
|
||||
@Mock OverseasFeeSourceService feeSources;
|
||||
@Mock LastlegOrderOperationLogMapper operations;
|
||||
@Mock LastlegOrderManualNodeMapper manualNodes;
|
||||
@Mock InboundPlanCartonMapper cartons;
|
||||
@@ -70,7 +72,7 @@ class LastlegOrderServiceTest {
|
||||
ReflectionTestUtils.setField(service, "orderMapper", orders);
|
||||
ReflectionTestUtils.setField(service, "detailMapper", details);
|
||||
ReflectionTestUtils.setField(service, "historyMapper", histories);
|
||||
ReflectionTestUtils.setField(service, "feeMapper", fees);
|
||||
ReflectionTestUtils.setField(service, "feeSources", feeSources);
|
||||
ReflectionTestUtils.setField(service, "operationLogMapper", operations);
|
||||
ReflectionTestUtils.setField(service, "manualNodeMapper", manualNodes);
|
||||
ReflectionTestUtils.setField(service, "cartonMapper", cartons);
|
||||
@@ -140,7 +142,7 @@ class LastlegOrderServiceTest {
|
||||
when(orders.selectOne(any())).thenReturn(order);
|
||||
when(details.selectList(any())).thenReturn(List.of());
|
||||
when(histories.selectList(any())).thenReturn(List.of());
|
||||
when(fees.selectList(any())).thenReturn(List.of());
|
||||
when(feeSources.listForBusiness("100", "LASTLEG_ORDER", 11L)).thenReturn(List.of());
|
||||
when(operations.selectList(any())).thenReturn(List.of());
|
||||
when(manualNodes.selectList(any())).thenReturn(List.of());
|
||||
|
||||
@@ -186,14 +188,21 @@ class LastlegOrderServiceTest {
|
||||
void createFeePersistsFeeAndOperationForOwnedOrder() {
|
||||
when(orders.selectOne(any())).thenReturn(order(11L, "100", "PENDING_ASSIGNMENT", null));
|
||||
var request = new LastlegOrderRequests.CreateFee(
|
||||
"清关费", "USD", new BigDecimal("420.00"), "PENDING_REVIEW", "报关代理");
|
||||
"CUSTOMS_CLEARANCE", "清关费", "RECEIVABLE", "USD", new BigDecimal("420.00"),
|
||||
LocalDate.of(2026, 9, 9), null, null, null, null, null, null, null, List.of(),
|
||||
null, null, null, null, null);
|
||||
OverseasFeeSource draft = new OverseasFeeSource();
|
||||
draft.setSourceFeeId(701L); draft.setCustomerId("100"); draft.setFeeItemName("清关费");
|
||||
draft.setOriginalCurrency("USD"); draft.setOriginalAmount(new BigDecimal("420.00"));
|
||||
when(feeSources.create(eq("platform_admin"), eq("fee-key"), any())).thenReturn(draft);
|
||||
when(feeSources.submit(701L, "platform_admin", "fee-key:submit")).thenReturn(draft);
|
||||
|
||||
var fee = service.createFee("100", 11L, request, "platform_admin");
|
||||
var fee = service.createFee("100", 11L, request, "platform_admin", "fee-key");
|
||||
|
||||
assertEquals("100", fee.getCustomerId());
|
||||
assertEquals("清关费", fee.getFeeItem());
|
||||
assertEquals(new BigDecimal("420.00"), fee.getAmount());
|
||||
verify(fees).insert(any(com.baiyue.lastleg.entity.LastlegOrderFee.class));
|
||||
assertEquals("清关费", fee.getFeeItemName());
|
||||
verify(feeSources).create(eq("platform_admin"), eq("fee-key"), any());
|
||||
verify(feeSources).submit(701L, "platform_admin", "fee-key:submit");
|
||||
verify(operations).insert(any(com.baiyue.lastleg.entity.LastlegOrderOperationLog.class));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user