entranceFeeBillList.py
3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# -*- coding: utf-8 -*-
# @Time : 2021/7/29 16:48
# @Author : Ljq
# @File : entranceFeeBillList.py
# @Software: PyCharm
"""
进门单列表接口封装
"""
import json,time,random
from commons.scripts import dealContentType as dct
from commons.MySession import my
import urllib3
def listPage(host="",attrName="收费单号",attrValue=None,**kwargs):
"""
进门单列表查询接口
:param kwargs:
rows=10
page=1
sort=et.created
order=desc
attr=number
attrValue=11
carTypeId=53
categoryId=14152
productName=1
status=2
tradeTypeId=70
tareOperatorName=11
startTime=2021-07-29 00:00:00
endTime=2021-07-29 23:59:59
startPayTime=2021-07-29 00:00:00
endPayTime=2021-07-29 23:59:59
startRefundTime=2021-07-29 00:00:00
endRefundTime=2021-07-29 23:59:59
"""
headers = dct.urlCode()
url = host + "/entranceFeeBill/listPage.action"
attr_list = {"收费单号": "number", "车号": "likePlate", "商品": "goods", "收费员": "pay", "客户姓名": "cname",
"客户卡号": "ic", "手机号码": "phone"}
data = {"rows": "10", "page": "1", "sort": "et.created", "order": "desc",
"metadata[created]": {"provider": "datetimeProvider", "index": 10, "field": "created"},
"metadata[totalPrice]": {"provider": "moneyProvider", "index": 20, "field": "totalPrice"},
"metadata[paymentTime]": {"provider": "datetimeProvider", "index": 30, "field": "paymentTime"},
"metadata[type]": {"provider": "entranceFeeBillTypeProvider", "index": 40, "field": "type"},
"metadata[status]": {"provider": "entranceFeeBillStateProvider", "index": 50, "field": "status"},
"attr": "number"}
# 查询类型处理
attr = attr_list[attrName]
data["attr"] = attr
if attrValue != None:
data["attrValue"]=attrValue
# 参数替换与部分参数数据格式处理
data = dict(data, **kwargs)
data["metadata[created]"] = json.dumps(data["metadata[created]"])
data["metadata[totalPrice]"] = json.dumps(data["metadata[totalPrice]"])
data["metadata[paymentTime]"] = json.dumps(data["metadata[paymentTime]"])
data["metadata[type]"] = json.dumps(data["metadata[type]"])
data["metadata[status]"] = json.dumps(data["metadata[status]"])
# 请求接口
res = my.useHeadersRequests(method="POST", url=url, data=data, headers=headers)
return res
def get_OrderDetails(host="",orderId=None):
"""获取订单详情"""
headers = dct.urlCode()
url = host + f"/entranceFeeBill/pay/{orderId}.action"
res = my.useHeadersRequests("get", url=url, headers=headers)
return res
def get_icCheck(host="",ic=None):
"""进门缴费单详情页面刷卡刷卡"""
headers = dct.urlCode()
url = host + f"/api/jmsf/ajax/icCheck?ic={ic}"
res = my.useHeadersRequests("get", url=url,headers=headers)
return res
def get_city(host="",name=None):
"""进门缴费单详情页面获取产地信息"""
headers = dct.urlCode()
url = host + f"/api/jmsf/ajax/city/?name={name}&query={name}"
res = my.useHeadersRequests("get", url=url,headers=headers)
return res
# a = listPage(host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202107290900021")
# print(a.json())
# orderId = a.json()["rows"][0]["id"]
# print(orderId)
# res = getOrderDetails(host="http://test.jmsf.diligrp.com:8385",orderId=orderId)
# print(res.text)
# res = get_icCheck(host="http://test.jmsf.diligrp.com:8385",ic=888810032426)
# print(res.text)
# res = get_city(host="http://test.jmsf.diligrp.com:8385",name="万州")
# print(res.text)