fix(firstleg): support platform scope port schedules
This commit is contained in:
@@ -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,
|
||||
|
||||
+2
-1
@@ -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, "关联柜次不存在");
|
||||
|
||||
Reference in New Issue
Block a user