统计充值 日期问题修复

This commit is contained in:
tianfeng 2025-12-16 15:11:00 +08:00
parent 78a9cb9a8e
commit d0a76d1ac1

View File

@ -719,37 +719,30 @@ public final class TeamBillCycleUtils {
return String.format("%d年%d月%s", year, month, batchDesc); return String.format("%d年%d月%s", year, month, batchDesc);
} }
public static LocalDateTime getBillBelongStartTime(Integer billBelong) { public static LocalDateTime getBillBelongStartTime(Integer billBelong) {
int year, month; // billBelong 格式20251101 20251116
int year = billBelong / 10000; // 2025
int month = (billBelong / 100) % 100; // 11
int day = billBelong % 100; // 01 16
if (billBelong > 999999) { return LocalDateTime.of(year, month, day, 0, 0, 0);
// 8位格式20251016 }
year = billBelong / 10000;
month = (billBelong / 100) % 100; public static LocalDateTime getBillBelongEndTime(Integer billBelong) {
} else { // billBelong 格式20251101 20251116
// 6位格式202510 int year = billBelong / 10000; // 2025
year = billBelong / 100; int month = (billBelong / 100) % 100; // 11
month = billBelong % 100; int day = billBelong % 100; // 01 16
}
LocalDateTime startTime = LocalDateTime.of(year, month, 1, 0, 0, 0); LocalDateTime startTime = LocalDateTime.of(year, month, day, 0, 0, 0);
return startTime;
} if (day == 1) {
// 如果是1号结束时间是当月16号0点
public static LocalDateTime getBillBelongEndTime(Integer billBelong) { return LocalDateTime.of(year, month, 16, 0, 0, 0);
int year, month; } else {
// 如果是16号结束时间是下个月1号0点
if (billBelong > 999999) { return startTime.plusMonths(1).withDayOfMonth(1);
// 8位格式20251016
year = billBelong / 10000;
month = (billBelong / 100) % 100;
} else {
// 6位格式202510
year = billBelong / 100;
month = billBelong % 100;
}
LocalDateTime startTime = LocalDateTime.of(year, month, 1, 0, 0, 0);
LocalDateTime endTime = startTime.plusMonths(1).minusSeconds(1);
return endTime;
} }
}
} }