Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/chint/domain/service/OrderDomainService.java
This commit is contained in:
lulz1 2024-03-14 20:58:31 +08:00
commit 5f808574d6
6 changed files with 101 additions and 52 deletions

View File

@ -178,6 +178,13 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setOverStandard(""); //
}
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first1 != null){
carOrderDetail.setOverStandardReason(first1.get().getExtension());
}
// derDetail.setTollFee(tollFee);//
return carOrderDetail;
@ -384,7 +391,12 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setOverStandard(""); //
}
// flightOrderDetail.setOverStandardReason(flightInfo.getClassReasonDesc());
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first1 != null){
flightOrderDetail.setOverStandardReason(first1.get().getExtension());
}
// flightOrderDetail.setPostServiceFee();
// flightOrderDetail.setParentOrderNo();
@ -552,7 +564,13 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
} else {
hotelOrderDetail.setOverStandard(""); //
}
hotelOrderDetail.setOverStandardReason(hotelOrderInfoEntity.getLowPriceRCInfo());
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first1 != null){
hotelOrderDetail.setOverStandardReason(first1.get().getExtension());
}
return hotelOrderDetail;
}

View File

@ -209,7 +209,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
} else {
flightOrderDetail.setOverStandard(""); //
}
// flightOrderDetail.setOverStandardReason(orderDetails.getFoulReason());
Optional<OrderEvent> first1 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first1 != null){
flightOrderDetail.setOverStandardReason(first1.get().getExtension());
}
// flightOrderDetail.setBookingUserPhone(data.get); //
@ -290,7 +295,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
.setPreServiceFee(String.valueOf(orderInfo.getServicePrice()))
.setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice()))
.setRefundAmount(String.valueOf(orderInfo.getRefundPrice()))
.setOverStandardReason(orderInfo.getFoulReason())
.setAgreementHotel(orderInfo.getProtocolType()==0?"":"");
// .setBookingName(orderInfo.getContactName()) //预订人名字和电话使用contact是否正确
// .setBookingUserPhone(orderInfo.getContactPhone())
@ -339,7 +343,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
} else {
hotelOrderDetail.setOverStandard(""); //
}
// flightOrderDetail.setOverStandardReason(orderDetails.getFoulReason());
Optional<OrderEvent> first2 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first2 != null){
hotelOrderDetail.setOverStandardReason(first2.get().getExtension());
}
List<Resident> residentList = data.getResidentList();
if (residentList != null && !residentList.isEmpty()) {
@ -515,7 +524,12 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
trainOrderDetail.setOverStandard(""); //
}
trainOrderDetail.setOverStandardReason(""); //
Optional<OrderEvent> first2 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first2 != null){
trainOrderDetail.setOverStandardReason(first2.get().getExtension());
}
// trainOrderDetail.setOriginalOrderNo("originalOrderNo"); //
// trainOrderDetail.setBookingUserPhone(trainDetailData.getContactInfo().getPersonMobile() != null ?
@ -579,8 +593,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}}
);
String EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
@ -637,22 +649,22 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
carOrderDetail.setOverStandard(""); //
}
carOrderDetail.setOverStandardReason(""); //
Optional<OrderEvent> first2 = orderDetail.getOrderEventList()
.stream()
.findFirst();
if (first2 != null){
carOrderDetail.setOverStandardReason(first2.get().getExtension());
}
// carOrderDetail.setParentOrderNo(parentOrderNo); //
// carOrderDetail.setOriginalOrderNo(originalOrderNo); //
// carOrderDetail.setScheduleNum(scheduleNum); //
// carOrderDetail.setBookingName(bookingName); //
// carOrderDetail.setBookingUserPhone(bookingUserPhone);//
// carOrderDetail.setCancellationFee(cancellationFee); //
// carOrderDetail.setStandardItems(standardItems); //
// carOrderDetail.setOverStandardReason(overStandardReason); contactName
// carOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); //
// carOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); //
// carOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); //

View File

@ -25,7 +25,6 @@ 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.ctrip.dto.search.flight.FlightRefundInfo;
import com.chint.interfaces.rest.user.UserHttpRequest;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
@ -88,7 +87,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) {
@ -279,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(),
@ -347,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()) {

View File

@ -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);

View File

@ -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;

View File

@ -204,27 +204,10 @@ public class CTripTest {
@Test
void search() {
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("29821751403");
System.out.println(response);
response = orderSearchRequest.searchOrderResponseByOrderId("31018642992");
System.out.println(response);
response = orderSearchRequest.searchOrderResponseByOrderId("31021935860");
System.out.println(response);
response = orderSearchRequest.searchOrderResponseByOrderId("31022442484");
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("29882203254");
System.out.println(response);
response = orderSearchRequest.searchOrderResponseByOrderId("31024617012");
System.out.println(response);
response = orderSearchRequest.searchOrderResponseByOrderId("31025266484");
System.out.println(response);
response = orderSearchRequest.searchOrderResponseByOrderId("31025198037");
System.out.println(response);
}
// @Test