结算明细字段映射调整
This commit is contained in:
parent
3d1435751f
commit
94c52aabce
|
@ -0,0 +1,32 @@
|
|||
package com.chint.domain.aggregates.order.order_record.ly_order_record;
|
||||
|
||||
import com.chint.domain.aggregates.order.CarOrderDetail;
|
||||
import com.chint.domain.aggregates.order.FlightOrderDetail;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("ly_order_detail_car_record")
|
||||
public class LyOrderDetailCarRecord implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1477918306209404564L;
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
private String orderNo;//订单号
|
||||
|
||||
private String parentOrderNo;//父级订单号
|
||||
private String arriveTime; //"到达时间格式:2023-04-26 13:15:17"
|
||||
private String carModel; //车型
|
||||
private String toCity;//到达城市
|
||||
private String runTime; //运行时长
|
||||
private String mileage; //里程数
|
||||
private String personalPaymentAmount; //个人支付金额
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.chint.domain.aggregates.order.order_record.ly_order_record;
|
||||
|
||||
import com.chint.interfaces.rest.ly.dto.user.CostCenter;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("ly_order_detail_flight_record")
|
||||
public class LyOrderDetailFlightRecord implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1477918306209404564L;
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
private String orderNo;//订单号
|
||||
private String parentOrderNo;//父级订单号
|
||||
private String startAirportName;//起飞机场名称
|
||||
private String startCityCode;//起飞城市编码
|
||||
private String startCityName;//起飞城市名称
|
||||
private String endAirportCode;//到达机场三字码
|
||||
private String endAirportName;//到达机场名称
|
||||
private String endCityCode;//到达城市编码
|
||||
private String endCityName;//到达城市名称
|
||||
private String endTerminal;//到达航站楼
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.chint.domain.aggregates.order.order_record.ly_order_record;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("ly_order_detail_hotel_record")
|
||||
public class LyOrderDetailHotelRecord implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1477918306209404564L;
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
private String orderNo;//订单号
|
||||
private String hotelAddress;//酒店地址
|
||||
private String agreementHotel;//是否协议酒店:0否1是
|
||||
private String personalAmount;//个人支付金额
|
||||
private String roomCount;//房间数
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.chint.domain.aggregates.order.order_record.ly_order_record;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("ly_order_detail_train_record")
|
||||
public class LyOrderDetailTrainRecord implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1477918306209404564L;
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
private String orderNo;//订单号
|
||||
|
||||
private String parentOrderNo;//父级订单号
|
||||
private String runTime; //时长
|
||||
private String seatType;// 座位等级
|
||||
private String fromCity; //出发城市
|
||||
private String toCity; //到达城市
|
||||
private String fromStationName;// 出发站
|
||||
private String toStationName;// 到达站
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package com.chint.domain.aggregates.user;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
|
@ -11,6 +13,8 @@ import java.util.Objects;
|
|||
|
||||
@Data
|
||||
@Table("user_department_info")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserDepartmentInfo implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5602115854952241146L;
|
||||
|
|
|
@ -0,0 +1,190 @@
|
|||
package com.chint.domain.factoriy.order_record;
|
||||
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailCarRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailHotelRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailTrainRecord;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderDetailCarRecord;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderDetailFlightRecord;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderDetailHotelRecord;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderDetailTrainRecord;
|
||||
import com.chint.interfaces.rest.ly.LYSearchRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||
|
||||
@Service
|
||||
public class LYOrderDetailRecordFactory {
|
||||
|
||||
@Autowired
|
||||
private LYSearchRequest lySearchRequest;
|
||||
|
||||
@Autowired
|
||||
private JdbcLyOrderDetailFlightRecord jdbcLyOrderDetailFlightRecord;
|
||||
@Autowired
|
||||
private JdbcLyOrderDetailHotelRecord jdbcLyOrderDetailHotelRecord;
|
||||
@Autowired
|
||||
private JdbcLyOrderDetailTrainRecord jdbcLyOrderDetailTrainRecord;
|
||||
@Autowired
|
||||
private JdbcLyOrderDetailCarRecord jdbcLyOrderDetailCarRecord;
|
||||
|
||||
//飞机订单明细
|
||||
@Transactional
|
||||
public LyOrderDetailFlightRecord queryFlightDetail(String orderNo) {
|
||||
LyOrderDetailFlightRecord orderDetail = jdbcLyOrderDetailFlightRecord.findByOrderNo(orderNo);
|
||||
if (orderDetail != null) {
|
||||
return orderDetail;
|
||||
}
|
||||
LyOrderDetailFlightRecord lyOrderDetailFlightRecord = new LyOrderDetailFlightRecord();//创建对象
|
||||
//订单明细数据
|
||||
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
|
||||
FlightOrderResponse.Data data = flightOrderDetail.getData();
|
||||
if (data == null) {
|
||||
return new LyOrderDetailFlightRecord();
|
||||
}
|
||||
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
|
||||
lyOrderDetailFlightRecord.setOrderNo(orderNo)//订单号
|
||||
.setParentOrderNo(orderDetails.getParentOrderSerialNo());//父级订单号
|
||||
List<FlightOrderResponse.FlightSegment> flightSegmentList = data.getFlightSegmentList();
|
||||
if (flightSegmentList != null && !flightSegmentList.isEmpty()) {
|
||||
FlightOrderResponse.FlightSegment flightSegment = flightSegmentList.get(0);
|
||||
lyOrderDetailFlightRecord.setStartAirportName(flightSegment.getDepartAirport())//起飞机场名称
|
||||
.setStartCityName(flightSegment.getDepartCity())//起飞城市名称
|
||||
.setEndAirportCode(flightSegment.getArriveAirportCode())//到达机场三字码
|
||||
.setEndAirportName(flightSegment.getArriveAirport())//到达机场名称
|
||||
.setEndCityName(flightSegment.getArriveCity())//到达城市名称
|
||||
.setEndTerminal(flightSegment.getArriveTerminal());//到达航站楼
|
||||
}
|
||||
lyOrderDetailFlightRecord.setStartCityCode("")//起飞城市编码
|
||||
.setEndCityCode("");//到达城市编码
|
||||
jdbcLyOrderDetailFlightRecord.save(lyOrderDetailFlightRecord);
|
||||
return lyOrderDetailFlightRecord;
|
||||
}
|
||||
|
||||
//酒店订单明细
|
||||
@Transactional
|
||||
public LyOrderDetailHotelRecord queryHotelDetail(String orderNo) {
|
||||
LyOrderDetailHotelRecord orderDetail = jdbcLyOrderDetailHotelRecord.findByOrderNo(orderNo);
|
||||
if (orderDetail != null) {
|
||||
return orderDetail;
|
||||
}
|
||||
LyOrderDetailHotelRecord lyOrderDetailHotelRecord = new LyOrderDetailHotelRecord();
|
||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderNo);
|
||||
HotelDetailResponse.Data data = hotelOrderDetail.getData();
|
||||
if (data == null) {
|
||||
return new LyOrderDetailHotelRecord();
|
||||
}
|
||||
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
||||
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
|
||||
lyOrderDetailHotelRecord.setOrderNo(orderNo);//订单号
|
||||
if (hotelInfo != null && orderInfo != null) {
|
||||
lyOrderDetailHotelRecord.setHotelAddress(hotelInfo.getHotelAddress())//酒店地址
|
||||
.setAgreementHotel(orderInfo.getProtocolType() == 0 ? "否" : "是")//是否协议酒店:0否1是
|
||||
.setPersonalAmount(orderInfo.getPaymentType() == 1 ? KEEP_TWO_DECIMAL_ZERO : String.valueOf(orderInfo.getPersonalPrice()))//个人支付金额
|
||||
.setRoomCount(String.valueOf(hotelInfo.getRoomNum()));//房间数
|
||||
}
|
||||
jdbcLyOrderDetailHotelRecord.save(lyOrderDetailHotelRecord);
|
||||
return lyOrderDetailHotelRecord;
|
||||
}
|
||||
|
||||
//火车订单明细
|
||||
@Transactional
|
||||
public LyOrderDetailTrainRecord queryTrainDetail(String orderNo) {
|
||||
LyOrderDetailTrainRecord orderDetail = jdbcLyOrderDetailTrainRecord.findByOrderNo(orderNo);
|
||||
if (orderDetail != null) {
|
||||
return orderDetail;
|
||||
}
|
||||
LyOrderDetailTrainRecord lyOrderDetailTrainRecord = new LyOrderDetailTrainRecord();
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo);
|
||||
TrainDetailResponse.TrainDetailData trainDetailData = trainOrderDetail.getData();
|
||||
if (trainDetailData == null) {
|
||||
return new LyOrderDetailTrainRecord();
|
||||
}
|
||||
List<TrainDetailResponse.Item> detailDataItems = trainDetailData.getItems();
|
||||
lyOrderDetailTrainRecord.setOrderNo(orderNo)//订单号
|
||||
.setParentOrderNo(trainDetailData.getParentOrderSerialNo())//父级订单号
|
||||
.setRunTime(getRunTime(trainDetailData.getPlanBeginDate(), trainDetailData.getPlanEndDate())) //时长
|
||||
.setFromCity(trainDetailData.getDepartCity()) //出发城市
|
||||
.setToCity(trainDetailData.getArriveCity()) //到达城市
|
||||
.setFromStationName(trainDetailData.getFromStation())// 出发站
|
||||
.setToStationName(trainDetailData.getToStation());// 到达站
|
||||
|
||||
if (detailDataItems != null && !detailDataItems.isEmpty()) {
|
||||
TrainDetailResponse.Item item = detailDataItems.get(0);
|
||||
lyOrderDetailTrainRecord.setSeatType(translateEnSeatToCnSeat(item.getSeatClass()));//座位等级
|
||||
}
|
||||
jdbcLyOrderDetailTrainRecord.save(lyOrderDetailTrainRecord);
|
||||
return lyOrderDetailTrainRecord;
|
||||
}
|
||||
|
||||
//用车订单明细
|
||||
@Transactional
|
||||
public LyOrderDetailCarRecord queryCarDetail(String orderNo) {
|
||||
LyOrderDetailCarRecord orderDetail = jdbcLyOrderDetailCarRecord.findByOrderNo(orderNo);
|
||||
if (orderDetail != null) {
|
||||
return orderDetail;
|
||||
}
|
||||
LyOrderDetailCarRecord lyOrderDetailCarRecord = new LyOrderDetailCarRecord();
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo);
|
||||
CarDetailResponse.DataWrapper data = carDetailResponse.getData();
|
||||
if (data == null) {
|
||||
return new LyOrderDetailCarRecord();
|
||||
}
|
||||
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
|
||||
CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo();
|
||||
lyOrderDetailCarRecord.setOrderNo(orderNo)//订单号
|
||||
.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice())); //个人支付金额
|
||||
if (orderExtendInfo != null) {
|
||||
lyOrderDetailCarRecord.setParentOrderNo("")//父级订单号
|
||||
.setArriveTime(orderExtendInfo.getFinishTime())//"到达时间格式:2023-04-26 13:15:17"
|
||||
.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName())) //车型
|
||||
.setToCity(orderExtendInfo.getEndCityName())//到达城市
|
||||
.setRunTime(orderExtendInfo.getDuration().replaceAll("[^\\u0000-\\u007F\\p{P}]", "")) //运行时长
|
||||
.setMileage(orderExtendInfo.getMileage().replaceAll("[^\\u0000-\\u007F\\p{P}]", "")); //里程数
|
||||
}
|
||||
jdbcLyOrderDetailCarRecord.save(lyOrderDetailCarRecord);
|
||||
return lyOrderDetailCarRecord;
|
||||
}
|
||||
|
||||
private String translateEnSeatToCnSeat(String seatEnName) {
|
||||
return switch (seatEnName) {
|
||||
case "secondseat" -> "二等座";
|
||||
case "businessseat" -> "商务座";
|
||||
case "hardseat" -> "二等座";
|
||||
case "softsleeperup" -> "软卧上铺";
|
||||
case "hardsleeperup" -> "硬卧上铺";
|
||||
case "firstseat" -> "一等座";
|
||||
case "softsleeperdown" -> "软卧下铺";
|
||||
case "hardsleeperdown" -> "硬卧下铺";
|
||||
case "softsleepermid" -> "软卧中铺";
|
||||
case "hardsleepermid" -> "硬卧中铺";
|
||||
default -> "未知类型座位";
|
||||
};
|
||||
}
|
||||
|
||||
//获取时长
|
||||
public String getRunTime(String startTimeDate, String endTimeDate) {
|
||||
// 解析时间字符串
|
||||
LocalDateTime startTime = LocalDateTime.parse(startTimeDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime endTime = LocalDateTime.parse(endTimeDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// 计算时间差
|
||||
Duration duration = Duration.between(startTime, endTime);
|
||||
// 将时间差转换为时长
|
||||
long hours = duration.toHours();
|
||||
long minutes = duration.toMinutesPart();
|
||||
// 格式化时长
|
||||
return String.format("%02d:%02d", hours, minutes);
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
|
|||
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.aggregates.user.UserDepartmentInfo;
|
||||
import com.chint.infrastructure.repository.jdbc.*;
|
||||
import com.chint.infrastructure.util.BeanCopyUtils;
|
||||
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
||||
|
@ -54,6 +55,12 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Autowired
|
||||
private LYOrderDetailRecordFactory lyOrderDetailRecordFactory;
|
||||
|
||||
@Autowired
|
||||
private JdbcUserRepository jdbcUserRepository;
|
||||
|
||||
@Override
|
||||
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
|
||||
OrderFlightRecord orderFlightRecord = new OrderFlightRecord();
|
||||
|
@ -100,7 +107,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
BeanUtils.copyProperties(orderRecordBasic, orderFlightRecord);
|
||||
OrderDetail orderDetail = orderDetailRef.get();//获取订单明细
|
||||
RouteOrder routeOrder = routeOrderRef.get();//获取财务共享订单
|
||||
FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail() == null ? new FlightOrderDetail() : orderDetail.getFlightOrderDetail();//机票订单明细
|
||||
orderFlightRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());
|
||||
//公共字段校验
|
||||
flightFieldCheck(orderFlightRecord, lyOrderFlightRecord);
|
||||
|
@ -147,15 +153,22 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setUseStatus(lyOrderFlightRecord.getTicketStatus())//机票使用情况
|
||||
.setOrderSource(StringUtils.isNotBlank(lyOrderFlightRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下
|
||||
.setNotLowReason("正泰机票无超标") //未预订最低价原因
|
||||
.setBookOrgCode1(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息1
|
||||
.setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3
|
||||
// .setExpenseOrderAmount("") //订单金额
|
||||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount()))//支付金额
|
||||
;
|
||||
.setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount()));//支付金额
|
||||
//成本中心
|
||||
if (StringUtils.isBlank(orderFlightRecord.getOfflineCcomyCode()) && !Objects.isNull(routeOrder.getApproveOrderNo())) {
|
||||
orderFlightRecord.setOfflineCcomyCode(routeOrder.getApproveOrderNo().getCostCenter());
|
||||
}
|
||||
//订单明细字段赋值
|
||||
setFlightRecordDetail(orderFlightRecord, flightOrderDetail);
|
||||
setFlightRecordDetail(orderFlightRecord, orderDetail.getFlightOrderDetail(), orderSerialNo);
|
||||
|
||||
//结算状态
|
||||
if (StringUtils.isBlank(orderFlightRecord.getOrderStatus())) {
|
||||
orderFlightRecord.setOrderStatus(readOrderStatus(lyOrderFlightRecord.getOrderOperType()));//结算状态
|
||||
}
|
||||
//组织架构
|
||||
setFlightOrganizational(orderFlightRecord, lyOrderFlightRecord);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
|
@ -167,7 +180,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
}
|
||||
|
||||
//订单明细字段赋值
|
||||
private void setFlightRecordDetail(OrderFlightRecord orderFlightRecord, FlightOrderDetail flightOrderDetail) {
|
||||
private void setFlightRecordDetail(OrderFlightRecord orderFlightRecord, FlightOrderDetail flightOrderDetail, String orderSerialNo) {
|
||||
if (!Objects.isNull(flightOrderDetail)) {
|
||||
orderFlightRecord.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称
|
||||
.setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码
|
||||
|
@ -178,11 +192,33 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setEndCityName(flightOrderDetail.getEndCityName())//到达城市名称
|
||||
.setEndTerminal(flightOrderDetail.getEndTerminal())//到达航站楼
|
||||
.setOrderStatus(flightOrderDetail.getOrderStatus());//结算状态
|
||||
if (StringUtils.isBlank(orderFlightRecord.getOfflineCcomyCode())) {
|
||||
orderFlightRecord.setOfflineCcomyCode(flightOrderDetail.getCostCenter());//成本中心
|
||||
} else {
|
||||
LyOrderDetailFlightRecord lyOrderDetailFlightRecord = lyOrderDetailRecordFactory.queryFlightDetail(orderSerialNo);
|
||||
orderFlightRecord.setParentOrderNo(lyOrderDetailFlightRecord.getParentOrderNo())//父级订单号
|
||||
.setStartAirportName(lyOrderDetailFlightRecord.getStartAirportName())//起飞机场名称
|
||||
.setStartCityCode(lyOrderDetailFlightRecord.getStartCityCode())//起飞城市编码
|
||||
.setStartCityName(lyOrderDetailFlightRecord.getStartCityName())//起飞城市名称
|
||||
.setEndAirportCode(lyOrderDetailFlightRecord.getEndAirportCode())//到达机场三字码
|
||||
.setEndAirportName(lyOrderDetailFlightRecord.getEndAirportName())//到达机场名称
|
||||
.setEndCityCode(lyOrderDetailFlightRecord.getEndCityCode())//到达城市编码
|
||||
.setEndCityName(lyOrderDetailFlightRecord.getEndCityName())//到达城市名称
|
||||
.setEndTerminal(lyOrderDetailFlightRecord.getEndTerminal());//到达航站楼
|
||||
}
|
||||
}
|
||||
|
||||
//设置组织架构
|
||||
private void setFlightOrganizational(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) {
|
||||
UserDepartmentInfo userDepartmentInfo = readUser(lyOrderFlightRecord.getPassengerExternalId());
|
||||
if (userDepartmentInfo != null) {
|
||||
orderFlightRecord.setBookOrgCode1(userDepartmentInfo.getDepartmentNameOne())//出行人组织架构信息1
|
||||
.setBookOrgCode2(userDepartmentInfo.getDepartmentNameTwo()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(userDepartmentInfo.getDepartmentNameThree()); //出行人组织架构信息3
|
||||
} else {
|
||||
orderFlightRecord.setBookOrgCode1(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息1
|
||||
.setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()); //出行人组织架构信息3
|
||||
}
|
||||
}
|
||||
|
||||
private void createHotelOrder(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) {
|
||||
String orderSerialNo = lyOrderHotelRecord.getOrderSerialNo();//订单号
|
||||
|
@ -192,7 +228,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
BeanUtils.copyProperties(orderRecordBasic, orderHotelRecord);
|
||||
OrderDetail orderDetail = orderDetailRef.get();//订单明细
|
||||
RouteOrder routeOrder = routeOrderRef.get();//财务共享订单数据
|
||||
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail() == null ? new HotelOrderDetail() : orderDetail.getHotelOrderDetail();//酒店订单明细
|
||||
orderHotelRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());//订单明细id
|
||||
//公共字段校验
|
||||
hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord);
|
||||
|
@ -241,10 +276,19 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setOrderStatus("") //结算状态
|
||||
// .setExpenseOrderAmount("") //订单金额
|
||||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount()))//支付金额
|
||||
;
|
||||
.setPayAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount()));//支付金额
|
||||
//成本中心
|
||||
if (StringUtils.isBlank(orderHotelRecord.getOfflineCcomyCode()) && !Objects.isNull(routeOrder.getApproveOrderNo())) {
|
||||
orderHotelRecord.setOfflineCcomyCode(routeOrder.getApproveOrderNo().getCostCenter());
|
||||
}
|
||||
//订单明细字段赋值
|
||||
setHotelRecordDetail(orderHotelRecord, hotelOrderDetail);
|
||||
setHotelRecordDetail(orderHotelRecord, orderDetail.getHotelOrderDetail(), orderSerialNo);
|
||||
//结算状态
|
||||
if (StringUtils.isBlank(orderHotelRecord.getOrderStatus())) {
|
||||
orderHotelRecord.setOrderStatus(readOrderStatus(lyOrderHotelRecord.getOrderOperType()));//结算状态
|
||||
}
|
||||
//组织架构
|
||||
setHotelOrganizational(orderHotelRecord, lyOrderHotelRecord);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
|
@ -255,21 +299,38 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
));
|
||||
}
|
||||
|
||||
|
||||
//酒店订单明细字段赋值
|
||||
private void setHotelRecordDetail(OrderHotelRecord orderHotelRecord, HotelOrderDetail hotelOrderDetail) {
|
||||
private void setHotelRecordDetail(OrderHotelRecord orderHotelRecord, HotelOrderDetail hotelOrderDetail, String orderSerialNo) {
|
||||
if (!Objects.isNull(hotelOrderDetail)) {
|
||||
orderHotelRecord.setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址
|
||||
.setIsAgreement(hotelOrderDetail.getAgreementHotel()) //是否协议酒店:0否1是
|
||||
.setPersonalAmount(hotelOrderDetail.getPersonalAmount())//个人支付金额
|
||||
.setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数
|
||||
.setStarRate(hotelOrderDetail.getStarRate())//星级
|
||||
.setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2
|
||||
.setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()) //入住人组织架构信息3
|
||||
.setOrderStatus(hotelOrderDetail.getOrderStatus()); //结算状态
|
||||
if (StringUtils.isBlank(orderHotelRecord.getOfflineCcomyCode())) {
|
||||
orderHotelRecord.setOfflineCcomyCode(hotelOrderDetail.getCostCenter());//成本中心
|
||||
} else {
|
||||
LyOrderDetailHotelRecord lyOrderDetailHotelRecord = lyOrderDetailRecordFactory.queryHotelDetail(orderSerialNo);
|
||||
orderHotelRecord.setHotelAddress(lyOrderDetailHotelRecord.getHotelAddress()) //酒店地址
|
||||
.setIsAgreement(lyOrderDetailHotelRecord.getAgreementHotel()) //是否协议酒店:0否1是
|
||||
.setPersonalAmount(lyOrderDetailHotelRecord.getPersonalAmount())//个人支付金额
|
||||
.setRoomCount(Integer.parseInt(StringUtils.isBlank(lyOrderDetailHotelRecord.getRoomCount()) ? "1" : lyOrderDetailHotelRecord.getRoomCount()));//房间数
|
||||
}
|
||||
}
|
||||
|
||||
//组织架构
|
||||
private void setHotelOrganizational(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) {
|
||||
UserDepartmentInfo userDepartmentInfo = readUser(lyOrderHotelRecord.getPassengerExternalId());
|
||||
if (userDepartmentInfo != null) {
|
||||
orderHotelRecord.setBookOrgCode1(userDepartmentInfo.getDepartmentNameOne())//出行人组织架构信息1
|
||||
.setBookOrgCode2(userDepartmentInfo.getDepartmentNameTwo()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(userDepartmentInfo.getDepartmentNameThree()); //出行人组织架构信息3
|
||||
} else {
|
||||
orderHotelRecord.setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //出行人组织架构信息1
|
||||
.setBookOrgCode2(lyOrderHotelRecord.getPassengerDepartment()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(lyOrderHotelRecord.getPassengerDepartment()); //出行人组织架构信息3
|
||||
}
|
||||
}
|
||||
|
||||
private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
|
||||
String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号
|
||||
|
@ -279,7 +340,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
BeanUtils.copyProperties(orderRecordBasic, orderTrainRecord);
|
||||
OrderDetail orderDetail = orderDetailRef.get();//订单明细
|
||||
RouteOrder routeOrder = routeOrderRef.get();//财务共享订单数据
|
||||
TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail() == null ? new TrainOrderDetail() : orderDetail.getTrainOrderDetail();//火车订单明细
|
||||
orderTrainRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());//订单明细id
|
||||
//公共字段校验
|
||||
trainFieldCheck(orderTrainRecord, lyOrderTrainRecord);
|
||||
|
@ -318,10 +378,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1
|
||||
// .setExpenseOrderAmount() //订单金额
|
||||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())) //支付金额
|
||||
;
|
||||
.setPayAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())); //支付金额
|
||||
|
||||
//成本中心
|
||||
if (StringUtils.isBlank(orderTrainRecord.getOfflineCcomyCode()) && !Objects.isNull(routeOrder.getApproveOrderNo())) {
|
||||
orderTrainRecord.setOfflineCcomyCode(routeOrder.getApproveOrderNo().getCostCenter());
|
||||
}
|
||||
//订单明细字段赋值
|
||||
setTrainRecordDetail(orderTrainRecord, trainOrderDetail);
|
||||
setTrainRecordDetail(orderTrainRecord, orderDetail.getTrainOrderDetail(), orderSerialNo);
|
||||
//结算状态
|
||||
if (StringUtils.isBlank(orderTrainRecord.getOrderStatus())) {
|
||||
orderTrainRecord.setOrderStatus(readOrderStatus(lyOrderTrainRecord.getOrderOperType()));//结算状态
|
||||
}
|
||||
//组织架构
|
||||
setTrainOrganizational(orderTrainRecord, lyOrderTrainRecord);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
|
@ -333,9 +403,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
}
|
||||
|
||||
//火车订单明细字段赋值
|
||||
private void setTrainRecordDetail(OrderTrainRecord orderTrainRecord, TrainOrderDetail trainOrderDetail) {
|
||||
private void setTrainRecordDetail(OrderTrainRecord orderTrainRecord, TrainOrderDetail trainOrderDetail, String orderSerialNo) {
|
||||
if (!Objects.isNull(trainOrderDetail)) {
|
||||
orderTrainRecord.setParentOrderNo(trainOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setRunTime(trainOrderDetail.getRunTime()) //时长
|
||||
.setRunTime(lyOrderDetailRecordFactory.getRunTime(trainOrderDetail.getStartTime(), trainOrderDetail.getArriveTime()))//时长
|
||||
.setSeatType(trainOrderDetail.getSeatType())// 座位等级
|
||||
.setFromCity(trainOrderDetail.getFromCity()) //出发城市
|
||||
.setToCity(trainOrderDetail.getToCity()) //到达城市
|
||||
|
@ -343,12 +414,18 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.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
|
||||
.setOrderStatus(trainOrderDetail.getOrderStatus());//结算状态
|
||||
if (StringUtils.isBlank(orderTrainRecord.getOfflineCcomyCode())) {
|
||||
orderTrainRecord.setOfflineCcomyCode(trainOrderDetail.getCostCenter());//成本中心
|
||||
} else {
|
||||
LyOrderDetailTrainRecord lyOrderDetailTrainRecord = lyOrderDetailRecordFactory.queryTrainDetail(orderSerialNo);
|
||||
orderTrainRecord.setParentOrderNo(lyOrderDetailTrainRecord.getParentOrderNo())//父级订单号
|
||||
.setRunTime(lyOrderDetailTrainRecord.getRunTime()) //时长
|
||||
.setSeatType(lyOrderDetailTrainRecord.getSeatType())// 座位等级
|
||||
.setFromCity(lyOrderDetailTrainRecord.getFromCity()) //出发城市
|
||||
.setToCity(lyOrderDetailTrainRecord.getToCity()) //到达城市
|
||||
.setFromStationName(Optional.ofNullable(orderTrainRecord.getFromStationName())
|
||||
.orElse(lyOrderDetailTrainRecord.getFromStationName())) // 出发站
|
||||
.setToStationName(Optional.ofNullable(orderTrainRecord.getToStationName())
|
||||
.orElse(lyOrderDetailTrainRecord.getToStationName())); // 到达站
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,6 +438,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
}
|
||||
}
|
||||
|
||||
//组织架构
|
||||
private void setTrainOrganizational(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
|
||||
UserDepartmentInfo userDepartmentInfo = readUser(lyOrderTrainRecord.getPassengerExternalId());
|
||||
if (userDepartmentInfo != null) {
|
||||
orderTrainRecord.setBookOrgCode1(userDepartmentInfo.getDepartmentNameOne())//出行人组织架构信息1
|
||||
.setBookOrgCode2(userDepartmentInfo.getDepartmentNameTwo()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(userDepartmentInfo.getDepartmentNameThree()); //出行人组织架构信息3
|
||||
} else {
|
||||
orderTrainRecord.setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment()) //出行人组织架构信息1
|
||||
.setBookOrgCode2(lyOrderTrainRecord.getPassengerDepartment()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(lyOrderTrainRecord.getPassengerDepartment()); //出行人组织架构信息3
|
||||
}
|
||||
}
|
||||
|
||||
private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
|
||||
String orderSerialNo = lyOrderCarRecord.getOrderSerialNo();//订单号
|
||||
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
|
||||
|
@ -369,7 +460,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
BeanUtils.copyProperties(orderRecordBasic, orderCarRecord);
|
||||
OrderDetail orderDetail = orderDetailRef.get();//订单明细
|
||||
RouteOrder routeOrder = routeOrderRef.get();//财务共享订单数据
|
||||
CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail() == null ? new CarOrderDetail() : orderDetail.getCarOrderDetail();//用车订单明细
|
||||
orderCarRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());//订单明细id
|
||||
//公共字段校验
|
||||
carFieldCheck(orderCarRecord, lyOrderCarRecord);
|
||||
|
@ -405,10 +495,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
.setOrderSource(StringUtils.isNotBlank(lyOrderCarRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下
|
||||
// .setExpenseOrderAmount() //订单金额
|
||||
// .setSettleOrderFlag() //订单对账状态
|
||||
.setPayAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount()))// 支付金额
|
||||
;
|
||||
.setPayAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount()));// 支付金额
|
||||
|
||||
//成本中心
|
||||
if (StringUtils.isBlank(orderCarRecord.getOfflineCcomyCode()) && !Objects.isNull(routeOrder.getApproveOrderNo())) {
|
||||
orderCarRecord.setOfflineCcomyCode(routeOrder.getApproveOrderNo().getCostCenter());
|
||||
}
|
||||
//订单明细字段赋值
|
||||
setCarRecordDetail(orderCarRecord, carOrderDetail);
|
||||
setCarRecordDetail(orderCarRecord, orderDetail.getCarOrderDetail(), orderSerialNo);
|
||||
//结算状态
|
||||
if (StringUtils.isBlank(orderCarRecord.getOrderStatus())) {
|
||||
orderCarRecord.setOrderStatus(readOrderStatus(lyOrderCarRecord.getOrderOperType()));//结算状态
|
||||
}
|
||||
//组织架构
|
||||
setCarOrganizational(orderCarRecord, lyOrderCarRecord);
|
||||
|
||||
//这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取
|
||||
Optional<RouterOrderExtensionField> routerOrderExtensionField = Optional.of(routeOrder)
|
||||
|
@ -420,21 +520,40 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
}
|
||||
|
||||
//用车订单明细字段赋值
|
||||
private void setCarRecordDetail(OrderCarRecord orderCarRecord, CarOrderDetail carOrderDetail) {
|
||||
private void setCarRecordDetail(OrderCarRecord orderCarRecord, CarOrderDetail carOrderDetail, String orderSerialNo) {
|
||||
if (!Objects.isNull(carOrderDetail)) {
|
||||
orderCarRecord.setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号
|
||||
.setArriveTime(carOrderDetail.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17"
|
||||
.setCarType(carOrderDetail.getCarModel()) //车型
|
||||
.setToCity(carOrderDetail.getToCity()) //到达城市
|
||||
.setRunTime(carOrderDetail.getRunTime()) //运行时长
|
||||
.setMiles(carOrderDetail.getMileage()) //里程数
|
||||
.setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount()) //个人支付金额
|
||||
.setBookOrgCode2(carOrderDetail.getBOOK_ORG_STRUCT_2()) //用车人组织架构信息2
|
||||
.setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()); //用车人组织架构信息3
|
||||
if (StringUtils.isBlank(orderCarRecord.getOfflineCcomyCode())) {
|
||||
orderCarRecord.setOfflineCcomyCode(carOrderDetail.getCostCenter());//成本中心
|
||||
.setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount());//个人支付金额
|
||||
} else {
|
||||
LyOrderDetailCarRecord lyOrderDetailCarRecord = lyOrderDetailRecordFactory.queryCarDetail(orderSerialNo);
|
||||
orderCarRecord.setParentOrderNo(lyOrderDetailCarRecord.getParentOrderNo())//父级订单号
|
||||
.setArriveTime(lyOrderDetailCarRecord.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17"
|
||||
.setCarType(lyOrderDetailCarRecord.getCarModel()) //车型
|
||||
.setToCity(lyOrderDetailCarRecord.getToCity()) //到达城市
|
||||
.setRunTime(lyOrderDetailCarRecord.getRunTime()) //运行时长
|
||||
.setMiles(lyOrderDetailCarRecord.getMileage()) //里程数
|
||||
.setOwnPayAmt(lyOrderDetailCarRecord.getPersonalPaymentAmount());//个人支付金额
|
||||
}
|
||||
}
|
||||
|
||||
//组织机构
|
||||
private void setCarOrganizational(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
|
||||
UserDepartmentInfo userDepartmentInfo = readUser(lyOrderCarRecord.getPassengerExternalId());
|
||||
if (userDepartmentInfo != null) {
|
||||
orderCarRecord.setBookOrgCode1(userDepartmentInfo.getDepartmentNameOne())//出行人组织架构信息1
|
||||
.setBookOrgCode2(userDepartmentInfo.getDepartmentNameTwo()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(userDepartmentInfo.getDepartmentNameThree()); //出行人组织架构信息3
|
||||
} else {
|
||||
orderCarRecord.setBookOrgCode1(lyOrderCarRecord.getPassengerDepartment()) //出行人组织架构信息1
|
||||
.setBookOrgCode2(lyOrderCarRecord.getPassengerDepartment()) //出行人组织架构信息2
|
||||
.setBookOrgCode3(lyOrderCarRecord.getPassengerDepartment()); //出行人组织架构信息3
|
||||
}
|
||||
}
|
||||
|
||||
//获取公共对象
|
||||
public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer<OrderDetail> consumerOrderDetail, Consumer<RouteOrder> consumerRouteOrder) {
|
||||
|
@ -604,7 +723,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
case BELONG_SYS_CODE_H3BPM -> BELONG_SYS_TYPE_H3BPM;
|
||||
case BELONG_SYS_CODE_XNFSSC -> BELONG_SYS_TYPE_XNFSSC;
|
||||
case BELONG_SYS_CODE_ANFSSC -> BELONG_SYS_TYPE_ANFSSC;
|
||||
default -> "NOT";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -675,4 +794,26 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
|
|||
default -> "未知发票";
|
||||
};
|
||||
}
|
||||
|
||||
//查询组织结构
|
||||
public UserDepartmentInfo readUser(String employeeNo) {
|
||||
User user = jdbcUserRepository.findByEmployeeNo(employeeNo);
|
||||
if (user != null) {
|
||||
List<UserDepartmentInfo> userDepartmentInfoList = user.getUserDepartmentInfoList();
|
||||
if (userDepartmentInfoList != null && !userDepartmentInfoList.isEmpty()) {
|
||||
return userDepartmentInfoList.get(0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//订单状态映射 1-出票成功,2-改签成功,3-退票成功
|
||||
public String readOrderStatus(String orderStatus) {
|
||||
return switch (orderStatus) {
|
||||
case "变更", "改签" -> "2";
|
||||
case "退款", "退票" -> "3";
|
||||
default -> "1";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import com.chint.infrastructure.util.PageResult;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailCarRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailTrainRecord;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcLyOrderDetailCarRecord extends CrudRepository<LyOrderDetailCarRecord,Long> {
|
||||
LyOrderDetailCarRecord findByOrderNo(String orderNo);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailTrainRecord;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcLyOrderDetailFlightRecord extends CrudRepository<LyOrderDetailFlightRecord,Long> {
|
||||
LyOrderDetailFlightRecord findByOrderNo(String orderNo);
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailHotelRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailTrainRecord;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcLyOrderDetailHotelRecord extends CrudRepository<LyOrderDetailHotelRecord,Long> {
|
||||
LyOrderDetailHotelRecord findByOrderNo(String orderNo);
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailTrainRecord;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcLyOrderDetailTrainRecord extends CrudRepository<LyOrderDetailTrainRecord, Long> {
|
||||
LyOrderDetailTrainRecord findByOrderNo(String orderNo);
|
||||
|
||||
}
|
|
@ -6,15 +6,18 @@ import com.authine.cloudpivot.opensdk.CloudpivotOpenClient;
|
|||
import com.authine.cloudpivot.opensdk.model.request.workflow.StartWorkflowRequest;
|
||||
import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse;
|
||||
import com.chint.application.commands.RefundOrderGenerateCommand;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.aggregates.order.OrderTravel;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailCarRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailFlightRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailHotelRecord;
|
||||
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailTrainRecord;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
|
||||
import com.chint.infrastructure.constant.LYConstant;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderDetailFlightRecord;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
|
@ -35,6 +38,7 @@ import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderRespon
|
|||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.in.CommonController;
|
||||
import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
@ -45,12 +49,17 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
|
||||
import static com.chint.infrastructure.constant.BPMConstant.YSBPM_TOKEN_URL;
|
||||
import static com.chint.infrastructure.constant.FSSCConstant.*;
|
||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_TRAIN_STATUS_SUCCESS;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||
|
||||
@SpringBootTest
|
||||
public class LYTest {
|
||||
|
@ -812,7 +821,7 @@ public class LYTest {
|
|||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void searchTrain() {
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24032768188401512");
|
||||
Gson gson = new Gson();
|
||||
|
@ -828,7 +837,7 @@ public class LYTest {
|
|||
System.out.println(json);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void searchCar() {
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031566878059751");
|
||||
Gson gson = new Gson();
|
||||
|
@ -864,7 +873,6 @@ public class LYTest {
|
|||
// System.out.println(json);
|
||||
|
||||
|
||||
|
||||
// CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("30352884087");
|
||||
// Gson gson = new Gson();
|
||||
// String json = gson.toJson(carDetailResponse);
|
||||
|
@ -922,18 +930,166 @@ public class LYTest {
|
|||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void syncToSupplierOne() {
|
||||
RouteOrder routeOrder = routeRepository.queryById(665L);
|
||||
lyOrderSyncAdapter.syncSupplierOrder(routeOrder);
|
||||
}
|
||||
|
||||
|
||||
// @Test
|
||||
// @Test
|
||||
void queryHotelCustom() {
|
||||
OrderDetail byId = orderDetailRepository.findById(2569L);
|
||||
HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail());
|
||||
System.out.println(hotelOrderDetailDto);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void queryFlightDetail() {
|
||||
LyOrderDetailFlightRecord lyOrderDetailFlightRecord = new LyOrderDetailFlightRecord();//创建对象
|
||||
//订单明细数据
|
||||
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24031566804119214");
|
||||
FlightOrderResponse.Data data = flightOrderDetail.getData();
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
|
||||
lyOrderDetailFlightRecord.setOrderNo("DF24031566804119214")//订单号
|
||||
.setParentOrderNo(orderDetails.getParentOrderSerialNo());//父级订单号
|
||||
List<FlightOrderResponse.FlightSegment> flightSegmentList = data.getFlightSegmentList();
|
||||
if (flightSegmentList != null && !flightSegmentList.isEmpty()) {
|
||||
FlightOrderResponse.FlightSegment flightSegment = flightSegmentList.get(0);
|
||||
lyOrderDetailFlightRecord.setStartAirportName(flightSegment.getDepartAirport())//起飞机场名称
|
||||
.setStartCityName(flightSegment.getDepartCity())//起飞城市名称
|
||||
.setEndAirportCode(flightSegment.getArriveAirportCode())//到达机场三字码
|
||||
.setEndAirportName(flightSegment.getArriveAirport())//到达机场名称
|
||||
.setEndCityName(flightSegment.getArriveCity())//到达城市名称
|
||||
.setEndTerminal(flightSegment.getArriveTerminal());//到达航站楼
|
||||
}
|
||||
lyOrderDetailFlightRecord.setStartCityCode("")//起飞城市编码
|
||||
.setEndCityCode("");//到达城市编码
|
||||
Gson gson = new Gson();
|
||||
System.out.println(gson.toJson(lyOrderDetailFlightRecord));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryHotelDetail() {
|
||||
LyOrderDetailHotelRecord lyOrderDetailHotelRecord = new LyOrderDetailHotelRecord();
|
||||
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240308154500794121");
|
||||
HotelDetailResponse.Data data = hotelOrderDetail.getData();
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
||||
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
|
||||
lyOrderDetailHotelRecord.setOrderNo("HO20240308154500794121");//订单号
|
||||
if (hotelInfo != null && orderInfo != null) {
|
||||
lyOrderDetailHotelRecord.setHotelAddress(hotelInfo.getHotelAddress())//酒店地址
|
||||
.setAgreementHotel(orderInfo.getProtocolType() == 0 ? "否" : "是")//是否协议酒店:0否1是
|
||||
.setPersonalAmount(orderInfo.getPaymentType() == 1 ? KEEP_TWO_DECIMAL_ZERO : String.valueOf(orderInfo.getPersonalPrice()))//个人支付金额
|
||||
.setRoomCount(String.valueOf(hotelInfo.getRoomNum()));//房间数
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
System.out.println(gson.toJson(lyOrderDetailHotelRecord));
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryTrainDetail() {
|
||||
LyOrderDetailTrainRecord lyOrderDetailTrainRecord = new LyOrderDetailTrainRecord();
|
||||
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24031266448572670");
|
||||
TrainDetailResponse.TrainDetailData trainDetailData = trainOrderDetail.getData();
|
||||
if (trainDetailData == null) {
|
||||
return;
|
||||
}
|
||||
List<TrainDetailResponse.Item> detailDataItems = trainDetailData.getItems();
|
||||
lyOrderDetailTrainRecord.setOrderNo("DT24031266448572670")//订单号
|
||||
.setParentOrderNo(trainDetailData.getParentOrderSerialNo())//父级订单号
|
||||
.setRunTime(getRunTime(trainDetailData.getPlanBeginDate(), trainDetailData.getPlanEndDate())) //时长
|
||||
.setFromCity(trainDetailData.getDepartCity()) //出发城市
|
||||
.setToCity(trainDetailData.getArriveCity()) //到达城市
|
||||
.setFromStationName(trainDetailData.getFromStation())// 出发站
|
||||
.setToStationName(trainDetailData.getToStation());// 到达站
|
||||
|
||||
if (detailDataItems != null && !detailDataItems.isEmpty()) {
|
||||
TrainDetailResponse.Item item = detailDataItems.get(0);
|
||||
lyOrderDetailTrainRecord.setSeatType(translateEnSeatToCnSeat(item.getSeatClass()));//座位等级
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
System.out.println(gson.toJson(lyOrderDetailTrainRecord));
|
||||
}
|
||||
|
||||
private String translateEnSeatToCnSeat(String seatEnName) {
|
||||
return switch (seatEnName) {
|
||||
case "secondseat" -> "二等座";
|
||||
case "businessseat" -> "商务座";
|
||||
case "hardseat" -> "二等座";
|
||||
case "softsleeperup" -> "软卧上铺";
|
||||
case "hardsleeperup" -> "硬卧上铺";
|
||||
case "firstseat" -> "一等座";
|
||||
case "softsleeperdown" -> "软卧下铺";
|
||||
case "hardsleeperdown" -> "硬卧下铺";
|
||||
case "softsleepermid" -> "软卧中铺";
|
||||
case "hardsleepermid" -> "硬卧中铺";
|
||||
default -> "未知类型座位";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void queryCarDetail() {
|
||||
LyOrderDetailCarRecord lyOrderDetailCarRecord = new LyOrderDetailCarRecord();
|
||||
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031466726324898");
|
||||
CarDetailResponse.DataWrapper data = carDetailResponse.getData();
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo();
|
||||
CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo();
|
||||
lyOrderDetailCarRecord.setOrderNo("DC24031466726324898")//订单号
|
||||
.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice())); //个人支付金额
|
||||
if (orderExtendInfo != null) {
|
||||
lyOrderDetailCarRecord.setParentOrderNo("")//父级订单号
|
||||
.setArriveTime(orderExtendInfo.getFinishTime())//"到达时间格式:2023-04-26 13:15:17"
|
||||
.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName())) //车型
|
||||
.setToCity(orderExtendInfo.getEndCityName())//到达城市
|
||||
.setRunTime(orderExtendInfo.getDuration().replaceAll("[^\\u0000-\\u007F\\p{P}]", "")) //运行时长
|
||||
.setMileage(orderExtendInfo.getMileage().replaceAll("[^\\u0000-\\u007F\\p{P}]", "")); //里程数
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
System.out.println(gson.toJson(lyOrderDetailCarRecord));
|
||||
}
|
||||
|
||||
|
||||
//获取时长
|
||||
public String getRunTime(String startTimeDate, String endTimeDate) {
|
||||
// 解析时间字符串
|
||||
LocalDateTime startTime = LocalDateTime.parse(startTimeDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime endTime = LocalDateTime.parse(endTimeDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// 计算时间差
|
||||
Duration duration = Duration.between(startTime, endTime);
|
||||
// 将时间差转换为时长
|
||||
long hours = duration.toHours();
|
||||
long minutes = duration.toMinutesPart();
|
||||
// 格式化时长
|
||||
return String.format("%02d:%02d", hours, minutes);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcLyOrderDetailFlightRecord jdbcLyOrderDetailFlightRecord;
|
||||
@Test
|
||||
public void dasfag() {
|
||||
LyOrderDetailFlightRecord orderDetail = jdbcLyOrderDetailFlightRecord.findByOrderNo("123");
|
||||
if (orderDetail != null) {
|
||||
System.out.println("123333orderDetail = " + orderDetail);
|
||||
System.out.println("不为空");
|
||||
}else {
|
||||
LyOrderDetailFlightRecord lyOrderDetailFlightRecord = new LyOrderDetailFlightRecord();
|
||||
lyOrderDetailFlightRecord.setOrderNo("123");
|
||||
jdbcLyOrderDetailFlightRecord.save(lyOrderDetailFlightRecord);
|
||||
System.out.println("为空");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue