结算标题更改

This commit is contained in:
tianfeng 2025-12-01 10:43:31 +08:00
parent 5c67f66d32
commit 84f57ee119

View File

@ -314,31 +314,31 @@ public class TeamBdHistoryServiceImpl implements TeamBdHistoryService {
/**
* 格式化结算周期为日期范围
* 例如202501 -> 2025.10.01-2025.10.15
* 202502 -> 2025.10.16-2025.10.31
* 例如: 20251101 -> 2025.11.01-2025.11.15
* 20251116 -> 2025.11.16-2025.11.30
*/
private String formatPeriod(Integer billBelong) {
if (billBelong == null) {
return "";
}
int year = billBelong / 10000;
int period = billBelong % 100;
int month = (period + 1) / 2;
boolean isFirstHalf = (period % 2 == 1);
int year = billBelong / 10000; // 2025
int month = (billBelong / 100) % 100; // 11
int day = billBelong % 100; // 01 16
LocalDate startDate, endDate;
if (isFirstHalf) {
if (day == 1) {
// 上半月: 1-15号
startDate = LocalDate.of(year, month, 1);
endDate = LocalDate.of(year, month, 15);
} else {
// 下半月: 16-月末
startDate = LocalDate.of(year, month, 16);
endDate = LocalDate.of(year, month, startDate.lengthOfMonth());
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd");
return startDate.format(formatter).replace("+", "") + "-" + endDate.format(formatter).replace("+", "");
return startDate.format(formatter) + "-" + endDate.format(formatter);
}
/**