Commit 2528f8d399d6755e788425de4dc5e915c8b3d041

Authored by lixi
1 parent 7f4d4cfe

更新文件

commons/api/hg/BackCollection/__init__.py 0 → 100644
commons/api/hg/BackCollection/customer_getByKeyword.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +
  4 +from commons.MySession import hg
  5 +
  6 +class customer_getByKeyword():
  7 + "后台收款-收款时选择指定客户"
  8 + def __init__(self):
  9 + self.url = "http://test.gateway.diligrp.com:8285/customer-service/api/customer/getByKeyword?customerKeywords=拜登&characterType=buyer_character_type"
  10 + self.header = {
  11 + "UAP_accessToken" :".-.--",
  12 + "UAP_refreshToken" :".-.--",
  13 + "UAP_firmId" :"15",
  14 + "Content-Type": "application/json;charset=UTF-8"
  15 + }
  16 +
  17 +
  18 +
  19 +# tt = customer_getByKeyword()
  20 +# re = hg.post(url = tt.url,headers = tt.header,proxies=hg.myproxies)
  21 +# print(re.json())
... ...
commons/api/hg/BackCollection/tradingOrder_create.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +from commons.MySession import hg
  4 +
  5 +class tradingOrder_create():
  6 + "后台收款-创建交款单"
  7 + def __init__(self):
  8 + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/create"
  9 + self.header = {
  10 + "UAP_accessToken" :".-.--",
  11 + "UAP_refreshToken" :".-.--",
  12 + "Content-Type" :"application/json;charset=UTF-8"
  13 + }
  14 + self.body = {
  15 + "sellerId": 141995,
  16 + "sellerName": "拜登",
  17 + "sellerAccountId": 107791,
  18 + "sellerCardNo": "888810043394",
  19 + "buyerId": 0,
  20 + "buyerName": None,
  21 + "buyerAccountId": 0,
  22 + "buyerCardNo": None,
  23 + "posCode": "666",
  24 + "tradePassword": None,
  25 + "orderItemList": [{
  26 + "number": 1,
  27 + "batchCode": "2109000200",
  28 + "productId": 125,
  29 + "productCode": "374690",
  30 + "productName": "苹果",
  31 + "categoryId": 374690,
  32 + "weightType": 1,
  33 + "quantity": 1,
  34 + "pieceWeight": 1,
  35 + "grossWeight": 0,
  36 + "tareWeight": 0,
  37 + "weight": 1,
  38 + "price": 100,
  39 + "PriceStr": "1",
  40 + "amount": 100,
  41 + "amountStr": 1.0,
  42 + "originId": 510100,
  43 + "originName": "成都市",
  44 + "feeItemList": [{
  45 + "type": 1,
  46 + "chargeItemId": 521,
  47 + "chargeItemName": "买家手续费",
  48 + "amount": 550.0
  49 + }, {
  50 + "type": 2,
  51 + "chargeItemId": 522,
  52 + "chargeItemName": "卖家手续费",
  53 + "amount": 989.00
  54 + }, {
  55 + "type": 2,
  56 + "chargeItemId": 527,
  57 + "chargeItemName": "卖家仓储服务费",
  58 + "amount": 367.00
  59 + }]
  60 + }]
  61 + }
  62 +
  63 + #返回交款单的单号
  64 + self.sql="SELECT `code` FROM `trading_order_item` WHERE trading_order_id=373;"
  65 +
  66 +# tt = tradingOrder_create()
  67 +# re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies)
  68 +# print(re.json())
... ...
commons/api/hg/BackCollection/tradingOrder_getUnPaidByCode.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +
  4 +from commons.MySession import hg
  5 +
  6 +class tradingOrder_getUnPaidByCode():
  7 + "后台收款-查询交款单"
  8 + def __init__(self):
  9 + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/getUnPaidByCode/2109141500003"
  10 + self.header = {
  11 + "UAP_accessToken" :".-.--",
  12 + "UAP_refreshToken" :".-.--",
  13 + "UAP_firmId" :"15"
  14 + }
  15 +
  16 +
  17 +
  18 +# tt = tradingOrder_getUnPaidByCode()
  19 +# re = hg.get(url = tt.url,headers = tt.header,proxies=hg.myproxies)
  20 +# print(re.json())
... ...
commons/api/hg/BackCollection/tradingOrder_loadPrintData.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +from commons.MySession import hg
  4 +
  5 +class tradingOrder_loadPrintData():
  6 + "后台收款-交款单支付"
  7 + def __init__(self):
  8 + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/loadPrintData?id=398&type=3&reprint=False"
  9 + self.header = {
  10 + "UAP_accessToken" :".-.--" ,
  11 + "UAP_refreshToken" :".-.--",
  12 + "UAP_firmId" :"15"
  13 + }
  14 +
  15 + #返回交款单的单号
  16 + self.sql="SELECT `code` FROM `trading_order_item` WHERE trading_order_id=373;"
  17 +
  18 +# tt = tradingOrder_loadPrintData()
  19 +# re = hg.get(url = tt.url,headers = tt.header,proxies=hg.myproxies)
  20 +# print(re.json())
... ...
commons/api/hg/BackCollection/tradingOrder_pay.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +from commons.MySession import hg
  4 +
  5 +class tradingOrder_pay():
  6 + "后台收款-交款单支付"
  7 + def __init__(self):
  8 + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/pay"
  9 + self.header = {
  10 + "UAP_accessToken" :".-.--" ,
  11 + "UAP_refreshToken" :".-.--",
  12 + "UAP_firmId" :"15",
  13 + "Content-Type":"application/json;charset=UTF-8"
  14 + }
  15 + # 现金支付
  16 + self.body = {
  17 + "id": 393,
  18 + "buyerId": 141995,
  19 + "buyerName": "拜登",
  20 + "channelDetailList": [{
  21 + "collectionType": "现金",
  22 + "tradeChannel": 2,
  23 + "amountY": 6.5,
  24 + "amount": 650.0,
  25 + "remark": None
  26 + }]
  27 + }
  28 + #非现金的组合支付
  29 + self.body1={
  30 + "id": 419,
  31 + "buyerId": 141995,
  32 + "buyerName": "拜登",
  33 + "channelDetailList": [{
  34 + "collectionType": "支票",
  35 + "tradeChannel": 40,
  36 + "amountY": 3.0,
  37 + "amount": 300.0,
  38 + "remark": "12345678"
  39 + }, {
  40 + "collectionType": "POS",
  41 + "tradeChannel": 3,
  42 + "amountY": 2.5,
  43 + "amount": 250.0,
  44 + "remark": "888810043394"
  45 + }, {
  46 + "collectionType": "优惠",
  47 + "tradeChannel": 0,
  48 + "amountY": 1.0,
  49 + "amount": 100.0,
  50 + "remark": "杭果借款"
  51 + }]
  52 + }
  53 + #包含现金的组合支付
  54 + self.body2={
  55 + "id": 417,
  56 + "buyerId": 141995,
  57 + "buyerName": "拜登",
  58 + "channelDetailList": [{
  59 + "collectionType": "现金",
  60 + "tradeChannel": 2,
  61 + "amountY": 1.0,
  62 + "amount": 100.0,
  63 + "remark": None
  64 + }, {
  65 + "collectionType": "支票",
  66 + "tradeChannel": 40,
  67 + "amountY": 2.0,
  68 + "amount": 200.0,
  69 + "remark": "12345678"
  70 + }, {
  71 + "collectionType": "POS",
  72 + "tradeChannel": 3,
  73 + "amountY": 3.0,
  74 + "amount": 300.0,
  75 + "remark": "888810043394"
  76 + }, {
  77 + "collectionType": "优惠",
  78 + "tradeChannel": 0,
  79 + "amountY": 0.5,
  80 + "amount": 50.0,
  81 + "remark": "杭果借款"
  82 + }]
  83 + }
  84 +
  85 + #返回交款单的单号
  86 + self.sql="SELECT `code` FROM `trading_order_item` WHERE trading_order_id=373;"
  87 +
  88 +# tt = tradingOrder_pay()
  89 +# re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies)
  90 +# print(re.json())
... ...
commons/basic/createAndTrade.py
... ... @@ -8,7 +8,7 @@
8 8 """
9 9 大客户模式——新增交易单
10 10 """
11   -
  11 +from commons.basic.registerRecord_save import registerRecord_save
