Commit 2b5474e297551554f9c517ccc2ce3d26ebd52c59

Authored by lixi
2 parents f575d535 21bba349

Merge remote-tracking branch 'origin/master'

commons/MySession.py
@@ -146,9 +146,9 @@ class mysession(requests.Session): @@ -146,9 +146,9 @@ class mysession(requests.Session):
146 :param data:接口数据 146 :param data:接口数据
147 :kwargs:其他requests.request()支持参数可以直接传递 147 :kwargs:其他requests.request()支持参数可以直接传递
148 """ 148 """
149 - print(url)  
150 - # print(headers)  
151 - print(data) 149 + # print(url)
  150 + # # print(headers)
  151 + # print(data)
152 log.info("{0:=^86}".format('')) 152 log.info("{0:=^86}".format(''))
153 log.info("{}\n{}\n{}\n".format(url, data, kwargs)) 153 log.info("{}\n{}\n{}\n".format(url, data, kwargs))
154 if "gateway" in url: 154 if "gateway" in url:
commons/api/hg/settlement/batch.py
@@ -50,3 +50,5 @@ def changeBatchCodeState(session=None,host=None,**kwargs): @@ -50,3 +50,5 @@ def changeBatchCodeState(session=None,host=None,**kwargs):
50 50
51 # res = changeBatchCodeState(session=sessionHg,host=host,batchCode="2109000202",state=1) 51 # res = changeBatchCodeState(session=sessionHg,host=host,batchCode="2109000202",state=1)
52 # print(res.json()) 52 # print(res.json())
  53 +
  54 +
commons/api/hg/settlement/batchSettlement.py
@@ -8,3 +8,27 @@ @@ -8,3 +8,27 @@
8 """ 8 """
9 批号结算页面 9 批号结算页面
10 """ 10 """
  11 +
  12 +import json,time,random,re
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.scripts import jsonToUrlCode
  15 +from commons.scripts import replaceJsonData as rJD
  16 +import urllib.parse
  17 +from commons.MySession import sessionHg
  18 +
  19 +host = "http://test.gateway.diligrp.com:8285"
  20 +
  21 +def settle_query(session=None,host=None,batchCode=None):
  22 + """
  23 + 登记单状态变更
  24 + :param batchCode:等级单号
  25 + :param _t:时间戳
  26 + """
  27 + url = host+"/hg-trading/api/settle/query"
  28 + headers = {}
  29 + data = {"batchCode":str(batchCode)}
  30 + res = session.useHeadersRequests(method="GET",url=url,params=data,headers=headers)
  31 + return res
  32 +
  33 +# res = settle_query(session=sessionHg,host=host,batchCode="2109000319")
  34 +# print(res.text)
11 \ No newline at end of file 35 \ No newline at end of file
commons/api/hg/settlement/demo.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/9 14:41
  4 +# @Author : Ljq
  5 +# @File : demo.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
  11 +
  12 +import json,time,random,re
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.scripts import jsonToUrlCode
  15 +from commons.scripts import replaceJsonData as rJD
  16 +import urllib.parse
  17 +from commons.MySession import sessionHg
  18 +
  19 +def save_red(session=None,host=None,**kwargs):
  20 + """
  21 + 登记单状态变更
  22 + :param batchCode:等级单号
  23 + :param state:变更状态,1继续,2停止
  24 + """
  25 + url = "http://test.card.diligrp.com:8386/contract/save.action"
  26 + headers = dct.jsonCode()
  27 + data = {
  28 + "notes": "123备注",
  29 + "customerId": 141963,
  30 + "consignorCustomerName": "杭果客户长歌一",
  31 + "cardNo": "888800010592",
  32 + "consignorCustomerIDCode": "110101202108265741",
  33 + "consignorCustomerMobile": "18080018009",
  34 + "consignorCustomerCode": "00131684",
  35 + "consignorAccountId": 107667,
  36 + "startTime": "2021-09-09",
  37 + "endTime": "2021-09-13",
  38 + "consignors": [{
  39 + "consigneeName": "张三",
  40 + "consigneeIdCode": "513922198704216819",
  41 + "consigneeIdMobile": "asda",
  42 + "signatureImagePath": "5f68851207864520924e41b7f73c208c"
  43 + }],
  44 + "consigneeNames": "唐川",
  45 + "node": "signatureImagePathConsignor",
  46 + "signatureImagePath": "bbdcbcca70a74adfb10b7fb86de5d04c"
  47 +}
  48 + data = dict(data,**kwargs)
  49 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  50 + return res
  51 +
  52 +res = save_red(session=sessionHg,host="")
  53 +print(res.json())
0 \ No newline at end of file 54 \ No newline at end of file
commons/api/hg/settlement/sellingGoods.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/10 11:06
  4 +# @Author : Ljq
  5 +# @File : sellingGoods.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +商品售卖
  10 +"""
  11 +
  12 +import json,time,random,re
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.scripts import jsonToUrlCode
  15 +from commons.scripts import replaceJsonData as rJD
  16 +import urllib.parse
  17 +from commons.MySession import sessionHg
  18 +
  19 +host = "http://test.gateway.diligrp.com:8285"
  20 +
  21 +def queryRegister(session=None,host=None,**kwargs):
  22 + """
  23 + 查询登记单
  24 + :param batchCode:登记单号
  25 + """
  26 + url = host+"/hg-trading/api/registerRecord/queryRegister"
  27 + headers = {}
  28 + data = {"recordQueryDto":{"batchCode":"2109000250"}}
  29 + data = rJD.replaceJsonData(json=data,data=kwargs)
  30 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  31 + return res
  32 +
  33 +# res = queryRegister(session=sessionHg,host=host,batchCode="2109000266")
  34 +# print(res.json())
  35 +
  36 +def getBySheetNoAndBizNo(session=None,host=None,bizNo="2109000250"):
  37 + """
  38 + 查询登记单
  39 + :param batchCode:登记单号
  40 + """
  41 + url = host+"/wms-service/api/sheet/manage/getBySheetNoAndBizNo"
  42 + headers = {}
  43 + data = {"bizNo":bizNo}
  44 + res = session.useHeadersRequests(method="get",url=url,params=data,headers=headers)
  45 + return res
  46 +
  47 +# res = getBySheetNoAndBizNo(session=sessionHg,host=host,bizNo="2109000250")
  48 +# print(res.json())
  49 +
  50 +def getArea(session=None,host=None,**kwargs):
  51 + """
  52 + 查询登记单
  53 + :param batchCode:登记单号
  54 + """
  55 + url = host+"/assets-service/api/district/search"
  56 + headers = dct.jsonCode()
  57 + data = {"id":272,"marketId":15,"departmentId":177}
  58 + data = dict(data,**kwargs)
  59 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  60 + return res
  61 +
  62 +# res = getArea(session=sessionHg,host=host,bizNo="2109000250")
  63 +# print(res.json())
  64 +
  65 +def validateReduce(session=None,host=None,**kwargs):
  66 + """
  67 + 查询登记单
  68 + :param batchCode:登记单号
  69 + """
  70 + url = host+"/wms-service/api/sheet/manage/validateReduce"
  71 + headers = dct.jsonCode()
  72 + data = {"bizNo":"2109000250","firmId":15,"kid":36,"weight":50}
  73 + data = dict(data,**kwargs)
  74 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  75 + return res
  76 +
  77 +# res = validateReduce(session=sessionHg,host=host,bizNo="2109000250")
  78 +# print(res.json())
  79 +
  80 +def listByExample(session=None,host=None,**kwargs):
  81 + """
  82 + 查询登记单
  83 + :param IsEnable:是否可用
  84 + :param MarketId:登记单号
  85 + :param BusinessType:身份类型,hg_trading_buyer,hg_trading_seller
  86 + """
  87 + url = host+"/assets-service/api/businessChargeItem/listByExample"
  88 + headers = dct.jsonCode()
  89 + data = {"IsEnable":1,"MarketId":15,"BusinessType":"hg_trading_buyer"}
  90 + data = dict(data,**kwargs)
  91 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  92 + return res
  93 +
  94 +# res = listByExample(session=sessionHg,host=host,bizNo="2109000250")
  95 +# print(res.json())
  96 +
  97 +
  98 +def queryFee(session=None,host=None,**kwargs):
  99 + """
  100 + 查询登记单
  101 + :param batchCode:登记单号
  102 + """
  103 + url = host+"/dili-rule/api/chargeRule/queryFee"
  104 + headers = dct.jsonCode()
  105 + data = {"marketId": 15, "businessType": "hg_trading_buyer", "chargeItem": 521, "calcParams": {"amount": 150.0},
  106 + "conditionParams": {"payment": 150.0, "categoryId": 754107}}
  107 + data = dict(data,**kwargs)
  108 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  109 + return res
  110 +
  111 +# res = queryFee(session=sessionHg,host=host)
  112 +# print(res.json())
  113 +
  114 +def get_simpleInfo(session=None,host=None,ic="888800010592"):
  115 + url = host+"/account-service/api/account/simpleInfo"
  116 + headers=dct.jsonCode()
  117 + data={"cardNo":ic}
  118 + res = session.useHeadersRequests(method="GET",url=url,params=data,headers=headers)
  119 + return res
  120 +
  121 +# res = get_simpleInfo(session=sessionHg,host=host,ic="888800010592")
  122 +# print(res.text)
  123 +
  124 +def getCustomerInfoExpireState(session=None,host=None,customerId="141963"):
  125 + url = host+"/customer-service/api/customerMarket/getCustomerInfoExpireState"
  126 + headers=dct.jsonCode()
  127 + data={"customerId":customerId}
  128 + res = session.useHeadersRequests(method="post",url=url,params=data,headers=headers)
  129 + return res
  130 +
  131 +# res = getCustomerInfoExpireState(session=sessionHg,host=host,customerId="141963")
  132 +# print(res.text)
  133 +
  134 +
  135 +def createAndTrade(session=None,host=None,**kwargs):
  136 + url = host+"/hg-trading/api/tradingOrder/createAndTrade"
  137 + headers=dct.jsonCode()
  138 + data = {"sellerId": 142000, "sellerName": "史东晶", "sellerAccountId": 107796, "sellerCardNo": "888800010591",
  139 + "buyerId": 141963, "buyerName": "杭果客户长歌一", "buyerAccountId": 107667, "buyerCardNo": "888800010592",
  140 + "posCode": "123", "tradePassword": "111111", "orderItemList": [
  141 + {"number": 0, "batchCode": "2109000262", "productId": 36, "productCode": "754107", "productName": "葡萄",
  142 + "categoryId": 754107, "weightType": 2, "quantity": 1, "pieceWeight": None, "grossWeight": 0,
  143 + "tareWeight": 0, "weight": 50, "price": 200, "PriceStr": "2", "amount": 10000, "amountStr": 100.0,
  144 + "originId": 500101, "originName": "万州区",
  145 + "feeItemList": [{"type": 1, "chargeItemId": 521, "chargeItemName": "买家手续费", "amount": 1122.00},
  146 + {"type": 2, "chargeItemId": 522, "chargeItemName": "卖家手续费", "amount": 610.0},
  147 + {"type": 2, "chargeItemId": 527, "chargeItemName": "卖家仓储服务费", "amount": 522.00}]}]}
  148 + data = rJD.replaceJsonData(json=data,data=kwargs)
  149 + data["orderItemList"][0]["feeItemList"]=kwargs["feeItemList"]
  150 + print("data",data)
  151 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  152 + return res
  153 +
  154 +# res = createAndTrade(session=sessionHg,host=host)
  155 +# print(res.text)
  156 +
  157 +def doCreateAndTrade(session=None,host=None,batchCode=None,weight="50",PriceStr="2",posCode="123",tradePassword="111111",
  158 + ic="888800010592"):
  159 + # 获取订单信息
  160 + resQuery = queryRegister(session=session,host=host,batchCode=batchCode)
  161 + # print(resQuery.json())
  162 +
  163 + # 订单信息中提取卖家信息
  164 + sellerId = resQuery.json()["data"][0]["registerRecord"]["customerId"]
  165 + sellerName = resQuery.json()["data"][0]["registerRecord"]["customerName"]
  166 + sellerAccountId = resQuery.json()["data"][0]["registerRecord"]["accountId"]
  167 + sellerCardNo = resQuery.json()["data"][0]["registerRecord"]["cardNo"]
  168 + posCode=posCode
  169 + tradePassword=tradePassword
  170 +
  171 + # 订单信息中提取商品信息
  172 + productId = resQuery.json()["data"][0]["product"]["id"]
  173 + productCode = resQuery.json()["data"][0]["product"]["categoryCode"]
  174 + productName = resQuery.json()["data"][0]["product"]["categoryName"]
  175 + categoryId = resQuery.json()["data"][0]["product"]["categoryId"]
  176 + originId = resQuery.json()["data"][0]["product"]["originId"]
  177 + originName = resQuery.json()["data"][0]["product"]["originName"]
  178 +
  179 +
  180 + # 获取信息
  181 + res = getBySheetNoAndBizNo(session=session,host=host,bizNo=batchCode)
  182 + # print(res.json())
  183 +
  184 +
  185 + # 打印客户信息
  186 + id = resQuery.json()["data"][0]["registerDetail"]["areaId"]
  187 + departmentId = session.userInfo["data"]["user"]["departmentId"]
  188 + marketId = session.userInfo["data"]["user"]["firmId"]
  189 + resArea = getArea(session=session,host=host,id=id,departmentId=departmentId,marketId=marketId)
  190 + print(resArea.json())
  191 +
  192 + # 称重信息
  193 + weightType = resQuery.json()["data"][0]["registerDetail"]["weightType"]
  194 + weight=weight
  195 + PriceStr = PriceStr
  196 + price = int(float(PriceStr)*100)
  197 + amount = int(float(weight)*price)
  198 + amountStr = str(float(amount)/100)
  199 +
  200 + # 判断库存
  201 + resValidate = validateReduce(session=session,host=host,bizNo=batchCode,firmId=marketId,kid=productId,weight=weight)
  202 + # print(resValidate.json())
  203 +
  204 + # 费用信息获取,初始化费用信息
  205 + feeItemList=[]
  206 +
  207 + # 买家身份费用获取
  208 + BusinessType = "hg_trading_buyer"
  209 + resExample = listByExample(session=session,host=host,marketId=marketId,BusinessType=BusinessType)
  210 + chargeItemList = [i["id"] for i in resExample.json()["data"]]
  211 + for item in chargeItemList:
  212 + res = queryFee(session=session,host=host,businessType=BusinessType,marketId=marketId,chargeItem=item,
  213 + amount=amount,payment=amount,categoryId=categoryId)
  214 + feeItem = {}
  215 + feeItem["type"]=1
  216 + feeItem["chargeItemId"]=item
  217 + feeItem["chargeItemName"]=[i["chargeItem"] for i in resExample.json()["data"] if i["id"] == item][0]
  218 + feeItem["amount"]=float(res.json()["data"]["totalFee"])*100
  219 + feeItemList.append(feeItem)
  220 +
  221 + # 卖家费用获取
  222 + BusinessType = "hg_trading_seller"
  223 + resExample = listByExample(session=session,host=host,marketId=marketId,BusinessType=BusinessType)
  224 + chargeItemList = [i["id"] for i in resExample.json()["data"]]
  225 + for item in chargeItemList:
  226 + res = queryFee(session=session,host=host,businessType=BusinessType,marketId=marketId,chargeItem=item,
  227 + amount=amount,payment=amount,categoryId=categoryId)
  228 + feeItem = {}
  229 + feeItem["type"]=2
  230 + feeItem["chargeItemId"]=item
  231 + feeItem["chargeItemName"]=[i["chargeItem"] for i in resExample.json()["data"] if i["id"] == item][0]
  232 + feeItem["amount"]=float(res.json()["data"]["totalFee"])*100
  233 + feeItemList.append(feeItem)
  234 + print(feeItemList)
  235 +
  236 + # 获取买家信息
  237 + resSimpleInfo = get_simpleInfo(session=session,host=host,ic=ic)
  238 + # print(resSimpleInfo.json())
  239 + buyerId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"]
  240 + buyerName = resSimpleInfo.json()["data"]["accountInfo"]["customerName"]
  241 + buyerAccountId = resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
  242 + buyerCardNo = resSimpleInfo.json()["data"]["accountInfo"]["cardNo"]
  243 +
  244 + resCAT = createAndTrade(session=session,host=host,sellerId=sellerId,sellerName=sellerName,sellerAccountId=sellerAccountId,
  245 + sellerCardNo=sellerCardNo,posCode=posCode,tradePassword=tradePassword,productId=productId,
  246 + productCode=productCode,productName=productName,categoryId=categoryId,originId=originId,
  247 + originName=originName,weightType=weightType,weight=weight,PriceStr=PriceStr,price=price,
  248 + amount=amount,amountStr=amountStr,batchCode=batchCode,buyerId=buyerId,
  249 + buyerName=buyerName,buyerAccountId=buyerAccountId,buyerCardNo=buyerCardNo,feeItemList=feeItemList)
  250 + return resCAT
  251 +
  252 +# res = doCreateAndTrade(session=sessionHg,host=host,batchCode="2109000289",ic="888800010592")
  253 +# print(res.text)
0 \ No newline at end of file 254 \ No newline at end of file
commons/api/hg/transaction/Key_customer_login.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/9/9 14:24
  4 +@Auth : wlm
  5 +@File :Key_customer_login.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +大客户模式——登录
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import hg
  13 +class Key_customer_login():
  14 +
  15 + def __init__(self):
  16 + self.url = "http://test.uap.diligrp.com/api/authenticationApi/loginWeb"
  17 + self.header = {
  18 + "Content-Type":"text/plain; charset=utf-8",
  19 + }
  20 + self.body = {
  21 + "userName":"111222",
  22 + "password":"ZfeMAEQsKtLwnj16HwUjFy3NObIVQ8cnjrPuSAFk+hXEOV3hXxTqZFTFM0j4xPhPHK8Cq8RFA10xxP6P2U7SgqZPivlCZl1AnpblIiqA07GIN+4fseHvJd9fUR2fcZOWdRXed/EoiJ6MkRnAUVvsRAcDI8GRsXesv7n9yanYBxE="
  23 + }
  24 +
  25 +
  26 +kcl = Key_customer_login()
  27 +print(kcl.body)
  28 +re = hg.post(url = kcl.url,json = kcl.body,headers = kcl.header,proxies=hg.myproxies)
  29 +print(re.json())
  30 +print(re.headers)
0 \ No newline at end of file 31 \ No newline at end of file
commons/api/hg/transaction/ordinary_customer_login.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/9/9 14:56
  4 +@Auth : wlm
  5 +@File :ordinary_customer_login.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +普通客户模式——登录
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import hg
  13 +class ordinary_customer_login():
  14 +
  15 + def __init__(self):
  16 + self.url = "http://test.uap.diligrp.com/api/authenticationApi/loginWeb"
  17 + self.header = {
  18 + "Content-Type":"text/plain; charset=utf-8",
  19 + }
  20 + self.body = {
  21 + "userName":"333444",
  22 + "password":"GuqHBFJ3t+S6+Iu05bDMbrxy5ZH3POY+egSoYhENV528Nk32B/2NOUhdDvaNwsaYBMf+LxCzJMnF2n3xQ4C94PaH4yqimM9BoNEhMXVXhm4GNRn2GYEihO8U2lvBwC45T7mcbEK1wvy9ie+kFi/PwkQb0nDRzjkR38s6yDU8fF8="
  23 + }
  24 +
  25 +
  26 +ocl = ordinary_customer_login()
  27 +print(ocl.body)
  28 +re = hg.post(url = ocl.url,json = ocl.body,headers = ocl.header)
  29 +print(re.json())
  30 +print(re.headers)
0 \ No newline at end of file 31 \ No newline at end of file
commons/scripts/replaceJsonData.py
@@ -19,4 +19,11 @@ def replaceJsonData(json={},data={}): @@ -19,4 +19,11 @@ def replaceJsonData(json={},data={}):
19 for list_child_index in range(len(json[i])): 19 for list_child_index in range(len(json[i])):
20 if type(json[i][list_child_index]) == dict: 20 if type(json[i][list_child_index]) == dict:
21 json[i][list_child_index] = replaceJsonData(json=json[i][list_child_index], data=data) 21 json[i][list_child_index] = replaceJsonData(json=json[i][list_child_index], data=data)
22 - return json  
23 \ No newline at end of file 22 \ No newline at end of file
  23 + else:
  24 + if i in data.keys():
  25 + json[i] = data[i]
  26 + return json
  27 +
  28 +# json = {"a":"1","b":[{"c":"1"},{"c":2}],"d":[1],"e":"1","f":{"g":1},"h":1,"i":[1]}
  29 +# data = {"a":"a","c":"c","e":"e","d": {"d1":"d1"},"g":"g","h":"h"}
  30 +# print(replaceJsonData(json=json,data=data))
24 \ No newline at end of file 31 \ No newline at end of file
config/marketConfig/conf_test.conf
@@ -12,6 +12,8 @@ sy_cardNumRe_01=888810033081 @@ -12,6 +12,8 @@ sy_cardNumRe_01=888810033081
12 hd_cardNumRe_01=210823173732 12 hd_cardNumRe_01=210823173732
13 #hg 13 #hg
14 hg_cardNumRe_01=888800010591 14 hg_cardNumRe_01=888800010591
  15 +hg_cardNumRe_02=888800010592
  16 +hg_posCode_01=123
15 17
16 18
17 [host] 19 [host]
report/test.log
1 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
2 -[2021-09-08 18:19:16] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb  
3 -[2021-09-08 18:19:16] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb  
4 -{'data': None, 'json': {'userName': '111222', 'password': 'UQq2o0Q6W7XIaDqnez/Hyq3gDuBAZUuOnWAy97RA2s99LIQtVP4tTXJdRLOWCNfF3dS+elBLSKoAPfXygUuoPFrSODa6QYZQ3L4Aufl3fk4wn9ei3l2WczKg0rc030FbxfDUBzKL7QMfjRp2oCfpSH+/r6fVPM1UcZXWRhoxfnU='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}  
5 -  
6 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
7 -[2021-09-08 18:19:16] [INFO] : http://test.uap.diligrp.com/login/login.action  
8 -[2021-09-08 18:19:16] [INFO] : http://10.28.12.150:80/login/login.action 1 +[2021-09-14 11:09:05] [INFO] : ======================================================================================
  2 +[2021-09-14 11:09:05] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
  3 +[2021-09-14 11:09:05] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb
  4 +{'data': None, 'json': {'userName': '111222', 'password': 'EmGtRPV6kawgKe9lnvhrzQftIM9vpxXcsnKUuZBj0L1fH+Lr270OPPUkT+YI69D87J9V/Vl/Z7XqpH9+qETijhO6mWjGDoxxqbhAAvc+fOxgPpdvSwQ7P0DE9JkOA5r4+mKbN7DhBa69i0RkO5MkOUouUbXYdoUY+3jfXaZT0jI='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
  5 +
  6 +[2021-09-14 11:09:05] [INFO] : ======================================================================================
  7 +[2021-09-14 11:09:05] [INFO] : http://test.uap.diligrp.com/login/login.action
  8 +[2021-09-14 11:09:05] [INFO] : http://10.28.12.150:80/login/login.action
9 {'data': b'userName=111222&password=111111', 'json': None, 'headers': {'Host': 'test.uap.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '33', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1', 'Origin': 'http://test.uap.diligrp.com', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'http://test.uap.diligrp.com/login/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7', 'Cookie': 'UAP_accessToken=;UAP_refreshToken=;UAP_loginPath='}, 'allow_redirects': False} 9 {'data': b'userName=111222&password=111111', 'json': None, 'headers': {'Host': 'test.uap.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '33', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1', 'Origin': 'http://test.uap.diligrp.com', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'http://test.uap.diligrp.com/login/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7', 'Cookie': 'UAP_accessToken=;UAP_refreshToken=;UAP_loginPath='}, 'allow_redirects': False}
10 10
11 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
12 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/businessChargeItem/listBusinessChargeItem 11 +[2021-09-14 11:09:05] [INFO] : ======================================================================================
  12 +[2021-09-14 11:09:05] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/businessChargeItem/listBusinessChargeItem
13 {"marketId": 15, "businessType": "501"} 13 {"marketId": 15, "businessType": "501"}
14 {} 14 {}
15 15
16 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
17 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/card-web/accountQuery/simpleInfo.action 16 +[2021-09-14 11:09:05] [INFO] : ======================================================================================
  17 +[2021-09-14 11:09:05] [INFO] : http://test.gateway.diligrp.com:8285/card-web/accountQuery/simpleInfo.action
18 None 18 None
19 -{'params': {'cardNo': '888800010592'}} 19 +{'params': {'cardNo': '888800010591'}}
20 20
21 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
22 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree  
23 -{"marketId": 15, "keyword": "\u82f9\u679c", "state": 1} 21 +[2021-09-14 11:09:05] [INFO] : ======================================================================================
  22 +[2021-09-14 11:09:05] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
  23 +{"marketId": 15, "keyword": "\u8461\u8404", "state": 1}
24 {} 24 {}
25 25
26 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
27 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/city/listByKeywordsWithCityCode  
28 -{"allLevelKeyword": "\u91d1\u725b\u533a"} 26 +[2021-09-14 11:09:06] [INFO] : ======================================================================================
  27 +[2021-09-14 11:09:06] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/city/listByKeywordsWithCityCode
  28 +{"allLevelKeyword": "\u4e07\u5dde"}
29 {} 29 {}
30 30
31 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
32 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/district/search 31 +[2021-09-14 11:09:06] [INFO] : ======================================================================================
  32 +[2021-09-14 11:09:06] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/district/search
33 {"marketId": 15, "nameLike": "\u897f\u533a"} 33 {"marketId": 15, "nameLike": "\u897f\u533a"}
34 {} 34 {}
35 35
36 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
37 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee 36 +[2021-09-14 11:09:06] [INFO] : ======================================================================================
  37 +[2021-09-14 11:09:06] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
38 {"businessType": "501", "chargeItem": 518, "marketId": 15} 38 {"businessType": "501", "chargeItem": 518, "marketId": 15}
39 {} 39 {}
40 40
41 -[2021-09-08 18:19:16] [INFO] : ======================================================================================  
42 -[2021-09-08 18:19:16] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee 41 +[2021-09-14 11:09:06] [INFO] : ======================================================================================
  42 +[2021-09-14 11:09:06] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
43 {"businessType": "501", "chargeItem": 520, "marketId": 15} 43 {"businessType": "501", "chargeItem": 520, "marketId": 15}
44 {} 44 {}
45 45
46 -[2021-09-08 18:19:17] [INFO] : ======================================================================================  
47 -[2021-09-08 18:19:17] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/registerRecord/save  
48 -{"accountId": 107667, "cardNo": "888800010592", "customerId": 141963, "customerCode": "00131684", "customerName": "\u676d\u679c\u5ba2\u6237\u957f\u6b4c\u4e00", "fixedphoneNumber": null, "mobilephoneNumber": "18080018009", "identityCardAddress": "", "identityCardNo": "110101202108265741", "identityCardType": "ID", "registerDetailDtoList": [{"id": 0, "areaId": 272, "areaName": "\u897f\u533a", "quantity": 0, "productId": 374690, "registerRecordId": 0, "remark": null, "weight": "50", "weightType": 0, "created": null, "createdById": 0, "createdByName": null, "createdByDepartmentId": 0, "createdByDepartmentName": null, "registerCertificateList": null, "product": null, "registerCertificateDtoList": null, "productDto": {"id": 0, "originId": 510106, "originName": "\u91d1\u725b\u533a", "pieceWeight": 0, "categoryId": 374690, "categoryCode": 374690, "categoryName": "\u82f9\u679c", "created": null}}], "registerFeeDtoList": [{"id": 0, "actualFee": 200, "receivableFee": 1300, "discountFee": 1100, "registerRecordId": 0, "payStatus": 0, "chargeItemName": "\u5176\u4ed6\u6536\u8d39", "chargeType": 1, "chargeItemId": 518, "registerFeeType": 999, "created": null, "createdById": 0, "createdByName": null, "settleDate": null, "isBehalf": 0, "registerLoadingFeeExtDto": null}], "tradePassword": "111111"} 46 +[2021-09-14 11:09:06] [INFO] : ======================================================================================
  47 +[2021-09-14 11:09:06] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/registerRecord/save
  48 +{"accountId": 107796, "cardNo": "888800010591", "customerId": 142000, "customerCode": "00131702", "customerName": "\u53f2\u4e1c\u6676", "fixedphoneNumber": null, "mobilephoneNumber": "18080008020", "identityCardAddress": "", "identityCardNo": "110101202109024587", "identityCardType": "ID", "registerDetailDtoList": [{"id": 0, "areaId": 272, "areaName": "\u897f\u533a", "quantity": 0, "productId": 754107, "registerRecordId": 0, "remark": null, "weight": 100, "weightType": 0, "created": null, "createdById": 0, "createdByName": null, "createdByDepartmentId": 0, "createdByDepartmentName": null, "registerCertificateList": null, "product": null, "registerCertificateDtoList": null, "productDto": {"id": 0, "originId": 500101, "originName": "\u4e07\u5dde\u533a", "pieceWeight": 0, "categoryId": 754107, "categoryCode": 754107, "categoryName": "\u8461\u8404", "created": null}}], "registerFeeDtoList": [{"id": 0, "actualFee": 200, "receivableFee": 1300, "discountFee": 1100, "registerRecordId": 0, "payStatus": 0, "chargeItemName": "\u5176\u4ed6\u6536\u8d39", "chargeType": 1, "chargeItemId": 518, "registerFeeType": 999, "created": null, "createdById": 0, "createdByName": null, "settleDate": null, "isBehalf": 0, "registerLoadingFeeExtDto": null}], "tradePassword": "111111"}
49 {} 49 {}
50 50
  51 +[2021-09-14 11:09:08] [INFO] : ======================================================================================
  52 +[2021-09-14 11:09:08] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/settle/changeBatchCodeState
  53 +{"batchCode": "2109000335", "state": "2"}
  54 +{}
  55 +
  56 +[2021-09-14 11:09:08] [INFO] : ======================================================================================
  57 +[2021-09-14 11:09:08] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/settle/query
  58 +None
  59 +{'params': {'batchCode': '2109000335'}}
  60 +
testcase/hg/test_batch/test_batch.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/10 10:17
  4 +# @Author : Ljq
  5 +# @File : test_batch.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +杭果市场-结算管理-批号管理
  10 +"""
  11 +
  12 +from commons.MySession import sessionHg as session
  13 +from commons.api.hg.CheckIn import CheckIn
  14 +from commons.api.hg.settlement import batch
  15 +from commons.scripts.readConf import rC
  16 +import unittest,random
  17 +
  18 +class test_batch(unittest.TestCase):
  19 + """杭果市场-结算管理-批号管理"""
  20 + def setUp(self) -> None:
  21 + pass
  22 +
  23 + def tearDown(self) -> None:
  24 + pass
  25 +
  26 + @classmethod
  27 + def setUpClass(cls) -> None:
  28 + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
  29 + cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
  30 + cls.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01")
  31 +
  32 + @classmethod
  33 + def tearDownClass(cls) -> None:
  34 + pass
  35 +
  36 + def test_searchState_1(self):
  37 + """
  38 + 批号管理--查询--输入【在售】状态的完整批号,查询出该批号下的相关数据
  39 + """
  40 + # 创建初始数据
  41 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  42 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  43 + # 执行查询
  44 + print("test_searchState_1 --> self.batchCode:",self.batchCode)
  45 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  46 + print(resSearchState.json())
  47 + assert resSearchState.json()["code"] == "200","在售状态的登记单查询失败"
  48 + assert resSearchState.json()["state"] == 1,"在售状态的登记单查询失败"
  49 + assert resSearchState.json()["data"]["state"] == 1, "在售状态的登记单查询失败"
  50 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
  51 +
  52 + def test_searchState_2(self):
  53 + """
  54 + 批号管理--查询--输入【关闭】状态的完整批号,查询出该批号下的相关数据
  55 + """
  56 + # 创建初始数据
  57 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  58 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  59 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  60 + # 将批号关闭
  61 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  62 + assert resChange.json()["message"] == "success","批号关闭成功"
  63 + # 执行查询
  64 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  65 + print(resSearchState.json())
  66 + assert resSearchState.json()["code"] == "200","在售状态的登记单查询失败"
  67 + assert resSearchState.json()["state"] == 2,"在售状态的登记单查询失败"
  68 + assert resSearchState.json()["data"]["state"] == 2, "在售状态的登记单查询失败"
  69 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
  70 +
  71 + def test_batchDetails(self):
  72 + """
  73 + 批号管理--列表--【列表】中数据显示正确
  74 + """
  75 + # 创建初始数据
  76 + goodsName="西瓜"
  77 + weight = random.randint(50,100)
  78 + print("weight",weight)
  79 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic,goodsName=goodsName,
  80 + weight=weight)
  81 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  82 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  83 + # 执行查询
  84 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  85 + print(resSearchState.json())
  86 + assert resSearchState.json()["code"] == "200","查询状态码返回错误"
  87 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "查询获得订单与实际订单不一致"
  88 + assert resSearchState.json()["data"]["registerDetail"][0]["categoryName"] == goodsName, "批号的商品信息与创建时不一致"
  89 + assert resSearchState.json()["data"]["registerDetail"][0]["weight"] == weight, "批号的重量信息与创建时不一致"
  90 +
  91 + def test_changeState_1(self):
  92 + """
  93 + 批号管理--恢复交款--“关闭”状态的批号,可【恢复交款】成功
  94 + """
  95 + # 创建初始数据
  96 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  97 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  98 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  99 + # 将批号关闭
  100 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode,state=2)
  101 + assert resChange.json()["message"] == "success","批号关闭成功"
  102 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode,state=1)
  103 + assert resChange.json()["message"] == "success","批号关闭成功"
  104 + # 执行查询
  105 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  106 + print(resSearchState.json())
  107 + assert resSearchState.json()["data"]["state"] == 1, "在售状态的登记单查询失败"
  108 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
  109 +
  110 + def test_changeState_2(self):
  111 + """
  112 + 批号管理--恢复交款--“在售”状态的批号,可【停止交款】成功
  113 + """
  114 + # 创建初始数据
  115 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  116 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  117 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  118 + # 将批号关闭
  119 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode,state=2)
  120 + assert resChange.json()["message"] == "success","批号关闭成功"
  121 + # 执行查询
  122 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  123 + print(resSearchState.json())
  124 + assert resSearchState.json()["data"]["state"] == 2, "在售状态的登记单查询失败"
  125 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
