Commit 22191275ee6818c486fcf8d99e9e1700f4258142
1 parent
b28f806a
创建大客户订单
Showing
3 changed files
with
157 additions
and
2 deletions
commons/api/hg/transaction/l_createAndTrade.py
0 → 100644
1 | +# -*- coding: utf-8 -*- | |
2 | +""" | |
3 | +@Time : 2021/9/9 18:24 | |
4 | +@Auth : wlm | |
5 | +@File :l_createAndTrade.py | |
6 | +@IDE :PyCharm | |
7 | +""" | |
8 | +""" | |
9 | +普通客户模式——新增交易单 | |
10 | +""" | |
11 | + | |
12 | +from commons import common as com | |
13 | +from commons.MySession import hg | |
14 | +class l_createAndTrade(): | |
15 | + | |
16 | + def __init__(self): | |
17 | + self.url = "http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade" | |
18 | + self.header = { | |
19 | + "UAP_accessToken":"demo", | |
20 | + "UAP_refreshToken":"demo", | |
21 | + "Content-Type":"application/json;charset=utf-8", | |
22 | + "Host":"test.gateway.diligrp.com:8285" | |
23 | + } | |
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 | + { | |
57 | + "type":1, | |
58 | + "chargeItemId":521, | |
59 | + "chargeItemName":"买家手续费", | |
60 | + "amount":1122 | |
61 | + }, | |
62 | + { | |
63 | + "type":2, | |
64 | + "chargeItemId":522, | |
65 | + "chargeItemName":"卖家手续费", | |
66 | + "amount":610 | |
67 | + }, | |
68 | + { | |
69 | + "type":2, | |
70 | + "chargeItemId":527, | |
71 | + "chargeItemName":"卖家仓储服务费", | |
72 | + "amount":522 | |
73 | + } | |
74 | + ] | |
75 | + } | |
76 | + ] | |
77 | +} | |
78 | + | |
79 | + | |
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) | |
0 | 85 | \ No newline at end of file | ... | ... |
testcase/hg/tradingOrder/test_createAndTrade.py
... | ... | @@ -55,7 +55,7 @@ ORDER BY |
55 | 55 | body2["categoryId"] = 44 |
56 | 56 | body2["categoryCode"] = 754107 |
57 | 57 | body2["categoryName"] = "葡萄" |
58 | - re = hg.post(url = r.url, headers = r.header, json = body2,proxies = hg.proxies) | |
58 | + re = hg.post(url = r.url, headers = r.header, json = body2) | |
59 | 59 | "获取批号" |
60 | 60 | print("获取批号结果:",re.json()) |
61 | 61 | cls.batch = re.json()["data"]["batchCode"] |
... | ... | @@ -67,7 +67,7 @@ ORDER BY |
67 | 67 | body = creat.body.copy() |
68 | 68 | body["orderItemList"][0]["batchCode"] = self.batch |
69 | 69 | print("创建订单body",body) |
70 | - re1 = hg.post(url = creat.url, headers = creat.header, json = body,proxies = hg.proxies) | |
70 | + re1 = hg.post(url = creat.url, headers = creat.header, json = body) | |
71 | 71 | print(re1.json()) |
72 | 72 | self.assertEqual(re1.status_code, 200) |
73 | 73 | self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) | ... | ... |
testcase/hg/tradingOrder/test_l_createAndTrade.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 import ConfigDB as db | |
6 | +from commons.api.hg.transaction.l_createAndTrade import l_createAndTrade | |
7 | +from commons.basic.registerRecord_save import registerRecord_save | |
8 | +lcat = l_createAndTrade() | |
9 | +r = registerRecord_save() | |
10 | + | |
11 | +""" | |
12 | +创建普通客户订单 | |
13 | +""" | |
14 | + | |
15 | +class test_l_createAndTrade(unittest.TestCase): | |
16 | + "创建普通客户订单" | |
17 | + @classmethod | |
18 | + def setUpClass(cls): | |
19 | + # 新增一个进门批号单 | |
20 | + cls.aaa = db.mysql_selectOne(''' | |
21 | + SELECT | |
22 | + aua.account_id AS "账号id", | |
23 | + auc.card_no AS "园区卡号", | |
24 | + aua.customer_id AS "客户id", | |
25 | + aua.customer_code AS "客户code", | |
26 | + aua.customer_name AS "客户姓名", | |
27 | + aua.customer_certificate_number AS "客户身份证号码", | |
28 | + aua.hold_contacts_phone AS "持卡人电话" | |
29 | +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 | |
32 | +WHERE | |
33 | + sp.customer_id = 141962 AND sp.market_id =15 | |
34 | +ORDER BY | |
35 | + aua.account_id DESC | |
36 | + LIMIT 1 | |
37 | + ''') | |
38 | + body2 = r.body1.copy() | |
39 | + body2["accountId"] = str(cls.aaa[0]) | |
40 | + body2["cardNo"] = str(cls.aaa[1]) | |
41 | + body2["customerId"] = str(cls.aaa[2]) | |
42 | + body2["customerCode"] = str(cls.aaa[3]) | |
43 | + body2["customerName"] = str(cls.aaa[4]) | |
44 | + body2["identityCardNo"] = str(cls.aaa[5]) | |
45 | + body2["mobilephoneNumber"] = str(cls.aaa[6]) | |
46 | + body2["categoryId"] = 44 | |
47 | + body2["categoryCode"] = 754107 | |
48 | + body2["categoryName"] = "葡萄" | |
49 | + re = hg.post(url = r.url, headers = r.header, json = body2) | |
50 | + "获取批号" | |
51 | + print("获取批号结果:",re.json()) | |
52 | + cls.batch = re.json()["data"]["batchCode"] | |
53 | + return cls.batch | |
54 | + | |
55 | + @unittest.case_mark(my.mark()) | |
56 | + def test_l_createAndTrade_01(self): | |
57 | + "普通客户创建订单" | |
58 | + body = lcat.body.copy() | |
59 | + body["orderItemList"][0]["batchCode"] = self.batch | |
60 | + print("创建订单body",body) | |
61 | + re1 = hg.post(url = lcat.url, headers = lcat.header, json = body) | |
62 | + print(re1.json()) | |
63 | + self.assertEqual(re1.status_code, 200) | |
64 | + self.assertTrue("'操作成功'" in str(re1.json()).replace(" ", "")) | |
65 | + @classmethod | |
66 | + def tearDownClass(cls): | |
67 | + pass | |
68 | + | |
69 | + | |
70 | +if __name__ == '__main__': | |
71 | + unittest.main() | ... | ... |