统计充值 日期问题修复

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);
}
public static LocalDateTime getBillBelongStartTime(Integer billBelong) {
int year, month;
public static LocalDateTime getBillBelongStartTime(Integer billBelong) {
// billBelong 格式20251101 20251116
int year = billBelong / 10000; // 2025
int month = (billBelong / 100) % 100; // 11
int day = billBelong % 100; // 01 16
if (billBelong > 999999) {
// 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);
return startTime;
}
public static LocalDateTime getBillBelongEndTime(Integer billBelong) {
int year, month;
if (billBelong > 999999) {
// 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;
return LocalDateTime.of(year, month, day, 0, 0, 0);
}
public static LocalDateTime getBillBelongEndTime(Integer billBelong) {
// billBelong 格式20251101 20251116
int year = billBelong / 10000; // 2025
int month = (billBelong / 100) % 100; // 11
int day = billBelong % 100; // 01 16
LocalDateTime startTime = LocalDateTime.of(year, month, day, 0, 0, 0);
if (day == 1) {
// 如果是1号结束时间是当月16号0点
return LocalDateTime.of(year, month, 16, 0, 0, 0);
} else {
// 如果是16号结束时间是下个月1号0点
return startTime.plusMonths(1).withDayOfMonth(1);
}
}
}