From 83b85ebe8d7c5cd66e88d61d5bbc95c9e256a352 Mon Sep 17 00:00:00 2001
From: longz <longzhaoz@qq.com>
Date: 星期二, 21 七月 2026 21:38:22 +0800
Subject: [PATCH] 充电时段统计fix
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java | 30 +++++++++++-------------------
1 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
index a6fda40..37cf4b7 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
@@ -145,20 +145,7 @@
@PostMapping(value = "/accountBillList")
@ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"})
public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) {
- AccountListVO accountListVO = new AccountListVO();
- ChargingBillVO res = chargingBillService.chargingBillList1(dto);
- List<ChargingBillListVO> records = res.getList().getRecords();
- accountListVO.setBillCount(records.size());
- accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getCommissionAmount()).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setPaymentAmount(res.getPaymentAmount().setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setRefundAmount(res.getRefundAmount().setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setCommissionAmount(res.getCommissionAmount().setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setSharingAmount(res.getSharingAmount().setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setPlatformIncome(res.getPlatformIncome().setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setPartnerIncome(res.getPartnerIncome().setScale(2, BigDecimal.ROUND_DOWN));
- accountListVO.setList(res.getList());
- accountListVO.setOrderList(res.getExportList());
- return R.ok(accountListVO);
+ return R.ok(chargingBillService.accountSettlementBillList(dto));
}
@@ -262,7 +249,9 @@
@PutMapping("/exportAccount")
public void exportAccount(@RequestBody ChargingListQuery dto)
{
- ChargingBillVO res = chargingBillService.chargingBillList1(dto);
+ dto.setPageCurr(1);
+ dto.setPageSize(100000);
+ AccountListVO res = chargingBillService.accountSettlementBillList(dto);
List<ChargingBillListVO> list = res.getList().getRecords();
List<TChargingBillExport> tChargingBillExports = new ArrayList<>();
for (ChargingBillListVO orderInvoiceVO : list) {
@@ -285,7 +274,7 @@
tChargingBillExport.setElectrovalence(orderInvoiceVO.getElectrovalence());
tChargingBillExport.setServiceCharge(orderInvoiceVO.getServiceCharge());
tChargingBillExport.setChargingCapacity(orderInvoiceVO.getChargingCapacity());
- Integer chargingSecond = orderInvoiceVO.getChargingSecond();
+ Integer chargingSecond = Optional.ofNullable(orderInvoiceVO.getChargingSecond()).orElse(0);
// 根据秒数 转换为xx小时xx分钟xx秒 如果小时为0不展示 如果分钟为0则不展示
// 计算小时、分钟和秒
int hours = chargingSecond / 60 / 60;
@@ -304,7 +293,8 @@
}
tChargingBillExport.setChargingTime(result.toString());
tChargingBillExport.setOrderCount(orderInvoiceVO.getOrderCount());
- tChargingBillExport.setBillTime(orderInvoiceVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ tChargingBillExport.setBillTime(orderInvoiceVO.getCreateTime() == null ? "-"
+ : orderInvoiceVO.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
tChargingBillExports.add(tChargingBillExport);
}
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TChargingBillExport.class, tChargingBillExports);
@@ -313,7 +303,7 @@
response.setCharacterEncoding("utf-8");
ServletOutputStream outputStream = null;
try {
- String fileName = URLEncoder.encode("月账单-"+res.getCategory()+"-"+res.getBillWeek()+"-"+res.getSiteName()+".xls", "utf-8");
+ String fileName = URLEncoder.encode("账户结算账单.xls", "utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setHeader("Pragma", "no-cache");
@@ -324,7 +314,9 @@
e.printStackTrace();
} finally {
try {
- outputStream.close();
+ if (outputStream != null) {
+ outputStream.close();
+ }
} catch (IOException e) {
e.printStackTrace();
}
--
Gitblit v1.7.1