12 12 from commons.MySession import hg
13 13  
14 14 class createAndTrade():
... ... @@ -23,8 +23,19 @@ class createAndTrade():
23 23 self.body = {"sellerId":141992,"sellerName":"特朗普vip","sellerAccountId":107792,"sellerCardNo":"888810026785","buyerId":141995,"buyerName":"拜登","buyerAccountId":107791,"buyerCardNo":"888810043394","posCode":"666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000067","productId":125,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":1,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":1,"price":2000,"PriceStr":"20","amount":2000,"amountStr":20.0,"originId":510100,"originName":"成都市","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":550.0},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":989.00}]}]}
24 24 #普通客户body
25 25 self.body1={"sellerId":141995,"sellerName":"拜登","sellerAccountId":107791,"sellerCardNo":"888810043394","buyerId":141992,"buyerName":"特朗普vip","buyerAccountId":107792,"buyerCardNo":"888810026785","posCode":"666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000073","productId":125,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":1,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":1,"price":2000,"PriceStr":"20","amount":2000,"amountStr":20.0,"originId":510100,"originName":"成都市","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":550.0},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":989.00}]}]}
  26 + #大客户-有装卸费和其他费,pos机号已经改变
  27 + self.body2= {"sellerId":141992,"sellerName":"特朗普vip","sellerAccountId":107792,"sellerCardNo":"888810026785","buyerId":141995,"buyerName":"拜登","buyerAccountId":107791,"buyerCardNo":"888810043394","posCode":"111666","tradePassword":"111111","orderItemList":[{"number":0,"batchCode":"2109000522","productId":632,"productCode":"374690","productName":"苹果","categoryId":374690,"weightType":1,"quantity":50,"pieceWeight":1,"grossWeight":0,"tareWeight":0,"weight":50,"price":100,"PriceStr":"1","amount":5000,"amountStr":50.0,"originId":100000000,"originName":"安提瓜和巴布达","feeItemList":[{"type":1,"chargeItemId":521,"chargeItemName":"买家手续费","amount":1122.00},{"type":2,"chargeItemId":522,"chargeItemName":"卖家手续费","amount":356.00},{"type":2,"chargeItemId":527,"chargeItemName":"卖家仓储服务费","amount":522.00}]}]}
26 28  
27 29  
  30 +# dd=registerRecord_save()
28 31 # tt = createAndTrade()
29   -# re = hg.post(url = tt.url,json = tt.body,headers = tt.header,proxies=hg.myproxies)
30   -# print(re.json())
31 32 \ No newline at end of file
  33 +#
  34 +# #进门
  35 +# re1 = hg.post(url = dd.url,json = dd.body2,headers = dd.header,proxies=hg.myproxies)
  36 +# print(re1.json())
  37 +#
  38 +# #创建交易单
  39 +# tt.body2["orderItemList"][0]["batchCode"]=re1.json()["data"]["batchCode"]
  40 +# re2 = hg.post(url = tt.url,json = tt.body2,headers = tt.header,proxies=hg.myproxies)
  41 +# print(re2.json())
  42 +
... ...
commons/basic/registerRecord_save.py
... ... @@ -33,7 +33,7 @@ class registerRecord_save():
33 33 "id": 0,
34 34 "areaId": 274,
35 35 "areaName": "东区01",
36   - "quantity": 10,
  36 + "quantity": 100,
37 37 "productId": 374690,
38 38 "registerRecordId": 0,
39 39 "remark": None,
... ... @@ -104,9 +104,9 @@ class registerRecord_save():
104 104 "registerFeeDtoList": [],
105 105 "tradePassword": ""
106 106 }
107   -
108   -
  107 + #大客户有装卸10元和其他费2元
  108 + self.body2={"accountId":107792,"cardNo":"888810026785","customerId":141992,"customerCode":"00131694","customerName":"特朗普vip","fixedphoneNumber":None,"mobilephoneNumber":"16111111112","identityCardAddress":"","identityCardNo":"110101198001012390","identityCardType":"ID","registerDetailDtoList":[{"id":0,"areaId":274,"areaName":"东区01","quantity":1000,"productId":374690,"registerRecordId":0,"remark":None,"weight":1000,"weightType":0,"created":None,"createdById":0,"createdByName":None,"createdByDepartmentId":0,"createdByDepartmentName":None,"registerCertificateList":None,"product":None,"registerCertificateDtoList":None,"productDto":{"id":0,"originId":100000000,"originName":"安提瓜和巴布达","pieceWeight":1,"categoryId":374690,"categoryCode":"374690","categoryName":"苹果","created":None}}],"registerFeeDtoList":[{"id":0,"actualFee":200.0,"receivableFee":1300.0,"discountFee":1100.0,"registerRecordId":0,"payStatus":0,"chargeItemName":"其他收费","chargeType":1,"chargeItemId":518,"registerFeeType":999,"created":None,"createdById":0,"createdByName":None,"settleDate":None,"isBehalf":1,"registerLoadingFeeExtDto":None},{"id":0,"actualFee":1000.0,"receivableFee":1000.0,"discountFee":0.0,"registerRecordId":0,"payStatus":0,"chargeItemName":"装卸费","chargeType":0,"chargeItemId":531,"registerFeeType":1,"created":None,"createdById":0,"createdByName":None,"settleDate":None,"isBehalf":1,"registerLoadingFeeExtDto":{"loadingTeamId":54,"loadingTeam":"大江","loadingFee":850.0,"behalfLoadingFee":150.0}}],"tradePassword":""}
