测试携程结算代码

This commit is contained in:
Superdandan 2024-04-01 09:26:22 +08:00 committed by lulz1
parent 86c90598ce
commit fda49ff6c3
25 changed files with 535 additions and 105 deletions

View File

@ -41,7 +41,7 @@ public class AutoWorkController {
public Result<String> autoSaveCTripRecord() {
cTripOrderRecordAutoSave.saveAll();
//将昨天的结算数据生成为财务共享需要的数据
// Command.of(OrderRecordGenerateCommand.class).sendToQueue();
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}

View File

@ -521,7 +521,6 @@ public class OrderQuery {
if (legItems != null && !legItems.isEmpty()) {
//这里使用领域事件进行检查leg的订单状态 用户每次想要查看行程都会进行一次检查
legItems.forEach(leg -> legDomainService.legCheckOrder(leg));
orderDomainService.queryLocation(legItems);
List<LegRes> list = legItems.stream().map(LegRes::copyFrom).toList();
routeOrderRes.setLegResList(list);

View File

@ -164,7 +164,7 @@ public class OrderCarRecord extends OrderBaseRecord {
public OrderCarRecord loadComplianceInfo(OrderDetail orderDetail) {
orderDetail.getETAEvent().ifPresentOrElse(it->{
this.setOverStandard("");
this.setOverStandardReason(overStandardReason);
this.setOverStandardReason(it.getExtension());
},()->{
this.setOverStandard("");
this.setOverStandardReason("");

View File

@ -1,5 +1,6 @@
package com.chint.domain.aggregates.order.order_record;
import com.chint.domain.aggregates.order.OrderDetail;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -75,31 +76,71 @@ public class OrderFlightRecord extends OrderBaseRecord{
private String bookOrgCode3; // 出行人组织架构信息3
private String projectOrderNo; // 项目订单号
private String offlineCcomyCode; // 成本中心
private String orderStatus;
private String createTime;
// 加载基础订单信息
public OrderFlightRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) {
this.setId(id);
public OrderFlightRecord loadBasicOrderInfo(String orderNo,
String orderStatus,
String createTime) {
this.setOrderNo(orderNo);
// this.setOrderStatus(orderStatus);
// this.setCreateTime(createTime);
this.setOrderStatus(orderStatus);
this.setCreateTime(createTime);
return this;
}
// 加载航班信息
public OrderFlightRecord loadFlightInfo(String flightNum, String startAirportName, String endAirportName,
String startCityName, String endCityName, String startTime, String endTime) {
// 加载航班信息 , 航线
public OrderFlightRecord loadFlightInfo(String flightNum,
String flightCompName,
String startAirportName,
String endAirportName,
String startCityName,
String endCityName,
String startTime,
String endTime,
String distance,
String endAirportCode,
String endTerminal) {
this.setDistance(distance);
this.setFlightNum(flightNum);
this.setFlightCompName(flightCompName);
this.setStartAirportName(startAirportName);
this.setEndAirportName(endAirportName);
this.setStartCityName(startCityName);
this.setEndCityName(endCityName);
this.setStartTime(startTime);
this.setEndAirportName(endAirportName);
this.setEndCityName(endCityName);
this.setEndTime(endTime);
this.setEndAirportCode(endAirportCode);
this.setEndTerminal(endTerminal);
return this;
}
// 加载机票信息
public OrderFlightRecord loadTicketInfo(String issueTicketTime,
String facePrice,
String useStatus) {
this.setIssueTicketTime(issueTicketTime);
this.setFacePrice(facePrice);
this.setUseStatus(useStatus);
return this;
}
// 加载座位细节
public OrderFlightRecord loadSeatInfo(String seatPoint,
String seatPointName,
String seatDiscount) {
this.setSeatDiscount(seatDiscount);
this.setSeatPoint(seatPoint);
this.setSeatPointName(seatPointName);
return this;
}
// 加载预订与乘机人信息
public OrderFlightRecord loadBookingAndPassengerInfo(String bookingUserCode, String bookingName, String userName, String userCode) {
public OrderFlightRecord loadBookingAndPassengerInfo(String bookingUserCode,
String bookingName,
String userName,
String userCode) {
this.setBookingUserCode(bookingUserCode);
this.setBookingName(bookingName);
this.setUserName(userName);
@ -108,86 +149,95 @@ public class OrderFlightRecord extends OrderBaseRecord{
}
// 加载财务与价格信息
public OrderFlightRecord loadFinancialAndPricingInfo(String accountCompanyId, String accountCompanyName,
String accountPeriod, String billNo, String orderAmount,
String facePrice, String noTaxAmt, String taxAmt) {
this.setAccountCompanyId(accountCompanyId);
this.setAccountCompanyName(accountCompanyName);
public OrderFlightRecord loadFinancialAndPricingInfo(String accountPeriod,
String billNo,
String orderAmount,
String ycabinFullPrice,
String policyLowestPrice,
String flightLowestPrice) {
this.setAccountPeriod(accountPeriod);
this.setBillNo(billNo);
this.setOrderAmount(orderAmount);
this.setFacePrice(facePrice);
this.setYcabinFullPrice(ycabinFullPrice); //经济舱全价
this.setPolicyLowestPrice(policyLowestPrice); // 比价范围最低价
this.setFlightLowestPrice(flightLowestPrice); // 航班最低价
return this;
}
// 加载税务信息
public OrderFlightRecord loadTaxInfo(String noTaxAmt,
String taxAmt,
String airportTax,
String fuelTax) {
this.setNoTaxAmt(noTaxAmt);
this.setTaxAmt(taxAmt);
return this;
}
// 加载额外费用信息
public OrderFlightRecord loadExtraFeeInfo(String serviceFee, String airportTax, String fuelTax,
String changeFee, String refundFee) {
this.setPreServiceFee(serviceFee);
this.setAirportTax(airportTax);
this.setFuelTax(fuelTax);
return this;
}
// 加载费用信息, 服务费 改签费 退票费 , 升舱费
public OrderFlightRecord loadExtraFeeInfo(String preServiceFee,
String changeFee,
String refundFee,
String upFee,
String postServiceFee) {
this.setPreServiceFee(preServiceFee);
this.setChangeFee(changeFee);
this.setRefundFee(refundFee);
return this;
}
// 加载航班额外细节
public OrderFlightRecord loadFlightExtraDetails(String ycabinFullPrice, String seatDiscount, String policyLowestPrice,
String issueTicketTime, String flightLowestPrice, String useStatus,
String upFee, String postServiceFee, String endAirportCode, String endTerminal) {
this.setYcabinFullPrice(ycabinFullPrice);
this.setSeatDiscount(seatDiscount);
this.setPolicyLowestPrice(policyLowestPrice);
this.setIssueTicketTime(issueTicketTime);
this.setFlightLowestPrice(flightLowestPrice);
this.setUseStatus(useStatus);
this.setUpFee(upFee);
this.setPostServiceFee(postServiceFee);
this.setEndAirportCode(endAirportCode);
this.setEndTerminal(endTerminal);
return this;
}
// 加载组织架构与项目信息
public OrderFlightRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, String bookOrgCode2, String bookOrgCode3,
String projectOrderNo, String offlineCcomyCode) {
public OrderFlightRecord loadOrganizationalAndProjectInfo(String bookOrgCode1,
String bookOrgCode2,
String bookOrgCode3) {
this.setBookOrgCode1(bookOrgCode1);
this.setBookOrgCode2(bookOrgCode2);
this.setBookOrgCode3(bookOrgCode3);
this.setProjectOrderNo(projectOrderNo);
this.setOfflineCcomyCode(offlineCcomyCode);
return this;
}
// 加载来源和系统归属信息
public OrderFlightRecord loadSourceAndSystemInfo(String trvaleSysType, String belongSysType, String orderSource) {
this.setTrvaleSysType(trvaleSysType);
this.setBelongSysType(belongSysType);
public OrderFlightRecord loadSourceInfo(String orderSource) {
this.setOrderSource(orderSource);
return this;
}
// 加载违规信息
public OrderFlightRecord loadComplianceInfo(String overStandard, String overStandardReason) {
this.setOverStandard(overStandard);
this.setOverStandardReason(overStandardReason);
public OrderFlightRecord loadComplianceInfo(OrderDetail orderDetail) {
orderDetail.getETAEvent().ifPresentOrElse(it->{
this.setOverStandard("");
this.setOverStandardReason(it.getExtension());
},()->{
this.setOverStandard("");
this.setOverStandardReason("");
});
return this;
}
// 加载航班细节
public OrderFlightRecord loadFlightDetails(String seatPoint, String seatPointName, String distance, String flightCompName) {
this.setSeatPoint(seatPoint);
this.setSeatPointName(seatPointName);
this.setDistance(distance);
this.setFlightCompName(flightCompName);
return this;
}
// 加载未预订最低价原因
public OrderFlightRecord loadNotLowReason(String notLowReason) {
this.setNotLowReason(notLowReason);
return this;
}
// 加载关联订单信息
public OrderFlightRecord loadRelatedOrderInfo(Long orderDetailId,
String detailId,
String receiptsNum,
String parentOrderNo,
String originalOrderNo) {
this.setOrderDetailId(orderDetailId);
this.setDetailId(detailId);
this.setReceiptsNum(receiptsNum);
this.setParentOrderNo(parentOrderNo);
this.setOriginalOrderNo(originalOrderNo);
return this;
}
}

View File

@ -1,5 +1,6 @@
package com.chint.domain.aggregates.order.order_record;
import com.chint.domain.aggregates.order.OrderDetail;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -72,13 +73,17 @@ public class OrderHotelRecord extends OrderBaseRecord {
private String bookOrgCode3; // 入住人组织架构信息3
private String projectOrderNo; // 项目订单号
private String offlineCcomyCode; // 成本中心
private String payAmount; // 支付总金额
private String orderStatus;
private String createTime;
// 加载基础订单信息
public OrderHotelRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) {
this.setId(id);
public OrderHotelRecord loadBasicOrderInfo(String orderNo,
String orderStatus,
String createTime) {
this.setOrderNo(orderNo);
// this.setOrderStatus(orderStatus);
// this.setCreateTime(createTime);
this.setOrderStatus(orderStatus);
this.setCreateTime(createTime);
return this;
}
@ -112,22 +117,36 @@ public class OrderHotelRecord extends OrderBaseRecord {
}
// 加载财务信息
public OrderHotelRecord loadFinancialInfo(String accountCompanyId, String accountCompanyName, String accountPeriod, String billNo,
String orderAmount, String noTaxAmt, String taxAmt, String companyAmount, String personalAmount) {
this.setAccountCompanyId(accountCompanyId);
this.setAccountCompanyName(accountCompanyName);
public OrderHotelRecord loadFinancialInfo(String accountPeriod,
String billNo,
String orderAmount,
String ticketClerk,
String payAmount
) {
this.setAccountPeriod(accountPeriod);
this.setBillNo(billNo);
this.setOrderAmount(orderAmount);
this.setPayAmount(payAmount);
this.setTicketClerk(ticketClerk);
return this;
}
// 加载税类信息
public OrderHotelRecord loadTaxInfo(String noTaxAmt,
String taxAmt) {
this.setNoTaxAmt(noTaxAmt);
this.setTaxAmt(taxAmt);
this.setCompanyAmount(companyAmount);
this.setPersonalAmount(personalAmount);
return this;
}
// 加载支付和服务费信息
public OrderHotelRecord loadPaymentAndServiceFeeInfo(int paymentType, String unifiedPayAmt, String personalPayAmt) {
public OrderHotelRecord loadPaymentInfo(Integer paymentType,
String unifiedPayAmt,
String personalPayAmt,
String companyAmount,
String personalAmount) {
this.setCompanyAmount(companyAmount);
this.setPersonalAmount(personalAmount);
this.setPaymentType(paymentType);
this.setUnifiedPayAmt(unifiedPayAmt);
this.setPersonalPayAmt(personalPayAmt);
@ -143,37 +162,41 @@ public class OrderHotelRecord extends OrderBaseRecord {
}
// 加载订单来源和系统归属信息
public OrderHotelRecord loadSourceAndSystemInfo(String trvaleSysType, String belongSysType, String orderSource) {
this.setTrvaleSysType(trvaleSysType);
this.setBelongSysType(belongSysType);
public OrderHotelRecord loadSourceInfo(String orderSource) {
this.setOrderSource(orderSource);
return this;
}
// 加载违规信息
public OrderHotelRecord loadComplianceInfo(int overStandard, String overStandardReason) {
this.setOverStandard(overStandard);
this.setOverStandardReason(overStandardReason);
public OrderHotelRecord loadComplianceInfo(OrderDetail orderDetail) {
orderDetail.getETAEvent().ifPresentOrElse(it -> {
this.setOverStandard(1);
this.setOverStandardReason(it.getExtension());
}, () -> {
this.setOverStandard(0);
this.setOverStandardReason("");
});
return this;
}
// 加载组织架构和项目信息
public OrderHotelRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, String bookOrgCode2, String bookOrgCode3,
String projectOrderNo, String offlineCcomyCode) {
public OrderHotelRecord loadOrganizationalAndProjectInfo(String bookOrgCode1,
String bookOrgCode2,
String bookOrgCode3) {
this.setBookOrgCode1(bookOrgCode1);
this.setBookOrgCode2(bookOrgCode2);
this.setBookOrgCode3(bookOrgCode3);
this.setProjectOrderNo(projectOrderNo);
this.setOfflineCcomyCode(offlineCcomyCode);
return this;
}
// 加载订单详情和结算信息
public OrderHotelRecord loadOrderDetailAndSettlementInfo(Long orderDetailId, String detailId, String ticketClerk,
String receiptsNum, String parentOrderNo, String originalOrderNo) {
// 加载订单关联号信息
public OrderHotelRecord loadOrderNoInfo(Long orderDetailId,
String detailId,
String receiptsNum,
String parentOrderNo,
String originalOrderNo) {
this.setOrderDetailId(orderDetailId);
this.setDetailId(detailId);
this.setTicketClerk(ticketClerk);
this.setReceiptsNum(receiptsNum);
this.setParentOrderNo(parentOrderNo);
this.setOriginalOrderNo(originalOrderNo);
@ -181,8 +204,12 @@ public class OrderHotelRecord extends OrderBaseRecord {
}
// 加载房间和早餐信息
public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount, int isAgreement, int roomNightCount,
int nightCount, String roomPrice, String roomRate) {
public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount,
int isAgreement,
int roomNightCount,
int nightCount,
String roomPrice,
String roomRate) {
this.setIncludeAmount(includeAmount);
this.setIsAgreement(isAgreement);
this.setRoomNightCount(roomNightCount);

View File

@ -0,0 +1,73 @@
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;
@Data
@Table("c_trip_flight_base_info")
public class CTripFlightBaseInfo {
@Id
private Long id;
private Long cTripFlightRecordId;
private String Uid;
private String Rank;
private String ConfirmType;
private String ConfirmType2;
private String ConfirmPerson;
private String ConfirmPerson2;
private String ConfirmPersonCC;
private String ConfirmPersonCC2;
private String ConfirmPersonName;
private String ConfirmPersonName2;
private String ConfirmPersonCCName;
private String ConfirmPersonCCName2;
private String CostCenter;
private String CostCenter2;
private String CostCenter3;
private String CostCenter4;
private String CostCenter5;
private String CostCenter6;
private String JourneyReason;
private String Project;
private String DefineFlag;
private String DefineFlag2;
private String EmployeeID;
private String WorkCity;
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 CtripCardNo;
private String Name;
private String FlightClass;
private String IsOnline;
private String NickName;
private String JourneyID;
private String PrintTicketTime;
private String OrderDate;
private String PreEmployeeID;
private long RebookOrderID;
private String RankName;
private String RankNameEn;
private String ConfirmPersonEID;
private String ConfirmPerson2EID;
private String OrderStatus;
private String ProjectCode;
private String PrepayType;
private String ReservationType;
private String PreEmail;
public static CTripFlightBaseInfo of(OrderFlightResponse.FlightOrderBaseInfo flightOrderBaseInfo) {
return BeanUtil.copyProperties(flightOrderBaseInfo, CTripFlightBaseInfo.class);
}
}

View File

@ -20,13 +20,16 @@ public class CTripFlightRecord {
private CTripFlightRecordBase cTripFlightRecordBase;
@MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightInfo cTripFlightInfo;
@MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightBaseInfo cTripOrderBaseInfo;
public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo) {
public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) {
CTripFlightRecord cTripFlightRecord = new CTripFlightRecord();
cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase);
cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo);
cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId()));
cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime()));
cTripFlightRecord.setCTripOrderBaseInfo(cTripOrderBaseInfo);
return cTripFlightRecord;
}
}

View File

@ -13,6 +13,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
@ -44,6 +45,8 @@ public class User implements Serializable {
private String phoneNumber;
private String password;
private LocalDateTime syncTime;
@MappedCollection(idColumn = "user_id", keyColumn = "user_key")
private List<UserDepartmentInfo> userDepartmentInfo;
@Transient
private List<FsscSystem> fsscSystemList;
@Transient
@ -68,6 +71,10 @@ public class User implements Serializable {
this.employeeNo = employeeNo;
}
// public User addDeptInfo(){
//
// }
public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) {
this.userId = userId;
this.employeeNo = employeeNo;

View File

@ -0,0 +1,36 @@
package com.chint.domain.aggregates.user;
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("user_department_info")
public class UserDepartmentInfo implements Serializable {
@Serial
private static final long serialVersionUID = 5602115854952241146L;
@Id
private Long id;
private Long userId;
private Integer userKey;
private String companyCode;
private String companyName;
private String departmentCodeOne;
private String departmentNameOne;
private String departmentCodeTwo;
private String departmentNameTwo;
private String departmentCodeThree;
private String departmentNameThree;
private String departmentCodeFour;
private String departmentNameFour;
private String departmentCodeFive;
private String departmentNameFive;
private String departmentCodeSix;
private String departmentNameSix;
private String departmentCodeSeven;
private String departmentNameSeven;
private Integer ifPrimary;
}

View File

@ -1,10 +1,7 @@
package com.chint.domain.factoriy.order_record;
import com.chint.application.dtos.response.LocationRes;
import com.chint.domain.aggregates.order.CarOrderDetail;
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.*;
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;
@ -20,6 +17,8 @@ import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
@Component
public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFactory {
@ -44,7 +43,10 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
.carRecord();
CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase();
//携程的打车订单可以直接通过订单号获取对应的订单
Optional<OrderDetail> orderDetail = byOrderNo.getOrderDetails().stream().filter(it -> it.getOrderNo().equals(String.valueOf(
Optional<OrderDetail> orderDetail = byOrderNo
.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(String.valueOf(
cTripCarRecordBase.getOrderId()
))).findFirst();
@ -115,7 +117,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
CarOrderDetail carOrderDetail = it.getCarOrderDetail();
orderCarRecord.loadComplianceInfo(it)
.loadRelatedOrderInfo(it.getOrderId(),
carOrderDetail.getDetailId(),
cTripCarRecord.getRecordId(),
carOrderDetail.getReceiptsNum(),
carOrderDetail.getParentOrderNo(),
carOrderDetail.getOriginalOrderNo())
@ -135,8 +137,91 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
@Override
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData;
String routeOrderNo = cTripFlightRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
OrderFlightRecord orderFlightRecord = orderRecordFactory.buildWithRouteOrder(byOrderNo)
.flightRecord();
return null;
CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo();
CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase();
//携程的打车订单可以直接通过订单号获取对应的订单
Optional<OrderDetail> orderDetail = byOrderNo.
getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId()
))).findFirst();
// 加载航班信息 , 航线
orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(),
cTripFlightInfo.getAirLineName(),
cTripFlightInfo.getDPortName(),
cTripFlightInfo.getAPortName(),
cTripFlightInfo.getDCityName(),
cTripFlightInfo.getACityName(),
cTripFlightInfo.getTakeOffTime(),
cTripFlightInfo.getArrivalTime(),
"",
cTripFlightInfo.getACityCode(),
"")
.loadTicketInfo(cTripFlightRecordBase.getCreateTime(),
String.valueOf(cTripFlightRecordBase.getPrice()),
"")
.loadSeatInfo(cTripFlightInfo.getClassName(),
cTripFlightInfo.getClassName(),
String.valueOf(cTripFlightInfo.getPriceRate()));
// 加载财务与价格信息
String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6);
orderFlightRecord.loadFinancialAndPricingInfo(batchNo,
cTripFlightRecordBase.getSubAccCheckBatchNo(),
String.valueOf(cTripFlightRecordBase.getPrice()),
String.valueOf(cTripFlightInfo.getEClassStandardPrice()),
String.valueOf(cTripFlightInfo.getLowPrice()),
String.valueOf(cTripFlightInfo.getLowPrice()));
// 加载税务信息
orderFlightRecord.loadTaxInfo(String.valueOf(cTripFlightRecordBase.getNonDeductibleTax()),
String.valueOf(cTripFlightRecordBase.getDeductibleTax()),
String.valueOf(cTripFlightRecordBase.getTax()),
String.valueOf(cTripFlightRecordBase.getOilFee()));
// 加载费用信息, 服务费 改签费 退票费 , 升舱费
orderFlightRecord.loadExtraFeeInfo(String.valueOf(cTripFlightRecordBase.getPostServiceFee()),
String.valueOf(cTripFlightRecordBase.getRebookQueryFee()),
String.valueOf(cTripFlightRecordBase.getRefund()),
String.valueOf(cTripFlightRecordBase.getAmount()),
String.valueOf(cTripFlightRecordBase.getSettItineraryFee()));
// 加载来源
if (cTripFlightRecord.getRouteOrderNo() == null ||
cTripFlightRecord.getRouteOrderNo().isEmpty() ||
cTripFlightRecord.getRouteOrderNo().isBlank()) {
orderFlightRecord.loadSourceInfo("N");
} else {
orderFlightRecord.loadSourceInfo("Y");
}
// 加载关联票价原因
orderDetail.ifPresent(it -> {
FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail();
orderFlightRecord.loadComplianceInfo(it)
.loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()),
flightOrderDetail.getOrderStatus(),
cTripFlightRecordBase.getCreateTime())
.loadRelatedOrderInfo(it.getOrderId(),
String.valueOf(cTripFlightRecordBase.getRecordId()),
flightOrderDetail.getReceiptsNum(),
flightOrderDetail.getParentOrderNo(),
it.getOrderNo());
});
// 加载未预订最低价原因
orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc());
return orderFlightRecord;
}
@Override
@ -150,6 +235,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
.hotelRecord();
CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo();
CTripHotelRecordBase cTripHotelRecordBase = cTripHotelRecord.getCTripHotelRecordBase();
// 加载酒店和入住信息
orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(),
cTripHotelInfo.getHotelName(),
@ -158,6 +244,21 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
cTripHotelOrderDetail.getRoomQuantity(),
cTripHotelOrderDetail.getRoomName());
// 加载房间和早餐信息 , 含早分数先为空
String isAgreement;
if (cTripHotelRecordBase.getOrderType().equals(4) || cTripHotelRecordBase.getOrderType().equals(6)) {
isAgreement = "1";
} else {
isAgreement = "0";
}
orderHotelRecord.loadRoomAndBreakfastInfo("",
Integer.parseInt(isAgreement),
cTripHotelRecordBase.getQuantity(),
cTripHotelRecordBase.getQuantity(),
String.valueOf(cTripHotelRecordBase.getPrice()),
String.valueOf(cTripHotelRecordBase.getAmount()));
// 加载地理信息位置
Integer cityID = cTripHotelInfo.getCityID();
List<Location> locations = locationRepository.findByCityId(Long.valueOf(cityID));
@ -171,9 +272,73 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
}
// 加载酒店品牌和星级信息
// orderHotelRecord.loadBrandAndStarRateInfo()
orderHotelRecord.loadBrandAndStarRateInfo(cTripHotelInfo.getHotelGroupName(),
cTripHotelInfo.getBrandName(),
String.valueOf(cTripHotelInfo.getStar()));
// 加载订单来源和系统归属信息
String sourceInfo;
if (cTripHotelRecord.getRouteOrderNo() == null) {
sourceInfo = "N";
} else {
sourceInfo = "Y";
}
orderHotelRecord.loadSourceInfo(sourceInfo);
Optional<OrderDetail> orderDetailOptional = byOrderNo.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId())))
.findFirst();
orderDetailOptional.ifPresent(it -> {
orderHotelRecord.loadComplianceInfo(it); // 加载违规信息
HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail();
orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息
cTripHotelRecord.getRecordId(),
hotelOrderDetail.getReceiptsNum(),
hotelOrderDetail.getOrderNo(),
hotelOrderDetail.getOrderNo());
orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息
hotelOrderDetail.getOrderStatus(),
cTripHotelRecordBase.getCreateTime());
});
// 加载财务信息
orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(),
cTripHotelRecordBase.getBatchStartDate().substring(0, 6),
String.valueOf(cTripHotelRecordBase.getAmount()),
"",
cTripHotelRecordBase.getPaidAmount());
return null;
// 加载付款 付款方式公司付款金额, 个人付款金额
String paymentType;
Double personAmount = cTripHotelRecordBase.getPersonAmount();
Double paidAmount = Double.parseDouble(cTripHotelRecordBase.getPaidAmount());
if (personAmount > 0 && personAmount < paidAmount) {
paymentType = "2";
} else if (personAmount.equals(paidAmount)) {
paymentType = "1";
} else {
paymentType = "0";
}
orderHotelRecord.loadPaymentInfo(Integer.parseInt(paymentType),
cTripHotelRecordBase.getBookServiceFee(),
KEEP_TWO_DECIMAL_ZERO,
String.valueOf(paidAmount - personAmount),
String.valueOf(personAmount));
// 加载预订人和入住人信息
orderHotelRecord.loadBookerAndGuestInfo(cTripHotelOrderDetail.getEmployeeID(),
cTripHotelOrderDetail.getEmployeeName(),
cTripHotelOrderDetail.getEmployeeID(),
cTripHotelOrderDetail.getEmployeeName());
// 加载组织架构
orderHotelRecord.loadOrganizationalAndProjectInfo(cTripHotelOrderDetail.getDept1(),
cTripHotelOrderDetail.getDept2(),
cTripHotelOrderDetail.getDept3());
return orderHotelRecord;
}
}

