1.修改订单明细认证接口

This commit is contained in:
wanglf3 2024-03-13 13:23:12 +08:00
parent d5b0be42f9
commit 088ca0a9ea
3 changed files with 68 additions and 46 deletions

View File

@ -11,6 +11,8 @@ import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import static com.chint.infrastructure.constant.OrderConstant.*;
@Data
@Table("order_event")
public class OrderEvent implements Serializable {
@ -32,9 +34,9 @@ public class OrderEvent implements Serializable {
public String translateOrderEvent(int event) {
return switch (event) {
case OrderConstant.ORDER_EVENT_PREPARE -> OrderConstant.ORDER_EVENT_PREPARE_NAME;
case OrderConstant.ORDER_EVENT_PAYED -> OrderConstant.ORDER_EVENT_PAYED_NAME;
case OrderConstant.ORDER_EVENT_CHANGE -> OrderConstant.ORDER_EVENT_CHANGE_NAME;
case ORDER_EVENT_PREPARE -> OrderConstant.ORDER_EVENT_PREPARE_NAME;
case ORDER_EVENT_PAYED -> OrderConstant.ORDER_EVENT_PAYED_NAME;
case ORDER_EVENT_CHANGE -> OrderConstant.ORDER_EVENT_CHANGE_NAME;
case OrderConstant.ORDER_EVENT_CANCEL -> OrderConstant.ORDER_EVENT_CANCEL_NAME;
case OrderConstant.ORDER_EVENT_ORDERED -> OrderConstant.ORDER_EVENT_ORDERED_NAME;
case OrderConstant.ORDER_EVENT_REFUND -> OrderConstant.ORDER_EVENT_REFUND_NAME;
@ -45,17 +47,17 @@ public class OrderEvent implements Serializable {
};
}
public String mapToFlightOrderDetailStatus(){
public String mapToOrderDetailStatus(){
return switch (this.eventType) {
case OrderConstant.ORDER_EVENT_PREPARE -> "0";
case OrderConstant.ORDER_EVENT_PAYED -> "1";
case OrderConstant.ORDER_EVENT_CHANGE -> "2";
case OrderConstant.ORDER_EVENT_CANCEL -> "3";
case OrderConstant.ORDER_EVENT_ORDERED -> "0";
case OrderConstant.ORDER_EVENT_REFUND -> "3";
case OrderConstant.ORDER_EVENT_UNKNOWN -> "0";
case OrderConstant.ORDER_EVENT_FINISH -> "1";
case OrderConstant.ORDER_EVENT_ETA -> "0";
case ORDER_EVENT_PREPARE -> "0";
case ORDER_EVENT_PAYED -> "1";
case ORDER_EVENT_CHANGE -> "2";
case ORDER_EVENT_CANCEL -> "3";
case ORDER_EVENT_ORDERED -> "1";
case ORDER_EVENT_REFUND -> "3";
case ORDER_EVENT_UNKNOWN -> "0";
case ORDER_EVENT_FINISH -> "1";
case ORDER_EVENT_ETA -> "0";
default -> "未知事件";
};
}

View File

@ -9,7 +9,6 @@ import com.chint.domain.repository.UserRepository;
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.ly.dto.search.response.car.CarDetailResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -17,9 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_DETAIL_STATUS_SUCCESS;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP_EXTENSION_NAME;
@Component
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@ -135,7 +132,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
first.ifPresent(orderDetail ->{
OrderEvent lastEvent = orderDetail.getLastEvent();
if(lastEvent != null){
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
flightOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}}
);
@ -143,16 +140,20 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
flightOrderDetail.setCreateTime(flightOrderBasicInfo.getCreateTime());
flightOrderDetail.setUserCode(flightOrderBasicInfo.getEmployeeID());
flightOrderDetail.setOrderAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
flightOrderDetail.setPaymentType(flightOrderBasicInfo.getPrepayType());
if (flightOrderBasicInfo.getPrepayType().equals("ACCNT")){
flightOrderDetail.setPaymentType("0");
}else {
flightOrderDetail.setPaymentType("1");
}
//付款方式 ACCNT公司统付 其他类型个人支付
if (flightOrderBasicInfo.getPrepayType().equals("ACCNT")) {
flightOrderDetail.setPersonalPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
} else {
flightOrderDetail.setPersonalPaymentAmount(String.valueOf(flightOrderBasicInfo.getAmount()));
}
flightOrderDetail.setProjectOrderNo(flightOrderBasicInfo.getCostCenter5());
flightOrderDetail.setCostCenter(flightOrderBasicInfo.getCostCenter6());
}
if (flightInfo != null) {
@ -212,6 +213,9 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
// flightOrderDetail.setReceiptsNum(journeyNo);
flightOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
// first.flatMap(orderDetail -> routeOrder.getLegItems()
@ -321,7 +325,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
first.ifPresent(orderDetail ->{
OrderEvent lastEvent = orderDetail.getLastEvent();
if(lastEvent != null){
hotelOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
hotelOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}}
);
@ -342,13 +346,19 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (approveOrderNo != null) {
hotelOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
hotelOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
hotelOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
hotelOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
if (hotelOrderInfoEntity != null){
hotelOrderDetail.setOrderNo(hotelOrderInfoEntity.getOrderID()); //订单号
hotelOrderDetail.setDetailId(hotelOrderInfoEntity.getOrderID());
hotelOrderDetail.setPaymentType(hotelOrderInfoEntity.getPayType());
// hotelOrderDetail.setReceiptsNum(hotelOrderInfoEntity.getJourneyNo());
hotelOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo());
@ -365,18 +375,26 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setRoomTypeName(hotelOrderInfoEntity.getRoomName()); //房型
if (Double.parseDouble(hotelOrderInfoEntity.getSettlementACCNTAmt()) > 0) {
hotelOrderDetail.setCompanyAmount(hotelOrderInfoEntity.getSettlementACCNTAmt());
hotelOrderDetail.setCompanyRefundAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPaymentType("0");
} else {
//如果公司统付为负数 那么表示退款
hotelOrderDetail.setCompanyAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setCompanyRefundAmount(hotelOrderInfoEntity.getSettlementACCNTAmt());
hotelOrderDetail.setPaymentType("0");
}
if (Double.parseDouble(hotelOrderInfoEntity.getSettlementPersonAmt()) > 0) {
hotelOrderDetail.setPersonalAmount(hotelOrderInfoEntity.getSettlementPersonAmt());
hotelOrderDetail.setPersonalRefundAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPaymentType("1");
} else {
hotelOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPersonalRefundAmount(hotelOrderInfoEntity.getSettlementPersonAmt());
hotelOrderDetail.setPaymentType("1");
}
if (Double.parseDouble(hotelOrderInfoEntity.getAmount()) > 0) {
@ -405,8 +423,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
hotelOrderDetail.setBOOK_ORG_STRUCT_2(clientInfo.getDept2());
hotelOrderDetail.setBOOK_ORG_STRUCT_3(clientInfo.getDept3());
//
hotelOrderDetail.setProjectOrderNo(clientInfo.getCostCenter5());
hotelOrderDetail.setCostCenter(clientInfo.getCostCenter6());
//
}
}

View File

@ -7,28 +7,21 @@ 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.ly.dto.NotifyData;
import com.chint.interfaces.rest.ly.dto.ResultBackFly;
import com.chint.interfaces.rest.ly.dto.ResultBackTrain;
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;
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import com.chint.interfaces.rest.ly.tools.GetObjectNature;
import com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_EXTENSION_NAME;
@Component
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
@ -110,6 +103,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (approveOrderNo != null){
flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
flightOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
flightOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
flightOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
@ -171,7 +166,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
flightOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
flightOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}}
);
// flightOrderDetail.setScheduleNum(orderDetails.getTravelOrderNo());
@ -359,6 +354,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (approveOrderNo != null){
hotelOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
hotelOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
hotelOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
hotelOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
List<FlightOrderResponse.SubmitItem> submitItemList =
@ -388,7 +385,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
hotelOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
hotelOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}}
);
@ -476,7 +473,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
trainOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
trainOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}}
);
@ -505,6 +502,8 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (approveOrderNo != null){
trainOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
trainOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
trainOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
trainOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
if (submitItemList != null && !submitItemList.isEmpty()) {
for (TrainDetailResponse.TravelData.SubmitItem submitItem : submitItemList) {
@ -615,7 +614,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
first1.ifPresent(it ->{
OrderEvent lastEvent = it.getLastEvent();
if(lastEvent != null){
carOrderDetail.setOrderStatus(lastEvent.mapToFlightOrderDetailStatus());
carOrderDetail.setOrderStatus(lastEvent.mapToOrderDetailStatus());
}}
);
carOrderDetail.setBookingUserCode(carOrderDetailInfo.getOutEmployeeId());
@ -655,21 +654,25 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (approveOrderNo != null){
carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
carOrderDetail.setCostCenter(approveOrderNo.getCostCenter());
carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName());
}
if (submitItemList != null && !submitItemList.isEmpty()) {
for (CarDetailResponse.SubmitItem submitItem : submitItemList) {
String itemCode = submitItem.getItemCode();
if (itemCode.equals("CostCenter")) {
carOrderDetail.setCostCenter(submitItem.getItemContent());
}
if (itemCode.equals("Custom3")) {
carOrderDetail.setProjectOrderNo(submitItem.getItemContent());
}
}
}
// if (submitItemList != null && !submitItemList.isEmpty()) {
// for (CarDetailResponse.SubmitItem submitItem : submitItemList) {
// String itemCode = submitItem.getItemCode();
//
// if (itemCode.equals("CostCenter")) {
// carOrderDetail.setCostCenter(submitItem.getItemContent());
// }
//
// if (itemCode.equals("Custom3")) {
// carOrderDetail.setProjectOrderNo(submitItem.getItemContent());
// }
// }
// }
// carOrderDetail.setOverStandard(); //