Commit f276518a by 魏强

qwe;

parent c746330f
......@@ -73,7 +73,10 @@ def rent_detail():
rent_no = json_data['rent_no'] if 'rent_no' in json_data else ''
hatch_no = json_data['hatch_no'] if 'hatch_no' in json_data else ''
# data = RentService.get_production_detail(rent_no, hatch_no)
data = RentService.get_production_detail_new(rent_no, hatch_no)
if not hatch_no:
data = RentService.get_no_production_detail(rent_no)
else:
data = RentService.get_production_detail_new(rent_no, hatch_no)
return jsonify(BASE_RESPONSE(data=data).to_dict())
......
......@@ -95,30 +95,31 @@ class RentService():
return data
@staticmethod
def get_no_production_detail(rent_no):
rent_detail = Rent.query.filter_by(rent_no=rent_no).first()
total_info = []
tmp = {
'deposit': 9900,
'is_return': 1,
'status': 0,
'mac_no': None,
'phone': RentService.get_customer_phone(rent_detail.customer_id),
'real_total': 0,
'rent_no': rent_no,
'rent_over_time': None,
'rent_price': None,
'spot_name': RentService.get_rent_spot_name(rent_detail.spot_id),
'is_refund': 0,
'refund_no': None,
'rent_refund_no': None,
}
total_info.append(tmp)
return total_info
@staticmethod
def get_production_detail_new(rent_no, hatch_no):
if not hatch_no:
rent_detail = Rent.query.filter_by(rent_no=rent_no).first()
total_info = []
tmp = {
'deposit': 9900,
'is_return': 1,
'status': 0,
'mac_no': None,
'phone': RentService.get_customer_phone(rent_detail.customer_id),
'real_total': 0,
'rent_no': rent_no,
'rent_over_time': None,
'rent_price': None,
'spot_name': RentService.get_rent_spot_name(rent_detail.spot_id),
'is_refund': 0,
'refund_no': None,
'rent_refund_no': None,
}
total_info.append(tmp)
return total_info
else:
sql = '''
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,
......@@ -127,38 +128,38 @@ class RentService():
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
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'] = 1
cur_info['status'] = 2
else:
cur_info['status'] = 0
cur_info['status'] = 1
else:
cur_info['status'] = 0
cur_info['mac_no'] = RentService.get_rent_machine(info.rent_machine_id)
cur_info['phone'] = RentService.get_customer_phone(info.customer_id)
cur_info['real_total'] = info.real_total
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_price'] = str(info.free_time) + '分钟内免费,日租金' + str(
round(info.one_day_price / 100, 2)) + '元/个'
cur_info['rent_start_time'] = Helper.getFormatDate(info.pay_time)
cur_info['spot_name'] = RentService.get_rent_spot_name(info.spot_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['real_total'] = info.real_total
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_price'] = str(info.free_time) + '分钟内免费,日租金' + str(
round(info.one_day_price / 100, 2)) + '元/个'
cur_info['rent_start_time'] = Helper.getFormatDate(info.pay_time)
cur_info['spot_name'] = RentService.get_rent_spot_name(info.spot_id)
cur_info['is_refund'] = info.is_refund
cur_info['refund_no'] = info.refund_no
cur_info['rent_refund_no'] = info.rent_refund_no
total_info.append(cur_info)
return total_info
cur_info['is_refund'] = info.is_refund
cur_info['refund_no'] = info.refund_no
cur_info['rent_refund_no'] = info.rent_refund_no
total_info.append(cur_info)
return total_info
@staticmethod
def get_production_detail(rent_no, hatch_no):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment