修改城市英文名查询逻辑
This commit is contained in:
parent
cc5ee788d9
commit
1a3d3aece4
|
@ -16,6 +16,13 @@ import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
|
|||
import com.chint.infrastructure.util.Digest;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -30,7 +37,6 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CHANGE;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/OrderDetail")
|
||||
|
@ -51,6 +57,12 @@ public class OrderDetailController {
|
|||
@Autowired
|
||||
private OrderDetailQuery orderDetailPageQuery;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderSearchRequest cTripOrderSearchRequest;
|
||||
|
||||
@Autowired
|
||||
private LYSearchRequest lySearchRequest;
|
||||
|
||||
|
||||
@ApiOperation("订单明细认证接口")
|
||||
@PostMapping("/public/authentication")
|
||||
|
@ -95,6 +107,41 @@ public class OrderDetailController {
|
|||
return Result.Success(SUCCESS, orderDetailResPageResult);
|
||||
}
|
||||
|
||||
@ApiOperation("查询携程订单")
|
||||
@PostMapping("/public/query/cTrip")
|
||||
public Result<Object> queryOrderDetail(@RequestBody String orderNo) {
|
||||
SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderNo);
|
||||
return Result.Success(SUCCESS, response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询同程订单火车")
|
||||
@PostMapping("/public/query/ly/train")
|
||||
public Result<Object> queryOrderDetailTrain(@RequestBody String orderNo) {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo);
|
||||
return Result.Success(SUCCESS, trainOrderDetail);
|
||||
}
|
||||
|
||||
@ApiOperation("查询同程订单酒店")
|
||||
@PostMapping("/public/query/ly/hotel")
|
||||
public Result<Object> queryOrderDetailHotel(@RequestBody String orderNo) {
|
||||
HotelDetailResponse response = lySearchRequest.getHotelOrderDetail(orderNo);
|
||||
return Result.Success(SUCCESS, response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询同程订单用车")
|
||||
@PostMapping("/public/query/ly/car")
|
||||
public Result<Object> queryOrderDetailCar(@RequestBody String orderNo) {
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo);
|
||||
return Result.Success(SUCCESS, carDetailResponse);
|
||||
}
|
||||
|
||||
@ApiOperation("查询同程订单飞机")
|
||||
@PostMapping("/public/query/ly/flight")
|
||||
public Result<Object> queryOrderDetailFlight(@RequestBody String orderNo) {
|
||||
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
|
||||
return Result.Success(SUCCESS, flightOrderDetail);
|
||||
}
|
||||
|
||||
|
||||
@TransitionTo(command = "RefundOrderGenerateCommand", order = 0)
|
||||
public void generateCTripRefund(RefundOrderGenerateCommand command) {
|
||||
|
@ -108,7 +155,7 @@ public class OrderDetailController {
|
|||
}
|
||||
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
||||
|
||||
if(routeOrder.getOrderDetails().stream().map(OrderDetail::getOrderNo).toList().contains(newOrderNo)){
|
||||
if (routeOrder.getOrderDetails().stream().map(OrderDetail::getOrderNo).toList().contains(newOrderNo)) {
|
||||
return;
|
||||
}
|
||||
Integer productType = orderDetail.getProductType();
|
||||
|
|
|
@ -375,27 +375,30 @@ public class OrderQuery {
|
|||
|
||||
List<Location> locationListAfterNotNull = locationList.stream().filter(Objects::nonNull).toList();
|
||||
|
||||
List<CityEntity> cityEntities = new ArrayList<>();
|
||||
// List<CityEntity> cityEntities = new ArrayList<>();
|
||||
for (Location location : locationListAfterNotNull) {
|
||||
// if (location.getLocationEnName() == null) {
|
||||
// //这里的代码来补充地理位置的英文名
|
||||
// Integer level = location.getLevel();
|
||||
// if (level.equals(LOCATION_TYPE_CITY)) {
|
||||
// PrefectureLevelCityInfoEntity cityInfo = prefectureLevelRepository.findByCityId(location.getCityId());
|
||||
// location.setLocationEnName(cityInfo.getCityEnName());
|
||||
// } else if (level.equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().contains("D")) {
|
||||
// DistrictPOIInfoEntity byCityId = districtInfoRepository.findByCityId(location.getCityId());
|
||||
// location.setLocationEnName(byCityId.getDistrictEnName());
|
||||
// } else if (level.equals(LOCATION_TYPE_COUNTY)) {
|
||||
// CountryLevelInfoEntity byCityId = countryLevelInfoRepository.findByCityId(location.getCityId());
|
||||
// location.setLocationEnName(byCityId.getCountyEnName());
|
||||
// } else {
|
||||
// location.setLocationEnName("unknown");
|
||||
// }
|
||||
// }
|
||||
|
||||
CityEntity city = cityRepository.findByCityName(location.getLocationName());
|
||||
cityEntities.add(city);
|
||||
if (location.getLocationEnName() == null) {
|
||||
//这里的代码来补充地理位置的英文名
|
||||
Integer level = location.getLevel();
|
||||
if (level.equals(LOCATION_TYPE_CITY)) {
|
||||
PrefectureLevelCityInfoEntity cityInfo = prefectureLevelRepository.findByCityId(location.getCityId());
|
||||
location.setLocationEnName(cityInfo.getCityEnName());
|
||||
} else if (level.equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().contains("D")) {
|
||||
DistrictPOIInfoEntity byCityId = districtInfoRepository.findByCityId(location.getCityId());
|
||||
location.setLocationEnName(byCityId.getDistrictEnName());
|
||||
} else if (level.equals(LOCATION_TYPE_COUNTY)) {
|
||||
CountryLevelInfoEntity byCityId = countryLevelInfoRepository.findByCityId(location.getCityId());
|
||||
location.setLocationEnName(byCityId.getCountyEnName());
|
||||
} else {
|
||||
location.setLocationEnName("unknown");
|
||||
}
|
||||
locationRepository.saveAll(List.of(location));
|
||||
}
|
||||
|
||||
|
||||
// CityEntity city = cityRepository.findByCityName(location.getLocationName());
|
||||
// cityEntities.add(city);
|
||||
callbackDataBuilder.cityList()
|
||||
.cityName(location.getLocationName())
|
||||
.cityEnName(location.getLocationEnName())
|
||||
|
@ -405,32 +408,30 @@ public class OrderQuery {
|
|||
List<ScheduleDetail> scheduleDetails = legItems.stream()
|
||||
.map(leg -> {
|
||||
leg.reloadStatus();
|
||||
CityEntity originCity;
|
||||
CityEntity destinationCity;
|
||||
// CityEntity originCity;
|
||||
// CityEntity destinationCity;
|
||||
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail
|
||||
.builder()
|
||||
.legId(leg.getLegId());
|
||||
if (!leg.getLegType().equals(LEG_TYPE_OTHER)) {
|
||||
if (leg.getOriginLocation() != null) {
|
||||
originCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
.getCityName()
|
||||
.equals(leg.getOriginLocation().getLocationName()))
|
||||
.findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
Location originLocation = leg.getOriginLocation();
|
||||
if (originLocation != null) {
|
||||
// originCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
// .getCityName()
|
||||
// .equals(leg.getOriginLocation().getLocationName()))
|
||||
// .findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
scheduleDetailBuilder
|
||||
.startCity(originCity.getCityName())
|
||||
.startCityName(originCity.getCityName())
|
||||
.startCityEnName(originCity.getCityename());
|
||||
.startCity(originLocation.getLocationName())
|
||||
.startCityName(originLocation.getLocationName())
|
||||
.startCityEnName(originLocation.getLocationEnName());
|
||||
}
|
||||
|
||||
if (leg.getDestinationLocation() != null) {
|
||||
destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
.getCityName()
|
||||
.equals(leg.getDestinationLocation().getLocationName()))
|
||||
.findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
Location destinationLocation = leg.getDestinationLocation();
|
||||
if (destinationLocation != null) {
|
||||
scheduleDetailBuilder
|
||||
.endCityName(destinationCity.getCityName())
|
||||
.endCity(destinationCity.getCityName())
|
||||
.endCityEnName(destinationCity.getCityename());
|
||||
.endCityName(destinationLocation.getLocationName())
|
||||
.endCity(destinationLocation.getLocationName())
|
||||
.endCityEnName(destinationLocation.getLocationEnName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,7 +448,6 @@ public class OrderQuery {
|
|||
.currencyNameUS(leg.getCurrencyType().getAbbreviation());
|
||||
}
|
||||
|
||||
|
||||
LegExtensionField legExtensionField = leg.getLegExtensionField();
|
||||
if (legExtensionField != null) {
|
||||
List<Location> locationList1 = legExtensionField.getLocationList();
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.chint.domain.factoriy.order_detail;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BaseOrderExtension {
|
||||
// 数据来源商旅平台
|
||||
private String trvaleSysType;
|
||||
// 对应所属系统
|
||||
private String belongSysType;
|
||||
// 订单号
|
||||
private String orderNo;
|
||||
// 消费明细唯一标识
|
||||
private String detailId;
|
||||
// 核算企业id
|
||||
private String accountCompanyId;
|
||||
// 核算企业名称
|
||||
private String accountCompanyName;
|
||||
// 申请单号
|
||||
private String receiptsNum;
|
||||
// 行程编号
|
||||
private String scheduleNum;
|
||||
// 预订人Code
|
||||
private String bookingUserCode;
|
||||
// 预订人姓名
|
||||
private String bookingName;
|
||||
// 预订人电话
|
||||
private String bookingUserPhone;
|
||||
// 资源供应商
|
||||
private String supplier;
|
||||
// 差标
|
||||
private String standardItems;
|
||||
// 超标原因
|
||||
private String overStandardReason;
|
||||
|
||||
}
|
|
@ -99,7 +99,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
if (!data.getFlightSegmentList().isEmpty()) {
|
||||
flightSegment = data.getFlightSegmentList().get(0);
|
||||
}
|
||||
FlightOrderResponse.TravelData travelData = data.getTravelData();
|
||||
|
||||
FlightOrderResponse.Passenger passenger = null;
|
||||
if (!data.getPassengerList().isEmpty()) {
|
||||
passenger = data.getPassengerList().get(0);
|
||||
|
@ -749,4 +749,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,4 +8,5 @@ public interface OrderDetailFactory {
|
|||
|
||||
OrderEvent createEvent(Integer eventType, String outStatus);
|
||||
|
||||
BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
package com.chint.domain.factoriy.order_detail;
|
||||
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.domain.value_object.enums.CurrencyType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||
|
||||
@Component
|
||||
public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
@Override
|
||||
public OrderDetail create(OrderLegData orderLegData) {
|
||||
OrderDetail orderDetail = OrderDetail.of(orderLegData.getOutOrderNo(), orderLegData.getSupplierName());
|
||||
|
@ -36,4 +45,47 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
|||
orderEvent.setHappenTime(LocalDateTime.now());
|
||||
return orderEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder) {
|
||||
BaseOrderExtension baseOrderExtension = new BaseOrderExtension();
|
||||
//完成身份信息
|
||||
String userId = routeOrder.getUserId();
|
||||
User user = userRepository.findByUserEmployeeNo(userId);
|
||||
|
||||
baseOrderExtension.setBookingUserCode(user.getEmployeeNo());
|
||||
baseOrderExtension.setBookingName(user.getName());
|
||||
baseOrderExtension.setBookingUserPhone(user.getPhoneNumber());
|
||||
|
||||
//配置供应商信息
|
||||
String supplierName = routeOrder.getSupplierName();
|
||||
if(supplierName.equals(SUPPLIER_C_TRIP)){
|
||||
baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
|
||||
} else {
|
||||
baseOrderExtension.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
|
||||
}
|
||||
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
if(approveOrderNo != null){
|
||||
|
||||
}
|
||||
|
||||
// if (sysCode != null) {
|
||||
// if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
||||
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
|
||||
// }
|
||||
// if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
|
||||
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
|
||||
//
|
||||
// }
|
||||
// if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
|
||||
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
|
||||
// }
|
||||
// if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
|
||||
// trainOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
|
||||
// }
|
||||
// }
|
||||
|
||||
return baseOrderExtension;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue