Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xianyang
financial-system
Commits
4091744b
Commit
4091744b
authored
Apr 18, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化账户数据源
parent
f88d0280
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
17 deletions
+5
-17
crud.py
app/api/account/crud.py
+3
-16
views.py
app/api/account/views.py
+2
-1
No files found.
app/api/account/crud.py
View file @
4091744b
...
...
@@ -187,7 +187,7 @@ def get_finance_group_by(date, condition):
return
result
def
get_finance_info
(
unique_tag
,
page
,
size
,
start_time
,
end_time
,
is_list
=
None
):
def
get_finance_info
(
unique_tag
,
id
,
page
,
size
,
start_time
,
end_time
,
is_list
=
None
):
"""账户财务信息"""
finance_condition
=
[]
month
,
last_month
,
before_last_month
=
get_last_month
()
...
...
@@ -233,21 +233,8 @@ def get_finance_info(unique_tag, page, size, start_time, end_time, is_list=None)
count
=
future1
.
result
()
res
=
future2
.
result
()
else
:
total_list
=
[]
fi_sql
=
f
"select uuid from fi_account where unique_tag='{unique_tag}'"
fi_res
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
fi_sql
)
finance_condition
.
append
(
f
" uuid='{fi_res[0]['uuid']}'"
)
with
ThreadPoolExecutor
(
max_workers
=
3
)
as
pool
:
future1
=
pool
.
submit
(
get_finance_group_by
,
'assets_log_'
+
month
,
finance_condition
)
future2
=
pool
.
submit
(
get_finance_group_by
,
'assets_log_'
+
last_month
,
finance_condition
)
future3
=
pool
.
submit
(
get_finance_group_by
,
'assets_log_'
+
before_last_month
,
finance_condition
)
month_data
=
future1
.
result
()
last_data
=
future2
.
result
()
before_last_data
=
future3
.
result
()
total_list
=
total_list
+
month_data
if
month_data
else
total_list
total_list
=
total_list
+
last_data
if
last_data
else
total_list
ultimately_data
=
total_list
+
before_last_data
if
before_last_data
else
total_list
result
=
out_income_combine
(
ultimately_data
)
sys_sql
=
f
"select initial_money as balance,income,outcome,create_time from v2_system_account_statistics_copy where fi_account_id={id} ORDER BY create_time DESC"
result
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
sys_sql
)
res
=
result
[
int
(
page
-
1
)
*
size
:
page
*
size
]
count
=
result
# 判断是列表还是导出接口
...
...
app/api/account/views.py
View file @
4091744b
...
...
@@ -53,12 +53,13 @@ def read_account(data: schemas.AccountUpdate, token=Depends(login_required)):
def
finance_information
(
unique_tag
:
str
,
page
:
int
,
size
:
int
,
id
:
Optional
[
int
]
=
None
,
start_time
:
Optional
[
str
]
=
""
,
end_time
:
Optional
[
str
]
=
""
,
token
=
Depends
(
login_required
)):
# unique_tag:Optional[str] = Query(None, min_length=3, max_length=50, regex="^xiao\d+$") 参数验证
"""账户财务详情列表"""
res
,
total
=
crud
.
get_finance_info
(
unique_tag
,
page
,
size
,
start_time
,
end_time
,
1
)
res
,
total
=
crud
.
get_finance_info
(
unique_tag
,
id
,
page
,
size
,
start_time
,
end_time
,
1
)
return
HttpResultResponse
(
total
=
total
,
data
=
res
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment