Commit f7fa6f9ba028b3d5ee5a771321a89599cafa5e95

Authored by lixi
1 parent eec2ab68

更新demo

Too many changes to show.

To preserve performance only 34 of 86 files are displayed.

commons/BasicTmp.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +
  4 +import os
  5 +import sys,time
  6 +import json
  7 +from commons import common as com
  8 +from commons.MySession import sy1
  9 +
  10 +class get_basic_data(object):
  11 + url_listCarType = "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCarType"
  12 + url_cusCategory= "http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree"
  13 + url_userApi= "http://test.gateway.diligrp.com:8285/dili-uap/userApi/listByExample.api"
  14 + url_prove_type= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid?pid=prove_type"
  15 + url_tradeType= "http://test.gateway.diligrp.com:8285/assets-service/api/tradeType/query"
  16 + url_goods_tag= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/listCodeByPid?pid=goods_tag"
  17 + url_dep= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/dep?keyword="
  18 + url_address= "http://test.gateway.diligrp.com:8285/jmsf-web/api/jmsf/query/address"
  19 +
  20 + header = {
  21 + "UAP_accessToken": "demo",
  22 + "UAP_refreshToken": "demo",
  23 + "UAP_firmId": "9",
  24 + "Content-Type": "application/json",
  25 + "Content-Length": "23"}
  26 +
  27 + body_listCarType = {"businessCode":"jmsf"}
  28 + body_cusCategory = {"marketId":9,"state":1}
  29 + body_userApi = {"firmCode":"sy","departmentId":58,"keyword":""}
  30 + body_tradeType = {"pageNum":100,"pageSize":100,"marketId":9}
  31 + body_address = {"province":"四川省","city":"成都市","area":None}
  32 +
  33 + def __init__(self,market):
  34 + self.market=market
  35 + self.url_listCarType = get_basic_data.url_listCarType.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  36 + self.url_cusCategory = get_basic_data.url_cusCategory.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  37 + self.url_userApi = get_basic_data.url_userApi.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  38 + self.url_prove_type = get_basic_data.url_prove_type.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  39 + self.url_tradeType = get_basic_data.url_tradeType.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  40 + self.url_goods_tag = get_basic_data.url_goods_tag.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  41 + self.url_dep = get_basic_data.url_dep.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  42 + self.url_address = get_basic_data.url_address.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  43 + self.header = get_basic_data.header
  44 + self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"]
  45 + self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"]
  46 + self.header["UAP_firmId"] = self.market.cookies["UAP_firmId"]
  47 +
  48 + def car_list(self):
  49 + "车型"
  50 + h=self.header.copy()
  51 + re = self.market.post(url=self.url_listCarType, headers=h,json=self.body_listCarType)
  52 + # print(re.json())
  53 + return re.json()
  54 +
  55 + def cusCategory(self):
  56 + "商品"
  57 + h=self.header.copy()
  58 + re = self.market.post(url=self.url_cusCategory, headers=h,json=self.body_cusCategory)
  59 + # print(re.json())
  60 + return re.json()
  61 +
  62 + def userApi(self):
  63 + "用户"
  64 + h=self.header.copy()
  65 + re = self.market.post(url=self.url_userApi, headers=h,json=self.body_userApi)
  66 + # print(re.json())
  67 + return re.json()
  68 +
  69 + def prove_type(self):
  70 + "证明类型"
  71 + h=self.header.copy()
  72 + h.pop("Content-Type")
  73 + h.pop("Content-Length")
  74 + re = self.market.get(url=self.url_prove_type, headers=h)
  75 + # print(re.json())
  76 + return re.json()
  77 +
  78 + def tradeType(self):
  79 + "交易类型"
  80 + h=self.header.copy()
  81 + re = self.market.post(url=self.url_tradeType, headers=h,json=self.body_tradeType)
  82 + # print(re.json())
  83 + return re.json()
  84 +
  85 + def goods_tag(self):
  86 + "货物标签"
  87 + h=self.header.copy()
  88 + h.pop("Content-Type")
  89 + h.pop("Content-Length")
  90 + re = self.market.get(url=self.url_goods_tag, headers=h)
  91 + # print(re.json())
  92 + return re.json()
  93 +
  94 + def dep(self):
  95 + "部门"
  96 + h=self.header.copy()
  97 + h.pop("Content-Type")
  98 + h.pop("Content-Length")
  99 + re = self.market.get(url=self.url_dep, headers=h)
  100 + # print(re.json())
  101 + return re.json()
  102 +
  103 + def address(self):
  104 + "产地"
  105 + h=self.header.copy()
  106 + re = self.market.post(url=self.url_address, headers=h,json=self.body_address)
  107 + # print(re.json())
  108 + return re.json()
  109 +
  110 + def write_file(self,market,name,json):
  111 + path = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
  112 + print(path)
  113 + self.file = path + "/config/api/" + market + "/" + name + ".py"
  114 + # 创建报告文件
  115 + self.fp = open(self.file, 'wb')
  116 + # 写文件
  117 + self.fp.write(str(json).encode("UTF-8"))
  118 + # 关闭文件
  119 + self.fp.close()
  120 +
  121 + def read_file(self):
  122 + self.fp = open(self.file, 'r')
  123 + print(self.fp.read().encode("utf-8"))
  124 +
  125 + def start(self,market):
  126 + self.write_file(market,"car_list","data={}".format(json.dumps(
  127 + self.car_list(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  128 + self.write_file(market,"cusCategory","data={}".format(json.dumps(
  129 + self.cusCategory(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  130 + self.write_file(market,"userApi","data={}".format(json.dumps(
  131 + self.userApi(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  132 + self.write_file(market,"prove_type","data={}".format(json.dumps(
  133 + self.prove_type(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  134 + self.write_file(market,"tradeType","data={}".format(json.dumps(
  135 + self.tradeType(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  136 + self.write_file(market,"goods_tag","data={}".format(json.dumps(
  137 + self.goods_tag(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  138 + self.write_file(market,"dep","data={}".format(json.dumps(
  139 + self.dep(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  140 + self.write_file(market,"address","data={}".format(json.dumps(
  141 + self.address(),indent=4,ensure_ascii=False).replace("null","None").replace("true","True")))
  142 +
  143 +a=get_basic_data(sy1)
  144 +a.start("sy")
  145 +
  146 +# a.write_file(a.car_list())
  147 +# a.write_file("sy","car_list",a.car_list())
  148 +# a.read_file()
  149 +# a.car_list()
  150 +# a.cusCategory()
  151 +# a.userApi()
  152 +# a.prove_type()
  153 +# a.tradeType()
  154 +# a.goods_tag()
  155 +# a.dep()
  156 +# a.address()
... ...
commons/api/entranceFeeBillList/__init__.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/13 10:14
  4 +# @Author : Ljq
  5 +# @File : __init__.py.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
... ...
commons/api/entranceFeeBillList/apiDemo.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/24 17:15
  4 +# @Author : Ljq
  5 +# @File : apiDemo.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
  11 +
  12 +import json,time,random
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.MySession import my,sessionHeb
  15 +from commons.basic import getLookupList as gLL
  16 +
  17 +global mk_sign
  18 +mk_sign = "haaab"
  19 +
  20 +def get_carType(host="",**kwargs):
  21 + """车型获取"""
  22 + url = host + "/jmsf-web/api/jmsf/query/listCarType"
  23 + data = {"businessCode":"jmsf"}
  24 + headers = dct.jsonCode()
  25 + data = dict(data, **kwargs)
  26 + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  27 + return res
  28 +
  29 +def get_listCategoryByCondition(host="",**kwargs):
  30 + """商品获取"""
  31 + url = host + "/assets-service/api/cusCategory/getTree"
  32 + # marketId = my.userInfo()[]
  33 + data = {"marketId":9,"state":1,"keyword":"蔬菜"}
  34 + headers = dct.jsonCode()
  35 + data = dict(data, **kwargs)
  36 + res = my.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  37 + return res
0 38 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/entranceFeeBillList.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/7/29 16:48
  4 +# @Author : Ljq
  5 +# @File : entranceFeeBillList.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.MySession import my
  16 +from bs4 import BeautifulSoup
  17 +import urllib.parse
  18 +
  19 +def listPage(session=None,host="",attrName="收费单号",attrValue=None,**kwargs):
  20 + """
  21 + 进门单列表查询接口
  22 + :param kwargs:
  23 + rows=10
  24 + page=1
  25 + sort=et.created
  26 + order=desc
  27 + attr=number
  28 + attrValue=11
  29 + carTypeId=53
  30 + categoryId=14152
  31 + productName=1
  32 + status=2
  33 + tradeTypeId=70
  34 + tareOperatorName=11
  35 + startTime=2021-07-29 00:00:00
  36 + endTime=2021-07-29 23:59:59
  37 + startPayTime=2021-07-29 00:00:00
  38 + endPayTime=2021-07-29 23:59:59
  39 + startRefundTime=2021-07-29 00:00:00
  40 + endRefundTime=2021-07-29 23:59:59
  41 + """
  42 +
  43 + headers = dct.urlCode()
  44 + url = host + "/entranceFeeBill/listPage.action"
  45 + attr_list = {"收费单号": "number", "车号": "likePlate", "商品": "goods", "收费员": "pay", "客户姓名": "cname",
  46 + "客户卡号": "ic", "手机号码": "phone"}
  47 + data = {"rows": "10", "page": "1", "sort": "et.created", "order": "desc",
  48 + "metadata[created]": {"provider": "datetimeProvider", "index": 10, "field": "created"},
  49 + "metadata[totalPrice]": {"provider": "moneyProvider", "index": 20, "field": "totalPrice"},
  50 + "metadata[paymentTime]": {"provider": "datetimeProvider", "index": 30, "field": "paymentTime"},
  51 + "metadata[type]": {"provider": "entranceFeeBillTypeProvider", "index": 40, "field": "type"},
  52 + "metadata[status]": {"provider": "entranceFeeBillStateProvider", "index": 50, "field": "status"},
  53 + "attr": "number"}
  54 +
  55 + # 查询类型处理
  56 + attr = attr_list[attrName]
  57 + data["attr"] = attr
  58 + if attrValue != None:
  59 + data["attrValue"]=attrValue
  60 +
  61 + # 参数替换与部分参数数据格式处理
  62 + data = dict(data, **kwargs)
  63 + data["metadata[created]"] = json.dumps(data["metadata[created]"])
  64 + data["metadata[totalPrice]"] = json.dumps(data["metadata[totalPrice]"])
  65 + data["metadata[paymentTime]"] = json.dumps(data["metadata[paymentTime]"])
  66 + data["metadata[type]"] = json.dumps(data["metadata[type]"])
  67 + data["metadata[status]"] = json.dumps(data["metadata[status]"])
  68 +
  69 + # 请求接口
  70 + res = session.useHeadersRequests(method="POST", url=url, data=data, headers=headers)
  71 + return res
  72 +
  73 +def get_OrderDetails(session=None,host="",orderId=None):
  74 + """获取订单详情"""
  75 + headers = dct.urlCode()
  76 + url = host + f"/entranceFeeBill/pay/{orderId}.action"
  77 + res = session.useHeadersRequests("get", url=url, headers=headers)
  78 + return res
  79 +
  80 +def get_orderUnfreeze(session=None,host="",orderId=None):
  81 + """获取订单详情"""
  82 + headers = dct.urlCode()
  83 + url = host + f"/entranceFeeBill/unfreeze/{orderId}.action"
  84 + res = session.useHeadersRequests("get", url=url, headers=headers)
  85 + return res
  86 +
  87 +def get_orderView(session=None,host="",orderId=None):
  88 + """获取订单详情"""
  89 + headers = dct.urlCode()
  90 + url = host + f"/entranceFeeBill/view/{orderId}.action"
  91 + res = session.useHeadersRequests("get", url=url, headers=headers)
  92 + return res
  93 +
  94 +def get_icCheck(session=None,host="",ic=None):
  95 + """进门缴费单详情页面刷卡刷卡"""
  96 + headers = dct.urlCode()
  97 + url = host + f"/api/jmsf/ajax/icCheck?ic={ic}"
  98 + res = session.useHeadersRequests("get", url=url,headers=headers)
  99 + return res
  100 +
  101 +def get_city(session=None,host="",name=None):
  102 + """进门缴费单缴费金额计算"""
  103 + headers = dct.urlCode()
  104 + url = host + f"/api/jmsf/ajax/city/?name={name}&query={name}"
  105 + res = session.useHeadersRequests("get", url=url,headers=headers)
  106 + return res
  107 +
  108 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  109 + """缴费金额获取
  110 + :params kwargs:
  111 + protocolId:
  112 + pwd:
  113 + clientRedirectTag:
  114 + viewType:pay
  115 + optType:${optType}
  116 + optUrl:
  117 + correctInfo:${correctInfo}
  118 + weightType:${weightType}
  119 + id:${orderId}
  120 + goodsId:${goodsId}
  121 + number:${number}
  122 + modified:${__time(yyyy-MM-dd HH:mm:ss,)}
  123 + status:${status}
  124 + source:${source}
  125 + updateFeeItems:
  126 + correctDiscount:${correctDiscount}
  127 + totalAmount:
  128 + customerId:0
  129 + fundAccount:
  130 + ic:
  131 + customerName:
  132 + customerPhone:
  133 + payway:刷卡
  134 + plate:${plate}
  135 + autocomplete-cartype:${carTypeCode}(${carTypeName})
  136 + carTypeName:${carTypeName}
  137 + carTypeCode:${carTypeCode}
  138 + carTypeId:${carTypeId}
  139 + carTypeWeight:${carTypeWeight}
  140 + storeTareWeight:
  141 + proveType:${proveTypeCode}
  142 + grossWeight:${grossWeight}
  143 + tareWeight:${tareWeight}
  144 + weight:${grossWeight}
  145 + goodsNum:
  146 + itemWeight:
  147 + productPrice:1
  148 + unitPrice:${unitPrice}
  149 + depName:${feeDepName}
  150 + calcDepId:${feeDepId}
  151 + regionName:
  152 + regionId:0
  153 + productName:${productName}
  154 + productId:${productId}
  155 + productArea:万州区
  156 + parentId:
  157 + levelType:
  158 + originId:${originId}
  159 + tradeTypeId:${tradeTypeId}
  160 + chargeTotalAmount:
  161 + chargeTotalAmountYuan:
  162 + freezeMoneySymbol:
  163 + comparisonFreezeAmount:
  164 + created:${created}
  165 + remark:
  166 + goodsTagIds:${goodsTagIds}
  167 + shareRatio:${shareRatio}
  168 + handlingTeam:
  169 + handlingRatio:
  170 + handActualAmount:
  171 + handManageAmount:
  172 + handCollectionAmount:
  173 + receivableAmount:
  174 + categoryName:${productName}
  175 + categoryId:${productId}
  176 + driverTel:
  177 + grossWeightDate:${grossWeightDate}
  178 + tareWeightDate:${tareWeightDate}
  179 + grossPathName:
  180 + grossPathId:
  181 + tarePathId:
  182 + goodsRemark:
  183 + inGreeterName:
  184 + inGreeterId:0
  185 + outGreeterId:
  186 + sumPrice:${sumPrice}
  187 + shipperName:
  188 + shipperId:
  189 + shipperPhone:
  190 + feeDepName:
  191 + calcFeeDepId:
  192 + """
  193 + url = host + "/calculate/index.action"
  194 + headers = dct.urlCode()
  195 +
  196 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "pay", "optType": "optType", "optUrl": "",
  197 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  198 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  199 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  200 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  201 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  202 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  203 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  204 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  205 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName", "calcDepId": "feeDepId",
  206 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  207 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  208 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  209 + "created": "created", "remark": "false", "goodsTagIds": "goodsTagIds", "shareRatio": "shareRatio",
  210 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  211 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  212 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  213 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  214 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  215 + "shipperName": "", "shipperId": "", "shipperPhone": "", "feeDepName": "", "calcFeeDepId": ""}
  216 + data["autocomplete-cartype"]=autocompletecartype
  217 + data = dict(data,**kwargs)
  218 + print("get_calculateRes",data)
  219 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  220 + return res
  221 +
  222 +def do_doPay(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  223 + """进门单缴费"""
  224 + url = host + "/entranceTrade/doPay.action"
  225 + headers = dct.urlCode()
  226 +
  227 + data = {"protocolId": "", "pwd": "{pwd}", "clientRedirectTag": "", "viewType": "pay", "optType": "{optType}",
  228 + "optUrl": "", "correctInfo": "{correctInfo}", "weightType": "{weightType}", "id": "{orderId}",
  229 + "goodsId": "{goodsId}", "number": "{number}", "modified": "{created}", "status": "{status}",
  230 + "source": "{source}", "updateFeeItems": "", "correctDiscount": "{correctDiscount}",
  231 + "totalAmount": "{totalMoney}", "customerId": "{customerId}", "fundAccount": "{accountId}", "ic": "{ic}",
  232 + "customerName": "{customerName}", "customerPhone": "{mobile}", "payway": "刷卡", "plate": "{plate}",
  233 + "autocomplete-cartype": "{carTypeCode}({carTypeName})", "carTypeName": "{carTypeName}",
  234 + "carTypeCode": "{carTypeCode}", "carTypeId": "{carTypeId}", "carTypeWeight": "{carTypeWeight}",
  235 + "storeTareWeight": "", "proveType": "{proveTypeCode}", "grossWeight": "{grossWeight}",
  236 + "tareWeight": "{tareWeight}", "weight": "{newWeight}", "goodsNum": "", "itemWeight": "",
  237 + "productPrice": "{productPrice}", "unitPrice": "{unitPrice}", "depName": "{feeDepName}",
  238 + "calcDepId": "{feeDepId}", "dep": "{feeDepId}", "regionName": "{regionName}", "regionId": "{regionId}",
  239 + "productName": "{productName}", "productId": "{productId}", "productArea": "{origin}", "parentId": "",
  240 + "levelType": "", "originId": "{originId}", "tradeTypeId": "{tradeTypeId}",
  241 + "chargeTotalAmount": "{totalMoney}", "chargeTotalAmountYuan": "{chargeTotalAmountYuan}",
  242 + "freezeMoneySymbol": "{chargeTotalAmountYuan}", "comparisonFreezeAmount": "{chargeTotalAmountYuan}",
  243 + "created": "{created}", "remark": "", "goodsTagIds": "", "marketFlag": "{firmCode}",
  244 + "totalMoney": "{totalMoney}", "receivable": "{receivable}", "collectionPrice": "{discountAmount}",
  245 + "discountAmount": "{discountAmount}", "handReceivableAmount": "{handReceivableAmount}",
  246 + "itemReceivableAmount": "{receivable}", "correctDiscount": "{correctDiscount}", "shareRatio": "0",
  247 + "handlingTeam": "", "handActualAmount": "0", "handManageAmount": "0", "handCollectionAmount": "0",
  248 + "receivableAmount": "{receivable}", "categoryName": "{productName}", "categoryId": "{productId}",
  249 + "driverTel": "", "grossWeightDate": "{grossWeightDate}", "tareWeightDate": "{tareWeightDate}",
  250 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "", "inGreeterName": "",
  251 + "inGreeterId": "0", "outGreeterId": "", "sumPrice": "{sumPrice}", "shipperName": "", "shipperId": "",
  252 + "shipperPhone": "", "feeDepName": "", "calcFeeDepId": "", "feeDepId": "","accountId":""}
  253 + data["autocomplete-cartype"] = autocompletecartype
  254 + data = dict(data, **kwargs)
  255 +
  256 + # 当模板没有配置货物标签时,参数不能传递货物标签所以需要删除
  257 + if kwargs["goodsTagIds"] =="":
  258 + del kwargs["goodsTagIds"]
  259 + del data["goodsTagIds"]
  260 +
  261 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  262 + print("================开始请求================")
  263 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  264 + return res
  265 +
  266 +
  267 +
  268 +def do_payOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111",
  269 + ic=888810032426):
  270 + a = listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  271 + print("listPage", a.json())
  272 + orderId = a.json()["rows"][0]["id"]
  273 + number = a.json()["rows"][0]["number"]
  274 + created = a.json()["rows"][0]["created"]
  275 + print(orderId)
  276 +
  277 + # # 订单详情获取
  278 + resOrderDetails = get_OrderDetails(session=session,host=host, orderId=orderId)
  279 +
  280 + # 正则取值
  281 + regionId = re.findall('<option value="(.*?)" bind-name="', resOrderDetails.text)[0]
  282 + regionName=re.findall('" bind-name="(.*?)" bind-index', resOrderDetails.text)[0]
  283 + print("regionName",regionName)
  284 +
  285 + # bs取值
  286 + orderDetailsList = BeautifulSoup(resOrderDetails.text, "html.parser").findAll("input")
  287 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  288 + print("orderDetailsDict",orderDetailsDict)
  289 + unitPrice = orderDetailsDict["unitPrice"]
  290 + goodsId = orderDetailsDict["goodsId"]
  291 + status = orderDetailsDict["status"]
  292 + source = orderDetailsDict["source"]
  293 + optType = orderDetailsDict["optType"]
  294 + correctInfo = orderDetailsDict["correctInfo"]
  295 + weightType = orderDetailsDict["weightType"]
  296 + correctDiscount = orderDetailsDict["correctDiscount"]
  297 +
  298 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  299 + # 货物标签特别判断
  300 + if "goodsTagIds" in orderDetailsDict.keys():
  301 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  302 + else:
  303 + goodsTagIds = ""
  304 +
  305 + sumPrice = orderDetailsDict["sumPrice"]
  306 + tradeTypeId = orderDetailsDict["tradeTypeId"]
  307 + shareRatio = orderDetailsDict["shareRatio"]
  308 + plate = orderDetailsDict["plate"]
  309 + carTypeName = orderDetailsDict["carTypeName"]
  310 + carTypeCode = orderDetailsDict["carTypeCode"]
  311 + carTypeId = orderDetailsDict["carTypeId"]
  312 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  313 + proveType = orderDetailsDict["proveType"]
  314 + grossWeight = orderDetailsDict["grossWeight"]
  315 + tareWeight = orderDetailsDict["tareWeight"]
  316 + depName = orderDetailsDict["depName"]
  317 + feeDepId = orderDetailsDict["calcDepId"]
  318 + productName = orderDetailsDict["productName"]
  319 + productId = orderDetailsDict["productId"]
  320 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  321 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  322 + weight = orderDetailsDict["weight"]
  323 + calcDepId = orderDetailsDict["calcDepId"]
  324 + categoryName = orderDetailsDict["categoryName"]
  325 + categoryId = orderDetailsDict["categoryId"]
  326 + inGreeterName = orderDetailsDict["inGreeterName"]
  327 + inGreeterId = orderDetailsDict["inGreeterId"]
  328 + productArea = orderDetailsDict["productArea"]
  329 + productPrice = orderDetailsDict["productPrice"]
  330 +
  331 +
  332 + # 用户信息获取
  333 + res = get_icCheck(session=session,host=host, ic=ic)
  334 + print(res.text)
  335 + customerId = res.json()["data"]["aInfo"]["customerId"]
  336 + customerName = res.json()["data"]["aInfo"]["customerName"]
  337 + accountId = res.json()["data"]["aInfo"]["accountId"]
  338 + mobile = res.json()["data"]["aInfo"]["mobile"]
  339 +
  340 + # 省市区获取
  341 + res = get_city(session=session,host=host, name="万州")
  342 + print('res.json()["suggestions"]',res.json()["suggestions"])
  343 + originId = res.json()["suggestions"][0]["id"]
  344 + parentId = res.json()["suggestions"][0]["parentId"]
  345 + productArea = res.json()["suggestions"][0]["value"]
  346 +
  347 + # # 获取缴费金额
  348 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  349 + print(autocompletecartype)
  350 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  351 +
  352 + print("categoryId",categoryId)
  353 +
  354 + # 获取缴费金额
  355 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  356 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  357 + status=status,
  358 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  359 + carTypeCode=carTypeCode,
  360 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  361 + grossWeight=grossWeight,
  362 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  363 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  364 + goodsTagIds=goodsTagIds,
  365 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  366 + grossWeightDate=grossWeightDate,
  367 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, calcDepId=calcDepId, weight=weight,
  368 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  369 +
  370 + # 缴费信息
  371 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  372 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  373 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  374 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  375 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  376 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  377 +
  378 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  379 + soup = BeautifulSoup(res.text, "html.parser")
  380 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  381 + fee_int = 0
  382 + discount_amount = 0
  383 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  384 + c = tag.findAll("input")
  385 + for i in c:
  386 + if i.get("name") != None:
  387 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  388 + if i.get("type") == "text":
  389 + fee_int = fee_int + int(float(i.get("value")))
  390 + if "优惠" in i.get("value"):
  391 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  392 +
  393 + id = orderId
  394 + totalAmount = totalMoney
  395 + customerPhone = mobile
  396 + dep = feeDepId
  397 + chargeTotalAmount = totalMoney
  398 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  399 + freezeMoneySymbol = fee_int
  400 + comparisonFreezeAmount = fee_int
  401 + modified = created
  402 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  403 + marketFlag = firmCode
  404 + itemReceivableAmount = receivable
  405 + receivableAmount = receivable
  406 + tareWeightDate = tareWeightDate
  407 +
  408 + aa = do_doPay(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  409 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  410 + source=source,
  411 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  412 + fundAccount=accountId,
  413 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  414 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  415 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  416 + productPrice=productPrice,
  417 + unitPrice=unitPrice, depName=depName, calcDepId=calcDepId, dep=dep, regionName=regionName,
  418 + regionId=regionId,
  419 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  420 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  421 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  422 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  423 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  424 + handReceivableAmount=handReceivableAmount,
  425 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  426 + categoryName=categoryName,inGreeterName=inGreeterName,inGreeterId=inGreeterId,
  427 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  428 + sumPrice=sumPrice,parentId=parentId,
  429 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  430 +
  431 + print(aa.text)
  432 + return aa
  433 +# do_payOrder(attrValue="202108100900016")
0 434 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoAmend.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/13 15:22
  4 +# @Author : Ljq
  5 +# @File : operationDoAmend.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.api.entranceFeeBillList import entranceFeeBillList as eFBL
  16 +from bs4 import BeautifulSoup
  17 +import urllib.parse
  18 +
  19 +
  20 +def get_orderAmend(session=None,host="",orderId=None):
  21 + """获取订单详情"""
  22 + headers = dct.urlCode()
  23 + url = host + f"/entranceFeeBill/amend/{orderId}.action"
  24 + res = session.useHeadersRequests("get", url=url, headers=headers)
  25 + return res
  26 +
  27 +
  28 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  29 + """缴费金额获取
  30 + :params kwargs:
  31 + protocolId:
  32 + pwd:
  33 + clientRedirectTag:
  34 + viewType:pay
  35 + optType:${optType}
  36 + optUrl:
  37 + correctInfo:${correctInfo}
  38 + weightType:${weightType}
  39 + id:${orderId}
  40 + goodsId:${goodsId}
  41 + number:${number}
  42 + modified:${__time(yyyy-MM-dd HH:mm:ss,)}
  43 + status:${status}
  44 + source:${source}
  45 + updateFeeItems:
  46 + correctDiscount:${correctDiscount}
  47 + totalAmount:
  48 + customerId:0
  49 + fundAccount:
  50 + ic:
  51 + customerName:
  52 + customerPhone:
  53 + payway:刷卡
  54 + plate:${plate}
  55 + autocomplete-cartype:${carTypeCode}(${carTypeName})
  56 + carTypeName:${carTypeName}
  57 + carTypeCode:${carTypeCode}
  58 + carTypeId:${carTypeId}
  59 + carTypeWeight:${carTypeWeight}
  60 + storeTareWeight:
  61 + proveType:${proveTypeCode}
  62 + grossWeight:${grossWeight}
  63 + tareWeight:${tareWeight}
  64 + weight:${grossWeight}
  65 + goodsNum:
  66 + itemWeight:
  67 + productPrice:1
  68 + unitPrice:${unitPrice}
  69 + depName:${feeDepName}
  70 + calcDepId:${feeDepId}
  71 + regionName:
  72 + regionId:0
  73 + productName:${productName}
  74 + productId:${productId}
  75 + productArea:万州区
  76 + parentId:
  77 + levelType:
  78 + originId:${originId}
  79 + tradeTypeId:${tradeTypeId}
  80 + chargeTotalAmount:
  81 + chargeTotalAmountYuan:
  82 + freezeMoneySymbol:
  83 + comparisonFreezeAmount:
  84 + created:${created}
  85 + remark:
  86 + goodsTagIds:${goodsTagIds}
  87 + shareRatio:${shareRatio}
  88 + handlingTeam:
  89 + handlingRatio:
  90 + handActualAmount:
  91 + handManageAmount:
  92 + handCollectionAmount:
  93 + receivableAmount:
  94 + categoryName:${productName}
  95 + categoryId:${productId}
  96 + driverTel:
  97 + grossWeightDate:${grossWeightDate}
  98 + tareWeightDate:${tareWeightDate}
  99 + grossPathName:
  100 + grossPathId:
  101 + tarePathId:
  102 + goodsRemark:
  103 + inGreeterName:
  104 + inGreeterId:0
  105 + outGreeterId:
  106 + sumPrice:${sumPrice}
  107 + shipperName:
  108 + shipperId:
  109 + shipperPhone:
  110 + feeDepName:
  111 + """
  112 + url = host + "/calculate/index.action"
  113 + headers = dct.urlCode()
  114 +
  115 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "amend", "optType": "optType", "optUrl": "",
  116 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  117 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  118 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  119 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  120 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  121 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  122 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  123 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  124 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName",
  125 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  126 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  127 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  128 + "created": "created", "remark": "false", "goodsTagIds": "goodsTagIds", "shareRatio": "shareRatio",
  129 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  130 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  131 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  132 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  133 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  134 + "shipperName": "", "shipperId": "", "shipperPhone": ""}
  135 + data["autocomplete-cartype"]=autocompletecartype
  136 + data = dict(data,**kwargs)
  137 + print("get_calculateRes",data)
  138 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  139 + return res
  140 +
  141 +def do_doAmend(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  142 + """进门单缴费"""
  143 + url = host + "/entranceFeeBill/doAmend.action"
  144 + headers = dct.urlCode()
  145 +
  146 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "amend", "optType": "0", "optUrl": "",
  147 + "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  148 + "modified": "2021-08-11+17:32:50", "status": "3", "source": "1", "updateFeeItems": "2",
  149 + "correctDiscount": "1", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  150 + "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  151 + "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  152 + "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  153 + "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  154 + "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "72",
  155 + "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  156 + "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  157 + "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "备注", "goodsTagIds": "1900",
  158 + "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  159 + "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  160 + "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  161 + "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  162 + "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  163 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  164 + "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  165 + "shipperPhone": "", "feeDepId": "0","backSkinTwo":"-1"}
  166 +
  167 + data["autocomplete-cartype"] = autocompletecartype
  168 + data = dict(data, **kwargs)
  169 +
  170 + # 当模板没有配置货物标签时,参数不能传递货物标签所以需要删除
  171 + if kwargs["goodsTagIds"] =="":
  172 + del data["goodsTagIds"]
  173 +
  174 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  175 + print("================开始请求================")
  176 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  177 + return res
  178 +
  179 +def do_amendOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111",
  180 + ic=888810032426):
  181 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  182 + print("listPage", a.json())
  183 + orderId = a.json()["rows"][0]["id"]
  184 + number = a.json()["rows"][0]["number"]
  185 + created = a.json()["rows"][0]["created"]
  186 + print(orderId)
  187 +
  188 + # # 订单详情获取
  189 + resOrderDetails = get_orderAmend(session=session,host=host, orderId=orderId)
  190 + # print(resOrderDetails.text)
  191 +
  192 + # bs取值
  193 + orderDetailsSoup = BeautifulSoup(resOrderDetails.text, "html.parser")
  194 +
  195 + # 第一种取值
  196 + orderDetailsList = orderDetailsSoup.findAll("input")
  197 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  198 + # print("orderDetailsDict",orderDetailsDict)
  199 + unitPrice = orderDetailsDict["unitPrice"]
  200 + regionId=orderDetailsDict["regionId"]
  201 + goodsId = orderDetailsDict["goodsId"]
  202 + status = orderDetailsDict["status"]
  203 + source = orderDetailsDict["source"]
  204 + optType = orderDetailsDict["optType"]
  205 + correctInfo = orderDetailsDict["correctInfo"]
  206 + weightType = orderDetailsDict["weightType"]
  207 + correctDiscount = orderDetailsDict["correctDiscount"]
  208 +
  209 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  210 + # 货物标签特别判断
  211 + if "goodsTagIds" in orderDetailsDict.keys():
  212 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  213 + else:
  214 + goodsTagIds = ""
  215 +
  216 + sumPrice = orderDetailsDict["sumPrice"]
  217 + shareRatio = orderDetailsDict["shareRatio"]
  218 + plate = orderDetailsDict["plate"]
  219 + carTypeName = orderDetailsDict["carTypeName"]
  220 + carTypeCode = orderDetailsDict["carTypeCode"]
  221 + carTypeId = orderDetailsDict["carTypeId"]
  222 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  223 + grossWeight = orderDetailsDict["grossWeight"]
  224 + tareWeight = orderDetailsDict["tareWeight"]
  225 + depName = orderDetailsDict["depName"]
  226 + dep = orderDetailsDict["dep"]
  227 + productName = orderDetailsDict["productName"]
  228 + productId = orderDetailsDict["productId"]
  229 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  230 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  231 + weight = orderDetailsDict["weight"]
  232 + categoryName = orderDetailsDict["categoryName"]
  233 + categoryId = orderDetailsDict["categoryId"]
  234 + inGreeterName = orderDetailsDict["inGreeterName"]
  235 + inGreeterId = orderDetailsDict["inGreeterId"]
  236 + productArea = orderDetailsDict["productArea"]
  237 + productPrice = orderDetailsDict["productPrice"]
  238 +
  239 + # 第二种取法
  240 + selectList = orderDetailsSoup.findAll("select")
  241 + selectDict = {i.get("name"): [a.get("value"),a.text] for i in selectList for a in i.findAll("option")}
  242 + print("selectDict",selectDict)
  243 + tradeTypeId = selectDict["tradeTypeId"][0]
  244 + proveType = selectDict["proveType"][0]
  245 + proveTypeName = selectDict["proveType"][1]
  246 +
  247 + # # 用户信息获取
  248 + # res = eFBL.get_icCheck(host=host, ic=ic)
  249 + # print(res.text)
  250 + # customerId = res.json()["data"]["aInfo"]["customerId"]
  251 + # customerName = res.json()["data"]["aInfo"]["customerName"]
  252 + # accountId = res.json()["data"]["aInfo"]["accountId"]
  253 + # mobile = res.json()["data"]["aInfo"]["mobile"]
  254 + customerId = orderDetailsDict["customerId"]
  255 + customerName = orderDetailsDict["customerName"]
  256 + accountId = orderDetailsDict["accountId"]
  257 + mobile = orderDetailsDict["customerPhone"]
  258 + ic = orderDetailsDict["ic"]
  259 +
  260 + # 省市区获取
  261 + res = eFBL.get_city(session=session,host=host, name="万州")
  262 + # print(res.text)
  263 + originId = res.json()["suggestions"][0]["id"]
  264 +
  265 + # # 获取缴费金额
  266 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  267 + # print(autocompletecartype)
  268 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  269 +
  270 + # 获取缴费金额
  271 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  272 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  273 + status=status,
  274 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  275 + carTypeCode=carTypeCode,
  276 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  277 + grossWeight=grossWeight,
  278 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  279 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  280 + goodsTagIds=goodsTagIds,
  281 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  282 + grossWeightDate=grossWeightDate,proveTypeName=proveTypeName,
  283 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, weight=weight,
  284 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  285 +
  286 + # 缴费信息
  287 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  288 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  289 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  290 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  291 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  292 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  293 +
  294 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  295 + soup = BeautifulSoup(res.text, "html.parser")
  296 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  297 + fee_int = 0
  298 + discount_amount = 0
  299 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  300 + c = tag.findAll("input")
  301 + for i in c:
  302 + if i.get("name") != None:
  303 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  304 + if i.get("type") == "text":
  305 + fee_int = fee_int + int(float(i.get("value")))
  306 + if "优惠" in i.get("value"):
  307 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  308 +
  309 + id = orderId
  310 + totalAmount = totalMoney
  311 + customerPhone = mobile
  312 + chargeTotalAmount = totalMoney
  313 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  314 + freezeMoneySymbol = fee_int
  315 + comparisonFreezeAmount = fee_int
  316 + modified = created
  317 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  318 + marketFlag = firmCode
  319 + itemReceivableAmount = receivable
  320 + receivableAmount = receivable
  321 + tareWeightDate = tareWeightDate
  322 +
  323 + aa = do_doAmend(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  324 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  325 + source=source,
  326 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  327 + fundAccount=accountId,
  328 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  329 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  330 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  331 + productPrice=productPrice,
  332 + unitPrice=unitPrice, depName=depName, dep=dep,
  333 + regionId=regionId,
  334 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  335 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  336 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  337 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  338 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  339 + handReceivableAmount=handReceivableAmount,
  340 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  341 + categoryName=categoryName,
  342 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  343 + sumPrice=sumPrice,
  344 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  345 +
  346 + print(aa.text)
  347 + return aa
  348 +
  349 +# time.sleep(5)
  350 +# do_amendOrder(attrValue="202108130900123")
0 351 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoCorrect.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/13 14:21
  4 +# @Author : Ljq
  5 +# @File : operationDoCorrect.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.api.entranceFeeBillList import entranceFeeBillList as eFBL
  16 +from bs4 import BeautifulSoup
  17 +import urllib.parse
  18 +
  19 +
  20 +def get_orderCorrect(session=None,host="",orderId=None):
  21 + """获取订单详情"""
  22 + headers = dct.urlCode()
  23 + url = host + f"/entranceFeeBill/correct/{orderId}.action"
  24 + res = session.useHeadersRequests("get", url=url, headers=headers)
  25 + return res
  26 +
  27 +
  28 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  29 + """缴费金额获取
  30 + :params kwargs:
  31 + protocolId:
  32 + pwd:
  33 + clientRedirectTag:
  34 + viewType:pay
  35 + optType:${optType}
  36 + optUrl:
  37 + correctInfo:${correctInfo}
  38 + weightType:${weightType}
  39 + id:${orderId}
  40 + goodsId:${goodsId}
  41 + number:${number}
  42 + modified:${__time(yyyy-MM-dd HH:mm:ss,)}
  43 + status:${status}
  44 + source:${source}
  45 + updateFeeItems:
  46 + correctDiscount:${correctDiscount}
  47 + totalAmount:
  48 + customerId:0
  49 + fundAccount:
  50 + ic:
  51 + customerName:
  52 + customerPhone:
  53 + payway:刷卡
  54 + plate:${plate}
  55 + autocomplete-cartype:${carTypeCode}(${carTypeName})
  56 + carTypeName:${carTypeName}
  57 + carTypeCode:${carTypeCode}
  58 + carTypeId:${carTypeId}
  59 + carTypeWeight:${carTypeWeight}
  60 + storeTareWeight:
  61 + proveType:${proveTypeCode}
  62 + grossWeight:${grossWeight}
  63 + tareWeight:${tareWeight}
  64 + weight:${grossWeight}
  65 + goodsNum:
  66 + itemWeight:
  67 + productPrice:1
  68 + unitPrice:${unitPrice}
  69 + depName:${feeDepName}
  70 + calcDepId:${feeDepId}
  71 + regionName:
  72 + regionId:0
  73 + productName:${productName}
  74 + productId:${productId}
  75 + productArea:万州区
  76 + parentId:
  77 + levelType:
  78 + originId:${originId}
  79 + tradeTypeId:${tradeTypeId}
  80 + chargeTotalAmount:
  81 + chargeTotalAmountYuan:
  82 + freezeMoneySymbol:
  83 + comparisonFreezeAmount:
  84 + created:${created}
  85 + remark:
  86 + goodsTagIds:${goodsTagIds}
  87 + shareRatio:${shareRatio}
  88 + handlingTeam:
  89 + handlingRatio:
  90 + handActualAmount:
  91 + handManageAmount:
  92 + handCollectionAmount:
  93 + receivableAmount:
  94 + categoryName:${productName}
  95 + categoryId:${productId}
  96 + driverTel:
  97 + grossWeightDate:${grossWeightDate}
  98 + tareWeightDate:${tareWeightDate}
  99 + grossPathName:
  100 + grossPathId:
  101 + tarePathId:
  102 + goodsRemark:
  103 + inGreeterName:
  104 + inGreeterId:0
  105 + outGreeterId:
  106 + sumPrice:${sumPrice}
  107 + shipperName:
  108 + shipperId:
  109 + shipperPhone:
  110 + feeDepName:
  111 + """
  112 + url = host + "/calculate/index.action"
  113 + headers = dct.urlCode()
  114 +
  115 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "correct", "optType": "optType", "optUrl": "",
  116 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  117 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  118 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  119 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  120 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  121 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  122 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  123 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  124 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName",
  125 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  126 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  127 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  128 + "created": "created", "remark": "false", "goodsTagIds": "goodsTagIds", "shareRatio": "shareRatio",
  129 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  130 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  131 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  132 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  133 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  134 + "shipperName": "", "shipperId": "", "shipperPhone": ""}
  135 + data["autocomplete-cartype"]=autocompletecartype
  136 + data = dict(data,**kwargs)
  137 + print("get_calculateRes",data)
  138 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  139 + return res
  140 +
  141 +def do_doCorrect(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  142 + """进门单缴费"""
  143 + url = host + "/entranceFeeBill/doCorrect.action"
  144 + headers = dct.urlCode()
  145 +
  146 + # data = {"protocolId":"","pwd":"","clientRedirectTag":"","viewType":"unfreeze","optType":"0","optUrl":"","correctInfo":"1","weightType":"1","id":"3968","goodsId":"3982","number":"202108110900122","modified":"2021-08-11+17:32:50","status":"3","source":"1","updateFeeItems":"","correctDiscount":"1","totalAmount":"800","customerId":"389","fundAccount":"105847","accountId":"105847","ic":"888810032426","customerName":"长歌买家省内啊啊啊嘿","customerPhone":"18011501258","payway":"刷卡","plate":"川B00001","autocomplete-cartype":"003(板车)","carTypeName":"板车","carTypeCode":"003","carTypeId":"53","carTypeWeight":"333","storeTareWeight":"","proveType":"1621","grossWeight":"353","tareWeight":"333","weight":"20","goodsNum":"","itemWeight":"","productPrice":"1.00000","unitPrice":"100.0","depName":"水果部","dep":"58","regionId":"72","productName":"雪莲果","productId":"14158","productArea":"重庆,重庆市,万州区","originId":"500101","tradeTypeId":"71","chargeTotalAmount":"800","chargeTotalAmountYuan":"8","freezeMoneySymbol":"13","comparisonFreezeAmount":"13","created":"2021-08-11+17:32:27","remark":"备注","goodsTagIds":"1900","shareRatio":"0","handlingTeam":"","steveTeamId":"","handlingRatio":"","handActualAmount":"0","handManageAmount":"0","handCollectionAmount":"0","marketFlag":"sy","totalMoney":"800","receivable":"1300","collectionPrice":"0","discountAmount":"500","handReceivableAmount":"0","itemReceivableAmount":"1300","receivableAmount":"1300","categoryName":"水果","categoryId":"14436","driverTel":"","grossWeightDate":"2021-08-11+17:32:27","tareWeightDate":"2021-08-11+17:32:27","grossPathName":"","grossPathId":"","tarePathId":"","goodsRemark":"备注","inGreeterName":"通用测试","inGreeterId":"274","outGreeterId":"","sumPrice":"2000","shipperName":"","shipperId":"","shipperPhone":"","feeDepId":"0"}
  147 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "correct", "optType": "0", "optUrl": "",
  148 + "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  149 + "modified": "2021-08-11+17:32:50", "status": "2", "source": "1", "updateFeeItems": "2",
  150 + "correctDiscount": "2", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  151 + "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  152 + "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  153 + "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  154 + "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  155 + "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "72",
  156 + "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  157 + "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  158 + "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "备注", "goodsTagIds": "1900",
  159 + "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  160 + "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  161 + "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  162 + "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  163 + "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  164 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  165 + "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  166 + "shipperPhone": "", "feeDepId": "0","bskinWithGoods":"-1","outGreeterName":"","proveTypeName":"",
  167 + "feeDepName":"","calcFeeDepId":"","backSkinTwo":"-1"}
  168 +
  169 + data["autocomplete-cartype"] = autocompletecartype
  170 + data = dict(data, **kwargs)
  171 +
  172 + # 当模板没有配置货物标签时,参数不能传递货物标签所以需要删除
  173 + if kwargs["goodsTagIds"] =="":
  174 + del data["goodsTagIds"]
  175 +
  176 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  177 + print("================开始请求================")
  178 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  179 + return res
  180 +
  181 +def do_correctOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111"):
  182 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  183 + print("listPage", a.json())
  184 + orderId = a.json()["rows"][0]["id"]
  185 + number = a.json()["rows"][0]["number"]
  186 + created = a.json()["rows"][0]["created"]
  187 + print(orderId)
  188 +
  189 + # # 订单详情获取
  190 + resOrderDetails = get_orderCorrect(session=session,host=host, orderId=orderId)
  191 + # print(resOrderDetails.text)
  192 +
  193 + # bs取值
  194 + orderDetailsSoup = BeautifulSoup(resOrderDetails.text, "html.parser")
  195 +
  196 +
  197 + # 第一种取法
  198 + orderDetailsList = orderDetailsSoup.findAll("input")
  199 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  200 + print("orderDetailsDict",orderDetailsDict)
  201 + unitPrice = orderDetailsDict["unitPrice"]
  202 + regionId=orderDetailsDict["regionId"]
  203 + goodsId = orderDetailsDict["goodsId"]
  204 + status = orderDetailsDict["status"]
  205 + source = orderDetailsDict["source"]
  206 + optType = orderDetailsDict["optType"]
  207 + correctInfo = orderDetailsDict["correctInfo"]
  208 + weightType = orderDetailsDict["weightType"]
  209 + correctDiscount = "2"
  210 +
  211 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  212 + # 货物标签特别判断
  213 + if "goodsTagIds" in orderDetailsDict.keys():
  214 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  215 + else:
  216 + goodsTagIds = ""
  217 +
  218 + sumPrice = orderDetailsDict["sumPrice"]
  219 + shareRatio = orderDetailsDict["shareRatio"]
  220 + plate = orderDetailsDict["plate"]
  221 + carTypeName = orderDetailsDict["carTypeName"]
  222 + carTypeCode = orderDetailsDict["carTypeCode"]
  223 + carTypeId = orderDetailsDict["carTypeId"]
  224 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  225 +
  226 + grossWeight = orderDetailsDict["grossWeight"]
  227 + tareWeight = orderDetailsDict["tareWeight"]
  228 + depName = orderDetailsDict["depName"]
  229 + dep = orderDetailsDict["dep"]
  230 + productName = orderDetailsDict["productName"]
  231 + productId = orderDetailsDict["productId"]
  232 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  233 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  234 + weight = orderDetailsDict["weight"]
  235 + categoryName = orderDetailsDict["categoryName"]
  236 + categoryId = orderDetailsDict["categoryId"]
  237 + inGreeterName = orderDetailsDict["inGreeterName"]
  238 + inGreeterId = orderDetailsDict["inGreeterId"]
  239 + productArea = orderDetailsDict["productArea"]
  240 + productPrice = orderDetailsDict["productPrice"]
  241 + # proveTypeName = orderDetailsDict["proveTypeName"]
  242 +
  243 + # 第二种取法
  244 + selectList = orderDetailsSoup.findAll("select")
  245 + selectDict = {i.get("name"): [a.get("value"),a.text] for i in selectList for a in i.findAll("option")}
  246 + print("selectDict",selectDict)
  247 + tradeTypeId = selectDict["tradeTypeId"][0]
  248 + proveType = selectDict["proveType"][0]
  249 + proveTypeName = selectDict["proveType"][1]
  250 +
  251 +
  252 +
  253 + # 用户信息获取
  254 + # res = eFBL.get_icCheck(session=session,host=host, ic=ic)
  255 + # print(res.text)
  256 + # customerId = res.json()["data"]["aInfo"]["customerId"]
  257 + # customerName = res.json()["data"]["aInfo"]["customerName"]
  258 + # accountId = res.json()["data"]["aInfo"]["accountId"]
  259 + # mobile = res.json()["data"]["aInfo"]["mobile"]
  260 + customerId = orderDetailsDict["customerId"]
  261 + customerName = orderDetailsDict["customerName"]
  262 + accountId = orderDetailsDict["accountId"]
  263 + mobile = orderDetailsDict["customerPhone"]
  264 + ic = orderDetailsDict["ic"]
  265 +
  266 + # 省市区获取
  267 + res = eFBL.get_city(session=session,host=host, name="万州")
  268 + print(res.text)
  269 + originId = res.json()["suggestions"][0]["id"]
  270 +
  271 + # # 获取缴费金额
  272 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  273 + print(autocompletecartype)
  274 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  275 +
  276 + # 获取缴费金额
  277 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  278 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  279 + status=status,
  280 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  281 + carTypeCode=carTypeCode,
  282 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  283 + grossWeight=grossWeight,
  284 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  285 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  286 + goodsTagIds=goodsTagIds,
  287 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  288 + grossWeightDate=grossWeightDate,
  289 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, weight=weight,
  290 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  291 +
  292 + # 缴费信息
  293 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  294 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  295 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  296 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  297 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  298 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  299 +
  300 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  301 + soup = BeautifulSoup(res.text, "html.parser")
  302 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  303 + fee_int = 0
  304 + discount_amount = 0
  305 + cNum = 0
  306 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  307 + c = tag.findAll("input")
  308 + for i in c:
  309 + if i.get("name") != None:
  310 + if i.get("type") == "text":
  311 + cNum = random.randint(10,100)
  312 + fee_int = fee_int + int(float(i.get("value")))+cNum
  313 + if "billItemsDic" == i.get("name"):
  314 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  315 + billItems = i.get("value")
  316 + if "{" not in billItems and i.get("name") != "billItemCheckIds" and i.get("name")!="billItemDicCheckIds":
  317 + billItems = str(int(float(billItems)) + cNum)
  318 + elif "{" in billItems and i.get("name")!="billItemsDic":
  319 + billItemsDict = json.loads(billItems)
  320 + billItemsDict["receivable"] = int(billItemsDict["receivable"]) + cNum * 100
  321 + billItems = json.dumps(billItemsDict,ensure_ascii=False,separators=(',', ':'))
  322 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote_plus(billItems)
  323 +
  324 + id = orderId
  325 + # totalAmount = totalMoney
  326 + totalAmount = int(fee_int)*100-int(discount_amount)*100
  327 + # print("totalAmount",totalAmount)
  328 + customerPhone = mobile
  329 + # chargeTotalAmount = totalMoney
  330 + chargeTotalAmount = totalAmount
  331 + # receivable
  332 + receivable = fee_int*100
  333 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  334 + freezeMoneySymbol = fee_int
  335 + comparisonFreezeAmount = fee_int
  336 + modified = created
  337 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  338 + marketFlag = firmCode
  339 + itemReceivableAmount = receivable
  340 + receivableAmount = receivable
  341 + tareWeightDate = tareWeightDate
  342 +
  343 + res = do_doCorrect(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  344 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  345 + source=source,
  346 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  347 + fundAccount=accountId,
  348 + accountId=accountId, ic="", customerName=customerName, customerPhone=customerPhone, plate=plate,
  349 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  350 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  351 + productPrice=productPrice,
  352 + unitPrice=unitPrice, depName=depName, dep=dep,
  353 + regionId=regionId,
  354 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  355 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  356 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  357 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  358 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  359 + handReceivableAmount=handReceivableAmount,
  360 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  361 + categoryName=categoryName,
  362 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  363 + sumPrice=sumPrice,proveTypeName=proveTypeName,
  364 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  365 +
  366 + print("res.text",res.text)
  367 + print("totalAmount",totalAmount)
  368 + return res,totalAmount
  369 +
  370 +# do_correctOrder(attrValue="202108160900001")
0 371 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoFreeze.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/24 13:40
  4 +# @Author : Ljq
  5 +# @File : operationDoFreeze.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.api.entranceFeeBillList import entranceFeeBillList as eFBL
  16 +from bs4 import BeautifulSoup
  17 +import urllib.parse
  18 +
  19 +def do_doFreeze(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  20 + """进门单缴费"""
  21 + url = host + "/entranceTrade/doFreeze.action"
  22 + headers = dct.urlCode()
  23 +
  24 + data = {"protocolId": "", "pwd": "{pwd}", "clientRedirectTag": "", "viewType": "pay", "optType": "{optType}",
  25 + "optUrl": "", "correctInfo": "{correctInfo}", "weightType": "{weightType}", "id": "{orderId}",
  26 + "goodsId": "{goodsId}", "number": "{number}", "modified": "{created}", "status": "{status}",
  27 + "source": "{source}", "updateFeeItems": "", "correctDiscount": "{correctDiscount}",
  28 + "totalAmount": "{totalMoney}", "customerId": "{customerId}", "fundAccount": "{accountId}", "ic": "{ic}",
  29 + "customerName": "{customerName}", "customerPhone": "{mobile}", "payway": "刷卡", "plate": "{plate}",
  30 + "autocomplete-cartype": "{carTypeCode}({carTypeName})", "carTypeName": "{carTypeName}",
  31 + "carTypeCode": "{carTypeCode}", "carTypeId": "{carTypeId}", "carTypeWeight": "{carTypeWeight}",
  32 + "storeTareWeight": "", "proveType": "{proveTypeCode}", "grossWeight": "{grossWeight}",
  33 + "tareWeight": "{tareWeight}", "weight": "{newWeight}", "goodsNum": "", "itemWeight": "",
  34 + "productPrice": "{productPrice}", "unitPrice": "{unitPrice}", "depName": "{feeDepName}",
  35 + "calcDepId": "{feeDepId}", "dep": "{feeDepId}", "regionName": "{regionName}", "regionId": "{regionId}",
  36 + "productName": "{productName}", "productId": "{productId}", "productArea": "{origin}", "parentId": "",
  37 + "levelType": "", "originId": "{originId}", "tradeTypeId": "{tradeTypeId}",
  38 + "chargeTotalAmount": "{totalMoney}", "chargeTotalAmountYuan": "{chargeTotalAmountYuan}",
  39 + "freezeMoneySymbol": "{chargeTotalAmountYuan}", "comparisonFreezeAmount": "{chargeTotalAmountYuan}",
  40 + "created": "{created}", "remark": "", "goodsTagIds": "{goodsTagIds}", "marketFlag": "{firmCode}",
  41 + "totalMoney": "{totalMoney}", "receivable": "{receivable}", "collectionPrice": "{discountAmount}",
  42 + "discountAmount": "{discountAmount}", "handReceivableAmount": "{handReceivableAmount}",
  43 + "itemReceivableAmount": "{receivable}", "correctDiscount": "{correctDiscount}", "shareRatio": "0",
  44 + "handlingTeam": "", "handActualAmount": "0", "handManageAmount": "0", "handCollectionAmount": "0",
  45 + "receivableAmount": "{receivable}", "categoryName": "{productName}", "categoryId": "{productId}",
  46 + "driverTel": "", "grossWeightDate": "{grossWeightDate}", "tareWeightDate": "{tareWeightDate}",
  47 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "", "inGreeterName": "",
  48 + "inGreeterId": "0", "outGreeterId": "", "sumPrice": "{sumPrice}", "shipperName": "", "shipperId": "",
  49 + "shipperPhone": "", "feeDepName": "", "calcFeeDepId": "", "feeDepId": "","accountId":""}
  50 + data["autocomplete-cartype"] = autocompletecartype
  51 + data = dict(data, **kwargs)
  52 +
  53 + # 当模板没有配置货物标签时,参数不能传递货物标签所以需要删除
  54 + if kwargs["goodsTagIds"] =="":
  55 + del data["goodsTagIds"]
  56 +
  57 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  58 + print("================开始请求================")
  59 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  60 + return res
  61 +
  62 +def do_freezeOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111",
  63 + ic=888810032426):
  64 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  65 + print("listPage", a.json())
  66 + orderId = a.json()["rows"][0]["id"]
  67 + number = a.json()["rows"][0]["number"]
  68 + created = a.json()["rows"][0]["created"]
  69 + print(orderId)
  70 +
  71 + # # 订单详情获取
  72 + resOrderDetails = eFBL.get_OrderDetails(session=session,host=host, orderId=orderId)
  73 +
  74 + # 正则取值
  75 + regionId = re.findall('<option value="(.*?)" bind-name="', resOrderDetails.text)[0]
  76 + regionName=re.findall('" bind-name="(.*?)" bind-index', resOrderDetails.text)[0]
  77 +
  78 + # bs取值
  79 + orderDetailsList = BeautifulSoup(resOrderDetails.text, "html.parser").findAll("input")
  80 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  81 + print("orderDetailsDict",orderDetailsDict)
  82 + unitPrice = orderDetailsDict["unitPrice"]
  83 + goodsId = orderDetailsDict["goodsId"]
  84 + status = orderDetailsDict["status"]
  85 + source = orderDetailsDict["source"]
  86 + optType = orderDetailsDict["optType"]
  87 + correctInfo = orderDetailsDict["correctInfo"]
  88 + weightType = orderDetailsDict["weightType"]
  89 + correctDiscount = orderDetailsDict["correctDiscount"]
  90 +
  91 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  92 + # 货物标签特别判断
  93 + if "goodsTagIds" in orderDetailsDict.keys():
  94 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  95 + else:
  96 + goodsTagIds = ""
  97 +
  98 + sumPrice = orderDetailsDict["sumPrice"]
  99 + tradeTypeId = orderDetailsDict["tradeTypeId"]
  100 + shareRatio = orderDetailsDict["shareRatio"]
  101 + # regionName=orderDetailsDict["regionName"]
  102 + plate = orderDetailsDict["plate"]
  103 + carTypeName = orderDetailsDict["carTypeName"]
  104 + carTypeCode = orderDetailsDict["carTypeCode"]
  105 + carTypeId = orderDetailsDict["carTypeId"]
  106 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  107 + proveType = orderDetailsDict["proveType"]
  108 + grossWeight = orderDetailsDict["grossWeight"]
  109 + tareWeight = orderDetailsDict["tareWeight"]
  110 + depName = orderDetailsDict["depName"]
  111 + feeDepId = orderDetailsDict["calcDepId"]
  112 + productName = orderDetailsDict["productName"]
  113 + productId = orderDetailsDict["productId"]
  114 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  115 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  116 + weight = orderDetailsDict["weight"]
  117 + calcDepId = orderDetailsDict["calcDepId"]
  118 + categoryName = orderDetailsDict["categoryName"]
  119 + categoryId = orderDetailsDict["categoryId"]
  120 + inGreeterName = orderDetailsDict["inGreeterName"]
  121 + inGreeterId = orderDetailsDict["inGreeterId"]
  122 + productArea = orderDetailsDict["productArea"]
  123 + productPrice = orderDetailsDict["productPrice"]
  124 +
  125 +
  126 + # 用户信息获取
  127 + res = eFBL.get_icCheck(session=session,host=host, ic=ic)
  128 + print(res.text)
  129 + customerId = res.json()["data"]["aInfo"]["customerId"]
  130 + customerName = res.json()["data"]["aInfo"]["customerName"]
  131 + accountId = res.json()["data"]["aInfo"]["accountId"]
  132 + mobile = res.json()["data"]["aInfo"]["mobile"]
  133 +
  134 + # 省市区获取
  135 + res = eFBL.get_city(session=session,host=host, name="万州")
  136 + print(res.text)
  137 + originId = res.json()["suggestions"][0]["id"]
  138 + parentId = res.json()["suggestions"][0]["parentId"]
  139 + productArea = res.json()["suggestions"][0]["value"]
  140 +
  141 + # # 获取缴费金额
  142 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  143 + print(autocompletecartype)
  144 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  145 +
  146 + # 获取缴费金额
  147 + res = eFBL.get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  148 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  149 + status=status,
  150 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  151 + carTypeCode=carTypeCode,
  152 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  153 + grossWeight=grossWeight,
  154 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  155 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  156 + goodsTagIds=goodsTagIds,regionName=regionName,
  157 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  158 + grossWeightDate=grossWeightDate,
  159 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, calcDepId=calcDepId, weight=weight,
  160 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  161 +
  162 + # 缴费信息
  163 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  164 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  165 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  166 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  167 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  168 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  169 +
  170 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  171 + soup = BeautifulSoup(res.text, "html.parser")
  172 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  173 + fee_int = 0
  174 + discount_amount = 0
  175 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  176 + c = tag.findAll("input")
  177 + for i in c:
  178 + if i.get("name") != None:
  179 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  180 + if i.get("type") == "text":
  181 + fee_int = fee_int + int(float(i.get("value")))
  182 + if "优惠" in i.get("value"):
  183 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  184 +
  185 + id = orderId
  186 + totalAmount = totalMoney
  187 + customerPhone = mobile
  188 + dep = feeDepId
  189 + chargeTotalAmount = totalMoney
  190 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  191 + freezeMoneySymbol = fee_int
  192 + comparisonFreezeAmount = fee_int
  193 + modified = created
  194 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  195 + marketFlag = firmCode
  196 + itemReceivableAmount = receivable
  197 + receivableAmount = receivable
  198 + tareWeightDate = tareWeightDate
  199 +
  200 + aa = do_doFreeze(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  201 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  202 + source=source,
  203 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  204 + fundAccount=accountId,
  205 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  206 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  207 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  208 + productPrice=productPrice,
  209 + unitPrice=unitPrice, depName=depName, calcDepId=calcDepId, dep=dep, regionName=regionName,
  210 + regionId=regionId,
  211 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  212 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  213 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  214 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  215 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  216 + handReceivableAmount=handReceivableAmount,
  217 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  218 + categoryName=categoryName,
  219 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  220 + sumPrice=sumPrice,parentId=parentId,
  221 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  222 +
  223 + print(aa.text)
  224 + return aa
0 225 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoInvalid.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/13 10:52
  4 +# @Author : Ljq
  5 +# @File : operationDoInvalid.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.MySession import my
  16 +from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
  17 +from bs4 import BeautifulSoup
  18 +import urllib.parse
  19 +
  20 +
  21 +def get_orderInvalid(session=None,host="",orderId=None):
  22 + """获取订单详情"""
  23 + headers = dct.urlCode()
  24 + url = host + f"/entranceFeeBill/invalid/{orderId}.action"
  25 + res = session.useHeadersRequests("get", url=url, headers=headers)
  26 + return res
  27 +
  28 +
  29 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  30 + """缴费金额获取
  31 + :params kwargs:
  32 + protocolId:
  33 + pwd:
  34 + clientRedirectTag:
  35 + viewType:pay
  36 + optType:${optType}
  37 + optUrl:
  38 + correctInfo:${correctInfo}
  39 + weightType:${weightType}
  40 + id:${orderId}
  41 + goodsId:${goodsId}
  42 + number:${number}
  43 + modified:${__time(yyyy-MM-dd HH:mm:ss,)}
  44 + status:${status}
  45 + source:${source}
  46 + updateFeeItems:
  47 + correctDiscount:${correctDiscount}
  48 + totalAmount:
  49 + customerId:0
  50 + fundAccount:
  51 + ic:
  52 + customerName:
  53 + customerPhone:
  54 + payway:刷卡
  55 + plate:${plate}
  56 + autocomplete-cartype:${carTypeCode}(${carTypeName})
  57 + carTypeName:${carTypeName}
  58 + carTypeCode:${carTypeCode}
  59 + carTypeId:${carTypeId}
  60 + carTypeWeight:${carTypeWeight}
  61 + storeTareWeight:
  62 + proveType:${proveTypeCode}
  63 + grossWeight:${grossWeight}
  64 + tareWeight:${tareWeight}
  65 + weight:${grossWeight}
  66 + goodsNum:
  67 + itemWeight:
  68 + productPrice:1
  69 + unitPrice:${unitPrice}
  70 + depName:${feeDepName}
  71 + calcDepId:${feeDepId}
  72 + regionName:
  73 + regionId:0
  74 + productName:${productName}
  75 + productId:${productId}
  76 + productArea:万州区
  77 + parentId:
  78 + levelType:
  79 + originId:${originId}
  80 + tradeTypeId:${tradeTypeId}
  81 + chargeTotalAmount:
  82 + chargeTotalAmountYuan:
  83 + freezeMoneySymbol:
  84 + comparisonFreezeAmount:
  85 + created:${created}
  86 + remark:
  87 + goodsTagIds:${goodsTagIds}
  88 + shareRatio:${shareRatio}
  89 + handlingTeam:
  90 + handlingRatio:
  91 + handActualAmount:
  92 + handManageAmount:
  93 + handCollectionAmount:
  94 + receivableAmount:
  95 + categoryName:${productName}
  96 + categoryId:${productId}
  97 + driverTel:
  98 + grossWeightDate:${grossWeightDate}
  99 + tareWeightDate:${tareWeightDate}
  100 + grossPathName:
  101 + grossPathId:
  102 + tarePathId:
  103 + goodsRemark:
  104 + inGreeterName:
  105 + inGreeterId:0
  106 + outGreeterId:
  107 + sumPrice:${sumPrice}
  108 + shipperName:
  109 + shipperId:
  110 + shipperPhone:
  111 + feeDepName:
  112 + """
  113 + url = host + "/calculate/index.action"
  114 + headers = dct.urlCode()
  115 +
  116 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "invalid", "optType": "optType", "optUrl": "",
  117 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  118 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  119 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  120 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  121 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  122 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  123 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  124 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  125 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName",
  126 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  127 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  128 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  129 + "created": "created", "remark": "false", "goodsTagIds": "goodsTagIds", "shareRatio": "shareRatio",
  130 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  131 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  132 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  133 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  134 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  135 + "shipperName": "", "shipperId": "", "shipperPhone": ""}
  136 + data["autocomplete-cartype"]=autocompletecartype
  137 + data = dict(data,**kwargs)
  138 + print("get_calculateRes",data)
  139 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  140 + return res
  141 +
  142 +def do_doInvalid(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  143 + """进门单缴费"""
  144 + url = host + "/entranceFeeBill/doInvalid.action"
  145 + headers = dct.urlCode()
  146 +
  147 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "invalid", "optType": "0", "optUrl": "",
  148 + "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  149 + "modified": "2021-08-11+17:32:50", "status": "3", "source": "1", "updateFeeItems": "",
  150 + "correctDiscount": "1", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  151 + "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  152 + "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  153 + "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  154 + "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  155 + "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "72",
  156 + "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  157 + "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  158 + "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "备注", "goodsTagIds": "1900",
  159 + "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  160 + "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  161 + "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  162 + "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  163 + "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  164 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  165 + "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  166 + "shipperPhone": "", "feeDepId": "0"}
  167 +
  168 + data["autocomplete-cartype"] = autocompletecartype
  169 + data = dict(data, **kwargs)
  170 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  171 + print("================开始请求================")
  172 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  173 + return res
  174 +
  175 +def do_invalidOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111",
  176 + ic=888810032426):
  177 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  178 + print("listPage", a.json())
  179 + orderId = a.json()["rows"][0]["id"]
  180 + number = a.json()["rows"][0]["number"]
  181 + created = a.json()["rows"][0]["created"]
  182 + print(orderId)
  183 +
  184 + # # 订单详情获取
  185 + resOrderDetails = get_orderInvalid(session=session,host=host, orderId=orderId)
  186 +
  187 + # bs取值
  188 + orderDetailsList = BeautifulSoup(resOrderDetails.text, "html.parser").findAll("input")
  189 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  190 + print("orderDetailsDict",orderDetailsDict)
  191 + unitPrice = orderDetailsDict["unitPrice"]
  192 + regionId=orderDetailsDict["regionId"]
  193 + goodsId = orderDetailsDict["goodsId"]
  194 + status = orderDetailsDict["status"]
  195 + source = orderDetailsDict["source"]
  196 + optType = orderDetailsDict["optType"]
  197 + correctInfo = orderDetailsDict["correctInfo"]
  198 + weightType = orderDetailsDict["weightType"]
  199 + correctDiscount = orderDetailsDict["correctDiscount"]
  200 +
  201 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  202 + # 货物标签特别判断
  203 + if "goodsTagIds" in orderDetailsDict.keys():
  204 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  205 + else:
  206 + goodsTagIds = ""
  207 +
  208 + sumPrice = orderDetailsDict["sumPrice"]
  209 + tradeTypeId = orderDetailsDict["tradeTypeId"]
  210 + shareRatio = orderDetailsDict["shareRatio"]
  211 + plate = orderDetailsDict["plate"]
  212 + carTypeName = orderDetailsDict["carTypeName"]
  213 + carTypeCode = orderDetailsDict["carTypeCode"]
  214 + carTypeId = orderDetailsDict["carTypeId"]
  215 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  216 + proveType = orderDetailsDict["proveType"]
  217 + grossWeight = orderDetailsDict["grossWeight"]
  218 + tareWeight = orderDetailsDict["tareWeight"]
  219 + depName = orderDetailsDict["depName"]
  220 + dep = orderDetailsDict["dep"]
  221 + productName = orderDetailsDict["productName"]
  222 + productId = orderDetailsDict["productId"]
  223 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  224 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  225 + weight = orderDetailsDict["weight"]
  226 + categoryName = orderDetailsDict["categoryName"]
  227 + categoryId = orderDetailsDict["categoryId"]
  228 + inGreeterName = orderDetailsDict["inGreeterName"]
  229 + inGreeterId = orderDetailsDict["inGreeterId"]
  230 + productArea = orderDetailsDict["productArea"]
  231 + productPrice = orderDetailsDict["productPrice"]
  232 +
  233 +
  234 + # # 用户信息获取
  235 + # res = eFBL.get_icCheck(session=session,host=host, ic=ic)
  236 + # print(res.text)
  237 + # customerId = res.json()["data"]["aInfo"]["customerId"]
  238 + # customerName = res.json()["data"]["aInfo"]["customerName"]
  239 + # accountId = res.json()["data"]["aInfo"]["accountId"]
  240 + # mobile = res.json()["data"]["aInfo"]["mobile"]
  241 + customerId = orderDetailsDict["customerId"]
  242 + customerName = orderDetailsDict["customerName"]
  243 + accountId = orderDetailsDict["accountId"]
  244 + mobile = orderDetailsDict["customerPhone"]
  245 + ic = orderDetailsDict["ic"]
  246 +
  247 + # 省市区获取
  248 + res = eFBL.get_city(session=session,host=host, name="万州")
  249 + print(res.text)
  250 + originId = res.json()["suggestions"][0]["id"]
  251 +
  252 + # # 获取缴费金额
  253 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  254 + print(autocompletecartype)
  255 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  256 +
  257 + # 获取缴费金额
  258 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  259 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  260 + status=status,
  261 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  262 + carTypeCode=carTypeCode,
  263 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  264 + grossWeight=grossWeight,
  265 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  266 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  267 + goodsTagIds=goodsTagIds,
  268 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  269 + grossWeightDate=grossWeightDate,
  270 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, weight=weight,
  271 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  272 +
  273 + # 缴费信息
  274 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  275 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  276 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  277 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  278 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  279 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  280 +
  281 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  282 + soup = BeautifulSoup(res.text, "html.parser")
  283 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  284 + fee_int = 0
  285 + discount_amount = 0
  286 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  287 + c = tag.findAll("input")
  288 + for i in c:
  289 + if i.get("name") != None:
  290 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  291 + if i.get("type") == "text":
  292 + fee_int = fee_int + int(float(i.get("value")))
  293 + if "优惠" in i.get("value"):
  294 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  295 +
  296 + id = orderId
  297 + totalAmount = totalMoney
  298 + customerPhone = mobile
  299 + chargeTotalAmount = totalMoney
  300 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  301 + freezeMoneySymbol = fee_int
  302 + comparisonFreezeAmount = fee_int
  303 + modified = created
  304 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  305 + marketFlag = firmCode
  306 + itemReceivableAmount = receivable
  307 + receivableAmount = receivable
  308 + tareWeightDate = tareWeightDate
  309 +
  310 + aa = do_doInvalid(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  311 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  312 + source=source,
  313 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  314 + fundAccount=accountId,
  315 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  316 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  317 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  318 + productPrice=productPrice,
  319 + unitPrice=unitPrice, depName=depName, dep=dep,
  320 + regionId=regionId,
  321 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  322 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  323 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  324 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  325 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  326 + handReceivableAmount=handReceivableAmount,
  327 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  328 + categoryName=categoryName,
  329 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  330 + sumPrice=sumPrice,
  331 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  332 +
  333 + print(aa.text)
  334 + return aa
  335 +
  336 +# time.sleep(5)
  337 +# do_invalidOrder(attrValue="202108130900105")
0 338 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoUndo.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/16 15:15
  4 +# @Author : Ljq
  5 +# @File : operationDoUndo.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.MySession import my
  16 +from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
  17 +from bs4 import BeautifulSoup
  18 +import urllib.parse
  19 +
  20 +def get_orderRefund(session=None,host="",orderId=None):
  21 + """获取订单详情"""
  22 + headers = dct.urlCode()
  23 + url = host + f"/entranceFeeBill/refund/{orderId}.action"
  24 + res = session.useHeadersRequests("get", url=url, headers=headers)
  25 + return res
  26 +
  27 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  28 + """缴费金额获取"""
  29 + url = host + "/calculate/index.action"
  30 + headers = dct.urlCode()
  31 +
  32 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "refund", "optType": "optType", "optUrl": "",
  33 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  34 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  35 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  36 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  37 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  38 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  39 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  40 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  41 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName", "calcDepId": "",
  42 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  43 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  44 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  45 + "created": "created", "remark": "false", "goodsTagIds": "", "shareRatio": "shareRatio",
  46 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  47 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  48 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  49 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  50 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  51 + "shipperName": "", "shipperId": "", "shipperPhone": "", "feeDepName": "", "calcFeeDepId": ""}
  52 + data["autocomplete-cartype"]=autocompletecartype
  53 + data = dict(data,**kwargs)
  54 + print("get_calculateRes",data)
  55 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  56 + return res
  57 +
  58 +
  59 +def do_doUndo(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  60 + """进门单缴费"""
  61 + url = host + "/entranceTrade/doUndo.action"
  62 + headers = dct.urlCode()
  63 +
  64 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "refund", "optType": "0", "optUrl": "",
  65 + "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  66 + "modified": "2021-08-11+17:32:50", "status": "3", "source": "1", "updateFeeItems": "",
  67 + "correctDiscount": "1", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  68 + "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  69 + "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  70 + "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  71 + "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  72 + "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "72",
  73 + "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  74 + "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  75 + "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "", "goodsTagIds": "1900",
  76 + "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  77 + "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  78 + "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  79 + "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  80 + "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  81 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  82 + "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  83 + "shipperPhone": "", "feeDepId": "0"}
  84 + data["autocomplete-cartype"] = autocompletecartype
  85 + data = dict(data, **kwargs)
  86 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  87 + print("================开始请求================")
  88 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  89 + return res
  90 +
  91 +
  92 +
  93 +def do_undoOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="",
  94 + ic=888810032426):
  95 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  96 + print("listPage", a.json())
  97 + orderId = a.json()["rows"][0]["id"]
  98 + number = a.json()["rows"][0]["number"]
  99 + created = a.json()["rows"][0]["created"]
  100 + print(orderId)
  101 +
  102 + # # 订单详情获取
  103 + resOrderDetails = get_orderRefund(session=session,host=host, orderId=orderId)
  104 +
  105 + # 正则取值
  106 + # regionId = re.findall('<option value="(.*?)" bind-name="', resOrderDetails.text)[0]
  107 +
  108 + # bs取值
  109 + orderDetailsList = BeautifulSoup(resOrderDetails.text, "html.parser").findAll("input")
  110 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  111 + print("orderDetailsDict",orderDetailsDict)
  112 + unitPrice = orderDetailsDict["unitPrice"]
  113 + goodsId = orderDetailsDict["goodsId"]
  114 + status = orderDetailsDict["status"]
  115 + source = orderDetailsDict["source"]
  116 + optType = orderDetailsDict["optType"]
  117 + correctInfo = orderDetailsDict["correctInfo"]
  118 + weightType = orderDetailsDict["weightType"]
  119 + correctDiscount = orderDetailsDict["correctDiscount"]
  120 +
  121 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  122 + # 货物标签特别判断
  123 + if "goodsTagIds" in orderDetailsDict.keys():
  124 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  125 + else:
  126 + goodsTagIds = ""
  127 +
  128 + sumPrice = orderDetailsDict["sumPrice"]
  129 + tradeTypeId = orderDetailsDict["tradeTypeId"]
  130 + shareRatio = orderDetailsDict["shareRatio"]
  131 + # regionName=orderDetailsDict["regionName"]
  132 + plate = orderDetailsDict["plate"]
  133 + carTypeName = orderDetailsDict["carTypeName"]
  134 + carTypeCode = orderDetailsDict["carTypeCode"]
  135 + carTypeId = orderDetailsDict["carTypeId"]
  136 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  137 + proveType = orderDetailsDict["proveType"]
  138 + grossWeight = orderDetailsDict["grossWeight"]
  139 + tareWeight = orderDetailsDict["tareWeight"]
  140 + depName = orderDetailsDict["depName"]
  141 + dep = orderDetailsDict["dep"]
  142 + # feeDepId = orderDetailsDict["calcDepId"]
  143 + productName = orderDetailsDict["productName"]
  144 + productId = orderDetailsDict["productId"]
  145 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  146 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  147 + weight = orderDetailsDict["weight"]
  148 + # calcDepId = orderDetailsDict["calcDepId"]
  149 + categoryName = orderDetailsDict["categoryName"]
  150 + categoryId = orderDetailsDict["categoryId"]
  151 + print("categoryId",categoryId)
  152 + inGreeterName = orderDetailsDict["inGreeterName"]
  153 + inGreeterId = orderDetailsDict["inGreeterId"]
  154 + productArea = orderDetailsDict["productArea"]
  155 + productPrice = orderDetailsDict["productPrice"]
  156 + modified = orderDetailsDict["modified"]
  157 +
  158 +
  159 + # # 用户信息获取
  160 + # res = eFBL.get_icCheck(host=host, ic=ic)
  161 + # print(res.text)
  162 + # customerId = res.json()["data"]["aInfo"]["customerId"]
  163 + # customerName = res.json()["data"]["aInfo"]["customerName"]
  164 + # accountId = res.json()["data"]["aInfo"]["accountId"]
  165 + # mobile = res.json()["data"]["aInfo"]["mobile"]
  166 + customerId = orderDetailsDict["customerId"]
  167 + customerName = orderDetailsDict["customerName"]
  168 + accountId = orderDetailsDict["accountId"]
  169 + mobile = orderDetailsDict["customerPhone"]
  170 + ic = orderDetailsDict["ic"]
  171 +
  172 + # 省市区获取
  173 + res = eFBL.get_city(session=session,host=host, name="万州")
  174 + print(res.text)
  175 + originId = res.json()["suggestions"][0]["id"]
  176 + # parentId = res.json()["suggestions"][0]["parentId"]
  177 + # value = res.json()["suggestions"][0]["value"]
  178 +
  179 + # # 获取缴费金额
  180 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  181 + print(autocompletecartype)
  182 + # modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  183 +
  184 + # 获取缴费金额
  185 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  186 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  187 + status=status,
  188 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  189 + carTypeCode=carTypeCode,
  190 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  191 + grossWeight=grossWeight,
  192 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  193 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  194 + goodsTagIds=goodsTagIds,
  195 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  196 + grossWeightDate=grossWeightDate,
  197 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, weight=weight,
  198 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  199 +
  200 + # 缴费信息
  201 + # print("res.text",res.text)
  202 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  203 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  204 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  205 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  206 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  207 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  208 +
  209 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  210 + soup = BeautifulSoup(res.text, "html.parser")
  211 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  212 + fee_int = 0
  213 + discount_amount = 0
  214 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  215 + c = tag.findAll("input")
  216 + for i in c:
  217 + if i.get("name") != None:
  218 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  219 + if i.get("type") == "text":
  220 + fee_int = fee_int + int(float(i.get("value")))
  221 + if "优惠" in i.get("value"):
  222 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  223 +
  224 + id = orderId
  225 + totalAmount = totalMoney
  226 + customerPhone = mobile
  227 + # dep = ""
  228 + chargeTotalAmount = totalMoney
  229 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  230 + freezeMoneySymbol = fee_int
  231 + comparisonFreezeAmount = fee_int
  232 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  233 + marketFlag = firmCode
  234 + itemReceivableAmount = receivable
  235 + receivableAmount = receivable
  236 + tareWeightDate = tareWeightDate
  237 + print("categoryId2",categoryId)
  238 +
  239 + aa = do_doUndo(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  240 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  241 + source=source,
  242 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  243 + fundAccount=accountId,
  244 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  245 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  246 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  247 + productPrice=productPrice,
  248 + unitPrice=unitPrice, depName=depName, dep=dep,
  249 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  250 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  251 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  252 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  253 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  254 + handReceivableAmount=handReceivableAmount,
  255 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  256 + categoryName=categoryName,
  257 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  258 + sumPrice=sumPrice,
  259 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  260 +
  261 + print(aa.text)
  262 + return aa
  263 +
  264 +# do_undoOrder(attrValue="202108160900078")
0 265 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationDoUpdate.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/13 14:08
  4 +# @Author : Ljq
  5 +# @File : operationModify.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.MySession import my
  16 +from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
  17 +from bs4 import BeautifulSoup
  18 +import urllib.parse
  19 +
  20 +
  21 +def get_orderUpdate(session=None,host="",orderId=None):
  22 + """获取订单详情"""
  23 + headers = dct.urlCode()
  24 + url = host + f"/entranceFeeBill/update/{orderId}.action"
  25 + res = session.useHeadersRequests("get", url=url, headers=headers)
  26 + return res
  27 +
  28 +
  29 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  30 + """缴费金额获取
  31 + :params kwargs:
  32 + protocolId:
  33 + pwd:
  34 + clientRedirectTag:
  35 + viewType:pay
  36 + optType:${optType}
  37 + optUrl:
  38 + correctInfo:${correctInfo}
  39 + weightType:${weightType}
  40 + id:${orderId}
  41 + goodsId:${goodsId}
  42 + number:${number}
  43 + modified:${__time(yyyy-MM-dd HH:mm:ss,)}
  44 + status:${status}
  45 + source:${source}
  46 + updateFeeItems:
  47 + correctDiscount:${correctDiscount}
  48 + totalAmount:
  49 + customerId:0
  50 + fundAccount:
  51 + ic:
  52 + customerName:
  53 + customerPhone:
  54 + payway:刷卡
  55 + plate:${plate}
  56 + autocomplete-cartype:${carTypeCode}(${carTypeName})
  57 + carTypeName:${carTypeName}
  58 + carTypeCode:${carTypeCode}
  59 + carTypeId:${carTypeId}
  60 + carTypeWeight:${carTypeWeight}
  61 + storeTareWeight:
  62 + proveType:${proveTypeCode}
  63 + grossWeight:${grossWeight}
  64 + tareWeight:${tareWeight}
  65 + weight:${grossWeight}
  66 + goodsNum:
  67 + itemWeight:
  68 + productPrice:1
  69 + unitPrice:${unitPrice}
  70 + depName:${feeDepName}
  71 + calcDepId:${feeDepId}
  72 + regionName:
  73 + regionId:0
  74 + productName:${productName}
  75 + productId:${productId}
  76 + productArea:万州区
  77 + parentId:
  78 + levelType:
  79 + originId:${originId}
  80 + tradeTypeId:${tradeTypeId}
  81 + chargeTotalAmount:
  82 + chargeTotalAmountYuan:
  83 + freezeMoneySymbol:
  84 + comparisonFreezeAmount:
  85 + created:${created}
  86 + remark:
  87 + goodsTagIds:${goodsTagIds}
  88 + shareRatio:${shareRatio}
  89 + handlingTeam:
  90 + handlingRatio:
  91 + handActualAmount:
  92 + handManageAmount:
  93 + handCollectionAmount:
  94 + receivableAmount:
  95 + categoryName:${productName}
  96 + categoryId:${productId}
  97 + driverTel:
  98 + grossWeightDate:${grossWeightDate}
  99 + tareWeightDate:${tareWeightDate}
  100 + grossPathName:
  101 + grossPathId:
  102 + tarePathId:
  103 + goodsRemark:
  104 + inGreeterName:
  105 + inGreeterId:0
  106 + outGreeterId:
  107 + sumPrice:${sumPrice}
  108 + shipperName:
  109 + shipperId:
  110 + shipperPhone:
  111 + feeDepName:
  112 + """
  113 + url = host + "/calculate/index.action"
  114 + headers = dct.urlCode()
  115 +
  116 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "update", "optType": "optType", "optUrl": "",
  117 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  118 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  119 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  120 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  121 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  122 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  123 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  124 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  125 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName",
  126 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  127 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  128 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  129 + "created": "created", "remark": "false", "goodsTagIds": "goodsTagIds", "shareRatio": "shareRatio",
  130 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  131 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  132 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  133 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  134 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  135 + "shipperName": "", "shipperId": "", "shipperPhone": ""}
  136 + data["autocomplete-cartype"]=autocompletecartype
  137 + data = dict(data,**kwargs)
  138 + print("get_calculateRes",data)
  139 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  140 + return res
  141 +
  142 +def do_doUpdate(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  143 + """进门单缴费"""
  144 + url = host + "/entranceFeeBill/doUpdate.action"
  145 + headers = dct.urlCode()
  146 +
  147 + # data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "update", "optType": "0", "optUrl": "",
  148 + # "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  149 + # "modified": "2021-08-11+17:32:50", "status": "3", "source": "1", "updateFeeItems": "",
  150 + # "correctDiscount": "1", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  151 + # "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  152 + # "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  153 + # "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  154 + # "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  155 + # "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "72",
  156 + # "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  157 + # "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  158 + # "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "备注", "goodsTagIds": "1900",
  159 + # "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  160 + # "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  161 + # "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  162 + # "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  163 + # "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  164 + # "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  165 + # "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  166 + # "shipperPhone": "", "feeDepId": "0"}
  167 +
  168 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "update", "optType": "0", "optUrl": "",
  169 + "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  170 + "modified": "2021-08-11+17:32:50", "status": "3", "source": "1", "updateFeeItems": "",
  171 + "correctDiscount": "1", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  172 + "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  173 + "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  174 + "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  175 + "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  176 + "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "",
  177 + "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  178 + "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  179 + "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "备注", "goodsTagIds": "1900",
  180 + "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  181 + "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  182 + "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  183 + "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  184 + "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  185 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  186 + "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  187 + "shipperPhone": "", "feeDepId": "0",}
  188 +
  189 + data["autocomplete-cartype"] = autocompletecartype
  190 + data = dict(data, **kwargs)
  191 +
  192 + # 当模板没有配置货物标签时,参数不能传递货物标签所以需要删除
  193 + if kwargs["goodsTagIds"] =="":
  194 + del data["goodsTagIds"]
  195 +
  196 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  197 + print("================开始请求================")
  198 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  199 + return res
  200 +
  201 +def do_updateOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111",
  202 + ic=888810032426):
  203 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  204 + print("listPage", a.json())
  205 + orderId = a.json()["rows"][0]["id"]
  206 + number = a.json()["rows"][0]["number"]
  207 + created = a.json()["rows"][0]["created"]
  208 + print(orderId)
  209 +
  210 + # # 订单详情获取
  211 + resOrderDetails = get_orderUpdate(session=session,host=host, orderId=orderId)
  212 +
  213 + # 正则取值
  214 + regionId = re.findall('<option value="(.*?)" bind-name="', resOrderDetails.text)[0]
  215 + regionName=re.findall('" bind-name="(.*?)" bind-index', resOrderDetails.text)[0]
  216 +
  217 + # bs取值
  218 + orderDetailsList = BeautifulSoup(resOrderDetails.text, "html.parser").findAll("input")
  219 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  220 + print("orderDetailsDict",orderDetailsDict)
  221 + unitPrice = orderDetailsDict["unitPrice"]
  222 + # regionId=orderDetailsDict["regionId"]
  223 + goodsId = orderDetailsDict["goodsId"]
  224 + status = orderDetailsDict["status"]
  225 + source = orderDetailsDict["source"]
  226 + optType = orderDetailsDict["optType"]
  227 + correctInfo = orderDetailsDict["correctInfo"]
  228 + weightType = orderDetailsDict["weightType"]
  229 + correctDiscount = orderDetailsDict["correctDiscount"]
  230 +
  231 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  232 + # 货物标签特别判断
  233 + if "goodsTagIds" in orderDetailsDict.keys():
  234 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  235 + else:
  236 + goodsTagIds = ""
  237 +
  238 + sumPrice = orderDetailsDict["sumPrice"]
  239 + tradeTypeId = orderDetailsDict["tradeTypeId"]
  240 + shareRatio = orderDetailsDict["shareRatio"]
  241 + plate = orderDetailsDict["plate"]
  242 + carTypeName = orderDetailsDict["carTypeName"]
  243 + carTypeCode = orderDetailsDict["carTypeCode"]
  244 + carTypeId = orderDetailsDict["carTypeId"]
  245 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  246 + proveType = orderDetailsDict["proveType"]
  247 + grossWeight = orderDetailsDict["grossWeight"]
  248 + tareWeight = orderDetailsDict["tareWeight"]
  249 + depName = orderDetailsDict["depName"]
  250 + print("depName123123123",depName)
  251 + dep = orderDetailsDict["calcDepId"]
  252 + productName = orderDetailsDict["productName"]
  253 + productId = orderDetailsDict["productId"]
  254 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  255 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  256 + weight = orderDetailsDict["weight"]
  257 + categoryName = orderDetailsDict["categoryName"]
  258 + categoryId = orderDetailsDict["categoryId"]
  259 + inGreeterName = orderDetailsDict["inGreeterName"]
  260 + inGreeterId = orderDetailsDict["inGreeterId"]
  261 + productArea = orderDetailsDict["productArea"]
  262 + productPrice = orderDetailsDict["productPrice"]
  263 +
  264 + # 哈达需要
  265 + calcDepId = orderDetailsDict["calcDepId"]
  266 + calcFeeDepId = ""
  267 + feeDepName = ""
  268 + levelType = ""
  269 +
  270 +
  271 + # # 用户信息获取
  272 + # res = eFBL.get_icCheck(session=session,host=host, ic=ic)
  273 + # print(res.text)
  274 + # customerId = res.json()["data"]["aInfo"]["customerId"]
  275 + # customerName = res.json()["data"]["aInfo"]["customerName"]
  276 + # accountId = res.json()["data"]["aInfo"]["accountId"]
  277 + # mobile = res.json()["data"]["aInfo"]["mobile"]
  278 + customerId = orderDetailsDict["customerId"]
  279 + customerName = orderDetailsDict["customerName"]
  280 + accountId = orderDetailsDict["accountId"]
  281 + mobile = orderDetailsDict["customerPhone"]
  282 + ic = orderDetailsDict["ic"]
  283 +
  284 + # 省市区获取
  285 + res = eFBL.get_city(session=session,host=host, name="万州")
  286 + print('res.json()["suggestions"]',res.json()["suggestions"])
  287 + originId = res.json()["suggestions"][0]["id"]
  288 + parentId = res.json()["suggestions"][0]["parentId"]
  289 + productArea = res.json()["suggestions"][0]["value"]
  290 +
  291 + # # 获取缴费金额
  292 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  293 + print(autocompletecartype)
  294 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  295 +
  296 + # 获取缴费金额
  297 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  298 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  299 + status=status,
  300 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  301 + carTypeCode=carTypeCode,
  302 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  303 + grossWeight=grossWeight,
  304 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  305 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  306 + goodsTagIds=goodsTagIds,
  307 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  308 + grossWeightDate=grossWeightDate,
  309 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, weight=weight,
  310 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  311 +
  312 + # 缴费信息
  313 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  314 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  315 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  316 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  317 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  318 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  319 +
  320 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  321 + soup = BeautifulSoup(res.text, "html.parser")
  322 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  323 + fee_int = 0
  324 + discount_amount = 0
  325 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  326 + c = tag.findAll("input")
  327 + for i in c:
  328 + if i.get("name") != None:
  329 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  330 + if i.get("type") == "text":
  331 + fee_int = fee_int + int(float(i.get("value")))
  332 + if "优惠" in i.get("value"):
  333 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  334 +
  335 + id = orderId
  336 + totalAmount = totalMoney
  337 + customerPhone = mobile
  338 + chargeTotalAmount = totalMoney
  339 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  340 + freezeMoneySymbol = fee_int
  341 + comparisonFreezeAmount = fee_int
  342 + modified = created
  343 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  344 + marketFlag = firmCode
  345 + itemReceivableAmount = receivable
  346 + receivableAmount = receivable
  347 + tareWeightDate = tareWeightDate
  348 +
  349 + aa = do_doUpdate(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  350 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  351 + source=source,
  352 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  353 + fundAccount=accountId,
  354 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  355 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  356 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  357 + productPrice=productPrice,
  358 + unitPrice=unitPrice, depName=depName,
  359 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  360 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  361 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  362 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  363 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  364 + handReceivableAmount=handReceivableAmount,
  365 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  366 + categoryName=categoryName,regionName=regionName,
  367 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  368 + sumPrice=sumPrice,parentId=parentId,regionId=regionId,dep=dep,
  369 + chargeTotalAmountYuan=chargeTotalAmountYuan,calcDepId=calcDepId)
  370 +
  371 + print(aa.text)
  372 + return aa
  373 +
  374 +# time.sleep(5)
  375 +# do_updateOrder(attrValue="202108130900106")
0 376 \ No newline at end of file
... ...
commons/api/entranceFeeBillList/operationUnfreeze.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/12 16:01
  4 +# @Author : Ljq
  5 +# @File : entanceOperation.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.MySession import my
  16 +from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
  17 +from bs4 import BeautifulSoup
  18 +import urllib.parse
  19 +
  20 +
  21 +def get_calculateRes(session=None,host="",autocompletecartype=None,**kwargs):
  22 + """缴费金额获取
  23 + :params kwargs:
  24 + protocolId:
  25 + pwd:
  26 + clientRedirectTag:
  27 + viewType:pay
  28 + optType:${optType}
  29 + optUrl:
  30 + correctInfo:${correctInfo}
  31 + weightType:${weightType}
  32 + id:${orderId}
  33 + goodsId:${goodsId}
  34 + number:${number}
  35 + modified:${__time(yyyy-MM-dd HH:mm:ss,)}
  36 + status:${status}
  37 + source:${source}
  38 + updateFeeItems:
  39 + correctDiscount:${correctDiscount}
  40 + totalAmount:
  41 + customerId:0
  42 + fundAccount:
  43 + ic:
  44 + customerName:
  45 + customerPhone:
  46 + payway:刷卡
  47 + plate:${plate}
  48 + autocomplete-cartype:${carTypeCode}(${carTypeName})
  49 + carTypeName:${carTypeName}
  50 + carTypeCode:${carTypeCode}
  51 + carTypeId:${carTypeId}
  52 + carTypeWeight:${carTypeWeight}
  53 + storeTareWeight:
  54 + proveType:${proveTypeCode}
  55 + grossWeight:${grossWeight}
  56 + tareWeight:${tareWeight}
  57 + weight:${grossWeight}
  58 + goodsNum:
  59 + itemWeight:
  60 + productPrice:1
  61 + unitPrice:${unitPrice}
  62 + depName:${feeDepName}
  63 + calcDepId:${feeDepId}
  64 + regionName:
  65 + regionId:0
  66 + productName:${productName}
  67 + productId:${productId}
  68 + productArea:万州区
  69 + parentId:
  70 + levelType:
  71 + originId:${originId}
  72 + tradeTypeId:${tradeTypeId}
  73 + chargeTotalAmount:
  74 + chargeTotalAmountYuan:
  75 + freezeMoneySymbol:
  76 + comparisonFreezeAmount:
  77 + created:${created}
  78 + remark:
  79 + goodsTagIds:${goodsTagIds}
  80 + shareRatio:${shareRatio}
  81 + handlingTeam:
  82 + handlingRatio:
  83 + handActualAmount:
  84 + handManageAmount:
  85 + handCollectionAmount:
  86 + receivableAmount:
  87 + categoryName:${productName}
  88 + categoryId:${productId}
  89 + driverTel:
  90 + grossWeightDate:${grossWeightDate}
  91 + tareWeightDate:${tareWeightDate}
  92 + grossPathName:
  93 + grossPathId:
  94 + tarePathId:
  95 + goodsRemark:
  96 + inGreeterName:
  97 + inGreeterId:0
  98 + outGreeterId:
  99 + sumPrice:${sumPrice}
  100 + shipperName:
  101 + shipperId:
  102 + shipperPhone:
  103 + feeDepName:
  104 + """
  105 + url = host + "/calculate/index.action"
  106 + headers = dct.urlCode()
  107 +
  108 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "unfreeze", "optType": "optType", "optUrl": "",
  109 + "correctInfo": "correctInfo", "weightType": "weightType", "id": "orderId", "goodsId": "goodsId",
  110 + "number": "number", "modified": "time", "status": "status", "source": "source", "updateFeeItems": "",
  111 + "correctDiscount": "correctDiscount", "totalAmount": "", "customerId": "0", "fundAccount": "",
  112 + "accountId":"","ic": "","customerName": "", "customerPhone": "", "payway": "刷卡", "plate": "plate",
  113 + "autocomplete-cartype": "carTypeCode(carTypeName)", "carTypeName": "carTypeName",
  114 + "carTypeCode": "carTypeCode", "carTypeId": "carTypeId", "carTypeWeight": "carTypeWeight",
  115 + "storeTareWeight": "", "proveType": "proveTypeCode", "grossWeight": "grossWeight",
  116 + "tareWeight": "tareWeight", "weight": "grossWeight", "goodsNum": "", "itemWeight": "",
  117 + "productPrice": "1.00000", "unitPrice": "unitPrice", "depName": "feeDepName",
  118 + "regionName": "", "regionId": "0", "productName": "productName", "productId": "productId",
  119 + "productArea": "重庆,重庆市,万州区", "parentId": "", "levelType": "", "originId": "originId", "tradeTypeId": "tradeTypeId",
  120 + "chargeTotalAmount": "", "chargeTotalAmountYuan": "", "freezeMoneySymbol": "", "comparisonFreezeAmount": "",
  121 + "created": "created", "remark": "false", "goodsTagIds": "goodsTagIds", "shareRatio": "shareRatio",
  122 + "handlingTeam": "", "handlingRatio": "", "handActualAmount": "", "handManageAmount": "",
  123 + "handCollectionAmount": "", "receivableAmount": "", "categoryName": "productName",
  124 + "categoryId": "productId", "driverTel": "", "grossWeightDate": "grossWeightDate",
  125 + "tareWeightDate": "tareWeightDate", "grossPathName": "", "grossPathId": "", "tarePathId": "",
  126 + "goodsRemark": "", "inGreeterName": "", "inGreeterId": "0", "outGreeterId": "", "sumPrice": "sumPrice",
  127 + "shipperName": "", "shipperId": "", "shipperPhone": ""}
  128 + data["autocomplete-cartype"]=autocompletecartype
  129 + data = dict(data,**kwargs)
  130 + print("get_calculateRes",data)
  131 + res = session.useHeadersRequests("post", url=url,data=data,headers=headers)
  132 + return res
  133 +
  134 +def do_doUnfreeze(session=None,host="",autocompletecartype=None,fee_str="",**kwargs):
  135 + """进门单缴费"""
  136 + url = host + "/entranceTrade/doUnfreeze.action"
  137 + headers = dct.urlCode()
  138 + data = {"protocolId": "", "pwd": "", "clientRedirectTag": "", "viewType": "unfreeze", "optType": "0", "optUrl": "",
  139 + "correctInfo": "1", "weightType": "1", "id": "3968", "goodsId": "3982", "number": "202108110900122",
  140 + "modified": "2021-08-11+17:32:50", "status": "3", "source": "1", "updateFeeItems": "",
  141 + "correctDiscount": "1", "totalAmount": "800", "customerId": "389", "fundAccount": "105847",
  142 + "accountId": "105847", "ic": "888810032426", "customerName": "长歌买家省内啊啊啊嘿", "customerPhone": "18011501258",
  143 + "payway": "刷卡", "plate": "川B00001", "autocomplete-cartype": "003(板车)", "carTypeName": "板车",
  144 + "carTypeCode": "003", "carTypeId": "53", "carTypeWeight": "333", "storeTareWeight": "", "proveType": "1621",
  145 + "grossWeight": "353", "tareWeight": "333", "weight": "20", "goodsNum": "", "itemWeight": "",
  146 + "productPrice": "1.00000", "unitPrice": "100.0", "depName": "水果部", "dep": "58", "regionId": "72",
  147 + "productName": "雪莲果", "productId": "14158", "productArea": "重庆,重庆市,万州区", "originId": "500101",
  148 + "tradeTypeId": "71", "chargeTotalAmount": "800", "chargeTotalAmountYuan": "8", "freezeMoneySymbol": "13",
  149 + "comparisonFreezeAmount": "13", "created": "2021-08-11+17:32:27", "remark": "备注", "goodsTagIds": "1900",
  150 + "shareRatio": "0", "handlingTeam": "", "steveTeamId": "", "handlingRatio": "", "handActualAmount": "0",
  151 + "handManageAmount": "0", "handCollectionAmount": "0", "marketFlag": "sy", "totalMoney": "800",
  152 + "receivable": "1300", "collectionPrice": "0", "discountAmount": "500", "handReceivableAmount": "0",
  153 + "itemReceivableAmount": "1300", "receivableAmount": "1300", "categoryName": "水果", "categoryId": "14436",
  154 + "driverTel": "", "grossWeightDate": "2021-08-11+17:32:27", "tareWeightDate": "2021-08-11+17:32:27",
  155 + "grossPathName": "", "grossPathId": "", "tarePathId": "", "goodsRemark": "备注", "inGreeterName": "通用测试",
  156 + "inGreeterId": "274", "outGreeterId": "", "sumPrice": "2000", "shipperName": "", "shipperId": "",
  157 + "shipperPhone": "", "feeDepId": "0"}
  158 +
  159 + data["autocomplete-cartype"] = autocompletecartype
  160 + data = dict(data, **kwargs)
  161 + data_uc = jsonToUrlcode.jsonToUrlcode(data_json=data)+fee_str
  162 + print("================开始请求================")
  163 + res = session.useHeadersRequests("post", url=url, data=data_uc, headers=headers)
  164 + return res
  165 +
  166 +def do_unfreezeOrder(session=None,host="http://test.jmsf.diligrp.com:8385",attrName="收费单号",attrValue="202108060900032",pwd="111111",
  167 + ic=888810032426):
  168 + a = eFBL.listPage(session=session,host=host, attrName=attrName, attrValue=attrValue)
  169 + print("listPage", a.json())
  170 + orderId = a.json()["rows"][0]["id"]
  171 + number = a.json()["rows"][0]["number"]
  172 + created = a.json()["rows"][0]["created"]
  173 + print(orderId)
  174 +
  175 + # # 订单详情获取
  176 + resOrderDetails = eFBL.get_orderUnfreeze(session=session,host=host, orderId=orderId)
  177 +
  178 + # bs取值
  179 + orderDetailsList = BeautifulSoup(resOrderDetails.text, "html.parser").findAll("input")
  180 + orderDetailsDict = {i.get("name"): i.get("value") for i in orderDetailsList}
  181 + print("orderDetailsDict",orderDetailsDict)
  182 + unitPrice = orderDetailsDict["unitPrice"]
  183 + regionId=orderDetailsDict["regionId"]
  184 + goodsId = orderDetailsDict["goodsId"]
  185 + status = orderDetailsDict["status"]
  186 + source = orderDetailsDict["source"]
  187 + optType = orderDetailsDict["optType"]
  188 + correctInfo = orderDetailsDict["correctInfo"]
  189 + weightType = orderDetailsDict["weightType"]
  190 + correctDiscount = orderDetailsDict["correctDiscount"]
  191 +
  192 + # goodsTagIds = orderDetailsDict["goodsTagIds"]
  193 + # 货物标签特别判断
  194 + if "goodsTagIds" in orderDetailsDict.keys():
  195 + goodsTagIds = orderDetailsDict["goodsTagIds"]
  196 + else:
  197 + goodsTagIds = ""
  198 +
  199 + sumPrice = orderDetailsDict["sumPrice"]
  200 + tradeTypeId = orderDetailsDict["tradeTypeId"]
  201 + shareRatio = orderDetailsDict["shareRatio"]
  202 + plate = orderDetailsDict["plate"]
  203 + carTypeName = orderDetailsDict["carTypeName"]
  204 + carTypeCode = orderDetailsDict["carTypeCode"]
  205 + carTypeId = orderDetailsDict["carTypeId"]
  206 + carTypeWeight = orderDetailsDict["carTypeWeight"]
  207 + proveType = orderDetailsDict["proveType"]
  208 + grossWeight = orderDetailsDict["grossWeight"]
  209 + tareWeight = orderDetailsDict["tareWeight"]
  210 + depName = orderDetailsDict["depName"]
  211 + dep = orderDetailsDict["dep"]
  212 + productName = orderDetailsDict["productName"]
  213 + productId = orderDetailsDict["productId"]
  214 + grossWeightDate = orderDetailsDict["grossWeightDate"]
  215 + tareWeightDate = orderDetailsDict["tareWeightDate"]
  216 + weight = orderDetailsDict["weight"]
  217 + categoryName = orderDetailsDict["categoryName"]
  218 + categoryId = orderDetailsDict["categoryId"]
  219 + inGreeterName = orderDetailsDict["inGreeterName"]
  220 + inGreeterId = orderDetailsDict["inGreeterId"]
  221 + productArea = orderDetailsDict["productArea"]
  222 + productPrice = orderDetailsDict["productPrice"]
  223 +
  224 +
  225 + # # 用户信息获取
  226 + # res = eFBL.get_icCheck(host=host, ic=ic)
  227 + # print(res.text)
  228 + # customerId = res.json()["data"]["aInfo"]["customerId"]
  229 + # customerName = res.json()["data"]["aInfo"]["customerName"]
  230 + # accountId = res.json()["data"]["aInfo"]["accountId"]
  231 + # mobile = res.json()["data"]["aInfo"]["mobile"]
  232 + customerId = orderDetailsDict["customerId"]
  233 + customerName = orderDetailsDict["customerName"]
  234 + accountId = orderDetailsDict["accountId"]
  235 + mobile = orderDetailsDict["customerPhone"]
  236 + ic = orderDetailsDict["ic"]
  237 +
  238 + # 省市区获取
  239 + res = eFBL.get_city(session=session,host=host, name="万州")
  240 + print(res.text)
  241 + originId = res.json()["suggestions"][0]["id"]
  242 +
  243 + # # 获取缴费金额
  244 + autocompletecartype = f"{carTypeCode}({carTypeName})"
  245 + print(autocompletecartype)
  246 + modified = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  247 +
  248 + # 获取缴费金额
  249 + res = get_calculateRes(session=session,host=host, autocompletecartype=autocompletecartype, optType=optType, correctInfo=correctInfo,
  250 + weightType=weightType, id=orderId, goodsId=goodsId, number=number, modified=modified,
  251 + status=status,
  252 + source=source, correctDiscount=correctDiscount, plate=plate, carTypeName=carTypeName,
  253 + carTypeCode=carTypeCode,
  254 + carTypeId=carTypeId, carTypeWeight=carTypeWeight, proveType=proveType,
  255 + grossWeight=grossWeight,
  256 + tareWeight=tareWeight, unitPrice=unitPrice, depName=depName, productName=productName,
  257 + productId=productId, originId=originId, tradeTypeId=tradeTypeId, created=created,
  258 + goodsTagIds=goodsTagIds,
  259 + shareRatio=shareRatio, categoryName=categoryName, categoryId=categoryId,
  260 + grossWeightDate=grossWeightDate,
  261 + tareWeightDate=tareWeightDate, sumPrice=sumPrice, weight=weight,
  262 + inGreeterName=inGreeterName, inGreeterId=inGreeterId)
  263 +
  264 + # 缴费信息
  265 + totalMoney = re.findall('name="totalMoney" value="(.*?)">', res.text)[0]
  266 + discountAmount = re.findall('name="discountAmount" value="(.*?)">', res.text)[0]
  267 + handReceivableAmount = re.findall('name="handReceivableAmount" value="(.*?)">', res.text)[0]
  268 + correctDiscount = re.findall('id="correctDiscount" name="correctDiscount" value="(.*?)">', res.text)[0]
  269 + receivable = re.findall('id="creceivableLong" name="receivable" value="(.*?)">', res.text)[0]
  270 + collectionPrice = re.findall('name="collectionPrice" value="(.*?)"', res.text)[0]
  271 +
  272 + # 查找dl标签class为包含'ui-font-'字符的所有dl标签
  273 + soup = BeautifulSoup(res.text, "html.parser")
  274 + fee_str = "correctDiscount=1&billItems=&billItemsDic="
  275 + fee_int = 0
  276 + discount_amount = 0
  277 + for tag in soup.findAll("div", class_="d-flex align-items-center"):
  278 + c = tag.findAll("input")
  279 + for i in c:
  280 + if i.get("name") != None:
  281 + fee_str = fee_str + "&" + i.get("name") + "=" + urllib.parse.quote(i.get("value"))
  282 + if i.get("type") == "text":
  283 + fee_int = fee_int + int(float(i.get("value")))
  284 + if "优惠" in i.get("value"):
  285 + discount_amount = discount_amount + int(json.loads(i.get("value"))["receivable"]) / 100
  286 +
  287 + id = orderId
  288 + totalAmount = totalMoney
  289 + customerPhone = mobile
  290 + chargeTotalAmount = totalMoney
  291 + chargeTotalAmountYuan = fee_int - int(discount_amount)
  292 + freezeMoneySymbol = fee_int
  293 + comparisonFreezeAmount = fee_int
  294 + modified = created
  295 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  296 + marketFlag = firmCode
  297 + itemReceivableAmount = receivable
  298 + receivableAmount = receivable
  299 + tareWeightDate = tareWeightDate
  300 +
  301 + aa = do_doUnfreeze(session=session,host=host, autocompletecartype=autocompletecartype, fee_str=fee_str, pwd=pwd, optType=optType,
  302 + weightType=weightType, id=id, goodsId=goodsId, number=number, created=created, status=status,
  303 + source=source,
  304 + correctDiscount=correctDiscount, totalAmount=totalAmount, customerId=customerId,
  305 + fundAccount=accountId,
  306 + accountId=accountId, ic=ic, customerName=customerName, customerPhone=customerPhone, plate=plate,
  307 + carTypeName=carTypeName, carTypeCode=carTypeCode, carTypeId=carTypeId, carTypeWeight=carTypeWeight,
  308 + proveType=proveType, grossWeight=grossWeight, tareWeight=tareWeight, weight=weight,
  309 + productPrice=productPrice,
  310 + unitPrice=unitPrice, depName=depName, dep=dep,
  311 + regionId=regionId,
  312 + productName=productName, productId=productId, productArea=productArea, originId=originId,
  313 + tradeTypeId=tradeTypeId, correctInfo=correctInfo, chargeTotalAmount=chargeTotalAmount,
  314 + freezeMoneySymbol=freezeMoneySymbol, comparisonFreezeAmount=comparisonFreezeAmount, modified=modified,
  315 + goodsTagIds=goodsTagIds, marketFlag=marketFlag, totalMoney=totalMoney, receivable=receivable,
  316 + collectionPrice=collectionPrice, discountAmount=discountAmount,
  317 + handReceivableAmount=handReceivableAmount,
  318 + itemReceivableAmount=itemReceivableAmount, receivableAmount=receivableAmount,
  319 + categoryName=categoryName,
  320 + categoryId=categoryId, grossWeightDate=grossWeightDate, tareWeightDate=tareWeightDate,
  321 + sumPrice=sumPrice,
  322 + chargeTotalAmountYuan=chargeTotalAmountYuan)
  323 +
  324 + print(aa.text)
  325 + return aa
  326 +
  327 +# time.sleep(5)
  328 +# do_unfreezeOrder(attrValue="202108120900023")
0 329 \ No newline at end of file
... ...
commons/api/entranceFeeBill_details.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import sy1,heb
  6 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  7 +
  8 +
  9 +class entranceFeeBill_details():
  10 + "收费单标记-查询"
  11 + url = "http://test.jmsf.diligrp.com:8385/entranceFeeBill/details.action"
  12 + header = {
  13 + "Connection": "keep-alive",
  14 + "Accept": "application/json, text/javascript, */*; q=0.01",
  15 + "X-Requested-With": "XMLHttpRequest",
  16 + "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
  17 + "Content-Type": "application/json",
  18 + "Accept-Language": "zh-CN,zh;q=0.9",
  19 + "Accept-Encoding": "gzip, deflate"}
  20 + url_tail = """?rows=10&page=1
  21 + &metadata[charge_total_amount]={"provider":"moneyProvider","index":10,"field":"charge_total_amount"}
  22 + &metadata[discount]={"provider":"moneyProvider","index":20,"field":"discount"}
  23 + &metadata[freeze_price]={"provider":"moneyProvider","index":30,"field":"freeze_price"}
  24 + &metadata[trx_sum]={"provider":"moneyProvider","index":40,"field":"trx_sum"}
  25 + &metadata[itemFee103]={"provider":"moneyProvider","index":50,"field":"itemFee103"}
  26 + &metadata[itemFee106]={"provider":"moneyProvider","index":60,"field":"itemFee106"}
  27 + &metadata[payment_time]={"provider":"datetimeProvider","index":70,"field":"payment_time"}
  28 + &metadata[status]={"provider":"entranceFeeBillStateProvider","index":80,"field":"status"}
  29 + &metadata[CREATED]={"provider":"datetimeProvider","index":90,"field":"CREATED"}
  30 + &metadata[gross_weight_date]={"provider":"datetimeProvider","index":100,"field":"gross_weight_date"}
  31 + &metadata[tare_weight_date]={"provider":"datetimeProvider","index":110,"field":"tare_weight_date"}
  32 + &carTypeId=53
  33 + &categoryId=14436
  34 + &dep=58
  35 + &regionId=72
  36 + &status=4
  37 + &type=1
  38 + &backSkinStatus=-1
  39 + &tag=20
  40 + &companyId=9
  41 + &startTime=2020-08-11 00:00:00&endTime=2025-08-13 00:00:00
  42 + &startPayTime=2020-08-11 00:00:00&endPayTime=2025-08-13 00:00:00
  43 + &attr=number&attrValue=202108120900001"""
  44 +
  45 + def __init__(self):
  46 + self.url = entranceFeeBill_details.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  47 + self.url =self.url + entranceFeeBill_details.url_tail.replace('\n', '')
  48 + self.header = entranceFeeBill_details.header
  49 +
  50 + def sql_select(self,marketid):
  51 + self.sql="""SELECT
  52 + a.car_type_id, #0车型
  53 + b.category_id, #1品类
  54 + a.dep, #2接车部
  55 + b.region_id ,#3货物区域
  56 + a.`status`, #4状态
  57 + a.type ,#5称重类型
  58 + a.back_skin_status, #6回皮状态
  59 + b.tags, #7货物标签-F
  60 + a.company_id, #8子公司
  61 + a.number, #9收费单号
  62 + a.plate, #10车牌号
  63 + b.product_name , #11商品
  64 + a.cashier_name , #12收费员
  65 + a.customer_name, #13客户姓名
  66 + a.customer_phone, #14客户手机号
  67 + a.ic #15客户卡号
  68 + FROM entrance_fee_bill a ,goods b
  69 + WHERE a.goods_id=b.id
  70 + AND a.market_id={}
  71 + AND a.`status`=4
  72 + AND a.company_id IS NOT NULL
  73 + AND a.ic IS NOT NULL
  74 + AND a.cashier_name IS NOT NULL
  75 + ORDER BY a.id DESC LIMIT 1;""".format(marketid)
  76 + return self.sql
  77 +
  78 +# tt=entranceFeeBill_details()
  79 +# re=sy1.get(url=tt.url,headers=tt.header)
  80 +# print(str(re.json()).replace(" ",""))
0 81 \ No newline at end of file
... ...
commons/api/entranceFeeBill_provesPage.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import sy1
  6 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  7 +
  8 +
  9 +class entranceFeeBill_provesPage():
  10 + "证明类型明细-查询"
  11 + url = "http://test.jmsf.diligrp.com:8385/entranceFeeBill/provesPage.action"
  12 + header = {
  13 + "Connection": "keep-alive",
  14 + "Content-Length": "485",
  15 + "Accept": "application/json, text/javascript, */*; q=0.01",
  16 + "X-Requested-With": "XMLHttpRequest",
  17 + "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
  18 + "Content-Type": "application/x-www-form-urlencoded",
  19 + "Accept-Language": "zh-CN,zh;q=0.9",
  20 + "Accept-Encoding": "gzip, deflate"}
  21 + body = """rows=10&page=1&sort=et.created&order=desc
  22 + &metadata[actualPrice]={"provider":"moneyProvider","index":10,"field":"actualPrice"}
  23 + &metadata[created]={"provider":"datetimeProvider","index":20,"field":"created"}
  24 + &metadata[status]={"provider":"entranceFeeBillStateProvider","index":30,"field":"status"}
  25 + &attr=number&attrValue=202108110900139&categoryId=14436&productName=雪莲果&productId=14158
  26 + &dep=103&proveTypeCode=1621&companyId=9&startTime=2020-08-11 00:00:00&endTime=2025-08-13 23:59:59"""
  27 +
  28 + def __init__(self):
  29 + self.url = entranceFeeBill_provesPage.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  30 + self.header = entranceFeeBill_provesPage.header
  31 + self.body= entranceFeeBill_provesPage.body.replace('\n', '')
  32 +
  33 + def sql_select(self,marketid):
  34 + self.sql="""SELECT
  35 + a.dep, #部门
  36 + a.number, #收费单号
  37 + a.plate, #车牌号
  38 + a.customer_name, #客户姓名
  39 + a.customer_phone, #客户电话
  40 + a.ic, #客户卡号
  41 + a.company_id, #子公司
  42 + a.goods_id,
  43 + b.prove_type_code, #证明类型
  44 + b.category_id, #品类id
  45 + b.product_id, #商品id
  46 + b.product_name , #商品名称
  47 + c.fee_bill_id
  48 + FROM entrance_fee_bill a ,goods b ,bill_fee_item c
  49 + WHERE a.goods_id=b.id
  50 + AND a.id = c.fee_bill_id
  51 + AND a.market_id={}
  52 + AND a.yn=1
  53 + AND c.fee_item_name LIKE "%检测费%"
  54 + AND a.company_id IS NOT NULL
  55 + AND a.ic IS NOT NULL
  56 + AND b.prove_type_code IS NOT NULL
  57 + ORDER BY a.id DESC LIMIT 1;""".format(marketid)
  58 + return self.sql
  59 +
  60 +# tt=entranceFeeBill_provesPage()
  61 +# re=sy1.post(url=tt.url,headers=tt.header,data=tt.body.encode('utf-8'))
  62 +# print(re.json())
0 63 \ No newline at end of file
... ...
commons/api/fc_add.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/7/29 11:18
  4 +@Auth : wlm
  5 +@File :test_fc_edit.py
  6 +@IDE :PyCharm
  7 +"""
  8 +# -*- coding: utf-8 -*-
  9 +
  10 +"""
  11 +返还人管理——新增返还人
  12 +"""
  13 +
  14 +from commons import common as com
  15 +from commons.MySession import my
  16 +
  17 +class fc_add():
  18 + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/add.action"
  19 + header = {
  20 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "77",
  21 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  22 + "X-Requested-With": "XMLHttpRequest",
  23 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  24 + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", "Accept-Language": "zh-CN,zh;q=0.9",
  25 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
  26 + "Accept-Encoding": "gzip,deflate"
  27 + }
  28 + body = 'parentId=0&name=你好&mobile=18828281176&cardNumber=888810054630'
  29 + # body = "parentId=0&name=你好&mobile=18828281176&cardNumber=888810054630&relationCardTemp=888810054630&relationalCard[0].cardNumber=888810054630"
  30 + def __init__(self):
  31 + self.url = fc_add.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
  32 + self.header = fc_add.header
  33 + self.body = fc_add.body
  34 +
  35 +
  36 +# fc = fc_add()
  37 +# print(fc.body)
  38 +# re = my.post(url = fc.url,data = fc.body.encode('utf-8'),headers = fc.header)
  39 +# print(re.json())
  40 +# print(re.headers)
0 41 \ No newline at end of file
... ...
commons/api/fc_edit.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/7/30 9:55
  4 +@Auth : wlm
  5 +@File :test_fc_edit.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +返还人管理——修改返还人
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import my
  13 +
  14 +class fc_edit():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/add.action"
  16 +
  17 + header = {
  18 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "148",
  19 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  20 + "X-Requested-With": "XMLHttpRequest",
  21 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  22 + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", "Accept-Language": "zh-CN,zh;q=0.9",
  23 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
  24 + "Accept-Encoding": "gzip,deflate"
  25 + }
  26 + body = "id=40&name=农交&mobile=18828281176&cardNumber=888810054630"
  27 + # body = "id=40&name=农交&mobile=18828281176&cardNumber=888810054630&\
  28 + # relationCardTemp=210720133001&relationalCard[0].cardNumber=210720131533"
  29 +
  30 + def __init__(self):
  31 + self.url = fc_edit.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
  32 + self.header = fc_edit.header
  33 + self.body = fc_edit.body
  34 +
  35 +# fc=fc_edit()
  36 +# print(fc.body)
  37 +# re=my.post(url=fc.url,data=fc.body.encode('utf-8'),headers=fc.header)
  38 +# print(re.json())
  39 +# print(re.headers)
0 40 \ No newline at end of file
... ...
commons/api/fc_view.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/7/30 9:55
  4 +@Auth : wlm
  5 +@File :test_fc_view.py
  6 +@IDE :PyCharm
  7 +"""
  8 +# -*- coding: utf-8 -*-
  9 +"""
  10 +返还人管理——查看返还人
  11 +"""
  12 +from commons import common as com
  13 +from commons.MySession import my
  14 +
  15 +class fc_view():
  16 + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/view.html?pagetype=2&id=40"
  17 +
  18 + header = {
  19 + "Host":"test.jmsf.diligrp.com:8385",
  20 + "Connection":"keep-alive",
  21 + "Upgrade-Insecure-Requests":"1",
  22 + "User-Agent":"Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  23 + "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
  24 + "Accept-Language":"zh-CN,zh;q=0.9",
  25 + "Referer":"http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
  26 + "Accept-Encoding":"gzip,deflate"
  27 + }
  28 +
  29 + def __init__(self):
  30 + self.url = fc_view.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
  31 + self.header = fc_view.header
  32 +
  33 +# fc = fc_view()
  34 +# re = my.get(url=fc.url,headers = fc.header)
  35 +# print(re.text)
0 36 \ No newline at end of file
... ...
commons/api/feedbackAccounrecordController_list.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/5 9:59
  4 +@Auth : wlm
  5 +@File :test_feedbackAccounrecordController_list.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +交易明细——交易流水号和时间查询
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import my,sy1
  13 +
  14 +class feedbackAccounrecordController_list():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackAccounrecordController/list.action"
  16 + header = {
  17 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "631",
  18 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  19 + "X-Requested-With": "XMLHttpRequest",
  20 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  21 + "Content-Type": "application/x-www-form-urlencoded", "Accept-Language": "zh-CN,zh;q=0.9",
  22 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackAccounrecordController/list",
  23 + "Accept-Encoding": "gzip,deflate"
  24 + }
  25 + # body = '''rows=10&page=1&order=desc
  26 + # &metadata[created]={"provider":"datetimeProvider","index":10,"field":"created"}
  27 + # &metadata[recordType]={"provider":"recordTypeProvider","index":20,"field":"recordType"}
  28 + # &metadata[recordState]={"provider":"recordStateProvider","index":30,"field":"recordState"}
  29 + # &metadata[recordAmount]={"provider":"moneyProvider","index":40,"field":"recordAmount"}
  30 + # &createdStart=2021-08-05 00:00:00
  31 + # &createdEnd=2021-08-05 23:59:59
  32 + # &queryType=1
  33 + # &keyword=1075782308694007808'''
  34 + # body = '''rows=10&page=1&order=desc&metadata[created]={"provider":"datetimeProvider","index":10,"field":"created"}&metadata[recordType]={"provider":"recordTypeProvider","index":20,"field":"recordType"}&metadata[recordState]={"provider":"recordStateProvider","index":30,"field":"recordState"}&metadata[recordAmount]={"provider":"moneyProvider","index":40,"field":"recordAmount"}&createdStart=2021-08-05 00:00:00&createdEnd=2021-08-05 23:59:59&queryType=1&keyword=1075782308694007808'''
  35 + body = '''rows=10
  36 + &page=1&order=desc
  37 + &metadata[created]={"provider":"datetimeProvider","index":10,"field":"created"}
  38 + &metadata[recordType]={"provider":"recordTypeProvider","index":20,"field":"recordType"}
  39 + &metadata[recordState]={"provider":"recordStateProvider","index":30,"field":"recordState"}
  40 + &metadata[recordAmount]={"provider":"moneyProvider","index":40,"field":"recordAmount"}
  41 + &createdStart=2021-08-05 00:00:00
  42 + &createdEnd=2021-08-05 23:59:59
  43 + &queryType=1
  44 + &keyword=1075782308694007808'''
  45 +
  46 + def __init__(self):
  47 + self.url = feedbackAccounrecordController_list.url.replace("http://test.",com.get_global_config("global_data", "environment", "en"))
  48 + self.header = feedbackAccounrecordController_list.header
  49 + self.body = feedbackAccounrecordController_list.body
  50 +
  51 +# farc = feedbackAccounrecordController_list()
  52 +# print(farc.body)
  53 +# re = sy1.post(url = farc.url,headers = farc.header,data = farc.body.replace("\n", ""),proxies = my.myproxies)
  54 +# print(re.json())
0 55 \ No newline at end of file
... ...
commons/api/feedbackOrderController_querySumAmount.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/5 9:33
  4 +@Auth : wlm
  5 +@File :feedbackOrderController_querySumAmount.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +已结账明细——返还人和结账时间查询
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import my,sy1
  13 +
  14 +class querySumAmount():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/querySumAmount.action"
  16 +
  17 + header = {
  18 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "165",
  19 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  20 + "X-Requested-With": "XMLHttpRequest",
  21 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  22 + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", "Accept-Language": "zh-CN,zh;q=0.9",
  23 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/settlementlist",
  24 + "Accept-Encoding": "gzip,deflate"
  25 + }
  26 +
  27 + # body = "feedbackCustomerId=25&departmentId=56&tagId=yjsp&settleTimeStart=2021-08-02 00:00:00&settleTimeEnd=2021-08-05 23:59:59&queryType=1&keyword=苹果"
  28 + body = "feedbackCustomerId=25&settleTimeStart=2021-07-05 00:00:00&settleTimeEnd=2021-08-05 09:46:25&queryType=1"
  29 + def __init__(self):
  30 + self.url = querySumAmount.url.replace("http://test.",com.get_global_config("global_data", "environment", "en"))
  31 + self.header = querySumAmount.header
  32 + self.body = querySumAmount.body
  33 +
  34 +# qsm = querySumAmount()
  35 +# re = sy1.post(url = qsm.url,data = qsm.body.encode('utf-8'),headers = qsm.header)
  36 +# print(re.json())
0 37 \ No newline at end of file
... ...
commons/api/feedbackOrderController_settlementlist.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/5 16:23
  4 +@Auth : wlm
  5 +@File :test_feedbackOrderController_settlementlist.py
  6 +@IDE :PyCharm
  7 +"""
  8 +# -*- coding: utf-8 -*-
  9 +"""
  10 +已结账明细——已结账笔数和已结账金额查询
  11 +"""
  12 +from commons import common as com
  13 +from commons.MySession import sy1,my
  14 +
  15 +class feedbackOrderController_settlementlist():
  16 + url = "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/settlementlist.action"
  17 +
  18 + header = {
  19 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "651",
  20 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  21 + "X-Requested-With": "XMLHttpRequest",
  22 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  23 + "Content-Type": "application/x-www-form-urlencoded", "Accept-Language": "zh-CN,zh;q=0.9",
  24 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/settlementlist",
  25 + "Accept-Encoding": "gzip,deflate"
  26 + }
  27 +
  28 + # body = '''rows=10
  29 + # &page=1
  30 + # &sort=efb.payment_time
  31 + # &order=desc
  32 + # &metadata[payTime]={"provider":"datetimeProvider","index":10,"field":"payTime"}
  33 + # &metadata[feebackAmount]={"provider":"moneyProvider","index":20,"field":"feebackAmount"}
  34 + # &metadata[settledAmount]={"provider":"moneyProvider","index":30,"field":"settledAmount"}
  35 + # &metadata[settleTime]={"provider":"datetimeProvider","index":40,"field":"settleTime"}
  36 + # &feedbackCustomerId=25
  37 + # &departmentId=56
  38 + # &tagId=yjsp
  39 + # &settleTimeStart=2021-08-04 00:00:00
  40 + # &settleTimeEnd=2021-08-05 23:59:59
  41 + # &queryType=1'''
  42 + body = '''rows=10
  43 + &page=1
  44 + &sort=efb.payment_time
  45 + &order=desc
  46 + &metadata[payTime]={"provider":"datetimeProvider","index":10,"field":"payTime"}
  47 + &metadata[feebackAmount]={"provider":"moneyProvider","index":20,"field":"feebackAmount"}
  48 + &metadata[settledAmount]={"provider":"moneyProvider","index":30,"field":"settledAmount"}
  49 + &metadata[settleTime]={"provider":"datetimeProvider","index":40,"field":"settleTime"}
  50 + &feedbackCustomerId=25
  51 + &settleTimeStart=2021-08-04 00:00:00
  52 + &settleTimeEnd=2021-08-05 23:59:59
  53 + &queryType=1'''
  54 + def __init__(self):
  55 + self.url = feedbackOrderController_settlementlist.url.replace("http://test.",com.get_global_config("global_data", "environment", "en"))
  56 + self.header = feedbackOrderController_settlementlist.header
  57 + self.body = feedbackOrderController_settlementlist.body
  58 +
  59 +# focsl = feedbackOrderController_settlementlist()
  60 +# re = sy1.post(url = focsl.url,data = focsl.body.replace("\n",""),headers = focsl.header,proxies = my.proxies)
  61 +# print(re.json())
0 62 \ No newline at end of file
... ...
commons/api/feedback_customer_disable.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/7/30 9:56
  4 +@Auth : wlm
  5 +@File :test_feedback_customer_disable.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +返还人管理——禁用返还人
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import my
  13 +
  14 +class feedback_customer_disable():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/disable.action?id=44"
  16 +
  17 + header = {
  18 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "0",
  19 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  20 + "X-Requested-With": "XMLHttpRequest",
  21 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  22 + "Accept-Language": "zh-CN,zh;q=0.9",
  23 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
  24 + "Accept-Encoding": "gzip,deflate"
  25 + }
  26 +
  27 + def __init__(self):
  28 + self.url = feedback_customer_disable.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  29 + self.header = feedback_customer_disable.header
  30 +
  31 +
  32 +
  33 +# fcd = feedback_customer_disable()
  34 +# re = my.post(url=fcd.url, headers=fcd.header)
  35 +# print(re.json())
0 36 \ No newline at end of file
... ...
commons/api/feedback_customer_enable.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/3 8:56
  4 +@Auth : wlm
  5 +@File :test_feedback_customer_enable.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +返还人管理——启用返还人
  10 +"""
  11 +from commons import common as com
  12 +
  13 +class feedback_customer_enable():
  14 + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/enable.action?id=49"
  15 +
  16 + header = {
  17 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "0",
  18 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  19 + "X-Requested-With": "XMLHttpRequest",
  20 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  21 + "Accept-Language": "zh-CN,zh;q=0.9",
  22 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
  23 + "Accept-Encoding": "gzip,deflate"}
  24 +
  25 + def __init__(self):
  26 + self.url = feedback_customer_enable.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  27 + self.header = feedback_customer_enable.header
  28 +
  29 +# fce = feedback_customer_enable()
  30 +# re = my.post(url=fce.url, headers=fce.header)
  31 +# print(re.json())
0 32 \ No newline at end of file
... ...
commons/api/feedback_customer_query.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/3 9:11
  4 +@Auth : wlm
  5 +@File :test_feedback_customer_query.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +返还人管理——返还人列表查询
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import my,sy1
  13 +
  14 +class feedback_customer_query():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list.action"
  16 +
  17 + header = {
  18 + "Host": "test.jmsf.diligrp.com:8385",
  19 + "Connection": "keep-alive",
  20 + "Content-Length": "0",
  21 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  22 + "X-Requested-With": "XMLHttpRequest",
  23 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  24 + "Accept-Language": "zh-CN,zh;q=0.9",
  25 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list",
  26 + "Accept-Encoding": "gzip,deflate",
  27 + "Content-Type": "application/x-www-form-urlencoded",
  28 + }
  29 +
  30 + body = '''rows=10
  31 + &page=1
  32 + &sort=id
  33 + &order=desc
  34 + &metadata[created]={"provider":"datetimeProvider","index":10,"field":"created"}
  35 + &metadata[status]={"provider":"stateProvider","index":20,"field":"status"}
  36 + &name=潘婷婷
  37 + &createdStart=2021-08-11 00:00:00
  38 + &createdEnd=2021-08-11 23:59:59
  39 + '''
  40 +
  41 +
  42 + def __init__(self):
  43 + self.url = feedback_customer_query.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  44 + self.header = feedback_customer_query.header
  45 + self.body = feedback_customer_query.body
  46 + # print(self.body)
  47 +# feedback_customer_query = urllib.parse.urlencode(feedback_customer_query())
  48 +
  49 +# fcq = feedback_customer_query
  50 +# # # print(fcq.body)
  51 +# re = sy1.post(url = fcq.url, data = fcq.body.replace('\n',"").encode('utf-8'),headers = fcq.header,proxies = my.proxies)
  52 +# print(re.text)
0 53 \ No newline at end of file
... ...
commons/api/feedback_order_settlement.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/7/30 9:44
  4 +@Auth : wlm
  5 +@File :test_feedback_order_settlement.py
  6 +@IDE :PyCharm
  7 +"""
  8 +from commons import common as com
  9 +from commons.MySession import my,sy1
  10 +import requests
  11 +"""
  12 +结账管理——结账
  13 +"""
  14 +class feedback_order_settlement():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/doSettleAccount.action"
  16 + header = {
  17 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "190",
  18 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  19 + "X-Requested-With": "XMLHttpRequest",
  20 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  21 + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", "Accept-Language": "zh-CN,zh;q=0.9",
  22 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/list",
  23 + "Accept-Encoding": "gzip,deflate"
  24 + }
  25 + body = "id=25&cardNo=888810057654&settleAmount=2&ids=12034&feedbackCustomerId=25&feedbackCustomerName=验证员工推送到CRM&billIds=3621&settledAmounts=2"
  26 + # body1 = "id=25&cardNo=888810057654&settleAmount=2&ids=11960&feedbackCustomerId=25&feedbackCustomerName=验证员工推送到CRM&billIds=3509&settledAmounts=2"
  27 + def __init__(self):
  28 + self.url = feedback_order_settlement.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") )
  29 + self.header = feedback_order_settlement.header
  30 + self.body = feedback_order_settlement.body
  31 +
  32 +# fos=feedback_order_settlement()
  33 +# print(fos.url)
  34 +# print(fos.body)
  35 +# re=sy1.post(url=fos.url,headers=fos.header,data=fos.body.encode('utf-8'))
  36 +# print(re.json())
  37 +# print(re.headers)
0 38 \ No newline at end of file
... ...
commons/api/feedback_order_settlement_query.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +"""
  3 +@Time : 2021/8/3 15:58
  4 +@Auth : wlm
  5 +@File :test_feedback_order_settlement_query.py
  6 +@IDE :PyCharm
  7 +"""
  8 +"""
  9 +结账管理——列表查询
  10 +"""
  11 +from commons import common as com
  12 +from commons.MySession import my,sy1
  13 +
  14 +class feedback_order_settlement_query():
  15 + url = "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/list.action"
  16 +
  17 + header = {
  18 + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "496",
  19 + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385",
  20 + "X-Requested-With": "XMLHttpRequest",
  21 + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36",
  22 + "Content-Type": "application/x-www-form-urlencoded", "Accept-Language": "zh-CN,zh;q=0.9",
  23 + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackOrderController/list", "Accept-Encoding": "gzip,deflate"
  24 + }
  25 +
  26 + # body = '''page=1&order=desc&
  27 + # metadata[payTime]={"provider":"datetimeProvider","index":10,"field":"payTime"}
  28 + # &metadata[feebackAmount]={"provider":"moneyProvider","index":20,"field":"feebackAmount"}
  29 + # &metadata[unsettledAmount]={"provider":"moneyProvider","index":40,"field":"unsettledAmount"}
  30 + # &feedbackCustomerId=25&tagId=yjsp&queryType=2&keyword=苹果
  31 + # &payTimeStart=2021-07-22 00:00:00&payTimeEnd=2021-08-03 23:59:59'''
  32 +
  33 + body = '''page=1&order=desc
  34 + &metadata[payTime]={"provider":"datetimeProvider","index":10,"field":"payTime"}
  35 + &metadata[feebackAmount]={"provider":"moneyProvider","index":20,"field":"feebackAmount"}
  36 + &metadata[unsettledAmount]={"provider":"moneyProvider","index":40,"field":"unsettledAmount"}
  37 + &feedbackCustomerId=25&queryType=2&
  38 + &payTimeStart=2021-07-22 00:00:00&payTimeEnd=2021-08-03 23:59:59'''
  39 +
  40 + def __init__(self):
  41 + self.url = feedback_order_settlement_query.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  42 + self.header = feedback_order_settlement_query.header
  43 + self.body = feedback_order_settlement_query.body
  44 + # print(self.body)
  45 +
  46 +# fosq = feedback_order_settlement_query
  47 +# print(fosq.body)
  48 +# re = sy1.post(url = fosq.url, data = fosq.body.encode('utf-8'),headers = fosq.header)
  49 +# print(re.text)
  50 +# print(re.json())
... ...
commons/api/hpApi.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/12 17:04
  4 +# @Author : Ljq
  5 +# @File : hpApi.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +回皮相关接口
  10 +"""
  11 +
  12 +import json,time,random
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.MySession import my
  15 +from commons.api import zcApi
  16 +from commons.api import entranceFeeBillList as eFBL
  17 +
  18 +host = "http://test.gateway.diligrp.com:8285"
  19 +
  20 +def get_listBackSkinTrucks(session=None,host="",**kwargs):
  21 + """获取接车员信息"""
  22 + url = host + "/jmsf-web/api/jmsf/query/listBackSkinTrucks"
  23 + data = {"plate":"","number":"","customerName":""}
  24 + headers = dct.jsonCode()
  25 + data = dict(data, **kwargs)
  26 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  27 + return res
  28 +
  29 +def backSkinWeighSave(session=None,host="",**kwargs):
  30 + """获取接车员信息"""
  31 + url = host + "/jmsf-web/api/entrace/backSkinWeighSave"
  32 + data = {"hasStoreTruck": 1, "number": "202108120900052", "outGreeterId": 223, "outGreeterName": "测试沈阳",
  33 + "plate": "川B00001", "rail": 1, "tareWeight": 343.0, "tareWeightDate": "2021-08-12 17:18:19",
  34 + "weighImgs": [], "weighId": 0, "remark": "123", "carTypeWeight": 333.0, "trailerNumber": "川B00001",
  35 + "pathAddress": "A4-BB-6D-0A-F4-13", "bskinWithGoods": -1, "ic": "", "customerName": None, "customerId": 0,
  36 + "carTypeCode": "003", "carTypeId": 53, "carTypeName": "板车"}
  37 + headers = dct.jsonCode()
  38 + data = dict(data, **kwargs)
  39 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  40 + return res
  41 +
  42 +def do_backSkinWeighSave(session=None,host="",number=None,userName=None):
  43 + orderInfo = get_listBackSkinTrucks(session=session,host=host,number=number).json()["data"][0]
  44 + print(orderInfo)
  45 + # 参数
  46 + number=number
  47 + plate = orderInfo["plate"]
  48 + carTypeWeight=orderInfo["carTypeWeight"]
  49 + grossWeight=orderInfo["grossWeight"]
  50 + tareWeight=random.randint(carTypeWeight,grossWeight)
  51 + trailerNumber=orderInfo["trailerNumber"]
  52 + carTypeCode=orderInfo["carTypeCode"]
  53 + carTypeId=orderInfo["carTypeId"]
  54 + carTypeName=orderInfo["carTypeName"]
  55 + tareWeightDate=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  56 +
  57 + # 获取接车员信息
  58 + listByExample = zcApi.get_listByExample(session=session,host=host)
  59 + print(listByExample.json())
  60 + if userName == None:
  61 + listByExampleIndex = 0
  62 + else:
  63 + listByExampleIndex = listByExample.json()["data"].index(
  64 + [i for i in listByExample.json()["data"] if i["userName"] == userName][0])
  65 + outGreeterId = listByExample.json()["data"][listByExampleIndex]["id"]
  66 + outGreeterName = listByExample.json()["data"][listByExampleIndex]["realName"]
  67 +
  68 + res_HP = backSkinWeighSave(session=session,host=host,number=number,tareWeight=tareWeight,carTypeWeight=carTypeWeight,
  69 + plate=plate,trailerNumber=trailerNumber,carTypeCode=carTypeCode,
  70 + carTypeId=carTypeId,carTypeName=carTypeName,tareWeightDate=tareWeightDate,
  71 + outGreeterId=outGreeterId,outGreeterName=outGreeterName)
  72 + print(res_HP.json())
  73 + return res_HP,tareWeight
  74 +
  75 +
  76 +
  77 +# do_backSkinWeighSave(host=host,number="202108120900062")
  78 +
  79 +
  80 +
... ...
commons/api/sjApi.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/11 15:59
  4 +# @Author : Ljq
  5 +# @File : sjApi.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +散件
  10 +"""
  11 +
  12 +import json,time,random
  13 +from commons.scripts import dealContentType as dct
  14 +from commons.MySession import my
  15 +from commons.api import zcApi
  16 +from commons.api import entranceFeeBillList as eFBL
  17 +from commons.basic import getLookupList as gLL
  18 +
  19 +
  20 +def create_sparePartsWeighSave(session=None,host="",duplicateToken=None,**kwargs):
  21 + """查询证明类型
  22 + :param host:
  23 + :param **kwargs:
  24 + {
  25 + "driverTel": "",
  26 + "inGreeterId": 223,
  27 + "inGreeterName": "测试沈阳",
  28 + "itemWeight": 11,
  29 + "productId": 14158,
  30 + "productName": "雪莲果",
  31 + "proveTypeCode": 665,
  32 + "proveTypeName": "食品安全",
  33 + "qty": 33,
  34 + "weighRemark": null,
  35 + "weight": 363,
  36 + "weighmanRecord": {
  37 + "grossWeight": null,
  38 + "grossWeightDate": null,
  39 + "newWeight": null,
  40 + "tareWeight": null,
  41 + "tareWeightDate": null,
  42 + "weighImgs": []
  43 + },
  44 + "productCode": null,
  45 + "plate": "ASD",
  46 + "carTypeId": 53,
  47 + "carTypeCode": "003",
  48 + "carTypeName": "板车",
  49 + "pathAddress": "A4-BB-6D-0A-F4-13",
  50 + "entryPlateInputType": 1,
  51 + "feeDepId": 0,
  52 + "feeDepName": null,
  53 + "dep": 58,
  54 + "depName": "水果部",
  55 + "notice": 0,
  56 + "backSkinTwo": -1,
  57 + "recordOriginId": 0,
  58 + "recordOriginName": null,
  59 + "recordProductId": 0,
  60 + "recordProductName": null,
  61 + "recordWeight": null,
  62 + "codeIc": null,
  63 + "codeId": 0,
  64 + "difference": 0,
  65 + "bindRecordSign": 0,
  66 + "recordDesc": null,
  67 + "hasCodeItems": false,
  68 + "type": 2,
  69 + "tradeTypeId": 70,
  70 + "tradeType": "9001",
  71 + "tradeTypeName": "沈阳1号",
  72 + "goodsTagId": 663,
  73 + "originId": 500101,
  74 + "origin": "万州区",
  75 + "originCode": "023"l
  76 + }
  77 + :return:"""
  78 + url = host + "/jmsf-web/api/entrace/sparePartsWeighSave"
  79 + # data = {"driverTel":"","inGreeterId":223,"inGreeterName":"测试沈阳","itemWeight":11,"productId":14158,"productName":"雪莲果","proveTypeCode":665,"proveTypeName":"食品安全","qty":33,"weighRemark":None,"weight":363,"weighmanRecord":{"grossWeight":None,"grossWeightDate":None,"newWeight":None,"tareWeight":None,"tareWeightDate":None,"weighImgs":[]},"productCode":None,"plate":"ASD","carTypeId":53,"carTypeCode":"003","carTypeName":"板车","pathAddress":"A4-BB-6D-0A-F4-13","entryPlateInputType":1,"feeDepId":0,"feeDepName":None,"dep":58,"depName":"水果部","notice":0,"backSkinTwo":-1,"recordOriginId":0,"recordOriginName":None,"recordProductId":0,"recordProductName":None,"recordWeight":None,"codeIc":None,"codeId":0,"difference":0,"bindRecordSign":0,"recordDesc":None,"hasCodeItems":False,"type":2,"tradeTypeId":70,"tradeType":"9001","tradeTypeName":"沈阳1号","goodsTagId":663,"originId":500101,"origin":"万州区","originCode":"023"}
  80 + data = {"driverTel": "", "inGreeterId": 223, "inGreeterName": "测试沈阳", "itemWeight": 11, "productId": 14158,
  81 + "productName": "雪莲果", "proveTypeCode": 665, "proveTypeName": "食品安全", "qty": 33, "weighRemark": None,
  82 + "weight": 363,
  83 + "weighmanRecord": {"grossWeight": None, "grossWeightDate": None, "newWeight": None, "tareWeight": None,
  84 + "tareWeightDate": None, "weighImgs": []}, "productCode": None, "plate": "ASD",
  85 + "carTypeId": 53, "carTypeCode": "003", "carTypeName": "板车", "pathAddress": "A4-BB-6D-0A-F4-13",
  86 + "entryPlateInputType": 1, "feeDepId": 0, "feeDepName": None, "dep": 58, "depName": "水果部", "notice": 0,
  87 + "backSkinTwo": -1, "recordOriginId": 0, "recordOriginName": None, "recordProductId": 0,
  88 + "recordProductName": None, "recordWeight": None, "codeIc": None, "codeId": 0, "difference": 0,
  89 + "bindRecordSign": 0, "recordDesc": None, "hasCodeItems": False, "type": 2, "tradeTypeId": 70,
  90 + "tradeType": "9001", "tradeTypeName": "沈阳1号", "goodsTagId": 663, "originId": 500101, "origin": "万州区",
  91 + "originCode": "023"}
  92 + headers = dct.jsonCode()
  93 + headers["jmsf_duplicate_commit_token"] = duplicateToken
  94 + data = dict(data, **kwargs)
  95 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  96 + return res
  97 +
  98 +def create_sj(session=None,host=None,carTypeName=None,keyword="蔬菜",userName=None,transactionName=None,
  99 + plate="川A12345",goodsTagName=None,depName=None,proveName=None,itemWeight="10",qty="22"):
  100 + """
  101 +
  102 + """
  103 + # 模板获取
  104 + templateAttr_list = gLL.get_templateAttr(session=session,host=host,moduleCode="SJ")
  105 + print(templateAttr_list)
  106 +
  107 + # 获取车型
  108 + if "车型" in templateAttr_list:
  109 + carType = zcApi.get_carType(session=session,host=host)
  110 + print(carType.text)
  111 + if carTypeName == None:
  112 + carTypeIndex = 0
  113 + else:
  114 + carTypeIndex = carType.json()["data"].index(
  115 + [i for i in carType.json()["data"] if i["carTypeName"] == carTypeName][0])
  116 + carTypeCode = carType.json()["data"][carTypeIndex]["code"]
  117 + carTypeId = carType.json()["data"][carTypeIndex]["id"]
  118 + carTypeName = carType.json()["data"][carTypeIndex]["carTypeName"]
  119 + carTypeWeight = carType.json()["data"][carTypeIndex]["weight"]
  120 + else:
  121 + carTypeCode = ""
  122 + carTypeId = ""
  123 + carTypeName = ""
  124 + carTypeWeight = ""
  125 +
  126 +
  127 + # 获取商品
  128 + if "商品" in templateAttr_list or "商品(末级)" in templateAttr_list:
  129 + categoryByCondition = zcApi.get_listCategoryByCondition(session=session,host=host, keyword=keyword)
  130 + cateId = categoryByCondition.json()["data"][0]["id"]
  131 + productId = categoryByCondition.json()["data"][0]["id"]
  132 + productName = categoryByCondition.json()["data"][0]["name"]
  133 + # productCode = categoryByCondition.json()["data"][0]["keycode"]
  134 + else:
  135 + cateId = ""
  136 + productId = ""
  137 + productName = ""
  138 +
  139 +
  140 + # 获取接车员信息
  141 + if "进门接车员" in templateAttr_list:
  142 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  143 + firmId = session.userInfo["data"]["user"]["firmId"]
  144 +
  145 + try:
  146 + res_config = gLL.get_config(session=session,host=host, marketId=firmId)
  147 + departmentId = [i["value"] for i in res_config.json()["rows"] if i["name"] == "DepartmentId"][0]
  148 + except:
  149 + departmentId = None
  150 + # print("==========1============")
  151 + # print(session.userInfo["data"]["user"])
  152 + # print(firmCode)
  153 + # print(departmentId)
  154 + # print("==========1============")
  155 + listByExample = zcApi.get_listByExample(session=session,host=host,firmCode=firmCode,departmentId=departmentId)
  156 + print("listByExample",listByExample.json())
  157 + if userName == None:
  158 + listByExampleIndex = 0
  159 + else:
  160 + listByExampleIndex = listByExample.json()["data"].index(
  161 + [i for i in listByExample.json()["data"] if i["userName"] == userName][0])
  162 + inGreeterId = listByExample.json()["data"][listByExampleIndex]["id"]
  163 + inGreeterName = listByExample.json()["data"][listByExampleIndex]["realName"]
  164 + else:
  165 + inGreeterId=""
  166 + inGreeterName = ""
  167 +
  168 + # if "进门接车员" in templateAttr_list:
  169 + # listByExample = zcApi.get_listByExample(host=host)
  170 + # print(listByExample.json())
  171 + # if userName == None:
  172 + # listByExampleIndex = 0
  173 + # else:
  174 + # listByExampleIndex = listByExample.json()["data"].index(
  175 + # [i for i in listByExample.json()["data"] if i["userName"] == userName][0])
  176 + # inGreeterId = listByExample.json()["data"][listByExampleIndex]["id"]
  177 + # inGreeterName = listByExample.json()["data"][listByExampleIndex]["realName"]
  178 + # else:
  179 + # inGreeterId = ""
  180 + # inGreeterName = ""
  181 +
  182 + # 获取交易类型
  183 + if "交易类型" in templateAttr_list:
  184 + transactionType = zcApi.query_transactionType(session=session,host=host)
  185 + print(transactionType.json())
  186 + print("交易类型")
  187 + if transactionName == None:
  188 + transactionTypeIndex = 0
  189 + else:
  190 + transactionTypeIndex = transactionType.json()["rows"].index(
  191 + [i for i in transactionType.json()["rows"] if i["name"] == transactionName][0])
  192 + tradeType = transactionType.json()["rows"][transactionTypeIndex]["code"]
  193 + tradeTypeId = transactionType.json()["rows"][transactionTypeIndex]["id"]
  194 + tradeTypeName = transactionType.json()["rows"][transactionTypeIndex]["name"]
  195 + else:
  196 + tradeType = ""
  197 + tradeTypeId = ""
  198 + tradeTypeName = ""
  199 +
  200 + # 获取货物标签
  201 + if "货物标签" in templateAttr_list:
  202 + goodsTag = zcApi.get_goodsTag(session=session,host=host)
  203 + print(goodsTag.json())
  204 + if goodsTagName == None:
  205 + transactionTypeIndex = 0
  206 + else:
  207 + transactionTypeIndex = goodsTag.json()["data"].index(
  208 + [i for i in goodsTag.json()["data"] if i["name"] == goodsTagName][0])
  209 + goodsTagId = goodsTag.json()["data"][transactionTypeIndex]["id"]
  210 + else:
  211 + goodsTagId = ""
  212 +
  213 + # 产地信息获取
  214 + if "产地" in templateAttr_list:
  215 + address = zcApi.get_address(session=session,host=host)
  216 + print(address.json())
  217 + originId = address.json()["data"][0]["id"]
  218 + origin = address.json()["data"][0]["name"]
  219 + originCode = address.json()["data"][0]["cityCode"]
  220 + else:
  221 + originId = ""
  222 + origin = ""
  223 + originCode = ""
  224 +
  225 + # 查询部门信息
  226 + # 查询部门信息
  227 + if "接车部门" in templateAttr_list or "收费部门" in templateAttr_list:
  228 + depRes = zcApi.get_dep(session=session,host=host)
  229 + print(depRes.json())
  230 + if depName == None:
  231 + depResIndex = 0
  232 + else:
  233 + depResIndex = depRes.json()["data"].index(
  234 + [i for i in depRes.json()["data"] if i["name"] == depName][0])
  235 + feeDepId = depRes.json()["data"][depResIndex]["id"]
  236 + feeDepName = depRes.json()["data"][depResIndex]["name"]
  237 + else:
  238 + feeDepId = ""
  239 + feeDepName = ""
  240 +
  241 + # 获取证明类型
  242 + if "证明类型" in templateAttr_list:
  243 + proveType = zcApi.get_proveType(session=session,host=host)
  244 + print(proveType.json())
  245 + # print("proveName",proveName)
  246 + if proveName == None:
  247 + proveTypeIndex = 0
  248 + else:
  249 + proveTypeIndex = proveType.json()["data"].index(
  250 + [i for i in proveType.json()["data"] if i["name"] == proveName][0])
  251 + proveTypeCode = proveType.json()["data"][proveTypeIndex]["id"]
  252 + proveTypeName = proveType.json()["data"][proveTypeIndex]["name"]
  253 + else:
  254 + proveTypeCode = ""
  255 + proveTypeName = ""
  256 + print("proveTypeCode", proveTypeCode)
  257 + print("proveTypeName", proveTypeName)
  258 +
  259 + # 获取防重token
  260 + duplicateTokenRes = zcApi.get_duplicateToken(session=session,host=host)
  261 + print(duplicateTokenRes.json())
  262 + duplicateToken = duplicateTokenRes.json()["data"]
  263 +
  264 + # 创建生成进门单
  265 + plate = plate
  266 + productState = "1"
  267 + trailerNumber = plate
  268 +
  269 + # 重量信息准备
  270 + weight = int(itemWeight)*int(qty)
  271 +
  272 + # 创建进门单
  273 + cre_res = create_sparePartsWeighSave(session=session,host=host, duplicateToken=duplicateToken,
  274 + carTypeCode=carTypeCode, carTypeId=carTypeId,
  275 + carTypeName=carTypeName, plate=plate,weight=weight,
  276 + productId=productId, productName=productName, proveTypeCode=proveTypeCode,
  277 + proveTypeName=proveTypeName, trailerNumber=trailerNumber, depName=feeDepName,
  278 + cateId=cateId, originId=originId, origin=origin, originCode=originCode,
  279 + tradeType=tradeType, tradeTypeName=tradeTypeName, productState=productState,
  280 + tradeTypeId=tradeTypeId, goodsTagId=goodsTagId, inGreeterId=inGreeterId,
  281 + inGreeterName=inGreeterName, dep=feeDepId)
  282 + return cre_res
  283 +
  284 +# host="http://test.gateway.diligrp.com:8285"
  285 +# cre_res = create_sj(host=host,keyword="雪莲果")
  286 +# print(cre_res.json())
  287 +# number = cre_res.json()["data"]["number"]
  288 +# aa = eFBL.do_payOrder(attrValue=number)
0 289 \ No newline at end of file
... ...
commons/api/weighingServiceSave.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import my,sy1,heb
  6 +from commons.basic.duplicateToken import duplicateToken
  7 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  8 +
  9 +
  10 +class weighingServiceSave():
  11 + "称重服务"
  12 + url = "http://test.gateway.diligrp.com:8285/jmsf-web/api/entrace/weighingServiceSave"
  13 + header = {
  14 + "jmsf_duplicate_commit_token": "demo",
  15 + "UAP_accessToken": "demo",
  16 + "UAP_refreshToken": "demo",
  17 + "UAP_firmId": "9",
  18 + "Content-Type": "application/json",
  19 + "Host": "test.gateway.diligrp.com:8285",
  20 + "Content-Length": "453"}
  21 + body = {
  22 + "carTypeId": 128,
  23 + "carTypeName": "玉玺",
  24 + "carTypeCode": "888",
  25 + "driverTel": "16111111111",
  26 + "fee": "18.00",
  27 + "greeterId": 0,
  28 + "greeterName": None,
  29 + "plate": "京A666666",
  30 + "remark": "test_称重服务接口测试",
  31 + "weighImgs": [],
  32 + "weight": 10.0,
  33 + "weightDate": "2021-07-29 15:50:26",
  34 + "pathAddress": "40-5B-D8-DF-CA-C7",
  35 + "entryPlateInputType": 1,
  36 + "customerType": 0,
  37 + "carryStatus": 0,
  38 + "customerName": None,
  39 + "pwd": "",
  40 + "totalPrice": 18.00,
  41 + "ic": "",
  42 + "customerId": 0,
  43 + "accountId": 0,
  44 + "protocolId": None}
  45 +
  46 + def __init__(self,market):
  47 + self.market=market
  48 + self.url = weighingServiceSave.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  49 + self.header = weighingServiceSave.header
  50 + self.header["UAP_accessToken"] = self.market.cookies["UAP_accessToken"]
  51 + self.header["UAP_refreshToken"] = self.market.cookies["UAP_refreshToken"]
  52 + self.header["UAP_firmId"] = self.market.cookies["UAP_firmId"]
  53 + self.header["Host"] = com.get_global_config("global_data", "host", "gateway")
  54 +
  55 + def refresh_commit_token(self):
  56 + self.header["jmsf_duplicate_commit_token"] = duplicateToken(self.market).jmsf_duplicate_commit_token()
  57 +
  58 +
  59 +
  60 +# tt=weighingServiceSave(heb)
  61 +# tt.refresh_commit_token()
  62 +# re=heb.post(url=tt.url,headers=tt.header,json=tt.body)
  63 +# print(re.json())
  64 +# print(heb.user.sort())
  65 +# print(sy1.user.sort())
0 66 \ No newline at end of file
... ...
commons/api/weightBizBill_doRefund.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import my,sy1
  6 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  7 +
  8 +
  9 +class weightBizBill_doRefund():
  10 + "称重服务单列表-退款"
  11 + url = "http://test.jmsf.diligrp.com:8385/weightBizBill/doRefund.action"
  12 + header = {
  13 + "Connection": "keep-alive",
  14 + "Accept": "application/json, text/javascript, */*; q=0.01",
  15 + "X-Requested-With": "XMLHttpRequest",
  16 + "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
  17 + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  18 + "Accept-Language": "zh-CN,zh;q=0.9",
  19 + "Accept-Encoding": "gzip, deflate"}
  20 + body = "id=206&reason=退款原因_test_123"
  21 +
  22 + def __init__(self):
  23 + self.url = weightBizBill_doRefund.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  24 + self.header = weightBizBill_doRefund.header
  25 + self.body = weightBizBill_doRefund.body
  26 +
  27 +
  28 +
  29 +# tt=weightBizBill_doRefund()
  30 +# re=sy1.post(url=tt.url,headers=tt.header,json=tt.body)
  31 +# print(re.json())
0 32 \ No newline at end of file
... ...
commons/api/weightBizBill_listPage.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import my,sy1
  6 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  7 +
  8 +
  9 +class weightBizBill_listPage():
  10 + "称重服务单列表-查询"
  11 + url = "http://test.jmsf.diligrp.com:8385/weightBizBill/listPage.action"
  12 + header = {
  13 + "Connection": "keep-alive",
  14 + "Accept": "application/json, text/javascript, */*; q=0.01",
  15 + "X-Requested-With": "XMLHttpRequest",
  16 + "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
  17 + "Content-Type": "application/x-www-form-urlencoded",
  18 + "Accept-Language": "zh-CN,zh;q=0.9",
  19 + "Accept-Encoding": "gzip, deflate"}
  20 + body = '''rows=10&page=1&sort=id&order=desc&metadata[fee]={"provider":"moneyProvider","index":10,"field":
  21 + "fee"}&metadata[created]={"provider":"datetimeProvider","index":20,"field":
  22 + "created"}&metadata[payTime]={"provider":"datetimeProvider","index":30,"field":"payTime"}
  23 + &metadata[status]={"provider":"weightPayStateProvider","index":40,"field":"status"}
  24 + &metadata[refundTime]={"provider":"datetimeProvider","index":50,"field":"refundTime"}
  25 + &metadata[payType]={"provider":"weightPayTypeProvider","index":60,"field":"payType"}
  26 + &attr=number&attrValue=202108030900001&carTypeId=53&depId=139&status=2
  27 + &startCreateDate=2020-08-03 00:00:00&endCreateDate=2029-08-03 23:59:59
  28 + &startPayTime=2020-08-03 00:00:00&endPayTime=2029-08-03 23:59:59'''
  29 +
  30 + def __init__(self):
  31 + self.url = weightBizBill_listPage.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  32 + self.header = weightBizBill_listPage.header
  33 + self.body = weightBizBill_listPage.body.replace('\n', '')
  34 +
  35 +
  36 +# tt=weightBizBill_listPage()
  37 +# re=sy1.post(url=tt.url,headers=tt.header,data=tt.body)
  38 +# print(re.json())
0 39 \ No newline at end of file
... ...
commons/api/zcApi.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/7/28 11:14
  4 +# @Author : Ljq
  5 +# @File : zcApi.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +整车进门相关接口
  10 +1.整车进门基础接口封装
  11 +2.整车进门create_jmsf进门单一步创建接口封装
  12 +"""
  13 +
  14 +import json,time,random
  15 +from commons.scripts import dealContentType as dct
  16 +# from commons.MySession import my
  17 +from commons.basic import getLookupList as gLL
  18 +
  19 +
  20 +def get_carType(session=None,host="",**kwargs):
  21 + """车型获取"""
  22 + url = host + "/jmsf-web/api/jmsf/query/listCarType"
  23 + data = {"businessCode":"jmsf"}
  24 + headers = dct.jsonCode()
  25 + data = dict(data, **kwargs)
  26 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  27 + return res
  28 +
  29 +def get_listCategoryByCondition(session=None,host="",**kwargs):
  30 + """商品获取"""
  31 + url = host + "/assets-service/api/cusCategory/getTree"
  32 + # marketId = session.userInfo()[]
  33 + data = {"marketId":9,"state":1,"keyword":"蔬菜"}
  34 + headers = dct.jsonCode()
  35 + data = dict(data, **kwargs)
  36 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  37 + return res
  38 +
  39 +def get_listByExample(session=None,host="",**kwargs):
  40 + """获取接车员信息"""
  41 + url = host + "/dili-uap/userApi/listByExample.api"
  42 + data = {"firmCode":"sy","departmentId":58,"keyword":""}
  43 + headers = dct.jsonCode()
  44 + data = dict(data, **kwargs)
  45 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  46 + return res
  47 +
  48 +def get_proveType(session=None,host="",**kwargs):
  49 + """查询证明类型"""
  50 + url = host + "/jmsf-web/api/jmsf/query/listCodeByPid"
  51 + data = {"pid":"prove_type"}
  52 + headers = dct.jsonCode()
  53 + data = dict(data, **kwargs)
  54 + res = session.useHeadersRequests(method="get", url=url, params=json.loads(json.dumps(data)), headers=headers)
  55 + return res
  56 +
  57 +def query_transactionType(session=None,host="",**kwargs):
  58 + """查交易类型"""
  59 + url = host + "/assets-service/api/tradeType/query"
  60 + data = {"pageNum":100,"pageSize":100,"marketId":9}
  61 + headers = dct.jsonCode()
  62 + data = dict(data, **kwargs)
  63 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  64 + return res
  65 +
  66 +def get_goodsTag(session=None,host="",**kwargs):
  67 + """获取货物标签"""
  68 + url = host + "/jmsf-web/api/jmsf/query/listCodeByPid"
  69 + data = {"pid":"goods_tag"}
  70 + headers = dct.jsonCode()
  71 + data = dict(data, **kwargs)
  72 + res = session.useHeadersRequests(method="get", url=url, params=json.loads(json.dumps(data)), headers=headers)
  73 + return res
  74 +
  75 +def get_address(session=None,host="",**kwargs):
  76 + """产地获取"""
  77 + url = host + "/jmsf-web/api/jmsf/query/address"
  78 + data = {"province":"C","city":None,"area":None}
  79 + headers = dct.jsonCode()
  80 + data = dict(data, **kwargs)
  81 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  82 + return res
  83 +
  84 +def get_dep(session=None,host="",**kwargs):
  85 + """获取部门信息"""
  86 + url = host + "/jmsf-web/api/jmsf/query/dep"
  87 + data = {"keyword":""}
  88 + headers = dct.jsonCode()
  89 + data = dict(data, **kwargs)
  90 + res = session.useHeadersRequests(method="get", url=url, params=data, headers=headers)
  91 + return res
  92 +
  93 +
  94 +
  95 +def get_duplicateToken(session=None,host=""):
  96 + """进门防重接口"""
  97 + url = host + "/jmsf-web/appCommon/duplicateToken.action"
  98 + headers = dct.jsonCode()
  99 + res = session.useHeadersRequests(method="get", url=url, headers=headers)
  100 + return res
  101 +
  102 +
  103 +def create_wholeCarWeighSave(session=None,host="",duplicateToken=None,**kwargs):
  104 + """查询证明类型
  105 + :param host:
  106 + :param **kwargs:
  107 + {
  108 + "carTypeCode": "${carTypeCode}",
  109 + "carTypeId": ${carTypeId},
  110 + "carTypeName": "${carTypeName}",
  111 + "carTypeWeight": ${carTypeWeight},
  112 + "plate": "${plate}",
  113 + "inGreeterId": 0,
  114 + "inGreeterName": null,
  115 + "productId": ${productId},
  116 + "productName": "${productName}",
  117 + "proveTypeCode": ${proveTypeCode},
  118 + "proveTypeName": "${proveTypeName}",
  119 + "weighRemark": "",
  120 + "weighmanRecord": {
  121 + "grossWeight": ${grossWeight},
  122 + "grossWeightDate": "${grossWeightDate}",
  123 + "newWeight":${grossWeight},
  124 + "tareWeight": ${tareWeight},
  125 + "tareWeightDate": null,
  126 + "weighImgs": []
  127 + },
  128 + "productCode": null,
  129 + "trailerNumber": "${plate}",
  130 + "pathAddress": "A4-BB-6D-0A-F4-13",
  131 + "haveTruckWeight": false,
  132 + "source": 4,
  133 + "entryPlateInputType": 1,
  134 + "dep": ${feeDepId},
  135 + "depName": "${feeDepName}",
  136 + "cateId": ${cateId},
  137 + "notice": 0,
  138 + "backSkinTwo": -1,
  139 + "recordOriginId": 0,
  140 + "recordOriginName": null,
  141 + "recordProductId": 0,
  142 + "recordProductName": null,
  143 + "recordWeight": null,
  144 + "codeIc": null,
  145 + "codeId": 0,
  146 + "difference": 0,
  147 + "bindRecordSign": 0,
  148 + "recordDesc": null,
  149 + "hasCodeItems": false,
  150 + "customerId": 0,
  151 + "customerName": "",
  152 + "driverIc": "",
  153 + "driverName": "",
  154 + "totalPrice": null,
  155 + "originId": ${originId},
  156 + "origin": "${origin}",
  157 + "originCode": "${originCode}",
  158 + "tradeType": "${tradeType}",
  159 + "tradeTypeName": "${tradeTypeName}",
  160 + "weight": ${grossWeight},
  161 + "pwd": "",
  162 + "type": 1,
  163 + "ic": "",
  164 + "boothNumber": "210622124244",
  165 + "productState": ${productState},
  166 + "accountId": 0,
  167 + "passCheckId": 0,
  168 + "passCheckName": null,
  169 + "tradeTypeId": ${tradeTypeId},
  170 + "id": 0,
  171 + "protocolId": null,
  172 + "goodsTagId": ${goodsTagId}
  173 + }
  174 + :return:"""
  175 + url = host + "/jmsf-web/api/entrace/wholeCarWeighSave"
  176 + data = {"carTypeCode": "003", "carTypeId": 53, "carTypeName": "板车", "carTypeWeight": 333, "plate": "213123",
  177 + "inGreeterId": 223, "inGreeterName": "测试沈阳", "productId": 14152, "productName": "蔬菜", "proveTypeCode": 665,
  178 + "proveTypeName": "食品安全", "weighRemark": "备注",
  179 + "weighmanRecord": {"grossWeight": 3.0, "grossWeightDate": "2021-07-28 16:28:24", "newWeight": 2.0,
  180 + "tareWeight": 1.0, "tareWeightDate": None, "weighImgs": []}, "productCode": None,
  181 + "trailerNumber": "", "pathAddress": "A4-BB-6D-0A-F4-13", "haveTruckWeight": False, "source": 4,
  182 + "entryPlateInputType": 1, "dep": 58, "depName": "水果部", "cateId": 14152, "notice": 0, "backSkinTwo": -1,
  183 + "recordOriginId": 0, "recordOriginName": None, "recordProductId": 0, "recordProductName": None,
  184 + "recordWeight": None, "codeIc": None, "codeId": 0, "difference": 0, "bindRecordSign": 0, "recordDesc": None,
  185 + "hasCodeItems": False, "customerId": 0, "customerName": "", "driverIc": None, "driverName": None,
  186 + "totalPrice": None, "originId": 500101, "origin": "万州区", "originCode": "023", "tradeType": "9001",
  187 + "tradeTypeName": "沈阳1号", "weight": 2.0, "pwd": "", "type": 1, "ic": "", "boothNumber": "210728154359",
  188 + "productState": 1, "accountId": 0, "passCheckId": 0, "passCheckName": None, "tradeTypeId": 70, "id": 0,
  189 + "protocolId": None, "goodsTagId": 663}
  190 + headers = dct.jsonCode()
  191 + headers["jmsf_duplicate_commit_token"] = duplicateToken
  192 + data = dict(data, **kwargs)
  193 + res = session.useHeadersRequests(method="POST", url=url, data=json.dumps(data), headers=headers)
  194 + return res
  195 +
  196 +def create_jmsf(session=None,host=None,carTypeName=None,keyword="蔬菜",userName=None,transactionName=None,
  197 + newWeight=99,plate="川A12345",goodsTagName=None,depName=None,proveName=None):
  198 + """
  199 +
  200 + """
  201 + templateAttr_list = gLL.get_templateAttr(session=session,host=host)
  202 + print(templateAttr_list)
  203 + # 获取车型
  204 + if "车型" in templateAttr_list:
  205 + carType = get_carType(session=session,host=host)
  206 + if carTypeName == None:
  207 + carTypeIndex = 0
  208 + else:
  209 + carTypeIndex = carType.json()["data"].index(
  210 + [i for i in carType.json()["data"] if i["carTypeName"] == carTypeName][0])
  211 + carTypeCode = carType.json()["data"][carTypeIndex]["code"]
  212 + carTypeId = carType.json()["data"][carTypeIndex]["id"]
  213 + carTypeName = carType.json()["data"][carTypeIndex]["carTypeName"]
  214 + carTypeWeight = carType.json()["data"][carTypeIndex]["weight"]
  215 + else:
  216 + carTypeCode = ""
  217 + carTypeId = ""
  218 + carTypeName = ""
  219 + carTypeWeight = ""
  220 +
  221 + # 获取商品
  222 + if "商品" in templateAttr_list or "商品(末级)" in templateAttr_list:
  223 + categoryByCondition = get_listCategoryByCondition(session=session,host=host, keyword=keyword)
  224 + cateId = categoryByCondition.json()["data"][0]["id"]
  225 + productId = categoryByCondition.json()["data"][0]["id"]
  226 + productName = categoryByCondition.json()["data"][0]["name"]
  227 + # productCode = categoryByCondition.json()["data"][0]["keycode"]
  228 + else:
  229 + cateId = ""
  230 + productId = ""
  231 + productName = ""
  232 + productCode = ""
  233 +
  234 + # 获取接车员信息
  235 + if "进门接车员" in templateAttr_list:
  236 + firmCode = session.userInfo["data"]["user"]["firmCode"]
  237 + firmId = session.userInfo["data"]["user"]["firmId"]
  238 +
  239 + try:
  240 + res_config = gLL.get_config(host=host, marketId=firmId)
  241 + departmentId = [i["value"] for i in res_config.json()["rows"] if i["name"] == "DepartmentId"][0]
  242 + except:
  243 + departmentId = None
  244 + # print("==========1============")
  245 + # print(session.userInfo["data"]["user"])
  246 + # print(firmCode)
  247 + # print(departmentId)
  248 + # print("==========1============")
  249 + listByExample = get_listByExample(session=session,host=host,firmCode=firmCode,departmentId=departmentId)
  250 + print("listByExample",listByExample.json())
  251 + if userName == None:
  252 + listByExampleIndex = 0
  253 + else:
  254 + listByExampleIndex = listByExample.json()["data"].index(
  255 + [i for i in listByExample.json()["data"] if i["userName"] == userName][0])
  256 + inGreeterId = listByExample.json()["data"][listByExampleIndex]["id"]
  257 + inGreeterName = listByExample.json()["data"][listByExampleIndex]["realName"]
  258 + else:
  259 + inGreeterId=""
  260 + inGreeterName = ""
  261 +
  262 + # 获取交易类型
  263 + if "交易类型" in templateAttr_list:
  264 + transactionType = query_transactionType(session=session,host=host)
  265 + if transactionName == None:
  266 + transactionTypeIndex = 0
  267 + else:
  268 + transactionTypeIndex = transactionType.json()["rows"].index(
  269 + [i for i in transactionType.json()["rows"] if i["name"] == transactionName][0])
  270 + tradeType = transactionType.json()["rows"][transactionTypeIndex]["code"]
  271 + tradeTypeId = transactionType.json()["rows"][transactionTypeIndex]["id"]
  272 + tradeTypeName = transactionType.json()["rows"][transactionTypeIndex]["name"]
  273 + else:
  274 + tradeType = ""
  275 + tradeTypeId = ""
  276 + tradeTypeName = ""
  277 +
  278 + # 获取货物标签
  279 + if "货物标签" in templateAttr_list:
  280 + goodsTag = get_goodsTag(session=session,host=host)
  281 + if goodsTagName == None:
  282 + transactionTypeIndex = 0
  283 + else:
  284 + transactionTypeIndex = goodsTag.json()["data"].index(
  285 + [i for i in goodsTag.json()["data"] if i["name"] == goodsTagName][0])
  286 + goodsTagId = goodsTag.json()["data"][transactionTypeIndex]["id"]
  287 + else:
  288 + goodsTagId = ""
  289 +
  290 + # 产地信息获取
  291 + if "产地" in templateAttr_list:
  292 + address = get_address(session=session,host=host)
  293 + originId = address.json()["data"][0]["id"]
  294 + origin = address.json()["data"][0]["name"]
  295 + originCode = address.json()["data"][0]["cityCode"]
  296 + else:
  297 + originId = ""
  298 + origin = ""
  299 + originCode = ""
  300 +
  301 + # 查询部门信息
  302 + if "接车部门" in templateAttr_list or "收费部门" in templateAttr_list:
  303 + depRes = get_dep(session=session,host=host)
  304 + print("depRes",depRes.json())
  305 + if depName == None:
  306 + depResIndex = 0
  307 + else:
  308 + depResIndex = depRes.json()["data"].index(
  309 + [i for i in depRes.json()["data"] if i["name"] == depName][0])
  310 + feeDepId = depRes.json()["data"][depResIndex]["id"]
  311 + feeDepName = depRes.json()["data"][depResIndex]["name"]
  312 + else:
  313 + feeDepId = ""
  314 + feeDepName = ""
  315 +
  316 + # 获取证明类型
  317 + if "证明类型" in templateAttr_list:
  318 + proveType = get_proveType(session=session,host=host)
  319 + print(proveType.json())
  320 + # print("proveName",proveName)
  321 + if proveName == None:
  322 + proveTypeIndex = 0
  323 + else:
  324 + proveTypeIndex = proveType.json()["data"].index(
  325 + [i for i in proveType.json()["data"] if i["name"] == proveName][0])
  326 + proveTypeCode = proveType.json()["data"][proveTypeIndex]["id"]
  327 + proveTypeName = proveType.json()["data"][proveTypeIndex]["name"]
  328 + else:
  329 + proveTypeCode = ""
  330 + proveTypeName = ""
  331 +
  332 + # 获取防重token
  333 + duplicateTokenRes = get_duplicateToken(session=session,host=host)
  334 + print(duplicateTokenRes.json())
  335 + duplicateToken = duplicateTokenRes.json()["data"]
  336 +
  337 + # 创建生成进门单
  338 + plate = plate
  339 + productState = "1"
  340 + trailerNumber = plate
  341 +
  342 + # 重量信息准备
  343 + newWeight = newWeight
  344 + tareWeight = carTypeWeight
  345 + weighmanRecord = {"grossWeight": None, "grossWeightDate": "", "newWeight": None, "tareWeight": None,
  346 + "tareWeightDate": None, "weighImgs": []}
  347 + weighmanRecord["grossWeight"] = carTypeWeight+newWeight
  348 + weighmanRecord["tareWeight"] = carTypeWeight
  349 + weighmanRecord["newWeight"] = newWeight
  350 + print("weighmanRecord",weighmanRecord)
  351 + weighmanRecord["grossWeightDate"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
  352 +
  353 + # 创建进门单
  354 + cre_res = create_wholeCarWeighSave(session=session,host=host, duplicateToken=duplicateToken,
  355 + carTypeCode=carTypeCode, carTypeId=carTypeId,
  356 + carTypeName=carTypeName, carTypeWeight=carTypeWeight, plate=plate,
  357 + productId=productId, productName=productName, proveTypeCode=proveTypeCode,
  358 + proveTypeName=proveTypeName, trailerNumber=trailerNumber, depName=feeDepName,
  359 + cateId=cateId, originId=originId, origin=origin, originCode=originCode,
  360 + tradeType=tradeType, tradeTypeName=tradeTypeName, productState=productState,
  361 + tradeTypeId=tradeTypeId, goodsTagId=goodsTagId, inGreeterId=inGreeterId,
  362 + inGreeterName=inGreeterName, dep=feeDepId, weighmanRecord=weighmanRecord)
  363 + # print(cre_res.json())
  364 + return cre_res
0 365 \ No newline at end of file
... ...
commons/scripts/jsonToUrlcode.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/8/4 14:33
  4 +# @Author : Ljq
  5 +# @File : jsonToUrlcode.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +
  10 +"""
  11 +
  12 +import urllib.parse
  13 +
  14 +def jsonToUrlcode(data_json={}):
  15 + """json格式数据转换未urlcode格式数据"""
  16 + data_uc = ""
  17 + for k, v in data_json.items():
  18 + data_uc = data_uc + str(k) + "=" + urllib.parse.quote(str(v)) + "&"
  19 + print(data_uc)
  20 + return data_uc
  21 +
  22 +# data_json = {"a": "a1", "b": "b1"}
  23 +# print(jsonToUrlcode(data_json))
0 24 \ No newline at end of file
... ...
config/api/__init__.py 0 → 100644
config/api/sy/__init__.py 0 → 100644
config/api/sy/address.py 0 → 100644
  1 +data={
  2 + "code": "200",
  3 + "data": [
  4 + {
  5 + "cityCode": "028",
  6 + "created": "2017-05-27 23:42:37",
  7 + "id": 510104,
  8 + "lat": "30.65614",
  9 + "levelType": 3,
  10 + "lng": "104.08347",
  11 + "mergerName": "四川省,成都市,锦江区",
  12 + "modified": "2017-06-15 12:42:56",
  13 + "name": "锦江区",
  14 + "parentId": 510100,
  15 + "pinyin": "Jinjiang",
  16 + "shortName": "锦江",
  17 + "shortPy": "JJ",
  18 + "yn": True
  19 + },
  20 + {
  21 + "cityCode": "028",
  22 + "created": "2017-05-27 23:42:37",
  23 + "id": 510105,
  24 + "lat": "30.67387",
  25 + "levelType": 3,
  26 + "lng": "104.06151",
  27 + "mergerName": "四川省,成都市,青羊区",
  28 + "modified": "2017-06-15 12:42:56",
  29 + "name": "青羊区",
  30 + "parentId": 510100,
  31 + "pinyin": "Qingyang",
  32 + "shortName": "青羊",
  33 + "shortPy": "QY",
  34 + "yn": True
  35 + },
  36 + {
  37 + "cityCode": "028",
  38 + "created": "2017-05-27 23:42:37",
  39 + "id": 510106,
  40 + "lat": "30.69126",
  41 + "levelType": 3,
  42 + "lng": "104.05114",
  43 + "mergerName": "四川省,成都市,金牛区",
  44 + "modified": "2017-06-15 12:42:56",
  45 + "name": "金牛区",
  46 + "parentId": 510100,
  47 + "pinyin": "Jinniu",
  48 + "shortName": "金牛",
  49 + "shortPy": "JN",
  50 + "yn": True
  51 + },
  52 + {
  53 + "cityCode": "028",
  54 + "created": "2017-05-27 23:42:37",
  55 + "id": 510107,
  56 + "lat": "30.64235",
  57 + "levelType": 3,
  58 + "lng": "104.04303",
  59 + "mergerName": "四川省,成都市,武侯区",
  60 + "modified": "2017-06-15 12:42:56",
  61 + "name": "武侯区",
  62 + "parentId": 510100,
  63 + "pinyin": "Wuhou",
  64 + "shortName": "武侯",
  65 + "shortPy": "WH",
  66 + "yn": True
  67 + },
  68 + {
  69 + "cityCode": "028",
  70 + "created": "2017-05-27 23:42:37",
  71 + "id": 510108,
  72 + "lat": "30.65993",
  73 + "levelType": 3,
  74 + "lng": "104.10193",
  75 + "mergerName": "四川省,成都市,成华区",
  76 + "modified": "2017-06-15 12:42:56",
  77 + "name": "成华区",
  78 + "parentId": 510100,
  79 + "pinyin": "Chenghua",
  80 + "shortName": "成华",
  81 + "shortPy": "CH",
  82 + "yn": True
  83 + },
  84 + {
  85 + "cityCode": "028",
  86 + "created": "2017-05-27 23:42:37",
  87 + "id": 510112,
  88 + "lat": "30.55658",
  89 + "levelType": 3,
  90 + "lng": "104.27462",
  91 + "mergerName": "四川省,成都市,龙泉驿区",
  92 + "modified": "2017-06-15 12:42:56",
  93 + "name": "龙泉驿区",
  94 + "parentId": 510100,
  95 + "pinyin": "Longquanyi",
  96 + "shortName": "龙泉驿",
  97 + "shortPy": "LQY",
  98 + "yn": True
  99 + },
  100 + {
  101 + "cityCode": "028",
  102 + "created": "2017-05-27 23:42:37",
  103 + "id": 510113,
  104 + "lat": "30.87841",
  105 + "levelType": 3,
  106 + "lng": "104.251",
  107 + "mergerName": "四川省,成都市,青白江区",
  108 + "modified": "2017-06-15 12:42:56",
  109 + "name": "青白江区",
  110 + "parentId": 510100,
  111 + "pinyin": "Qingbaijiang",
  112 + "shortName": "青白江",
  113 + "shortPy": "QBJ",
  114 + "yn": True
  115 + },
  116 + {
  117 + "cityCode": "028",
  118 + "created": "2017-05-27 23:42:37",
  119 + "id": 510114,
  120 + "lat": "30.82314",
  121 + "levelType": 3,
  122 + "lng": "104.15921",
  123 + "mergerName": "四川省,成都市,新都区",
  124 + "modified": "2017-06-15 12:42:56",
  125 + "name": "新都区",
  126 + "parentId": 510100,
  127 + "pinyin": "Xindu",
  128 + "shortName": "新都",
  129 + "shortPy": "XD",
  130 + "yn": True
  131 + },
  132 + {
  133 + "cityCode": "028",
  134 + "created": "2017-05-27 23:42:37",
  135 + "id": 510115,
  136 + "lat": "30.68444",
  137 + "levelType": 3,
  138 + "lng": "103.84881",
  139 + "mergerName": "四川省,成都市,温江区",
  140 + "modified": "2017-06-15 12:42:56",
  141 + "name": "温江区",
  142 + "parentId": 510100,
  143 + "pinyin": "Wenjiang",
  144 + "shortName": "温江",
  145 + "shortPy": "WJ",
  146 + "yn": True
  147 + },
  148 + {
  149 + "cityCode": "028",
  150 + "created": "2018-01-15 15:34:54",
  151 + "id": 510116,
  152 + "lat": "30.659462",
  153 + "levelType": 3,
  154 + "lng": "104.065735",
  155 + "mergerName": "四川省,成都市,双流区",
  156 + "modified": "2018-01-15 15:34:54",
  157 + "name": "双流区",
  158 + "parentId": 510100,
  159 + "pinyin": "ShuangLiu",
  160 + "shortName": "双流",
  161 + "shortPy": "SL",
  162 + "yn": True
  163 + },
  164 + {
  165 + "cityCode": "028",
  166 + "created": "2018-01-15 14:11:08",
  167 + "id": 510117,
  168 + "lat": "30.659462",
  169 + "levelType": 3,
  170 + "lng": "104.065735",
  171 + "mergerName": "四川省,成都市,郫都区",
  172 + "modified": "2018-01-15 14:11:08",
  173 + "name": "郫都区",
  174 + "parentId": 510100,
  175 + "pinyin": "PiDou",
  176 + "shortName": "郫都",
  177 + "shortPy": "PD",
  178 + "yn": True
  179 + },
  180 + {
  181 + "cityCode": "028",
  182 + "created": "2017-05-27 23:42:37",
  183 + "id": 510121,
  184 + "lat": "30.86195",
  185 + "levelType": 3,
  186 + "lng": "104.41195",
  187 + "mergerName": "四川省,成都市,金堂县",
  188 + "modified": "2017-06-15 12:42:56",
  189 + "name": "金堂县",
  190 + "parentId": 510100,
  191 + "pinyin": "Jintang",
  192 + "shortName": "金堂",
  193 + "shortPy": "JT",
  194 + "yn": True
  195 + },
  196 + {
  197 + "cityCode": "028",
  198 + "created": "2017-05-27 23:42:37",
  199 + "id": 510122,
  200 + "lat": "30.57444",
  201 + "levelType": 3,
  202 + "lng": "103.92373",
  203 + "mergerName": "四川省,成都市,双流县",
  204 + "modified": "2017-06-15 12:42:56",
  205 + "name": "双流县",
  206 + "parentId": 510100,
  207 + "pinyin": "Shuangliu",
  208 + "shortName": "双流",
  209 + "shortPy": "SL",
  210 + "yn": True
  211 + },
  212 + {
  213 + "cityCode": "028",
  214 + "created": "2017-05-27 23:42:37",
  215 + "id": 510124,
  216 + "lat": "30.81054",
  217 + "levelType": 3,
  218 + "lng": "103.88717",
  219 + "mergerName": "四川省,成都市,郫县",
  220 + "modified": "2017-06-15 12:42:56",
  221 + "name": "郫县",
  222 + "parentId": 510100,
  223 + "pinyin": "Pixian",
  224 + "shortName": "郫县",
  225 + "shortPy": "PX",
  226 + "yn": True
  227 + },
  228 + {
  229 + "cityCode": "028",
  230 + "created": "2017-05-27 23:42:37",
  231 + "id": 510129,
  232 + "lat": "30.58738",
  233 + "levelType": 3,
  234 + "lng": "103.52075",
  235 + "mergerName": "四川省,成都市,大邑县",
  236 + "modified": "2017-06-15 12:42:56",
  237 + "name": "大邑县",
  238 + "parentId": 510100,
  239 + "pinyin": "Dayi",
  240 + "shortName": "大邑",
  241 + "shortPy": "DY",
  242 + "yn": True
  243 + },
  244 + {
  245 + "cityCode": "028",
  246 + "created": "2017-05-27 23:42:37",
  247 + "id": 510131,
  248 + "lat": "30.19667",
  249 + "levelType": 3,
  250 + "lng": "103.50616",
  251 + "mergerName": "四川省,成都市,蒲江县",
  252 + "modified": "2017-06-15 12:42:56",
  253 + "name": "蒲江县",
  254 + "parentId": 510100,
  255 + "pinyin": "Pujiang",
  256 + "shortName": "蒲江",
  257 + "shortPy": "PJ",
  258 + "yn": True
  259 + },
  260 + {
  261 + "cityCode": "028",
  262 + "created": "2017-05-27 23:42:37",
  263 + "id": 510132,
  264 + "lat": "30.40983",
  265 + "levelType": 3,
  266 + "lng": "103.8114",
  267 + "mergerName": "四川省,成都市,新津县",
  268 + "modified": "2017-06-15 12:42:56",
  269 + "name": "新津县",
  270 + "parentId": 510100,
  271 + "pinyin": "Xinjin",
  272 + "shortName": "新津",
  273 + "shortPy": "XJ",
  274 + "yn": True
  275 + },
  276 + {
  277 + "cityCode": "028",
  278 + "created": "2017-05-27 23:42:37",
  279 + "id": 510181,
  280 + "lat": "30.99825",
  281 + "levelType": 3,
  282 + "lng": "103.61941",
  283 + "mergerName": "四川省,成都市,都江堰市",
  284 + "modified": "2017-06-15 12:42:56",
  285 + "name": "都江堰市",
  286 + "parentId": 510100,
  287 + "pinyin": "Dujiangyan",
  288 + "shortName": "都江堰",
  289 + "shortPy": "DJY",
  290 + "yn": True
  291 + },
  292 + {
  293 + "cityCode": "028",
  294 + "created": "2017-05-27 23:42:37",
  295 + "id": 510182,
  296 + "lat": "30.99011",
  297 + "levelType": 3,
  298 + "lng": "103.958",
  299 + "mergerName": "四川省,成都市,彭州市",
  300 + "modified": "2017-06-15 12:42:56",
  301 + "name": "彭州市",
  302 + "parentId": 510100,
  303 + "pinyin": "Pengzhou",
  304 + "shortName": "彭州",
  305 + "shortPy": "PZ",
  306 + "yn": True
  307 + },
  308 + {
  309 + "cityCode": "028",
  310 + "created": "2017-05-27 23:42:37",
  311 + "id": 510183,
  312 + "lat": "30.41489",
  313 + "levelType": 3,
  314 + "lng": "103.46283",
  315 + "mergerName": "四川省,成都市,邛崃市",
  316 + "modified": "2017-06-15 12:42:56",
  317 + "name": "邛崃市",
  318 + "parentId": 510100,
  319 + "pinyin": "Qionglai",
  320 + "shortName": "邛崃",
  321 + "shortPy": "QL",
  322 + "yn": True
  323 + },
  324 + {
  325 + "cityCode": "028",
  326 + "created": "2017-05-27 23:42:37",
  327 + "id": 510184,
  328 + "lat": "30.63014",
  329 + "levelType": 3,
  330 + "lng": "103.67285",
  331 + "mergerName": "四川省,成都市,崇州市",
  332 + "modified": "2017-06-15 12:42:57",
  333 + "name": "崇州市",
  334 + "parentId": 510100,
  335 + "pinyin": "Chongzhou",
  336 + "shortName": "崇州",
  337 + "shortPy": "CZ",
  338 + "yn": True
  339 + },
  340 + {
  341 + "cityCode": "028",
  342 + "created": "2018-01-17 11:26:47",
  343 + "id": 510185,
  344 + "lat": "30.659462",
  345 + "levelType": 3,
  346 + "lng": "104.065735",
  347 + "mergerName": "四川省,成都市,简阳市",
  348 + "modified": "2018-01-17 11:26:47",
  349 + "name": "简阳市",
  350 + "parentId": 510100,
  351 + "pinyin": "JianYang",
  352 + "shortName": "简阳",
  353 + "shortPy": "JY",
  354 + "yn": True
  355 + }
  356 + ],
  357 + "message": "OK",
  358 + "result": "OK",
  359 + "success": True
  360 +}
0 361 \ No newline at end of file
... ...