Merge branch 'dev' into dev-lyhfive

# Conflicts:
#	deploy/sql/头程数据库统一增量-MySQL8.sql
#	deploy/sql/海外区域统一增量-MySQL8.sql
#	lastleg-service/src/main/java/com/baiyue/lastleg/service/LoadingCompletedConsumer.java
#	lastleg-service/src/main/resources/db/lastleg.sql
#	lastleg-service/src/test/java/com/baiyue/lastleg/service/LoadingCompletedConsumerTest.java
This commit is contained in:
2026-08-26 16:05:24 +08:00
357 changed files with 7739 additions and 3505 deletions
@@ -7,8 +7,6 @@ import com.baiyue.lastleg.dropship.dto.DropshipRequests;
import com.baiyue.lastleg.dropship.service.DropshipOrderService;
import com.baiyue.lastleg.inboundplan.entity.InboundPlanCarton;
import com.baiyue.lastleg.inboundplan.mapper.InboundPlanCartonMapper;
import com.baiyue.lastleg.inboundplan.service.InboundPlanService;
import com.baiyue.lastleg.inboundplan.dto.InboundPlanResponse;
import com.baiyue.lastleg.inventory.command.dto.InventoryCommandRequests;
import com.baiyue.lastleg.inventory.command.service.InventoryCommandService;
import com.baiyue.lastleg.shipping.mapper.ContainerShippingGateMapper;
@@ -37,7 +35,6 @@ public class LoadingCompletedConsumer {
@Resource private LastlegOrderDetailMapper detailMapper;
@Resource private LastlegOrderStatusHistoryMapper historyMapper;
@Resource private InboundPlanCartonMapper cartonMapper;
@Resource private InboundPlanService inboundPlans;
@Resource private ObjectMapper objectMapper;
@Resource private LastlegOrderNoGenerator orderNoGenerator;
@Resource private DropshipOrderService dropshipOrders;
@@ -228,12 +225,9 @@ public class LoadingCompletedConsumer {
history.setOrderId(order.getId()); history.setToStatus("PENDING_ASSIGNMENT"); history.setEventId(event.eventId());
history.setRemark("头程装柜完成自动生成"); history.setCreatedAt(LocalDateTime.now()); historyMapper.insert(history);
if ("FIRST_LEG".equals(orderType)) {
List<String> sourcePalletNos = source.pallets() == null ? List.of() : source.pallets().stream()
.map(FirstLegLoadingPlanCompletedV1.PalletSnapshot::palletNo).filter(Objects::nonNull).toList();
InboundPlanResponse plan = sourcePalletNos.isEmpty()
? inboundPlans.convert(customerId, order.getId())
: inboundPlans.convert(customerId, order.getId(), sourcePalletNos);
registerInTransit(event, payload, source, order, plan.planNo());
// The cross-region handover freezes the source inbound code only. An inbound plan is
// created later by an explicit platform conversion, which replaces this display snapshot.
registerInTransit(event, payload, source, order, source.inboundCode());
}
if ("ONE_CLICK_DROPSHIP".equals(orderType)) {
long warehouseId;
@@ -241,11 +235,6 @@ public class LoadingCompletedConsumer {
catch (Exception exception) { throw new IllegalArgumentException("One-click dropship warehouseId is invalid", exception); }
dropshipOrders.receive(new DropshipRequests.Receive(customerId, order.getId(), warehouseId,
event.eventId() + ":DROPSHIP", dropshipPallets));
InboundPlanResponse plan = inboundPlans.convertDropship(customerId, order.getId(), dropshipPallets.stream()
.map(pallet -> new InboundPlanService.WholePalletInput(pallet.palletNo(), pallet.skuPackages().stream()
.mapToInt(sku -> Math.toIntExact(sku.packageCount())).sum()))
.toList());
registerInTransit(event, payload, source, order, plan.planNo());
}
}