Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
@@ -234,6 +234,7 @@ services:
|
|||||||
EVENT_BRIDGE_DB_PASSWORD: ${EVENT_BRIDGE_DB_PASSWORD}
|
EVENT_BRIDGE_DB_PASSWORD: ${EVENT_BRIDGE_DB_PASSWORD}
|
||||||
EVENT_CONSUMER_URL: ${FIRSTLEG_CONTAINER_EVENT_CONSUMER_URL:-http://firstleg:9202/internal/firstleg/v1/container-events}
|
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}
|
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
|
SPRING_SQL_INIT_MODE: never
|
||||||
networks:
|
networks:
|
||||||
firstleg-network:
|
firstleg-network:
|
||||||
|
|||||||
@@ -88,9 +88,12 @@ public class ContainerFeeDetailService {
|
|||||||
.reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
.reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
||||||
if (allocated.compareTo(total) != 0) throw conflict("柜级费用分摊合计必须等于费用总额");
|
if (allocated.compareTo(total) != 0) throw conflict("柜级费用分摊合计必须等于费用总额");
|
||||||
Map<InboundAllocationKey, Long> ownership = new HashMap<>();
|
Map<InboundAllocationKey, Long> ownership = new HashMap<>();
|
||||||
loading.items(loadingPlanId).forEach(value -> ownership.put(
|
Map<OrderAllocationKey, Long> orderOwnership = new HashMap<>();
|
||||||
new InboundAllocationKey(value.getOrderId(), text(value.getOrderNo()), value.getInboundId(),
|
loading.items(loadingPlanId).forEach(value -> {
|
||||||
text(value.getInboundCode())), value.getAccountId()));
|
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<InboundAllocationKey> unique = new HashSet<>();
|
Set<InboundAllocationKey> unique = new HashSet<>();
|
||||||
long groupId = IdWorker.getId();
|
long groupId = IdWorker.getId();
|
||||||
List<ContainerFeeDetailEntity> rows = new java.util.ArrayList<>();
|
List<ContainerFeeDetailEntity> rows = new java.util.ArrayList<>();
|
||||||
@@ -101,7 +104,10 @@ public class ContainerFeeDetailService {
|
|||||||
InboundAllocationKey key = new InboundAllocationKey(allocation.orderId(), allocation.orderNo().trim(),
|
InboundAllocationKey key = new InboundAllocationKey(allocation.orderId(), allocation.orderNo().trim(),
|
||||||
allocation.inboundId(), inboundCode);
|
allocation.inboundId(), inboundCode);
|
||||||
if (!unique.add(key)) throw conflict("同一业务归属不得重复分摊");
|
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("分摊客户、订单及入仓信息与柜内真实归属不一致");
|
throw conflict("分摊客户、订单及入仓信息与柜内真实归属不一致");
|
||||||
ContainerFeeDetailEntity value = new ContainerFeeDetailEntity();
|
ContainerFeeDetailEntity value = new ContainerFeeDetailEntity();
|
||||||
value.setId(IdWorker.getId()); value.setTenantId(allocation.customerId());
|
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 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 InboundAllocationKey(Long orderId, String orderNo, Long inboundId, String inboundCode) { }
|
||||||
|
private record OrderAllocationKey(Long orderId, String orderNo) { }
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -248,7 +248,7 @@ class ContainerFeeDetailServiceTest {
|
|||||||
LocalDate.of(2026, 8, 20), new BigDecimal("300.00"), "CNY", null, "柜级操作费");
|
LocalDate.of(2026, 8, 20), new BigDecimal("300.00"), "CNY", null, "柜级操作费");
|
||||||
var request = new AllocationGroupRequest(fee, List.of(
|
var request = new AllocationGroupRequest(fee, List.of(
|
||||||
new Allocation(10001L, 501L, "FL-501", null, null, new BigDecimal("120.00")),
|
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<ContainerFeeDetailEntity> result = service.createAllocationGroup(41L, 9L, request);
|
List<ContainerFeeDetailEntity> result = service.createAllocationGroup(41L, 9L, request);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ test('Compose wires both producers to the stable service aliases used by test en
|
|||||||
assert.match(overseasCompose,
|
assert.match(overseasCompose,
|
||||||
/FIRSTLEG_EVENT_BRIDGE_URL:\s*\$\{CN_EVENT_BRIDGE_TARGET_URL:-http:\/\/event-bridge-cn:9312\}/)
|
/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, /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\]/)
|
assert.match(overseasCompose, /aliases:\s*\[event-bridge-overseas\]/)
|
||||||
for (const source of [cnCompose, overseasCompose]) {
|
for (const source of [cnCompose, overseasCompose]) {
|
||||||
assert.doesNotMatch(source, /(?:LASTLEG|FIRSTLEG|CN)_EVENT_BRIDGE_URL:[^\n]*(?:\d{1,3}\.){3}\d{1,3}/)
|
assert.doesNotMatch(source, /(?:LASTLEG|FIRSTLEG|CN)_EVENT_BRIDGE_URL:[^\n]*(?:\d{1,3}\.){3}\d{1,3}/)
|
||||||
|
|||||||
Reference in New Issue
Block a user