From 1b997c6b026dc7a897f0b248413054d006af8028 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期六, 03 十月 2026 21:23:15 +0800
Subject: [PATCH] fix(holiday): 快报累计正文单位由亿人次改为万人次
---
traffic-audit-server/src/main/java/com/trafficaudit/holiday/service/HolidayBulletinService.java | 43 +++++++++++++++++++++++++++++++++----------
1 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/traffic-audit-server/src/main/java/com/trafficaudit/holiday/service/HolidayBulletinService.java b/traffic-audit-server/src/main/java/com/trafficaudit/holiday/service/HolidayBulletinService.java
index 1ef5884..f99c55d 100644
--- a/traffic-audit-server/src/main/java/com/trafficaudit/holiday/service/HolidayBulletinService.java
+++ b/traffic-audit-server/src/main/java/com/trafficaudit/holiday/service/HolidayBulletinService.java
@@ -31,6 +31,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
@@ -77,8 +78,6 @@
}
String currentTotal = formatNumber(current.getTotalPersonFlow());
- String cumulativeTotalYi = formatNumber(currentCumulative.getTotalPersonFlow() == null
- ? null : HolidayNumberUtils.divide(currentCumulative.getTotalPersonFlow(), BigDecimal.valueOf(10000)));
String ringRatioClause = previousDay == null ? "" : "锛岀幆姣�" + ratioPhrase(
current.getTotalPersonFlow(), previousDay.getTotalPersonFlow());
String paragraph1 = String.format("%d鏈�%d鏃ワ紙鍋囨湡绗�%d澶╋級锛屽叏鐪佸叏绀句細璺ㄥ尯鍩熶汉鍛樻祦鍔ㄩ噺%s涓囦汉娆�%s锛屾瘮2025骞村悓鏈�%s锛屾瘮2024骞村悓鏈�%s銆�",
@@ -86,12 +85,7 @@
ringRatioClause,
ratioPhrase(current.getTotalPersonFlow(), previousYear == null ? null : previousYear.getTotalPersonFlow()),
ratioPhrase(current.getTotalPersonFlow(), twoYearsAgo == null ? null : twoYearsAgo.getTotalPersonFlow()));
- String paragraph2 = String.format("鍋囨湡浠ユ潵锛屽叏鐪佸叏绀句細璺ㄥ尯鍩熶汉鍛樻祦鍔ㄩ噺绱%s浜夸汉娆★紝姣�2025骞村悓鏈�%s锛屾瘮2024骞村悓鏈�%s銆�",
- cumulativeTotalYi,
- ratioPhrase(currentCumulative.getTotalPersonFlow(),
- previousYearCumulative == null ? null : previousYearCumulative.getTotalPersonFlow()),
- ratioPhrase(currentCumulative.getTotalPersonFlow(),
- twoYearsAgoCumulative == null ? null : twoYearsAgoCumulative.getTotalPersonFlow()));
+ String paragraph2 = cumulativeParagraph(currentCumulative, previousYearCumulative, twoYearsAgoCumulative);
File template = resolveTemplateFile();
if (!template.exists() || !template.isFile()) {
@@ -131,6 +125,10 @@
if (table == null) {
throw new IllegalArgumentException("蹇姤妯℃澘涓壘涓嶅埌鏁版嵁琛�");
}
+ DailyMetrics previousYearCivilCumulative = comparableCumulative(
+ current, previousYear, DailyMetrics::getCivilAviation);
+ DailyMetrics twoYearsAgoCivilCumulative = comparableCumulative(
+ current, twoYearsAgo, DailyMetrics::getCivilAviation);
writeTableRow(table, 2, new String[]{
number(current.getNonBusinessPersonFlow()),
ratio(current.getNonBusinessPersonFlow(), previousDay == null ? null : previousDay.getNonBusinessPersonFlow()),
@@ -174,8 +172,8 @@
previousYear == null ? null : previousYear.getCivilAviation(),
twoYearsAgo == null ? null : twoYearsAgo.getCivilAviation(),
currentCumulative.getCivilAviation(),
- previousYearCumulative == null ? null : previousYearCumulative.getCivilAviation(),
- twoYearsAgoCumulative == null ? null : twoYearsAgoCumulative.getCivilAviation()));
+ previousYearCivilCumulative == null ? null : previousYearCivilCumulative.getCivilAviation(),
+ twoYearsAgoCivilCumulative == null ? null : twoYearsAgoCivilCumulative.getCivilAviation()));
writeTableRow(table, 7, transportRow(current.getWater(),
previousDay == null ? null : previousDay.getWater(),
previousYear == null ? null : previousYear.getWater(),
@@ -332,6 +330,31 @@
return (percent.signum() > 0 ? "澧為暱" : "涓嬮檷") + HolidayNumberUtils.format1(percent.abs()) + "%";
}
+ private DailyMetrics comparableCumulative(DailyMetrics current, DailyMetrics comparisonYear,
+ Function<DailyMetrics, BigDecimal> selector) {
+ if (current == null || comparisonYear == null) return null;
+ int coveredDay = 0;
+ for (int day = current.getDayIndex(); day >= 1; day--) {
+ DailyMetrics metrics = statService.dailyMetrics(current.getYear(), current.getHolidayType(), day);
+ if (metrics != null && selector.apply(metrics) != null) {
+ coveredDay = day;
+ break;
+ }
+ }
+ if (coveredDay == 0) return null;
+ return statService.cumulativeMetrics(comparisonYear.getYear(), current.getHolidayType(), coveredDay);
+ }
+
+ private String cumulativeParagraph(DailyMetrics currentCumulative,
+ DailyMetrics previousYearCumulative,
+ DailyMetrics twoYearsAgoCumulative) {
+ BigDecimal total = currentCumulative == null ? null : currentCumulative.getTotalPersonFlow();
+ return String.format("鍋囨湡浠ユ潵锛屽叏鐪佸叏绀句細璺ㄥ尯鍩熶汉鍛樻祦鍔ㄩ噺绱%s涓囦汉娆★紝姣�2025骞村悓鏈�%s锛屾瘮2024骞村悓鏈�%s銆�",
+ formatNumber(total),
+ ratioPhrase(total, previousYearCumulative == null ? null : previousYearCumulative.getTotalPersonFlow()),
+ ratioPhrase(total, twoYearsAgoCumulative == null ? null : twoYearsAgoCumulative.getTotalPersonFlow()));
+ }
+
private String ratio(BigDecimal current, BigDecimal base) {
if (current == null || base == null || base.abs().compareTo(EPSILON) < 0) return "鈥�";
BigDecimal ratio = HolidayNumberUtils.divide(current, base);
--
Gitblit v1.9.1