From 5b2d92965d917b34030be01c0ff70a4f0ceb487e Mon Sep 17 00:00:00 2001 From: dengwc Date: Wed, 3 Apr 2024 17:32:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LyOrderRecordExtensionFactory.java | 22 ++++++++---- .../order_record/LyStatementOrder.java | 35 +++++++++++-------- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index ce9160f7..712940f1 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -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 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 diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java b/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java index 4c50986d..cf86ff09 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java @@ -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 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 statementOrderList = flightStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List 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 statementOrderList = hotelStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List 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 statementOrderList = trainStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List 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 statementOrderList = carStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -205,7 +212,7 @@ public class LyStatementOrder { } -/* //保存需要的机票订单明细字段 + //保存需要的机票订单明细字段 private void saveLyOrderFlightDetail(List lyOrderFlightRecords) { lyOrderFlightRecords.forEach(lyOrderFlightRecord -> { lySearchRequest.getFlightOrderDetail(lyOrderFlightRecord.getOrderSerialNo()); @@ -236,5 +243,5 @@ public class LyStatementOrder { lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo()); }); - }*/ + } }