首页 > 其他分享 >接口校验易宝分账状态异常单据重推

接口校验易宝分账状态异常单据重推

时间:2024-04-08 15:25:03浏览次数:19  
标签:status 易宝 text 22% receipt 重推 分账 data order

import time

from USSyunwei.bin import *
from USSapi.Apiserver import *
from USSapi.bascidata import *



sql=f"""select order_no,sfdj_receipt_status,sfdj_failure_reason,site_receipt_status,
site_failure_reason,site_id,receipt_status,failure_reason,engineer_id
from tcl_finance_reconciliation
where
(receipt_status in (0) or sfdj_receipt_status in (0) or site_receipt_status in (0) )
and order_finish_date<'{datetime.datetime.now().date()} 00:00:00' and order_finish_date !='0001-01-01 00:00:00' and
site_name not in ("测试服务商勿理会") and
brand_name not in ("金鱼","熊猫","风行","3M") """
# print(sql)
# 生产环境数据库
#如果生产环境查出来没有数据,说明没有待分账的数据
statu,text=DB_sql(sql,database="uss_payunit",example="生产_营销_十分到家_USS2.0_basicdata_MYSQL_从(10.68.70.37)")
if "空值" not in str(text):
for i in text:
statu,datalist=Api_server("统收统付重推列表查询",order_no=i[0])
if statu :
pass
else:
print(i[0])
fzstatu,fztext=Api_server("重新调起易宝分账",orderNoList= [f'{i[0]}'],Goal_hierarchy="")
print(fztext)
else:
print(f"截止至{datetime.datetime.now().date()}之前没有待完工的数据")
#查询前一天单据状态是已发起清分,状态没有改的数据
sql=f"select order_no,sfdj_receipt_status,sfdj_failure_reason,site_receipt_status,site_failure_reason,site_id," \
"receipt_status,failure_reason,engineer_id " \
"from tcl_finance_reconciliation " \
f"where order_finish_date between '2023-01-01 00:00:00' and '{datetime.datetime.now().date()} 16:40:00' and " \
"(receipt_status in (6) or sfdj_receipt_status in (6) or site_receipt_status in (6) )" \
"and site_name not in ('测试服务商勿理会') and " \
"brand_name not in ('金鱼','熊猫','风行','3M') order by order_finish_date asc"
statu, text = DB_sql(sql, database="uss_payunit",
example="生产_营销_十分到家_USS2.0_basicdata_MYSQL_从(10.68.70.37)")

url="https://gateway.shifendaojia.com/uss-payment-unite/v1/tcl-finance-reconciliations/updateStatusByMerchantNo"
header = {
"Authorization": token,
"Content-Type": "application/json;charset=UTF-8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
"Cookie": "sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22ex_yong.zeng%22%2C%22first_id%22%3A%2218cce911e5d1c8d-020ee3b22e7e8f6-4c657b58-1327104-18cce911e5e1dd2%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMThjY2U5MTFlNWQxYzhkLTAyMGVlM2IyMmU3ZThmNi00YzY1N2I1OC0xMzI3MTA0LTE4Y2NlOTExZTVlMWRkMiIsIiRpZGVudGl0eV9sb2dpbl9pZCI6ImV4X3lvbmcuemVuZyJ9%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%24identity_login_id%22%2C%22value%22%3A%22ex_yong.zeng%22%7D%2C%22%24device_id%22%3A%2218cce911e5d1c8d-020ee3b22e7e8f6-4c657b58-1327104-18cce911e5e1dd2%22%7D"
}

num=1
data = {"orderNoList": []}
order_num=1
if "空值" not in str(text):
print(f"一共查到{len(text)}条数据")
if len(text)>=10:
for order in text:


if order_num<10:
data["orderNoList"].append(order[0])
order_num+=1
else:
try:
re = requests.post(data=json.dumps(data), url=url, headers=header)
except:
sleep(2)
re = requests.post(data=json.dumps(data), url=url, headers=header)
if "SUCCESS" in re.text:
print(f"{num} {order[0]}状态更新成功")
else:
print(f"{num} {order[0]}更新失败---{re.text} {data}")
order_num=1
data = {"orderNoList": []}
num+=1
else:
for order in text:

if order_num != len(text):
data["orderNoList"].append(order[0])
order_num += 1
else:
data["orderNoList"].append(order[0])
try:
re = requests.post(data=json.dumps(data), url=url, headers=header)
except:
sleep(2)
re = requests.post(data=json.dumps(data), url=url, headers=header)
if "SUCCESS" in re.text:
print(f"{len(text)} {order[0]}状态更新成功")
else:
print(f"{len(text)} {order[0]}更新失败---{re.text} {data}")
# order_num = 1
# data = {"orderNoList": []}
num += 1
else:
print("没有单据状态是已发起清分,但是实际状态是已到账的数据")


#查询”费用金额集合不能为空“的数据
sql = "select order_no,sfdj_receipt_status,sfdj_failure_reason,site_receipt_status,site_failure_reason,site_id," \
"receipt_status,failure_reason,engineer_id " \
"from tcl_finance_reconciliation " \
"where (receipt_status in (5) or sfdj_receipt_status in (5) or site_receipt_status in (5) ) " \
"and site_name not in ('测试服务商勿理会') and " \
"brand_name not in ('金鱼','熊猫','风行','3M')"
# 生产环境数据库
statu, text = DB_sql(sql, database="uss_payunit",
example="生产_营销_十分到家_USS2.0_basicdata_MYSQL_从(10.68.70.37)")
starttime = time.time()
if "金额" in str(text):
for u in text:
if "金额" in str(u):
print(u)
else:
print(f"截止至{datetime.datetime.now().date()}之前没有 ‘费用金额集合不能为空’ 的数据")







标签:status,易宝,text,22%,receipt,重推,分账,data,order
From: https://www.cnblogs.com/xieweiwen/p/18121251

相关文章

  • 谷歌云 | Cloud SQL Enterprise Plus 隆重推出:新版本可提供高达 3 倍的 MySQL 性能
    【本文由CloudAce整理发布。CloudAce是谷歌云全球战略合作伙伴,拥有300多名工程师,也是谷歌最高级别合作伙伴,多次获得GoogleCloud合作伙伴奖。作为谷歌托管服务商,我们提供谷歌云、谷歌地图、谷歌办公套件、谷歌云认证培训服务。】CloudSQL是GoogleCloud的企业级、完全......
  • 易宝正式加入openGauss社区
    8月15日,易宝签署CLA(ContributionLicenseAgreement,贡献许可协议),正式加入openGauss社区。关于易宝易宝是中国领先的科技公司,拥有软件服务、易宝智能、易宝设计、易宝教育......
  • 微信分账
    Q1:调用请求分账接口返回”非分账订单不支持分账“是什么原因?A1:请按照以下几点检查:微信订单号填写错误,请检查确认统一下单时未上传分账标识(profit_sharing=Y)的订单,是不......
  • 企业分账如何帮助用户解决成本优化和预算分配的问题
    简介: Serverless应用引擎SAE(ServerlessAppEngine)是一个全托管、免运维、高弹性的通用PaaS平台。SAE支持SpringCloud、Dubbo、HSF、Web应用和XXL-JOB、ElasticJ......
  • 企业分账如何帮助用户解决成本优化和预算分配的问题
    开头我们先讲一个小故事,这也是很多创业团队经常碰到的情况:小王是一家互联网创业公司的研发领导,最初创业的时候研发团队只有10人左右。当时他最大的痛点是,如何带领技术团......