entranceFeeBill_provesPage.py 2.92 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib3
from commons import common as com
from commons.MySession import sy1
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


class entranceFeeBill_provesPage():
    "证明类型明细-查询"
    url = "http://test.jmsf.diligrp.com:8385/entranceFeeBill/provesPage.action"
    header = {
          "Connection": "keep-alive",
          "Content-Length": "485",
          "Accept": "application/json, text/javascript, */*; q=0.01",
          "X-Requested-With": "XMLHttpRequest",
          "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
          "Content-Type": "application/x-www-form-urlencoded",
          "Accept-Language": "zh-CN,zh;q=0.9",
          "Host": "test.jmsf.diligrp.com:8385",
          "Accept-Encoding": "gzip, deflate"}
    body = """rows=10&page=1&sort=et.created&order=desc
    &metadata[actualPrice]={"provider":"moneyProvider","index":10,"field":"actualPrice"}
    &metadata[created]={"provider":"datetimeProvider","index":20,"field":"created"}
    &metadata[status]={"provider":"entranceFeeBillStateProvider","index":30,"field":"status"}
    &attr=number&attrValue=202108110900139&categoryId=14436&productName=雪莲果&productId=14158
    &dep=103&proveTypeCode=1621&companyId=9&startTime=2020-08-11 00:00:00&endTime=2025-08-13 23:59:59"""

    def __init__(self):
        self.url = entranceFeeBill_provesPage.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
        self.header = entranceFeeBill_provesPage.header
        self.body= entranceFeeBill_provesPage.body.replace('\n', '')

    def sql_select(self,marketid):
        self.sql="""SELECT 
                    a.dep, #部门
                    a.number, #收费单号
                    a.plate, #车牌号
                    a.customer_name, #客户姓名
                    a.customer_phone, #客户电话
                    a.ic, #客户卡号
                    a.company_id, #子公司
                    a.goods_id, 
                    b.prove_type_code, #证明类型
                    b.category_id,  #品类id
                    b.product_id,   #商品id
                    b.product_name , #商品名称
                    c.fee_bill_id
                    FROM entrance_fee_bill a ,goods b ,bill_fee_item c
                    WHERE a.goods_id=b.id 
                    AND a.id = c.fee_bill_id
                    AND a.market_id={} 
                    AND a.yn=1 
                    AND c.fee_item_name LIKE "%检测费%"
                    AND a.company_id IS NOT NULL
                    AND a.ic IS NOT NULL
                    AND b.prove_type_code IS NOT NULL
                    ORDER BY a.id DESC LIMIT 1;""".format(marketid)
        return self.sql

# tt=entranceFeeBill_provesPage()
# re=sy1.post(url=tt.url,headers=tt.header,data=tt.body.encode('utf-8'))
# print(re.json())