测试携程结算代码

This commit is contained in:
Superdandan 2024-04-01 10:42:08 +08:00
parent ed3c0484f9
commit 16f4a64fd5
8 changed files with 196 additions and 15 deletions

View File

@ -0,0 +1,52 @@
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.OrderCarResponse;
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_car_passenger_info")
public class CTripCarPassengerInfo implements Serializable {
@Serial
private static final long serialVersionUID = 2343214623512376645L;
@Id
private Long id;
private Long cTripCarRecordId;
private String PassengerName;
private String PassengerPhone;
private String PassengerType;
private String UserProperties;
private String EmployeeID;
private String CorpUserID;
private String IdNumber;
private String IdType;
private String DistrictCode;
private String CityName;
private String CostCenter1;
private String CostCenter2;
private String CostCenter3;
private String CostCenter4;
private String CostCenter5;
private String CostCenter6;
private int CurrentStatus;
private String Dept1;
private String Dept2;
private String Dept3;
private String Dept4;
private String Dept5;
private String Dept6;
private String Dept7;
private String Dept8;
private String Dept9;
private String Dept10;
private String PassengerNamePinYin;
public static CTripCarPassengerInfo of(OrderCarResponse.CarOrderPassengerInfo carOrderPassengerInfo) {
return BeanUtil.copyProperties(carOrderPassengerInfo, CTripCarPassengerInfo.class);
}
}

View File

@ -24,13 +24,16 @@ public class CTripCarRecord implements Serializable {
private CTripCarRecordBase cTripCarRecordBase; private CTripCarRecordBase cTripCarRecordBase;
@MappedCollection(idColumn = "c_trip_car_record_id") @MappedCollection(idColumn = "c_trip_car_record_id")
private CTripCarQuickInfo cTripCarQuickInfo; private CTripCarQuickInfo cTripCarQuickInfo;
@MappedCollection(idColumn = "c_trip_car_record_id")
private CTripCarPassengerInfo cTripCarPassengerInfo;
public static CTripCarRecord of(CTripCarRecordBase cTripCarRecordBase, CTripCarQuickInfo cTripCarQuickInfo) { public static CTripCarRecord of(CTripCarRecordBase cTripCarRecordBase, CTripCarQuickInfo cTripCarQuickInfo , CTripCarPassengerInfo cTripCarPassengerInfo) {
CTripCarRecord cTripCarRecord = new CTripCarRecord(); CTripCarRecord cTripCarRecord = new CTripCarRecord();
cTripCarRecord.setCTripCarQuickInfo(cTripCarQuickInfo); cTripCarRecord.setCTripCarQuickInfo(cTripCarQuickInfo);
cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase); cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase);
cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId())); cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId()));
cTripCarRecord.setCreateTime(DateTimeUtil.strToTime(cTripCarRecordBase.getCreateTime())); cTripCarRecord.setCreateTime(DateTimeUtil.strToTime(cTripCarRecordBase.getCreateTime()));
cTripCarRecord.setCTripCarPassengerInfo(cTripCarPassengerInfo);
return cTripCarRecord; return cTripCarRecord;
} }
} }

View File

@ -6,10 +6,15 @@ import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
@Data @Data
@Table("c_trip_flight_base_info") @Table("c_trip_flight_base_info")
public class CTripFlightBaseInfo { public class CTripFlightBaseInfo implements Serializable {
@Serial
private static final long serialVersionUID = 2742278923464870145L;
@Id @Id
private Long id; private Long id;
private Long cTripFlightRecordId; private Long cTripFlightRecordId;

View File

@ -6,9 +6,14 @@ import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
@Data @Data
@Table("c_trip_flight_info") @Table("c_trip_flight_info")
public class CTripFlightInfo { public class CTripFlightInfo implements Serializable {
@Serial
private static final long serialVersionUID = 2423124551558870145L;
@Id @Id
private Long id; private Long id;
private Long cTripFlightRecordId; private Long cTripFlightRecordId;

View File

@ -6,11 +6,15 @@ import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
@Table("c_trip_flight_record") @Table("c_trip_flight_record")
public class CTripFlightRecord { public class CTripFlightRecord implements Serializable {
@Serial
private static final long serialVersionUID = 2423112324154456545L;
@Id @Id
private Long id; private Long id;
private String recordId; private String recordId;
@ -21,7 +25,7 @@ public class CTripFlightRecord {
@MappedCollection(idColumn = "c_trip_flight_record_id") @MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightInfo cTripFlightInfo; private CTripFlightInfo cTripFlightInfo;
@MappedCollection(idColumn = "c_trip_flight_record_id") @MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightBaseInfo cTripOrderBaseInfo; private CTripFlightBaseInfo cTripFlightBaseInfo;
public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) {
CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); CTripFlightRecord cTripFlightRecord = new CTripFlightRecord();
@ -29,7 +33,7 @@ public class CTripFlightRecord {
cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo);
cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId()));
cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime()));
cTripFlightRecord.setCTripOrderBaseInfo(cTripOrderBaseInfo); cTripFlightRecord.setCTripFlightBaseInfo(cTripOrderBaseInfo);
return cTripFlightRecord; return cTripFlightRecord;
} }
} }

