Commit 52a835c022704bb3f3ecf147a7da33b0c07fb82d

Authored by lixi
2 parents 2635b8d3 bb414ba8

Merge remote-tracking branch 'origin/master'

commons/api/entranceFeeBillList.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/7/29 16:48
  4 +# @Author : Ljq
  5 +# @File : entranceFeeBillList.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +进门单列表接口封装
  10 +"""
  11 +
  12 +import json,time,random
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.MySession import my
  15 +import urllib3
  16 +
  17 +def listPage(host="",attrName="收费单号",attrValue=None,**kwargs):
  18 + """
  19 + 进门单列表查询接口
  20 + :param kwargs:
  21 + rows=10
  22 + page=1
  23 + sort=et.created
  24 + order=desc
  25 + attr=number
  26 + attrValue=11
  27 + carTypeId=53
  28 + categoryId=14152
  29 + productName=1
  30 + status=2
  31 + tradeTypeId=70
  32 + tareOperatorName=11
  33 + startTime=2021-07-29 00:00:00
  34 + endTime=2021-07-29 23:59:59
  35 + startPayTime=2021-07-29 00:00:00
  36 + endPayTime=2021-07-29 23:59:59
  37 + startRefundTime=2021-07-29 00:00:00
  38 + endRefundTime=2021-07-29 23:59:59
  39 + """
  40 +
  41 + headers = dct.urlCode()
  42 + url = host + "/entranceFeeBill/listPage.action"
  43 + attr_list = {"收费单号": "number", "车号": "likePlate", "商品": "goods", "收费员": "pay", "客户姓名": "cname",
  44 + "客户卡号": "ic", "手机号码": "phone"}
  45 + data = {"rows": "10", "page": "1", "sort": "et.created", "order": "desc",
  46 + "metadata[created]": {"provider": "datetimeProvider", "index": 10, "field": "created"},
  47 + "metadata[totalPrice]": {"provider": "moneyProvider", "index": 20, "field": "totalPrice"},
  48 + "metadata[paymentTime]": {"provider": "datetimeProvider", "index": 30, "field": "paymentTime"},
  49 + "metadata[type]": {"provider": "entranceFeeBillTypeProvider", "index": 40, "field": "type"},
  50 + "metadata[status]": {"provider": "entranceFeeBillStateProvider", "index": 50, "field": "status"},
  51 + "attr": "number"}
  52 +
  53 + # 查询类型处理
  54 + attr = attr_list[attrName]
  55 + data["attr"] = attr
  56 + if attrValue != None:
  57 + data["attrValue"]=attrValue
  58 +
  59 + # 参数替换与部分参数数据格式处理
  60 + data = dict(data, **kwargs)
  61 + data["metadata[created]"] = json.dumps(data["metadata[created]"])
  62 + data["metadata[totalPrice]"] = json.dumps(data["metadata[totalPrice]"])
  63 + data["metadata[paymentTime]"] = json.dumps(data["metadata[paymentTime]"])
  64 + data["metadata[type]"] = json.dumps(data["metadata[type]"])
  65 + data["metadata[status]"] = json.dumps(data["metadata[status]"])
  66 +
  67 + # 请求接口
  68 + res = my.useHeadersRequests(method="POST", url=url, data=data, headers=headers)
  69 + return res
  70 +
  71 +def get_OrderDetails(host="",orderId=None):
  72 + """获取订单详情"""
  73 + headers = dct.urlCode()
  74 + url = host + f"/entranceFeeBill/pay/{orderId}.action"
  75 + res = my.useHeadersRequests("get", url=url, headers=headers)
  76 + return res
  77 +
  78 +def get_icCheck(host="",ic=None):
  79 + """进门缴费单详情页面刷卡刷卡"""
  80 + headers = dct.urlCode()
  81 + url = host + f"/api/jmsf/ajax/icCheck?ic={ic}"
  82 + res = my.useHeadersRequests("get", url=url,headers=headers)
  83 + return res
  84 +
  85 +def get_city(host="",name=None):
  86 + """进门缴费单详情页面获取产地信息"""
  87 + headers = dct.urlCode()
  88 + url = host + f"/api/jmsf/ajax/city/?name={name}&query={name}"
  89 + res = my.useHeadersRequests("get", url=url,headers=headers)
  90 + return res
  91 +
  92 +# a = listPage(host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202107290900021")
  93 +# print(a.json())
  94 +# orderId = a.json()["rows"][0]["id"]
  95 +# print(orderId)
  96 +# res = getOrderDetails(host="http://test.jmsf.diligrp.com:8385",orderId=orderId)
  97 +# print(res.text)
  98 +# res = get_icCheck(host="http://test.jmsf.diligrp.com:8385",ic=888810032426)
  99 +# print(res.text)
  100 +# res = get_city(host="http://test.jmsf.diligrp.com:8385",name="万州")
  101 +# print(res.text)
0 102 \ No newline at end of file
... ...
commons/api/zcApi.py
... ... @@ -9,9 +9,8 @@
9 9 整车进门相关接口
10 10 """
11 11  
12   -import json
  12 +import json,time,random
