fix(firstleg): allow public sailing schedule dispatch fallback
This commit is contained in:
+3
-2
@@ -34,9 +34,10 @@ public interface PortScheduleMapper extends BaseMapper<PortScheduleEntity> {
|
||||
|
||||
@Select("""
|
||||
SELECT * FROM fl_port_schedule
|
||||
WHERE customer_id=#{customerId} AND ocean_booking_id=#{oceanBookingId}
|
||||
WHERE (customer_id=#{customerId} OR customer_id=0) AND ocean_booking_id=#{oceanBookingId}
|
||||
AND container_booking_id=#{containerBookingId}
|
||||
ORDER BY observed_at DESC,updated_at DESC,id DESC LIMIT 1
|
||||
ORDER BY CASE WHEN customer_id=#{customerId} THEN 0 ELSE 1 END,
|
||||
observed_at DESC,updated_at DESC,id DESC LIMIT 1
|
||||
""")
|
||||
PortScheduleEntity latestForDispatch(@Param("customerId") long customerId,
|
||||
@Param("oceanBookingId") long oceanBookingId,
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class PortScheduleDispatchGateContributor implements OutboundDispatchGate
|
||||
PortScheduleEntity schedule = repository.latestForDispatch(context.tenantId(), context.oceanBookingId(),
|
||||
context.containerBookingId());
|
||||
if (schedule == null) return gate(false, "MISSING");
|
||||
if (!java.util.Objects.equals(schedule.getCustomerId(), context.tenantId())
|
||||
if (!(java.util.Objects.equals(schedule.getCustomerId(), context.tenantId()) || schedule.getCustomerId() == 0L)
|
||||
|| !java.util.Objects.equals(schedule.getOceanBookingId(), context.oceanBookingId())
|
||||
|| !java.util.Objects.equals(schedule.getContainerBookingId(), context.containerBookingId())) {
|
||||
return gate(false, "ASSOCIATION_MISMATCH");
|
||||
|
||||
Reference in New Issue
Block a user