结算明细字段映射调整

This commit is contained in:
dengwc 2024-04-03 17:32:53 +08:00
parent d7a607571b
commit 2dfc9e0490
2 changed files with 37 additions and 20 deletions

View File

@ -8,6 +8,7 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.*;
import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.util.BeanCopyUtils;
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,8 +23,9 @@ 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.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.OrderRecordConstant.*;
import static com.chint.infrastructure.constant.RankConstant.OUT_OF_STANDARD;
/**
* 同程数据转换
@ -133,7 +135,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setPreServiceFee(String.valueOf(lyOrderFlightRecord.getServiceAmount())) //服务费
.setPostServiceFee("") //配送服务费
.setAirportTax(String.valueOf(lyOrderFlightRecord.getCapitalCost())) //机建费
.setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee())) //改签手续费
.setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee() - lyOrderFlightRecord.getUpgradeFee())) //改签手续费
.setFuelTax(String.valueOf(lyOrderFlightRecord.getFuelCost())) //燃油费
.setRefundFee(String.valueOf(lyOrderFlightRecord.getRefundFee())) //退票手续费
.setUpFee(String.valueOf(lyOrderFlightRecord.getUpgradeFee())) //改签差价
@ -371,7 +373,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
if (Objects.isNull(routeOrder)) {
return new OrderRecordBasic();
}
return orderRecordFactory.buildWithRouteOrder(routeOrder);
// return orderRecordFactory.buildWithRouteOrder(routeOrder);
return new OrderRecordBasic();
}
//获取账期号 202403
@ -485,13 +488,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
//对应所属系统
public String findBelongSysType(List<TripSubmitItemList> itemList, String outApplayOrderNo) {
return itemList.stream()
String sysCode = itemList.stream()
.filter(item -> LY_CUSTOM1.equals(item.getCode()))
.findFirst()
.map(TripSubmitItemList::getContent)
.map(item -> StringUtils.isBlank(item.getContent()) ? null : item.getContent())
.orElseGet(() -> Optional.ofNullable(outApplayOrderNo)
.map(no -> no.split("-")[0])
.orElse(""));
.orElse("NOT"));
return switch (sysCode) {
case BELONG_SYS_CODE_FSSC -> BELONG_SYS_TYPE_FSSC;
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";
};
}
//核算企业code

View File

@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@ -85,16 +86,22 @@ public class LyStatementOrder {
ResStatementList resStatementList = reqStatement.queryStatementList(statementList);
log.info("resStatementList: {}", resStatementList);
ArrayList<ResStatementList.OnlineStatementList> onlineStatementList = resStatementList.getData().getOnlineStatementList();
// 获取当前时间
LocalDate now = LocalDate.now();
LocalDate startDate = now.minusMonths(2).withDayOfMonth(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTime = startDate.atStartOfDay().format(formatter);
String endTime = LocalDateTime.now().format(formatter);
for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) {
String statementCode = onlineStatement.getStatementCode();//对账单编码
//1.查询机票账单详情
flightStatement(statementCode, beginDate, endDate);
flightStatement(statementCode, startTime, endTime);
//2.查询酒店账单详情
hotelStatement(statementCode, beginDate, endDate);
hotelStatement(statementCode, startTime, endTime);
//3.查询火车票账单详情
trainStatement(statementCode, beginDate, endDate);
trainStatement(statementCode, startTime, endTime);
//4.查询用车账单详情
carStatement(statementCode, beginDate, endDate);
carStatement(statementCode, startTime, endTime);
}
log.info("保存成功!");
@ -103,7 +110,7 @@ public class LyStatementOrder {
/**
* 飞机账单同步
*/
public void flightStatement(String statementCode, String beginDate, String endDate) {
public void flightStatement(String statementCode, String startTime, String endTime) {
int flightCount = 0;//初始化变量
int flightPageCount;//飞机总分页数
do {
@ -114,7 +121,7 @@ public class LyStatementOrder {
//保存数据
List<FlightStatement.StatementOrderList> statementOrderList = flightStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<FlightStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -129,7 +136,7 @@ public class LyStatementOrder {
/**
* 酒店账单同步
*/
public void hotelStatement(String statementCode, String beginDate, String endDate) {
public void hotelStatement(String statementCode, String startTime, String endTime) {
int hotelCount = 0;//初始化变量
int hotelPageCount;//酒店总分页数
do {
@ -139,7 +146,7 @@ public class LyStatementOrder {
//保存数据
List<HotelStatement.StatementOrderList> statementOrderList = hotelStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<HotelStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -155,7 +162,7 @@ public class LyStatementOrder {
/**
* 火车账单同步
*/
public void trainStatement(String statementCode, String beginDate, String endDate) {
public void trainStatement(String statementCode, String startTime, String endTime) {
int trainCount = 0;//初始化变量
int trainPageCount;//酒店总分页数
do {
@ -165,7 +172,7 @@ public class LyStatementOrder {
//保存数据
List<TrainStatement.StatementOrderList> statementOrderList = trainStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<TrainStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -181,7 +188,7 @@ public class LyStatementOrder {
/**
* 用车账单同步
*/
public void carStatement(String statementCode, String beginDate, String endDate) {
public void carStatement(String statementCode, String startTime, String endTime) {
int carCount = 0;//初始化变量
int carPageCount;//酒店总分页数
do {
@ -191,7 +198,7 @@ public class LyStatementOrder {
//保存数据
List<CarStatement.StatementOrderList> statementOrderList = carStatement.getData().getStatementOrderList();
//查询已经保存的数据
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(beginDate, endDate);
List<String> orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startTime, endTime);
//过滤出已经保存的数据
List<CarStatement.StatementOrderList> statementOrderListNew = statementOrderList.stream().filter(o ->
!orderSerialNoList.contains(o.getBillOrderNo())
@ -205,7 +212,7 @@ public class LyStatementOrder {
}
/* //保存需要的机票订单明细字段
//保存需要的机票订单明细字段
private void saveLyOrderFlightDetail(List<LyOrderFlightRecord> lyOrderFlightRecords) {
lyOrderFlightRecords.forEach(lyOrderFlightRecord -> {
lySearchRequest.getFlightOrderDetail(lyOrderFlightRecord.getOrderSerialNo());
@ -236,5 +243,5 @@ public class LyStatementOrder {
lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo());
});
}*/
}
}