完善携程结算逻辑
This commit is contained in:
parent
7841af05b4
commit
5ad1e6f6f4
|
@ -119,9 +119,11 @@ public class OrderFlightRecord extends OrderBaseRecord {
|
|||
|
||||
// 加载机票信息
|
||||
public OrderFlightRecord loadTicketInfo(String issueTicketTime,
|
||||
String ticketNo,
|
||||
String facePrice,
|
||||
String useStatus) {
|
||||
this.setIssueTicketTime(issueTicketTime);
|
||||
this.setTicketNo(ticketNo);
|
||||
this.setFacePrice(facePrice);
|
||||
this.setUseStatus(useStatus);
|
||||
return this;
|
||||
|
|
|
@ -79,6 +79,7 @@ public class OrderHotelRecord extends OrderBaseRecord {
|
|||
private String orderStatus;
|
||||
private String createTime;
|
||||
private String receiptsNumOrigin;//支付总金额
|
||||
|
||||
// 加载基础订单信息
|
||||
public OrderHotelRecord loadBasicOrderInfo(String orderNo,
|
||||
String orderStatus,
|
||||
|
@ -90,10 +91,9 @@ public class OrderHotelRecord extends OrderBaseRecord {
|
|||
}
|
||||
|
||||
// 加载酒店和入住信息
|
||||
public OrderHotelRecord loadHotelInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate,
|
||||
public OrderHotelRecord loadHotelInfo(String hotelName, String checkInDate, String departureDate,
|
||||
int roomCount, String roomTypeName) {
|
||||
this.setHotelName(hotelName);
|
||||
this.setHotelAddress(hotelAddress);
|
||||
this.setCheckInDate(checkInDate);
|
||||
this.setDepartureDate(departureDate);
|
||||
this.setRoomCount(roomCount);
|
||||
|
@ -102,10 +102,11 @@ public class OrderHotelRecord extends OrderBaseRecord {
|
|||
}
|
||||
|
||||
// 加载地理信息位置
|
||||
public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity) {
|
||||
public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity, String hotelAddress) {
|
||||
this.setCountry(country);
|
||||
this.setProvince(province);
|
||||
this.setCheckInCity(checkInCity);
|
||||
this.setHotelAddress(hotelAddress);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -239,6 +240,4 @@ public class OrderHotelRecord extends OrderBaseRecord {
|
|||
this.setTaxCusFee(taxCusFee);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -26,14 +26,20 @@ public class CTripFlightRecord implements Serializable {
|
|||
private CTripFlightInfo cTripFlightInfo;
|
||||
@MappedCollection(idColumn = "c_trip_flight_record_id")
|
||||
private CTripFlightBaseInfo cTripFlightBaseInfo;
|
||||
@MappedCollection(idColumn = "c_trip_flight_record_id")
|
||||
private CTripFlightTripInfo cTripFlightTripInfo;
|
||||
|
||||
public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) {
|
||||
public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase,
|
||||
CTripFlightInfo cTripFlightInfo,
|
||||
CTripFlightBaseInfo cTripOrderBaseInfo,
|
||||
CTripFlightTripInfo cTripFlightTripInfo) {
|
||||
CTripFlightRecord cTripFlightRecord = new CTripFlightRecord();
|
||||
cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase);
|
||||
cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo);
|
||||
cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId()));
|
||||
cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime()));
|
||||
cTripFlightRecord.setCTripFlightBaseInfo(cTripOrderBaseInfo);
|
||||
cTripFlightRecord.setCTripFlightTripInfo(cTripFlightTripInfo);
|
||||
return cTripFlightRecord;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("c_trip_flight_trip_info")
|
||||
public class CTripFlightTripInfo implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -2541232534673683466L;
|
||||
@Id
|
||||
private Long id;
|
||||
private Long cTripFlightRecordId;
|
||||
private Long TripId;
|
||||
private Integer SectorId;
|
||||
private String PassengerName;
|
||||
private String RecordStatus;
|
||||
private Integer ValidFlag;//
|
||||
private String FlightClass;
|
||||
private String Flight;
|
||||
private String ClassGrade;
|
||||
private String SubClass;
|
||||
private String TakeOffTime;
|
||||
private String ArrivalTime;
|
||||
private Integer DCity;
|
||||
private String DepartureDistrictCode;
|
||||
private String DPort;
|
||||
private String DPortBuilding;
|
||||
private Integer DPortBuildingId;
|
||||
private Integer ACity;
|
||||
private String ArrivalDistrictCode;
|
||||
private String APort;
|
||||
private String APortBuilding;
|
||||
private Integer APortBuildingId;
|
||||
private Integer OpenTranFlag;//
|
||||
private Double PrintPrice;
|
||||
private Double Oil;
|
||||
private Double Tax;
|
||||
private String RecordNo;
|
||||
private String AirlineRecordNo;
|
||||
private Integer SharedFlag;//
|
||||
private String SharedFlight;
|
||||
private Integer SurfaceFlag; //
|
||||
private String AirLineCode;
|
||||
private String TicketNo;
|
||||
private Integer TicketNoStatus;
|
||||
private String TicketNoStatusName;
|
||||
private String DCityName;
|
||||
private String DPortName;
|
||||
private String ACityName;
|
||||
private String APortName;
|
||||
// private OrderFlightResponse.StandardGeoInfo StandardGeoInfo;
|
||||
private String ClassTypeName;
|
||||
private String AirlineName;
|
||||
|
||||
public static CTripFlightTripInfo of(OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo) {
|
||||
CTripFlightTripInfo cTripFlightTripInfo = BeanUtil.copyProperties(flightTripRecordInfo, CTripFlightTripInfo.class);
|
||||
cTripFlightTripInfo.setValidFlag(flightTripRecordInfo.isValidFlag() ? 1 : 0);
|
||||
cTripFlightTripInfo.setOpenTranFlag(flightTripRecordInfo.isOpenTranFlag() ? 1 : 0);
|
||||
cTripFlightTripInfo.setSharedFlag(flightTripRecordInfo.isSharedFlag() ? 1 : 0);
|
||||
cTripFlightTripInfo.setSurfaceFlag(flightTripRecordInfo.isSurfaceFlag() ? 1 : 0);
|
||||
cTripFlightTripInfo.setTicketNoStatusName(translateTicketStatus(flightTripRecordInfo.getTicketNoStatus()));
|
||||
return cTripFlightTripInfo;
|
||||
}
|
||||
|
||||
private static String translateTicketStatus(Integer ticketNoStatus) {
|
||||
return switch (ticketNoStatus) {
|
||||
case -2 -> "未知";
|
||||
case -1 -> "未知";
|
||||
case 1 -> "待使用";
|
||||
case 2 -> "已使用";
|
||||
case 3 -> "已经办理登记";
|
||||
case 4 -> "已离港";
|
||||
case 5 -> "已作废";
|
||||
case 6 -> "已退票";
|
||||
case 7 -> "换开";
|
||||
case 8 -> "挂起";
|
||||
case 9 -> "机场控制";
|
||||
case 10 -> "机场控制";
|
||||
case 11 -> "未查到";
|
||||
default -> "未知";
|
||||
};
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -19,6 +20,8 @@ public class CTripHotelOrderDetail implements Serializable {
|
|||
private Long id;
|
||||
private Long cTripHotelRecordId;
|
||||
private Long OrderId;
|
||||
@MappedCollection(idColumn = "c_trip_hotel_order_detail_id", keyColumn = "c_trip_hotel_order_detail_key")
|
||||
private List<CTripHotelRoomDetail> cTripHotelRoomDetailList;
|
||||
private String EmployeeName;
|
||||
private String EmployeeID;
|
||||
private String WorkCity;
|
||||
|
@ -100,8 +103,13 @@ public class CTripHotelOrderDetail implements Serializable {
|
|||
private Double TPConfigMaxPrice;
|
||||
private String ReservationType;
|
||||
private String PreEmail;
|
||||
|
||||
public static CTripHotelOrderDetail of(OrderHotelResponse.SettlementOrderDetail data) {
|
||||
return BeanUtil.copyProperties(data, CTripHotelOrderDetail.class);
|
||||
CTripHotelOrderDetail cTripHotelOrderDetail = BeanUtil.copyProperties(data, CTripHotelOrderDetail.class);
|
||||
List<OrderHotelResponse.SettlementRoomDetail> roomDetailList = data.getRoomDetailList();
|
||||
List<CTripHotelRoomDetail> res = roomDetailList.stream().map(CTripHotelRoomDetail::of).toList();
|
||||
cTripHotelOrderDetail.setCTripHotelRoomDetailList(res);
|
||||
return cTripHotelOrderDetail;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.chint.domain.aggregates.order.order_record.ctrip_order_record;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Table("c_trip_hotel_room_detail")
|
||||
public class CTripHotelRoomDetail implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1027124557206346513L;
|
||||
@Id
|
||||
private Long id;
|
||||
private Long cTripHotelOrderDetailId;
|
||||
private Integer cTripHotelOrderDetailKey;
|
||||
private String BasicRoomTypeName;
|
||||
private String BasicRoomTypeEnName;
|
||||
private Integer Breakfast;
|
||||
private Integer AddBreakfast;
|
||||
private Integer Meals;
|
||||
private String ETA;
|
||||
private String ETD;
|
||||
private Double Price;
|
||||
private Integer remainQuantity;
|
||||
private Integer refundQuantity;
|
||||
|
||||
public static CTripHotelRoomDetail of(OrderHotelResponse.SettlementRoomDetail roomDetail) {
|
||||
return BeanUtil.copyProperties(roomDetail, CTripHotelRoomDetail.class);
|
||||
}
|
||||
}
|
|
@ -49,16 +49,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5());
|
||||
String sysCode = cTripCarPassengerInfo.getCostCenter3();
|
||||
if (sysCode != null) {
|
||||
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_FSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
|
||||
}
|
||||
} else {
|
||||
|
@ -208,16 +208,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5());
|
||||
String sysCode = cTripFlightBaseInfo.getCostCenter3();
|
||||
if (sysCode != null) {
|
||||
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_FSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
|
||||
}
|
||||
} else {
|
||||
|
@ -231,6 +231,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
|
||||
CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData;
|
||||
CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo();
|
||||
CTripFlightTripInfo cTripFlightTripInfo = cTripFlightRecord.getCTripFlightTripInfo();
|
||||
String routeOrderNo = cTripFlightRecord.getRouteOrderNo();
|
||||
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
|
||||
OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord)
|
||||
|
@ -257,13 +258,22 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
"",
|
||||
cTripFlightInfo.getACityCode(),
|
||||
"")
|
||||
.loadTicketInfo(cTripFlightRecordBase.getCreateTime(),
|
||||
String.valueOf(cTripFlightRecordBase.getPrice()),
|
||||
"")
|
||||
.loadSeatInfo(cTripFlightInfo.getClassName(),
|
||||
cTripFlightInfo.getClassName(),
|
||||
String.valueOf(cTripFlightInfo.getPriceRate()));
|
||||
|
||||
if (cTripFlightTripInfo != null) {
|
||||
orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(),
|
||||
String.valueOf(cTripFlightRecordBase.getPrice()),
|
||||
cTripFlightTripInfo.getTicketNo(),
|
||||
cTripFlightTripInfo.getTicketNoStatusName());
|
||||
} else {
|
||||
orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(),
|
||||
String.valueOf(cTripFlightRecordBase.getPrice()),
|
||||
"",
|
||||
"无机票信息");
|
||||
}
|
||||
|
||||
|
||||
// 加载财务与价格信息
|
||||
String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6);
|
||||
|
@ -349,16 +359,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5());
|
||||
String sysCode = cTripHotelOrderDetail.getCostCenter3();
|
||||
if (sysCode != null) {
|
||||
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_FSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
|
||||
}
|
||||
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
|
||||
if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) {
|
||||
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
|
||||
}
|
||||
} else {
|
||||
|
@ -386,7 +396,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
|
||||
// 加载酒店和入住信息
|
||||
orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(),
|
||||
cTripHotelInfo.getHotelName(),
|
||||
cTripHotelOrderDetail.getStartTime(),
|
||||
cTripHotelOrderDetail.getEndTime(),
|
||||
cTripHotelOrderDetail.getRoomQuantity(),
|
||||
|
@ -399,7 +408,15 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
} else {
|
||||
isAgreement = "否";
|
||||
}
|
||||
orderHotelRecord.loadRoomAndBreakfastInfo("",
|
||||
List<CTripHotelRoomDetail> roomDetails = cTripHotelOrderDetail.getCTripHotelRoomDetailList();
|
||||
Integer averageMeals;
|
||||
if (roomDetails != null && !roomDetails.isEmpty()) {
|
||||
averageMeals = roomDetails.stream().map(CTripHotelRoomDetail::getBreakfast).reduce(Integer::sum).get();
|
||||
|
||||
} else {
|
||||
averageMeals = 0;
|
||||
}
|
||||
orderHotelRecord.loadRoomAndBreakfastInfo(String.valueOf(averageMeals),
|
||||
isAgreement,
|
||||
cTripHotelRecordBase.getQuantity(),
|
||||
cTripHotelRecordBase.getQuantity(),
|
||||
|
@ -413,10 +430,19 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
if (locations != null && !locations.isEmpty()) {
|
||||
Location location = locations.get(0);
|
||||
LocationRes locationRes = LocationRes.copyFrom(location);
|
||||
orderHotelRecord.loadLocationInfo(locationRes.getCountry(), locationRes.getProvince(), cTripHotelInfo.getCityName());
|
||||
String address = locationRes.getCountry() + locationRes.getProvince() + cTripHotelInfo.getCityName();
|
||||
if (cTripHotelInfo.getDistrictName() != null) {
|
||||
address = address + cTripHotelInfo.getDistrictName();
|
||||
}
|
||||
address = address + cTripHotelInfo.getHotelName();
|
||||
orderHotelRecord.loadLocationInfo(
|
||||
address,
|
||||
locationRes.getCountry(),
|
||||
locationRes.getProvince(),
|
||||
cTripHotelInfo.getCityName());
|
||||
} else {
|
||||
//如果找不到该地区,那么只能先用空的
|
||||
orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName());
|
||||
orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName(), cTripHotelInfo.getHotelName());
|
||||
}
|
||||
|
||||
// 加载酒店品牌和星级信息
|
||||
|
@ -458,11 +484,17 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
cTripHotelRecordBase.getCreateTime()));
|
||||
|
||||
// 加载财务信息
|
||||
String invoiceType = cTripHotelOrderDetail.getIsHasSpecialInvoice().equals("T") ? "增值税专用发票" : "增值税普通发票"; //发票类型
|
||||
orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getBatchStartDate().substring(0, 6),
|
||||
cTripHotelRecordBase.getSubAccCheckBatchNo(),
|
||||
String.valueOf(cTripHotelRecordBase.getAmount()),
|
||||
"",
|
||||
cTripHotelRecordBase.getPaidAmount());
|
||||
cTripHotelRecordBase.getPaidAmount())
|
||||
.loadInvoiceAndFeeInfo(invoiceType,
|
||||
String.valueOf(cTripHotelRecordBase.getExtraCharge()),
|
||||
String.valueOf(cTripHotelRecordBase.getServiceFee()),
|
||||
"",
|
||||
"");
|
||||
|
||||
|
||||
// 加载付款 付款方式,公司付款金额, 个人付款金额
|
||||
|
|
|
@ -40,7 +40,8 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
|
|||
String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
Page<OrderCarRecord> byUpdateDataTimeBetween = orderCarRecordRepository
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType,
|
||||
startTime, endTime, startTime, endTime, pageRequest);
|
||||
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,8 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
|
|||
public PageResult<OrderFlightRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
Page<OrderFlightRecord> byUpdateDataTimeBetween = jdbcOrderFlightRecordRepository
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType,
|
||||
startTime, endTime, startTime, endTime, pageRequest);
|
||||
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||
import com.chint.domain.repository.OrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -23,6 +20,7 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
|
|||
|
||||
@Autowired
|
||||
private JdbcOrderHotelRecordRepository jdbcOrderHotelRecordRepository;
|
||||
|
||||
@Override
|
||||
public List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList) {
|
||||
List<OrderHotelRecord> res = new ArrayList<>();
|
||||
|
@ -36,10 +34,11 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) {
|
||||
public PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
Page<OrderHotelRecord> byUpdateDataTimeBetween = jdbcOrderHotelRecordRepository
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType,
|
||||
startTime, endTime, startTime, endTime, pageRequest);
|
||||
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
||||
import com.chint.domain.repository.OrderTrainRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -21,6 +19,7 @@ import java.util.Optional;
|
|||
public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository {
|
||||
@Autowired
|
||||
private JdbcOrderTrainRecordRepository jdbcOrderTrainRecordRepository;
|
||||
|
||||
@Override
|
||||
public List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList) {
|
||||
List<OrderTrainRecord> res = new ArrayList<>();
|
||||
|
@ -34,10 +33,11 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) {
|
||||
public PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
|
||||
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
|
||||
Page<OrderTrainRecord> byUpdateDataTimeBetween = jdbcOrderTrainRecordRepository
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
|
||||
.findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType,
|
||||
startTime, endTime, startTime, endTime, pageRequest);
|
||||
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRec
|
|||
Optional<OrderCarRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderCarRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
Page<OrderCarRecord> findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFli
|
|||
Optional<OrderFlightRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderFlightRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
Page<OrderFlightRecord> findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
@ -15,4 +16,5 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHote
|
|||
Optional<OrderHotelRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderHotelRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
Page<OrderHotelRecord> findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -14,4 +14,6 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrai
|
|||
Optional<OrderTrainRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderTrainRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
|
||||
Page<OrderTrainRecord> findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -55,20 +55,23 @@ public class CTripOrderRecordAutoSave {
|
|||
.map(it -> {
|
||||
//对数据库进行查找 ,如果发现已经存在 , 就使用查找出来的
|
||||
OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = it.getOrderSettlementBaseInfo();
|
||||
OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo = it.getFlightTripRecordInfo();
|
||||
CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId(
|
||||
String.valueOf(orderSettlementBaseInfo.getRecordID()));
|
||||
if (record == null) {
|
||||
record = CTripFlightRecord.of(
|
||||
CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo),
|
||||
CTripFlightInfo.of(it.getOrderFlightInfo()),
|
||||
CTripFlightBaseInfo.of(it.getOrderBaseInfo())
|
||||
CTripFlightBaseInfo.of(it.getOrderBaseInfo()),
|
||||
CTripFlightTripInfo.of(flightTripRecordInfo)
|
||||
);
|
||||
} else {
|
||||
Long originId = record.getId();
|
||||
record = CTripFlightRecord.of(
|
||||
CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo),
|
||||
CTripFlightInfo.of(it.getOrderFlightInfo()),
|
||||
CTripFlightBaseInfo.of(it.getOrderBaseInfo()));
|
||||
CTripFlightBaseInfo.of(it.getOrderBaseInfo()),
|
||||
CTripFlightTripInfo.of(flightTripRecordInfo));
|
||||
record.setId(originId);
|
||||
}
|
||||
//补充额外的字段
|
||||
|
|
Loading…
Reference in New Issue