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 b3a23f02
authored
Jul 27, 2026
by
江名洋
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
兼容店名不同
1 parent
f97904f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
app/services/harmony_analysis_service.py
app/services/harmony_analysis_service.py
View file @
b3a23f0
...
@@ -82,6 +82,8 @@ SUB_BRAND_STORE_NAME_MAP = {
...
@@ -82,6 +82,8 @@ SUB_BRAND_STORE_NAME_MAP = {
"龙海智行(上海)汽车科技有限公司"
:
"龙海智行(上海)汽车科技有限公司"
,
"龙海智行(上海)汽车科技有限公司"
:
"龙海智行(上海)汽车科技有限公司"
,
"海南丰盛利华汽车销售服务有限公司(鸿蒙)"
:
"海南丰盛利华汽车销售服务有限公司"
,
"海南丰盛利华汽车销售服务有限公司(鸿蒙)"
:
"海南丰盛利华汽车销售服务有限公司"
,
}
}
# 反向映射:主机厂名称 → 数据库名称(DB 查询时回退用)
SUB_BRAND_STORE_NAME_MAP_REVERSE
=
{
v
:
k
for
k
,
v
in
SUB_BRAND_STORE_NAME_MAP
.
items
()}
def
_safe_float
(
val
,
default
=
0.0
):
def
_safe_float
(
val
,
default
=
0.0
):
...
@@ -621,13 +623,12 @@ class HarmonyAnalysisService:
...
@@ -621,13 +623,12 @@ class HarmonyAnalysisService:
cursorclass
=
pymysql
.
cursors
.
DictCursor
,
cursorclass
=
pymysql
.
cursors
.
DictCursor
,
)
)
# DB 查询时同时传入 OEM 名称和原始数据库名称,避免映射后查不到数据
query_names
=
list
(
store_names
)
query_names
=
list
(
store_names
)
_HM_SUFFIX_WHITELIST
=
{
"海南丰盛利华汽车销售服务有限公司"
}
for
name
in
store_names
:
for
name
in
store_names
:
if
name
in
_HM_SUFFIX_WHITELIST
:
db_name
=
SUB_BRAND_STORE_NAME_MAP_REVERSE
.
get
(
name
)
hm_name
=
name
+
"(鸿蒙)"
if
db_name
and
db_name
not
in
query_names
:
if
hm_name
not
in
query_names
:
query_names
.
append
(
db_name
)
query_names
.
append
(
hm_name
)
placeholders
=
", "
.
join
([
"
%
s"
]
*
len
(
query_names
))
placeholders
=
", "
.
join
([
"
%
s"
]
*
len
(
query_names
))
brand_placeholders
=
", "
.
join
([
"
%
s"
]
*
len
(
HARMONY_BRAND_IDS
))
brand_placeholders
=
", "
.
join
([
"
%
s"
]
*
len
(
HARMONY_BRAND_IDS
))
...
@@ -723,9 +724,10 @@ class HarmonyAnalysisService:
...
@@ -723,9 +724,10 @@ class HarmonyAnalysisService:
@staticmethod
@staticmethod
def
_lookup_sub_brand_perf
(
db_perf
:
dict
,
store_name
:
str
,
legal_name
:
str
,
brand
:
str
)
->
dict
:
def
_lookup_sub_brand_perf
(
db_perf
:
dict
,
store_name
:
str
,
legal_name
:
str
,
brand
:
str
)
->
dict
:
"""按用户中心名/法人名 + 品牌查找产值"""
"""按用户中心名/法人名
/反向映射DB名
+ 品牌查找产值"""
brand
=
str
(
brand
or
""
)
.
strip
()
brand
=
str
(
brand
or
""
)
.
strip
()
for
name
in
(
store_name
,
legal_name
):
for
name
in
(
store_name
,
legal_name
,
SUB_BRAND_STORE_NAME_MAP_REVERSE
.
get
(
store_name
or
""
,
""
)):
name
=
str
(
name
or
""
)
.
strip
()
name
=
str
(
name
or
""
)
.
strip
()
if
not
name
:
if
not
name
:
continue
continue
...
...
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