完善财务全量验收链路
This commit is contained in:
+9
-2
@@ -14,10 +14,17 @@ public class FinanceCostSnapshotService {
|
||||
public FinanceCostSnapshotService(SmartLoadingRepository repository) { this.repository = repository; }
|
||||
|
||||
public ContainerSnapshot container(long customerId, long loadingPlanId) {
|
||||
if (customerId <= 0 || loadingPlanId <= 0 || repository.plan(loadingPlanId) == null) {
|
||||
if (customerId <= 0 || loadingPlanId <= 0) {
|
||||
throw new BizException(ResultCode.NOT_FOUND, "柜次不存在");
|
||||
}
|
||||
List<OrderVolume> orders = repository.items(loadingPlanId).stream()
|
||||
// Older Finance deployments called this endpoint with the physical
|
||||
// container booking ID. Resolve both identities during rollout while
|
||||
// preserving the caller's ID in the snapshot contract.
|
||||
var plan = repository.plan(loadingPlanId);
|
||||
if (plan == null) plan = repository.planByBooking(loadingPlanId);
|
||||
if (plan == null) throw new BizException(ResultCode.NOT_FOUND, "柜次不存在");
|
||||
long effectivePlanId = plan.getId() == null || plan.getId() <= 0 ? loadingPlanId : plan.getId();
|
||||
List<OrderVolume> orders = repository.items(effectivePlanId).stream()
|
||||
.filter(item -> item.getAccountId() != null && item.getAccountId() == customerId)
|
||||
.filter(item -> item.getOrderId() != null && item.getOrderId() > 0)
|
||||
.filter(item -> item.getVolumeCbm() != null && item.getVolumeCbm().signum() > 0)
|
||||
|
||||
Reference in New Issue
Block a user