修复财务共享时间传参问题

This commit is contained in:
lulz1 2024-03-12 17:05:12 +08:00
parent 1b028c2ac5
commit 236d0ba056
3 changed files with 60 additions and 10 deletions

View File

@ -1,9 +1,15 @@
package com.chint.application.dtos.mapper;
import cn.hutool.core.bean.BeanUtil;
import com.chint.application.dtos.response.FLightExtensionField;
import com.chint.application.dtos.response.HotelExtensionField;
import com.chint.application.dtos.response.OrderDetailRes;
import com.chint.application.dtos.response.TrainExtensionField;
import com.chint.domain.aggregates.order.FlightOrderDetail;
import com.chint.domain.aggregates.order.HotelOrderDetail;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.TrainOrderDetail;
import com.chint.domain.exceptions.NotFoundException;
import static com.chint.infrastructure.constant.LegConstant.*;
@ -14,15 +20,58 @@ public class OrderDetailMapper {
orderDetailRes.setOutOrderStatus(orderDetail.getOutOrderStatus());
Integer productType = orderDetail.getProductType();
// switch (productType){
// case LEG_TYPE_TRAIN -> {
// TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
// };
// case LEG_TYPE_AIRPLANE -> ;
// case LEG_TYPE_HOTEL -> ;
// case LEG_TYPE_TAXI -> ;
// }
switch (productType) {
case LEG_TYPE_TRAIN -> {
TrainExtensionField trainExtensionField = getTrainExtensionField(orderDetail);
orderDetailRes.setTrainExtensionField(trainExtensionField);
}
case LEG_TYPE_AIRPLANE -> {
FLightExtensionField fLightExtensionField = getFlightExtensionField(orderDetail);
orderDetailRes.setFLightExtensionField(fLightExtensionField);
}
case LEG_TYPE_HOTEL -> {
HotelExtensionField hotelExtensionField = getHotelExtensionField(orderDetail);
orderDetailRes.setHotelExtensionField(hotelExtensionField);
}
case LEG_TYPE_TAXI -> {
}
default -> throw new NotFoundException("订单类型未知");
}
return orderDetailRes;
}
private static HotelExtensionField getHotelExtensionField(OrderDetail orderDetail) {
HotelExtensionField hotelExtensionField = new HotelExtensionField();
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();
hotelExtensionField.setHotelName(hotelOrderDetail.getHotelName());
hotelExtensionField.setNightCount(hotelOrderDetail.getRoomCount());
hotelExtensionField.setNightCount(hotelOrderDetail.getNightCount());
return hotelExtensionField;
}
private static FLightExtensionField getFlightExtensionField(OrderDetail orderDetail) {
FLightExtensionField fLightExtensionField = new FLightExtensionField();
FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail();
fLightExtensionField.setArriveCity(flightOrderDetail.getEndCityName());
fLightExtensionField.setDepartCity(flightOrderDetail.getStartCityName());
fLightExtensionField.setArriveStation(flightOrderDetail.getEndAirportName());
fLightExtensionField.setDepartStation(flightOrderDetail.getStartAirportName());
fLightExtensionField.setSeatName(flightOrderDetail.getSeatPointName());
return fLightExtensionField;
}
private static TrainExtensionField getTrainExtensionField(OrderDetail orderDetail) {
TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
TrainExtensionField trainExtensionField = new TrainExtensionField();
trainExtensionField.setArriveCity(trainOrderDetail.getToCity());
trainExtensionField.setDepartCity(trainOrderDetail.getFromCity());
trainExtensionField.setDepartStation(trainOrderDetail.getFromStationName());
trainExtensionField.setArriveStation(trainOrderDetail.getToStationName());
trainExtensionField.setTrainNo(trainOrderDetail.getTrainNo());
trainExtensionField.setSeatName(trainOrderDetail.getSeatName());
return trainExtensionField;
}
}

View File

@ -5,6 +5,7 @@ import lombok.Data;
@Data
public class FLightExtensionField {
private String flightInfo;
private String seatName;
private String departCity;
private String departStation;
private String arriveCity;

View File

@ -131,8 +131,8 @@ public class LegEventHandler implements LegEventService {
if (startTime != null && endTime != null) {
if (startTime.contains("T") && endTime.contains("T")) {
//如果包含T就截取时间信息前10位
routeOrder.setStartTime(LocalDate.parse(startTime.substring(0, 10), formatterWithT).atStartOfDay());
routeOrder.setEndTime(LocalDate.parse(endTime.substring(0, 10), formatterWithT).atStartOfDay().plusHours(23).plusMinutes(59).plusSeconds(59));
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));