Commit fc91703486d0c33583e40ca3b741a0f6d9d0f6ca

Authored by lixi
2 parents 2528f8d3 0bc23e40

Merge remote-tracking branch 'origin/master'

commons/api/hg/CheckIn/CheckInMoreGoods.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/8 14:17
  4 +# @Author : Ljq
  5 +# @File : CheckIn.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 get_simpleInfo(session=None,host=None,ic=None):
  22 + url = host+"/card-web/accountQuery/simpleInfo.action"
  23 + headers={}
  24 + data={"cardNo":ic}
  25 + res = session.useHeadersRequests(method="GET",url=url,params=data,headers=headers)
  26 + return res
  27 +
  28 +
  29 +def get_tree(session=None,host=None,**kwargs):
  30 + "商品信息获取"
  31 + url = host+"/assets-service/api/cusCategory/getTree"
  32 + headers = dct.jsonCode()
  33 + data={"marketId":15,"keyword":"西瓜","state":1}
  34 + data = dict(data,**kwargs)
  35 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  36 + return res
  37 +
  38 +
  39 +def get_cityCode(session=None,host=None,allLevelKeyword="万州"):
  40 + """"""
  41 + url = host+"/assets-service/api/city/listByKeywordsWithCityCode"
  42 + headers = dct.jsonCode()
  43 + data={"allLevelKeyword":allLevelKeyword}
  44 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  45 + return res
  46 +
  47 +
  48 +def get_searchArea(session=None,host=None,**kwargs):
  49 + """"""
  50 + url = host+"/assets-service/api/district/search"
  51 + headers = dct.jsonCode()
  52 + data={"marketId":15,"nameLike":"西区"}
  53 + data = dict(data,**kwargs)
  54 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  55 + return res
  56 +
  57 +
  58 +def get_chargeItem(session=None,host=None,**kwargs):
  59 + """获取费用项"""
  60 + url = host+"/hg-trading/api/businessChargeItem/listBusinessChargeItem"
  61 + headers = dct.jsonCode()
  62 + data={"marketId":15,"businessType":"501"}
  63 + data = dict(data,**kwargs)
  64 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  65 + return res
  66 +
  67 +
  68 +def get_queryFee(session=None,host=None,**kwargs):
  69 + """根据费用项获取费用"""
  70 + url = host+"/dili-rule/api/chargeRule/queryFee"
  71 + headers = dct.jsonCode()
  72 + data={"businessType":"501","chargeItem":520,"marketId":15}
  73 + data = dict(data,**kwargs)
  74 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  75 + return res
  76 +
  77 +def returnDetailChild(**kwargs):
  78 + child_template = {"id": 0, "areaId": 272, "areaName": "西区", "quantity": 0, "productId": 754107, "registerRecordId": 0,
  79 + "remark": None, "weight": 100, "weightType": 0, "created": None, "createdById": 0,
  80 + "createdByName": None, "createdByDepartmentId": 0, "createdByDepartmentName": None,
  81 + "registerCertificateList": None, "product": None, "registerCertificateDtoList": None,
  82 + "productDto": {"id": 0, "originId": 500101, "originName": "万州区", "pieceWeight": 0,
  83 + "categoryId": 754107, "categoryCode": "754107", "categoryName": "葡萄",
  84 + "created": None}}
  85 + child_template = rJD.replaceJsonData(json=child_template, data=kwargs)
  86 + return child_template
  87 +
  88 +
  89 +
  90 +def save_registerRecord(session=None,host=None,registerDetailDtoList=None,**kwargs):
  91 + """生成登记单并缴费"""
  92 + url = host+"/hg-trading/api/registerRecord/save"
  93 + headers = dct.jsonCode()
  94 + data = {"accountId": 107796, "cardNo": "888800010591", "customerId": 142000, "customerCode": "00131702",
  95 + "customerName": "史东晶", "fixedphoneNumber": None, "mobilephoneNumber": "18080008020",
  96 + "identityCardAddress": "", "identityCardNo": "110101202109024587", "identityCardType": "ID",
  97 + "registerDetailDtoList": [
  98 + {"id": 0, "areaId": 272, "areaName": "西区", "quantity": 0, "productId": 754107, "registerRecordId": 0,
  99 + "remark": None, "weight": 100, "weightType": 0, "created": None, "createdById": 0,
  100 + "createdByName": None, "createdByDepartmentId": 0, "createdByDepartmentName": None,
  101 + "registerCertificateList": None, "product": None, "registerCertificateDtoList": None,
  102 + "productDto": {"id": 0, "originId": 500101, "originName": "万州区", "pieceWeight": 0,
  103 + "categoryId": 754107, "categoryCode": "754107", "categoryName": "葡萄",
  104 + "created": None}}],
  105 + "registerFeeDtoList": [
  106 + {"id": 0, "actualFee": 200.0, "receivableFee": 1300.0, "discountFee": 1100.0, "registerRecordId": 0,
  107 + "payStatus": 0, "chargeItemName": "其他收费", "chargeType": 1, "chargeItemId": 518, "registerFeeType": 999,
  108 + "created": None, "createdById": 0, "createdByName": None, "settleDate": None, "isBehalf": 0,
  109 + "registerLoadingFeeExtDto": None}], "tradePassword": "111111"}
  110 + data = rJD.replaceJsonData(json=data,data=kwargs)
  111 + data["registerDetailDtoList"] = registerDetailDtoList
  112 + print(data)
  113 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  114 + return res
  115 +
  116 +def create_registerRecord(session=None,host=None,ic="888800010591",goodsName="葡萄",nameLike="西区",
  117 + allLevelKeyword="万州",tradePassword="111111",weight=100):
  118 + """创建进门登记单并缴费"""
  119 + # 获取费用信息
  120 + marketId = session.userInfo["data"]["user"]["firmId"]
  121 + res = get_chargeItem(session=session,host=host,marketId=marketId)
  122 + chargeItemId = [i["id"] for i in res.json()["data"] if i["chargeItem"] == "其他收费"][0]
  123 + chargeItemIdChild = [i["id"] for i in res.json()["data"] if "parentId" in i.keys() and i["parentId"] == chargeItemId][0]
  124 +
  125 + # 获取客户信息
  126 + resSimpleInfo = get_simpleInfo(session=session,host=host,ic=ic)
  127 + accountId = resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
  128 + cardNo = resSimpleInfo.json()["data"]["accountInfo"]["cardNo"]
  129 + customerId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"]
  130 + customerCode = resSimpleInfo.json()["data"]["accountInfo"]["customerCode"]
  131 + customerName = resSimpleInfo.json()["data"]["accountInfo"]["customerName"]
  132 + mobilephoneNumber = resSimpleInfo.json()["data"]["accountInfo"]["customerContactsPhone"]
  133 + identityCardNo = resSimpleInfo.json()["data"]["accountInfo"]["customerCertificateNumber"]
  134 +
  135 + # # 获取商品信息
  136 + # resTree = get_tree(session=session,host=host,keyword=goodsName,marketId=marketId)
  137 + # productId = resTree.json()["data"][0]["id"]
  138 + # categoryId = productId
  139 + # categoryCode = productId
  140 + # categoryName = resTree.json()["data"][0]["name"]
  141 +
  142 + # 获取产地信息
  143 + resCity = get_cityCode(session=session,host=host,allLevelKeyword=allLevelKeyword)
  144 + originId = resCity.json()["data"][0]["id"]
  145 + originName = resCity.json()["data"][0]["name"]
  146 +
  147 + # 获取区域信息
  148 + resArea = get_searchArea(session=session,host=host,nameLike=nameLike,marketId=marketId)
  149 + areaId = resArea.json()["data"][0]["id"]
  150 + areaName = resArea.json()["data"][0]["name"]
  151 +
  152 + registerDetailDtoList = []
  153 +
  154 + for i in goodsName.split(","):
  155 + # 获取商品信息
  156 + resTree = get_tree(session=session, host=host, keyword=i, marketId=marketId)
  157 + print(resTree.json())
  158 + productId = resTree.json()["data"][0]["id"]
  159 + categoryId = productId
  160 + categoryCode = productId
  161 + categoryName = resTree.json()["data"][0]["name"]
  162 + child_item = returnDetailChild(productId=productId,categoryId=categoryId,categoryCode=categoryCode,
  163 + categoryName=categoryName,areaId=areaId,areaName=areaName,weight=weight,
  164 + originId=originId,originName=originName)
  165 + registerDetailDtoList.append(child_item)
  166 +
  167 + # 采用其他收费时获取应收金额,优惠金额,实际金额
  168 + receivableFee = int(get_queryFee(session=session,host=host,chargeItem=chargeItemId,marketId=marketId).json()["data"]["totalFee"])*100
  169 + discountFee = int(get_queryFee(session=session, host=host, chargeItem=chargeItemIdChild,marketId=marketId).json()["data"]["totalFee"])*100
  170 + actualFee = receivableFee - discountFee
  171 +
  172 + # 创建进门登记单并缴费
  173 + resSave = save_registerRecord(session=session, host=host, registerDetailDtoList=registerDetailDtoList,weight=weight, tradePassword=tradePassword,
  174 + chargeItemId=chargeItemId, accountId=accountId, cardNo=cardNo, customerId=customerId,
  175 + customerCode=customerCode, customerName=customerName,
  176 + mobilephoneNumber=mobilephoneNumber, identityCardNo=identityCardNo,originId=originId, originName=originName, areaId=areaId,
  177 + areaName=areaName, receivableFee=receivableFee, discountFee=discountFee,
  178 + actualFee=actualFee)
  179 + return resSave
  180 +
  181 +
  182 +res = create_registerRecord(session=sessionHg,ic="888800010592",host=host,goodsName="苹果,葡萄,西瓜",allLevelKeyword="万州",
  183 + nameLike="东区",tradePassword="111111",weight=51)
  184 +print(res.text)
  185 +print(res.json()["data"]["batchCode"])
