Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Automat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯佳佳
Automat
Commits
1c80ee4b
Commit
1c80ee4b
authored
Feb 25, 2022
by
Aeolus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9043de60
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
myapps/pc_management/api/rent_portal.py
+44
-0
No files found.
myapps/pc_management/api/rent_portal.py
View file @
1c80ee4b
...
...
@@ -724,3 +724,47 @@ def run_draw_detail():
"status"
:
i
.
status
,
})
return
BaseResponse
(
data
=
{
"list"
:
return_data
})
@rent_route.route
(
"all_draw_money"
,
methods
=
[
"POST"
])
def
run_all_draw_money
():
"""
:return:
"""
sql
=
"""
select sum(real_total) as real_total from (SELECT
SUM(tab1.real_total) AS real_total,
tab1.bill_date,
IFNULL(draw_record.status, - 2) as status,
IFNULL(draw_record.real_total, 0) AS drawed_total
FROM
(SELECT
SUM(total * rate / 100) AS real_total,
rent.business_id,
DATE_FORMAT(rent.created_at, '
%
Y-
%
m-
%
d') AS bill_date,
admin_business.rate AS rate,
business.business_name AS business_name
FROM
rent
LEFT JOIN admin_business ON admin_business.business_id = rent.business_id
LEFT JOIN business ON business.id = rent.business_id
WHERE
0 = 0
AND rent.created_at < '{}'
AND admin_business.user_id = '{}'
AND admin_business.status = 1
AND admin_business.rate > 0
GROUP BY DATE_FORMAT(rent.created_at, '
%
Y-
%
m-
%
d') , rent.business_id) AS tab1
LEFT JOIN
draw_record ON draw_record.bill_date = tab1.bill_date
AND draw_record.status != - 1
WHERE
tab1.real_total > '0'
GROUP BY tab1.bill_date) as tab2
where tab2.status = -2
"""
.
format
(
datetime
.
datetime
.
now
()
.
date
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
),
g
.
user
.
id
)
result
=
int
(
db
.
session
.
execute
(
sql
)
.
fetchone
()[
"real_total"
])
return
BaseResponse
(
data
=
{
"all_draw_money"
:
result
})
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