结算明细字段映射调整,同程同步接口更改。

This commit is contained in:
dengwc 2024-04-08 16:20:03 +08:00
parent a1acf27785
commit 7c9098dca0
3 changed files with 214 additions and 68 deletions

View File

@ -105,7 +105,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//公共字段校验
flightFieldCheck(orderFlightRecord, lyOrderFlightRecord);
orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
// .setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
.setAccountPeriod(getAccountPeriod(lyOrderFlightRecord.getStatementCode()))//账期号
.setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号
.setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号
@ -150,7 +150,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setBookOrgCode1(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息1
.setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2
.setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3
.setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心
// .setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心
.setOrderStatus("") //结算状态
// .setExpenseOrderAmount("") //订单金额
// .setSettleOrderFlag() //订单对账状态
@ -195,7 +195,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//公共字段校验
hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord);
orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
// .setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
.setAccountPeriod(getAccountPeriod(lyOrderHotelRecord.getStatementCode())) //账期号
.setBillNo(lyOrderHotelRecord.getBillOrderNo()) //账单号结算单号
.setOrderNo(lyOrderHotelRecord.getOrderSerialNo()) //订单号
@ -232,13 +232,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setTaxAmt("") //税费
.setInvoiceType(readInvoiceType(lyOrderHotelRecord.getCustomerInvoiceType())) //供应商发票类型
.setInvoiceFee("") //开票手续费
.setCustodayFee("") //托管费
.setCustodayFee(String.valueOf(lyOrderHotelRecord.getServiceAmount()))//托管费
.setNoTaxCusFee("") //托管费不含税
.setTaxCusFee("") //托管费税费
.setRoomTypeName(lyOrderHotelRecord.getBedType()) //房型
.setOrderSource(StringUtils.isNotBlank(lyOrderHotelRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源线上/线下
.setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //入住人组织架构信息1
.setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心
// .setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心
.setOrderStatus("") //结算状态
// .setExpenseOrderAmount("") //订单金额
// .setSettleOrderFlag() //订单对账状态
@ -259,7 +259,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//酒店订单明细字段赋值
private void setHotelRecordDetail(OrderHotelRecord orderHotelRecord, HotelOrderDetail hotelOrderDetail) {
orderHotelRecord.setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址
.setIsAgreement("".equals(hotelOrderDetail.getAgreementHotel()) ? "1" : "0") //是否协议酒店0否1是
.setIsAgreement(hotelOrderDetail.getAgreementHotel()) //是否协议酒店0否1是
.setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数
.setStarRate(hotelOrderDetail.getStarRate()) //星级
.setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2
@ -280,7 +280,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//公共字段校验
trainFieldCheck(orderTrainRecord, lyOrderTrainRecord);
orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
// .setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
.setAccountPeriod(getAccountPeriod(lyOrderTrainRecord.getStatementCode())) //账期号
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
@ -303,18 +303,16 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setReturnFee(String.valueOf(lyOrderTrainRecord.getRefundFee())) //退票手续费
.setNoTaxAmt("") //未税金额
.setTaxAmt("") //税额
.setOrderAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())) //结算总额
.setFromCity(lyOrderTrainRecord.getTripName()) //出发城市
.setFromStationName(lyOrderTrainRecord.getTripName()) //出发站
.setToCity(lyOrderTrainRecord.getTripName()) //到达城市
.setToStationName(lyOrderTrainRecord.getTripName()) //到达站
.setIssueTicketTime(lyOrderTrainRecord.getEnterAccount()) //出票时间 yyyy-MM-dd HH:mm:ss
.setOrderAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())); //结算总额
//设置出发地和到达地
roadTripName(orderTrainRecord, lyOrderTrainRecord.getTripName());
orderTrainRecord.setIssueTicketTime(lyOrderTrainRecord.getEnterAccount()) //出票时间 yyyy-MM-dd HH:mm:ss
.setTrainNo(lyOrderTrainRecord.getTrainNo()) //车次
.setUserCode(lyOrderTrainRecord.getPassengerNo())//出行人编码
.setUserName(lyOrderTrainRecord.getPassengerName())//出行人姓名
.setOrderSource(StringUtils.isNotBlank(lyOrderTrainRecord.getOutApplayOrderNo()) ? "Y" : "N")//预订来源线上 / 线下
.setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1
.setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心
// .setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心
// .setOrderStatus() //结算状态
// .setExpenseOrderAmount() //订单金额
// .setSettleOrderFlag() //订单对账状态
@ -346,10 +344,26 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
orderTrainRecord.setParentOrderNo(trainOrderDetail.getParentOrderNo())//父级订单号
.setRunTime(trainOrderDetail.getRunTime()) //时长
.setSeatType(trainOrderDetail.getSeatType())// 座位等级
.setFromCity(trainOrderDetail.getFromCity()) //出发城市
.setToCity(trainOrderDetail.getToCity()) //到达城市
.setFromStationName(Optional.ofNullable(orderTrainRecord.getFromStationName())
.orElse(trainOrderDetail.getFromStationName())) // 出发站
.setToStationName(Optional.ofNullable(orderTrainRecord.getToStationName())
.orElse(trainOrderDetail.getToStationName())) // 到达站
.setSeatType(trainOrderDetail.getSeatType())// 座位等级
.setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2
.setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3());//出行人组织架构信息3
}
//设置出发 到达站
private void roadTripName(OrderTrainRecord orderTrainRecord, String tripName) {
String[] tripNames = tripName.split("-");
if (tripNames.length == 2) {
orderTrainRecord.setFromStationName(tripNames[0])// 出发站
.setToStationName(tripNames[1]);// 到达站
}
}
private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
String orderSerialNo = lyOrderCarRecord.getOrderSerialNo();//订单号
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
@ -363,7 +377,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//公共字段校验
carFieldCheck(orderCarRecord, lyOrderCarRecord);
orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
// .setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
.setAccountPeriod(getAccountPeriod(lyOrderCarRecord.getStatementCode())) //账期号
.setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号
orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
@ -391,7 +405,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setComyPayAmt(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //公司统付金额
.setBookOrgCode1(lyOrderCarRecord.getPassengerDepartment()) //用车人组织架构信息1
.setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0公司统付 1个人付 2混付"
.setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心
// .setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心
.setOrderSource(StringUtils.isNotBlank(lyOrderCarRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源线上/线下
// .setExpenseOrderAmount() //订单金额
// .setSettleOrderFlag() //订单对账状态
@ -485,7 +499,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
if (StringUtils.isBlank(orderFlightRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderFlightRecord::setProjectOrderNo);//项目订单号
}
//成本中心
findCostCenter(tripSubmitItemList).ifPresent(orderFlightRecord::setOfflineCcomyCode);
}
public void hotelFieldCheck(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) {
@ -508,7 +523,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
if (StringUtils.isBlank(orderHotelRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderHotelRecord::setProjectOrderNo);//项目订单号
}
//成本中心
findCostCenter(tripSubmitItemList).ifPresent(orderHotelRecord::setOfflineCcomyCode);
}
public void trainFieldCheck(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
@ -531,7 +547,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
if (StringUtils.isBlank(orderTrainRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderTrainRecord::setProjectOrderNo);//项目订单号
}
//成本中心
findCostCenter(tripSubmitItemList).ifPresent(orderTrainRecord::setOfflineCcomyCode);
}
public void carFieldCheck(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
@ -554,7 +571,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
if (StringUtils.isBlank(orderCarRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderCarRecord::setProjectOrderNo);//项目订单号
}
//成本中心
findCostCenter(tripSubmitItemList).ifPresent(orderCarRecord::setOfflineCcomyCode);
}
//对应所属系统
@ -599,6 +617,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.map(TripSubmitItemList::getContent);
}
//成本中心
public Optional<String> findCostCenter(List<TripSubmitItemList> tripSubmitItemList) {
return tripSubmitItemList.stream()
.filter(item -> LY_CUSTOM5.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent);
}
//获取财务共享单号
private String getReceiptsNum(String outApplayOrderNo, RouteOrder routeOrder) {

View File

@ -53,7 +53,10 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
@Override
public boolean syncRouteRequest(RouteRequest routeRequest) {
return false;
log.info("开始同步同程订单");
Boolean flag = synchronizationNew(routeRequest, "1");
log.info("flag = " + flag);
return flag;
}
@Override
@ -68,54 +71,116 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
@Override
public boolean cancelRouteRequest(RouteRequest routeRequest) {
return false;
log.info("开始同步同程订单");
Boolean flag = synchronizationNew(routeRequest, "2");
log.info("flag = " + flag);
return flag;
}
//同步同程订单
private Boolean synchronization(RouteOrder order, String tag) {
String supplierOrderSyncUrl = lyBaseUrl + L_Y_ORDER_PATH;//请求地址
//1.设置订单参数
SupplierOrderParam param = new SupplierOrderParam();//参数
//成本中心
this.setCostCenter(param, order);
param.setOutEmployeeIdType(0);//外部员工ID类型默认为0
// param.setOutTravelApplyNo(order.getApproveOrderNo().getActualOrderNo());//审批订单号
param.setOutTravelApplyNo(order.getRouteOrderNo());//审批订单号
param.setTravelApplyType(1); //差旅类型1 普通差旅,2 福利差旅
param.setStatus(Integer.valueOf(tag));//状态1通过2作废
//日期格式化
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String applyTime = order.getCreateTime().format(formatter);
String updateTime = order.getUpdateTime().format(formatter);
param.setTravelApplyTime(applyTime);//开始创建时间
param.setTravelUpdateTime(updateTime);//最后更新时间
param.setOperationType(1);//1新增2更新
//设置订单基本数据
loadBaseData(param, order.getRouteOrderNo(), tag);
//设置时间
loadTime(param, order.getCreateTime(), order.getUpdateTime());
//获取用户信息
// User user = "1".equals(tag) ? BaseContext.getCurrentUser() : userRepository.findByUserEmployeeNo(order.getUserId());
// param.setOutEmployeeId(String.valueOf("1".equals(tag) ? user.getEmployeeNo() : order.getUserId()));//用户id
User user = userRepository.findByUserEmployeeNo(order.getUserId());
param.setOutEmployeeId(order.getUserId());//用户id
param.setTravelDescription("同程订单");//描述信息
param.setBookableProducts(getLegType(order));//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
//设置用户信息和预定类型
loadUserAndProducts(param, order);
//2.同程的行程节点集合
List<AOSItem> aosItems = getAosItems(order);
//3.差旅人信息
List<AOSPerson> aosPeople = readAosPeople(user, order.getUserId());
//4.前置差旅政策
List<AOSPreTravelPolicy> aosPreTravelPolicies = readAOSPreTravelPolicy(order.getStandardLevel());
return sendRequest(param, aosItems, aosPeople, aosPreTravelPolicies);
}
//新同步同程订单
private Boolean synchronizationNew(RouteRequest routeRequest, String tag) {
//1.设置订单参数
SupplierOrderParam param = new SupplierOrderParam();//参数
this.readCostCenter(param, routeRequest);
//设置订单基本数据
loadBaseData(param, routeRequest.getRouteRequestNo(), tag);
//设置时间
loadTime(param, routeRequest.getCreateTime(), routeRequest.getUpdateTime());
//获取用户信息
User user = userRepository.findByUserEmployeeNo(routeRequest.getRouteRequestFields().getUserId());
loadNewUserAndProducts(param, routeRequest);
//2.同程的行程节点集合
List<AOSItem> aosItems = roadAosItems(routeRequest);
//3.差旅人信息
List<AOSPerson> aosPeople = readAosPeople(user, routeRequest.getRouteRequestFields().getUserId());
//4.前置差旅政策
List<AOSPreTravelPolicy> aosPreTravelPolicies = readAOSPreTravelPolicy(routeRequest.getRouteRequestFields().getStandardLevel());
return sendRequest(param, aosItems, aosPeople, aosPreTravelPolicies);
}
//基本数据
private void loadBaseData(SupplierOrderParam param, String orderNo, String tag) {
param.setOutEmployeeIdType(0);//外部员工ID类型默认为0
param.setOutTravelApplyNo(orderNo);//审批订单号
param.setTravelApplyType(1); //差旅类型1 普通差旅,2 福利差旅
param.setStatus(Integer.valueOf(tag));//状态1通过2作废
}
//设置时间
private void loadTime(SupplierOrderParam param, LocalDateTime createTime, LocalDateTime updateTime) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String applyTime = createTime.format(formatter);
String editTime = updateTime.format(formatter);
param.setTravelApplyTime(applyTime);//开始创建时间
param.setTravelUpdateTime(editTime);//最后更新时间
param.setOperationType(1);//1新增2更新
}
//用户和预定类型
private void loadUserAndProducts(SupplierOrderParam param, RouteOrder order) {
param.setOutEmployeeId(order.getUserId());//用户id
param.setTravelDescription("同程订单");//描述信息
param.setBookableProducts(getLegType(order));//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
}
//新对象用户和预定类型
private void loadNewUserAndProducts(SupplierOrderParam param, RouteRequest routeRequest) {
param.setOutEmployeeId(routeRequest.getRouteRequestFields().getUserId());//用户id
param.setTravelDescription("同程订单");//描述信息
param.setBookableProducts(roadLegType(routeRequest));//1:国内机票,2:国际机票,3:国内酒店,4:海外酒店,5:火车票,6:用车
}
//差旅人信息
private List<AOSPerson> readAosPeople(User user, String userId) {
List<AOSPerson> aosPeople = new ArrayList<>();
AOSPerson aosPerson = new AOSPerson();
aosPerson.setName(user.getName());//用户名
aosPerson.setRelation(0);//0:内部员工1:配偶2:子女3:父母4:面试候选人5:实习生6:外部宾客
aosPerson.setPassengerType(0);//0:成人, 1:儿童, 2:婴儿
// aosPerson.setOutEmployeeId(String.valueOf("1".equals(tag) ? user.getEmployeeNo() : order.getUserId()));//SF号(长工号)
aosPerson.setOutEmployeeId(order.getUserId());//SF号(长工号)
aosPerson.setOutEmployeeId(userId);//SF号(长工号)
aosPeople.add(aosPerson);
//4.前置差旅政策
return aosPeople;
}
//前置差旅政策
private List<AOSPreTravelPolicy> readAOSPreTravelPolicy(String standardLevel) {
List<AOSPreTravelPolicy> aosPreTravelPolicies = new ArrayList<>();
for (int i = 1; i < 7; i++) {
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
aosPreTravelPolicy.setPolicyCode(order.getStandardLevel());//一般指客户经理提供的差旅政策标题
aosPreTravelPolicy.setPolicyCode(standardLevel);//一般指客户经理提供的差旅政策标题
aosPreTravelPolicy.setProductTypeId(i);//产品ID 1国内机票2国际机票3国内酒店4海外酒店5火车票6用车
aosPreTravelPolicies.add(aosPreTravelPolicy);
}
return aosPreTravelPolicies;
}
//发送请求
private Boolean sendRequest(SupplierOrderParam param, List<AOSItem> aosItems, List<AOSPerson> aosPeople, List<AOSPreTravelPolicy> aosPreTravelPolicies) {
String supplierOrderSyncUrl = lyBaseUrl + L_Y_ORDER_PATH;//请求地址
param.setItemList(aosItems); // 同程节点内容
param.setPersonList(aosPeople);// 同程信息实际出行人
param.setPreTravelPolicyList(aosPreTravelPolicies);// 同程政策
@ -140,12 +205,6 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
//同程Leg集合解析
private List<AOSItem> getAosItems(RouteOrder order) {
List<AOSItem> aosItems = new ArrayList<>();
AOSItem aosItem = new AOSItem();
LocalDateTime startDate = LocalDateTime.MAX;
LocalDateTime endDate = LocalDateTime.MIN;
StringBuilder departCityStr = new StringBuilder();
StringBuilder arriveCityStr = new StringBuilder();
//提取所有行程节点信息
List<Leg> legItems = order.getLegItems().stream().filter(
leg -> (leg.getLegType().equals(LEG_TYPE_TRAIN) ||
@ -153,6 +212,82 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
leg.getLegType().equals(LEG_TYPE_HOTEL) ||
leg.getLegType().equals(LEG_TYPE_TAXI)))
.toList();
return readAosItems(legItems);
}
//获取行程节点类型
public String getLegType(RouteOrder order) {
return order.getLegItems()
.stream()
.map(Leg::getLegType)
.distinct()
.map(legType -> switch (legType) {
case LEG_TYPE_TRAIN -> 5;
case LEG_TYPE_AIRPLANE -> 1;
case LEG_TYPE_HOTEL -> 3;
case LEG_TYPE_TAXI -> 6;
default -> legType;
})
.map(Object::toString)
.collect(Collectors.joining(","));
}
//新对象成本中心
private SupplierOrderParam readCostCenter(SupplierOrderParam param, RouteRequest routeRequest) {
RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields();
param.addCostCenter(routeRequestFields.getSysCode())
.addCostCenter(routeRequestFields.getAccountCompanyCode())
.addCostCenter(routeRequestFields.getAccountCompanyName())
.addCostCenter(routeRequestFields.getProjectName());
return param;
}
//新对象获取行程节点类型
public String roadLegType(RouteRequest routeRequest) {
return routeRequest.getRouteRequestLegList()
.stream()
.map(routeRequestLeg -> Optional.ofNullable(routeRequestLeg.getLeg())
.map(Leg::getLegType)
.orElse(-1))
.distinct()
.map(legType -> switch (legType) {
case LEG_TYPE_TRAIN -> 5;
case LEG_TYPE_AIRPLANE -> 1;
case LEG_TYPE_HOTEL -> 3;
case LEG_TYPE_TAXI -> 6;
default -> legType;
})
.map(Object::toString)
.collect(Collectors.joining(","));
}
//新对象同程Leg集合解析
private List<AOSItem> roadAosItems(RouteRequest routeRequest) {
//提取所有行程节点信息
List<Leg> legItems = routeRequest.getRouteRequestLegList().stream()
.map(routeRequestLeg -> Optional.ofNullable(routeRequestLeg.getLeg())
.filter(
leg -> (leg.getLegType().equals(LEG_TYPE_TRAIN) ||
leg.getLegType().equals(LEG_TYPE_AIRPLANE) ||
leg.getLegType().equals(LEG_TYPE_HOTEL) ||
leg.getLegType().equals(LEG_TYPE_TAXI)))
.orElse(null)).filter(Objects::nonNull)
.toList(); // 转换为 List
return readAosItems(legItems);
}
//新对象同程Leg集合解析
private List<AOSItem> readAosItems(List<Leg> legItems) {
List<AOSItem> aosItems = new ArrayList<>();
AOSItem aosItem = new AOSItem();
LocalDateTime startDate = LocalDateTime.MAX;
LocalDateTime endDate = LocalDateTime.MIN;
StringBuilder departCityStr = new StringBuilder();
StringBuilder arriveCityStr = new StringBuilder();
orderDomainService.queryLocation(legItems);
for (Leg leg : legItems) {
//开始时间
@ -208,24 +343,6 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
return aosItems;
}
//获取行程节点类型
public String getLegType(RouteOrder order) {
return order.getLegItems()
.stream()
.map(Leg::getLegType)
.distinct()
.map(legType -> switch (legType) {
case LEG_TYPE_TRAIN -> 5;
case LEG_TYPE_AIRPLANE -> 1;
case LEG_TYPE_HOTEL -> 3;
case LEG_TYPE_TAXI -> 6;
default -> legType;
})
.map(Object::toString)
.collect(Collectors.joining(","));
}
public Location getCityLocation(Location location) {
if (location.getLocationType().equals(LOCATION_TYPE_CITY)) {
return location;
@ -245,6 +362,7 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
}
}
//去重
public String removeDuplicates(StringBuilder stringBuilder) {
String cityStr = String.valueOf(stringBuilder);

View File

@ -11,4 +11,7 @@ public class OrderRecordConstant {
//项目订单号
public static final String LY_CUSTOM4 = "Custom4";
//成本中心
public static final String LY_CUSTOM5 = "CostCenter";
}