13 13 from commons.scripts import dealContentType as dct
14   -from commons import common
15 14 from commons.MySession import my
16 15  
17 16  
... ... @@ -191,7 +190,7 @@ def create_wholeCarWeighSave(host="",duplicateToken=None,**kwargs):
191 190 res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
192 191 return res
193 192  
194   -def create_jmsf(host=None,keyword="蔬菜",**kwargs):
  193 +def create_jmsf(host=None,keyword="蔬菜",newWeight=99,plate="川A12345"):
195 194 """
196 195  
197 196 """
... ... @@ -212,7 +211,7 @@ def create_jmsf(host=None,keyword="蔬菜",**kwargs):
212 211 productName = categoryByCondition.json()["data"][0]["name"]
213 212 productCode = categoryByCondition.json()["data"][0]["keycode"]
214 213  
215   - # 获取接车员信息
  214 + # 获取商品
216 215 listByExample = get_listByExample(host=host)
217 216 print(listByExample.json())
218 217 inGreeterId = listByExample.json()["data"][0]["id"]
... ... @@ -255,9 +254,21 @@ def create_jmsf(host=None,keyword="蔬菜",**kwargs):
255 254 duplicateToken = duplicateTokenRes.json()["data"]
256 255  
257 256 # 创建生成进门单
258   - plate = "川A12323"
  257 + plate = plate
259 258 productState = "1"
260 259 trailerNumber = plate
  260 +
  261 + # 重量信息准备
  262 + newWeight = newWeight
  263 + tareWeight = carTypeWeight
  264 + weighmanRecord = {"grossWeight": None, "grossWeightDate": "", "newWeight": None, "tareWeight": None,
  265 + "tareWeightDate": None, "weighImgs": []}
  266 + weighmanRecord["grossWeight"] = carTypeWeight+newWeight
  267 + weighmanRecord["tareWeight"] = carTypeWeight
  268 + weighmanRecord["newWeight"] = newWeight
  269 + weighmanRecord["grossWeightDate"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  270 +
  271 + # 创建进门单
261 272 cre_res = create_wholeCarWeighSave(host=host, duplicateToken=duplicateToken,
262 273 carTypeCode=carTypeCode, carTypeId=carTypeId,
263 274 carTypeName=carTypeName, carTypeWeight=carTypeWeight, plate=plate,
... ... @@ -266,5 +277,6 @@ def create_jmsf(host=None,keyword="蔬菜",**kwargs):
266 277 cateId=cateId, originId=originId, origin=origin, originCode=originCode,
267 278 tradeType=tradeType, tradeTypeName=tradeTypeName, productState=productState,
268 279 tradeTypeId=tradeTypeId, goodsTagId=goodsTagId, inGreeterId=inGreeterId,
269   - inGreeterName=inGreeterName, dep=feeDepId)
270   - print(cre_res.json())
271 280 \ No newline at end of file
  281 + inGreeterName=inGreeterName, dep=feeDepId, weighmanRecord=weighmanRecord)
  282 + print(cre_res.json())
  283 + return cre_res
272 284 \ No newline at end of file
... ...
config/marketConfig/test_config_hg.conf
... ... @@ -17,4 +17,5 @@ loginPwd=111111
17 17 [host]
18 18 cardHost=http://test.card.diligrp.com:8386
19 19 uapHost=http://test.uap.diligrp.com
20   -gatewayHost=http://test.gateway.diligrp.com:8285
21 20 \ No newline at end of file
  21 +gatewayHost=http://test.gateway.diligrp.com:8285
  22 +jmsfHost=http://test.jmsf.diligrp.com:8385
