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): 快报累计正文单位由亿人次改为万人次
---
HANDOFF.md | 7 +++++++
traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayBulletinServiceTest.java | 21 +++++++++++++++++++++
traffic-audit-server/src/main/java/com/trafficaudit/holiday/service/HolidayBulletinService.java | 19 +++++++++++--------
3 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/HANDOFF.md b/HANDOFF.md
index 189008f..fccabaf 100644
--- a/HANDOFF.md
+++ b/HANDOFF.md
@@ -30,6 +30,13 @@
- **楠岃瘉**锛歚HolidayBulletinServiceTest` 3 涓敤渚嬮�氳繃锛堟柊澧� 2 涓鐩栨皯鑸疮璁″姣旀湡闂翠笌鏃犳暟鎹繑鍥� null锛夛紱绔埌绔敤搴撳唴鐪熷疄 2026-10-02 鏁版嵁锛堥搧璺�/閬撹矾/姘磋矾/杞︽祦榻愬叏銆佺己姘戣埅锛夐噸鏂扮敓鎴愬揩鎶ワ紝姘戣埅绱鍚屾瘮 `-10.0%/-0.9%`銆佹皯鑸疮璁� `6.75`銆佹�昏绱 `3082.24`銆佹�昏绱鍚屾瘮 `-4.6%/-1.8%`锛屼笌鎵嬪伐绋垮彛寰勪竴鑷淬��
- **Git**锛氭湰娆℃敼鍔ㄥ緟鐢ㄦ埛銆岄獙鏀堕�氳繃銆嶅悗鍐嶆彁浜�/鎺ㄩ�併��
+### 10-03 娣卞锛�3锛夛細蹇姤绱姝f枃鍗曚綅鐢便�屼嚎浜烘銆嶆敼銆屼竾浜烘銆嶏紙寰呴獙鏀讹級
+
+- **鍙e緞锛堢敤鎴�/棰嗗纭锛�**锛氬亣鏈熺疮璁℃暟鍊肩洰鍓嶅亸灏忥紙0.31 浜匡級锛屾鏂囧彲璇绘�у樊锛屾敼涓轰笌褰撴棩涓�鑷寸殑**涓囦汉娆�**锛涗緥濡� `鍋囨湡浠ユ潵锛屽叏鐪佸叏绀句細璺ㄥ尯鍩熶汉鍛樻祦鍔ㄩ噺绱3088.63涓囦汉娆锛屼笉鍐嶈緭鍑恒��0.31浜夸汉娆°�嶃�傝〃鏍间笌鍏朵綑鍙e緞涓嶅彉銆�
+- **瀹炵幇**锛歚HolidayBulletinService` 鎶藉嚭 `cumulativeParagraph(...)`锛岀洿鎺ユ寜涓囦汉娆★紙2 浣嶅皬鏁帮級杈撳嚭绱鍊硷紱鍚屾瘮浠嶄负銆屽闀�/涓嬮檷 + 涓�浣嶅皬鏁般�嶏紝**淇濇寔涓�娆″彇鏁翠笉鍙�**锛堟�昏绱鍚屾瘮 2025 绮剧‘ -4.4486% 鈫� `-4.4%`锛涙墜宸ョ鐨� -4.5% 灞炰簩娆″彇鏁达紝涓嶉噰鐢級銆�
+- **楠岃瘉**锛歚HolidayBulletinServiceTest` 4 涓敤渚嬮�氳繃锛堟柊澧� `cumulativeParagraphUsesWanUnitAndSingleRounding` 鍥哄寲銆屼竾浜烘 + 涓�娆″彇鏁淬�嶏級锛涢噸鍚悗绔悗閲嶆柊鐢熸垚 2026-10-02 蹇姤锛屾鏂囦负 `绱3088.63涓囦汉娆★紝姣�2025骞村悓鏈熶笅闄�4.4%锛屾瘮2024骞村悓鏈熶笅闄�1.6%`锛屼笌鎵嬪伐绋夸粎宸棦瀹氱殑鍙栨暣鍙e緞锛�2026-10-01 鍥炲綊姝e父锛坄绱1643.17涓囦汉娆锛夈��
+- **鐘舵��**锛氬緟鐢ㄦ埛銆岄獙鏀堕�氳繃銆嶅悗鎻愪氦/鎺ㄩ�併��
+
---
### 琛ュ厖锛�10-03 涓嬪崍锛夛細鏈嶅姟鍣ㄩ儴缃叉姤 鈥淎ccess denied ... (using password: NO)鈥� 鈥斺�� 鏍瑰洜涓庝慨澶�
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 a80ca4f..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
@@ -78,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銆�",
@@ -87,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()) {
@@ -352,6 +345,16 @@
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);
diff --git a/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayBulletinServiceTest.java b/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayBulletinServiceTest.java
index 7f585b3..bdef3e2 100644
--- a/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayBulletinServiceTest.java
+++ b/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayBulletinServiceTest.java
@@ -77,6 +77,27 @@
verify(stat, never()).cumulativeMetrics(0, "NATIONAL_DAY", 1);
}
+ @Test
+ void cumulativeParagraphUsesWanUnitAndSingleRounding() throws Exception {
+ HolidayBulletinService service = new HolidayBulletinService(null);
+
+ DailyMetrics current = new DailyMetrics();
+ current.setTotalPersonFlow(new BigDecimal("3088.62958"));
+ DailyMetrics previousYear = new DailyMetrics();
+ previousYear.setTotalPersonFlow(new BigDecimal("3232.42742"));
+ DailyMetrics twoYearsAgo = new DailyMetrics();
+ twoYearsAgo.setTotalPersonFlow(new BigDecimal("3137.80860"));
+
+ Method method = HolidayBulletinService.class.getDeclaredMethod(
+ "cumulativeParagraph", DailyMetrics.class, DailyMetrics.class, DailyMetrics.class);
+ method.setAccessible(true);
+ String text = (String) method.invoke(service, current, previousYear, twoYearsAgo);
+
+ assertEquals(
+ "鍋囨湡浠ユ潵锛屽叏鐪佸叏绀句細璺ㄥ尯鍩熶汉鍛樻祦鍔ㄩ噺绱3088.63涓囦汉娆★紝姣�2025骞村悓鏈熶笅闄�4.4%锛屾瘮2024骞村悓鏈熶笅闄�1.6%銆�",
+ text);
+ }
+
private Object comparableCumulative(HolidayBulletinService service, DailyMetrics current,
DailyMetrics comparisonYear,
Function<DailyMetrics, BigDecimal> selector) throws Exception {
--
Gitblit v1.9.1