结算明细字段映射调整

This commit is contained in:
dengwc 2024-04-02 14:57:44 +08:00
parent ff18fd425f
commit 5bb2c31ddc
18 changed files with 453 additions and 60 deletions

View File

@ -0,0 +1,12 @@
package com.chint.application.commands;
import com.chint.infrastructure.echo_framework.command.Command;
import lombok.Data;
//将上月的结算数据生成为财务共享需要的数据
@Data
public class LYOrderRecordGenerateCommand extends Command {
}

View File

@ -1,6 +1,7 @@
package com.chint.application.in;
import com.chint.application.commands.LYOrderRecordGenerateCommand;
import com.chint.application.dtos.CTripRecordMonthSaveDTO;
import com.chint.domain.factoriy.order_record.LyStatementOrder;
import com.chint.infrastructure.echo_framework.command.Command;
@ -69,7 +70,7 @@ public class AutoWorkController {
//同步拉取上月数据
lyStatementOrder.saveAll();
//将上月的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
Command.of(LYOrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}

View File

@ -52,7 +52,7 @@ public class LyOrderCarRecord implements Serializable {
private String subjectRemark;
@MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key")
private List<TripSubmitItemList> tripSubmitItemList;
private List<TripSubmitItemCarList> tripSubmitItemList;
//出行人职级
private String passengerPositionLevelName;

View File

@ -92,7 +92,7 @@ public class LyOrderFlightRecord implements Serializable {
private String overStandardStatus;
@MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key")
private List<TripSubmitItemList> tripSubmitItemList;
private List<TripSubmitItemFlightList> tripSubmitItemList;
//出行人职级
private String passengerPositionLevelName;

View File

@ -64,7 +64,7 @@ public class LyOrderHotelRecord implements Serializable {
private String overStandardStatus;
@MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key")
private List<TripSubmitItemList> tripSubmitItemList;
private List<TripSubmitItemHotelList> tripSubmitItemList;
//出行人职级
private String passengerPositionLevelName;

View File

@ -58,7 +58,7 @@ public class LyOrderTrainRecord implements Serializable {
private String overStandardStatus;
@MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key")
private List<TripSubmitItemList> tripSubmitItemList;
private List<TripSubmitItemTrainList> tripSubmitItemList;
//出行人职级
private String passengerPositionLevelName;

View File

@ -0,0 +1,45 @@
package com.chint.domain.aggregates.order.order_record.ly_order_record;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
/**
* 行程提交项目(TripSubmitItem)表实体类
*
* @author dengweichao
* @since 2024-03-27 10:17:58
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("trip_submit_item_car_list")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TripSubmitItemCarList implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id
private Integer id;
//父id
private Integer lyRecordId;
private Integer lyRecordKey;
//编码
private String code;
//名称
private String name;
//内容
private String content;
}

View File

@ -0,0 +1,46 @@
package com.chint.domain.aggregates.order.order_record.ly_order_record;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
/**
* 行程提交项目(TripSubmitItem)表实体类
*
* @author dengweichao
* @since 2024-03-27 10:17:58
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("trip_submit_item_flight_list")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TripSubmitItemFlightList implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id
private Integer id;
//父id
private Integer lyRecordId;
private Integer lyRecordKey;
//编码
private String code;
//名称
private String name;
//内容
private String content;
}

View File

@ -0,0 +1,45 @@
package com.chint.domain.aggregates.order.order_record.ly_order_record;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
/**
* 行程提交项目(TripSubmitItem)表实体类
*
* @author dengweichao
* @since 2024-03-27 10:17:58
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("trip_submit_item_hotel_list")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TripSubmitItemHotelList implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id
private Integer id;
//父id
private Integer lyRecordId;
private Integer lyRecordKey;
//编码
private String code;
//名称
private String name;
//内容
private String content;
}

View File

@ -1,19 +1,18 @@
package com.chint.domain.aggregates.order.order_record.ly_order_record;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
/**
* 行程提交项目(TripSubmitItem)表实体类
* 行程提交项目
*
* @author dengweichao
* @since 2024-03-27 10:17:58
@ -21,15 +20,9 @@ import org.springframework.data.relational.core.mapping.Table;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("trip_submit_item_list")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TripSubmitItemList implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id
private Integer id;
//父id

View File

@ -0,0 +1,45 @@
package com.chint.domain.aggregates.order.order_record.ly_order_record;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
/**
* 行程提交项目(TripSubmitItem)表实体类
*
* @author dengweichao
* @since 2024-03-27 10:17:58
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table("trip_submit_item_train_list")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TripSubmitItemTrainList implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id
private Integer id;
//父id
private Integer lyRecordId;
private Integer lyRecordKey;
//编码
private String code;
//名称
private String name;
//内容
private String content;
}

View File

@ -5,14 +5,10 @@ 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;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.domain.aggregates.order.order_record.ly_order_record.*;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.BeanCopyUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -20,9 +16,13 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_LY;
import static com.chint.infrastructure.constant.OrderRecordConstant.*;
/**
* 同程数据转换
*/
@ -83,13 +83,15 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
private void createFlightOrder(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) {
String orderSerialNo = lyOrderFlightRecord.getOrderSerialNo();//订单号
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set);
AtomicReference<RouteOrder> routeOrderRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set);
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);
orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员
.setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号
@ -101,8 +103,9 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//行程单号
List<OrderTravel> byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo);
String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo();
orderFlightRecord.setScheduleNum(travelNo)//行程单号
.setReceiptsNum(lyOrderFlightRecord.getOutApplayOrderNo())//关联申请单号
orderFlightRecord.setScheduleNum(travelNo);//行程单号
orderFlightRecord.setReceiptsNum(getReceiptsNum(lyOrderFlightRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
.setReceiptsNumOrigin(lyOrderFlightRecord.getOutApplayOrderNo())//原关联申请单号
.setUserName(lyOrderFlightRecord.getPassengerName())//出行人姓名
.setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码
.setOverStandard("".equals(lyOrderFlightRecord.getOverStandardStatus()) ? "1" : "0")//"是否违规超标0否 ,1是"
@ -152,13 +155,19 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
;
}
private void createHotelOrder(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) {
String orderSerialNo = lyOrderHotelRecord.getOrderSerialNo();//订单号
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set);
AtomicReference<RouteOrder> routeOrderRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set);
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);
orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员
.setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号
@ -169,8 +178,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setBrandGroup("") //酒店品牌集团
.setBrandName("") //酒店品牌
.setOverStandard("".equals(lyOrderHotelRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规(超标) 0否,1是"
.setOverStandardReason(lyOrderHotelRecord.getViolationReason()) //违规原因超标原因
.setReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo()) //关联申请单号
.setOverStandardReason(lyOrderHotelRecord.getViolationReason());//违规原因超标原因
orderHotelRecord.setReceiptsNum(getReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
.setReceiptsNumOrigin(lyOrderHotelRecord.getOutApplayOrderNo()) //原关联申请单号
.setUserName(lyOrderHotelRecord.getPassengerName()) //入住人姓名
.setUserCode(lyOrderHotelRecord.getPassengerNo()) //入住人编码
.setCheckInCity(lyOrderHotelRecord.getCityName()) //入住城市
@ -189,7 +200,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setUnifiedPayAmt(String.valueOf(lyOrderHotelRecord.getServiceAmount())) //统付服务费
.setPersonalPayAmt("") //个人服务费
.setProvince("") //省份
.setRoomCount(Integer.parseInt(hotelOrderDetail.getRoomCount())) //房间数
.setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数
.setRoomNightCount(lyOrderHotelRecord.getHotelNights()) //夜间数
.setNightCount(lyOrderHotelRecord.getHotelNights()) //间夜数
.setRoomPrice("") //房价房间单价不包含服务费
@ -219,18 +230,24 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set);
AtomicReference<RouteOrder> routeOrderRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set);
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);
orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员
.setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号
.setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号
.setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号
.setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号
.setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo()) //原始订单号
.setReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo()) //关联申请单号
.setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo());//原始订单号
orderTrainRecord.setReceiptsNum(getReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
.setReceiptsNumOrigin(lyOrderTrainRecord.getOutApplayOrderNo()) //原关联申请单号
.setStartDate(lyOrderTrainRecord.getPlanBeginDate()) //出发日期
.setArriveDate(lyOrderTrainRecord.getPlanEndDate()) //到达日期
.setOverStandard("".equals(lyOrderTrainRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规超标0否 1是"
@ -283,15 +300,21 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
String orderSerialNo = lyOrderCarRecord.getOrderSerialNo();//订单号
AtomicReference<OrderDetail> orderDetailRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set);
AtomicReference<RouteOrder> routeOrderRef = new AtomicReference<>();
OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set);
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);
orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识
.setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员
.setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号
.setBillNo(lyOrderCarRecord.getBillOrderNo()) //账单号
.setReceiptsNum(lyOrderCarRecord.getOrderSerialNo()) //关联申请单号
.setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号
orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号
.setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号
.setOverStandard("0") //"是否违规超标0否 1是"
.setOverStandardReason("")//违规原因超标原因
.setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号
@ -334,20 +357,181 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
}
//获取公共对象
public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer<OrderDetail> consumer) {
public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer<OrderDetail> consumerOrderDetail, Consumer<RouteOrder> consumerRouteOrder) {
OrderDetail orderDetail = jdbcOrderDetailRepository.findByOrderNo(orderSerialNo);
consumer.accept(orderDetail == null ? new OrderDetail() : orderDetail);//设置订单明细数据
consumerOrderDetail.accept(orderDetail == null ? new OrderDetail() : orderDetail);//设置订单明细数据
if (Objects.isNull(orderDetail)) {
consumerRouteOrder.accept(new RouteOrder());
return new OrderRecordBasic();
}
Long routeId = orderDetail.getRouteId();
RouteOrder routeOrder = jdbcRouteRepository.findByRouteId(routeId);
consumerRouteOrder.accept(routeOrder == null ? new RouteOrder() : routeOrder);
if (Objects.isNull(routeOrder)) {
return new OrderRecordBasic();
}
return orderRecordFactory.buildWithRouteOrder(routeOrder);
}
public void flightFieldCheck(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) {
orderFlightRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC携程 TC同程
.setBookingName(lyOrderFlightRecord.getReserveManName()) //预订人姓名
.setBookingUserCode(lyOrderFlightRecord.getReserveManNo()); //预订人编码
List<TripSubmitItemFlightList> tripSubmitItemFlightList = lyOrderFlightRecord.getTripSubmitItemList();
List<TripSubmitItemList> tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemFlightList, TripSubmitItemList.class);
if (StringUtils.isBlank(orderFlightRecord.getBelongSysType())) {
String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderFlightRecord.getOutApplayOrderNo());
orderFlightRecord.setBelongSysType(belongSysType);//对应所属系统
}
if (StringUtils.isBlank(orderFlightRecord.getAccountCompanyId())) {
findAccountCompanyId(tripSubmitItemList).ifPresent(orderFlightRecord::setAccountCompanyId);//核算企业code
}
if (StringUtils.isBlank(orderFlightRecord.getAccountCompanyName())) {
findAccountCompanyName(tripSubmitItemList).ifPresent(orderFlightRecord::setAccountCompanyName);//核算企业名称
}
if (StringUtils.isBlank(orderFlightRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderFlightRecord::setProjectOrderNo);//项目订单号
}
}
public void hotelFieldCheck(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) {
orderHotelRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC携程 TC同程
.setBookingName(lyOrderHotelRecord.getReserveManName()) //预订人姓名
.setBookingUserCode(lyOrderHotelRecord.getReserveManNo()); //预订人编码
List<TripSubmitItemHotelList> tripSubmitItemHotelList = lyOrderHotelRecord.getTripSubmitItemList();
List<TripSubmitItemList> tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemHotelList, TripSubmitItemList.class);
if (StringUtils.isBlank(orderHotelRecord.getBelongSysType())) {
String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderHotelRecord.getOutApplayOrderNo());
orderHotelRecord.setBelongSysType(belongSysType);//对应所属系统
}
if (StringUtils.isBlank(orderHotelRecord.getAccountCompanyId())) {
findAccountCompanyId(tripSubmitItemList).ifPresent(orderHotelRecord::setAccountCompanyId);//核算企业code
}
if (StringUtils.isBlank(orderHotelRecord.getAccountCompanyName())) {
findAccountCompanyName(tripSubmitItemList).ifPresent(orderHotelRecord::setAccountCompanyName);//核算企业名称
}
if (StringUtils.isBlank(orderHotelRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderHotelRecord::setProjectOrderNo);//项目订单号
}
}
public void trainFieldCheck(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) {
orderTrainRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC携程 TC同程
.setBookingName(lyOrderTrainRecord.getReserveManName()) //预订人姓名
.setBookingUserCode(lyOrderTrainRecord.getReserveManNo()); //预订人编码
List<TripSubmitItemTrainList> tripSubmitItemTrainList = lyOrderTrainRecord.getTripSubmitItemList();
List<TripSubmitItemList> tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemTrainList, TripSubmitItemList.class);
if (StringUtils.isBlank(orderTrainRecord.getBelongSysType())) {
String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderTrainRecord.getOutApplayOrderNo());
orderTrainRecord.setBelongSysType(belongSysType);//对应所属系统
}
if (StringUtils.isBlank(orderTrainRecord.getAccountCompanyId())) {
findAccountCompanyId(tripSubmitItemList).ifPresent(orderTrainRecord::setAccountCompanyId);//核算企业code
}
if (StringUtils.isBlank(orderTrainRecord.getAccountCompanyName())) {
findAccountCompanyName(tripSubmitItemList).ifPresent(orderTrainRecord::setAccountCompanyName);//核算企业名称
}
if (StringUtils.isBlank(orderTrainRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderTrainRecord::setProjectOrderNo);//项目订单号
}
}
public void carFieldCheck(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) {
orderCarRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC携程 TC同程
.setBookingName(lyOrderCarRecord.getReserveManName()) //预订人姓名
.setBookingUserCode(lyOrderCarRecord.getReserveManNo()); //预订人编码
List<TripSubmitItemCarList> tripSubmitItemCarList = lyOrderCarRecord.getTripSubmitItemList();
List<TripSubmitItemList> tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemCarList, TripSubmitItemList.class);
if (StringUtils.isBlank(orderCarRecord.getBelongSysType())) {
String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderCarRecord.getOutApplayOrderNo());
orderCarRecord.setBelongSysType(belongSysType);//对应所属系统
}
if (StringUtils.isBlank(orderCarRecord.getAccountCompanyId())) {
findAccountCompanyId(tripSubmitItemList).ifPresent(orderCarRecord::setAccountCompanyId);//核算企业code
}
if (StringUtils.isBlank(orderCarRecord.getAccountCompanyName())) {
findAccountCompanyName(tripSubmitItemList).ifPresent(orderCarRecord::setAccountCompanyName);//核算企业名称
}
if (StringUtils.isBlank(orderCarRecord.getProjectOrderNo())) {
findProjectOrderNo(tripSubmitItemList).ifPresent(orderCarRecord::setProjectOrderNo);//项目订单号
}
}
//对应所属系统
private static String findBelongSysType(List<TripSubmitItemList> itemList, String outApplayOrderNo) {
return itemList.stream()
.filter(item -> LY_CUSTOM1.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent)
.orElseGet(() -> Optional.ofNullable(outApplayOrderNo)
.map(no -> no.split("-")[0])
.orElse(""));
}
//核算企业code
private static Optional<String> findAccountCompanyId(List<TripSubmitItemList> tripSubmitItemList) {
return tripSubmitItemList.stream()
.filter(item -> LY_CUSTOM2.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent);
}
////核算企业名称
private static Optional<String> findAccountCompanyName(List<TripSubmitItemList> tripSubmitItemList) {
return tripSubmitItemList.stream()
.filter(item -> LY_CUSTOM3.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent);
}
//项目订单号
private static Optional<String> findProjectOrderNo(List<TripSubmitItemList> tripSubmitItemList) {
return tripSubmitItemList.stream()
.filter(item -> LY_CUSTOM4.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent);
}
private void flightReceiptsNum(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord, RouteOrder routeOrder) {
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
String outApplayOrderNo = lyOrderFlightRecord.getOutApplayOrderNo();
String receiptsNum = "";
if (Objects.isNull(approveOrderNo) && StringUtils.isNotBlank(outApplayOrderNo)) {
String[] receiptsNums = outApplayOrderNo.split("-");
if (receiptsNums.length > 1) {
receiptsNum = receiptsNums[1];
}
} else {
receiptsNum = approveOrderNo.getActualOrderNo();
}
orderFlightRecord.setReceiptsNum(receiptsNum);
}
//获取财务共享单号
private String getReceiptsNum(String outApplayOrderNo, RouteOrder routeOrder) {
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
if (Objects.isNull(approveOrderNo)) {
if (StringUtils.isNotBlank(outApplayOrderNo)) {
String[] receiptsNums = outApplayOrderNo.split("-");
if (receiptsNums.length > 1) {
return receiptsNums[1];
}
}
return "";
}
return approveOrderNo.getActualOrderNo();
}
//映射付款方式
//支付类型(1:企业授信 / 2:个人支付 / 3组合支付)
public int getPaymentType(String payType) {

View File

@ -1,5 +1,6 @@
package com.chint.domain.service.order_record;
import com.chint.application.commands.LYOrderRecordGenerateCommand;
import com.chint.application.commands.OrderRecordGenerateCommand;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
@ -12,6 +13,7 @@ import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTra
import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory;
import com.chint.domain.factoriy.order_record.LyOrderRecordExtensionFactory;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +27,7 @@ import java.util.ArrayList;
import java.util.List;
@Component
public class LYOrderRecordDomainService implements OrderRecordDomainService {
public class LYOrderRecordDomainService {
@Autowired
private JdbcLyOrderFlightRecord jdbcLyOrderFlightRecord;
@ -46,9 +48,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService {
@Autowired
private OrderDetailDomainService orderDetailDomainService;
@Override
@Transactional
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
@ListenTo(command = "LYOrderRecordGenerateCommand", order = 0)
public List<OrderFlightRecord> generateFlightRecord(LYOrderRecordGenerateCommand command) {
ArrayList<OrderFlightRecord> orderFlightRecordList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
@ -75,9 +78,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService {
return orderFlightRecordList;
}
@Override
@Transactional
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
@ListenTo(command = "LYOrderRecordGenerateCommand", order = 1)
public List<OrderHotelRecord> generateHotelRecord(LYOrderRecordGenerateCommand command) {
ArrayList<OrderHotelRecord> orderHotelRecordList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
@ -104,9 +108,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService {
return orderHotelRecordList;
}
@Override
@Transactional
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
@ListenTo(command = "LYOrderRecordGenerateCommand", order = 2)
public List<OrderTrainRecord> generateTrainRecord(LYOrderRecordGenerateCommand command) {
ArrayList<OrderTrainRecord> orderTrainRecordsList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10
@ -134,9 +139,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService {
}
@Override
@Transactional
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
@ListenTo(command = "LYOrderRecordGenerateCommand", order = 3)
public List<OrderCarRecord> generateCarRecord(LYOrderRecordGenerateCommand command) {
ArrayList<OrderCarRecord> orderCarRecordsList = new ArrayList<>();
int count = 0;//初始化变量
int pageSize = 100; // 假设每页大小为10

View File

@ -0,0 +1,14 @@
package com.chint.infrastructure.constant;
public class OrderRecordConstant {
// 对应所属系统
public static final String LY_CUSTOM1 = "Custom1";
//核算企业code
public static final String LY_CUSTOM2 = "Custom2";
//核算企业名称
public static final String LY_CUSTOM3 = "Custom3";
//项目订单号
public static final String LY_CUSTOM4 = "Custom4";
}

View File

@ -1,6 +1,6 @@
package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemCarList;
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse;
import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo;
import lombok.AllArgsConstructor;
@ -71,7 +71,7 @@ public class CarStatement extends BaseResponse {
private Double ticketOutAmount;//票面
private Double serviceAmount;//服务费
private Double insuranceAmount;//保险
private List<TripSubmitItemList> tripSubmitItemList;//行程提交项
private List<TripSubmitItemCarList> tripSubmitItemList;//行程提交项
private String orderOperType;//类型 预订/变更/退票
private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3组合支付)
private Double totalShouldPay;//总计应付

View File

@ -1,6 +1,6 @@
package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemFlightList;
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse;
import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo;
import lombok.AllArgsConstructor;
@ -93,7 +93,7 @@ public class FlightStatement extends BaseResponse {
private Double ticketOutAmount;//票面
private Double serviceAmount;//服务费
private Double insuranceAmount;//保险
private List<TripSubmitItemList> tripSubmitItemList;//行程提交项
private List<TripSubmitItemFlightList> tripSubmitItemList;//行程提交项
private String orderOperType;//类型 预订/变更/退票
private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3组合支付)
private Double totalShouldPay;//总计应付

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemHotelList;
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse;
import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo;
import lombok.AllArgsConstructor;
@ -79,7 +80,7 @@ public class HotelStatement extends BaseResponse {
private Double ticketOutAmount;//票面
private Double serviceAmount;//服务费
private Double insuranceAmount;//保险
private List<TripSubmitItemList> tripSubmitItemList;//行程提交项
private List<TripSubmitItemHotelList> tripSubmitItemList;//行程提交项
private String orderOperType;//类型 预订/变更/退票
private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3组合支付)
private Double totalShouldPay;//总计应付

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList;
import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemTrainList;
import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse;
import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo;
import lombok.AllArgsConstructor;
@ -77,7 +78,7 @@ public class TrainStatement extends BaseResponse {
private Double ticketOutAmount;//票面
private Double serviceAmount;//服务费
private Double insuranceAmount;//保险
private List<TripSubmitItemList> tripSubmitItemList;//行程提交项
private List<TripSubmitItemTrainList> tripSubmitItemList;//行程提交项
private String orderOperType;//类型 预订/变更/退票
private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3组合支付)
private Double totalShouldPay;//总计应付