22 23 \ No newline at end of file
... ...
report/test.log
1   -[2021-07-29 14:16:42] [INFO] : ======================================================================================
2   -[2021-07-29 14:16:42] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType
3   -{"businessCode": "jmsf"}
4   -{}
5   -
6   -[2021-07-29 14:16:43] [INFO] : ======================================================================================
7   -[2021-07-29 14:16:43] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
8   -{"marketId": 9, "state": 1, "keyword": "\u5c71\u836f"}
9   -{}
10   -
11   -[2021-07-29 14:16:43] [INFO] : ======================================================================================
12   -[2021-07-29 14:16:43] [INFO] : http://test.gateway.diligrp.com:8285/dili-uap/userApi/listByExample.api
13   -{"firmCode": "sy", "departmentId": 58, "keyword": ""}
14   -{}
15   -
16   -[2021-07-29 14:16:44] [INFO] : ======================================================================================
17   -[2021-07-29 14:16:44] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/tradeType/query
18   -{"pageNum": 100, "pageSize": 100, "marketId": 9}
19   -{}
20   -
21   -[2021-07-29 14:16:44] [INFO] : ======================================================================================
22   -[2021-07-29 14:16:44] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid
23   -None
24   -{'params': {'pid': 'goods_tag'}}
25   -
26   -[2021-07-29 14:16:49] [INFO] : ======================================================================================
27   -[2021-07-29 14:16:49] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/address
28   -{"province": "C", "city": null, "area": null}
29   -{}
30   -
31   -[2021-07-29 14:16:50] [INFO] : ======================================================================================
32   -[2021-07-29 14:16:50] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/dep
33   -{"keyword": ""}
34   -{}
35   -
36   -[2021-07-29 14:16:50] [INFO] : ======================================================================================
37   -[2021-07-29 14:16:50] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid
38   -None
39   -{'params': {'pid': 'prove_type'}}
40   -
41   -[2021-07-29 14:16:51] [INFO] : ======================================================================================
42   -[2021-07-29 14:16:51] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/appCommon/duplicateToken.action
  1 +[2021-07-29 18:13:25] [INFO] : ======================================================================================
  2 +[2021-07-29 18:13:25] [INFO] : http://test.jmsf.diligrp.com:8385/api/jmsf/ajax/city/?name=万州&query=万州