View File

@ -3,7 +3,10 @@ package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import java.util.List;
import java.util.Optional;
public interface OrderCarRecordRepository {
List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList);
Optional<OrderCarRecord> findByDetailId(String detailId);
}

View File

@ -3,9 +3,10 @@ package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import java.util.List;
import java.util.Optional;
public interface OrderFlightRecordRepository {
List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList);
Optional<OrderFlightRecord> findByDetailId(String detailId);
}

View File

@ -3,7 +3,10 @@ package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import java.util.List;
import java.util.Optional;
public interface OrderHotelRecordRepository {
List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList);
Optional<OrderHotelRecord> findByDetailId(String detailId);
}

View File

@ -4,7 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import java.util.List;
import java.util.Optional;
public interface OrderTrainRecordRepository {
List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList);
Optional<OrderTrainRecord> findByDetailId(String detailId);
}

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@ -85,15 +86,32 @@ public class OrderDetailDomainService {
}
public List<OrderCarRecord> saveCarOrderRecordBatch(List<OrderCarRecord> orderCarRecordList) {
//如果发现唯一键已经存在 那么就做更新处理
orderCarRecordList.forEach(needSave-> orderCarRecordRepository
.findByDetailId(needSave.getDetailId())
.ifPresent(it->
needSave.setId(it.getId())));
return orderCarRecordRepository.saveAll(orderCarRecordList);
}
public List<OrderFlightRecord> saveFlightOrderRecordBatch(List<OrderFlightRecord> orderFlightRecordList) {
orderFlightRecordList.forEach(needSave-> orderFlightRecordRepository
.findByDetailId(needSave.getDetailId())
.ifPresent(it->
needSave.setId(it.getId())));
return orderFlightRecordRepository.saveAll(orderFlightRecordList);
}
public List<OrderTrainRecord> saveTrainOrderRecordBatch(List<OrderTrainRecord> orderTrainRecordList) {
orderTrainRecordList.forEach(needSave-> orderTrainRecordRepository
.findByDetailId(needSave.getDetailId())
.ifPresent(it->
needSave.setId(it.getId())));
return orderTrainRecordRepository.saveAll(orderTrainRecordList);
}
public List<OrderHotelRecord> saveHotelOrderRecordBatch(List<OrderHotelRecord> orderHotelRecordList) {
orderHotelRecordList.forEach(needSave-> orderHotelRecordRepository
.findByDetailId(needSave.getDetailId())
.ifPresent(it->
needSave.setId(it.getId())));
return orderHotelRecordRepository.saveAll(orderHotelRecordList);
}

