puzhibing
2025-02-11 36e7b299289c393c3460140dc966e83f9ea2e749
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -188,22 +188,18 @@
            chargingBillListVO.setUid(chargingBillListVO.getId().toString());
            // 根据账单的出账时间 查询上个月的充电订单
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
            // todo 临时修改为查询昨天的充电订单
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            // 账单周期
            chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            // 获取 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());
            QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>()
                    .between("create_time", firstDayOfMonth, lastDayOfMonth)
                    .between("pay_time", firstDayOfMonth.atTime(0, 0, 0), lastDayOfMonth.atTime(23, 59, 59))
                    .eq("status", 5)
                    .eq("recharge_payment_status", 2);
            if (chargingBillListVO.getType() == 2) {
@@ -320,6 +316,8 @@
                        tChargingOrder.setLicensePlate(data4.get(0).getLicensePlate());
                        tChargingOrder.setVehicleModel(data4.get(0).getVehicleModel());
                    }
                }else{
                    tChargingOrder.setLicensePlate(tChargingOrder.getPlateNum());
                }
                if (data3!=null)tChargingOrder.setUserName(data3.getName());
                // 累加实收金额 支付结算金额
@@ -417,20 +415,15 @@
            chargingBillVO.setBillWeek(billTime.minusMonths(1).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            chargingBillListVO.setUid(chargingBillListVO.getId().toString());
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
            // todo 临时修改为查询昨天的充电订单
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
            // 账单周期
            chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            // 获取 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());
            QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>()
                    .between("create_time", firstDayOfMonth, lastDayOfMonth)
                    .eq("status", 5)
@@ -513,6 +506,7 @@
        chargingBillVO.setList(pageInfo);
        return chargingBillVO;
    }
    @Override
    public ChargingBillVO chargingBillList(ChargingListQuery dto) {
@@ -637,22 +631,18 @@
            chargingBillListVO.setUid(chargingBillListVO.getId().toString());
            // 根据账单的出账时间 查询上个月的充电订单
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
            // todo 临时修改为查询昨天的充电订单
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            // 账单周期
            chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            // 获取 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());
            QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>()
                    .between("create_time", firstDayOfMonth, lastDayOfMonth)
                    .between("pay_time", firstDayOfMonth.atTime(0, 0, 0), lastDayOfMonth.atTime(23, 59, 59))
                    .eq("status", 5)
                    .eq("recharge_payment_status", 2);
            if (chargingBillListVO.getType() == 2) {
@@ -768,6 +758,8 @@
                        tChargingOrder.setLicensePlate(data4.get(0).getLicensePlate());
                        tChargingOrder.setVehicleModel(data4.get(0).getVehicleModel());
                    }
                }else{
                    tChargingOrder.setLicensePlate(tChargingOrder.getPlateNum());
                }
                if (data3!=null)tChargingOrder.setUserName(data3.getName());
                if ( tChargingOrder.getPaymentAmount()!=null){
@@ -850,20 +842,18 @@
            chargingBillListVO.setUid(chargingBillListVO.getId().toString());
            // 根据账单的出账时间 查询上个月的充电订单
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
            // todo 临时修改为查询昨天的充电订单
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1);
//            LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1);
            // 账单周期
            chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM")));
            // 获取 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());
//            LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN);
//            LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX);
            QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>()
                    .between("create_time", firstDayOfMonth, lastDayOfMonth)
                    .eq("status", 5)
@@ -945,11 +935,15 @@
    }
    public static void main(String[] args) {
        int i = 8 % 20;
        System.err.println(i);
        LocalDateTime now = LocalDateTime.now();
        // 将时间转化为字符串 只保留年月日 格式为yyyy-MM-dd
        String format = now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        LocalDateTime localDateTime = LocalDateTime.now().minusMonths(1);
        // 获取 LocalDate 对象
        LocalDate date = localDateTime.toLocalDate();
//            // 获取该月份的第一天
        LocalDate firstDayOfMonth = date.withDayOfMonth(1);
        // 获取该月份的最后一天
        LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth());
        System.err.println(firstDayOfMonth);
        System.err.println(lastDayOfMonth);
    }
}