43 3 None
44 4 {}
45 5  
46   -[2021-07-29 14:16:51] [INFO] : ======================================================================================
47   -[2021-07-29 14:16:51] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/entrace/wholeCarWeighSave
48   -{"carTypeCode": "003", "carTypeId": 53, "carTypeName": "\u677f\u8f66", "carTypeWeight": 333, "plate": "\u5dddA12323", "inGreeterId": 223, "inGreeterName": "\u6d4b\u8bd5\u6c88\u9633", "productId": 14156, "productName": "\u5c71\u836f", "proveTypeCode": 665, "proveTypeName": "\u98df\u54c1\u5b89\u5168", "weighRemark": "\u5907\u6ce8", "weighmanRecord": {"grossWeight": 3.0, "grossWeightDate": "2021-07-28 16:28:24", "newWeight": 2.0, "tareWeight": 1.0, "tareWeightDate": null, "weighImgs": []}, "productCode": null, "trailerNumber": "\u5dddA12323", "pathAddress": "A4-BB-6D-0A-F4-13", "haveTruckWeight": false, "source": 4, "entryPlateInputType": 1, "dep": 58, "depName": "\u6c34\u679c\u90e8", "cateId": 14156, "notice": 0, "backSkinTwo": -1, "recordOriginId": 0, "recordOriginName": null, "recordProductId": 0, "recordProductName": null, "recordWeight": null, "codeIc": null, "codeId": 0, "difference": 0, "bindRecordSign": 0, "recordDesc": null, "hasCodeItems": false, "customerId": 0, "customerName": "", "driverIc": null, "driverName": null, "totalPrice": null, "originId": 500101, "origin": "\u4e07\u5dde\u533a", "originCode": "023", "tradeType": "9001", "tradeTypeName": "\u6c88\u96331\u53f7", "weight": 2.0, "pwd": "", "type": 1, "ic": "", "boothNumber": "210728154359", "productState": "1", "accountId": 0, "passCheckId": 0, "passCheckName": null, "tradeTypeId": 70, "id": 0, "protocolId": null, "goodsTagId": 663}
49   -{}
50   -
51   -[2021-07-29 14:16:53] [INFO] : ======================================================================================
52   -[2021-07-29 14:16:53] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType
53   -{"businessCode": "jmsf"}
54   -{}
55   -
56   -[2021-07-29 14:16:54] [INFO] : ======================================================================================
57   -[2021-07-29 14:16:54] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
58   -{"marketId": 9, "state": 1, "keyword": "\u852c\u83dc"}
59   -{}
60   -
61   -[2021-07-29 14:16:54] [INFO] : ======================================================================================
62   -[2021-07-29 14:16:54] [INFO] : http://test.gateway.diligrp.com:8285/dili-uap/userApi/listByExample.api
63   -{"firmCode": "sy", "departmentId": 58, "keyword": ""}
64   -{}
65   -
66   -[2021-07-29 14:16:54] [INFO] : ======================================================================================
67   -[2021-07-29 14:16:54] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/tradeType/query
68   -{"pageNum": 100, "pageSize": 100, "marketId": 9}
69   -{}
70   -
71   -[2021-07-29 14:16:54] [INFO] : ======================================================================================
72   -[2021-07-29 14:16:54] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid
73   -None
74   -{'params': {'pid': 'goods_tag'}}
75   -
76   -[2021-07-29 14:16:55] [INFO] : ======================================================================================
77   -[2021-07-29 14:16:55] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/address
78   -{"province": "C", "city": null, "area": null}
79   -{}
80   -
81   -[2021-07-29 14:16:55] [INFO] : ======================================================================================
82   -[2021-07-29 14:16:55] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/dep
83   -{"keyword": ""}
84   -{}
85   -
86   -[2021-07-29 14:16:55] [INFO] : ======================================================================================
87   -[2021-07-29 14:16:55] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid
88   -None
89   -{'params': {'pid': 'prove_type'}}
90   -
91   -[2021-07-29 14:16:56] [INFO] : ======================================================================================
92   -[2021-07-29 14:16:56] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/appCommon/duplicateToken.action
93   -None
94   -{}
95   -
96   -[2021-07-29 14:16:56] [INFO] : ======================================================================================
97   -[2021-07-29 14:16:56] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/entrace/wholeCarWeighSave
98   -{"carTypeCode": "003", "carTypeId": 53, "carTypeName": "\u677f\u8f66", "carTypeWeight": 333, "plate": "\u5dddA12323", "inGreeterId": 223, "inGreeterName": "\u6d4b\u8bd5\u6c88\u9633", "productId": 14152, "productName": "\u852c\u83dc", "proveTypeCode": 665, "proveTypeName": "\u98df\u54c1\u5b89\u5168", "weighRemark": "\u5907\u6ce8", "weighmanRecord": {"grossWeight": 3.0, "grossWeightDate": "2021-07-28 16:28:24", "newWeight": 2.0, "tareWeight": 1.0, "tareWeightDate": null, "weighImgs": []}, "productCode": null, "trailerNumber": "\u5dddA12323", "pathAddress": "A4-BB-6D-0A-F4-13", "haveTruckWeight": false, "source": 4, "entryPlateInputType": 1, "dep": 58, "depName": "\u6c34\u679c\u90e8", "cateId": 14152, "notice": 0, "backSkinTwo": -1, "recordOriginId": 0, "recordOriginName": null, "recordProductId": 0, "recordProductName": null, "recordWeight": null, "codeIc": null, "codeId": 0, "difference": 0, "bindRecordSign": 0, "recordDesc": null, "hasCodeItems": false, "customerId": 0, "customerName": "", "driverIc": null, "driverName": null, "totalPrice": null, "originId": 500101, "origin": "\u4e07\u5dde\u533a", "originCode": "023", "tradeType": "9001", "tradeTypeName": "\u6c88\u96331\u53f7", "weight": 2.0, "pwd": "", "type": 1, "ic": "", "boothNumber": "210728154359", "productState": "1", "accountId": 0, "passCheckId": 0, "passCheckName": null, "tradeTypeId": 70, "id": 0, "protocolId": null, "goodsTagId": 663}
99   -{}
100   -
... ...
testcase/test_ZC/demo.py
... ... @@ -10,9 +10,27 @@
10 10 """
11 11  
12 12 import json
  13 +import datetime,time
  14 +import urllib
  15 +
  16 +# print(time.localtime())
  17 +import urllib3
  18 +
  19 +print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
  20 +
  21 +# a = {"aa":"阿三大苏打","bb":"bb","cc":{"cc1":"啊实打","cc2":"ad"}}
  22 +# print(a)
  23 +# data = {"cc":{"cc1":"2"}}
  24 +# b = dict(a,**data)
  25 +# print(b)
  26 +
  27 +# def doDcit(**kwargs):
  28 +# a = {"aa": "阿三大苏打", "bb": "bb", "cc": {"cc1": "啊实打","cc2":"ad"}}
  29 +# print(a)
  30 +# b = dict(a,**kwargs)
  31 +# print(b)
  32 +
  33 +a = {"收费单号":"number","车号":"likePlate","商品":"goods","收费员":"pay","客户姓名":"cname","客户卡号":"ic","手机号码":"phone"}
  34 +print(a["收费单号"])
  35 +urllib3
13 36  
14   -a = {"aa":"阿三大苏打","bb":"bb","cc":{"cc1":"啊实打"}}
15   -print(a)
16   -data = {"cc":{"cc1":"2"}}
17   -b = json.dumps(a,ensure_ascii=False)
18   -print(b)
19 37 \ No newline at end of file
... ...
testcase/test_ZC/test_ZC.py
... ... @@ -13,6 +13,7 @@ import json
13 13 import unittest
14 14 from commons.scripts.readConf import rC
15 15 from commons.api import zcApi as zcA
  16 +import time,random
16 17  
17 18 class test_demo(unittest.TestCase):
18 19 """整车-整车进门单创建"""
... ... @@ -26,11 +27,13 @@ class test_demo(unittest.TestCase):
26 27 @classmethod
27 28 def setUpClass(cls) -> None:
28 29 cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
  30 + cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
29 31  
30 32 @classmethod
31 33 def tearDownClass(cls) -> None:
32 34 pass
33 35  
  36 + @unittest.skip
34 37 def test_get_carType(self):
35 38 """整车-整车创建:获取车型接口调用测试"""
36 39 # 获取车型
... ... @@ -96,6 +99,17 @@ class test_demo(unittest.TestCase):
96 99 plate = "川A12323"
97 100 productState = "1"
98 101 trailerNumber = plate
  102 +
  103 + # 重量信息准备
  104 + grossWeight = random.randint(carTypeWeight,carTypeWeight+100)
  105 + tareWeight = carTypeWeight
  106 + weighmanRecord = {"grossWeight":None, "grossWeightDate": "", "newWeight": None,"tareWeight":None, "tareWeightDate": None, "weighImgs": []}
  107 + weighmanRecord["grossWeight"] = grossWeight
  108 + weighmanRecord["tareWeight"] = carTypeWeight
  109 + weighmanRecord["newWeight"] = grossWeight-carTypeWeight
  110 + weighmanRecord["grossWeightDate"]= time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  111 +
  112 + # 创建进门单
99 113 cre_res = zcA.create_wholeCarWeighSave(host=self.gatewayHost,duplicateToken=duplicateToken,carTypeCode=carTypeCode,carTypeId=carTypeId,
100 114 carTypeName=carTypeName,carTypeWeight=carTypeWeight,plate=plate,
101 115 productId=productId,productName=productName,proveTypeCode=proveTypeCode,
... ... @@ -103,12 +117,14 @@ class test_demo(unittest.TestCase):
103 117 cateId=cateId,originId=originId,origin=origin,originCode=originCode,
104 118 tradeType=tradeType,tradeTypeName=tradeTypeName,productState=productState,
105 119 tradeTypeId=tradeTypeId,goodsTagId=goodsTagId,inGreeterId=inGreeterId,
106   - inGreeterName=inGreeterName,dep=feeDepId)
  120 + inGreeterName=inGreeterName,dep=feeDepId,weighmanRecord=weighmanRecord)
107 121 print(cre_res.json())
108 122  
109 123 def test_cre(self):
110 124 """调用方法1"""
111   - zcA.create_jmsf(host=self.gatewayHost,keyword="山药")
  125 + cre_res = zcA.create_jmsf(host=self.gatewayHost,plate="川B00001",keyword="山药",newWeight=20)
  126 + print(cre_res.json())
  127 +
112 128  
113 129  
114 130  
... ... @@ -116,4 +132,4 @@ class test_demo(unittest.TestCase):
116 132  
117 133 # if __name__ == "__main__":
118 134 # unittest.main()
119   -# 啊实打
120 135 \ No newline at end of file
  136 +#
121 137 \ No newline at end of file
... ...