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
153728e1
Commit
153728e1
authored
Apr 11, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化测试账户数据查询二版
parent
e47d5623
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
crud.py
app/api/account/crud.py
+10
-1
views.py
app/api/account/views.py
+3
-2
crud.py
app/api/export/crud.py
+7
-1
No files found.
app/api/account/crud.py
View file @
153728e1
...
@@ -326,6 +326,10 @@ class AccountStatistics(object):
...
@@ -326,6 +326,10 @@ class AccountStatistics(object):
public_list
.
append
(
f
" create_time >= {time_str_to_timestamp(self.start_time + ' 00:00:00')} "
)
public_list
.
append
(
f
" create_time >= {time_str_to_timestamp(self.start_time + ' 00:00:00')} "
)
if
self
.
end_time
:
if
self
.
end_time
:
public_list
.
append
(
f
" create_time <= {time_str_to_timestamp(self.end_time + ' 23:59:59')} "
)
public_list
.
append
(
f
" create_time <= {time_str_to_timestamp(self.end_time + ' 23:59:59')} "
)
if
self
.
unique
==
'knapsack_account'
:
public_list
.
append
(
f
" amount_type='backpack'"
)
if
self
.
unique
==
'user_account'
:
public_list
.
append
(
f
" amount_type in('consumable','withdrawable')"
)
return
public_list
return
public_list
def
get_finance_details
(
self
,
is_list
=
None
):
def
get_finance_details
(
self
,
is_list
=
None
):
...
@@ -378,7 +382,7 @@ class AccountStatistics(object):
...
@@ -378,7 +382,7 @@ class AccountStatistics(object):
class
SpecificAccountQuery
(
object
):
class
SpecificAccountQuery
(
object
):
"""账户用户,背包,公会第四层查询"""
"""账户用户,背包,公会第四层查询"""
def
__init__
(
self
,
page
,
size
,
uuid
,
time
,
type
,
reference_type
):
def
__init__
(
self
,
page
,
size
,
uuid
,
time
,
type
,
reference_type
,
unique_tag
):
self
.
page
=
page
self
.
page
=
page
self
.
size
=
size
self
.
size
=
size
self
.
uuid
=
uuid
self
.
uuid
=
uuid
...
@@ -386,6 +390,7 @@ class SpecificAccountQuery(object):
...
@@ -386,6 +390,7 @@ class SpecificAccountQuery(object):
self
.
end_time
=
time
self
.
end_time
=
time
self
.
_type
=
type
self
.
_type
=
type
self
.
reference_type
=
reference_type
self
.
reference_type
=
reference_type
self
.
unique_tag
=
unique_tag
self
.
total_list
=
[]
self
.
total_list
=
[]
def
condition_query
(
self
,
date
,
cond_list
):
def
condition_query
(
self
,
date
,
cond_list
):
...
@@ -404,6 +409,10 @@ class SpecificAccountQuery(object):
...
@@ -404,6 +409,10 @@ class SpecificAccountQuery(object):
condition
.
append
(
f
" type={self._type}"
)
condition
.
append
(
f
" type={self._type}"
)
if
self
.
reference_type
:
if
self
.
reference_type
:
condition
.
append
(
f
" reference_type='{self.reference_type}'"
)
condition
.
append
(
f
" reference_type='{self.reference_type}'"
)
if
self
.
unique_tag
==
'knapsack_account'
:
condition
.
append
(
f
" amount_type='backpack'"
)
if
self
.
unique_tag
==
'user_account'
:
condition
.
append
(
f
" amount_type in('consumable','withdrawable')"
)
month
,
last_month
,
before_last_month
=
get_last_month
()
month
,
last_month
,
before_last_month
=
get_last_month
()
with
ThreadPoolExecutor
(
max_workers
=
3
)
as
pool
:
with
ThreadPoolExecutor
(
max_workers
=
3
)
as
pool
:
future1
=
pool
.
submit
(
self
.
condition_query
,
'assets_log_'
+
month
,
condition
)
future1
=
pool
.
submit
(
self
.
condition_query
,
'assets_log_'
+
month
,
condition
)
...
...
app/api/account/views.py
View file @
153728e1
...
@@ -108,12 +108,13 @@ def finance_fourth_info(page: int,
...
@@ -108,12 +108,13 @@ def finance_fourth_info(page: int,
time
:
Optional
[
str
]
=
""
,
time
:
Optional
[
str
]
=
""
,
type
:
Optional
[
int
]
=
None
,
type
:
Optional
[
int
]
=
None
,
reference_type
:
Optional
[
str
]
=
""
,
reference_type
:
Optional
[
str
]
=
""
,
unique_tag
:
Optional
[
str
]
=
""
,
token
=
Depends
(
login_required
)):
token
=
Depends
(
login_required
)):
"""账户财务明细 第四层"""
"""账户财务明细 第四层"""
if
not
all
([
uuid
,
time
]):
if
not
all
([
uuid
,
time
,
unique_tag
]):
return
HttpResultResponse
(
code
=
500
,
msg
=
"缺少必传参数"
)
return
HttpResultResponse
(
code
=
500
,
msg
=
"缺少必传参数"
)
res
,
total
,
count
=
SpecificAccountQuery
(
page
,
size
,
uuid
,
time
,
type
,
res
,
total
,
count
=
SpecificAccountQuery
(
page
,
size
,
uuid
,
time
,
type
,
reference_type
)
.
business_logic
()
reference_type
,
unique_tag
)
.
business_logic
()
return
HttpResultResponse
(
total
=
total
,
data
=
res
,
count
=
count
)
return
HttpResultResponse
(
total
=
total
,
data
=
res
,
count
=
count
)
...
...
app/api/export/crud.py
View file @
153728e1
...
@@ -272,4 +272,10 @@ class ReferenceTypeClassification():
...
@@ -272,4 +272,10 @@ class ReferenceTypeClassification():
income
=
pd
.
DataFrame
(
self
.
income
)
income
=
pd
.
DataFrame
(
self
.
income
)
ogs
=
outcome
.
groupby
(
"nickname"
)
.
sum
()
ogs
=
outcome
.
groupby
(
"nickname"
)
.
sum
()
igs
=
income
.
groupby
(
"nickname"
)
.
sum
()
igs
=
income
.
groupby
(
"nickname"
)
.
sum
()
return
{
"outcome"
:
ogs
.
to_dict
()
.
get
(
'money'
),
"income"
:
igs
.
to_dict
()
.
get
(
'money'
)}
# 格式化
res_list
=
[]
for
k
,
v
in
ogs
.
to_dict
()
.
get
(
'money'
)
.
items
():
res_list
.
append
({
"type"
:
"出账"
,
"name"
:
k
,
"money"
:
v
})
for
k
,
v
in
igs
.
to_dict
()
.
get
(
'money'
)
.
items
():
res_list
.
append
({
"type"
:
"入账"
,
"name"
:
k
,
"money"
:
v
})
return
res_list
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