Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
data_report
/
data-report
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 872042e4
authored
Nov 16, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:区域展示表数据量放开限制,允许生成
1 parent
8c58b0a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
data-process/common_equity_processor.py
openspec/specs/common-equity-unified-report/spec.md
data-process/common_equity_processor.py
View file @
872042e
...
@@ -1955,8 +1955,11 @@ class CommonEquityProcessor:
...
@@ -1955,8 +1955,11 @@ class CommonEquityProcessor:
def
_build_region_rows
(
self
,
task
,
store_rows
,
region_operator_map
,
summary_map
):
def
_build_region_rows
(
self
,
task
,
store_rows
,
region_operator_map
,
summary_map
):
"""组装区域展示表数据(仅直营门店)。"""
"""组装区域展示表数据(仅直营门店)。"""
direct_rows
=
[
r
for
r
in
store_rows
if
r
[
'operate_mode'
]
==
'直营'
]
direct_rows
=
[
r
for
r
in
store_rows
if
r
[
'operate_mode'
]
==
'直营'
]
# 直营门店数为 0 时仍要输出区域展示表:表头、合计行(全 0)、说明行与
# 底部汇总照常写,只是没有明细行。这里禁止抛异常——整份工作簿是三个
# 工作表一起上传的,一个空月份不能连带门店展示表与红黄门店都交不出来。
if
not
direct_rows
:
if
not
direct_rows
:
raise
Exception
(
f
"{SHEET_REGION}:直营门店数为 0,无法生成区域展示表
"
)
logger
.
warning
(
f
"[通用+权益] {SHEET_REGION}:直营门店数为 0,输出空表(仅表头/合计/说明/汇总)
"
)
total
=
self
.
_aggregate_group
(
direct_rows
)
total
=
self
.
_aggregate_group
(
direct_rows
)
...
@@ -2010,7 +2013,15 @@ class CommonEquityProcessor:
...
@@ -2010,7 +2013,15 @@ class CommonEquityProcessor:
prev_token
=
prev_start
.
strftime
(
'
%
Y
%
m'
)
prev_token
=
prev_start
.
strftime
(
'
%
Y
%
m'
)
warranty_prev
,
equity_prev
=
self
.
_compute_summary_blocks
(
warranty_prev
,
equity_prev
=
self
.
_compute_summary_blocks
(
prev_rows
,
prev_token
,
summary_map
)
prev_rows
,
prev_token
,
summary_map
)
if
prev_rows
:
self
.
_save_snapshot
(
prev_month
,
prev_start
,
prev_end
,
warranty_prev
,
equity_prev
)
self
.
_save_snapshot
(
prev_month
,
prev_start
,
prev_end
,
warranty_prev
,
equity_prev
)
else
:
# 与定时快照任务同一口径:拒绝写入全零快照,否则之后每期的环比都会
# 以一个假 0 为基准被带偏。本月直营门店为 0 时这段必然走到,但空表
# 仍要照常输出,所以这里只跳过落库、不中断整单生成。
logger
.
warning
(
f
"[通用+权益] {SHEET_REGION}:{prev_month} 直营门店数为 0,"
f
"拒绝写入全零快照(上月快照段按全 0 输出)"
)
# ---- 环比:本月 - 上月(比率型字段,直接相减)----
# ---- 环比:本月 - 上月(比率型字段,直接相减)----
warranty_now
[
'after_sale_open_rate_mom'
]
=
_diff_ratio
(
warranty_now
[
'after_sale_open_rate_mom'
]
=
_diff_ratio
(
...
...
openspec/specs/common-equity-unified-report/spec.md
View file @
872042e
...
@@ -67,6 +67,10 @@
...
@@ -67,6 +67,10 @@
-
**当**
某省份下既有直营门店又有非直营门店
-
**当**
某省份下既有直营门店又有非直营门店
-
**那么**
区域展示表的统计结果必须只包含直营门店的数据
-
**那么**
区域展示表的统计结果必须只包含直营门店的数据
#### 场景:直营门店数为 0
-
**当**
本次任务的基础门店数据中没有任何运营模式为「直营」的门店
-
**那么**
区域展示表必须照常生成:表头、合计行(各列均为 0)、说明行与底部汇总照常输出,明细行为 0 行,禁止因直营门店为空而拒绝生成或抛错,也禁止影响门店展示表与红黄门店的生成
### 需求:区域维度数据附件解析
### 需求:区域维度数据附件解析
系统必须解析「区域维度数据」附件,跳过第 1 行说明行、以第 2 行(大区、省份、区域运营)为表头、第 3 行起为数据行,并以省份为唯一键构建省份到区域运营的映射(多个区域运营以「/」分隔)。附件中的「大区」列禁止作为大区取值来源。
系统必须解析「区域维度数据」附件,跳过第 1 行说明行、以第 2 行(大区、省份、区域运营)为表头、第 3 行起为数据行,并以省份为唯一键构建省份到区域运营的映射(多个区域运营以「/」分隔)。附件中的「大区」列禁止作为大区取值来源。
...
@@ -242,7 +246,7 @@
...
@@ -242,7 +246,7 @@
#### 场景:上月直营门店数为 0
#### 场景:上月直营门店数为 0
-
**当**
定时任务或报表任务计算上月快照时上月直营门店数为 0
-
**当**
定时任务或报表任务计算上月快照时上月直营门店数为 0
-
**那么**
系统必须拒绝写入快照并记录错误原因,禁止写入一份全零快照
-
**那么**
系统必须拒绝写入快照并记录错误原因,禁止写入一份全零快照
。定时任务须把该错误抛给调度方;报表任务只跳过快照落库(上月快照段按全 0 输出),禁止因此中断整份工作簿的生成
#### 场景:报表任务遇到缺失快照
#### 场景:报表任务遇到缺失快照
-
**当**
报表任务生成区域展示表时上月快照不存在
-
**当**
报表任务生成区域展示表时上月快照不存在
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment