diff --git a/src/main/java/com/chint/application/out/LocationController.java b/src/main/java/com/chint/application/out/LocationController.java index 8d19de1d..e94c7d95 100644 --- a/src/main/java/com/chint/application/out/LocationController.java +++ b/src/main/java/com/chint/application/out/LocationController.java @@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RestController; import java.util.List; import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; +import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_AIRPLANE; +import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_AIRPORT; @RestController @RequestMapping("/location") @@ -51,6 +53,14 @@ public class LocationController { locations = locationDomainService.queryByFirstLetter(locationParam); } + if (locationParam.getProductType() != LEG_TYPE_AIRPLANE) { + //过滤机场数据 + locations = locations + .stream() + .filter(it -> it.getLocationType().equals(LOCATION_TYPE_AIRPORT)) + .toList(); + } + if (locations != null && !locations.isEmpty()) { locationRes = locations .stream() diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java index 6303f7c8..0b5eba35 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -421,10 +421,11 @@ public class RouteOrder implements Serializable { Location destinationLocation = leg.getDestinationLocation(); Long orderDetailOriginId = orderDetail.getOriginId(); Long orderDetailDestinationId = orderDetail.getDestinationId(); - return leg.getLegType().equals(orderDetail.getProductType()) - && (originLocation.getLocationId().equals(orderDetailOriginId) || - originLocation.getParentLocationId().equals(orderDetailOriginId)) - && (destinationLocation.getLocationId().equals(orderDetailDestinationId) || + return leg.getLegType().equals(orderDetail.getProductType()) && + (originLocation.getLocationId().equals(orderDetailOriginId) || + originLocation.getParentLocationId().equals(orderDetailOriginId)) + && + (destinationLocation.getLocationId().equals(orderDetailDestinationId) || destinationLocation.getParentLocationId().equals(orderDetailDestinationId)); }) .toList(); diff --git a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java index a99735a3..ae743cb7 100644 --- a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java @@ -76,8 +76,8 @@ public class LocationRepositoryImpl implements LocationRepository { } @Override - public List findByCityIdAndLocationType(Long cityId , Integer LocationType) { - return jdbcLocationRepository.findByCityIdAndLocationType(cityId,LocationType); + public List findByCityIdAndLocationType(Long cityId, Integer LocationType) { + return jdbcLocationRepository.findByCityIdAndLocationType(cityId, LocationType); } @Override @@ -113,8 +113,8 @@ public class LocationRepositoryImpl implements LocationRepository { Integer cityType = locationParam.getCityType(); String queryWord = locationParam.getQueryWord(); if (productType.equals(LEG_TYPE_AIRPLANE)) { - return jdbcLocationRepository.findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel( - queryWord, cityType, 1, 3, queryWord, cityType, 1, 4); + return jdbcLocationRepository.findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel( + queryWord, cityType, 1, 3, queryWord, cityType, 1, 4, queryWord, cityType, 1, 5); } else { return jdbcLocationRepository.findByFirstPinYinAndIsInternalAndLevelOrFirstPinYinAndIsInternalAndLevel( queryWord, cityType, 3, queryWord, cityType, 4); @@ -128,8 +128,8 @@ public class LocationRepositoryImpl implements LocationRepository { Integer cityType = locationParam.getCityType(); String queryWord = locationParam.getQueryWord(); if (productType.equals(LEG_TYPE_AIRPLANE)) { - return jdbcLocationRepository.findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel( - queryWord, cityType, 1, 3, queryWord, cityType, 1, 4); + return jdbcLocationRepository.findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel( + queryWord, cityType, 1, 3, queryWord, cityType, 1, 4, queryWord, cityType, 1, 5); } else { return jdbcLocationRepository.findByLocationPathNameContainingAndIsInternalAndLevelOrLocationPathNameContainingAndIsInternalAndLevel( queryWord, cityType, 3, queryWord, cityType, 4); diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java index d10b7507..2b65a35a 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java @@ -33,14 +33,12 @@ public interface JdbcLocationRepository extends CrudRepository { List findByLocationPathNameContaining(String localName); - List findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(String firstPinYin, Integer isInternal, Integer isHaveAirport, Integer level, - String firstPinYin2, Integer isInternal2, Integer isHaveAirport2, Integer level2); + List findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(String firstPinYin, Integer isInternal, Integer isHaveAirport, Integer level, String firstPinYin2, Integer isInternal2, Integer isHaveAirport2, Integer level2, String firstPinYin3, Integer isInternal3, Integer isHaveAirport3, Integer level3); List findByFirstPinYinAndIsInternalAndLevelOrFirstPinYinAndIsInternalAndLevel(String firstPinYin, Integer isInternal, Integer level, String firstPinYin2, Integer isInternal2, Integer level2); - List findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(String locationPathName, Integer isInternal, Integer isHaveAirport, Integer level, - String locationPathName2, Integer isInternal2, Integer isHaveAirport2, Integer level2); + List findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(String locationPathName, Integer isInternal, Integer isHaveAirport, Integer level, String locationPathName2, Integer isInternal2, Integer isHaveAirport2, Integer level2, String locationPathName3, Integer isInternal3, Integer isHaveAirport3, Integer level3); List findByLocationPathNameContainingAndIsInternalAndLevelOrLocationPathNameContainingAndIsInternalAndLevel(String locationPathName, Integer isInternal, Integer level, String locationPathName2, Integer isInternal2, Integer level2);