109 109  
110 110 # tt=registerRecord_save()
111   -# re=hg.post(url=tt.url,headers=tt.header,json=tt.body1,proxies=hg.myproxies)
  111 +# re=hg.post(url=tt.url,headers=tt.header,json=tt.body2,proxies=hg.myproxies)
112 112 # print(str(re.json()))
113 113 \ No newline at end of file
... ...
testcase/hg/BackCollection/__init__.py 0 → 100644
testcase/hg/BackCollection/test_BackCollection.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import unittest
  4 +from commons import common as com
  5 +from commons import ConfigDB as db
  6 +from commons.MySession import my,hg
  7 +from commons.api.hg.BackCollection.tradingOrder_create import tradingOrder_create
  8 +from commons.api.hg.BackCollection.tradingOrder_getUnPaidByCode import tradingOrder_getUnPaidByCode
  9 +from commons.api.hg.BackCollection.tradingOrder_pay import tradingOrder_pay
  10 +from commons.api.hg.BackCollection.tradingOrder_loadPrintData import tradingOrder_loadPrintData
  11 +from commons.basic.registerRecord_save import registerRecord_save
  12 +tc=tradingOrder_create()
  13 +tg=tradingOrder_getUnPaidByCode()
  14 +tp=tradingOrder_pay()
  15 +tl=tradingOrder_loadPrintData()
  16 +rs=registerRecord_save()
  17 +
  18 +
  19 +class test_BackCollection(unittest.TestCase):
  20 + "杭果市场-交易管理"
  21 +
  22 + @classmethod
  23 + def setUpClass(cls) :
  24 + #新增一个进门批号单
  25 + re=hg.post(url=rs.url,headers=rs.header,json=rs.body1)
  26 + #获取进门批号
  27 + cls.batch=re.json()["data"]["batchCode"]
  28 + # print("setup class",re.json())
  29 +
  30 + def setUp(self):
  31 + body=tc.body.copy()
  32 + body["orderItemList"][0]["batchCode"]=self.batch
  33 + #创建交款单
  34 + self.re=hg.post(url=tc.url,headers=tc.header,json=body)
  35 + #根据交款单的id查询交款单的code,self.re.json()["data"]为交款单的id
  36 + self.order_code=db.mysql_selectOne(tc.sql.replace("373",str(self.re.json()["data"])))[0]
  37 + # print("setup",self.order_code,self.re.json())
  38 +
  39 + @unittest.case_mark(my.mark())
  40 + def test_BackCollection_01_getUnPaidByCode(self):
  41 + "后台收款-查询交款单:输入合法交款单号,查询指定交款单"
  42 + #替换批次号
  43 + url=tg.url.replace("2109141500003",self.order_code[0:-1])
  44 + #请求
  45 + re=hg.get(url=url,headers=tg.header)
  46 + print(re.json())
  47 + self.assertTrue(self.order_code in str(re.json()).replace(" ",""))
  48 +
  49 +
  50 + @unittest.skipDepend(depend="test_BackCollection_01_search")
  51 + @unittest.case_mark(my.mark())
  52 + def test_BackCollection_02_pay(self):
  53 + "后台收款-交款单支付:应收金额=实收金额,且仅现金收款"
  54 + #修改查询的值
  55 + body=tp.body.copy()
  56 + body["id"] = self.re.json()["data"]
  57 + #请求
  58 + re=hg.post(url=tp.url,headers=tp.header,json=body)
  59 + print(re.json())
  60 + #断言
  61 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  62 +
  63 +
  64 + @unittest.skipDepend(depend="test_BackCollection_02_pay")
  65 + @unittest.case_mark(my.mark())
  66 + def test_BackCollection_03_loadPrintData(self):
  67 + "后台收款-打印接口:完成支付后返回打印信息"
  68 + #打印前先调用支付接口,支付成功后才能打印
  69 + body=tp.body.copy()
  70 + body["id"] = self.re.json()["data"]
  71 + hg.post(url=tp.url, headers=tp.header, json=body)
  72 + #支付完成后,测试打印信息接口。修改查询的id
  73 + url=tl.url.replace("398",str(self.re.json()["data"]))
  74 + re=hg.get(url=url,headers=tl.header)
  75 + print(re.json())
  76 + #断言
  77 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  78 + self.assertTrue("交款成交单" in str(re.json()).replace(" ",""))
  79 + self.assertTrue(self.order_code[0:-1] in str(re.json()).replace(" ",""))
  80 +
  81 +
  82 + @unittest.skipDepend(depend="test_BackCollection_02_pay")
  83 + @unittest.case_mark(my.mark())
  84 + def test_BackCollection_04_pay(self):
  85 + "后台收款-交款单组合支付:优惠,pos卡,支票一起的组合支付"
  86 + #修改查询的值
  87 + body=tp.body1.copy()
  88 + body["id"] = self.re.json()["data"]
  89 + #请求
  90 + re=hg.post(url=tp.url,headers=tp.header,json=body)
  91 + print(re.json())
  92 + #断言
  93 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  94 +
  95 + @unittest.skipDepend(depend="test_BackCollection_02_pay")
  96 + @unittest.case_mark(my.mark())
  97 + def test_BackCollection_05_pay(self):
  98 + "后台收款-交款单组合支付:现金,优惠,pos卡,支票一起的组合支付"
  99 + #修改查询的值
  100 + body=tp.body2.copy()
  101 + body["id"] = self.re.json()["data"]
  102 + #请求
  103 + re=hg.post(url=tp.url,headers=tp.header,json=body)
  104 + print(re.json())
  105 + #断言
  106 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  107 +
  108 +
  109 +
  110 +
  111 +if __name__ == "__main__":
  112 +
  113 + unittest.main(verbosity=2)
  114 + # com.run_one(test_generalCustomerLoan("test_generalCustomerLoan_01_save"))
