Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
lulz1 2024-04-07 17:15:26 +08:00
commit 1d71d772a9
2 changed files with 34 additions and 8 deletions

View File

@ -42,6 +42,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
@Autowired @Autowired
private JdbcRouteRepository jdbcRouteRepository; private JdbcRouteRepository jdbcRouteRepository;
@Autowired
private OrderRecordFactory orderRecordFactory;
@Autowired @Autowired
private JdbcOrderTravelRepository orderTravelRepository; private JdbcOrderTravelRepository orderTravelRepository;
@ -124,7 +126,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称 .setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称
.setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价 .setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价
.setFlightNum(lyOrderFlightRecord.getFligthNo())//航班号 .setFlightNum(lyOrderFlightRecord.getFligthNo())//航班号
.setOrderAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount())) //结算总额 .setOrderAmount(String.valueOf(lyOrderFlightRecord.getTicketTotalAmount())) //结算总额
.setFacePrice(String.valueOf(lyOrderFlightRecord.getTicketOutAmount())) //票面价 .setFacePrice(String.valueOf(lyOrderFlightRecord.getTicketOutAmount())) //票面价
.setNoTaxAmt(String.valueOf(BigDecimal.valueOf(lyOrderFlightRecord.getTicketTotalAmount() == null ? 0 : lyOrderFlightRecord.getTicketTotalAmount()) .setNoTaxAmt(String.valueOf(BigDecimal.valueOf(lyOrderFlightRecord.getTicketTotalAmount() == null ? 0 : lyOrderFlightRecord.getTicketTotalAmount())
.subtract(BigDecimal.valueOf(lyOrderFlightRecord.getTicketDeductibleTax() == null ? 0 : lyOrderFlightRecord.getTicketDeductibleTax())))) //未税金额 .subtract(BigDecimal.valueOf(lyOrderFlightRecord.getTicketDeductibleTax() == null ? 0 : lyOrderFlightRecord.getTicketDeductibleTax())))) //未税金额
@ -152,7 +154,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setOrderStatus("") //结算状态 .setOrderStatus("") //结算状态
// .setExpenseOrderAmount("") //订单金额 // .setExpenseOrderAmount("") //订单金额
// .setSettleOrderFlag() //订单对账状态 // .setSettleOrderFlag() //订单对账状态
.setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount() + lyOrderFlightRecord.getServiceAmount()))//支付金额 .setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount()))//支付金额
; ;
//订单明细字段赋值 //订单明细字段赋值
setFlightRecordDetail(orderFlightRecord, flightOrderDetail); setFlightRecordDetail(orderFlightRecord, flightOrderDetail);
@ -228,7 +230,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
.setRoomRate(String.valueOf(lyOrderHotelRecord.getTotalRoomPrice())) //房费订单总额减总服务费 .setRoomRate(String.valueOf(lyOrderHotelRecord.getTotalRoomPrice())) //房费订单总额减总服务费
.setNoTaxAmt("") //不含税价 .setNoTaxAmt("") //不含税价
.setTaxAmt("") //税费 .setTaxAmt("") //税费
.setInvoiceType("") //供应商发票类型 .setInvoiceType(readInvoiceType(lyOrderHotelRecord.getCustomerInvoiceType())) //供应商发票类型
.setInvoiceFee("") //开票手续费 .setInvoiceFee("") //开票手续费
.setCustodayFee("") //托管费 .setCustodayFee("") //托管费
.setNoTaxCusFee("") //托管费不含税 .setNoTaxCusFee("") //托管费不含税
@ -625,4 +627,12 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor
}; };
} }
//供应商发票类型
public String readInvoiceType(Integer type) {
return switch (type) {
case 0 -> "增值税普通发票";
case 1 -> "增值税专用发票";
default -> "未知发票";
};
}
} }

View File

@ -29,6 +29,9 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@Service @Service
@ -94,15 +97,28 @@ public class LyStatementOrder {
String endTime = LocalDateTime.now().format(formatter); String endTime = LocalDateTime.now().format(formatter);
for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) { for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) {
String statementCode = onlineStatement.getStatementCode();//对账单编码 String statementCode = onlineStatement.getStatementCode();//对账单编码
// 提交任务给线程池处理
// 定义线程池可以根据实际情况调整线程数量
ExecutorService executor = Executors.newFixedThreadPool(4); // 创建一个包含4个线程的线程池
//1.查询机票账单详情 //1.查询机票账单详情
flightStatement(statementCode, startTime, endTime); executor.submit(() -> flightStatement(statementCode, startTime, endTime));
//2.查询酒店账单详情 //2.查询酒店账单详情
hotelStatement(statementCode, startTime, endTime); executor.submit(() -> hotelStatement(statementCode, startTime, endTime));
//3.查询火车票账单详情 //3.查询火车票账单详情
trainStatement(statementCode, startTime, endTime); executor.submit(() -> trainStatement(statementCode, startTime, endTime));
//4.查询用车账单详情 //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("保存成功!"); log.info("保存成功!");
} }