修复订单部分消费明细确实单号的问题

This commit is contained in:
lulz1 2024-04-17 20:47:13 +08:00
parent c261f3b776
commit e3edec5888
7 changed files with 72 additions and 6 deletions

View File

@ -91,6 +91,10 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
if(carOrderDetail.getOrderNo() == null || carOrderDetail.getDetailId() == null){
carOrderDetail.setOrderNo(orderNo);
carOrderDetail.setDetailId(orderNo);
}
return updateCarOrderDetailData(carOrderDetail, carOrderDetailData);
}
@ -192,6 +196,10 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
updateFlightOrderDetailData(flightOrderDetail, flightOrderInfoEntity);
if(flightOrderDetail.getOrderNo() == null || flightOrderDetail.getDetailId() == null){
flightOrderDetail.setOrderNo(orderNo);
flightOrderDetail.setDetailId(orderNo);
}
return flightOrderDetail;
}
@ -528,6 +536,11 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
first1.ifPresent(orderEvent -> hotelOrderDetail.setOverStandardReason(orderEvent.getExtension()));
hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
if(hotelOrderDetail.getOrderNo() == null || hotelOrderDetail.getDetailId() == null){
hotelOrderDetail.setOrderNo(orderNo);
hotelOrderDetail.setDetailId(orderNo);
}
return hotelOrderDetail;
}

View File

@ -102,6 +102,11 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
if(carOrderDetail.getOrderNo() == null || carOrderDetail.getDetailId() == null){
carOrderDetail.setOrderNo(orderSerialNo);
carOrderDetail.setDetailId(orderSerialNo);
}
return updateCarOrderDetailData(carOrderDetail, data);
}
@ -281,14 +286,15 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
FlightOrderResponse.Data data = (FlightOrderResponse.Data) flightOrderDetailData;
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderDetails.getOrderSerialNo())
String orderSerialNo = orderDetails.getOrderSerialNo();
OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderSerialNo)
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
Optional<OrderDetail> first = routeOrder
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(orderDetails.getOrderSerialNo()))
.filter(it -> it.getOrderNo().equals(orderSerialNo))
.findFirst();
FlightOrderDetail flightOrderDetail = orderDetailFactory.buildFlightWithRouteOrderAndOrderDetail(routeOrder, first);
@ -312,6 +318,11 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
}
flightOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
if(flightOrderDetail.getOrderNo() == null || flightOrderDetail.getDetailId() == null){
flightOrderDetail.setOrderNo(orderSerialNo);
flightOrderDetail.setDetailId(orderSerialNo);
}
return updateFlightOrderDetailData(flightOrderDetail, flightOrderDetailData);
}
@ -410,6 +421,11 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
if(hotelOrderDetail.getOrderNo() == null || hotelOrderDetail.getDetailId() == null){
hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo());
hotelOrderDetail.setDetailId(orderInfo.getOrderSerialNo());
}
return updateHotelOrderDetailData(hotelOrderDetail, data);
}
@ -554,6 +570,11 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
);
trainOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY);
if(trainOrderDetail.getOrderNo() == null || trainOrderDetail.getDetailId() == null){
trainOrderDetail.setOrderNo(orderNo);
trainOrderDetail.setDetailId(orderNo);
}
return updateTrainOrderDetailData(trainOrderDetail, trainDetailData);
}

View File

@ -222,7 +222,6 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
}, () -> carOrderDetail.setOverStandard(""));
carOrderDetail.setOrderNo(orderDetail.getOrderNo());
carOrderDetail.setDetailId(orderDetail.getOrderNo());
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
carOrderDetail.setBookingUserCode(user.getEmployeeNo());
carOrderDetail.setBookingName(user.getName());

View File

@ -15,5 +15,5 @@ public class AmapConstant {
public static final String CANCEL_AN_ORDER_URL = "/ws/car/open/enterprise/cancelOrder";//取消订单
//登录路径
public static final String AMAP_LOGIN_PATH = "/ws/car/open/enterprise/order/detail";
public static final String AMAP_LOGIN_PATH = "/node";
}

View File

@ -9,6 +9,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import static com.chint.infrastructure.constant.AmapConstant.AMAP_LOGIN_PATH;
@Component
public class AmapLoginRequest {
@ -22,8 +28,11 @@ public class AmapLoginRequest {
private String baseLoginUrl;
private H5LoginResponse h5Login(User user) {
public H5LoginResponse h5Login(User user) {
TokenResponse token = tokenRequest.getToken(user);
return null;
String tokenValue = token.getData().getToken();
String loginUrl = baseLoginUrl + AMAP_LOGIN_PATH;
return H5LoginResponse.Success(loginUrl).token(tokenValue);
}
}

View File

@ -7,4 +7,17 @@ public class H5LoginResponse {
private String redirectUrl;
private String htmlContent;
private boolean success;
private String token;
public static H5LoginResponse Success(String redirectUrl) {
H5LoginResponse h5LoginResponse = new H5LoginResponse();
h5LoginResponse.setRedirectUrl(redirectUrl);
h5LoginResponse.setSuccess(true);
return h5LoginResponse;
}
public H5LoginResponse token(String token) {
this.setToken(token);
return this;
}
}

View File

@ -1,6 +1,7 @@
package com.chint;
import com.chint.domain.aggregates.user.User;
import com.chint.interfaces.rest.amap.AmapLoginRequest;
import com.chint.interfaces.rest.amap.AmapUserRequest;
import com.chint.interfaces.rest.amap.BaseResponse;
import com.chint.interfaces.rest.amap.dto.UserQueryResponse;
@ -11,6 +12,7 @@ import com.chint.interfaces.rest.amap.request.OrderDetailRequest;
import com.chint.interfaces.rest.amap.request.SettleBillRequest;
import com.chint.interfaces.rest.amap.request.TakeCarRequest;
import com.chint.interfaces.rest.amap.request.TokenRequest;
import com.chint.interfaces.rest.base.dto.H5LoginResponse;
import com.google.gson.Gson;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,6 +24,9 @@ public class AmapTest {
@Autowired
private AmapUserRequest amapUserRequest;
@Autowired
private AmapLoginRequest amapLoginRequest;
private Gson gson = new Gson();
private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001");
@ -45,6 +50,12 @@ public class AmapTest {
System.out.println(gson.toJson(baseResponse));
}
@Test
public void login(){
H5LoginResponse h5LoginResponse = amapLoginRequest.h5Login(user);
System.out.println(gson.toJson(h5LoginResponse.getRedirectUrl()));
}
@Autowired
private TokenRequest tokenRequest;