... ...
testcase/hg/BackCollection/test_customer_getByKeyword.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import unittest
  4 +from commons import common as com
  5 +from commons.MySession import my,hg
  6 +from commons.api.hg.BackCollection.customer_getByKeyword import customer_getByKeyword
  7 +c=customer_getByKeyword()
  8 +from func_timeout import func_set_timeout
  9 +import time
  10 +import func_timeout
  11 +
  12 +class test_customer_getByKeyword(unittest.TestCase):
  13 + "杭果市场-交易管理-后台收款"
  14 +
  15 +
  16 + # @unittest.case_mark(my.mark())
  17 + # def test_customer_getByKeyword_01(self):
  18 + # "交易管理-后台收款:在客户信息页面输入正确的客户名称并查询"
  19 + # #请求
  20 + # re=hg.post(url=c.url,headers=c.header)
  21 + # print(re.json())
  22 + # self.assertTrue("'success':True" in str(re.json()).replace(" ",""))
  23 + # self.assertTrue("拜登" in str(re.json()).replace(" ",""))
  24 +
  25 + @func_set_timeout(1)
  26 + def test1(self):
  27 + time.sleep(3)
  28 +
  29 +
  30 + @func_set_timeout(1)
  31 + def test2(self):
  32 + time.sleep(3)
  33 +
  34 +if __name__ == "__main__":
  35 +
  36 + unittest.main(verbosity=2)
  37 + # com.run_one(test_generalCustomerLoan("test_generalCustomerLoan_01_save"))
... ...
testcase/hg/loan_generalCustomer/test_generalCustomerLoan.py
... ... @@ -35,7 +35,7 @@ class test_generalCustomerLoan(unittest.TestCase):
35 35 body=c.body1.copy()
36 36 body["orderItemList"][0]["batchCode"]=cls.batch
37 37 re1=hg.post(url=c.url,headers=c.header,json=body)
38   -
  38 + print(re1.json())
39 39  
40 40 @unittest.case_mark(my.mark())
41 41 def test_generalCustomerLoan_01_save(self):
... ... @@ -101,9 +101,12 @@ class test_generalCustomerLoan(unittest.TestCase):
101 101 self.assertEqual(re.status_code, 200)
102 102 self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
103 103  
104   -
  104 + def test_demo_1(self):
  105 + "列表-执行:执行一个未执行的借款单"
  106 + # 查询批次号对应id
  107 + print(123)
105 108  
106 109 if __name__ == "__main__":
107 110  
108   - unittest.main(verbosity=2)
109   - # com.run_one(test_generalCustomerLoan("test_generalCustomerLoan_01_save"))
  111 + # unittest.main(verbosity=2)
  112 + com.run_one(test_generalCustomerLoan("test_demo_1"))
... ...