From f922c6d987faf1c3d5d8c4240f53bfcbae9e40e5 Mon Sep 17 00:00:00 2001 From: dengwc Date: Sun, 7 Apr 2024 16:09:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=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 | 6 +++-- .../order_record/LyStatementOrder.java | 26 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 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 fc4069c7..12eb5dbf 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 @@ -41,6 +41,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor @Autowired private JdbcRouteRepository jdbcRouteRepository; + @Autowired + private OrderRecordFactory orderRecordFactory; @Autowired private JdbcOrderTravelRepository orderTravelRepository; @@ -120,7 +122,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称 .setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价 .setFlightNum(lyOrderFlightRecord.getFligthNo())//航班号 - .setOrderAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount())) //结算总额 + .setOrderAmount(String.valueOf(lyOrderFlightRecord.getTicketTotalAmount())) //结算总额 .setFacePrice(String.valueOf(lyOrderFlightRecord.getTicketOutAmount())) //票面价 .setNoTaxAmt(String.valueOf(BigDecimal.valueOf(lyOrderFlightRecord.getTicketTotalAmount() == null ? 0 : lyOrderFlightRecord.getTicketTotalAmount()) .subtract(BigDecimal.valueOf(lyOrderFlightRecord.getTicketDeductibleTax() == null ? 0 : lyOrderFlightRecord.getTicketDeductibleTax())))) //未税金额 @@ -148,7 +150,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setOrderStatus("") //结算状态 // .setExpenseOrderAmount("") //订单金额 // .setSettleOrderFlag() //订单对账状态 - .setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount() + lyOrderFlightRecord.getServiceAmount()))//支付金额 + .setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount()))//支付金额 ; //订单明细字段赋值 setFlightRecordDetail(orderFlightRecord, flightOrderDetail); 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 cf86ff09..9a6acf64 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 @@ -29,6 +29,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; @Slf4j @Service @@ -94,15 +97,28 @@ public class LyStatementOrder { String endTime = LocalDateTime.now().format(formatter); for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) { String statementCode = onlineStatement.getStatementCode();//对账单编码 + // 提交任务给线程池处理 + // 定义线程池,可以根据实际情况调整线程数量 + ExecutorService executor = Executors.newFixedThreadPool(4); // 创建一个包含4个线程的线程池 //1.查询机票账单详情 - flightStatement(statementCode, startTime, endTime); + executor.submit(() -> flightStatement(statementCode, startTime, endTime)); //2.查询酒店账单详情 - hotelStatement(statementCode, startTime, endTime); + executor.submit(() -> hotelStatement(statementCode, startTime, endTime)); //3.查询火车票账单详情 - trainStatement(statementCode, startTime, endTime); + executor.submit(() -> trainStatement(statementCode, startTime, endTime)); //4.查询用车账单详情 - carStatement(statementCode, startTime, endTime); - + executor.submit(() -> carStatement(statementCode, startTime, endTime)); + // 关闭线程池 + executor.shutdown(); + try { + // 等待所有任务执行完成或者超时时间到达(这里设置为一天) + boolean flag = executor.awaitTermination(1, TimeUnit.HOURS); + } catch (InterruptedException e) { + // 处理中断异常 + log.error(e.getMessage()); + // 强制关闭线程池 + executor.shutdownNow(); + } } log.info("保存成功!"); } From 9aa97824261f37ca0177db29db3fd8eae34d1249 Mon Sep 17 00:00:00 2001 From: dengwc Date: Sun, 7 Apr 2024 17:11:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=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 --- .../order_record/LyOrderRecordExtensionFactory.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 12eb5dbf..96f296c1 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 @@ -226,7 +226,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setRoomRate(String.valueOf(lyOrderHotelRecord.getTotalRoomPrice())) //房费(订单总额减总服务费) .setNoTaxAmt("") //不含税价 .setTaxAmt("") //税费 - .setInvoiceType("") //供应商发票类型 + .setInvoiceType(readInvoiceType(lyOrderHotelRecord.getCustomerInvoiceType())) //供应商发票类型 .setInvoiceFee("") //开票手续费 .setCustodayFee("") //托管费 .setNoTaxCusFee("") //托管费不含税 @@ -623,4 +623,12 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor }; } + //供应商发票类型 + public String readInvoiceType(Integer type) { + return switch (type) { + case 0 -> "增值税普通发票"; + case 1 -> "增值税专用发票"; + default -> "未知发票"; + }; + } }