已合并 PR 10093: 修复机票订单明细数据

This commit is contained in:
卢麟哲 2024-03-19 17:21:08 +08:00
commit 446c397da0
20 changed files with 390 additions and 232 deletions

View File

@ -11,6 +11,12 @@ public class RefundOrderGenerateCommand extends Command {
private String amount;
private String type;
private String createTime;
private Object orderInfo;
public RefundOrderGenerateCommand data(Object orderInfo) {
this.orderInfo = orderInfo;
return this;
}
public RefundOrderGenerateCommand Info(String recordId, String orderNo, String amount, String type, String createTime) {
this.recordId = recordId;

View File

@ -9,6 +9,7 @@ import java.util.List;
public class OrderDetailQueryParam extends BaseQuery {
private Long orderId;
private Long routeId;
private String orderNo;
private Integer ifNotStart; //0全部1未出行
private List<Integer> productTypes;
}

View File

@ -8,6 +8,7 @@ import com.chint.application.dtos.OrderSearchResult;
import com.chint.application.dtos.response.OrderDetailRes;
import com.chint.application.queryies.OrderDetailQuery;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.factoriy.order_detail.OrderExtensionCreator;
import com.chint.domain.repository.ClientRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
@ -37,6 +38,7 @@ import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.SupplierNameConstant.*;
@RestController
@RequestMapping("/OrderDetail")
@ -63,6 +65,9 @@ public class OrderDetailController {
@Autowired
private LYSearchRequest lySearchRequest;
@Autowired
private OrderExtensionCreator orderExtensionCreator;
@ApiOperation("订单明细认证接口")
@PostMapping("/public/authentication")
@ -109,36 +114,36 @@ public class OrderDetailController {
@ApiOperation("查询携程订单")
@PostMapping("/public/query/cTrip")
public Result<Object> queryOrderDetail(@RequestBody String orderNo) {
SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderNo);
public Result<Object> queryOrderDetail(@RequestBody OrderDetailQueryParam orderDetailQueryParam) {
SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderDetailQueryParam.getOrderNo());
return Result.Success(SUCCESS, response);
}
@ApiOperation("查询同程订单火车")
@PostMapping("/public/query/ly/train")
public Result<Object> queryOrderDetailTrain(@RequestBody String orderNo) {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo);
public Result<Object> queryOrderDetailTrain(@RequestBody OrderDetailQueryParam orderDetailQueryParam) {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderDetailQueryParam.getOrderNo());
return Result.Success(SUCCESS, trainOrderDetail);
}
@ApiOperation("查询同程订单酒店")
@PostMapping("/public/query/ly/hotel")
public Result<Object> queryOrderDetailHotel(@RequestBody String orderNo) {
HotelDetailResponse response = lySearchRequest.getHotelOrderDetail(orderNo);
public Result<Object> queryOrderDetailHotel(@RequestBody OrderDetailQueryParam orderDetailQueryParam) {
HotelDetailResponse response = lySearchRequest.getHotelOrderDetail(orderDetailQueryParam.getOrderNo());
return Result.Success(SUCCESS, response);
}
@ApiOperation("查询同程订单用车")
@PostMapping("/public/query/ly/car")
public Result<Object> queryOrderDetailCar(@RequestBody String orderNo) {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo);
public Result<Object> queryOrderDetailCar(@RequestBody OrderDetailQueryParam orderDetailQueryParam) {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderDetailQueryParam.getOrderNo());
return Result.Success(SUCCESS, carDetailResponse);
}
@ApiOperation("查询同程订单飞机")
@PostMapping("/public/query/ly/flight")
public Result<Object> queryOrderDetailFlight(@RequestBody String orderNo) {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
public Result<Object> queryOrderDetailFlight(@RequestBody OrderDetailQueryParam orderDetailQueryParam) {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderDetailQueryParam.getOrderNo());
return Result.Success(SUCCESS, flightOrderDetail);
}
@ -146,7 +151,6 @@ public class OrderDetailController {
@TransitionTo(command = "RefundOrderGenerateCommand", order = 0)
public void generateCTripRefund(RefundOrderGenerateCommand command) {
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> {
String newOrderNo = command.getOrderNo() + "-" + command.getRecordId();
String type = command.getType();
Optional<OrderDetail> byOrderNo = orderDetailRepository.findByOrderNo(newOrderNo);
@ -154,7 +158,6 @@ public class OrderDetailController {
return;
}
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
if (routeOrder.getOrderDetails().stream().map(OrderDetail::getOrderNo).toList().contains(newOrderNo)) {
return;
}
@ -184,6 +187,11 @@ public class OrderDetailController {
flightOrderDetail.setDetailId(newOrderNo);
flightOrderDetail.setCreateTime(command.getCreateTime());
flightOrderDetail.setId(null);
if (flightOrderDetail.getSupplier().equals(SUPPLIER_C_TRIP_CN_NAME)) {
orderExtensionCreator.of(SUPPLIER_C_TRIP).updateFlightOrderDetailData(flightOrderDetail, command.getOrderInfo());
} else {
orderExtensionCreator.of(SUPPLIER_L_Y).updateFlightOrderDetailData(flightOrderDetail, command.getOrderInfo());
}
}
if (productType == 2) {
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();

View File

@ -67,7 +67,7 @@ public class OrderOutController {
return Result.Success(SUCCESS, orderQuery.pageQuery(queryData));
}
// @Cacheable(value = "EstimateTrainPrice" , key = "#priceQueryData")
@ApiOperation("查询火车估算价格")
@PostMapping("/estimate/train")
public Result<TrainPriceData> estimateTrainPrice(@RequestBody PriceQueryData priceQueryData) {
@ -75,14 +75,14 @@ public class OrderOutController {
}
// @Cacheable(value = "FlightPriceData" , key = "#priceQueryData")
@ApiOperation("查询飞机估算价格")
@PostMapping("/estimate/flight")
public Result<FlightPriceData> estimateFlightPrice(@RequestBody PriceQueryData priceQueryData) {
return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData));
}
// @Cacheable(value = "HotelPriceData" , key = "#priceQueryData")
@ApiOperation("查询酒店估算价格")
@PostMapping("/estimate/hotel")
public Result<HotelPriceData> estimateHotelPrice(@RequestBody PriceQueryData priceQueryData) {

View File

@ -156,8 +156,7 @@ public class OrderDetailQuery {
}
HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail);
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
orderDetailDto.setApplicantId(approveOrderNo.getCreator());
orderDetailDto.setApplicantId(routeOrder.getUserId());
return orderDetailDto;
}
return null;
@ -175,8 +174,7 @@ public class OrderDetailQuery {
}
TrainOrderDetailDto orderDetailDto = TrainOrderDetailDto.copyFrom(trainOrderDetail);
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
orderDetailDto.setApplicantId(approveOrderNo.getCreator());
orderDetailDto.setApplicantId(routeOrder.getUserId());
return orderDetailDto;
}
return null;
@ -194,8 +192,7 @@ public class OrderDetailQuery {
}
CarOrderDetailDto orderDetailDto = CarOrderDetailDto.copyFrom(carOrderDetail);
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
orderDetailDto.setApplicantId(approveOrderNo.getCreator());
orderDetailDto.setApplicantId(routeOrder.getUserId());
return orderDetailDto;
}
return null;
@ -225,8 +222,7 @@ public class OrderDetailQuery {
orderDetailDto.setChangedTicketNo(changedTicketNo);
}
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
orderDetailDto.setApplicantId(approveOrderNo.getCreator());
orderDetailDto.setApplicantId(routeOrder.getUserId());
return orderDetailDto;
}
return null;

View File

@ -4,13 +4,11 @@ import cn.hutool.core.bean.BeanUtil;
import com.chint.application.dtos.response.*;
import com.chint.application.dtos.trip.*;
import com.chint.application.queryies.estimate.EstimatePrice;
import com.chint.domain.aggregates.location.CityEntity;
import com.chint.domain.aggregates.location.basedata.CountryLevelInfoEntity;
import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity;
import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.*;
import com.chint.domain.service.LegDomainService;
import com.chint.domain.service.OrderDomainService;
@ -36,7 +34,6 @@ import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.FSSCConstant.*;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER;
@ -106,7 +103,7 @@ public class OrderQuery {
User currentUser = BaseContext.getCurrentUser();
//从缓存的地方获取数据该用户所有的行程规划单
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull(currentUser.getEmployeeNo());
List<RouteOrder> routeOrders = routeRepository.findAllByEmployeeNo(currentUser.getEmployeeNo());
if (routeOrders == null || routeOrders.isEmpty()) {

View File

@ -58,7 +58,7 @@ public class RouteOrderFactory implements OrderFactory {
//用于区分测试环境和正式环境的出差申请单
String generate = OrderNo.generate(syscode, billcode);
if (envMark.equals("prod")) {
if (!envMark.equals("prod")) {
generate = generate + envMark;
}
routeOrder.setRouteOrderNo(generate);

View File

@ -32,5 +32,8 @@ public class BaseOrderExtension {
private String standardItems;
// 超标原因
private String overStandardReason;
// 项目订单号
private String projectOrderNo;
// 成本中心
private String costCenter;
}

View File

@ -41,12 +41,14 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Autowired
private LocationRepository locationRepository;
@Autowired
private OrderDetailFactory orderDetailFactory;
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData;
CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo();
String orderNo = carBasicInfo.getOrderId();
String journeyNo = carBasicInfo.getJourneyID();
@ -188,85 +190,20 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) {
FlightOrderInfoEntity flightOrderInfoEntity = (FlightOrderInfoEntity) flightOrderDetailData;
BasicInfo flightOrderBasicInfo = flightOrderInfoEntity.getBasicInfo();
FlightInfo flightInfo = null;
if (!flightOrderInfoEntity.getTripRecordInfoList().isEmpty()) {
flightInfo = flightOrderInfoEntity.getFlightInfo().get(0);
}
TripRecordInfo tripRecordInfo = null;
if (!flightOrderInfoEntity.getTripRecordInfoList().isEmpty()) {
tripRecordInfo = flightOrderInfoEntity.getTripRecordInfoList().get(0);
}
PassengerInfo passengerInfo = null;
PassengerBasic passengerBasic = null;
SequenceInfo sequenceInfo = null;
ChangeInfo changeInfo = null;
if (!flightOrderInfoEntity.getPassengerInfo().isEmpty()) {
passengerInfo = flightOrderInfoEntity.getPassengerInfo().get(0);
passengerBasic = passengerInfo.getPassengerBasic();
if (passengerInfo.getSequenceInfo() != null && !passengerInfo.getSequenceInfo().isEmpty()) {
sequenceInfo = passengerInfo.getSequenceInfo().get(0);
if (sequenceInfo.getChangeInfo() != null && !sequenceInfo.getChangeInfo().isEmpty()) {
changeInfo = sequenceInfo.getChangeInfo().get(0);
}
}
}
// FlightRefundInfo flightRefundInfo = flightOrderInfoEntity.getRefundInfo().get(0);
List<FlightRefundInfo> flightRefundInfoList = flightOrderInfoEntity.getRefundInfo();
FlightRefundInfo flightRefundInfo = new FlightRefundInfo();
if (flightRefundInfoList != null && flightRefundInfoList.size() > 1) {
flightRefundInfo = flightRefundInfoList.get(0);
}
FlightOrderFeeDetail flightOrderFeeDetail = null;
if (!flightOrderInfoEntity.getFlightOrderFeeDetailList().isEmpty()) {
flightOrderFeeDetail = flightOrderInfoEntity.getFlightOrderFeeDetailList().get(0);
}
String orderNo = flightOrderBasicInfo.getOrderID();
String journeyNo = flightOrderBasicInfo.getJourneyID();
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo);
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
Optional<OrderDetail> first = routeOrder.getOrderDetails().stream().filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo)).findFirst();
FlightOrderDetail flightOrderDetail;
if (first.isPresent()) {
if (first.get().getFlightOrderDetail() == null) {
flightOrderDetail = new FlightOrderDetail();
} else {
return first.get().getFlightOrderDetail();
}
} else {
flightOrderDetail = new FlightOrderDetail();
}
Optional<OrderDetail> first = routeOrder
.getOrderDetails()
.stream()
.filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo))
.findFirst();
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildWithRouteOrderAndOrderDetail(routeOrder, first);
// flightOrderDetail.setSupplier(SUPPLIER_C_TRIP_EXTENSION_NAME);
flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
flightOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
}
flightOrderDetail.setOrderNo(orderNo);
flightOrderDetail.setDetailId(orderNo);
//处理订单的状态信息
first.ifPresent(orderDetail -> {
OrderEvent lastEvent = orderDetail.getLastEvent();
if (lastEvent != null) {
@ -276,35 +213,49 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
});
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
flightOrderDetail.setBookingUserCode(user.getEmployeeNo());
flightOrderDetail.setBookingName(user.getName());
flightOrderDetail.setBookingUserPhone(user.getPhoneNumber());
updateFlightOrderDetailData(flightOrderDetail, flightOrderInfoEntity);
return flightOrderDetail;
}
if (flightOrderBasicInfo != null) {
flightOrderDetail.setCreateTime(flightOrderBasicInfo.getCreateTime());
flightOrderDetail.setUserCode(flightOrderBasicInfo.getEmployeeID());
flightOrderDetail.setOrderAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
@Override
public FlightOrderDetail updateFlightOrderDetailData(FlightOrderDetail flightOrderDetail, Object flightOrderInfo) {
FlightOrderInfoEntity flightOrderInfoEntity = (FlightOrderInfoEntity) flightOrderInfo;
BasicInfo flightOrderBasicInfo = flightOrderInfoEntity.getBasicInfo();
//对基础信息的录入OrderBasicInfo
flightOrderDetail.setCreateTime(flightOrderBasicInfo.getCreateTime());
flightOrderDetail.setOrderAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
//只有下单成功得状态会收取服务费
if (flightOrderDetail.equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
flightOrderDetail.setPostServiceFee(String.valueOf(flightOrderBasicInfo.getPostBasicServiceFee()));
flightOrderDetail.setChangeFee(String.valueOf(flightOrderBasicInfo.getChangeAmount()));
flightOrderDetail.setRefundFee(String.valueOf(flightOrderBasicInfo.getRefundAmount()));
if (flightOrderBasicInfo.getPrepayType().equals("ACCNT")) {
flightOrderDetail.setPaymentType("0");
} else {
flightOrderDetail.setPaymentType("1");
}
//付款方式 ACCNT公司统付 其他类型个人支付
if (flightOrderDetail.getPaymentType().equals("0")) {
flightOrderDetail.setCompanyPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
} else {
flightOrderDetail.setPersonalPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
}
} else {
flightOrderDetail.setPostServiceFee(KEEP_TWO_DECIMAL_ZERO);
}
if (flightInfo != null) {
flightOrderDetail.setChangeFee(String.valueOf(flightOrderBasicInfo.getChangeAmount()));
flightOrderDetail.setRefundFee(String.valueOf(flightOrderBasicInfo.getRefundAmount()));
if (flightOrderBasicInfo.getPrepayType().equals("ACCNT")) {
flightOrderDetail.setPaymentType("0");
} else {
flightOrderDetail.setPaymentType("1");
}
//付款方式 ACCNT公司统付 其他类型个人支付
if (flightOrderDetail.getPaymentType().equals("0") && flightOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
flightOrderDetail.setCompanyPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
flightOrderDetail.setPersonalPaymentAmount(KEEP_TWO_DECIMAL_ZERO);
} else {
flightOrderDetail.setCompanyPaymentAmount(KEEP_TWO_DECIMAL_ZERO);
flightOrderDetail.setPersonalPaymentAmount(KEEP_TWO_DECIMAL_ZERO);
}
//默认为0 , 根据不同的状态不同的值
flightOrderDetail.setChangeFee(KEEP_TWO_DECIMAL_ZERO);
flightOrderDetail.setRefundAmount(KEEP_TWO_DECIMAL_ZERO);
flightOrderDetail.setUpFee(KEEP_TWO_DECIMAL_ZERO);
//对飞机明细的航班明细进行录入
List<FlightInfo> flightInfoList = flightOrderInfoEntity.getFlightInfo();
if (flightInfoList != null && !flightInfoList.isEmpty()) {
FlightInfo flightInfo = flightInfoList.get(0);
flightOrderDetail.setStartTime(flightInfo.getTakeoffTime());
flightOrderDetail.setArriveTime(flightInfo.getArrivalTime());
flightOrderDetail.setStartCityName(flightInfo.getDCityName());
@ -323,25 +274,25 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setFlightModel(flightInfo.getFlight());
//前后收服务费
flightOrderDetail.setPreServiceFee(String.valueOf(flightInfo.getItineraryFee()));
flightOrderDetail.setFuelTax(String.valueOf(flightInfo.getOilFee()));
flightOrderDetail.setAirportTax(String.valueOf(flightInfo.getTax()));
flightOrderDetail.setFacePrice(String.valueOf(flightInfo.getPrice()));
flightOrderDetail.setStandard(flightInfo.getClassName() + flightInfo.getPriceRate());
flightOrderDetail.setNotBookedLowestPriceReason(flightInfo.getReasonDesc());
if (flightOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
flightOrderDetail.setFuelTax(String.valueOf(flightInfo.getOilFee()));
flightOrderDetail.setAirportTax(String.valueOf(flightInfo.getTax()));
flightOrderDetail.setFacePrice(String.valueOf(flightInfo.getPrice()));
flightOrderDetail.setStandard(flightInfo.getClassName() + flightInfo.getPriceRate());
flightOrderDetail.setNotBookedLowestPriceReason(flightInfo.getReasonDesc());
} else {
flightOrderDetail.setFuelTax(KEEP_TWO_DECIMAL_ZERO);
flightOrderDetail.setAirportTax(KEEP_TWO_DECIMAL_ZERO);
flightOrderDetail.setFacePrice(KEEP_TWO_DECIMAL_ZERO);
flightOrderDetail.setStandard(flightInfo.getClassName() + flightInfo.getPriceRate());
}
}
if (passengerBasic != null) {
flightOrderDetail.setUserName(passengerBasic.getPassengerName());
flightOrderDetail.setPhone(passengerBasic.getMobilePhone());
flightOrderDetail.setBOOK_ORG_STRUCT_1(passengerBasic.getDept1());
flightOrderDetail.setBOOK_ORG_STRUCT_2(passengerBasic.getDept2());
flightOrderDetail.setBOOK_ORG_STRUCT_3(passengerBasic.getDept3());
}
if (tripRecordInfo != null) {
List<TripRecordInfo> tripRecordInfoList = flightOrderInfoEntity.getTripRecordInfoList();
if (tripRecordInfoList != null && !tripRecordInfoList.isEmpty()) {
TripRecordInfo tripRecordInfo = tripRecordInfoList.get(0);
flightOrderDetail.setUserName(tripRecordInfo.getPassengerName());
flightOrderDetail.setStartTerminal(tripRecordInfo.getDPortBuilding());
flightOrderDetail.setEndTerminal(tripRecordInfo.getAPortBuilding());
flightOrderDetail.setTicketNo(tripRecordInfo.getTicketNo());
@ -349,63 +300,54 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
if (changeInfo != null) {
// flightOrderDetail.setChangeFee(String.valueOf(changeInfo.getDateChangeFee()));
flightOrderDetail.setUpFee(String.valueOf(changeInfo.getPriceDifferential()));
}
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (approveOrderNo != null) {
flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
flightOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
// first.flatMap(orderDetail -> routeOrder.getLegItems()
// .stream()
// .filter(it -> first.get().getLegId().equals(it.getLegId()))
// .findFirst()).ifPresent(it ->
// flightOrderDetail.setScheduleNum(it.getLegNo()));
// if (flightOrderFeeDetail != null) {
// flightOrderDetail.setRefundAmount(String.valueOf(flightOrderFeeDetail.getTransactionAmount()));
// }
if (flightRefundInfo != null) {
if (flightRefundInfo.getRefundDetail() != null && !flightRefundInfo.getRefundDetail().isEmpty()) {
FlightRefundDetail refundDetail = flightRefundInfo.getRefundDetail().get(0);
flightOrderDetail.setRefundFee(String.valueOf(refundDetail.getRefundFee()));
List<PassengerInfo> passengerInfoList = flightOrderInfoEntity.getPassengerInfo();
if (passengerInfoList != null && !passengerInfoList.isEmpty()) {
PassengerInfo passengerInfo = passengerInfoList.get(0);
List<SequenceInfo> sequenceInfoList = passengerInfo.getSequenceInfo();
if (sequenceInfoList != null && !sequenceInfoList.isEmpty()) {
SequenceInfo sequenceInfo = sequenceInfoList.get(0);
if (sequenceInfo.getChangeInfo() != null && !sequenceInfo.getChangeInfo().isEmpty() &&
flightOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_CHANGE)) {
ChangeInfo changeInfo = sequenceInfo.getChangeInfo().get(0);
flightOrderDetail.setUpFee(String.valueOf(changeInfo.getPriceDifferential()));
//如果是改签的要加入改签费
flightOrderDetail.setChangeFee(String.valueOf(changeInfo.getRebookServiceFee()));
flightOrderDetail.setOrderAmount(String.valueOf(changeInfo.getCFee()));
flightOrderDetail.setCompanyPaymentAmount(String.valueOf(changeInfo.getCFee()));
}
}
PassengerBasic passengerBasic = passengerInfo.getPassengerBasic();
if (passengerBasic != null) {
flightOrderDetail.setUserName(passengerBasic.getPassengerName());
flightOrderDetail.setPhone(passengerBasic.getMobilePhone());
flightOrderDetail.setBOOK_ORG_STRUCT_1(passengerBasic.getDept1());
flightOrderDetail.setBOOK_ORG_STRUCT_2(passengerBasic.getDept2());
flightOrderDetail.setBOOK_ORG_STRUCT_3(passengerBasic.getDept3());
}
}
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(flightOrderBasicInfo.getOrderID())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
Optional<Integer> firstOrderEvent = orderDetail.getOrderEventList()
.stream()
.map(OrderEvent::getEventType)
.filter(it -> it.equals(ORDER_EVENT_ETA))
.findFirst();
if (firstOrderEvent.isEmpty()) {
flightOrderDetail.setOverStandard(""); //
} else {
flightOrderDetail.setOverStandard(""); //
List<FlightRefundInfo> flightRefundInfoList = flightOrderInfoEntity.getRefundInfo();
if (flightRefundInfoList != null && !flightRefundInfoList.isEmpty()) {
FlightRefundInfo flightRefundInfo = flightRefundInfoList.get(0);
List<FlightRefundDetail> refundDetailList = flightRefundInfo.getRefundDetail();
if (refundDetailList != null && !refundDetailList.isEmpty() &&
flightOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_REFUND)) {
FlightRefundDetail refundDetail = refundDetailList.get(0);
//这里加一个判断 只有退票状态的机票加入 退票手续费
flightOrderDetail.setRefundFee(String.valueOf(refundDetail.getRefundFee()));
flightOrderDetail.setChangeFee(String.valueOf(refundDetail.getRefundFee()));
flightOrderDetail.setRefundAmount(String.valueOf(flightRefundInfo.getPayCustomerAmount()));
flightOrderDetail.setOrderAmount("-" + flightRefundInfo.getPayCustomerAmount());
flightOrderDetail.setCompanyPaymentAmount("-" + flightRefundInfo.getPayCustomerAmount());
} else {
flightOrderDetail.setRefundAmount(KEEP_TWO_DECIMAL_ZERO);
}
}
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
.stream()
.findFirst();
first1.ifPresent(orderEvent -> flightOrderDetail.setOverStandardReason(orderEvent.getExtension()));
// flightOrderDetail.setPostServiceFee();
// flightOrderDetail.setParentOrderNo();
// flightOrderDetail.setOriginalOrderNo();
// flightOrderDetail.setInsuranceFee();
return flightOrderDetail;
}
@Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {

View File

@ -1,5 +1,6 @@
package com.chint.domain.factoriy.order_detail;
import cn.hutool.core.bean.BeanUtil;
import com.chint.application.queryies.estimate.EstimatePrice;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User;
@ -7,6 +8,7 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity;
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident;
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
@ -44,6 +46,9 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Autowired
private OrderDetailRepository orderDetailRepository;
@Autowired
private OrderDetailFactory orderDetailFactory;
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData;
@ -61,12 +66,166 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) {
// 获取对象的Class对象
FlightOrderResponse.Data data = (FlightOrderResponse.Data) flightOrderDetailData;
FlightOrderDetail convertFlight = convertFlightOrderDetail(data);
return convertFlight;
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
Optional<OrderDetail> first = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(orderDetails.getOrderSerialNo()))
.findFirst();
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildWithRouteOrderAndOrderDetail(routeOrder, first);
//飞机票状态属性保存
OrderEvent lastEvent = orderDetail.getLastEvent();
if (orderDetails.getIsChangeOrder()) {
//如果发现同程的订单号里面还有C就能够判断出 它是改签订单
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE);
}
if (lastEvent != null) {
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
} else {
//如果订单事件为空那么就需要重新根据查询到的订单信息重新进行映射
Integer orderStatus = orderDetails.getOrderStatus();
flightOrderDetail.setOrderStatus(
OrderEvent.mapToFlightOrderDetailStatus(
LYOrderUtil.mapFlightStatus(orderStatus.toString())
)
);
}
//配置订单明细的父订单信息和订单号
flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo());
flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo());
flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo());
//获取订单明细的退票信息 如果有的话也补上
FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = orderDetails.getFlightOrderRefundInfo();
if (flightOrderRefundInfo != null) {
flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee()));
flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice
}
flightOrderDetail.setCreateTime(orderDetails.getBookDate());
flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice()));
flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice()));
flightOrderDetail.setPostServiceFee(String.valueOf(orderDetails.getAfterSettlementServicePrice()));
flightOrderDetail.setCompanyPaymentAmount(String.valueOf(orderDetails.getTotalPrice().toString()));
flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason());
flightOrderDetail.setPaymentType("0");
List<FlightOrderResponse.FlightSegment> flightSegmentList = data.getFlightSegmentList();
if (flightSegmentList != null && !flightSegmentList.isEmpty()) {
FlightOrderResponse.FlightSegment flightSegment = flightSegmentList.get(0);
flightOrderDetail.setEndAirportName(flightSegment.getArriveAirport());
flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode());
flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal());
flightOrderDetail.setDistance(flightSegment.getMileAge().toString());
flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
flightOrderDetail.setFlightNum(flightSegment.getShareNum());
flightOrderDetail.setSeatPoint(flightSegment.getSeatCode());
flightOrderDetail.setSeatPointName(flightSegment.getSeatName());
flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull());
flightOrderDetail.setArriveTime(flightSegment.getArriveTimeFull());
flightOrderDetail.setStartCityName(flightSegment.getDepartCity());
flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport());
flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode());
flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal());
flightOrderDetail.setEndCityName(flightSegment.getArriveCity());
flightOrderDetail.setFlightModel(flightSegment.getFlightNo());
flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount());
}
List<FlightOrderResponse.Passenger> passengerList = data.getPassengerList();
if (passengerList != null && !passengerList.isEmpty()) {
FlightOrderResponse.Passenger passenger = data.getPassengerList().get(0);
flightOrderDetail.setFuelTax(passenger.getFuelTax().toString());
flightOrderDetail.setAirportTax(passenger.getAirportTax().toString());
flightOrderDetail.setFacePrice(passenger.getParPrice().toString());
flightOrderDetail.setChangeFee(passenger.getChangeFee().toString());
flightOrderDetail.setUpFee(passenger.getChangePrice().toString());
flightOrderDetail.setTicketNo(passenger.getTicketNo());
flightOrderDetail.setChangedTicketNo(passenger.getTicketNo()); //无改签后票号
flightOrderDetail.setUserName(passenger.getPassengerName());
flightOrderDetail.setUserCode(passenger.getOutEmployeeId());
flightOrderDetail.setPhone(passenger.getContractPhone());
flightOrderDetail.setInsuranceFee(passenger.getInsurancePrice().toString());
}
return flightOrderDetail;
}
@Override
public FlightOrderDetail updateFlightOrderDetailData(FlightOrderDetail flightOrderDetail, Object flightOrderInfo) {
FlightOrderResponse.Data data = (FlightOrderResponse.Data) flightOrderInfo;
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
//配置订单明细的父订单信息和订单号
flightOrderDetail.setParentOrderNo(orderDetails.getParentOrderSerialNo());
flightOrderDetail.setOriginalOrderNo(orderDetails.getOriginalOrderNo());
flightOrderDetail.setChangedScheduleNum(orderDetails.getOriginalOrderNo());
//获取订单明细的退票信息 如果有的话也补上
FlightOrderResponse.FlightOrderRefundInfo flightOrderRefundInfo = orderDetails.getFlightOrderRefundInfo();
if (flightOrderRefundInfo != null) {
flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee()));
flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice
}
flightOrderDetail.setCreateTime(orderDetails.getBookDate());
flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice()));
flightOrderDetail.setPreServiceFee(String.valueOf(orderDetails.getServicePrice()));
flightOrderDetail.setPostServiceFee(String.valueOf(orderDetails.getAfterSettlementServicePrice()));
flightOrderDetail.setCompanyPaymentAmount(String.valueOf(orderDetails.getTotalPrice().toString()));
flightOrderDetail.setNotBookedLowestPriceReason(orderDetails.getFoulReason());
flightOrderDetail.setPaymentType("0");
List<FlightOrderResponse.FlightSegment> flightSegmentList = data.getFlightSegmentList();
if (flightSegmentList != null && !flightSegmentList.isEmpty()) {
FlightOrderResponse.FlightSegment flightSegment = flightSegmentList.get(0);
flightOrderDetail.setEndAirportName(flightSegment.getArriveAirport());
flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode());
flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal());
flightOrderDetail.setDistance(flightSegment.getMileAge().toString());
flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
flightOrderDetail.setFlightNum(flightSegment.getShareNum());
flightOrderDetail.setSeatPoint(flightSegment.getSeatCode());
flightOrderDetail.setSeatPointName(flightSegment.getSeatName());
flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull());
flightOrderDetail.setArriveTime(flightSegment.getArriveTimeFull());
flightOrderDetail.setStartCityName(flightSegment.getDepartCity());
flightOrderDetail.setStartAirportName(flightSegment.getDepartAirport());
flightOrderDetail.setStartAirportCode(flightSegment.getDepartAirportCode());
flightOrderDetail.setStartTerminal(flightSegment.getDepartTerminal());
flightOrderDetail.setEndCityName(flightSegment.getArriveCity());
flightOrderDetail.setFlightModel(flightSegment.getFlightNo());
flightOrderDetail.setStandard(flightSegment.getSeatName() + flightSegment.getSeatDiscount());
}
List<FlightOrderResponse.Passenger> passengerList = data.getPassengerList();
if (passengerList != null && !passengerList.isEmpty()) {
FlightOrderResponse.Passenger passenger = data.getPassengerList().get(0);
flightOrderDetail.setFuelTax(passenger.getFuelTax().toString());
flightOrderDetail.setAirportTax(passenger.getAirportTax().toString());
flightOrderDetail.setFacePrice(passenger.getParPrice().toString());
flightOrderDetail.setChangeFee(passenger.getChangeFee().toString());
flightOrderDetail.setUpFee(passenger.getChangePrice().toString());
flightOrderDetail.setTicketNo(passenger.getTicketNo());
flightOrderDetail.setChangedTicketNo(passenger.getTicketNo()); //无改签后票号
flightOrderDetail.setUserName(passenger.getPassengerName());
flightOrderDetail.setUserCode(passenger.getOutEmployeeId());
flightOrderDetail.setPhone(passenger.getContractPhone());
flightOrderDetail.setInsuranceFee(passenger.getInsurancePrice().toString());
}
return flightOrderDetail;
}
@Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderDetailData;
@ -86,6 +245,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo())
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
FlightOrderDetail flightOrderDetail = new FlightOrderDetail();
if (approveOrderNo != null) {
@ -167,7 +327,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (flightOrderRefundInfo != null) {
flightOrderDetail.setRefundFee(String.valueOf(flightOrderRefundInfo.getRefundFee()));
flightOrderDetail.setRefundAmount(String.valueOf(flightOrderRefundInfo.getRefundPrice())); //无refundPrice
}
flightOrderDetail.setCreateTime(orderDetails.getBookDate());
flightOrderDetail.setOrderAmount(String.valueOf(orderDetails.getTotalPrice()));
@ -685,7 +844,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
List<CarDetailResponse.SubmitItem> submitItemList =
data.getTravelDataInfo().getSubmitItemList();
@ -751,5 +909,4 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
}

View File

@ -1,7 +1,12 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.value_object.*;
import com.chint.domain.aggregates.order.FlightOrderDetail;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.OrderEvent;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.value_object.OrderLegData;
import java.util.Optional;
public interface OrderDetailFactory {
OrderDetail create(OrderLegData orderLegData);
@ -9,4 +14,6 @@ public interface OrderDetailFactory {
OrderEvent createEvent(Integer eventType, String outStatus);
BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder);
FlightOrderDetail buildWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail);
}

View File

@ -1,17 +1,19 @@
package com.chint.domain.factoriy.order_detail;
import cn.hutool.core.bean.BeanUtil;
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 com.chint.domain.value_object.OrderLegData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Optional;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@Component
@ -19,18 +21,19 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
@Autowired
private UserRepository userRepository;
@Override
public OrderDetail create(OrderLegData orderLegData) {
OrderDetail orderDetail = OrderDetail.of(orderLegData.getOutOrderNo(), orderLegData.getSupplierName());
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if(orderLegData.getStartTime() != null){
if (orderLegData.getStartTime() != null) {
orderDetail.setStartTime(LocalDateTime.parse(orderLegData.getStartTime(), dateTimeFormatter));
}
if(orderLegData.getEndTime() != null){
if (orderLegData.getEndTime() != null) {
orderDetail.setEndTime(LocalDateTime.parse(orderLegData.getEndTime(), dateTimeFormatter));
}
orderDetail.setOrderDate(LocalDateTime.parse(orderLegData.getOrderTime(), dateTimeFormatter));
// orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode()));
// orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode()));
orderDetail.setDestinationId(orderLegData.getDestinationId());
orderDetail.setOriginId(orderLegData.getOriginId());
orderDetail
@ -48,6 +51,7 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
@Override
public BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder) {
routeOrder.reloadStatus();
BaseOrderExtension baseOrderExtension = new BaseOrderExtension();
//完成身份信息
String userId = routeOrder.getUserId();
@ -59,33 +63,66 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
//配置供应商信息
String supplierName = routeOrder.getSupplierName();
if(supplierName.equals(SUPPLIER_C_TRIP)){
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 (approveOrderNo != null) {
baseOrderExtension.setAccountCompanyId(approveOrderNo.getAccountCompanyCode());
baseOrderExtension.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
baseOrderExtension.setCostCenter(approveOrderNo.getCostCenter());
baseOrderExtension.setProjectOrderNo(approveOrderNo.getProjectName());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
baseOrderExtension.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
baseOrderExtension.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
baseOrderExtension.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
baseOrderExtension.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
}
}
// 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);
// }
// }
//配置唯一标识
baseOrderExtension.setReceiptsNum(routeOrder.getRouteOrderNo());
baseOrderExtension.setSupplier(routeOrder.getSupplierCNName());
return baseOrderExtension;
}
@Override
public FlightOrderDetail buildWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> first) {
//获取飞机订单明细
FlightOrderDetail flightOrderDetail;
if (first.isPresent()) {
OrderDetail orderDetail = first.get();
if (orderDetail.getFlightOrderDetail() == null) {
flightOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), FlightOrderDetail.class);
} else {
return orderDetail.getFlightOrderDetail();
}
//如果订单存在直接配置该订单的超标信息和原因
orderDetail.getOrderEventList()
.stream()
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
.findFirst()
.ifPresentOrElse(it -> {
flightOrderDetail.setOverStandard("");
flightOrderDetail.setOverStandardReason(it.getExtension());
}, () -> flightOrderDetail.setOverStandard(""));
flightOrderDetail.setOrderNo(orderDetail.getOrderNo());
flightOrderDetail.setDetailId(orderDetail.getOrderNo());
} else {
flightOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), FlightOrderDetail.class);
}
return flightOrderDetail;
}
}

View File

@ -1,7 +1,7 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.value_object.*;
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity;
public interface OrderExtensionFactory {
@ -11,6 +11,8 @@ public interface OrderExtensionFactory {
FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData);
FlightOrderDetail updateFlightOrderDetailData(FlightOrderDetail flightOrderDetail, Object flightOrderInfo);
HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData);
OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData);

View File

@ -32,7 +32,7 @@ public interface RouteRepository {
List<RouteOrder> findByActualOrderNoNotNull(OrderQueryData orderQueryData);
List<RouteOrder> findByActualOrderNoNotNull(String employeeNo);
List<RouteOrder> findAllByEmployeeNo(String employeeNo);
Page<RouteOrder> findByTime(OrderQueryData queryData);

View File

@ -470,7 +470,7 @@ public class OrderDomainService {
"-" + flightRefundInfo.getPayCustomerAmount(),
"3",
flightRefundInfo.getRefundAplyTime()
).sendToQueue();
).data(flightOrderInfoEntity).sendToQueue();
}
}
}
@ -497,7 +497,7 @@ public class OrderDomainService {
String.valueOf(info.getCFee()),
"2",
info.getRebookedTime()
).sendToQueue();
).data(flightOrderInfoEntity).sendToQueue();
}
}
}
@ -561,7 +561,6 @@ public class OrderDomainService {
private void lyFlightRefundGenerate(String orderNo) {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
}
private void lyHotelRefundGenerate(String orderNo) {

View File

@ -29,6 +29,7 @@ public class RouteCacheService {
routeCacheManage.cacheFakeOrderNoAndSysCodeMapRouteId(approveOrderNo.getFakeOrderNo(), approveOrderNo.getSysCode(), routeOrder);
routeCacheManage.cacheActualOrderNoAndSysCodeMapRouteId(approveOrderNo.getActualOrderNo(), approveOrderNo.getSysCode(), routeOrder);
}
invalidateUserRoutesCache(employeeNo);
//获取当前用户所有的订单 缓存用户的routeIds列表
routeCacheManage.getRouteIdsByEmployeeNo(employeeNo, routeOrders, null);
return routeOrders;
@ -43,7 +44,6 @@ public class RouteCacheService {
.getRouteListByIds(routeIdsByEmployeeNo)
.stream()
.filter(Objects::nonNull)
.filter(it -> it.getApproveOrderNo() != null && it.getApproveOrderNo().getActualOrderNo() != null)
.toList();
//如果这里数量对不上名单那么对该用户的信息重新进行缓存
if (routeListByIds.size() != routeIdsByEmployeeNo.size()) {

View File

@ -131,7 +131,7 @@ public class RouteRepositoryImpl implements RouteRepository {
}
@Override
public List<RouteOrder> findByActualOrderNoNotNull(String employeeNo) {
public List<RouteOrder> findAllByEmployeeNo(String employeeNo) {
return routeCacheService.getUserRoutes(employeeNo);
// return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(employeeNo, employeeNo);
}

View File

@ -19,6 +19,7 @@ public class UserRepositoryImpl implements UserRepository {
}
@Cacheable(value = "RindByUserEmployeeNo",key = "#employeeNo")
@Override
public User findByUserEmployeeNo(String employeeNo) {
return jdbcUserRepository.findByEmployeeNo(employeeNo);

View File

@ -3,10 +3,11 @@ package com.chint.interfaces.rest.ctrip.dto.search.flight;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class BasicInfo {
public class BasicInfo implements Serializable {
private String OrderID;
private String TripID;
private String OrderStatus;

View File

@ -4,6 +4,7 @@ package com.chint.interfaces.rest.ctrip.dto.search.flight;
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
@ -14,7 +15,7 @@ import java.util.List;
* @vsrsion 1.0
**/
@Data
public class FlightOrderInfoEntity {
public class FlightOrderInfoEntity implements Serializable {
private BasicInfo BasicInfo;
private DeliveryInfo DeliveryInfo;
private List<FlightInfo> FlightInfo;