其他类型的城市查询过滤机场数据

This commit is contained in:
lulz1 2024-03-24 17:32:11 +08:00
parent 5101ea9e16
commit 60614f7208
4 changed files with 23 additions and 14 deletions

View File

@ -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()

View File

@ -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) ||
return leg.getLegType().equals(orderDetail.getProductType()) &&
(originLocation.getLocationId().equals(orderDetailOriginId) ||
originLocation.getParentLocationId().equals(orderDetailOriginId))
&& (destinationLocation.getLocationId().equals(orderDetailDestinationId) ||
&&
(destinationLocation.getLocationId().equals(orderDetailDestinationId) ||
destinationLocation.getParentLocationId().equals(orderDetailDestinationId));
})
.toList();

View File

@ -76,8 +76,8 @@ public class LocationRepositoryImpl implements LocationRepository {
}
@Override
public List<Location> findByCityIdAndLocationType(Long cityId , Integer LocationType) {
return jdbcLocationRepository.findByCityIdAndLocationType(cityId,LocationType);
public List<Location> 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);

View File

@ -33,14 +33,12 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
List<Location> findByLocationPathNameContaining(String localName);
List<Location> findByFirstPinYinAndIsInternalAndIsHaveAirportAndLevelOrFirstPinYinAndIsInternalAndIsHaveAirportAndLevel(String firstPinYin, Integer isInternal, Integer isHaveAirport, Integer level,
String firstPinYin2, Integer isInternal2, Integer isHaveAirport2, Integer level2);
List<Location> 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<Location> findByFirstPinYinAndIsInternalAndLevelOrFirstPinYinAndIsInternalAndLevel(String firstPinYin, Integer isInternal, Integer level,
String firstPinYin2, Integer isInternal2, Integer level2);
List<Location> findByLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevelOrLocationPathNameContainingAndIsInternalAndIsHaveAirportAndLevel(String locationPathName, Integer isInternal, Integer isHaveAirport, Integer level,
String locationPathName2, Integer isInternal2, Integer isHaveAirport2, Integer level2);
List<Location> 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<Location> findByLocationPathNameContainingAndIsInternalAndLevelOrLocationPathNameContainingAndIsInternalAndLevel(String locationPathName, Integer isInternal, Integer level,
String locationPathName2, Integer isInternal2, Integer level2);