结算标题更改
This commit is contained in:
parent
5c67f66d32
commit
84f57ee119
@ -314,31 +314,31 @@ public class TeamBdHistoryServiceImpl implements TeamBdHistoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化结算周期为日期范围
|
* 格式化结算周期为日期范围
|
||||||
* 例如:202501 -> 2025.10.01-2025.10.15
|
* 例如: 20251101 -> 2025.11.01-2025.11.15
|
||||||
* 202502 -> 2025.10.16-2025.10.31
|
* 20251116 -> 2025.11.16-2025.11.30
|
||||||
*/
|
*/
|
||||||
private String formatPeriod(Integer billBelong) {
|
private String formatPeriod(Integer billBelong) {
|
||||||
if (billBelong == null) {
|
if (billBelong == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
int year = billBelong / 10000;
|
int year = billBelong / 10000; // 2025
|
||||||
int period = billBelong % 100;
|
int month = (billBelong / 100) % 100; // 11
|
||||||
|
int day = billBelong % 100; // 01 或 16
|
||||||
int month = (period + 1) / 2;
|
|
||||||
boolean isFirstHalf = (period % 2 == 1);
|
|
||||||
|
|
||||||
LocalDate startDate, endDate;
|
LocalDate startDate, endDate;
|
||||||
if (isFirstHalf) {
|
if (day == 1) {
|
||||||
|
// 上半月: 1-15号
|
||||||
startDate = LocalDate.of(year, month, 1);
|
startDate = LocalDate.of(year, month, 1);
|
||||||
endDate = LocalDate.of(year, month, 15);
|
endDate = LocalDate.of(year, month, 15);
|
||||||
} else {
|
} else {
|
||||||
|
// 下半月: 16-月末
|
||||||
startDate = LocalDate.of(year, month, 16);
|
startDate = LocalDate.of(year, month, 16);
|
||||||
endDate = LocalDate.of(year, month, startDate.lengthOfMonth());
|
endDate = LocalDate.of(year, month, startDate.lengthOfMonth());
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd");
|
||||||
return startDate.format(formatter).replace("+", "") + "-" + endDate.format(formatter).replace("+", "");
|
return startDate.format(formatter) + "-" + endDate.format(formatter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user