From dd419a48b8f1b8ce5bd3906ea81ad32575929cb0 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 07 一月 2025 18:05:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java | 59 +++++++++++------------------
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java | 15 ++-----
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java | 17 +++-----
3 files changed, 33 insertions(+), 58 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 2f1c19e..6c2f211 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
@@ -343,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>()
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
index 083d681..c5eed9e 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingBillServiceImpl.java
@@ -188,20 +188,16 @@
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)
.eq("status", 5)
@@ -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)
@@ -637,20 +628,16 @@
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)
.eq("status", 5)
@@ -850,20 +837,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)
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java
index 526144c..24247db 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/task/TaskUtil.java
@@ -40,13 +40,8 @@
private TChargingOrderService chargingOrderService;
- // 每月2号凌晨12点执行的定时任务
-// @Scheduled(cron = "0 0 0 2 * ?")
- // 每天凌晨12点执行的定时任务
-
-@Scheduled(cron = "0 0 0 * * ?")
-//@Scheduled(fixedRate = 60000)
+ @Scheduled(cron = "0 0 0 2 * ?")
public void taskMonth() {
try {
// 获取上个月的开始和结束日期
@@ -135,7 +130,7 @@
}
}
- // 每天晚上23:59:59执行的定时任务
+ // 每个月最后一天凌晨23点执行的定时任务
@Scheduled(cron = "0 0 23 * * ?")
public void taskLastDay() {
try {
@@ -149,10 +144,10 @@
LocalDateTime endDateTime = lastDayOfLastMonth.atTime(23, 59, 59); // 设定到最后一秒
// 构建查询条件
LambdaQueryWrapper<TChargingBill> queryWrapper = new LambdaQueryWrapper<>();
-// queryWrapper.ge(TChargingBill::getBillTime,
-// Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()))
-// .le(TChargingBill::getBillTime,
-// Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())); // 使用 le 包括最后一天的记录
+ queryWrapper.ge(TChargingBill::getBillTime,
+ Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()))
+ .le(TChargingBill::getBillTime,
+ Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())); // 使用 le 包括最后一天的记录
List<TChargingBill> list = chargingBillService.list(queryWrapper);
for (TChargingBill tChargingBill : list) {
tChargingBill.setStatus(2);
--
Gitblit v1.7.1