0 \ No newline at end of file 186 \ No newline at end of file
commons/api/hg/CheckIn/demo.py renamed to commons/api/hg/CheckIn/中信银行接口调用.py
commons/api/hg/settlement/demo.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 -# @Time : 2021/9/9 14:41 3 +# @Time : 2021/9/23 18:26
4 # @Author : Ljq 4 # @Author : Ljq
5 # @File : demo.py 5 # @File : demo.py
6 # @Software: PyCharm 6 # @Software: PyCharm
@@ -9,45 +9,11 @@ @@ -9,45 +9,11 @@
9 9
10 """ 10 """
11 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 12 +import sys
18 13
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 14 +print(sys.argv)
  15 +data = {i.split("=")[0]:i.split("=")[1] for i in sys.argv if "=" in i}
  16 +print(data)
51 17
52 -res = save_red(session=sessionHg,host="")  
53 -print(res.json())  
54 \ No newline at end of file 18 \ No newline at end of file
  19 +# a = "啊实打,阿斯蒂"
  20 +# print(a.split(","))
55 \ No newline at end of file 21 \ No newline at end of file
commons/api/hg/settlement/saveOrUpdateBC.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/26 11:29
  4 +# @Author : Ljq
  5 +# @File : saveOrUpdateBC.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 saveOrUpdate(session=None,host=None,name="Z4"):
  22 + """
  23 + 查询登记单
  24 + :param batchCode:登记单号
  25 + """
  26 + url = host+"/assets-service/api/assetsClass/saveOrUpdate.action"
  27 + headers = dct.jsonCode()
  28 + data = {"typeName":str(name),"name":str(name),"assetsPartsList":[{"partsName":str(name)}],"marketId":15}
  29 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  30 + return res
  31 +
  32 +def searchList(session=None,host=None):
  33 + """
  34 + 查询登记单
  35 + :param batchCode:登记单号
  36 + """
  37 + url = host+"/assets-service/api/assetsClass/searchList.action"
  38 + headers = dct.jsonCode()
  39 + data = {"marketId":15,"isSearch":False}
  40 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  41 + return res
  42 +
  43 +def save(session=None,host=None,**kwargs):
  44 + """
  45 + 查询登记单
  46 + :param batchCode:登记单号
  47 + """
  48 + url = host+"/assets-service/api/scales/saveOrUpdate.action"
  49 + headers = dct.jsonCode()
  50 + data = {"name":"Z5","assetsClassId":148,"state":8,"marketId":15,"creatorId":457}
  51 + data = dict(data,**kwargs)
  52 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  53 + return res
  54 +
  55 +def search(session=None,host=None,**kwargs):
  56 + """
  57 + 查询登记单
  58 + :param batchCode:登记单号
  59 + """
  60 + url = host+"/assets-service/api/scales/search.action"
  61 + headers = dct.jsonCode()
  62 + data = {"likeName":""}
  63 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  64 + return res
  65 +
  66 +def saveLeaseOrder(session=None,host=None,**kwargs):
  67 + """
  68 + 查询登记单
  69 + :param batchCode:登记单号
  70 + """
  71 + url = host+"/intelligent-assets/api/leaseOrder/saveLeaseOrder"
  72 + headers = dct.jsonCode()
  73 + data = {"assetsType": 5, "customerId": 142000, "customerCellphone": "18080008020", "departmentId": 178,
  74 + "assetsId": 2641, "assetsClass": "D2", "startTime": "2021-09-26 00:00", "totalAmount": 10200,
  75 + "rentalFee#533": "2", "rentalFee#496": "100", "mchId": 15, "bizType": "18", "customerName": "史东晶",
  76 + "certificateNumber": "110101202109024587", "departmentName": "结算部", "organizationType": "individual",
  77 + "leaseOrderItems": [{"businessChargeItems": [{"chargeItemId": 496, "chargeItemName": "押金", "amount": 10000},
  78 + {"chargeItemId": 533, "chargeItemName": "押金2", "amount": 200}],
  79 + "assetsId": 2641, "assetsName": "D2", "assetsClass": "D2", "assetsClassId": 155,
  80 + "totalAmount": 10200}], "assetsClassId": 8}
  81 + # data = dict(data,**kwargs)
  82 + data = rJD.replaceJsonData(json=data, data=kwargs)
  83 + data["assetsClassId"]= 8
  84 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  85 + return res
  86 +
  87 +def submitPayment(session=None,host=None,id="2969"):
  88 + """
  89 + 查询登记单
  90 + :param batchCode:登记单号
  91 + """
  92 + url = host+f"/intelligent-assets/api/leaseOrder/submitPayment?id={id}"
  93 + headers = dct.jsonCode()
  94 + res = session.useHeadersRequests(method="post",url=url,headers=headers)
  95 + return res
  96 +
  97 +
  98 +if __name__ == "__main__":
  99 + # 名称
  100 + name = "CG"+time.strftime("%y%m%d%H%M%S", time.localtime())
  101 + print(name)
  102 +
  103 + # 开始创建
  104 + res = saveOrUpdate(session=sessionHg, host=host, name=name)
  105 + if res.json()["code"] == "200":
  106 + resSearch = searchList(session=sessionHg, host=host)
  107 + assetsClassId = [i["id"] for i in resSearch.json()["data"] if i["name"] == name][0]
  108 + resSave = save(session=sessionHg, host=host, name=name, assetsClassId=assetsClassId)
  109 + print("res ---------------> ", resSave.json()["message"])
  110 + runState = True
  111 + else:
  112 + print("res ---------------> ", res.json()["message"])
  113 + runState = False
  114 +
  115 + # 创建租赁单
  116 + if runState == True:
  117 + resSearchB = search(session=sessionHg, host=host)
  118 + assetsId = [i["id"] for i in resSearchB.json()["data"] if i["name"]==name][0]
  119 + # print(assetsId)
  120 + resSaveLeaseOrder = saveLeaseOrder(session=sessionHg, host=host,assetsClass=name,assetsId=assetsId,
  121 + assetsClassId=assetsClassId,assetsName=name)
  122 + # print(resSaveLeaseOrder.json())
  123 + id = resSaveLeaseOrder.json()["data"]["id"]
  124 + print(id)
  125 + res = submitPayment(session=sessionHg,host=host,id=id)
  126 + print(res.json())
