修复数据回推时 ,出现可能找不到城市的异常

This commit is contained in:
lulz1 2024-03-18 20:51:57 +08:00
parent 4bfabf6fd3
commit 0f4b7bc6f1
1 changed files with 22 additions and 5 deletions

View File

@ -83,8 +83,25 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
if (flightOrderInfoList != null && flightOrderInfoList.size() == 1) {
FlightOrderInfoEntity flightOrderInfo = flightOrderInfoList.get(0);
FlightInfo flightInfo = flightOrderInfo.getFlightInfo().get(0);
Location departCityName = locationRepository.findByCityId(Long.valueOf(flightInfo.getDCityCode()));
Location arriveCityName = locationRepository.findByCityId(Long.valueOf(flightInfo.getACityName()));
Long originId;
List<Location> listByCityName = locationRepository.findListByCityName(flightInfo.getDCityName());
if (listByCityName == null || listByCityName.isEmpty()) {
originId = null;
} else {
originId = listByCityName.get(0).getLocationId();
}
Long destinationId;
List<Location> arriveLocation = locationRepository.findListByCityName(flightInfo.getACityName());
if (arriveLocation == null || arriveLocation.isEmpty()) {
destinationId = null;
} else {
destinationId = arriveLocation.get(0).getLocationId();
}
String currency = flightOrderInfo.getBasicInfo().getCurrency();
if (currency == null) {
currency = CurrencyType.RENMINBI.getCode();
@ -95,8 +112,8 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
.orderTime(flightOrderInfo.getBasicInfo().getCreateTime())
.startTime(flightInfo.getTakeoffTime())
.endTime(flightInfo.getArrivalTime())
.originId(departCityName.getLocationId())
.destinationId(arriveCityName.getLocationId())
.originId(originId)
.destinationId(destinationId)
.price(String.valueOf(flightInfo.getAmount()))
.selfOrderNo(flightOrderInfo.getBasicInfo().getJourneyID())
.outOrderNo(flightOrderInfo.getBasicInfo().getOrderID())
@ -121,7 +138,7 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
CarQuickOrderInfoEntity carOrderInfo = carOrderInfoList.get(0);
OrderProduct orderProduct = carOrderInfo.getOrderProduct();
CarBasicInfo carBasicInfo = carOrderInfo.getBasicInfo();
Location departCityName = locationRepository.findByCityId(Long.valueOf(orderProduct.getDepartAddress().getCityId()));
Location departCityName = locationRepository.findByCityId(Long.valueOf(orderProduct.getDepartAddress().getCityId()));
Location arriveCityName = locationRepository.findByCityId(Long.valueOf(orderProduct.getArriveAddress().getCityId()));
return builder.productType(LegConstant.LEG_TYPE_TAXI)
.carOrderDetailData(carOrderInfo)