Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
data_report
/
daw
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 bf2fcff1
authored
Jun 24, 2026
by
江名洋
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(analysis): 调整指标提取逻辑与列名映射
1 parent
18dd7d2a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
21 deletions
app/services/__pycache__/analysis_service.cpython-313.pyc
app/services/analysis_service.py
app/templates/输出-问界生态系数-模板.xlsx
app/services/__pycache__/analysis_service.cpython-313.pyc
View file @
bf2fcff
No preview for this file type
app/services/analysis_service.py
View file @
bf2fcff
...
@@ -74,24 +74,11 @@ def extract_target_rates(store_row) -> dict:
...
@@ -74,24 +74,11 @@ def extract_target_rates(store_row) -> dict:
优先使用模板中的显式数值列(需达标转化率_整车延保等),
优先使用模板中的显式数值列(需达标转化率_整车延保等),
没有显式值时从兜底指标文本解析。
没有显式值时从兜底指标文本解析。
"""
"""
# 显式数值列优先
def
_has_val
(
v
):
explicit_yb
=
store_row
.
get
(
"需达标转化率_整车延保"
)
return
v
is
not
None
and
not
(
isinstance
(
v
,
float
)
and
pd
.
isna
(
v
))
explicit_axb
=
store_row
.
get
(
"需达标转化率_安心包"
)
explicit_bat
=
store_row
.
get
(
"需达标转化率_电池"
)
has_explicit
=
all
(
v
is
not
None
and
not
(
isinstance
(
v
,
float
)
and
pd
.
isna
(
v
))
for
v
in
[
explicit_yb
,
explicit_axb
,
explicit_bat
]
)
if
has_explicit
:
return
{
"整车延保"
:
_safe_float
(
explicit_yb
),
"安心包"
:
_safe_float
(
explicit_axb
),
"电池延保"
:
_safe_float
(
explicit_bat
),
}
# 兜底:从文本解析
# 兜底
默认值
:从文本解析
baodi
=
store_row
.
get
(
"兜底指标"
,
""
)
baodi
=
store_row
.
get
(
"兜底指标"
,
""
)
baodi_type
=
str
(
store_row
.
get
(
"兜底类型"
,
"交付"
))
rule_type
=
detect_rule_type
(
str
(
baodi
)
if
not
pd
.
isna
(
baodi
)
else
""
)
rule_type
=
detect_rule_type
(
str
(
baodi
)
if
not
pd
.
isna
(
baodi
)
else
""
)
targets
=
dict
(
RULE_TARGETS
.
get
(
rule_type
,
RULE_TARGETS
[
"default"
]))
targets
=
dict
(
RULE_TARGETS
.
get
(
rule_type
,
RULE_TARGETS
[
"default"
]))
...
@@ -100,6 +87,17 @@ def extract_target_rates(store_row) -> dict:
...
@@ -100,6 +87,17 @@ def extract_target_rates(store_row) -> dict:
targets
[
"安心包"
]
=
0.0
targets
[
"安心包"
]
=
0.0
targets
[
"整车延保"
]
=
_safe_float
(
_extract_number
(
baodi
,
r"触客成交率[不]*低于(\d+)
%
"
,
50
))
/
100.0
targets
[
"整车延保"
]
=
_safe_float
(
_extract_number
(
baodi
,
r"触客成交率[不]*低于(\d+)
%
"
,
50
))
/
100.0
# 显式数值列优先(逐个覆盖,缺失的保留文本解析默认值)
explicit_yb
=
store_row
.
get
(
"需达标转化率_整车延保"
)
explicit_axb
=
store_row
.
get
(
"需达标转化率_安心包"
)
explicit_bat
=
store_row
.
get
(
"需达标转化率_电池"
)
if
_has_val
(
explicit_yb
):
targets
[
"整车延保"
]
=
_safe_float
(
explicit_yb
)
if
_has_val
(
explicit_axb
):
targets
[
"安心包"
]
=
_safe_float
(
explicit_axb
)
if
_has_val
(
explicit_bat
):
targets
[
"电池延保"
]
=
_safe_float
(
explicit_bat
)
for
k
in
targets
:
for
k
in
targets
:
targets
[
k
]
=
_safe_float
(
targets
[
k
],
RULE_TARGETS
[
"default"
]
.
get
(
k
,
0.0
))
targets
[
k
]
=
_safe_float
(
targets
[
k
],
RULE_TARGETS
[
"default"
]
.
get
(
k
,
0.0
))
...
@@ -199,11 +197,11 @@ class AnalysisService:
...
@@ -199,11 +197,11 @@ class AnalysisService:
col_names
=
{
col_names
=
{
0
:
"门店名"
,
1
:
"兜底指标"
,
2
:
"兜底类型"
,
0
:
"门店名"
,
1
:
"兜底指标"
,
2
:
"兜底类型"
,
3
:
"特殊情况1"
,
4
:
"特殊情况2"
,
3
:
"特殊情况1"
,
4
:
"特殊情况2"
,
5
:
"
区域(省)"
,
6
:
"直营与否
"
,
5
:
"
需达标转化率_整车延保"
,
6
:
"需达标转化率_安心包"
,
7
:
"需达标转化率_电池
"
,
7
:
"区域运营"
,
8
:
"飞行督导"
,
9
:
"线上运营
"
,
8
:
"预计赔付单价_整车"
,
9
:
"预计赔付单价_安心包"
,
10
:
"预计赔付单价_电池
"
,
1
0
:
"需达标转化率_整车延保"
,
11
:
"需达标转化率_安心包"
,
12
:
"需达标转化率_电池
"
,
1
1
:
"兜底截止日期"
,
12
:
"策略组更新记录
"
,
13
:
"
预计赔付单价_整车"
,
14
:
"预计赔付单价_安心包"
,
15
:
"预计赔付单价_电池
"
,
13
:
"
区域(省)"
,
14
:
"直营与否
"
,
1
6
:
"兜底截止日期"
,
17
:
"策略组更新记录
"
,
1
5
:
"区域运营"
,
16
:
"飞行督导"
,
17
:
"线上运营
"
,
}
}
df
=
df
.
rename
(
columns
=
col_names
)
df
=
df
.
rename
(
columns
=
col_names
)
for
c
in
col_names
.
values
():
for
c
in
col_names
.
values
():
...
...
app/templates/输出-问界生态系数-模板.xlsx
View file @
bf2fcff
No preview for this file type
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