From 73e810fc9569597be99accd08d63aab6e7c0daac Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期二, 06 十月 2026 09:36:41 +0800
Subject: [PATCH] fix(holiday): 提高平均拥挤度走势图标签精度
---
pack-deploy.ps1 | 41 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/pack-deploy.ps1 b/pack-deploy.ps1
index c0bd2cb..68074de 100644
--- a/pack-deploy.ps1
+++ b/pack-deploy.ps1
@@ -32,11 +32,17 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
+$pomPath = Join-Path $root 'traffic-audit-server\pom.xml'
+if (-not (Test-Path $pomPath)) { throw "Missing Maven project: $pomPath" }
+[xml]$pom = Get-Content -LiteralPath $pomPath -Raw -Encoding UTF8
+$productVersion = [string]$pom.project.version
+if (-not $productVersion) { throw 'Missing <version> in traffic-audit-server\pom.xml' }
+if ($productVersion -match '(?i)-SNAPSHOT$') { throw "Release builds must not use a SNAPSHOT version: $productVersion" }
if (-not $OutRoot) { $OutRoot = Join-Path $root 'deploy' } # 榛樿杈撳嚭鍒颁粨搴� deploy\锛堝凡 gitignore锛�
$tplDir = Join-Path $root 'deploy-templates' # 鎵撳寘妯℃澘浠讹紙宸插叆搴擄級
$tplJarCfg = Join-Path $tplDir 'jar-application.yml' # 杩� jar 鐨勫崰浣嶇閰嶇疆
$srcCfg = Join-Path $root 'traffic-audit-server\src\main\resources\application.yml'
-$jarRel = 'traffic-audit-server\target\traffic-audit-server-1.0.0-SNAPSHOT.jar'
+$jarRel = 'traffic-audit-server\target\traffic-audit-server.jar'
$jar = Join-Path $root $jarRel
$webDist = Join-Path $root 'traffic-audit-web\dist'
@@ -86,6 +92,18 @@
$sr = New-Object System.IO.StreamReader($entry.Open())
$text = $sr.ReadToEnd()
$sr.Close()
+
+ $versionEntry = $zip.Entries | Where-Object { $_.FullName -eq 'BOOT-INF/classes/app-version.properties' }
+ if (-not $versionEntry) { throw 'jar 鍐呯己灏� BOOT-INF/classes/app-version.properties' }
+ $vr = New-Object System.IO.StreamReader($versionEntry.Open())
+ $versionText = $vr.ReadToEnd()
+ $vr.Close()
+
+ $manifestEntry = $zip.Entries | Where-Object { $_.FullName -eq 'META-INF/MANIFEST.MF' }
+ if (-not $manifestEntry) { throw 'jar 鍐呯己灏� META-INF/MANIFEST.MF' }
+ $mr = New-Object System.IO.StreamReader($manifestEntry.Open())
+ $manifestText = $mr.ReadToEnd()
+ $mr.Close()
} finally { $zip.Dispose() }
function Get-SecretHits([string]$ymlText) {
@@ -108,6 +126,19 @@
Write-Host ' 璀﹀憡锛歫ar 鍐呯疆 password 涓嶆槸 TRAFFIC_DB_PASSWORD 鍗犱綅绗﹀舰寮忥紝璇风‘璁ゆā鏉裤��'
}
Write-Host ' 閫氳繃锛歫ar 鍐呯疆閰嶇疆鍏ㄩ儴涓哄崰浣嶇锛屾棤鏄庢枃瀵嗛挜/鍙d护銆�'
+
+$builtVersion = ''
+if ($versionText -match '(?m)^\s*version\s*=\s*(.+?)\s*$') { $builtVersion = $matches[1].Trim() }
+if ($builtVersion -ne $productVersion) {
+ throw "鐗堟湰涓嶄竴鑷达細pom.xml=$productVersion, app-version.properties=$builtVersion"
+}
+
+$manifestVersion = ''
+if ($manifestText -match '(?m)^Implementation-Version:\s*(.+?)\s*$') { $manifestVersion = $matches[1].Trim() }
+if ($manifestVersion -ne $productVersion) {
+ throw "鐗堟湰涓嶄竴鑷达細pom.xml=$productVersion, MANIFEST.MF=$manifestVersion"
+}
+Write-Host " 鐗堟湰鑷閫氳繃锛�$productVersion (pom / app-version.properties / MANIFEST.MF)"
# ---------- [3/5] 鍓嶇鏋勫缓 ----------
# 鍗曠鍙i儴缃插繀椤绘湁 backend\web锛屾墍浠ュ嵆浣� -NoFrontendDist 涔熼渶瑕� dist锛涘彧鏈� -SkipFrontend 鎵嶅鐢ㄧ幇鏈� dist銆�
@@ -162,9 +193,9 @@
# ---------- [4/5] 缁勮瀹屾暣閮ㄧ讲鐩綍 ----------
Write-Host '[4/5] 缁勮閮ㄧ讲鐩綍...'
$stamp = Get-Date -Format 'yyyyMMdd'
-$dest = Join-Path $OutRoot ("traffic-audit-deploy-" + $stamp)
+$dest = Join-Path $OutRoot ("traffic-audit-deploy-" + $stamp + "-v" + $productVersion)
$n = 2
-while (Test-Path $dest) { $dest = Join-Path $OutRoot ("traffic-audit-deploy-" + $stamp + "-" + $n); $n++ }
+while (Test-Path $dest) { $dest = Join-Path $OutRoot ("traffic-audit-deploy-" + $stamp + "-v" + $productVersion + "-" + $n); $n++ }
if ($NoFrontendDist) {
New-Item -ItemType Directory -Force -Path (Join-Path $dest 'backend'), (Join-Path $dest 'db') | Out-Null
} else {
@@ -200,11 +231,11 @@
cmd /c "robocopy `"$root\docs`" `"$docsDest`" /E /NFL /NDL /NJH /NJS /NP /XD _cache 宸ヤ綔鏃ョ粨 鍔熻兘娴嬭瘯鎶ュ憡 闂姹囨�� /XF 鐢熸垚_*.xlsx _bak_* >nul"
if ($LASTEXITCODE -ge 8) { throw "docs 澶嶅埗澶辫触锛坮obocopy 杩斿洖 $LASTEXITCODE锛�" }
# db 鑴氭湰涔熸斁涓�浠藉埌 docs锛堜笌鏃у寘涓�鑷达細docs/init.sql 绛夛級
-Copy-Item (Join-Path $tplDir 'db\init.sql'), (Join-Path $tplDir 'db\sql_city_bus.sql'), (Join-Path $tplDir 'db\sql_city_taxi.sql'), (Join-Path $tplDir 'db\sql_wyc.sql'), (Join-Path $tplDir 'db\sql_holiday.sql'), (Join-Path $tplDir 'db\sql_holiday_decimal_migration.sql'), (Join-Path $tplDir 'db\sql_holiday_comparison_base_migration.sql'), (Join-Path $tplDir 'db\sql_holiday_previous_day_migration.sql'), (Join-Path $tplDir 'db\sql_observation_station.sql') $docsDest -Force -ErrorAction SilentlyContinue
+Copy-Item (Join-Path $tplDir 'db\init.sql'), (Join-Path $tplDir 'db\sql_city_bus.sql'), (Join-Path $tplDir 'db\sql_city_taxi.sql'), (Join-Path $tplDir 'db\sql_wyc.sql'), (Join-Path $tplDir 'db\sql_holiday.sql'), (Join-Path $tplDir 'db\sql_holiday_decimal_migration.sql'), (Join-Path $tplDir 'db\sql_holiday_comparison_base_migration.sql'), (Join-Path $tplDir 'db\sql_holiday_previous_day_migration.sql'), (Join-Path $tplDir 'db\sql_holiday_vehicle_adjustment_migration.sql'), (Join-Path $tplDir 'db\sql_observation_station.sql') $docsDest -Force -ErrorAction SilentlyContinue
# README锛氱敤妯℃澘骞舵浛鎹㈡棩鏈熷崰浣�
$readme = Get-Content (Join-Path $tplDir 'README-閮ㄧ讲璇存槑.txt') -Raw -Encoding UTF8
-$readme = $readme.Replace('{stamp}', $stamp)
+$readme = $readme.Replace('{stamp}', $stamp).Replace('{version}', $productVersion)
Set-Content -LiteralPath (Join-Path $dest 'README-閮ㄧ讲璇存槑.txt') -Value $readme -Encoding UTF8
# ---------- [5/5] 鏁村寘鏄庢枃瀵嗛挜鎵弿 + 姹囨�� ----------
--
Gitblit v1.9.1