testcase/hg/test_batchSettlement/__init__.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/10 11:00
  4 +# @Author : Ljq
  5 +# @File : __init__.py.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
testcase/hg/test_batchSettlement/test_batchSettlement.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/10 11:01
  4 +# @Author : Ljq
  5 +# @File : test_batchSettlement.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +杭果市场-结算管理-批号管理
  10 +"""
  11 +
  12 +
  13 +from commons.api.hg.settlement import batch
  14 +from commons.api.hg.settlement import batchSettlement
  15 +from commons.api.hg.settlement import sellingGoods
  16 +from commons.MySession import sessionHg as session
  17 +from commons.api.hg.CheckIn import CheckIn
  18 +from commons.scripts.readConf import rC
  19 +import unittest,random
  20 +
  21 +class test_batch(unittest.TestCase):
  22 + """杭果市场-结算管理-批号管理"""
  23 + def setUp(self) -> None:
  24 + pass
  25 +
  26 + def tearDown(self) -> None:
  27 + pass
  28 +
  29 + @classmethod
  30 + def setUpClass(cls) -> None:
  31 + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
  32 + cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
  33 + cls.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01")
  34 + cls.ic_buyer = rC.returnOptionsItems("testInfo", "hg_cardNumRe_02")
  35 + cls.posCode = rC.returnOptionsItems("testInfo", "hg_posCode_01")
  36 +
  37 + @classmethod
  38 + def tearDownClass(cls) -> None:
  39 + pass
  40 +
  41 + def test_searchState_1(self):
  42 + """
  43 + 批号管理--查询--验证查询已关闭的批号自动加载批号信息
  44 + """
  45 + # 创建初始数据
  46 + posCode = self.posCode
  47 + state = "2"
  48 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  49 + batchCode = resBatchCode.json()["data"]["batchCode"]
  50 + print("test_searchState_1 --> self.batchCode:", batchCode)
  51 + # 变更交易状态
  52 + resCAT = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=batchCode,state=state)
  53 + print(resCAT.json())
  54 + assert resCAT.json()["code"]=="200","登记单状态变更失败"
  55 + # 结算单查询
  56 + res = batchSettlement.settle_query(session=session,host=self.gatewayHost,batchCode=batchCode)
  57 + print(res.text)
  58 + assert "tradingOrder" in res.text,"验证查询已关闭的批号自动加载批号信息"
0 \ No newline at end of file 59 \ No newline at end of file
testcase/hg/tradingOrder/test_Key_customer_login.py 0 → 100644
  1 +import unittest
  2 +import urllib3
  3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  4 +from commons.MySession import hg,my
  5 +from commons.api.hg.transaction.Key_customer_login import Key_customer_login
  6 +kcl = Key_customer_login()
  7 +
  8 +"""
  9 +大客户登录
  10 +"""
  11 +
  12 +class test_Key_customer_login(unittest.TestCase):
  13 + "大客户登录"
  14 + @classmethod
  15 + def setUpClass(cls):
  16 + pass
  17 +
  18 + @unittest.case_mark(my.mark())
  19 + def test_Key_customer_login_01(self):
  20 + "大客户登录"
  21 + body = kcl.body.copy()
  22 + re = hg.post(url = kcl.url, headers = kcl.header, json = body)
  23 + print(re.json())
  24 + self.assertEqual(re.status_code, 200)
  25 + self.assertTrue("'登录成功'" in str(re.json()).replace(" ", ""))
  26 + self.assertEqual(re.json()["data"]["user"]["state"], 1,"为1时是大客户")
  27 + @classmethod
  28 + def tearDownClass(cls):
  29 + pass
  30 +
  31 +
  32 +if __name__ == '__main__':
  33 + unittest.main()
testcase/hg/tradingOrder/test_ordinary_customer_login.py 0 → 100644
  1 +import unittest
  2 +import urllib3
  3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  4 +from commons.MySession import hg,my
  5 +from commons.api.hg.transaction.ordinary_customer_login import ordinary_customer_login
  6 +ocl = ordinary_customer_login()
  7 +
  8 +"""
  9 +普通客户登录
  10 +"""
  11 +
  12 +class test_Key_customer_login(unittest.TestCase):
  13 + "普通客户登录"
  14 + @classmethod
  15 + def setUpClass(cls):
  16 + pass
  17 +
  18 + @unittest.case_mark(my.mark())
  19 + def test_Key_customer_login_01(self):
  20 + "普通客户登录"
  21 + body = ocl.body.copy()
  22 + re = hg.post(url = ocl.url, headers = ocl.header, json = body)
  23 + print(re.json())
  24 + self.assertEqual(re.status_code, 200)
  25 + self.assertTrue("'登录成功'" in str(re.json()).replace(" ", ""))
  26 + self.assertNotEqual(re.json()["data"]["user"]["state"], 1,"为1时是大客户")
  27 + @classmethod
  28 + def tearDownClass(cls):
  29 + pass
  30 +
  31 +
  32 +if __name__ == '__main__':
  33 + unittest.main()