Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tour_business
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
0
Merge Requests
0
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
魏强
tour_business
Commits
c746330f
Commit
c746330f
authored
Jun 15, 2020
by
魏强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qwe;
parent
46938a5f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
37 deletions
+59
-37
Service/RentService.py
+59
-37
No files found.
Service/RentService.py
View file @
c746330f
...
@@ -96,47 +96,69 @@ class RentService():
...
@@ -96,47 +96,69 @@ class RentService():
@staticmethod
@staticmethod
def
get_production_detail_new
(
rent_no
,
hatch_no
):
def
get_production_detail_new
(
rent_no
,
hatch_no
):
sql
=
'''
if
not
hatch_no
:
SELECT rent.deposit, rent.is_over, production.is_return, production.total, production.return_hatch_no,
rent_detail
=
Rent
.
query
.
filter_by
(
rent_no
=
rent_no
)
.
first
()
production.rent_machine_id, rent.customer_id, rent.real_total, rent.rent_no, production.return_time,
total_info
=
[]
rent.free_time, rent.one_day_price, rent.pay_time, rent.spot_id, production.is_refund, production.refund_no,
tmp
=
{
rent_refund.refund_no AS rent_refund_no FROM rent
'deposit'
:
9900
,
LEFT JOIN production ON production.rent_id = rent.id
'is_return'
:
1
,
LEFT JOIN rent_refund ON rent_refund.production_id = production.id
'status'
:
0
,
WHERE rent.rent_no = "{rent_no}" AND production.rent_hatch_no = {hatch_no}
'mac_no'
:
None
,
'''
.
format
(
rent_no
=
rent_no
,
hatch_no
=
hatch_no
)
'phone'
:
RentService
.
get_customer_phone
(
rent_detail
.
customer_id
),
production_info
=
db
.
session
.
execute
(
sql
)
'real_total'
:
0
,
total_info
=
[]
'rent_no'
:
rent_no
,
for
info
in
production_info
:
'rent_over_time'
:
None
,
cur_info
=
{}
'rent_price'
:
None
,
cur_info
[
'deposit'
]
=
info
.
deposit
'spot_name'
:
RentService
.
get_rent_spot_name
(
rent_detail
.
spot_id
),
cur_info
[
'is_return'
]
=
info
.
is_over
'is_refund'
:
0
,
if
info
.
is_return
==
1
:
'refund_no'
:
None
,
if
info
.
total
<=
0
:
'rent_refund_no'
:
None
,
if
info
.
return_hatch_no
==
127
:
}
cur_info
[
'status'
]
=
3
total_info
.
append
(
tmp
)
return
total_info
else
:
sql
=
'''
SELECT rent.deposit, rent.is_over, production.is_return, production.total, production.return_hatch_no,
production.rent_machine_id, rent.customer_id, rent.real_total, rent.rent_no, production.return_time,
rent.free_time, rent.one_day_price, rent.pay_time, rent.spot_id, production.is_refund, production.refund_no,
rent_refund.refund_no AS rent_refund_no FROM rent
LEFT JOIN production ON production.rent_id = rent.id
LEFT JOIN rent_refund ON rent_refund.production_id = production.id
WHERE rent.rent_no = "{rent_no}" AND production.rent_hatch_no = {hatch_no}
'''
.
format
(
rent_no
=
rent_no
,
hatch_no
=
hatch_no
)
production_info
=
db
.
session
.
execute
(
sql
)
total_info
=
[]
for
info
in
production_info
:
cur_info
=
{}
cur_info
[
'deposit'
]
=
info
.
deposit
cur_info
[
'is_return'
]
=
info
.
is_over
if
info
.
is_return
==
1
:
if
info
.
total
<=
0
:
if
info
.
return_hatch_no
==
127
:
cur_info
[
'status'
]
=
3
else
:
cur_info
[
'status'
]
=
2
else
:
else
:
cur_info
[
'status'
]
=
2
cur_info
[
'status'
]
=
1
else
:
else
:
cur_info
[
'status'
]
=
1
cur_info
[
'status'
]
=
0
else
:
cur_info
[
'status'
]
=
0
cur_info
[
'mac_no'
]
=
RentService
.
get_rent_machine
(
info
.
rent_machine_id
)
cur_info
[
'mac_no'
]
=
RentService
.
get_rent_machine
(
info
.
rent_machine_id
)
cur_info
[
'phone'
]
=
RentService
.
get_customer_phone
(
info
.
customer_id
)
cur_info
[
'phone'
]
=
RentService
.
get_customer_phone
(
info
.
customer_id
)
cur_info
[
'real_total'
]
=
info
.
real_total
cur_info
[
'real_total'
]
=
info
.
real_total
cur_info
[
'rent_no'
]
=
info
.
rent_no
cur_info
[
'rent_no'
]
=
info
.
rent_no
cur_info
[
'rent_over_time'
]
=
None
if
not
info
.
return_time
else
Helper
.
getFormatDate
(
info
.
return_time
)
cur_info
[
'rent_over_time'
]
=
None
if
not
info
.
return_time
else
Helper
.
getFormatDate
(
info
.
return_time
)
cur_info
[
'rent_price'
]
=
str
(
info
.
free_time
)
+
'分钟内免费,日租金'
+
str
(
cur_info
[
'rent_price'
]
=
str
(
info
.
free_time
)
+
'分钟内免费,日租金'
+
str
(
round
(
info
.
one_day_price
/
100
,
2
))
+
'元/个'
round
(
info
.
one_day_price
/
100
,
2
))
+
'元/个'
cur_info
[
'rent_start_time'
]
=
Helper
.
getFormatDate
(
info
.
pay_time
)
cur_info
[
'rent_start_time'
]
=
Helper
.
getFormatDate
(
info
.
pay_time
)
cur_info
[
'spot_name'
]
=
RentService
.
get_rent_spot_name
(
info
.
spot_id
)
cur_info
[
'spot_name'
]
=
RentService
.
get_rent_spot_name
(
info
.
spot_id
)
cur_info
[
'is_refund'
]
=
info
.
is_refund
cur_info
[
'is_refund'
]
=
info
.
is_refund
cur_info
[
'refund_no'
]
=
info
.
refund_no
cur_info
[
'refund_no'
]
=
info
.
refund_no
cur_info
[
'rent_refund_no'
]
=
info
.
rent_refund_no
cur_info
[
'rent_refund_no'
]
=
info
.
rent_refund_no
total_info
.
append
(
cur_info
)
total_info
.
append
(
cur_info
)
return
total_info
return
total_info
@staticmethod
@staticmethod
def
get_production_detail
(
rent_no
,
hatch_no
):
def
get_production_detail
(
rent_no
,
hatch_no
):
...
...
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