View File

@ -17,30 +17,34 @@ import java.util.List;
@Component
public class CTripOrderRecordDomainService implements OrderRecordDomainService{
@Autowired
private JdbcCtripHotelOrderDetailRepository jdbcCtripHotelOrderDetailRepository;
@Autowired
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
@Autowired
private OrderDetailDomainService orderDetailDomainService;
@Override
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
return null;
}
}

View File

@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Repository
public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
@ -19,4 +20,9 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
orderCarRecordRepository.saveAll(orderCarRecordList).forEach(res::add);
return res;
}
@Override
public Optional<OrderCarRecord> findByDetailId(String detailId) {
return orderCarRecordRepository.findByDetailId(detailId);
}
}

View File

@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Repository
public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordRepository {
@ -22,5 +23,9 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
return res;
}
@Override
public Optional<OrderFlightRecord> findByDetailId(String detailId) {
return jdbcOrderFlightRecordRepository.findByDetailId(detailId);
}
}

View File

@ -10,6 +10,7 @@ import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Repository
public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepository {
@ -22,4 +23,9 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
jdbcOrderHotelRecordRepository.saveAll(orderHotelRecordList).forEach(res::add);
return res;
}
@Override
public Optional<OrderHotelRecord> findByDetailId(String detailId) {
return jdbcOrderHotelRecordRepository.findByDetailId(detailId);
}
}

