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
b50ac460
Commit
b50ac460
authored
Apr 26, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化账户列表
parent
a84b257f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
crud.py
app/api/account/crud.py
+17
-8
views.py
app/api/account/views.py
+6
-2
No files found.
app/api/account/crud.py
View file @
b50ac460
...
...
@@ -525,16 +525,25 @@ class AccountStatistics(object):
return
result_list
[
int
(
self
.
page
-
1
)
*
self
.
size
:
self
.
page
*
self
.
size
],
len
(
result_list
),
money
def
delete_specify_field
(
data
):
def
delete_specify_field
(
data
,
unique_tag
):
res_list
=
[]
for
i
in
data
:
structure
=
{
"reference_number"
:
i
[
"reference_number"
],
"type"
:
'出账'
if
i
[
"type"
]
==
0
else
'入账'
,
"reference_type"
:
i
[
"reference_type"
],
"amount"
:
round
(
float
(
i
[
"amount"
]),
3
),
"create_time"
:
i
[
"create_time"
]
}
if
unique_tag
in
[
"knapsack_account"
,
"user_account"
,
"guild_account"
,
"pledgeDeduction"
]:
structure
=
{
"uuid"
:
i
[
"uuid"
],
"income"
:
i
[
"income"
],
"outcome"
:
i
[
"outcome"
],
"create_time"
:
i
[
"create_time"
]
}
else
:
structure
=
{
"reference_number"
:
i
[
"reference_number"
],
"type"
:
'出账'
if
i
[
"type"
]
==
0
else
'入账'
,
"reference_type"
:
i
[
"reference_type"
],
"amount"
:
round
(
float
(
i
[
"amount"
]),
3
),
"create_time"
:
i
[
"create_time"
]
}
res_list
.
append
(
structure
)
return
res_list
...
...
app/api/account/views.py
View file @
b50ac460
...
...
@@ -102,8 +102,12 @@ def finance_info_excel(data: schemas.FinanceDetails, request: Request,
headers
=
request
.
get
(
"headers"
)
statement_list
=
AccountStatistics
(
data
.
page
,
99999
,
data
.
uuid
,
data
.
user_id
,
data
.
start_time
,
data
.
end_time
,
data
.
type
,
data
.
gift_type
,
data
.
unique_tag
)
.
get_finance_details
()
data
=
crud
.
delete_specify_field
(
statement_list
)
field_head
=
[
'订单号'
,
'出入账方式'
,
'礼物类型'
,
'金额'
,
'时间'
]
if
data
.
unique_tag
in
[
"knapsack_account"
,
"user_account"
,
"guild_account"
,
"pledgeDeduction"
]:
field_head
=
[
'uuid'
,
'入账'
,
'出账'
,
'时间'
]
statement_list
=
statement_list
[
0
]
else
:
field_head
=
[
'订单号'
,
'出入账方式'
,
'礼物类型'
,
'金额'
,
'时间'
]
data
=
crud
.
delete_specify_field
(
statement_list
,
data
.
unique_tag
)
return
statement_crud
.
data_to_file
(
db
,
data
,
"财务明细"
,
headers
,
field_head
)
...
...
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