From 596a5c925cc62c307868157ae64ec21395ca9c0e Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 2 Sep 2026 18:14:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9F=9C=E8=B4=B9?= =?UTF-8?q?=E6=8C=89=E8=AE=A2=E5=8D=95=E5=BD=92=E5=B1=9E=E5=88=86=E6=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ContainerFeeDetailService.java | 15 +++++++++++---- .../service/ContainerFeeDetailServiceTest.java | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/firstleg/src/main/java/com/baiyue/firstleg/service/ContainerFeeDetailService.java b/firstleg/src/main/java/com/baiyue/firstleg/service/ContainerFeeDetailService.java index f03077b3f..dffe32349 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/service/ContainerFeeDetailService.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/service/ContainerFeeDetailService.java @@ -88,9 +88,12 @@ public class ContainerFeeDetailService { .reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP); if (allocated.compareTo(total) != 0) throw conflict("柜级费用分摊合计必须等于费用总额"); Map ownership = new HashMap<>(); - loading.items(loadingPlanId).forEach(value -> ownership.put( - new InboundAllocationKey(value.getOrderId(), text(value.getOrderNo()), value.getInboundId(), - text(value.getInboundCode())), value.getAccountId())); + Map orderOwnership = new HashMap<>(); + loading.items(loadingPlanId).forEach(value -> { + ownership.put(new InboundAllocationKey(value.getOrderId(), text(value.getOrderNo()), value.getInboundId(), + text(value.getInboundCode())), value.getAccountId()); + orderOwnership.put(new OrderAllocationKey(value.getOrderId(), text(value.getOrderNo())), value.getAccountId()); + }); Set unique = new HashSet<>(); long groupId = IdWorker.getId(); List rows = new java.util.ArrayList<>(); @@ -101,7 +104,10 @@ public class ContainerFeeDetailService { InboundAllocationKey key = new InboundAllocationKey(allocation.orderId(), allocation.orderNo().trim(), allocation.inboundId(), inboundCode); if (!unique.add(key)) throw conflict("同一业务归属不得重复分摊"); - if (!allocation.customerId().equals(ownership.get(key))) + Long owner = allocation.inboundId() == null + ? orderOwnership.get(new OrderAllocationKey(allocation.orderId(), allocation.orderNo().trim())) + : ownership.get(key); + if (!allocation.customerId().equals(owner)) throw conflict("分摊客户、订单及入仓信息与柜内真实归属不一致"); ContainerFeeDetailEntity value = new ContainerFeeDetailEntity(); value.setId(IdWorker.getId()); value.setTenantId(allocation.customerId()); @@ -371,4 +377,5 @@ public class ContainerFeeDetailService { private static String text(String value) { return value == null || value.isBlank() ? null : value.trim(); } private record InboundAllocationKey(Long orderId, String orderNo, Long inboundId, String inboundCode) { } + private record OrderAllocationKey(Long orderId, String orderNo) { } } diff --git a/firstleg/src/test/java/com/baiyue/firstleg/service/ContainerFeeDetailServiceTest.java b/firstleg/src/test/java/com/baiyue/firstleg/service/ContainerFeeDetailServiceTest.java index 8600e21d9..0c647f3b2 100644 --- a/firstleg/src/test/java/com/baiyue/firstleg/service/ContainerFeeDetailServiceTest.java +++ b/firstleg/src/test/java/com/baiyue/firstleg/service/ContainerFeeDetailServiceTest.java @@ -248,7 +248,7 @@ class ContainerFeeDetailServiceTest { LocalDate.of(2026, 8, 20), new BigDecimal("300.00"), "CNY", null, "柜级操作费"); var request = new AllocationGroupRequest(fee, List.of( new Allocation(10001L, 501L, "FL-501", null, null, new BigDecimal("120.00")), - new Allocation(10002L, 502L, "FL-502", 602L, "IB-602", new BigDecimal("180.00")))); + new Allocation(10002L, 502L, "FL-502", null, null, new BigDecimal("180.00")))); List result = service.createAllocationGroup(41L, 9L, request); From 30090e741fb2070aea2bfe2e7c0ce6ab55697808 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 2 Sep 2026 18:24:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=A2=E5=8A=A1?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=A1=A5=E6=8A=95=E9=80=92=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/docker-compose.yml | 1 + .../test-event-bridge-dns-deployment-contract.test.mjs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index c9175db39..f788f1795 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -234,6 +234,7 @@ services: EVENT_BRIDGE_DB_PASSWORD: ${EVENT_BRIDGE_DB_PASSWORD} EVENT_CONSUMER_URL: ${FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL:-http://firstleg:9202/internal/firstleg/v1/container-events} FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL: ${FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL:-http://firstleg:9202/internal/firstleg/v1/container-events} + FINANCE_FEE_EVENT_CONSUMER_URL: ${FINANCE_FEE_EVENT_CONSUMER_URL:-http://finance:9208/internal/finance/v1/business-fee-source-events} SPRING_SQL_INIT_MODE: never networks: firstleg-network: diff --git a/scripts/admin-test-env-modules/test-event-bridge-dns-deployment-contract.test.mjs b/scripts/admin-test-env-modules/test-event-bridge-dns-deployment-contract.test.mjs index 2a1234cb5..042c7d034 100644 --- a/scripts/admin-test-env-modules/test-event-bridge-dns-deployment-contract.test.mjs +++ b/scripts/admin-test-env-modules/test-event-bridge-dns-deployment-contract.test.mjs @@ -34,6 +34,8 @@ test('Compose wires both producers to the stable service aliases used by test en assert.match(overseasCompose, /FIRSTLEG_EVENT_BRIDGE_URL:\s*\$\{CN_EVENT_BRIDGE_TARGET_URL:-http:\/\/event-bridge-cn:9312\}/) assert.match(cnCompose, /aliases:\s*\[event-bridge-cn\]/) + assert.match(cnCompose, + /FINANCE_FEE_EVENT_CONSUMER_URL:\s*\$\{FINANCE_FEE_EVENT_CONSUMER_URL:-http:\/\/finance:9208\/internal\/finance\/v1\/business-fee-source-events\}/) assert.match(overseasCompose, /aliases:\s*\[event-bridge-overseas\]/) for (const source of [cnCompose, overseasCompose]) { assert.doesNotMatch(source, /(?:LASTLEG|FIRSTLEG|CN)_EVENT_BRIDGE_URL:[^\n]*(?:\d{1,3}\.){3}\d{1,3}/)