View File

@ -6,11 +6,15 @@ import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
@Table("c_trip_hotel_record") @Table("c_trip_hotel_record")
public class CTripHotelRecord { public class CTripHotelRecord implements Serializable {
@Serial
private static final long serialVersionUID = 3024566789331464513L;
@Id @Id
private Long id; private Long id;
private String recordId; private String recordId;

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
@Component @Component
@ -33,13 +34,46 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
@Autowired @Autowired
private LocationRepository locationRepository; private LocationRepository locationRepository;
private OrderRecordBasic buildWithRecord(CTripCarRecord cTripCarRecord) {
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
CTripCarPassengerInfo cTripCarPassengerInfo = cTripCarRecord.getCTripCarPassengerInfo();
orderRecordBasic.loadBookingInfo(cTripCarPassengerInfo.getEmployeeID(),
cTripCarPassengerInfo.getPassengerName(),
"",
cTripCarPassengerInfo.getPassengerName(),
cTripCarPassengerInfo.getEmployeeID());
orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
orderRecordBasic.setAccountCompanyId(cTripCarPassengerInfo.getCostCenter1());
orderRecordBasic.setAccountCompanyName(cTripCarPassengerInfo.getCostCenter2());
orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5());
String sysCode = cTripCarPassengerInfo.getCostCenter3();
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
} else {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT);
}
return orderRecordBasic;
}
@Override @Override
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData;
String routeOrderNo = cTripCarRecord.getRouteOrderNo(); String routeOrderNo = cTripCarRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
OrderCarRecord orderCarRecord = orderRecordFactory OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord)
.buildWithRouteOrder(byOrderNo)
.carRecord(); .carRecord();
CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase();
//携程的打车订单可以直接通过订单号获取对应的订单 //携程的打车订单可以直接通过订单号获取对应的订单
@ -135,12 +169,47 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
return null; return null;
} }
private OrderRecordBasic buildWithRecord(CTripFlightRecord cTripFlightRecord) {
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo();
orderRecordBasic.loadBookingInfo(cTripFlightBaseInfo.getEmployeeID(),
cTripFlightBaseInfo.getName(),
"",
cTripFlightBaseInfo.getName(),
cTripFlightBaseInfo.getEmployeeID());
orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
orderRecordBasic.setAccountCompanyId(cTripFlightBaseInfo.getCostCenter());
orderRecordBasic.setAccountCompanyName(cTripFlightBaseInfo.getCostCenter2());
orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5());
String sysCode = cTripFlightBaseInfo.getCostCenter3();
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
} else {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT);
}
return orderRecordBasic;
}
@Override @Override
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData;
CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo();
String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
OrderFlightRecord orderFlightRecord = orderRecordFactory.buildWithRouteOrder(byOrderNo) OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord)
.flightRecord(); .flightRecord();
CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo();
@ -220,18 +289,55 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
// 加载未预订最低价原因 // 加载未预订最低价原因
orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc());
// 加载组织架构与项目信息
orderFlightRecord.loadOrganizationalAndProjectInfo(cTripFlightBaseInfo.getDept1(),
cTripFlightBaseInfo.getDept2(),
cTripFlightBaseInfo.getDept3());
return orderFlightRecord; return orderFlightRecord;
} }
private OrderRecordBasic buildWithRecord(CTripHotelRecord cTripHotelRecord) {
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail();
orderRecordBasic.loadBookingInfo(cTripHotelOrderDetail.getEmployeeID(),
cTripHotelOrderDetail.getEmployeeName(),
"",
cTripHotelOrderDetail.getEmployeeName(),
cTripHotelOrderDetail.getEmployeeID());
orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP);
orderRecordBasic.setAccountCompanyId(cTripHotelOrderDetail.getCostCenter());
orderRecordBasic.setAccountCompanyName(cTripHotelOrderDetail.getCostCenter2());
orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5());
String sysCode = cTripHotelOrderDetail.getCostCenter3();
if (sysCode != null) {
if (sysCode.equals(BELONG_SYS_CODE_FSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM);
}
if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC);
}
if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC);
}
} else {
orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT);
}
return orderRecordBasic;
}
@Override @Override
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) {
CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData;
CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail();
String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
OrderHotelRecord orderHotelRecord = orderRecordFactory OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord)
.buildWithRouteOrder(byOrderNo)
.hotelRecord(); .hotelRecord();
CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo();

View File

@ -120,7 +120,9 @@ public class CTripOrderRecordAutoSave {
if (record == null) { if (record == null) {
record = CTripCarRecord.of( record = CTripCarRecord.of(
CTripCarRecordBase.changeInfo(settlementBaseInfo), CTripCarRecordBase.changeInfo(settlementBaseInfo),
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo())); CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()),
CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0))
);
} }
//补充额外的字段 //补充额外的字段
OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo(); OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo();