fix:修复高德打车地点无法映射行程的问题

This commit is contained in:
lulz1 2024-05-30 10:15:03 +08:00
parent 54022987a4
commit 52897065ec
5 changed files with 9 additions and 11 deletions

View File

@ -59,5 +59,5 @@ public interface LocationRepository {
List<Location> findNotChintCityByLevel(String locationNames, Integer level);
List<Location> findByLocationNameContainingAndIfInternal(String locationName,Integer ifInternal);
List<Location> findByLocationNameContainingAndIfInternalAndLocationType(String locationName, Integer ifInternal, Integer locationType);
}

View File

@ -61,11 +61,11 @@ public class AmapOrderDataAdapter implements OrderDataAdapter {
}
Optional<Long> startLocationId = locationRepository
.findByLocationNameContainingAndIfInternal(handlerLocationName(data.getStartCity()), 1).stream().findFirst()
.findByLocationNameContainingAndIfInternalAndLocationType(handlerLocationName(data.getStartCity()), 1, 4).stream().findFirst()
.flatMap(it -> Optional.ofNullable(it.getLocationId()));
Optional<Long> endCityLocationId = locationRepository
.findByLocationNameContainingAndIfInternal(handlerLocationName(data.getEndCity()), 1).stream().findFirst()
.findByLocationNameContainingAndIfInternalAndLocationType(handlerLocationName(data.getEndCity()), 1, 4).stream().findFirst()
.flatMap(it -> Optional.ofNullable(it.getLocationId()));
return Optional.of(
@ -86,7 +86,7 @@ public class AmapOrderDataAdapter implements OrderDataAdapter {
.destinationName(data.getEndName())
.supplierName(SUPPLIER_AMAP)
.originId(startLocationId.orElse(null))
.originId(endCityLocationId.orElse(null))
.destinationId(endCityLocationId.orElse(null))
.build());
}
@ -122,7 +122,7 @@ public class AmapOrderDataAdapter implements OrderDataAdapter {
}
//如果最后一位是市去掉最后一位
if (locationName.endsWith("")) {
return locationName.substring(0, locationName.length() - 2);
return locationName.substring(0, locationName.length() - 1);
}
return locationName;
}

View File

@ -215,8 +215,8 @@ public class LocationRepositoryImpl implements LocationRepository {
}
@Override
public List<Location> findByLocationNameContainingAndIfInternal(String locationName, Integer ifInternal) {
return jdbcLocationRepository.findByLocationNameContainingAndIsInternal(locationName, ifInternal);
public List<Location> findByLocationNameContainingAndIfInternalAndLocationType(String locationName, Integer ifInternal, Integer locationType) {
return jdbcLocationRepository.findByLocationNameContainingAndIsInternalAndLocationType(locationName, ifInternal, locationType);
}

View File

@ -70,5 +70,5 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
List<Location> findByLevelAndIsInternal(Integer level, Integer isInternal);
List<Location> findByLocationNameContainingAndIsInternal(String locationName, Integer isInternal);
List<Location> findByLocationNameContainingAndIsInternalAndLocationType(String locationName, Integer isInternal, Integer locationType);
}

View File

@ -1127,9 +1127,7 @@ class RouteApplicationTests {
@Test
void deleteByOrderId() {
orderDetailRepository.deleteById(3105L);
orderDetailRepository.deleteById(3106L);
orderDetailRepository.deleteById(3138L);
}
// @Test