fix(firstleg): support platform scope port schedules

This commit is contained in:
2026-09-30 17:41:16 +08:00
parent 32fb9ec7b3
commit 36a74eb58e
4 changed files with 7 additions and 6 deletions
@@ -23,7 +23,7 @@ public final class PortScheduleDtos {
public Query { if (page == 0) page = 1; if (size == 0) size = 20; }
}
public record ScheduleData(@NotNull @Positive Long customerId,
public record ScheduleData(@NotNull @Min(0) Long customerId,
@NotNull @Positive Long oceanBookingId,
@Positive Long containerBookingId,
@NotBlank @Size(max = 24) String sourceType,
@@ -102,7 +102,8 @@ public class PortScheduleService {
private void validateLinks(ScheduleData data) {
OceanBookingEntity booking = repository.oceanBooking(data.oceanBookingId());
if (booking == null) throw new BizException(ResultCode.NOT_FOUND, "关联订舱不存在");
if (!Objects.equals(booking.getCustomerId(), data.customerId())) throw badRequest("customerId与订舱客户不一致");
long expectedCustomerId = booking.getCustomerId() == null ? 0L : booking.getCustomerId();
if (expectedCustomerId != data.customerId()) throw badRequest("customerId与订舱客户不一致");
if (data.containerBookingId() != null) {
if (repository.containerBooking(data.containerBookingId()) == null) {
throw new BizException(ResultCode.NOT_FOUND, "关联柜次不存在");