Commit d8b64161f3cf83eab8233ac59e3c358b0c15d8e7

Authored by lixi
2 parents 3584627f 5f8af56a

Merge remote-tracking branch 'origin/master'

commons/api/entranceFeeBillList.py
@@ -247,9 +247,182 @@ def do_doPay(host="",autocompletecartype=None,fee_str="",**kwargs): @@ -247,9 +247,182 @@ def do_doPay(host="",autocompletecartype=None,fee_str="",**kwargs):
247 res = my.useHeadersRequests("post", url=url, data=data_uc, headers=headers) 247 res = my.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
248 return res 248 return res
249 249
  250 +def do_payOrder(host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032"):
  251 + a = listPage(host=host, attrName=attrName, attrValue=attrValue)
  252 + print("listPage", a.json())
  253 + orderId = a.json()["rows"][0]["id"]
  254 + number = a.json()["rows"][0]["number"]
  255 + created = a.json()["rows"][0]["created"]
  256 + print(orderId)
  257 +
  258 + # # 订单详情获取
  259 +
  260 + resOrderDetails = get_OrderDetails(host=host, orderId=orderId)
  261 + unitPrice = re.findall('name="unitPrice" value="(.*?)" id', resOrderDetails.text)[0]
  262 + goodsId = re.findall('id="goodsId" value="(.*?)">', resOrderDetails.text)[0]
  263 + status = re.findall('"status" name="status" value="(.*?)">', resOrderDetails.text)[0]
  264 + source = re.findall('id="source" name="source" value="(.*?)">', resOrderDetails.text)[0]
  265 + optType = re.findall('id="optType" name="optType" value="(.*?)">', resOrderDetails.text)[0]
  266 + correctInfo = re.findall('d="correctInfo" name="correctInfo" value="(.*?)">', resOrderDetails.text)[0]
  267 + weightType = re.findall('name="weightType" id="weightType" value="(.*?)">', resOrderDetails.text)[0]
  268 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', resOrderDetails.text)[0]
  269 + regionId = re.findall('<option value="(.*?)" bind-name="', resOrderDetails.text)[0]
  270 + goodsTagIds = \
  271 + re.findall('<input name="goodsTagIds" type="radio" value="(.*?)" readonly checked>', resOrderDetails.text)[0]
  272 + sumPrice = re.findall('<input type="hidden" name="sumPrice" value="(.*?)" id="sumPrice">', resOrderDetails.text)[0]
  273 + calcFeeDepId = re.findall('<input type="hidden" name="calcFeeDepId" value="(.*?)">', resOrderDetails.text)[0]
  274 + tradeTypeId = \
  275 + re.findall('input type="hidden" class="form-control" name="tradeTypeId" value="(.*?)" >', resOrderDetails.text)[0]
  276 + shareRatio = \
  277 + re.findall('input type="hidden" id="shareRatioVal" name="shareRatio" value="(.*?)"', resOrderDetails.text)[0]
  278 + regionName = re.findall('" bind-name="(.*?)"', resOrderDetails.text)[0]
  279 +
  280 + # 用户信息获取
  281 + ic = 888810032426
  282 + res = get_icCheck(host=host, ic=ic)
  283 + print(res.text)
  284 + customerId = res.json()["data"]["aInfo"]["customerId"]
  285 + customerName = res.json()["data"]["aInfo"]["customerName"]
  286 + accountId = res.json()["data"]["aInfo"]["accountId"]
  287 + mobile = res.json()["data"]["aInfo"]["mobile"]
  288 +
  289 + # 省市区获取
  290 + res = get_city(host=host, name="万州")
  291 + print(res.text)
  292 + originId = res.json()["suggestions"][0]["id"]
  293 + parentId = res.json()["suggestions"][0]["parentId"]
  294 + value = res.json()["suggestions"][0]["value"]
  295 +
  296 + # 获取缴费金额
  297 + # host = "http://test.jmsf.diligrp.com:8385"
  298 + plate = re.findall('name="plate" class="form-control" value="(.*?)" id="plate"', resOrderDetails.text)[0]
  299 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  300 + carTypeName = re.findall('name="carTypeName" id="carTypeName" value="(.*?)" ', resOrderDetails.text)[0]
  301 + carTypeCode = re.findall('name="carTypeCode" id="carTypeCode" value="(.*?)" ', resOrderDetails.text)[0]
  302 + carTypeId = re.findall('name="carTypeId" id="carTypeId" value="(.*?)" ', resOrderDetails.text)[0]
  303 + carTypeWeight = "333"
  304 + proveType = re.findall(' value="(.*?)" id="proveType" name="proveType"', resOrderDetails.text)[0]
  305 + proveTypeCode = proveType
  306 + grossWeight = re.findall('name="grossWeight" id="grossWeight" value="(.*?)"', resOrderDetails.text)[0]
  307 + newWeight = re.findall('name="weight" readonly value="(.*?)" id="weight"', resOrderDetails.text)[0]
  308 + tareWeight = re.findall('name="tareWeight" id="tareWeight" value="(.*?)"', resOrderDetails.text)[0]
  309 + depName = re.findall('id="depName" name="depName" value="(.*?)"', resOrderDetails.text)[0]
  310 + feeDepId = re.findall('name="calcDepId" value="(.*?)"', resOrderDetails.text)[0]
  311 + productName = re.findall('name="productName" value="(.*?)"', resOrderDetails.text)[0]
  312 + productId = re.findall('id="productId" value="(.*?)"', resOrderDetails.text)[0]
  313 + grossWeightDate = re.findall('name="grossWeightDate" value="(.*?)"', resOrderDetails.text)[0]
  314 + tareWeightDate = re.findall('name="tareWeightDate" value="(.*?)"', resOrderDetails.text)[0]
  315 + weight = re.findall('name="weight" readonly value="(.*?)"', resOrderDetails.text)[0]
  316 + calcDepId = re.findall('name="calcDepId" value="(.*?)"', resOrderDetails.text)[0]
  317 + categoryName = "水果"
  318 + categoryId = "14436"
  319 + inGreeterName = re.findall('id="inGreeterName" value="(.*?)"', resOrderDetails.text)[0]
  320 + inGreeterId = re.findall('name="inGreeterId" id="inGreeterId" value="(.*?)"', resOrderDetails.text)[0]
  321 +
  322 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  323 + print(autocompletecartype)
  324 +
  325 + res = get_calculateRes(host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  326 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  327 + status=status,
  328 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  329 + carTypeCode=carTypeCode,
  330 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  331 + grossWeight=grossWeight,
  332 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  333 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  334 + goodsTagIds=goodsTagIds,
  335 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  336 + grossWeightDate=grossWeightDate,
  337 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, calcDepId=calcDepId, weight=weight,
  338 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  339 +
  340 + # backSkinTwo = re.findall('name="backSkinTwo" value="(.*?)" >',res.text)[0]
  341 + # 缴费信息
  342 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  343 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  344 + collectionPrice = re.findall('" name="collectionPrice" value="(.*?)">', res.text)[0]
  345 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  346 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  347 + billItemCheckIds = re.findall('" name="billItemCheckIds" value="(.*?)" ', res.text)[0]
  348 + billItemCheckIdsV = re.findall('" maxlength="15" data-old="(.*?)"', res.text)[0]
  349 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  350 +
  351 + soup = BeautifulSoup(res.text, "html.parser")
  352 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  353 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  354 + fee_int = 0
  355 + discount_amount = 0
  356 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  357 + print("=============================================")
  358 + c = tag.findAll("input")
  359 + for i in c:
  360 + print(i)
  361 + if i.get("name") != None:
  362 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  363 + if i.get("type") == "text":
  364 + print("---------------- f 2 s----------------")
  365 + print(i)
  366 + print(i.get("value"))
  367 + fee_int = fee_int + int(float(i.get("value")))
  368 + print("---------------- f 2 e----------------")
  369 + if "优惠" in i.get("value"):
  370 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  371 + # fee_int = fee_int+int(i.get("value"))
  372 + # print(fee_str)
  373 + # print(fee_int)
  374 + # print("discount_amount",discount_amount)
  375 + # print("discountAmount",discountAmount)
  376 +
  377 + pwd = "111111"
  378 + id = orderId
  379 + totalAmount = totalMoney
  380 + customerPhone = mobile
  381 + productPrice = "1.00000"
  382 + dep = feeDepId
  383 + productArea = "重庆,重庆市,万州区"
  384 + chargeTotalAmount = totalMoney
  385 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  386 + freezeMoneySymbol = fee_int
  387 + comparisonFreezeAmount = fee_int
  388 + modified = created
  389 + firmCode = my.userInfo["data"]["user"]["firmCode"]
  390 + marketFlag = firmCode
  391 + collectionPrice = 0
  392 + itemReceivableAmount = receivable
  393 + receivableAmount = receivable
  394 + tareWeightDate = tareWeightDate
  395 + aa = do_doPay(host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  396 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  397 + source=source,
  398 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  399 + fundAccount=accountId,
  400 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  401 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  402 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  403 + productPrice=productPrice,
  404 + unitPrice=unitPrice, depName=depName, calcDepId=calcDepId, dep=dep, regionName=regionName,
  405 + regionId=regionId,
  406 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  407 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  408 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  409 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  410 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  411 + handReceivableAmount=handReceivableAmount,
  412 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  413 + categoryName=categoryName,
  414 + categoryId=carTypeId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  415 + sumPrice=sumPrice,
  416 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  417 +
  418 + print(aa.text)
  419 + return aa
  420 +
  421 +# do_payOrder(attrValue="202108060900035")
250 422
251 423
252 -a = listPage(host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900028") 424 +"""
  425 +a = listPage(host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032")
253 print("listPage",a.json()) 426 print("listPage",a.json())
254 orderId = a.json()["rows"][0]["id"] 427 orderId = a.json()["rows"][0]["id"]
255 number = a.json()["rows"][0]["number"] 428 number = a.json()["rows"][0]["number"]
@@ -257,15 +430,12 @@ created = a.json()[&quot;rows&quot;][0][&quot;created&quot;] @@ -257,15 +430,12 @@ created = a.json()[&quot;rows&quot;][0][&quot;created&quot;]
257 print(orderId) 430 print(orderId)
258 431
259 # # 订单详情获取 432 # # 订单详情获取
260 -# orderId = 3674 433 +
261 resOrderDetails = get_OrderDetails(host="http://test.jmsf.diligrp.com:8385",orderId=orderId) 434 resOrderDetails = get_OrderDetails(host="http://test.jmsf.diligrp.com:8385",orderId=orderId)
262 -# print(res.text)  
263 unitPrice = re.findall('name="unitPrice" value="(.*?)" id',resOrderDetails.text)[0] 435 unitPrice = re.findall('name="unitPrice" value="(.*?)" id',resOrderDetails.text)[0]
264 -  
265 goodsId = re.findall('id="goodsId" value="(.*?)">',resOrderDetails.text)[0] 436 goodsId = re.findall('id="goodsId" value="(.*?)">',resOrderDetails.text)[0]
266 status = re.findall('"status" name="status" value="(.*?)">',resOrderDetails.text)[0] 437 status = re.findall('"status" name="status" value="(.*?)">',resOrderDetails.text)[0]
267 source = re.findall('id="source" name="source" value="(.*?)">',resOrderDetails.text)[0] 438 source = re.findall('id="source" name="source" value="(.*?)">',resOrderDetails.text)[0]
268 -  
269 optType = re.findall('id="optType" name="optType" value="(.*?)">',resOrderDetails.text)[0] 439 optType = re.findall('id="optType" name="optType" value="(.*?)">',resOrderDetails.text)[0]
270 correctInfo = re.findall('d="correctInfo" name="correctInfo" value="(.*?)">',resOrderDetails.text)[0] 440 correctInfo = re.findall('d="correctInfo" name="correctInfo" value="(.*?)">',resOrderDetails.text)[0]
271 weightType = re.findall('name="weightType" id="weightType" value="(.*?)">',resOrderDetails.text)[0] 441 weightType = re.findall('name="weightType" id="weightType" value="(.*?)">',resOrderDetails.text)[0]
@@ -296,42 +466,29 @@ parentId = res.json()[&quot;suggestions&quot;][0][&quot;parentId&quot;] @@ -296,42 +466,29 @@ parentId = res.json()[&quot;suggestions&quot;][0][&quot;parentId&quot;]
296 value = res.json()["suggestions"][0]["value"] 466 value = res.json()["suggestions"][0]["value"]
297 467
298 # 获取缴费金额 468 # 获取缴费金额
299 -plate="川B00001"  
300 host="http://test.jmsf.diligrp.com:8385" 469 host="http://test.jmsf.diligrp.com:8385"
  470 +plate= re.findall('name="plate" class="form-control" value="(.*?)" id="plate"',resOrderDetails.text)[0]
301 modified=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) 471 modified=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
302 carTypeName= re.findall('name="carTypeName" id="carTypeName" value="(.*?)" ',resOrderDetails.text)[0] 472 carTypeName= re.findall('name="carTypeName" id="carTypeName" value="(.*?)" ',resOrderDetails.text)[0]
303 carTypeCode = re.findall('name="carTypeCode" id="carTypeCode" value="(.*?)" ',resOrderDetails.text)[0] 473 carTypeCode = re.findall('name="carTypeCode" id="carTypeCode" value="(.*?)" ',resOrderDetails.text)[0]
304 carTypeId = re.findall('name="carTypeId" id="carTypeId" value="(.*?)" ',resOrderDetails.text)[0] 474 carTypeId = re.findall('name="carTypeId" id="carTypeId" value="(.*?)" ',resOrderDetails.text)[0]
305 carTypeWeight = "333" 475 carTypeWeight = "333"
306 -# proveTypeCode = "1621"  
307 proveType = re.findall(' value="(.*?)" id="proveType" name="proveType"',resOrderDetails.text)[0] 476 proveType = re.findall(' value="(.*?)" id="proveType" name="proveType"',resOrderDetails.text)[0]
308 proveTypeCode = proveType 477 proveTypeCode = proveType
309 -# grossWeight="353"  
310 grossWeight = re.findall('name="grossWeight" id="grossWeight" value="(.*?)"',resOrderDetails.text)[0] 478 grossWeight = re.findall('name="grossWeight" id="grossWeight" value="(.*?)"',resOrderDetails.text)[0]
311 -# newWeight="20"  
312 newWeight = re.findall('name="weight" readonly value="(.*?)" id="weight"',resOrderDetails.text)[0] 479 newWeight = re.findall('name="weight" readonly value="(.*?)" id="weight"',resOrderDetails.text)[0]
313 -# tareWeight="333"  
314 tareWeight=re.findall('name="tareWeight" id="tareWeight" value="(.*?)"',resOrderDetails.text)[0] 480 tareWeight=re.findall('name="tareWeight" id="tareWeight" value="(.*?)"',resOrderDetails.text)[0]
315 -# depName="接车部"  
316 depName = re.findall('id="depName" name="depName" value="(.*?)"',resOrderDetails.text)[0] 481 depName = re.findall('id="depName" name="depName" value="(.*?)"',resOrderDetails.text)[0]
317 -# feeDepId="103"  
318 feeDepId = re.findall('name="calcDepId" value="(.*?)"',resOrderDetails.text)[0] 482 feeDepId = re.findall('name="calcDepId" value="(.*?)"',resOrderDetails.text)[0]
319 -# productName="雪莲果"  
320 productName = re.findall('name="productName" value="(.*?)"',resOrderDetails.text)[0] 483 productName = re.findall('name="productName" value="(.*?)"',resOrderDetails.text)[0]
321 -# productId="14158"  
322 productId=re.findall('id="productId" value="(.*?)"',resOrderDetails.text)[0] 484 productId=re.findall('id="productId" value="(.*?)"',resOrderDetails.text)[0]
323 -# grossWeightDate=created  
324 grossWeightDate=re.findall('name="grossWeightDate" value="(.*?)"',resOrderDetails.text)[0] 485 grossWeightDate=re.findall('name="grossWeightDate" value="(.*?)"',resOrderDetails.text)[0]
325 -# tareWeightDate=created  
326 tareWeightDate = re.findall('name="tareWeightDate" value="(.*?)"',resOrderDetails.text)[0] 486 tareWeightDate = re.findall('name="tareWeightDate" value="(.*?)"',resOrderDetails.text)[0]
327 -# weight=newWeight  
328 weight = re.findall('name="weight" readonly value="(.*?)"',resOrderDetails.text)[0] 487 weight = re.findall('name="weight" readonly value="(.*?)"',resOrderDetails.text)[0]
329 calcDepId=re.findall('name="calcDepId" value="(.*?)"',resOrderDetails.text)[0] 488 calcDepId=re.findall('name="calcDepId" value="(.*?)"',resOrderDetails.text)[0]
330 categoryName="水果" 489 categoryName="水果"
331 categoryId="14436" 490 categoryId="14436"
332 -# inGreeterName="通用测试"  
333 inGreeterName = re.findall('id="inGreeterName" value="(.*?)"',resOrderDetails.text)[0] 491 inGreeterName = re.findall('id="inGreeterName" value="(.*?)"',resOrderDetails.text)[0]
334 -# inGreeterId="274"  
335 inGreeterId = re.findall('name="inGreeterId" id="inGreeterId" value="(.*?)"',resOrderDetails.text)[0] 492 inGreeterId = re.findall('name="inGreeterId" id="inGreeterId" value="(.*?)"',resOrderDetails.text)[0]
336 493
337 494
@@ -371,7 +528,6 @@ for tag in soup.findAll(&quot;div&quot;, class_=&quot;d-flex align-items-center&quot;): @@ -371,7 +528,6 @@ for tag in soup.findAll(&quot;div&quot;, class_=&quot;d-flex align-items-center&quot;):
371 c = tag.findAll("input") 528 c = tag.findAll("input")
372 for i in c: 529 for i in c:
373 print(i) 530 print(i)
374 - # print(i.get("name"))  
375 if i.get("name") != None: 531 if i.get("name") != None:
376 fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value")) 532 fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
377 if i.get("type") == "text": 533 if i.get("type") == "text":
@@ -422,4 +578,5 @@ aa = do_doPay(host=host,autocompletecartype=autocompletecartype,fee_str=fee_str, @@ -422,4 +578,5 @@ aa = do_doPay(host=host,autocompletecartype=autocompletecartype,fee_str=fee_str,
422 categoryId=carTypeId,grossWeightDate=grossWeightDate,tareWeightDate=tareWeightDate,sumPrice=sumPrice, 578 categoryId=carTypeId,grossWeightDate=grossWeightDate,tareWeightDate=tareWeightDate,sumPrice=sumPrice,
423 chargeTotalAmountYuan=chargeTotalAmountYuan) 579 chargeTotalAmountYuan=chargeTotalAmountYuan)
424 580
425 -print(aa.text)  
426 \ No newline at end of file 581 \ No newline at end of file
  582 +print(aa.text)
  583 +"""
427 \ No newline at end of file 584 \ No newline at end of file
commons/api/zcApi.py
@@ -86,7 +86,7 @@ def get_dep(host=&quot;&quot;,**kwargs): @@ -86,7 +86,7 @@ def get_dep(host=&quot;&quot;,**kwargs):
86 data = {"keyword":""} 86 data = {"keyword":""}
87 headers = dct.jsonCode() 87 headers = dct.jsonCode()
88 data = dict(data, **kwargs) 88 data = dict(data, **kwargs)
89 - res = my.useHeadersRequests(method="get", url=url, data=json.dumps(data), headers=headers) 89 + res = my.useHeadersRequests(method="get", url=url, params=data, headers=headers)
90 return res 90 return res
91 91
92 92
report/test.log
1 -[2021-08-06 15:48:12] [INFO] : ======================================================================================  
2 -[2021-08-06 15:48:12] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb  
3 -{'data': None, 'json': {'userName': 'sy_chen', 'password': 'VTOTPkEIxvmtuO8zWAmUxzEJRCclqyDB4PzmKnOTpX86q20urQX6IRUZPGHh4g5JDryMvrFYBWufCB9kTnOzHmN1rHx5CIpV8yR6bX0+lQAk2hFlPcZbsWoDgK31CsPr4epTirwTf3WX1lhpMh45oZCYWgaR9PctTb4vAbVJ4m0='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}} 1 +[2021-08-06 17:59:01] [INFO] : ======================================================================================
  2 +[2021-08-06 17:59:01] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
  3 +{'data': None, 'json': {'userName': 'sy_chen', 'password': 'lsWZHfMAgFdA1giqEGJYul8opwYuR43hQpevsvVb43uipM2lnt6JdkBKNUOQqglnozlTCnVQGSo1jClpGUlPrf5vZRqa0pGL+bkt7JeXJEn+PWX6YwcReS35AZjjVMkvte914ZiwNkOhgMS6S/mQeJc6fjJX34NkbMG2yE2jK6w='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
4 4
5 -[2021-08-06 15:48:13] [INFO] : ======================================================================================  
6 -[2021-08-06 15:48:13] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb  
7 -{'data': None, 'json': {'userName': 'sygangda', 'password': 'kflO1Y7sTjw7YW/y91OMEKKuxKDQCZHNpvL6CUTRMcYg5AJkoN+B1OJW6z5K2vHDeNiJC0+cEnZYcPYsBmFxWgVIiUjf/XAWhd2dsh1HcOQ/HK65PmUFPVOAWlMqFnmkPCgBpd8OYMYUHn6/gHqpyh+MUDi++TSDQcswcgKbY8E='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}} 5 +[2021-08-06 17:59:01] [INFO] : ======================================================================================
  6 +[2021-08-06 17:59:01] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
  7 +{'data': None, 'json': {'userName': 'sygangda', 'password': 'NDKNIWWSXVpWHh9IK/ZgUt60b1DTN6k3jNED6lGBp3Hreemne5supQ8BeLwwxSoRxxt/Ko1Ejg2tLAOBpcsU7yxIvdEBDnuCof8d3OSmsCP83tMGnu/qIe94hIpfz6Pmo5dCQmXK3R83xhFE4FxVhQhL2z1j+QR6iBUWSXnAizU='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
8 8
9 -[2021-08-06 15:48:13] [INFO] : ======================================================================================  
10 -[2021-08-06 15:48:13] [INFO] : http://test.jmsf.diligrp.com:8385/entranceFeeBill/listPage.action  
11 -{'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', 'attrValue': '202108060900019'} 9 +[2021-08-06 17:59:01] [INFO] : ======================================================================================
  10 +[2021-08-06 17:59:01] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType
  11 +{"businessCode": "jmsf"}
12 {} 12 {}
13 13
14 -[2021-08-06 15:48:13] [INFO] : ======================================================================================  
15 -[2021-08-06 15:48:13] [INFO] : http://test.jmsf.diligrp.com:8385/entranceFeeBill/pay/3745.action  
16 -None 14 +[2021-08-06 17:59:02] [INFO] : ======================================================================================
  15 +[2021-08-06 17:59:02] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
  16 +{"marketId": 9, "state": 1, "keyword": "\u852c\u83dc"}
17 {} 17 {}
18 18
19 -[2021-08-06 15:48:15] [INFO] : ======================================================================================  
20 -[2021-08-06 15:48:15] [INFO] : http://test.jmsf.diligrp.com:8385/api/jmsf/ajax/icCheck?ic=888810032426  
21 -None 19 +[2021-08-06 17:59:02] [INFO] : ======================================================================================
  20 +[2021-08-06 17:59:02] [INFO] : http://test.gateway.diligrp.com:8285/dili-uap/userApi/listByExample.api
  21 +{"firmCode": "sy", "departmentId": 58, "keyword": ""}
22 {} 22 {}
23 23
24 -[2021-08-06 15:48:20] [INFO] : ======================================================================================  
25 -[2021-08-06 15:48:20] [INFO] : http://test.jmsf.diligrp.com:8385/api/jmsf/ajax/city/?name=万州&query=万州 24 +[2021-08-06 17:59:02] [INFO] : ======================================================================================
  25 +[2021-08-06 17:59:02] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/tradeType/query
  26 +{"pageNum": 100, "pageSize": 100, "marketId": 9}
  27 +{}
  28 +
  29 +[2021-08-06 17:59:02] [INFO] : ======================================================================================
  30 +[2021-08-06 17:59:02] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid
26 None 31 None
  32 +{'params': {'pid': 'goods_tag'}}
  33 +
  34 +[2021-08-06 17:59:03] [INFO] : ======================================================================================
  35 +[2021-08-06 17:59:03] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/address
  36 +{"province": "C", "city": null, "area": null}
27 {} 37 {}
28 38
29 -[2021-08-06 15:48:20] [INFO] : ======================================================================================  
30 -[2021-08-06 15:48:20] [INFO] : http://test.jmsf.diligrp.com:8385/calculate/index.action  
31 -{'protocolId': '', 'pwd': '', 'clientRedirectTag': '', 'viewType': 'pay', 'optType': '0', 'optUrl': '', 'correctInfo': '1', 'weightType': '1', 'id': 3745, 'goodsId': '3759', 'number': '202108060900019', 'modified': '2021-08-06 15:48:20', 'status': '2', 'source': '1', 'updateFeeItems': '', 'correctDiscount': '1', 'totalAmount': '', 'customerId': '0', 'fundAccount': '', 'accountId': '', 'ic': '', 'customerName': '', 'customerPhone': '', 'payway': '刷卡', 'plate': '川B00001', 'autocomplete-cartype': '003(板车)', 'carTypeName': '板车', 'carTypeCode': '003', 'carTypeId': '53', 'carTypeWeight': '333', 'storeTareWeight': '', 'proveType': '1621', 'grossWeight': '353', 'tareWeight': '333', 'weight': '20', 'goodsNum': '', 'itemWeight': '', 'productPrice': '1.00000', 'unitPrice': '100.0', 'depName': '接车部', 'calcDepId': '103', 'regionName': '', 'regionId': '0', 'productName': '雪莲果', 'productId': '14158', 'productArea': '重庆,重庆市,万州区', 'parentId': '', 'levelType': '', 'originId': 500101, 'tradeTypeId': '71', 'chargeTotalAmount': '', 'chargeTotalAmountYuan': '', 'freezeMoneySymbol': '', 'comparisonFreezeAmount': '', 'created': '2021-08-06 15:47:54', 'remark': 'false', 'goodsTagIds': '1900', 'shareRatio': '0', 'handlingTeam': '', 'handlingRatio': '', 'handActualAmount': '', 'handManageAmount': '', 'handCollectionAmount': '', 'receivableAmount': '', 'categoryName': '水果', 'categoryId': '14436', 'driverTel': '', 'grossWeightDate': '2021-08-06 15:47:54', 'tareWeightDate': '2021-08-06 15:47:54', 'grossPathName': '', 'grossPathId': '', 'tarePathId': '', 'goodsRemark': '', 'inGreeterName': '通用测试', 'inGreeterId': '274', 'outGreeterId': '', 'sumPrice': '2000', 'shipperName': '', 'shipperId': '', 'shipperPhone': '', 'feeDepName': '', 'calcFeeDepId': ''} 39 +[2021-08-06 17:59:03] [INFO] : ======================================================================================
  40 +[2021-08-06 17:59:03] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/dep
  41 +None
  42 +{'params': {'keyword': ''}}
  43 +
  44 +[2021-08-06 17:59:03] [INFO] : ======================================================================================
  45 +[2021-08-06 17:59:03] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid
  46 +None
  47 +{'params': {'pid': 'prove_type'}}
  48 +
  49 +[2021-08-06 17:59:04] [INFO] : ======================================================================================
  50 +[2021-08-06 17:59:04] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/appCommon/duplicateToken.action
  51 +None
32 {} 52 {}
33 53
34 -[2021-08-06 15:48:21] [INFO] : ======================================================================================  
35 -[2021-08-06 15:48:21] [INFO] : http://test.jmsf.diligrp.com:8385/entranceTrade/doPay.action  
36 -protocolId=&pwd=111111&clientRedirectTag=&viewType=pay&optType=0&optUrl=&correctInfo=1&weightType=1&id=3745&goodsId=3759&number=202108060900019&modified=2021-08-06%2015%3A47%3A54&status=2&source=1&updateFeeItems=&correctDiscount=1&totalAmount=800&customerId=389&fundAccount=105847&ic=888810032426&customerName=%E9%95%BF%E6%AD%8C%E4%B9%B0%E5%AE%B6%E7%9C%81%E5%86%85%E5%95%8A%E5%95%8A%E5%95%8A%E5%98%BF&customerPhone=18011501258&payway=%E5%88%B7%E5%8D%A1&plate=%E5%B7%9DB00001&autocomplete-cartype=003%28%E6%9D%BF%E8%BD%A6%29&carTypeName=%E6%9D%BF%E8%BD%A6&carTypeCode=003&carTypeId=53&carTypeWeight=333&storeTareWeight=&proveType=1621&grossWeight=353&tareWeight=333&weight=20&goodsNum=&itemWeight=&productPrice=1.00000&unitPrice=100.0&depName=%E6%8E%A5%E8%BD%A6%E9%83%A8&calcDepId=103&dep=103&regionName=A1%E5%8C%BA&regionId=72&productName=%E9%9B%AA%E8%8E%B2%E6%9E%9C&productId=14158&productArea=%E9%87%8D%E5%BA%86%2C%E9%87%8D%E5%BA%86%E5%B8%82%2C%E4%B8%87%E5%B7%9E%E5%8C%BA&parentId=&levelType=&originId=500101&tradeTypeId=71&chargeTotalAmount=800&chargeTotalAmountYuan=8&freezeMoneySymbol=13&comparisonFreezeAmount=13&created=2021-08-06%2015%3A47%3A54&remark=&goodsTagIds=1900&marketFlag=sy&totalMoney=800&receivable=1300&collectionPrice=0&discountAmount=500&handReceivableAmount=0&itemReceivableAmount=1300&shareRatio=0&handlingTeam=&handActualAmount=0&handManageAmount=0&handCollectionAmount=0&receivableAmount=1300&categoryName=%E6%B0%B4%E6%9E%9C&categoryId=53&driverTel=&grossWeightDate=2021-08-06%2015%3A47%3A54&tareWeightDate=2021-08-06%2015%3A47%3A54&grossPathName=&grossPathId=&tarePathId=&goodsRemark=&inGreeterName=&inGreeterId=0&outGreeterId=&sumPrice=2000&shipperName=&shipperId=&shipperPhone=&feeDepName=&calcFeeDepId=&feeDepId=&accountId=105847&correctDiscount=1&billItems=&billItemsDic=&billItemCheckIds=103&103=10.00&billItems=%7B%22discount%22%3A500%2C%22id%22%3A103%2C%22name%22%3A%22%E4%BA%A4%E6%98%93%E7%AE%A1%E7%90%86%E8%B4%B9%22%2C%22receivable%22%3A1000%2C%22require%22%3A1%7D&billItemDicCheckIds=105&billItemsDic=%7B%22discount%22%3A0%2C%22id%22%3A105%2C%22name%22%3A%22%E4%BC%98%E6%83%A0%E6%94%B6%E8%B4%B9%22%2C%22receivable%22%3A500%2C%22require%22%3A0%7D&billItemCheckIds=106&106=3.00&billItems=%7B%22discount%22%3A0%2C%22id%22%3A106%2C%22name%22%3A%22%E6%A3%80%E6%B5%8B%E8%B4%B9%22%2C%22receivable%22%3A300%2C%22require%22%3A1%7D 54 +[2021-08-06 17:59:04] [INFO] : ======================================================================================
  55 +[2021-08-06 17:59:04] [INFO] : http://test.gateway.diligrp.com:8285/jmsf-web/api/entrace/wholeCarWeighSave
  56 +{"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": 401, "grossWeightDate": "2021-08-06 17:59:04", "newWeight": 68, "tareWeight": 333, "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}
37 {} 57 {}
38 58
testcase/FeedbackOrderController/test_feedback_order_settlement.py
@@ -4,6 +4,7 @@ from commons.MySession import my,sy1 @@ -4,6 +4,7 @@ from commons.MySession import my,sy1
4 from commons.api.feedback_order_settlement import feedback_order_settlement 4 from commons.api.feedback_order_settlement import feedback_order_settlement
5 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) 5 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
6 from commons.api.feedback_order_settlement_query import feedback_order_settlement_query 6 from commons.api.feedback_order_settlement_query import feedback_order_settlement_query
  7 +import random
7 fosq = feedback_order_settlement_query() 8 fosq = feedback_order_settlement_query()
8 9
9 fos = feedback_order_settlement() 10 fos = feedback_order_settlement()
@@ -17,24 +18,28 @@ class test_feedback_order_settlement(unittest.TestCase): @@ -17,24 +18,28 @@ class test_feedback_order_settlement(unittest.TestCase):
17 def setUp(self): 18 def setUp(self):
18 body = fosq.body.replace("feedbackCustomerId=25", "feedbackCustomerId=16").replace("2021-07-22 00:00:00", "\ 19 body = fosq.body.replace("feedbackCustomerId=25", "feedbackCustomerId=16").replace("2021-07-22 00:00:00", "\
19 2021-07-03 00:00:00").replace("2021-08-03 23:59:59","2021-08-03 23:59:59") 20 2021-07-03 00:00:00").replace("2021-08-03 23:59:59","2021-08-03 23:59:59")
20 - re = sy1.post(url=fosq.url, data=body, headers=fosq.header, proxies=my.myproxies)  
21 - Amount = re.json()["rows"][0]["unsettledAmount"]  
22 - ids = re.json()["rows"][0]["id"]  
23 - billIds = re.json()["rows"][0]["billId"]  
24 - return Amount, ids, billIds 21 + re = sy1.post(url=fosq.url, data=body, headers=fosq.header)
  22 + # self.id = re.json()["rows"][0]["id"]
  23 + self.Amount = re.json()["rows"][0]["unsettledAmount"]
  24 + self.ids = re.json()["rows"][0]["id"]
  25 + self.billIds = re.json()["rows"][0]["billId"]
  26 + #
  27 + # elf.name = re.json()["rows"][0]["name"]
  28 +
25 29
26 def test_feedback_order_settlement_01(self): 30 def test_feedback_order_settlement_01(self):
27 - body = fos.body.replace("id=25","id=25").replace("888810057654","888810057654").replace("settleAmount=2","settleAmount=2").\  
28 - replace("ids=12034","ids=11953").\ 31 + body = fos.body.replace("id=25","id=25").replace("888810057654","888810057654")\
  32 + .replace("settleAmount=2","settleAmount="+str(self.Amount)).\
  33 + replace("ids=12034","ids="+str(self.ids)).\
29 replace("feedbackCustomerId=25","feedbackCustomerId=25").\ 34 replace("feedbackCustomerId=25","feedbackCustomerId=25").\
30 replace("feedbackCustomerName=验证员工推送到CRM","feedbackCustomerName=验证员工推送到CRM").\ 35 replace("feedbackCustomerName=验证员工推送到CRM","feedbackCustomerName=验证员工推送到CRM").\
31 - replace("billIds=3621","billIds=3493").\  
32 - replace("settledAmounts=2","settledAmounts=2")  
33 - 36 + replace("billIds=3621","billIds="+str(self.billIds)).\
  37 + replace("settledAmounts=2","settledAmounts="+str(self.Amount))
  38 + print(body)
34 re = sy1.post(url = fos.url, headers = fos.header, data = body.encode('utf-8')) 39 re = sy1.post(url = fos.url, headers = fos.header, data = body.encode('utf-8'))
35 - # print(re.headers) 40 + print(re.headers)
36 41
37 - # print(re.json()) 42 + print(re.json())
38 self.assertTrue("操作成功" in str(re.json())) 43 self.assertTrue("操作成功" in str(re.json()))
39 return re 44 return re
40 45
testcase/feedbackAccounrecordController_list/test_feedbackAccounrecordController_list.py
@@ -10,12 +10,13 @@ class test_feedbackAccounrecordController_list(unittest.TestCase): @@ -10,12 +10,13 @@ class test_feedbackAccounrecordController_list(unittest.TestCase):
10 "交易明细——交易流水号查询" 10 "交易明细——交易流水号查询"
11 @classmethod 11 @classmethod
12 def setUpClass(cls): 12 def setUpClass(cls):
  13 + print(sy1.user["sy_user01"]["firmId"])
13 pass 14 pass
14 def setUp(self): 15 def setUp(self):
15 self.body = db.mysql_selectOne( 16 self.body = db.mysql_selectOne(
16 '''SELECT dili_jmsf.feedback_account_record.created,dili_jmsf.feedback_order.record_number 17 '''SELECT dili_jmsf.feedback_account_record.created,dili_jmsf.feedback_order.record_number
17 FROM `dili_jmsf`.`feedback_order` LEFT JOIN `dili_jmsf`.`feedback_account_record` ON dili_jmsf.feedback_order.id = dili_jmsf.feedback_account_record.order_ids 18 FROM `dili_jmsf`.`feedback_order` LEFT JOIN `dili_jmsf`.`feedback_account_record` ON dili_jmsf.feedback_order.id = dili_jmsf.feedback_account_record.order_ids
18 -ORDER BY dili_jmsf.feedback_account_record.order_ids DESC LIMIT 1''') 19 +WHERE market_id = '''+str(sy1.user["sy_user01"]["firmId"])+''' ORDER BY dili_jmsf.feedback_account_record.order_ids DESC LIMIT 1''')
19 print("查询出查询时间和交易流水号:", self.body[0],self.body[1]) 20 print("查询出查询时间和交易流水号:", self.body[0],self.body[1])
20 21
21 def test_feedbackAccounrecordController_list_01(self): 22 def test_feedbackAccounrecordController_list_01(self):
testcase/test_ZC/demo.py
@@ -8,11 +8,4 @@ @@ -8,11 +8,4 @@
8 """ 8 """
9 9
10 """ 10 """
11 -import json  
12 -import urllib  
13 -import urllib.parse  
14 11
15 -a = {"a":"b","c":"阿三大苏打"}  
16 -print(urllib.parse.urlencode(a))  
17 -b = "a=b&c=d"  
18 -# print(urllib.unquote)  
testcase/test_ZC/test_ZC.py
@@ -13,6 +13,7 @@ import json @@ -13,6 +13,7 @@ import json
13 import unittest 13 import unittest
14 from commons.scripts.readConf import rC 14 from commons.scripts.readConf import rC
15 from commons.api import zcApi as zcA 15 from commons.api import zcApi as zcA
  16 +from commons.api import entranceFeeBillList as eFBL
16 import time,random 17 import time,random
17 18
18 class test_demo(unittest.TestCase): 19 class test_demo(unittest.TestCase):
@@ -33,9 +34,14 @@ class test_demo(unittest.TestCase): @@ -33,9 +34,14 @@ class test_demo(unittest.TestCase):
33 def tearDownClass(cls) -> None: 34 def tearDownClass(cls) -> None:
34 pass 35 pass
35 36
36 - @unittest.skip 37 + # @unittest.skip
37 def test_get_carType(self): 38 def test_get_carType(self):
38 """整车-整车创建:获取车型接口调用测试""" 39 """整车-整车创建:获取车型接口调用测试"""
  40 + # 依赖数据
  41 + plate = "川A12323"
  42 + productState = "1"
  43 + trailerNumber = plate
  44 +
39 # 获取车型 45 # 获取车型
40 carType = zcA.get_carType(host=self.gatewayHost) 46 carType = zcA.get_carType(host=self.gatewayHost)
41 print(carType.text) 47 print(carType.text)
@@ -53,7 +59,7 @@ class test_demo(unittest.TestCase): @@ -53,7 +59,7 @@ class test_demo(unittest.TestCase):
53 productName = categoryByCondition.json()["data"][0]["name"] 59 productName = categoryByCondition.json()["data"][0]["name"]
54 productCode = categoryByCondition.json()["data"][0]["keycode"] 60 productCode = categoryByCondition.json()["data"][0]["keycode"]
55 61
56 - # 获取商品 62 + # 获取接车员
57 listByExample = zcA.get_listByExample(host=self.gatewayHost) 63 listByExample = zcA.get_listByExample(host=self.gatewayHost)
58 print(listByExample.json()) 64 print(listByExample.json())
59 inGreeterId = listByExample.json()["data"][0]["id"] 65 inGreeterId = listByExample.json()["data"][0]["id"]
@@ -95,11 +101,6 @@ class test_demo(unittest.TestCase): @@ -95,11 +101,6 @@ class test_demo(unittest.TestCase):
95 print(duplicateTokenRes.json()) 101 print(duplicateTokenRes.json())
96 duplicateToken = duplicateTokenRes.json()["data"] 102 duplicateToken = duplicateTokenRes.json()["data"]
97 103
98 - # 创建生成进门单  
99 - plate = "川A12323"  
100 - productState = "1"  
101 - trailerNumber = plate  
102 -  
103 # 重量信息准备 104 # 重量信息准备
104 grossWeight = random.randint(carTypeWeight,carTypeWeight+100) 105 grossWeight = random.randint(carTypeWeight,carTypeWeight+100)
105 tareWeight = carTypeWeight 106 tareWeight = carTypeWeight
@@ -126,6 +127,8 @@ class test_demo(unittest.TestCase): @@ -126,6 +127,8 @@ class test_demo(unittest.TestCase):
126 userName="ty_test",transactionName="沈阳2号",newWeight=20, 127 userName="ty_test",transactionName="沈阳2号",newWeight=20,
127 depName="接车部",goodsTagName="货物标签测试",proveName="绿色蔬菜") 128 depName="接车部",goodsTagName="货物标签测试",proveName="绿色蔬菜")
128 print(cre_res.json()) 129 print(cre_res.json())
  130 + number = cre_res.json()["data"]["number"]
  131 + aa = eFBL.do_payOrder(attrValue=number)
129 # cre_res = zcA.create_jmsf(host=self.gatewayHost,plate="川B00002",newWeight=20) 132 # cre_res = zcA.create_jmsf(host=self.gatewayHost,plate="川B00002",newWeight=20)
130 # print(cre_res.json()) 133 # print(cre_res.json())
131 134
testcase/test_ZC/test_ZCBasic.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/6 16:29
  4 +# @Author : Ljq
  5 +# @File : test_ZCBasic.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +整车进门基础数据获取测试
  10 +"""
  11 +
  12 +import json
  13 +import unittest
  14 +from commons.scripts.readConf import rC
  15 +from commons.api import zcApi as zcA
  16 +from commons.MySession import my
  17 +from commons.api import entranceFeeBillList as eFBL
  18 +import time,random
  19 +
  20 +class test_ZCBasic(unittest.TestCase):
  21 + """整车-创建整车进门单基础信息接口测试"""
  22 + def setUp(self) -> None:
  23 + pass
  24 +
  25 + def tearDown(self) -> None:
  26 + pass
  27 +
  28 +
  29 + @classmethod
  30 + def setUpClass(cls) -> None:
  31 + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
  32 + cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
  33 +
  34 + @classmethod
  35 + def tearDownClass(cls) -> None:
  36 + pass
  37 +
  38 + def test_getCar(self):
  39 + """整车-整车创建:获取车型接口调用测试"""
  40 + # 获取车型
  41 + carType = zcA.get_carType(host=self.gatewayHost)
  42 + print(carType.text)
  43 + assert carType.json()["code"] == "200"
  44 + assert carType.json()["data"] != []
  45 +
  46 + def test_getAllCategory(self):
  47 + """整车-整车创建:获取测试商品信息测试"""
  48 + # 获取
  49 + # print(my.userInfo["data"]["user"]["firmCode"])
  50 + marketId = my.userInfo["data"]["user"]["firmId"]
  51 + resCategory = zcA.get_listCategoryByCondition(host=self.gatewayHost,marketId=marketId,keyword="")
  52 + print(resCategory.text)
  53 + assert resCategory.json()["code"] == "200","全商品查询失败"
  54 + assert resCategory.json()["data"] != [],"全商品查询失败,查询结果不应该为空"
  55 +
  56 + def test_getOneCategory(self):
  57 + """整车-整车创建:获取测试商品信息测试"""
  58 + # 获取
  59 + marketId = my.userInfo["data"]["user"]["firmId"]
  60 + resCategory = zcA.get_listCategoryByCondition(host=self.gatewayHost,marketId=marketId,keyword="火龙果")
  61 + print(resCategory.text)
  62 + nameList = [i["name"] for i in resCategory.json()["data"]]
  63 + assert resCategory.json()["code"] == "200"
  64 + for i in nameList:
  65 + assert "火龙果" in i,"指定条件查询失败,按照名称查询出商品错误"
  66 +
  67 + def test_getAllExample(self):
  68 + """整车-整车创建:接车员信息获取测试"""
  69 + # print(my.userInfo["data"]["user"]["departmentId"])
  70 + firmCode = my.userInfo["data"]["user"]["firmCode"]
  71 + departmentId = my.userInfo["data"]["user"]["departmentId"]
  72 + listByExample = zcA.get_listByExample(host=self.gatewayHost,firmCode=firmCode,departmentId=departmentId)
  73 + print(listByExample.json())
  74 + assert listByExample.json()["code"]=="200","接车员信息获取测试失败"
  75 + assert listByExample.json()["data"]!=[],"接车员信息获取测试失败"
  76 +
  77 + def test_getOneExample(self):
  78 + """整车-整车创建:按接车员名称信息查询接车员"""
  79 + # print(my.userInfo["data"]["user"]["departmentId"])
  80 + firmCode = my.userInfo["data"]["user"]["firmCode"]
  81 + departmentId = my.userInfo["data"]["user"]["departmentId"]
  82 + keyword="测试"
  83 + listByExample = zcA.get_listByExample(host=self.gatewayHost,firmCode=firmCode,departmentId=departmentId,
  84 + keyword=keyword)
  85 + print(listByExample.json())
  86 + assert listByExample.json()["code"]=="200","按接车员名称信息查询接车员测试失败"
  87 + assert listByExample.json()["data"]!=[],"按接车员名称信息查询接车员测试失败"
  88 +
  89 + def test_transactionType(self):
  90 + """整车-整车创建:交易类型获取测试"""
  91 + transactionType = zcA.query_transactionType(host=self.gatewayHost)
  92 + print(transactionType.json())
  93 + assert transactionType.status_code==200,"交易类型信息获取测试失败"
  94 + assert transactionType.json()["rows"]!=[],"交易类型信息获取测试失败"
  95 +
  96 + def test_getGoodsTag(self):
  97 + """整车-整车创建:货物标签获取测试"""
  98 + goodsTag = zcA.get_goodsTag(host=self.gatewayHost)
  99 + print(goodsTag.json())
  100 + assert goodsTag.status_code==200,"货物标签信息获取测试失败"
  101 + assert goodsTag.json()["data"]!=[],"货物标签信息获取测试失败"
  102 +
  103 + def test_getAllAddress(self):
  104 + """整车-整车创建:按照省份查询产地"""
  105 + province = "四川省"
  106 + address = zcA.get_address(host=self.gatewayHost,province=province)
  107 + print(address.json())
  108 + assert address.json()["code"] == "200","按照省份查询产地信息获取测试失败"
  109 + mergerNameList = [i["mergerName"] for i in address.json()["data"] if province not in i["mergerName"]]
  110 + assert mergerNameList == [],"按照省份查询产地信息获取测试失败"
  111 +
  112 + def test_getOneAddress(self):
  113 + """整车-整车创建:按照省份查询产地"""
  114 + province = "四川省"
  115 + city = "成都市"
  116 + area = "锦江区"
  117 + address = zcA.get_address(host=self.gatewayHost,province=province,city=city,area=area)
  118 + print(address.json())
  119 + assert address.json()["code"]=="200","详细产地信息查询失败"
  120 + assert len(address.json()["data"])==1,"详细产地信息查询只能查询出一个结果,查询结果超过一个测试失败"
  121 + assert address.json()["data"][0]["mergerName"] == "四川省,成都市,锦江区","根据省市区查询插地信息查询失败"
  122 +
  123 + def test_getAllDep(self):
  124 + """整车-整车创建:接车部门信息获取"""
  125 + depRes = zcA.get_dep(host=self.gatewayHost)
  126 + print(depRes.json())
  127 + assert depRes.json()["code"]=="200","接车部门信息获取测试失败"
  128 + assert depRes.json()["data"] != [], "接车部门信息获取测试失败"
  129 +
  130 +
  131 + def test_getOneDep(self):
  132 + """整车-整车创建:查询指定接车部门信息"""
  133 + keyword="水果部"
  134 + depRes = zcA.get_dep(host=self.gatewayHost,keyword=keyword)
  135 + print(depRes.json())
  136 + assert depRes.json()["code"]=="200","查询指定接车部门信息获取测试失败"
  137 + assert len(depRes.json()["data"]) == 1, "查询指定接车部门信息获取测试失败"
  138 + assert depRes.json()["data"][0]["name"] == keyword,"查询指定接车部门信息获取测试失败"
  139 +
  140 + def test_getProveType(self):
  141 + """整车-整车创建:证明类型信息获取"""
  142 + proveType = zcA.get_proveType(host=self.gatewayHost)
  143 + print(proveType.json())
  144 + assert proveType.json()["code"]=="200","证明类型信息获取测试失败"
  145 + assert proveType.json()["data"] != [], "证明类型信息获取测试失败"
  146 +
  147 + def test_getDuplicateToken(self):
  148 + """整车-整车创建:获取防重复token"""
  149 + duplicateTokenRes = zcA.get_duplicateToken(host=self.gatewayHost)
  150 + print(duplicateTokenRes.json())
  151 + assert duplicateTokenRes.json()["code"]=="200","获取防重复token测试失败"
  152 + assert duplicateTokenRes.json()["data"].isalnum(), "获取防重复token测试失败"
testcase/test_ZC/test_ZCCreate.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/6 17:49
  4 +# @Author : Ljq
  5 +# @File : test_ZCCreate.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +整车进门但创建测试
  10 +"""
  11 +
  12 +import json
  13 +import unittest
  14 +from commons.scripts.readConf import rC
  15 +from commons.api import zcApi as zcA
  16 +from commons.api import entranceFeeBillList as eFBL
  17 +import time,random
  18 +
  19 +class test_ZCCreate(unittest.TestCase):
  20 + """整车-创建整车进门单"""
  21 + def setUp(self) -> None:
  22 + pass
  23 +
  24 + def tearDown(self) -> None:
  25 + pass
  26 +
  27 +
  28 + @classmethod
  29 + def setUpClass(cls) -> None:
  30 + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
  31 + cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
  32 +
  33 + @classmethod
  34 + def tearDownClass(cls) -> None:
  35 + pass
  36 +
  37 + def test_creZC(self):
  38 + """整车-整车创建:按接车员名称信息查询接车员"""
  39 + """整车-整车创建:获取车型接口调用测试"""
  40 + # 依赖数据
  41 + plate = "川A12323"
  42 + productState = "1"
  43 + trailerNumber = plate
  44 +
  45 + # 获取车型
  46 + carType = zcA.get_carType(host=self.gatewayHost)
  47 + print(carType.text)
  48 + print(carType.json()["data"][0])
  49 + carTypeCode = carType.json()["data"][0]["code"]
  50 + carTypeId = carType.json()["data"][0]["id"]
  51 + carTypeName = carType.json()["data"][0]["carTypeName"]
  52 + carTypeWeight = carType.json()["data"][0]["weight"]
  53 +
  54 + # 获取商品
  55 + categoryByCondition = zcA.get_listCategoryByCondition(host=self.gatewayHost)
  56 + print(categoryByCondition.json())
  57 + cateId = categoryByCondition.json()["data"][0]["id"]
  58 + productId = categoryByCondition.json()["data"][0]["id"]
  59 + productName = categoryByCondition.json()["data"][0]["name"]
  60 + productCode = categoryByCondition.json()["data"][0]["keycode"]
  61 +
  62 + # 获取接车员
  63 + listByExample = zcA.get_listByExample(host=self.gatewayHost)
  64 + print(listByExample.json())
  65 + inGreeterId = listByExample.json()["data"][0]["id"]
  66 + inGreeterName = listByExample.json()["data"][0]["realName"]
  67 +
  68 + # 获取交易类型
  69 + transactionType = zcA.query_transactionType(host=self.gatewayHost)
  70 + print(transactionType.json())
  71 + tradeType = transactionType.json()["rows"][0]["code"]
  72 + tradeTypeId = transactionType.json()["rows"][0]["id"]
  73 + tradeTypeName = transactionType.json()["rows"][0]["name"]
  74 +
  75 + # 获取货物标签
  76 + goodsTag = zcA.get_goodsTag(host=self.gatewayHost)
  77 + print(goodsTag.json())
  78 + goodsTagId = goodsTag.json()["data"][0]["id"]
  79 +
  80 + # 产地信息获取
  81 + address = zcA.get_address(host=self.gatewayHost)
  82 + print(address.json())
  83 + originId = address.json()["data"][0]["id"]
  84 + origin = address.json()["data"][0]["name"]
  85 + originCode = address.json()["data"][0]["cityCode"]
  86 +
  87 + # 查询部门信息
  88 + depRes = zcA.get_dep(host=self.gatewayHost)
  89 + print(depRes.json())
  90 + feeDepId = depRes.json()["data"][0]["id"]
  91 + feeDepName = depRes.json()["data"][0]["name"]
  92 +
  93 + # 获取证明类型
  94 + proveType = zcA.get_proveType(host=self.gatewayHost)
  95 + print(proveType.json())
  96 + proveTypeCode = proveType.json()["data"][0]["id"]
  97 + proveTypeName = proveType.json()["data"][0]["name"]
  98 +
  99 + # 获取防重token
  100 + duplicateTokenRes = zcA.get_duplicateToken(host=self.gatewayHost)
  101 + print(duplicateTokenRes.json())
  102 + duplicateToken = duplicateTokenRes.json()["data"]
  103 +
  104 + # 重量信息准备
  105 + grossWeight = random.randint(carTypeWeight, carTypeWeight + 100)
  106 + tareWeight = carTypeWeight
  107 + weighmanRecord = {"grossWeight": None, "grossWeightDate": "", "newWeight": None, "tareWeight": None,
  108 + "tareWeightDate": None, "weighImgs": []}
  109 + weighmanRecord["grossWeight"] = grossWeight
  110 + weighmanRecord["tareWeight"] = carTypeWeight
  111 + weighmanRecord["newWeight"] = grossWeight - carTypeWeight
  112 + weighmanRecord["grossWeightDate"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  113 +
  114 + # 创建进门单
  115 + cre_res = zcA.create_wholeCarWeighSave(host=self.gatewayHost, duplicateToken=duplicateToken,
  116 + carTypeCode=carTypeCode, carTypeId=carTypeId,
  117 + carTypeName=carTypeName, carTypeWeight=carTypeWeight, plate=plate,
  118 + productId=productId, productName=productName,
  119 + proveTypeCode=proveTypeCode,
  120 + proveTypeName=proveTypeName, trailerNumber=trailerNumber,
  121 + depName=feeDepName,
  122 + cateId=cateId, originId=originId, origin=origin, originCode=originCode,
  123 + tradeType=tradeType, tradeTypeName=tradeTypeName,
  124 + productState=productState,
  125 + tradeTypeId=tradeTypeId, goodsTagId=goodsTagId, inGreeterId=inGreeterId,
  126 + inGreeterName=inGreeterName, dep=feeDepId, weighmanRecord=weighmanRecord)
  127 + print(cre_res.json())
0 \ No newline at end of file 128 \ No newline at end of file