puzhibing
2025-02-05 74b0e0814e37d640596f44ec86d20fa9ecce9ed6
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
@@ -16,6 +16,8 @@
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.Logical;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.order.api.model.*;
import com.ruoyi.order.api.query.TOrderInvoiceQuery;
import com.ruoyi.order.api.vo.AccountListVO;
@@ -139,6 +141,9 @@
//        chargingBillService.save(tChargingBill14);
        return R.ok();
    }
    @RequiresPermissions(value = {"/accountSettlementStatement"}, logical = Logical.OR)
    @PostMapping(value = "/accountBillList")
    @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"})
    public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) {
@@ -155,6 +160,8 @@
        accountListVO.setOrderList(res.getExportList());
        return R.ok(accountListVO);
    }
    @RequiresPermissions(value = {"/chargeBill"}, logical = Logical.OR)
    @PostMapping(value = "/chargingBillList")
    @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"})
    public AjaxResult<ChargingBillVO> chargingBillList(@RequestBody ChargingListQuery dto) {
@@ -170,10 +177,14 @@
    public R<ChargingBillVO> chargingBillListExport(String uid) {
        return R.ok(null);
    }
    @RequiresPermissions(value = {"/chargeBill/export"}, logical = Logical.OR)
    @ApiOperation(value = "导出", tags = {"管理后台-充电算账单"})
    @PutMapping("/export")
    public void export(@RequestBody ChargingListQuery dto)
    {
        ChargingBillVO res = chargingBillService.chargingBillList(dto);
        List<ChargingBillListVO> list = res.getList().getRecords();
        List<TChargingBillExport> tChargingBillExports = new ArrayList<>();
@@ -233,6 +244,9 @@
            }
        }
    }
    @RequiresPermissions(value = {"/accountSettlementStatement/export"}, logical = Logical.OR)
    @ApiOperation(value = "导出", tags = {"管理后台-账户结算账单"})
    @PutMapping("/exportAccount")
    public void exportAccount(@RequestBody ChargingListQuery dto)
@@ -304,6 +318,8 @@
        }
    }
    @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"})
    @PutMapping("/download")
    public void download(@RequestBody ExportUidDto uid)
@@ -327,23 +343,18 @@
            chargingBillExport.setSiteName(data.get(0).getName());
        }
//        // 根据账单的出账时间 查询上个月的充电订单
//        LocalDateTime localDate = byId.getBillTime().minusMonths(1);
        LocalDateTime localDate = byId.getBillTime().minusMonths(1);
//        // 账单周期
//        // 获取 LocalDate 对象
//        LocalDate date = localDate.toLocalDate();
//        // 获取该月份的第一天
//        LocalDate firstDayOfMonth = date.withDayOfMonth(1);
         LocalDateTime localDate = byId.getBillTime().minusDays(1);
        // todo 临时修改为前一天
        // 获取 LocalDate 对象
        LocalDate date = localDate.toLocalDate();
//            // 获取该月份的第一天
//            LocalDate firstDayOfMonth = date.withDayOfMonth(1);
//            // 获取该月份的最后一天
//            LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth());
        // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59
        LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN);
        LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX);
            // 获取该月份的第一天
            LocalDate firstDayOfMonth = date.withDayOfMonth(1);
            // 获取该月份的最后一天
            LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth());
        // 获取该月份的最后一天
//        LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth());
        QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>()