0 \ No newline at end of file 127 \ No newline at end of file
commons/api/hg/settlement/创建委托合同.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-10-09",
  37 + "endTime": "2021-10-30",
  38 + "consignors": [{
  39 + "consigneeName": "李四",
  40 + "consigneeIdCode": "513922198704216819",
  41 + "consigneeIdMobile": "18080008001",
  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/transaction/l_createAndTrade.py
@@ -22,63 +22,61 @@ class l_createAndTrade(): @@ -22,63 +22,61 @@ class l_createAndTrade():
22 "Host":"test.gateway.diligrp.com:8285" 22 "Host":"test.gateway.diligrp.com:8285"
23 } 23 }
24 self.body = { 24 self.body = {
25 - "sellerId":141969,  
26 - "sellerName":"严安彬卖",  
27 - "sellerAccountId":107677,  
28 - "sellerCardNo":"888810061102",  
29 - "buyerId":141968,  
30 - "buyerName":"袁豪正买",  
31 - "buyerAccountId":107676,  
32 - "buyerCardNo":"888810061104",  
33 - "posCode":"333444",  
34 - "tradePassword":"111111",  
35 - "orderItemList":[  
36 - {  
37 - "number":0,  
38 - "batchCode":"2109000223",  
39 - "productId":167,  
40 - "productCode":"754107",  
41 - "productName":"葡萄",  
42 - "categoryId":754107,  
43 - "weightType":1,  
44 - "quantity":10,  
45 - "pieceWeight":10,  
46 - "grossWeight":0,  
47 - "tareWeight":0,  
48 - "weight":100,  
49 - "price":1000,  
50 - "PriceStr":"10",  
51 - "amount":10000,  
52 - "amountStr":100,  
53 - "originId":40000000,  
54 - "originName":"阿尔及利亚",  
55 - "feeItemList":[  
56 - { 25 + "sellerId":141969,
  26 + "sellerName":"严安彬卖",
  27 + "sellerAccountId":107677,
  28 + "sellerCardNo":"888810061102",
  29 + "buyerId":141968,
  30 + "buyerName":"袁豪正买",
  31 + "buyerCardHolder":"袁豪正买",
  32 + "buyerAccountId":107676,
  33 + "buyerCardNo":"888810061104",
  34 + "posCode":"333444",
  35 + "tradePassword":"111111",
  36 + "orderItemList":[{
  37 + "number":0,
  38 + "batchCode":"2109000660",
  39 + "productId":125,
  40 + "productCode":"374690",
  41 + "productName":"苹果",
  42 + "categoryId":374690,
  43 + "weightType":1,
  44 + "quantity":10,
  45 + "pieceWeight":1,
  46 + "grossWeight":0.0,
  47 + "tareWeight":0.0,
  48 + "weight":10.0,
  49 + "price":2000,
  50 + "PriceStr":"20.00",
  51 + "amount":20000,
  52 + "amountStr":"200.00",
  53 + "originId":510100,
  54 + "originName":"成都市",
  55 + "feeItemList":[{
57 "type":1, 56 "type":1,
58 "chargeItemId":521, 57 "chargeItemId":521,
59 "chargeItemName":"买家手续费", 58 "chargeItemName":"买家手续费",
60 - "amount":1122  
61 - },  
62 - { 59 + "amount":550.0
  60 + },{
63 "type":2, 61 "type":2,
64 "chargeItemId":522, 62 "chargeItemId":522,
65 "chargeItemName":"卖家手续费", 63 "chargeItemName":"卖家手续费",
66 - "amount":610  
67 - },  
68 - { 64 + "amount":989.00
  65 + },{
69 "type":2, 66 "type":2,
70 "chargeItemId":527, 67 "chargeItemId":527,
71 "chargeItemName":"卖家仓储服务费", 68 "chargeItemName":"卖家仓储服务费",
72 - "amount":522  
73 - }  
74 - ]  
75 - }  
76 - ]  
77 -} 69 + "amount":522.00
  70 + },{
  71 + "type":2,
  72 + "chargeItemId":534,
  73 + "chargeItemName":"卖家其他费用",
  74 + "amount":231.00
  75 + }]}]}
