Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
dealaccountdata
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 8dee3200
authored
May 16, 2026
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
改为根据单个商户拆分scene_split_processor.py、main_scene_split.py
1 parent
97ce80d6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletions
scene_refactor_data/main_scene_split.py
scene_refactor_data/scene_split_processor.py
scene_refactor_data/main_scene_split.py
View file @
8dee320
...
@@ -175,7 +175,7 @@ def main():
...
@@ -175,7 +175,7 @@ def main():
11
:
(
'处理对账分组规则表(表10)及级联'
,
processor
.
step11_process_reconciliation_rule_group
),
11
:
(
'处理对账分组规则表(表10)及级联'
,
processor
.
step11_process_reconciliation_rule_group
),
# 审核记录不做处理,注释废弃
# 审核记录不做处理,注释废弃
# 12: ('处理审核记录表(表12)', processor.step12_process_rule_audit),
# 12: ('处理审核记录表(表12)', processor.step12_process_rule_audit),
#
无需根据商户维度处理,保持不变,增加商户ID写入tmp_rule_id_mapping
#
按商户维度处理生效记录表
13
:
(
'处理生效记录表(表11)'
,
processor
.
step13_process_effect_record
),
13
:
(
'处理生效记录表(表11)'
,
processor
.
step13_process_effect_record
),
}
}
...
@@ -190,8 +190,78 @@ def main():
...
@@ -190,8 +190,78 @@ def main():
logger
.
info
(
f
"
\n
开始执行第 {step_num} 步: {step_name}"
)
logger
.
info
(
f
"
\n
开始执行第 {step_num} 步: {step_name}"
)
try
:
try
:
# 步骤3-9:按商户维度循环处理(财务和分账规则)
if
3
<=
step_num
<=
9
:
# 查询需要处理的商户ID列表
merchant_query_sql
=
"""
SELECT DISTINCT merchant_id
FROM tmp_rule_id_mapping
WHERE table_name IN ('dj_car_life_merchant_settle_account_rule', 'dj_car_life_merchant_division_rule')
AND merchant_id IS NOT NULL
ORDER BY merchant_id;
"""
merchant_ids
=
db_helper
.
execute_query
(
merchant_query_sql
)
logger
.
info
(
f
" 找到 {len(merchant_ids)} 个商户需要处理"
)
# 循环处理每个商户
for
idx
,
(
merchant_id
,)
in
enumerate
(
merchant_ids
,
1
):
logger
.
info
(
f
" 处理商户 {idx}/{len(merchant_ids)}: merchant_id={merchant_id}"
)
step_func
(
merchant_id
)
logger
.
info
(
f
" 商户 {merchant_id} 处理完成"
)
logger
.
info
(
f
"第 {step_num} 步执行成功"
)
# 步骤11:按商户维度循环处理(对账规则)
elif
step_num
==
11
:
# 查询需要处理的商户ID列表
merchant_query_sql
=
"""
SELECT DISTINCT merchant_id
FROM tmp_rule_id_mapping
WHERE table_name IN ('dj_car_life_merchant_reconciliation_rule')
AND merchant_id IS NOT NULL
ORDER BY merchant_id;
"""
merchant_ids
=
db_helper
.
execute_query
(
merchant_query_sql
)
logger
.
info
(
f
" 找到 {len(merchant_ids)} 个商户需要处理"
)
# 循环处理每个商户
for
idx
,
(
merchant_id
,)
in
enumerate
(
merchant_ids
,
1
):
logger
.
info
(
f
" 处理商户 {idx}/{len(merchant_ids)}: merchant_id={merchant_id}"
)
step_func
(
merchant_id
)
logger
.
info
(
f
" 商户 {merchant_id} 处理完成"
)
logger
.
info
(
f
"第 {step_num} 步执行成功"
)
# 步骤13:按商户维度循环处理(生效记录表)
elif
step_num
==
13
:
# 查询需要处理的商户ID列表(从所有主表查询)
merchant_query_sql
=
"""
SELECT DISTINCT merchant_id
FROM tmp_rule_id_mapping
WHERE table_name IN (
'dj_car_life_merchant_settle_account_rule',
'dj_car_life_merchant_division_rule',
'dj_car_life_merchant_reconciliation_rule'
)
AND merchant_id IS NOT NULL
ORDER BY merchant_id;
"""
merchant_ids
=
db_helper
.
execute_query
(
merchant_query_sql
)
logger
.
info
(
f
" 找到 {len(merchant_ids)} 个商户需要处理"
)
# 循环处理每个商户
for
idx
,
(
merchant_id
,)
in
enumerate
(
merchant_ids
,
1
):
logger
.
info
(
f
" 处理商户 {idx}/{len(merchant_ids)}: merchant_id={merchant_id}"
)
step_func
(
merchant_id
)
logger
.
info
(
f
" 商户 {merchant_id} 处理完成"
)
logger
.
info
(
f
"第 {step_num} 步执行成功"
)
# 其他步骤:正常执行
else
:
step_func
()
step_func
()
logger
.
info
(
f
"第 {step_num} 步执行成功"
)
logger
.
info
(
f
"第 {step_num} 步执行成功"
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
f
"第 {step_num} 步执行失败: {e}"
,
exc_info
=
True
)
logger
.
error
(
f
"第 {step_num} 步执行失败: {e}"
,
exc_info
=
True
)
success
=
False
success
=
False
...
...
scene_refactor_data/scene_split_processor.py
View file @
8dee320
This diff is collapsed.
Click to expand it.
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