fix: expose the selected container schedule for editing

This commit is contained in:
2026-10-03 11:09:52 +08:00
parent ba7dcd39f2
commit 65c12eaf5e
4 changed files with 47 additions and 1 deletions
@@ -1,6 +1,7 @@
package com.baiyue.firstleg.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -75,6 +76,9 @@ public class ContainerBookingEntity {
@TableField(exist = false) private Long planId;
@TableField(exist = false) private String planNo;
@TableField(exist = false) private String planStatus;
/** Identity of the port schedule selected for the current transport read model. */
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@TableField(exist = false) private Long currentPortScheduleId;
/** Actual completion timestamp projected from the associated loading plan. */
@JsonIgnore @TableField(exist = false) private LocalDateTime completedLoadingAt;
@TableField(exist = false) private Boolean exceptionActive;
@@ -71,9 +71,12 @@ public class ContainerRepository {
}
private void resolveCurrentPortSchedule(ContainerBookingEntity value) {
if (value == null || value.getCustomerId() == null || value.getOceanBookingId() == null) return;
if (value == null) return;
value.setCurrentPortScheduleId(null);
if (value.getCustomerId() == null || value.getOceanBookingId() == null) return;
PortScheduleEntity schedule = schedules.latestForDispatch(value.getCustomerId(), value.getOceanBookingId(), value.getId());
if (schedule == null) return;
value.setCurrentPortScheduleId(schedule.getId());
value.setVesselName(schedule.getVesselName());
value.setVoyageNo(schedule.getVoyageNo());
value.setEstimatedSailingAt(schedule.getEtdAt());