78 76
79 77
80 -lcat = l_createAndTrade()  
81 -print(lcat.body)  
82 -re = hg.post(url = lcat.url,json = lcat.body,headers = lcat.header,proxies=hg.myproxies)  
83 -print(re.json())  
84 -print(re.headers)  
85 \ No newline at end of file 78 \ No newline at end of file
  79 +# lcat = l_createAndTrade()
  80 +# print(lcat.body)
  81 +# re = hg.post(url = lcat.url,json = lcat.body,headers = lcat.header,proxies=hg.myproxies)
  82 +# print(re.json())
  83 +# print(re.headers)
86 \ No newline at end of file 84 \ No newline at end of file
commons/api/hg/transaction/listFixedPaid.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/10/11 10:06
  4 +@Auth : wlm
  5 +@File :listFixedPaid.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +大客户模式——查询结算单
  10 +"""
  11 +
  12 +from commons import common as com
  13 +from commons.MySession import hg
  14 +class listFixedPaid():
  15 +
  16 + def __init__(self):
  17 + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/listFixedPaid"
  18 + self.header ={
  19 + "UAP_accessToken":"demo",
  20 + "UAP_refreshToken":"demo"
  21 + }
  22 + self.body = ""
  23 +
  24 +
  25 +# lfp = listFixedPaid()
  26 +# print(lfp.body)
  27 +# re = hg.post(url = lfp.url,json = lfp.body,headers = lfp.header,proxies=hg.myproxies)
  28 +# print(re.json())
  29 +# print(re.headers)
0 \ No newline at end of file 30 \ No newline at end of file
commons/scripts/replaceJsonData.py
@@ -26,4 +26,8 @@ def replaceJsonData(json={},data={}): @@ -26,4 +26,8 @@ def replaceJsonData(json={},data={}):
26 26
27 # json = {"a":"1","b":[{"c":"1"},{"c":2}],"d":[1],"e":"1","f":{"g":1},"h":1,"i":[1]} 27 # json = {"a":"1","b":[{"c":"1"},{"c":2}],"d":[1],"e":"1","f":{"g":1},"h":1,"i":[1]}
28 # data = {"a":"a","c":"c","e":"e","d": {"d1":"d1"},"g":"g","h":"h"} 28 # data = {"a":"a","c":"c","e":"e","d": {"d1":"d1"},"g":"g","h":"h"}
29 -# print(replaceJsonData(json=json,data=data))  
30 \ No newline at end of file 29 \ No newline at end of file
  30 +# data_b = {"b": [{"c":"3"}]}
  31 +# print(replaceJsonData(json=json,data=data))
  32 +# json["b"]=data_b["b"]
  33 +# print(json)
  34 +# # print(dict(json,**data))
31 \ No newline at end of file 35 \ No newline at end of file
config/marketConfig/conf_test.conf
@@ -11,9 +11,9 @@ sy_cardNumRe_01=888810033081 @@ -11,9 +11,9 @@ sy_cardNumRe_01=888810033081
11 #hd 11 #hd
12 hd_cardNumRe_01=210823173732 12 hd_cardNumRe_01=210823173732
13 #hg 13 #hg
14 -; hg_cardNumRe_01=888800010626  
15 -hg_cardNumRe_01=888800010591  
16 -hg_cardNumRe_02=888800010592 14 +; hg_cardNumRe_01=888800010591
  15 +hg_cardNumRe_01=210916163820
  16 +hg_cardNumRe_02=210916163880
17 hg_posCode_01=123 17 hg_posCode_01=123
18 18
19 19
report/test.log
1 -[2021-09-15 10:33:33] [INFO] : ======================================================================================  
2 -[2021-09-15 10:33:33] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb  
3 -[2021-09-15 10:33:33] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb  
4 -{'data': None, 'json': {'userName': '111222', 'password': 'DQXEjlThXAkerQ5AdTWgzBb+S7lpE99qU2rcDnKgA4TPFIMi5uBo7qCC9W+F+/+LbFOIYcdDPrNR5qfdDDb5B7cZaVfqDT4HnJcGk0O2iI44pPAEVicie2h3neKfDfgwmAaSiynHplT/C2AHNWqeY47/Q49d0VEWtgqwdCRy9bQ='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}  
5 -  
6 -[2021-09-15 10:33:34] [INFO] : ======================================================================================  
7 -[2021-09-15 10:33:34] [INFO] : http://test.uap.diligrp.com/login/login.action  
8 -[2021-09-15 10:33:34] [INFO] : http://10.28.12.150:80/login/login.action 1 +[2021-10-08 11:24:29] [INFO] : ======================================================================================
  2 +[2021-10-08 11:24:29] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
  3 +[2021-10-08 11:24:29] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb
  4 +{'data': None, 'json': {'userName': '111222', 'password': 'RW7Bqns0+dvVeXJ+R0W6vIqfS3/Tz/JTdIVZmuiA/vfO61U5DJVVYko26MyoBUxJzeSrBbmZdFzOmbblD9HZXaQbYK95tyIk2h+I8YtIkOTMqSnzlzc/5qNxtXK/ftLFp1ElEBZN25UGaR79qhJbQ5DuraW03IBM1wdbkJVOCik='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
  5 +
  6 +[2021-10-08 11:24:29] [INFO] : ======================================================================================
  7 +[2021-10-08 11:24:29] [INFO] : http://test.uap.diligrp.com/login/login.action
  8 +[2021-10-08 11:24:29] [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-15 10:33:34] [INFO] : ======================================================================================  
12 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/businessChargeItem/listBusinessChargeItem 11 +[2021-10-08 11:24:29] [INFO] : ======================================================================================
  12 +[2021-10-08 11:24:29] [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-15 10:33:34] [INFO] : ======================================================================================  
17 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/card-web/accountQuery/simpleInfo.action 16 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  17 +[2021-10-08 11:24:30] [INFO] : http://test.gateway.diligrp.com:8285/card-web/accountQuery/simpleInfo.action
18 None 18 None
19 {'params': {'cardNo': '888800010591'}} 19 {'params': {'cardNo': '888800010591'}}
20 20
21 -[2021-09-15 10:33:34] [INFO] : ======================================================================================  
22 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree 21 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  22 +[2021-10-08 11:24:30] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
23 {"marketId": 15, "keyword": "\u8461\u8404", "state": 1} 23 {"marketId": 15, "keyword": "\u8461\u8404", "state": 1}
24 {} 24 {}
25 25
26 -[2021-09-15 10:33:34] [INFO] : ======================================================================================  
27 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/city/listByKeywordsWithCityCode 26 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  27 +[2021-10-08 11:24:30] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/city/listByKeywordsWithCityCode
28 {"allLevelKeyword": "\u4e07\u5dde"} 28 {"allLevelKeyword": "\u4e07\u5dde"}
29 {} 29 {}
30 30
31 -[2021-09-15 10:33:34] [INFO] : ======================================================================================  
32 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/district/search 31 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  32 +[2021-10-08 11:24:30] [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-15 10:33:34] [INFO] : ======================================================================================  
37 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee 36 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  37 +[2021-10-08 11:24:30] [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-15 10:33:34] [INFO] : ======================================================================================  
42 -[2021-09-15 10:33:34] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee 41 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  42 +[2021-10-08 11:24:30] [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-15 10:33:34] [INFO] : ======================================================================================  
47 -[2021-09-15 10:33:34] [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"} 46 +[2021-10-08 11:24:30] [INFO] : ======================================================================================
  47 +[2021-10-08 11:24:30] [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": 1500, "receivableFee": 1500, "discountFee": 0, "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
testcase/hg/tradingOrder/test_createAndTrade.py
@@ -10,6 +10,7 @@ r = registerRecord_save() @@ -10,6 +10,7 @@ r = registerRecord_save()
10 10
11 """ 11 """
12 创建大客户订单 12 创建大客户订单
  13 +a
13 """ 14 """
14 15
15 class test_createAndTrade(unittest.TestCase): 16 class test_createAndTrade(unittest.TestCase):
testcase/hg/tradingOrder/test_l_createAndTrade.py
@@ -17,8 +17,7 @@ class test_l_createAndTrade(unittest.TestCase): @@ -17,8 +17,7 @@ class test_l_createAndTrade(unittest.TestCase):
17 @classmethod 17 @classmethod
18 def setUpClass(cls): 18 def setUpClass(cls):
19 # 新增一个进门批号单 19 # 新增一个进门批号单
20 - cls.aaa = db.mysql_selectOne('''  
21 - SELECT 20 + cls.aaa = db.mysql_selectOne('''SELECT
22 aua.account_id AS "账号id", 21 aua.account_id AS "账号id",
23 auc.card_no AS "园区卡号", 22 auc.card_no AS "园区卡号",
24 aua.customer_id AS "客户id", 23 aua.customer_id AS "客户id",
@@ -27,15 +26,13 @@ class test_l_createAndTrade(unittest.TestCase): @@ -27,15 +26,13 @@ class test_l_createAndTrade(unittest.TestCase):
27 aua.customer_certificate_number AS "客户身份证号码", 26 aua.customer_certificate_number AS "客户身份证号码",
28 aua.hold_contacts_phone AS "持卡人电话" 27 aua.hold_contacts_phone AS "持卡人电话"
29 FROM 28 FROM
30 - ( `dili_account`.`account_user_account` AS aua LEFT JOIN `dili_account`.`account_user_card` AS auc ON aua.account_id = auc.account_id )  
31 - LEFT JOIN `dili-customer`.`special_permissions` AS sp ON aua.customer_id = sp.customer_id 29 + `dili_account`.`account_user_account` AS aua LEFT JOIN `dili_account`.`account_user_card` AS auc ON aua.account_id = auc.account_id
32 WHERE 30 WHERE
33 - sp.customer_id = 141962 AND sp.market_id =15 31 + aua.customer_id = 141969
34 ORDER BY 32 ORDER BY
35 aua.account_id DESC 33 aua.account_id DESC
36 - LIMIT 1  
37 - ''')  
38 - body2 = r.body1.copy() 34 + LIMIT 1''')
  35 + body2 = r.body.copy()
39 body2["accountId"] = str(cls.aaa[0]) 36 body2["accountId"] = str(cls.aaa[0])
40 body2["cardNo"] = str(cls.aaa[1]) 37 body2["cardNo"] = str(cls.aaa[1])
41 body2["customerId"] = str(cls.aaa[2]) 38 body2["customerId"] = str(cls.aaa[2])
@@ -46,22 +43,25 @@ ORDER BY @@ -46,22 +43,25 @@ ORDER BY
46 body2["categoryId"] = 44 43 body2["categoryId"] = 44
47 body2["categoryCode"] = 754107 44 body2["categoryCode"] = 754107
48 body2["categoryName"] = "葡萄" 45 body2["categoryName"] = "葡萄"
49 - re = hg.post(url = r.url, headers = r.header, json = body2) 46 + print("批次号数据1", cls.aaa)
  47 + print("批次号数据",body2)
  48 + re = hg.post(url = r.url, headers = r.header, json = body2,proxies = my.proxies)
50 "获取批号" 49 "获取批号"
51 print("获取批号结果:",re.json()) 50 print("获取批号结果:",re.json())
52 cls.batch = re.json()["data"]["batchCode"] 51 cls.batch = re.json()["data"]["batchCode"]
53 return cls.batch 52 return cls.batch
54 53
  54 +
55 @unittest.case_mark(my.mark()) 55 @unittest.case_mark(my.mark())
56 def test_l_createAndTrade_01(self): 56 def test_l_createAndTrade_01(self):
57 "普通客户创建订单" 57 "普通客户创建订单"
58 body = lcat.body.copy() 58 body = lcat.body.copy()
59 body["orderItemList"][0]["batchCode"] = self.batch 59 body["orderItemList"][0]["batchCode"] = self.batch
60 print("创建订单body",body) 60 print("创建订单body",body)
61 - re1 = hg.post(url = lcat.url, headers = lcat.header, json = body) 61 + re1 = hg.post(url = lcat.url, headers = lcat.header, json = body,proxies = my.proxies)
62 print(re1.json()) 62 print(re1.json())
63 self.assertEqual(re1.status_code, 200) 63 self.assertEqual(re1.status_code, 200)
64 - self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) 64 + # self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", ""))
65 @classmethod 65 @classmethod
66 def tearDownClass(cls): 66 def tearDownClass(cls):
67 pass 67 pass
testcase/hg/tradingOrder/test_listFixedPaid.py 0 → 100644
  1 +import unittest
  2 +from commons import common as com
  3 +from commons.MySession import my,hg
  4 +from commons.api.hg.transaction.listFixedPaid import listFixedPaid
  5 +
  6 +lfp =listFixedPaid()
  7 +
  8 +
  9 +
  10 +class test_listFixedPaid(unittest.TestCase):
  11 + "大客户交易订单查询"
  12 +
  13 + @unittest.case_mark(my.mark())
  14 + def test_listFixedPaid_01(self):
  15 + "大客户交易订单查询"
  16 + re = hg.post(url = lfp.url,headers = lfp.header,json = lfp.body,proxies = hg.myproxies)
  17 + print(re.json())
  18 + self.assertEqual(re.status_code, 200)
  19 + self.assertTrue("'操作成功'" in str(re.json()).replace(" ",""))
  20 +
  21 +
  22 +if __name__ == '__main__':
  23 + unittest.main()