View File

@ -10,6 +10,7 @@ import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Repository
public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository {
@ -21,4 +22,9 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor
jdbcOrderTrainRecordRepository.saveAll(orderTrainRecordList).forEach(res::add);
return res;
}
@Override
public Optional<OrderTrainRecord> findByDetailId(String detailId) {
return jdbcOrderTrainRecordRepository.findByDetailId(detailId);
}
}

View File

@ -4,6 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRecord,Long> {
Optional<OrderCarRecord> findByDetailId(String detailId);
}

View File

@ -4,6 +4,9 @@ import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFlightRecord,Long> {
Optional<OrderFlightRecord> findByDetailId(String detailId);
}

View File

@ -4,6 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHotelRecord,Long> {
Optional<OrderHotelRecord> findByDetailId(String detailId);
}

View File

@ -4,6 +4,9 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrainRecord,Long> {
Optional<OrderTrainRecord> findByDetailId(String detailId);
}

View File

@ -45,9 +45,9 @@ public class CTripOrderRecordAutoSave {
String.valueOf(orderSettlementBaseInfo.getRecordID()));
if (record == null) {
record = CTripFlightRecord.of(
CTripFlightRecordBase.changeInfo(
orderSettlementBaseInfo
), CTripFlightInfo.of(it.getOrderFlightInfo())
CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo),
CTripFlightInfo.of(it.getOrderFlightInfo()),
CTripFlightBaseInfo.of(it.getOrderBaseInfo())
);
}
//补充额外的字段
@ -72,7 +72,8 @@ public class CTripOrderRecordAutoSave {
String.valueOf(settlementDetail.getRecordId()));
if (record == null) {
record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail),
CTripHotelInfo.of(it.getHotelDetail()),CTripHotelOrderDetail.of(it.getOrderDetail()));
CTripHotelInfo.of(it.getHotelDetail()),
CTripHotelOrderDetail.of(it.getOrderDetail()));
}
//补充额外的字段
OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail();