同程火车票、机票退改签字段调整
This commit is contained in:
parent
0fdb3fef39
commit
ef5de2ef37
|
@ -15,6 +15,7 @@ import com.chint.infrastructure.constant.CommonMessageConstant;
|
|||
import com.chint.infrastructure.constant.RouteConstant;
|
||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
||||
import com.chint.infrastructure.util.DelayDispatch;
|
||||
import com.chint.interfaces.rest.bpm.BPMParamFactory;
|
||||
import com.chint.interfaces.rest.bpm.BPMRequest;
|
||||
|
@ -25,6 +26,9 @@ import com.chint.interfaces.rest.ctrip.dto.search.ItineraryEntity;
|
|||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.flight.ChangeInfo;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -34,6 +38,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -87,6 +92,11 @@ public class OrderDomainService {
|
|||
@Autowired
|
||||
private CTripOrderSearchRequest cTripOrderSearchRequest;
|
||||
|
||||
@Autowired
|
||||
private LYSearchRequest lySearchRequest;
|
||||
|
||||
@Autowired
|
||||
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
|
||||
private Set<String> companyBlackList = new HashSet<>();
|
||||
|
||||
public RouteOrder saveOrder(RouteOrder routeOrder) {
|
||||
|
@ -272,31 +282,39 @@ public class OrderDomainService {
|
|||
rescheduleDto.setOrderSource(SUPPLIER_L_Y_BPM_NAME);//同程商旅
|
||||
//火车票改签
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
rescheduleDto
|
||||
/*.setStartTime()//原时间
|
||||
.setRebookStartTime()//改签后时间
|
||||
.setTrainNumber()//原车次
|
||||
.setSeatingStandard()//原席别
|
||||
.setRebookTrainNumber()//改签后车次
|
||||
.setRebookSeatingStandard()//改签后席别*/
|
||||
.setOrderType(RESCHEDULE_TYPE_TRAIN);
|
||||
TrainDetailResponse trainDetailResponse = lySearchRequest.getTrainOrderDetail(orderDetail.getOrderNo());
|
||||
setLYChangeTrain(rescheduleDto, trainDetailResponse);//火车票只支持一次改签
|
||||
rescheduleDto.setOrderType(RESCHEDULE_TYPE_TRAIN);
|
||||
}
|
||||
|
||||
//火车票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_TRAIN);
|
||||
rescheduleDto.setReason("计划有变,更改行程");//目前没有原因
|
||||
}
|
||||
//机票改签
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_CHANGE)) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// 将LocalDateTime对象格式化成字符串
|
||||
String rebookStartTime = orderDetail.getStartTime().format(formatter);
|
||||
rescheduleDto.setRebookStartTime(rebookStartTime);//变更后时间
|
||||
|
||||
FlightOrderResponse flightOrderResponse = lySearchRequest.getFlightOrderDetail(orderDetail.getOrderNo());
|
||||
//原订单
|
||||
String originalOrderNo = flightOrderResponse.getData().getOrderDetails().getOriginalOrderNo();
|
||||
OrderDetail orderDetailOld = jdbcOrderDetailRepository.findFirstByOrderNo(originalOrderNo);
|
||||
String startTime = orderDetailOld.getStartTime().format(formatter);
|
||||
rescheduleDto.setStartTime(startTime);
|
||||
rescheduleDto.setOrderType(RESCHEDULE_TYPE_FLIGHT);
|
||||
rescheduleDto.setReason("计划有变,更改行程");//目前没有原因
|
||||
}
|
||||
}
|
||||
|
||||
//机票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_FLIGHT);
|
||||
rescheduleDto.setReason("计划有变,更改行程");
|
||||
}
|
||||
//机票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_FLIGHT);
|
||||
rescheduleDto.setReason("计划有变,更改行程");
|
||||
}
|
||||
|
||||
//火车票退票
|
||||
if (orderDetail.getProductType().equals(LEG_TYPE_TRAIN) && command.getOperationType().equals(ORDER_EVENT_REFUND)) {
|
||||
rescheduleDto.setOrderType(REFUND_TYPE_TRAIN);
|
||||
rescheduleDto.setReason("计划有变,更改行程");
|
||||
}
|
||||
//发送
|
||||
DelayDispatch.attemptToSend(() -> bpmRequest.reschedule(rescheduleDto, sysCode).getSuccess(),
|
||||
|
@ -340,6 +358,29 @@ public class OrderDomainService {
|
|||
}
|
||||
}
|
||||
|
||||
//火车票改签
|
||||
private void setLYChangeTrain(RescheduleDto rescheduleDto, TrainDetailResponse trainDetailResponse) {
|
||||
TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData();
|
||||
String trainNoOld = data.getTrainNo();//原车次
|
||||
String planBeginDateOld = data.getPlanBeginDate();//原时间
|
||||
rescheduleDto.setStartTime(planBeginDateOld)
|
||||
.setTrainNumber(trainNoOld);//原车次
|
||||
if (!data.getItems().isEmpty()) {
|
||||
TrainDetailResponse.Item item = data.getItems().get(0);
|
||||
String seatClassOld = item.getSeatClass();//原席别
|
||||
TrainDetailResponse.ChangeInfo changeInfo = item.getChangeInfo();
|
||||
String planBeginDateNew = changeInfo.getPlanBeginDate();//改签后时间
|
||||
String trainNoNew = changeInfo.getTrainNo();//改签后车次
|
||||
String seatClassNew = changeInfo.getChangeItem().getSeatClass();//改签后席别
|
||||
//设置值
|
||||
rescheduleDto.setRebookStartTime(planBeginDateNew)
|
||||
.setSeatingStandard(seatClassOld)//原席别
|
||||
.setRebookTrainNumber(trainNoNew)//改签后车次
|
||||
.setRebookSeatingStandard(seatClassNew)//改签后席别
|
||||
.setReason("计划有变,更改行程");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean finishOrder(Long routeId) {
|
||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||
if (routeOrder != null && routeOrder.getLegItems() != null && !routeOrder.getLegItems().isEmpty()) {
|
||||
|
|
|
@ -15,6 +15,8 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
|||
|
||||
OrderDetail findByOrderNo(String orderNo);
|
||||
|
||||
OrderDetail findFirstByOrderNo(String orderNo);
|
||||
|
||||
List<OrderDetail> findByLegId(Long legId);
|
||||
|
||||
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
|
||||
|
|
|
@ -9,7 +9,7 @@ public class OrderFee {
|
|||
private String FeeName;
|
||||
private Double Amount;
|
||||
private String OrderFeeId;
|
||||
private Integer VendorFeeOrgin;
|
||||
private Double VendorFeeOrgin;
|
||||
private Double AccntAmount;
|
||||
private Double PersonAmount;
|
||||
private Double CnyAmount;
|
||||
|
|
Loading…
Reference in New Issue