feat 界面新增加数据
This commit is contained in:
parent
eaa8e3bd17
commit
884ece07dc
|
|
@ -55,7 +55,7 @@
|
|||
- `traffic_flow_change_under_accident.items[]`:事故影响下交通流变化趋势(project=时间/里程等,data=变化值)
|
||||
- `demo_area_7day_volume_comparison.*.items[]`:示范区域近7日流量对比(早峰/晚峰/全时段;project=日期,data=流量)
|
||||
- `accident_impact_quantified_comparison.data_one/items[]`、`data_two/items[]`:事故影响量化指标对比(project=类目,data=数值)
|
||||
- `demo_area_historical_trend.*.items[]`:示范区域历史交通流趋势(顶部展示/车流量/平均车速)
|
||||
- `demo_area_historical_trend.*.items[]`:示范区域历史交通流趋势 — `top_display` / `traffic_volume` / `average_speed`(项目+数据或日期+数据);以及日粒度 `traffic_volume_day`、`average_speed_day`(日期/数据)、`top_display_day`(项目/数据)
|
||||
- `page_top_display.items[]`:页面顶部展示(项目/数据)
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -91,11 +91,15 @@ type AccidentImpactQuantifiedComparison struct {
|
|||
DataTwo *TrendSubBlock `json:"data_two"`
|
||||
}
|
||||
|
||||
// 示范区域历史交通流趋势(顶部展示、车流量、平均车速)
|
||||
// 示范区域历史交通流趋势(顶部展示、车流量、平均车速,及对应的「_日」子类)
|
||||
type DemoAreaHistoricalTrend struct {
|
||||
TopDisplay *TrendSubBlock `json:"top_display"` // 项目/数据
|
||||
TrafficVolume *TrendSubBlock `json:"traffic_volume"` // 日期/数据
|
||||
AverageSpeed *TrendSubBlock `json:"average_speed"` // 日期/数据
|
||||
// 日粒度子块(表结构与上对应:车流量_日/平均车速_日为 日期/数据;顶部展示_日 为 项目/数据)
|
||||
TrafficVolumeDay *TrendSubBlock `json:"traffic_volume_day"`
|
||||
AverageSpeedDay *TrendSubBlock `json:"average_speed_day"`
|
||||
TopDisplayDay *TrendSubBlock `json:"top_display_day"`
|
||||
}
|
||||
|
||||
// 页面顶部展示(项目/数据)
|
||||
|
|
@ -470,12 +474,44 @@ func parseAnchorAccidentImpactQuantified(rows [][]string, i int) (*AccidentImpac
|
|||
return out, subtitleRow
|
||||
}
|
||||
|
||||
// 解析示范区域历史交通流趋势(顶部展示、车流量、平均车速)
|
||||
// matchDemoAreaHistoricalSubKey 列 B 子标题与 subs.key 匹配:避免「车流量_日」命中 key「车流量」。
|
||||
func matchDemoAreaHistoricalSubKey(cellB, key string) bool {
|
||||
c := strings.TrimSpace(cellB)
|
||||
k := strings.TrimSpace(key)
|
||||
if c == "" || k == "" {
|
||||
return false
|
||||
}
|
||||
if strings.HasSuffix(k, "_日") {
|
||||
return strings.Contains(c, k)
|
||||
}
|
||||
if strings.HasSuffix(c, "_日") {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(c, k)
|
||||
}
|
||||
|
||||
// rowIsDemoAreaHistoricalSubTitle 是否为本锚点下六级子标题之一(列 B)。
|
||||
func rowIsDemoAreaHistoricalSubTitle(cellB string) bool {
|
||||
for _, k := range []string{
|
||||
"顶部展示", "车流量", "平均车速",
|
||||
"车流量_日", "平均车速_日", "顶部展示_日",
|
||||
} {
|
||||
if matchDemoAreaHistoricalSubKey(cellB, k) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 解析示范区域历史交通流趋势(顶部展示、车流量、平均车速;车流量_日、平均车速_日、顶部展示_日)
|
||||
func parseAnchorDemoAreaHistoricalTrend(rows [][]string, i int) (*DemoAreaHistoricalTrend, int) {
|
||||
out := &DemoAreaHistoricalTrend{
|
||||
TopDisplay: &TrendSubBlock{Items: []ProjectData{}},
|
||||
TrafficVolume: &TrendSubBlock{Items: []ProjectData{}},
|
||||
AverageSpeed: &TrendSubBlock{Items: []ProjectData{}},
|
||||
TopDisplay: &TrendSubBlock{Items: []ProjectData{}},
|
||||
TrafficVolume: &TrendSubBlock{Items: []ProjectData{}},
|
||||
AverageSpeed: &TrendSubBlock{Items: []ProjectData{}},
|
||||
TrafficVolumeDay: &TrendSubBlock{Items: []ProjectData{}},
|
||||
AverageSpeedDay: &TrendSubBlock{Items: []ProjectData{}},
|
||||
TopDisplayDay: &TrendSubBlock{Items: []ProjectData{}},
|
||||
}
|
||||
subtitleRow := i + 1
|
||||
beginCol := dataBeginColLevel2
|
||||
|
|
@ -486,11 +522,14 @@ func parseAnchorDemoAreaHistoricalTrend(rows [][]string, i int) (*DemoAreaHistor
|
|||
{"顶部展示", out.TopDisplay},
|
||||
{"车流量", out.TrafficVolume},
|
||||
{"平均车速", out.AverageSpeed},
|
||||
{"车流量_日", out.TrafficVolumeDay},
|
||||
{"平均车速_日", out.AverageSpeedDay},
|
||||
{"顶部展示_日", out.TopDisplayDay},
|
||||
}
|
||||
for _, sub := range subs {
|
||||
for subtitleRow < len(rows) {
|
||||
row := rows[subtitleRow]
|
||||
if strings.Contains(safeCell(row, 1), sub.key) {
|
||||
if matchDemoAreaHistoricalSubKey(safeCell(row, 1), sub.key) {
|
||||
break
|
||||
}
|
||||
if safeCell(row, 0) != "" && isAnchorRow(safeCell(row, 0)) {
|
||||
|
|
@ -505,7 +544,7 @@ func parseAnchorDemoAreaHistoricalTrend(rows [][]string, i int) (*DemoAreaHistor
|
|||
return out, beginRow
|
||||
}
|
||||
cell1 := safeCell(row, 1)
|
||||
if cell1 != "" && (strings.Contains(cell1, "顶部展示") || strings.Contains(cell1, "车流量") || strings.Contains(cell1, "平均车速")) {
|
||||
if cell1 != "" && rowIsDemoAreaHistoricalSubTitle(cell1) {
|
||||
subtitleRow = beginRow
|
||||
break
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue