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
f88d0280
Commit
f88d0280
authored
Apr 17, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计出账和入账账
parent
6700d301
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
crud.py
app/api/export/crud.py
+12
-2
views.py
app/api/export/views.py
+2
-2
No files found.
app/api/export/crud.py
View file @
f88d0280
...
@@ -140,14 +140,24 @@ class CalculationMonthlyDetails(object):
...
@@ -140,14 +140,24 @@ class CalculationMonthlyDetails(object):
result
=
LinkMysql
(
db
)
.
query_mysql
(
sql
)
result
=
LinkMysql
(
db
)
.
query_mysql
(
sql
)
return
len
(
result
)
return
len
(
result
)
@
staticmethod
def
calculation_total
(
db
,
date
,
reference_type
,
is_out
):
sql
=
f
"SELECT sum(amount)/1000 as amount FROM {date} where reference_type='{reference_type}' and type={is_out}"
result
=
LinkMysql
(
db
)
.
query_mysql
(
sql
)
return
result
def
statement_income_expenditure
(
self
,
**
param
):
def
statement_income_expenditure
(
self
,
**
param
):
with
ThreadPoolExecutor
(
max_workers
=
2
)
as
pool
:
with
ThreadPoolExecutor
(
max_workers
=
3
)
as
pool
:
future1
=
pool
.
submit
(
self
.
data_query
,
env
.
DB_HISTORY
,
'assets_log_'
+
param
.
get
(
"date"
),
param
.
get
(
"key"
),
param
.
get
(
"is_income"
),
param
.
get
(
"page"
),
param
.
get
(
"size"
))
future1
=
pool
.
submit
(
self
.
data_query
,
env
.
DB_HISTORY
,
'assets_log_'
+
param
.
get
(
"date"
),
param
.
get
(
"key"
),
param
.
get
(
"is_income"
),
param
.
get
(
"page"
),
param
.
get
(
"size"
))
future2
=
pool
.
submit
(
self
.
acquired_total
,
env
.
DB_HISTORY
,
'assets_log_'
+
param
.
get
(
"date"
),
param
.
get
(
"key"
),
param
.
get
(
"is_income"
))
future2
=
pool
.
submit
(
self
.
acquired_total
,
env
.
DB_HISTORY
,
'assets_log_'
+
param
.
get
(
"date"
),
param
.
get
(
"key"
),
param
.
get
(
"is_income"
))
future3
=
pool
.
submit
(
self
.
calculation_total
,
env
.
DB_HISTORY
,
'assets_log_'
+
param
.
get
(
"date"
),
param
.
get
(
"key"
),
param
.
get
(
"is_income"
))
data
=
future1
.
result
()
data
=
future1
.
result
()
num
=
future2
.
result
()
num
=
future2
.
result
()
return
data
,
num
total
=
future3
.
result
()
if
data
:
return
data
,
num
,
float
(
total
[
0
][
'amount'
])
return
[],
0
,
0
@
staticmethod
@
staticmethod
def
query_error_data
(
date
,
reference_type
):
def
query_error_data
(
date
,
reference_type
):
...
...
app/api/export/views.py
View file @
f88d0280
...
@@ -75,8 +75,8 @@ def month_query_total_export(key: str,
...
@@ -75,8 +75,8 @@ def month_query_total_export(key: str,
"""月度计算,详情"""
"""月度计算,详情"""
if
not
date
:
if
not
date
:
return
HttpResultResponse
(
code
=
500
,
msg
=
'查询月份不能为空'
)
return
HttpResultResponse
(
code
=
500
,
msg
=
'查询月份不能为空'
)
result
,
num
=
crud
.
CalculationMonthlyDetails
()
.
statement_income_expenditure
(
key
=
key
,
is_income
=
is_income
,
page
=
page
,
size
=
size
,
date
=
date
)
result
,
total
,
count
=
crud
.
CalculationMonthlyDetails
()
.
statement_income_expenditure
(
key
=
key
,
is_income
=
is_income
,
page
=
page
,
size
=
size
,
date
=
date
)
return
HttpResultResponse
(
total
=
num
,
data
=
resul
t
)
return
HttpResultResponse
(
total
=
total
,
data
=
result
,
count
=
coun
t
)
@
router
.
post
(
"/error/data"
)
@
router
.
post
(
"/error/data"
)
...
...
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