Refine exception message handling for missing transport rates to support nullable end dates.
This commit is contained in:
parent
9c56b7ec16
commit
4f0eeff16b
1 changed files with 8 additions and 4 deletions
|
|
@ -175,16 +175,20 @@ public class PreCalculationCheckService {
|
|||
var rate = matrixRateRepository.getByCountryIds(fromRouteNode.get().getCountryId(), toRouteNode.get().getCountryId(), period.getId());
|
||||
|
||||
|
||||
if (rate.isEmpty())
|
||||
throw new PremiseValidationError("The transport rates for the period " + period.getStartDate().format(DateTimeFormatter.ISO_DATE) + " to " + period.getEndDate().format(DateTimeFormatter.ISO_DATE) + " are insufficient to perform the calculation for route segment" + fromRouteNode.get().getExternalMappingId() + " to " + toRouteNode.get().getExternalMappingId());
|
||||
if (rate.isEmpty()) {
|
||||
var toText = period.getEndDate() == null ? "" : " to " + period.getEndDate().format(DateTimeFormatter.ISO_DATE);
|
||||
throw new PremiseValidationError("The transport rates for the period " + period.getStartDate().format(DateTimeFormatter.ISO_DATE) + toText + " are insufficient to perform the calculation for route segment" + fromRouteNode.get().getExternalMappingId() + " to " + toRouteNode.get().getExternalMappingId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (RateType.CONTAINER == section.getRateType()) {
|
||||
var rate = containerRateRepository.findRoute(fromRouteNode.get().getNodeId(), toRouteNode.get().getNodeId(), period.getId(), section.getTransportType());
|
||||
|
||||
if (rate.isEmpty())
|
||||
throw new PremiseValidationError("The transport rates for the period " + period.getStartDate().format(DateTimeFormatter.ISO_DATE) + " to " + period.getEndDate().format(DateTimeFormatter.ISO_DATE) + " are insufficient to perform the calculation for route segment" + fromRouteNode.get().getExternalMappingId() + " to " + toRouteNode.get().getExternalMappingId());
|
||||
if (rate.isEmpty()) {
|
||||
var toText = period.getEndDate() == null ? "" : " to " + period.getEndDate().format(DateTimeFormatter.ISO_DATE);
|
||||
throw new PremiseValidationError("The transport rates for the period " + period.getStartDate().format(DateTimeFormatter.ISO_DATE) + toText + " are insufficient to perform the calculation for route segment" + fromRouteNode.get().getExternalMappingId() + " to " + toRouteNode.get().getExternalMappingId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue