已合并 PR 10135: 修复订单明细的细节问题
This commit is contained in:
commit
958c8bd8e4
|
@ -178,6 +178,9 @@ public class OrderDetailController {
|
|||
trainOrderDetail.setDetailId(newOrderNo);
|
||||
trainOrderDetail.setCreateTime(command.getCreateTime());
|
||||
trainOrderDetail.setId(null);
|
||||
if(trainOrderDetail.getSupplier().equals(SUPPLIER_L_Y_CN_NAME)){
|
||||
orderExtensionCreator.of(SUPPLIER_L_Y).updateTrainOrderDetailData(trainOrderDetail,command.getOrderInfo());
|
||||
}
|
||||
}
|
||||
if (productType == 1) {
|
||||
FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail();
|
||||
|
|
|
@ -141,10 +141,16 @@ public class OrderDetailQuery {
|
|||
|
||||
private Object processHotelOrderDetail(OrderDetail orderDetail, String systemType) {
|
||||
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();
|
||||
|
||||
if (hotelOrderDetail != null &&
|
||||
hotelOrderDetail.getOrderStatus() != null &&
|
||||
!hotelOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL) &&
|
||||
systemType.equals(hotelOrderDetail.getBelongSysType())) {
|
||||
|
||||
if (hotelOrderDetail.getCreateTime().contains("1900") || hotelOrderDetail.getCreateTime().contains("2999")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String receiptsNum = hotelOrderDetail.getReceiptsNum();
|
||||
if (receiptsNum != null) {
|
||||
hotelOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
||||
|
@ -164,10 +170,16 @@ public class OrderDetailQuery {
|
|||
|
||||
private Object processTrainOrderDetail(OrderDetail orderDetail, String systemType) {
|
||||
TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
|
||||
|
||||
if (trainOrderDetail != null &&
|
||||
trainOrderDetail.getOrderStatus() != null &&
|
||||
!trainOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL) &&
|
||||
systemType.equals(trainOrderDetail.getBelongSysType())) {
|
||||
|
||||
if (trainOrderDetail.getCreateTime().contains("1900") || trainOrderDetail.getCreateTime().contains("2999")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String receiptsNum = trainOrderDetail.getReceiptsNum();
|
||||
if (receiptsNum != null) {
|
||||
trainOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
||||
|
@ -186,6 +198,11 @@ public class OrderDetailQuery {
|
|||
carOrderDetail.getOrderStatus() != null &&
|
||||
!carOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL) &&
|
||||
systemType.equals(carOrderDetail.getBelongSysType())) {
|
||||
|
||||
if (carOrderDetail.getCreateTime().contains("1900") || carOrderDetail.getCreateTime().contains("2999")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String receiptsNum = carOrderDetail.getReceiptsNum();
|
||||
if (receiptsNum != null) {
|
||||
carOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
||||
|
@ -201,11 +218,15 @@ public class OrderDetailQuery {
|
|||
|
||||
private Object processFlightOrderDetail(OrderDetail orderDetail, String systemType) {
|
||||
FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail();
|
||||
|
||||
if (flightOrderDetail != null &&
|
||||
flightOrderDetail.getOrderStatus() != null &&
|
||||
!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL) &&
|
||||
systemType.equals(flightOrderDetail.getBelongSysType())) {
|
||||
|
||||
if (flightOrderDetail.getCreateTime().contains("1900") || flightOrderDetail.getCreateTime().contains("2999")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String receiptsNum = flightOrderDetail.getReceiptsNum();
|
||||
if (receiptsNum != null) {
|
||||
flightOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
||||
|
|
|
@ -72,7 +72,7 @@ public class OrderEvent implements Serializable {
|
|||
case ORDER_EVENT_CHANGE -> FSSC_FLIGHT_STATUS_CHANGE;
|
||||
case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL;
|
||||
case ORDER_EVENT_ORDERED -> FSSC_FLIGHT_STATUS_SUCCESS;
|
||||
case ORDER_EVENT_REFUND -> FSSC_FLIGHT_STATUS_CHANGE;
|
||||
case ORDER_EVENT_REFUND -> FSSC_FLIGHT_STATUS_REFUND;
|
||||
case ORDER_EVENT_UNKNOWN -> FSSC_FLIGHT_STATUS_SUCCESS;
|
||||
case ORDER_EVENT_FINISH -> FSSC_FLIGHT_STATUS_SUCCESS;
|
||||
case ORDER_EVENT_ETA -> FSSC_FLIGHT_STATUS_SUCCESS;
|
||||
|
|
|
@ -13,6 +13,8 @@ import com.chint.interfaces.rest.ctrip.dto.search.flight.*;
|
|||
import com.chint.interfaces.rest.ctrip.dto.search.hotel.ClientInfo;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.hotel.PaymentReceived;
|
||||
import com.chint.interfaces.rest.ctrip.tools.CTripUtils;
|
||||
import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -185,7 +187,13 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
|
||||
@Override
|
||||
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
|
||||
// 携程暂无火车
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail updateTrainOrderDetailData(TrainOrderDetail flightOrderDetail, Object trainOrderInfo) {
|
||||
// 携程暂无火车
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -203,14 +211,19 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
.filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo))
|
||||
.findFirst();
|
||||
|
||||
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildWithRouteOrderAndOrderDetail(routeOrder, first);
|
||||
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildFlightWithRouteOrderAndOrderDetail(routeOrder, first);
|
||||
|
||||
//处理订单的状态信息
|
||||
first.ifPresent(orderDetail -> {
|
||||
OrderEvent lastEvent = orderDetail.getLastEvent();
|
||||
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
|
||||
if (lastEvent != null && lastEvent.getEventType().equals(ORDER_EVENT_CANCEL)) {
|
||||
flightOrderDetail.setOrderStatus(FSSC_ORDER_STATUS_CANCEL);
|
||||
} else {
|
||||
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
|
||||
}
|
||||
//携程创建的飞机订单只有取消和预定成功两个状态
|
||||
if(!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)){
|
||||
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -372,7 +385,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
if (byOrderNo.get().getHotelOrderDetail() == null) {
|
||||
hotelOrderDetail = new HotelOrderDetail();
|
||||
} else {
|
||||
return byOrderNo.get().getHotelOrderDetail();
|
||||
hotelOrderDetail = byOrderNo.get().getHotelOrderDetail();
|
||||
}
|
||||
} else {
|
||||
hotelOrderDetail = new HotelOrderDetail();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
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;
|
||||
|
@ -8,7 +7,6 @@ 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;
|
||||
|
@ -19,6 +17,8 @@ import com.chint.interfaces.rest.user.UserHttpRequest;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -26,7 +26,10 @@ import java.util.stream.Collectors;
|
|||
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
import static com.chint.infrastructure.constant.FSSCConstant.*;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||
|
||||
@Component
|
||||
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||
|
@ -49,6 +52,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
@Autowired
|
||||
private OrderDetailFactory orderDetailFactory;
|
||||
|
||||
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
@Override
|
||||
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
|
||||
CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData;
|
||||
|
@ -56,13 +61,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
return carOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
|
||||
// 获取对象的Class对象
|
||||
TrainDetailResponse.TrainDetailData trainDetailData = (TrainDetailResponse.TrainDetailData) trainOrderDetailData;
|
||||
TrainOrderDetail convertTrain = convertTrainOrderDetail(trainDetailData);
|
||||
return convertTrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) {
|
||||
|
@ -80,15 +78,10 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
.filter(it -> it.getOrderNo().equals(orderDetails.getOrderSerialNo()))
|
||||
.findFirst();
|
||||
|
||||
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildWithRouteOrderAndOrderDetail(routeOrder, first);
|
||||
|
||||
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildFlightWithRouteOrderAndOrderDetail(routeOrder, first);
|
||||
|
||||
//飞机票状态属性保存
|
||||
OrderEvent lastEvent = orderDetail.getLastEvent();
|
||||
if (orderDetails.getIsChangeOrder()) {
|
||||
//如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单
|
||||
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE);
|
||||
}
|
||||
if (lastEvent != null) {
|
||||
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
|
||||
} else {
|
||||
|
@ -100,65 +93,15 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
//配置订单明细的父订单信息和订单号
|
||||
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
|
||||
if (orderDetails.getIsChangeOrder()) {
|
||||
//如果发现同程的订单号里面还有C就能够判断出 ,它是改签订单
|
||||
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_CHANGE);
|
||||
}
|
||||
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());
|
||||
if (orderDetails.getIsRefundOrder()) {
|
||||
//这里根据同程自带的字段进行状态映射
|
||||
flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_REFUND);
|
||||
}
|
||||
|
||||
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;
|
||||
return updateFlightOrderDetailData(flightOrderDetail, flightOrderDetailData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,8 +135,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode());
|
||||
flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal());
|
||||
flightOrderDetail.setDistance(flightSegment.getMileAge().toString());
|
||||
flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
|
||||
flightOrderDetail.setFlightNum(flightSegment.getShareNum());
|
||||
flightOrderDetail.setFlightCompName(flightSegment.getAirline());
|
||||
flightOrderDetail.setFlightNum(flightSegment.getFlightNo());
|
||||
flightOrderDetail.setSeatPoint(flightSegment.getSeatCode());
|
||||
flightOrderDetail.setSeatPointName(flightSegment.getSeatName());
|
||||
flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull());
|
||||
|
@ -343,8 +286,10 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
flightOrderDetail.setEndAirportCode(flightSegment.getArriveAirportCode());
|
||||
flightOrderDetail.setEndTerminal(flightSegment.getArriveTerminal());
|
||||
flightOrderDetail.setDistance(flightSegment.getMileAge().toString());
|
||||
flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
|
||||
flightOrderDetail.setFlightNum(flightSegment.getShareNum());
|
||||
// flightOrderDetail.setFlightCompName(flightSegment.getShareAirlineName());
|
||||
flightOrderDetail.setFlightCompName(flightSegment.getAirline());
|
||||
|
||||
flightOrderDetail.setFlightNum(flightSegment.getFlightNo());
|
||||
flightOrderDetail.setSeatPoint(flightSegment.getSeatCode());
|
||||
flightOrderDetail.setSeatPointName(flightSegment.getSeatName());
|
||||
flightOrderDetail.setStartTime(flightSegment.getDepartTimeFull());
|
||||
|
@ -425,7 +370,9 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
// HotelPriceData hotelPriceData = estimatePrice.queryHotelPrice(priceQueryData);
|
||||
|
||||
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
|
||||
|
||||
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
||||
|
||||
hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
|
||||
if (sysCode != null) {
|
||||
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
||||
|
@ -551,6 +498,119 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
return hotelOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
|
||||
// 获取对象的Class对象
|
||||
TrainDetailResponse.TrainDetailData trainDetailData = (TrainDetailResponse.TrainDetailData) trainOrderDetailData;
|
||||
String orderNo = trainDetailData.getOrderNo();
|
||||
OrderDetail byOrderNo = orderDetailRepository.findByOrderNo(orderNo)
|
||||
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
RouteOrder routeOrder = routeRepository.queryById(byOrderNo.getRouteId());
|
||||
|
||||
Optional<OrderDetail> first = routeOrder
|
||||
.getOrderDetails()
|
||||
.stream()
|
||||
.filter(it -> it.getOrderNo().equals(trainDetailData.getOrderNo()))
|
||||
.findFirst();
|
||||
|
||||
TrainOrderDetail trainOrderDetail = orderDetailFactory.buildTrainWithRouteOrderAndOrderDetail(routeOrder, first);
|
||||
//供应商为同程
|
||||
trainOrderDetail.setSupplier(SUPPLIER_L_Y_CN_NAME);
|
||||
//这里的内容是对火车状态的设置
|
||||
first.ifPresent(it -> {
|
||||
//因为同程的火车改签订单是单独的一条订单,这里可以根据这个状态来判断它是否是改签订单
|
||||
if (trainDetailData.getIsChangedOrder().equals(1)) {
|
||||
trainOrderDetail.setOrderStatus(FSSC_TRAIN_STATUS_CHANGE);
|
||||
} else {
|
||||
trainOrderDetail.setOrderStatus(FSSC_TRAIN_STATUS_SUCCESS);
|
||||
}
|
||||
String orderStatus = trainDetailData.getOrderStatus();
|
||||
if (LYOrderUtil.mapTrainStatus(orderStatus).equals(ORDER_EVENT_CANCEL)) {
|
||||
trainOrderDetail.setOrderStatus(FSSC_ORDER_STATUS_CANCEL);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return updateTrainOrderDetailData(trainOrderDetail, trainDetailData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail updateTrainOrderDetailData(TrainOrderDetail trainOrderDetail, Object trainOrderInfo) {
|
||||
TrainDetailResponse.TrainDetailData trainDetailData = (TrainDetailResponse.TrainDetailData) trainOrderInfo;
|
||||
|
||||
TrainDetailResponse.TravelData travelData = trainDetailData.getTravelData();
|
||||
String travelApplyNo = travelData.getTravelApplyNo();
|
||||
|
||||
|
||||
//这里对火车的进行信息进行录入
|
||||
trainOrderDetail.setReceiptsNum(travelApplyNo);
|
||||
trainOrderDetail.setCreateTime(formatter.format(LocalDateTime.now()));
|
||||
trainOrderDetail.setStartTime(trainDetailData.getPlanBeginDate());
|
||||
trainOrderDetail.setArriveTime(trainDetailData.getPlanEndDate());
|
||||
trainOrderDetail.setFromStationName(trainDetailData.getFromStation());
|
||||
trainOrderDetail.setToStationName(trainDetailData.getToStation());
|
||||
trainOrderDetail.setTrainNo(trainDetailData.getTrainNo());
|
||||
trainOrderDetail.setFromCity(trainDetailData.getDepartCity());
|
||||
trainOrderDetail.setToCity(trainDetailData.getArriveCity());
|
||||
|
||||
//这里要判断如果火车票不是退票状态,在设置
|
||||
if (!trainOrderDetail.getOrderStatus().equals(FSSC_TRAIN_STATUS_REFUND)) {
|
||||
trainOrderDetail.setOrderAmount(String.valueOf(trainDetailData.getTotalAmount()));
|
||||
}
|
||||
|
||||
trainOrderDetail.setPersonalAmount(trainDetailData.getPersonalPrice().toString());
|
||||
|
||||
trainOrderDetail.setUserCode(trainDetailData.getEmployeeCode());
|
||||
|
||||
//配置付款类型
|
||||
if (String.valueOf(trainDetailData.getPaymentType()).equals("1")) {
|
||||
trainOrderDetail.setPaymentType("0");
|
||||
trainOrderDetail.setCompanyAmount(trainDetailData.getCompanyPrice().toString());
|
||||
trainOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO);
|
||||
} else {
|
||||
trainOrderDetail.setPaymentType("1");
|
||||
trainOrderDetail.setCompanyAmount(KEEP_TWO_DECIMAL_ZERO);
|
||||
trainOrderDetail.setPersonalAmount(trainDetailData.getPersonalPrice().toString());
|
||||
}
|
||||
|
||||
List<TrainDetailResponse.Item> detailDataItems = trainDetailData.getItems();
|
||||
if (detailDataItems != null && !detailDataItems.isEmpty()) {
|
||||
TrainDetailResponse.Item item = detailDataItems.get(0);
|
||||
trainOrderDetail.setSeatName(item.getSeatNo());
|
||||
trainOrderDetail.setTicketPrice(String.valueOf(item.getTicketPrice()));
|
||||
trainOrderDetail.setRefundCost(String.valueOf(item.getRefundFee()));
|
||||
trainOrderDetail.setRefundPrice(String.valueOf(item.getRefundAmountCor()));
|
||||
trainOrderDetail.setChangeCost(String.valueOf(item.getServiceCharge()));
|
||||
|
||||
//座位信息和乘坐人信息
|
||||
trainOrderDetail.setPhone(item.getPassengerPhone());
|
||||
trainOrderDetail.setUserName(item.getPassengerName());
|
||||
trainOrderDetail.setSeatType(translateEnSeatToCnSeat(item.getSeatClass()));
|
||||
|
||||
//前后手续费
|
||||
trainOrderDetail.setPreServiceFee(String.valueOf(item.getServiceCharge()));
|
||||
trainOrderDetail.setPostServiceFee(String.valueOf(item.getAfterServiceCharge()));
|
||||
trainOrderDetail.setRefundAmount(String.valueOf(item.getRefundAmountCor()));
|
||||
|
||||
TrainDetailResponse.ChangeInfo changeInfo = item.getChangeInfo();
|
||||
if (changeInfo != null) {
|
||||
TrainDetailResponse.ChangeItem changeItem = changeInfo.getChangeItem();
|
||||
if (changeItem != null) {
|
||||
trainOrderDetail.setChangeDifference(String.valueOf(changeItem.getChangePrice()));
|
||||
//如果 是退票的加入退票费
|
||||
if (trainOrderDetail.getOrderStatus().equals(FSSC_TRAIN_STATUS_REFUND)) {
|
||||
trainOrderDetail.setRefundCost(String.valueOf(changeItem.getRefundFee()));
|
||||
} else if (trainOrderDetail.getOrderStatus().equals(FSSC_TRAIN_STATUS_CHANGE)) {
|
||||
//如果是改签的状态 ,就加入改签费
|
||||
trainOrderDetail.setRefundCost(String.valueOf(changeItem.getChangeFee()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return trainOrderDetail;
|
||||
}
|
||||
|
||||
|
||||
private TrainOrderDetail convertTrainOrderDetail(TrainDetailResponse.TrainDetailData trainDetailData) {
|
||||
|
||||
// TrainDetailResponse.TrainDetailData trainDetailData = trainDetailResponse.getData();
|
||||
|
@ -605,7 +665,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
if (trainDetailData != null) {
|
||||
trainOrderDetail.setOrderNo(trainDetailData.getOrderNo());
|
||||
trainOrderDetail.setDetailId(trainDetailData.getOrderNo());
|
||||
|
||||
trainOrderDetail.setParentOrderNo(trainDetailData.getParentOrderSerialNo());
|
||||
|
||||
Optional<OrderDetail> first1 = routeOrder
|
||||
|
@ -743,6 +802,18 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
return trainOrderDetail;
|
||||
}
|
||||
|
||||
private String translateEnSeatToCnSeat(String seatEnName) {
|
||||
return switch (seatEnName) {
|
||||
case "secondseat" -> "二等座";
|
||||
case "businessseat" -> "商务座";
|
||||
case "hardseat" -> "二等座";
|
||||
case "softsleeperup" -> "软卧";
|
||||
case "hardsleeperup" -> "硬卧";
|
||||
case "firstseat" -> "一等座";
|
||||
default -> "未知类型座位";
|
||||
};
|
||||
}
|
||||
|
||||
private CarOrderDetail convertCarOrderDetail(CarDetailResponse.DataWrapper data) {
|
||||
|
||||
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
|
||||
|
@ -834,11 +905,11 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
carOrderDetail.setToCity(orderExtendInfo.getEndCityName());
|
||||
|
||||
String duration = orderExtendInfo.getDuration();
|
||||
String durationNumbers = duration.replaceAll("\\D+", "");
|
||||
String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
|
||||
carOrderDetail.setRunTime(durationNumbers);
|
||||
|
||||
String mileage = orderExtendInfo.getMileage();
|
||||
String mileageNumbers = mileage.replaceAll("\\D+", "");
|
||||
String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", "");
|
||||
carOrderDetail.setMileage(mileageNumbers);
|
||||
carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName()));
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.chint.domain.factoriy.order_detail;
|
||||
|
||||
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.aggregates.order.*;
|
||||
import com.chint.domain.value_object.OrderLegData;
|
||||
|
||||
import java.util.Optional;
|
||||
|
@ -15,5 +12,7 @@ public interface OrderDetailFactory {
|
|||
|
||||
BaseOrderExtension buildWithRouteOrder(RouteOrder routeOrder);
|
||||
|
||||
FlightOrderDetail buildWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail);
|
||||
FlightOrderDetail buildFlightWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail);
|
||||
|
||||
TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FlightOrderDetail buildWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> first) {
|
||||
public FlightOrderDetail buildFlightWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> first) {
|
||||
//获取飞机订单明细
|
||||
FlightOrderDetail flightOrderDetail;
|
||||
if (first.isPresent()) {
|
||||
|
@ -125,4 +125,37 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
|||
}
|
||||
return flightOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional<OrderDetail> orderDetail) {
|
||||
//获取飞机订单明细
|
||||
TrainOrderDetail trainOrderDetail;
|
||||
if (orderDetail.isPresent()) {
|
||||
OrderDetail order = orderDetail.get();
|
||||
if (order.getFlightOrderDetail() == null) {
|
||||
trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class);
|
||||
} else {
|
||||
return order.getTrainOrderDetail();
|
||||
}
|
||||
//如果订单存在,直接配置该订单的超标信息和原因
|
||||
order.getOrderEventList()
|
||||
.stream()
|
||||
.filter(it -> it.getEventType().equals(ORDER_EVENT_ETA))
|
||||
.findFirst()
|
||||
.ifPresentOrElse(it -> {
|
||||
trainOrderDetail.setOverStandard("是");
|
||||
trainOrderDetail.setOverStandardReason(it.getExtension());
|
||||
}, () -> trainOrderDetail.setOverStandard("否"));
|
||||
trainOrderDetail.setOrderNo(order.getOrderNo());
|
||||
trainOrderDetail.setDetailId(order.getOrderNo());
|
||||
|
||||
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
|
||||
trainOrderDetail.setBookingUserCode(user.getEmployeeNo());
|
||||
trainOrderDetail.setBookingName(user.getName());
|
||||
trainOrderDetail.setBookingUserPhone(user.getPhoneNumber());
|
||||
}else {
|
||||
trainOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), TrainOrderDetail.class);
|
||||
}
|
||||
return trainOrderDetail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.chint.domain.factoriy.order_detail;
|
||||
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity;
|
||||
|
||||
public interface OrderExtensionFactory {
|
||||
|
||||
|
@ -9,6 +8,8 @@ public interface OrderExtensionFactory {
|
|||
|
||||
TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData);
|
||||
|
||||
TrainOrderDetail updateTrainOrderDetailData(TrainOrderDetail flightOrderDetail, Object trainOrderInfo);
|
||||
|
||||
FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData);
|
||||
|
||||
FlightOrderDetail updateFlightOrderDetailData(FlightOrderDetail flightOrderDetail, Object flightOrderInfo);
|
||||
|
|
|
@ -10,5 +10,7 @@ public interface DistrictInfoRepository {
|
|||
|
||||
DistrictPOIInfoEntity findByCityId(Long cityId);
|
||||
|
||||
List<DistrictPOIInfoEntity> findByLocationName(String locationName);
|
||||
|
||||
DistrictPOIInfoEntity save(DistrictPOIInfoEntity districtPOIInfoEntity);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_INTERNAL;
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_NOT_INTERNAL;
|
||||
import static com.chint.infrastructure.constant.LocationConstant.*;
|
||||
|
||||
@Service
|
||||
public class LocationDomainService {
|
||||
|
@ -31,6 +30,14 @@ public class LocationDomainService {
|
|||
return getLocationsByType(locationParam, queryByCityName);
|
||||
}
|
||||
|
||||
public Location queryCityLocation(Location location) {
|
||||
if (location.getLevel().equals(LOCATION_TYPE_CITY)) {
|
||||
return location;
|
||||
} else {
|
||||
return locationRepository.findById(location.getParentLocationId());
|
||||
}
|
||||
}
|
||||
|
||||
private List<Location> getLocationsByType(LocationParam locationParam, List<Location> queryByCityName) {
|
||||
Integer cityType = locationParam.getCityType();
|
||||
return switch (cityType) {
|
||||
|
@ -46,4 +53,6 @@ public class LocationDomainService {
|
|||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.domain.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.application.commands.*;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
|
@ -10,6 +11,7 @@ import com.chint.domain.factoriy.order.RouteOrderFactory;
|
|||
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
||||
import com.chint.domain.repository.*;
|
||||
import com.chint.domain.value_object.ApprovalSimpleData;
|
||||
import com.chint.domain.value_object.ApproveRouteData;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.constant.RouteConstant;
|
||||
|
@ -190,10 +192,14 @@ public class OrderDomainService {
|
|||
public void routeRecover(OrderApprovalRecoverCommand command) {
|
||||
ApprovalSimpleData data = command.getData();
|
||||
Optional.ofNullable(routeRepository.findByActualOrderNoAndSysCode(data.getActualOrderNo(), data.getSysCode()))
|
||||
.ifPresent(route -> {
|
||||
.ifPresentOrElse(route -> {
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||
route.getLegItems().forEach(leg -> leg.addEvent(legEvent));
|
||||
this.saveOrder(route);
|
||||
}, () -> {
|
||||
//如果没有找到该订单,说明该订单可能是未提交的状态 , 这里执行和审批提交一样的操作
|
||||
ApprovalSimpleData approvalSimpleData = command.getData();
|
||||
Command.of(OrderApprovalStartCommand.class).data(BeanUtil.copyProperties(approvalSimpleData, ApproveRouteData.class)).sendToQueue();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -555,7 +561,7 @@ public class OrderDomainService {
|
|||
"-" + item.getRefundAmount(),
|
||||
"3",
|
||||
data.getRefundTime()
|
||||
).sendToQueue();
|
||||
).data(trainOrderDetail.getData()).sendToQueue();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,21 +27,19 @@ import com.chint.interfaces.rest.bpm.BPMRequest;
|
|||
import com.chint.interfaces.rest.bpm.dto.JTH3ChangeDto;
|
||||
import com.chint.interfaces.rest.bpm.dto.XNChangeDto;
|
||||
import com.chint.interfaces.rest.bpm.dto.ZWChangeDto;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.H3_BPM;
|
||||
import static com.chint.infrastructure.constant.BPMConstant.XNYS_BPM;
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR;
|
||||
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
|
||||
import static com.chint.infrastructure.constant.DataMessageConstant.ORDER_STATUS_ERROR;
|
||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_CODE;
|
||||
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_NAME;
|
||||
|
@ -109,48 +107,41 @@ public class LegEventHandler implements LegEventService {
|
|||
if (routeOrder.getLegItems().isEmpty()) {
|
||||
throw new OrderException(CommonMessageConstant.LEG_ERROR);
|
||||
}
|
||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
|
||||
// approveOrderNo.setAccountCompany(data.getAccountCompany());
|
||||
approveOrderNo.setInstructions(data.getInstructions());
|
||||
approveOrderNo.setCreator(data.getCreator());
|
||||
approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode());
|
||||
approveOrderNo.setProjectName(data.getProjectName());
|
||||
approveOrderNo.setCostCenter(data.getCostCenter());
|
||||
//这里order所有的leg触发approve事件
|
||||
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
|
||||
legEventFactory.creatLegEvent(command.getLegEventType())
|
||||
));
|
||||
//保存提交审批所提供的资料
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
|
||||
// approveOrderNo.setAccountCompany(data.getAccountCompany());
|
||||
approveOrderNo.setInstructions(data.getInstructions());
|
||||
approveOrderNo.setCreator(data.getCreator());
|
||||
approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode());
|
||||
approveOrderNo.setProjectName(data.getProjectName());
|
||||
approveOrderNo.setCostCenter(data.getCostCenter());
|
||||
//这里order所有的leg触发approve事件
|
||||
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
|
||||
legEventFactory.creatLegEvent(command.getLegEventType())
|
||||
));
|
||||
|
||||
//这里也为行程规划单触发审批中事件
|
||||
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(RouteConstant.APPROVAL_EVENT_ING);
|
||||
routeOrder.addApprovalEvent(approvalEvent);
|
||||
//这里也为行程规划单触发审批中事件
|
||||
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(RouteConstant.APPROVAL_EVENT_ING);
|
||||
routeOrder.addApprovalEvent(approvalEvent);
|
||||
|
||||
//根据项目需求,当传入的时间 , 使用该时间保存到订单当中
|
||||
String startTime = data.getStartTime();
|
||||
String endTime = data.getEndTime();
|
||||
|
||||
//根据项目需求,当传入的时间 , 使用该时间保存到订单当中
|
||||
String startTime = data.getStartTime();
|
||||
String endTime = data.getEndTime();
|
||||
|
||||
if (startTime != null && endTime != null) {
|
||||
if (startTime.contains("T") && endTime.contains("T")) {
|
||||
//如果包含T,就截取时间信息前10位
|
||||
routeOrder.setStartTime(LocalDate.parse(startTime.substring(0, 10), formatter).atStartOfDay());
|
||||
routeOrder.setEndTime(LocalDate.parse(endTime.substring(0, 10), formatter).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
|
||||
} else {
|
||||
routeOrder.setStartTime(LocalDate.parse(startTime, formatter).atStartOfDay());
|
||||
routeOrder.setEndTime(LocalDate.parse(endTime, formatter).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
|
||||
}
|
||||
if (startTime != null && endTime != null) {
|
||||
if (startTime.contains("T") && endTime.contains("T")) {
|
||||
//如果包含T,就截取时间信息前10位
|
||||
routeOrder.setStartTime(LocalDate.parse(startTime.substring(0, 10), formatter).atStartOfDay());
|
||||
routeOrder.setEndTime(LocalDate.parse(endTime.substring(0, 10), formatter).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
|
||||
} else {
|
||||
routeOrder.setStartTime(LocalDate.parse(startTime, formatter).atStartOfDay());
|
||||
routeOrder.setEndTime(LocalDate.parse(endTime, formatter).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
|
||||
}
|
||||
|
||||
//保存routeOrder的状态
|
||||
RouteOrder save = routeRepository.save(routeOrder);
|
||||
command.order(save);
|
||||
} else if (routeOrder.getOrderStatus() > ORDER_STATUS_PREPARE) {
|
||||
throw new CommandException(ORDER_STATUS_ERROR);
|
||||
} else {
|
||||
throw new CommandException(ORDER_STATUS_ERROR);
|
||||
}
|
||||
//保存routeOrder的状态
|
||||
RouteOrder save = routeRepository.save(routeOrder);
|
||||
command.order(save);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -278,7 +269,12 @@ public class LegEventHandler implements LegEventService {
|
|||
|
||||
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_NOT_ORDERED) {
|
||||
//这里查看routeOrder的状态 , 如果是已经同步过的订单, 需要取消同步到供应商的订单
|
||||
if (!syncAdapter.of(routeOrder.getSupplierName()).cancelSyncSupplierOrder(routeOrder)) {
|
||||
List<Leg> list = routeOrder
|
||||
.getLegItems()
|
||||
.stream()
|
||||
.filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER))
|
||||
.toList();
|
||||
if (!list.isEmpty() && !syncAdapter.of(routeOrder.getSupplierName()).cancelSyncSupplierOrder(routeOrder)) {
|
||||
throw new CommandException("订单取消失败");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.chint.domain.service.order_sync;
|
||||
|
||||
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.repository.*;
|
||||
import com.chint.domain.service.LocationDomainService;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.interfaces.rest.ctrip.CTripApprovalRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
|
||||
|
@ -48,12 +50,18 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
|
||||
@Autowired
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
@Autowired
|
||||
private LocationDomainService locationDomainService;
|
||||
@Autowired
|
||||
private CountryLevelInfoRepository countryLevelInfoRepository;
|
||||
|
||||
@Autowired
|
||||
private PrefectureLevelRepository prefectureLevelRepository;
|
||||
|
||||
@Autowired
|
||||
private DistrictInfoRepository districtInfoRepository;
|
||||
|
||||
@Override
|
||||
public boolean syncSupplierOrder(RouteOrder order) {
|
||||
log.info("开始同步协程订单");
|
||||
|
@ -105,7 +113,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
legs.forEach(leg -> {
|
||||
hotelList.add(
|
||||
HotelEndorsementDetail.of(List.of(
|
||||
getCityId(leg.getOriginLocation()).getCityId().toString()
|
||||
getCityId(locationDomainService.queryCityLocation(leg.getOriginLocation())).getCityId().toString()
|
||||
))
|
||||
.passenger(PassengerDetail.of(employeeNo))
|
||||
.starTime(leg.getStartTime())
|
||||
|
@ -120,9 +128,9 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
legs.forEach(leg -> {
|
||||
filghtList.add(
|
||||
FlightEndorsementDetail.of(List.of(
|
||||
getCityId(leg.getOriginLocation()).getCityId().toString()
|
||||
getCityId(locationDomainService.queryCityLocation(leg.getOriginLocation())).getCityId().toString()
|
||||
), List.of(
|
||||
getCityId(leg.getDestinationLocation()).getCityId().toString()
|
||||
getCityId(locationDomainService.queryCityLocation(leg.getDestinationLocation())).getCityId().toString()
|
||||
))
|
||||
.passenger(PassengerDetail.of(employeeNo))
|
||||
.starTime(leg.getStartTime())
|
||||
|
@ -135,11 +143,12 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
private List<TrainEndorsementDetail> generateTrainList(List<Leg> legs, String employeeNo) {
|
||||
List<TrainEndorsementDetail> trainList = new ArrayList<>();
|
||||
legs.forEach(leg -> {
|
||||
|
||||
trainList.add(
|
||||
TrainEndorsementDetail.of(List.of(
|
||||
getCityId(leg.getOriginLocation()).getCityId().toString()
|
||||
getCityId(locationDomainService.queryCityLocation(leg.getOriginLocation())).getCityId().toString()
|
||||
), List.of(
|
||||
getCityId(leg.getDestinationLocation()).getCityId().toString()
|
||||
getCityId(locationDomainService.queryCityLocation(leg.getDestinationLocation())).getCityId().toString()
|
||||
)).passenger(PassengerDetail.of(employeeNo))
|
||||
.starTime(leg.getStartTime())
|
||||
.endTime(leg.getEndTime())
|
||||
|
@ -157,6 +166,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
.stream()
|
||||
.map(it -> {
|
||||
Location location = locationRepository.findById(it);
|
||||
location = locationDomainService.queryCityLocation(location);
|
||||
Location cityId = getCityId(location);
|
||||
return cityId.getCityId().toString();
|
||||
}).toList();
|
||||
|
@ -172,7 +182,10 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
|
||||
private Location getCityId(Location location) {
|
||||
if (location.getCityId() == null) {
|
||||
if (location.getLevel().equals(LOCATION_TYPE_COUNTY)) {
|
||||
if (location.getLevel().equals(LOCATION_TYPE_COUNTY) && location.getLocationShortName().endsWith("D")) {
|
||||
List<DistrictPOIInfoEntity> byLocationName = districtInfoRepository.findByLocationName(location.getLocationName());
|
||||
location.setCityId(byLocationName.get(0).getDistrictId());
|
||||
} else if (location.getLevel().equals(LOCATION_TYPE_COUNTY)) {
|
||||
CountryLevelInfoEntity byCityName = countryLevelInfoRepository
|
||||
.findByCityName(location.getLocationName())
|
||||
.get(0);
|
||||
|
@ -187,4 +200,5 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
|||
.map(legType -> switch (legType) {
|
||||
case LEG_TYPE_TRAIN -> 5;
|
||||
case LEG_TYPE_AIRPLANE -> 1;
|
||||
case LEG_TYPE_HOTEL -> 2;
|
||||
case LEG_TYPE_HOTEL -> 3;
|
||||
case LEG_TYPE_TAXI -> 6;
|
||||
default -> legType;
|
||||
})
|
||||
|
|
|
@ -1,10 +1,30 @@
|
|||
package com.chint.domain.value_object;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApprovalSimpleData {
|
||||
@ApiModelProperty("实际财务共享订单号")
|
||||
private String actualOrderNo;
|
||||
@ApiModelProperty("临时财务共享订单号")
|
||||
private String fakeOrderNo;
|
||||
@ApiModelProperty("入账公司")
|
||||
private String accountCompany;
|
||||
@ApiModelProperty("系统标识")
|
||||
private String sysCode;
|
||||
@ApiModelProperty("出差说明")
|
||||
private String instructions;
|
||||
@ApiModelProperty("财务共享订单创建人")
|
||||
private String creator;
|
||||
@ApiModelProperty("入账公司64位编码")
|
||||
private String accountCompanyCode;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty("成本中心")
|
||||
private String costCenter;
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,11 @@ public class DistrictInfoRepositoryImpl implements DistrictInfoRepository {
|
|||
return jdbcDistrictInfoRepository.findByDistrictId(cityId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DistrictPOIInfoEntity> findByLocationName(String locationName) {
|
||||
return jdbcDistrictInfoRepository.findByDistrictNameContaining(locationName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistrictPOIInfoEntity save(DistrictPOIInfoEntity districtPOIInfoEntity) {
|
||||
return jdbcDistrictInfoRepository.save(districtPOIInfoEntity);
|
||||
|
|
|
@ -4,8 +4,12 @@ import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity;
|
|||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface JdbcDistrictInfoRepository extends CrudRepository<DistrictPOIInfoEntity, Long> {
|
||||
|
||||
DistrictPOIInfoEntity findByDistrictId(Long districtId);
|
||||
|
||||
List<DistrictPOIInfoEntity> findByDistrictNameContaining(String districtName);
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ chint:
|
|||
username: tripbookpro
|
||||
password: W@Xbf25d&lG5k*L01X#
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# host: 10.10.24.44
|
||||
# # host: 10.9.56.48
|
||||
# port: 6603
|
||||
# host: gf-jump.chint.com
|
||||
# port: 30108
|
||||
# database: itinerary_booking
|
||||
# username: tripbook
|
||||
# password: W@Xgf25d&lRk*L0X#
|
||||
# username: e2b8171f-9920-4972-8f84-383ff27eee44
|
||||
# password: zbPYf9CUI1ef1nhW
|
||||
|
||||
url: https://trip.chint.com/
|
||||
redis:
|
||||
host: 10.10.68.66
|
||||
|
|
Loading…
Reference in New Issue