diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java new file mode 100644 index 00000000..84b40c87 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java @@ -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); + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java index e252843a..aad7ebd4 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java @@ -24,13 +24,16 @@ public class CTripCarRecord implements Serializable { private CTripCarRecordBase cTripCarRecordBase; @MappedCollection(idColumn = "c_trip_car_record_id") 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.setCTripCarQuickInfo(cTripCarQuickInfo); cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase); cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId())); cTripCarRecord.setCreateTime(DateTimeUtil.strToTime(cTripCarRecordBase.getCreateTime())); + cTripCarRecord.setCTripCarPassengerInfo(cTripCarPassengerInfo); return cTripCarRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java index 29d46cb9..19bb283a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java @@ -6,10 +6,15 @@ 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_base_info") -public class CTripFlightBaseInfo { +public class CTripFlightBaseInfo implements Serializable { + @Serial + private static final long serialVersionUID = 2742278923464870145L; @Id private Long id; private Long cTripFlightRecordId; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java index 955e2486..3f634d95 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java @@ -6,9 +6,14 @@ 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_info") -public class CTripFlightInfo { +public class CTripFlightInfo implements Serializable { + @Serial + private static final long serialVersionUID = 2423124551558870145L; @Id private Long id; private Long cTripFlightRecordId; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java index 76097dbe..98ea8dc8 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java @@ -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.Table; +import java.io.Serial; +import java.io.Serializable; import java.time.LocalDateTime; @Data @Table("c_trip_flight_record") -public class CTripFlightRecord { +public class CTripFlightRecord implements Serializable { + @Serial + private static final long serialVersionUID = 2423112324154456545L; @Id private Long id; private String recordId; @@ -21,7 +25,7 @@ public class CTripFlightRecord { @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightInfo cTripFlightInfo; @MappedCollection(idColumn = "c_trip_flight_record_id") - private CTripFlightBaseInfo cTripOrderBaseInfo; + private CTripFlightBaseInfo cTripFlightBaseInfo; public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); @@ -29,7 +33,7 @@ public class CTripFlightRecord { cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); - cTripFlightRecord.setCTripOrderBaseInfo(cTripOrderBaseInfo); + cTripFlightRecord.setCTripFlightBaseInfo(cTripOrderBaseInfo); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java index fb7eede3..3d48c646 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java @@ -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.Table; +import java.io.Serial; +import java.io.Serializable; import java.time.LocalDateTime; @Data @Table("c_trip_hotel_record") -public class CTripHotelRecord { +public class CTripHotelRecord implements Serializable { + @Serial + private static final long serialVersionUID = 3024566789331464513L; @Id private Long id; private String recordId; diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index d5ff7381..783ef50f 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -17,6 +17,7 @@ import org.springframework.stereotype.Component; import java.util.List; import java.util.Optional; +import static com.chint.infrastructure.constant.BelongSystemConstant.*; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; @Component @@ -33,13 +34,46 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Autowired 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 public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; String routeOrderNo = cTripCarRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderCarRecord orderCarRecord = orderRecordFactory - .buildWithRouteOrder(byOrderNo) + OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord) .carRecord(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); //携程的打车订单可以直接通过订单号获取对应的订单 @@ -47,8 +81,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .getOrderDetails() .stream() .filter(it -> it.getOrderNo().equals(String.valueOf( - cTripCarRecordBase.getOrderId() - ))).findFirst(); + cTripCarRecordBase.getOrderId() + ))).findFirst(); CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo(); @@ -135,12 +169,47 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac 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 public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; + CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderFlightRecord orderFlightRecord = orderRecordFactory.buildWithRouteOrder(byOrderNo) + OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) .flightRecord(); CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); @@ -220,18 +289,55 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载未预订最低价原因 orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); + // 加载组织架构与项目信息 + orderFlightRecord.loadOrganizationalAndProjectInfo(cTripFlightBaseInfo.getDept1(), + cTripFlightBaseInfo.getDept2(), + cTripFlightBaseInfo.getDept3()); 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 public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderHotelRecord orderHotelRecord = orderRecordFactory - .buildWithRouteOrder(byOrderNo) + OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord) .hotelRecord(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java index 92b38c3f..764e569c 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java @@ -120,7 +120,9 @@ public class CTripOrderRecordAutoSave { if (record == null) { record = CTripCarRecord.of( 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();