From 84f57ee11937767d8598ac8565fd457cc4ec1608 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 1 Dec 2025 10:43:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=A0=87=E9=A2=98=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/TeamBdHistoryServiceImpl.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/team/TeamBdHistoryServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/team/TeamBdHistoryServiceImpl.java index f81ddbeb..8a649c68 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/team/TeamBdHistoryServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/team/TeamBdHistoryServiceImpl.java @@ -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); } /**