无关风月
2025-01-17 b2738da3832b84beb0bc657b4a6bcf0c7ca152b0
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) {
@@ -417,20 +413,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 +504,7 @@
        chargingBillVO.setList(pageInfo);
        return chargingBillVO;
    }
    @Override
    public ChargingBillVO chargingBillList(ChargingListQuery dto) {
@@ -637,22 +629,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) {
@@ -850,20 +838,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 +931,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);
    }
}