Commit ac37b4eb by huangjing

hj

parent 453144ed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/12/29 0029 下午 3:01
# @Author : hj
# @File : IndexGet.py
# @Software: PyCharm
import pymysql
class UpdateId:
conn = pymysql.connect(host='43.247.184.35',port=8899,user='write',password='write',db='fktaxctl',charset="utf8mb4")
def Update(self,BatchNo):
cursor = self.conn.cursor()
sql = "UPDATE upload_batch SET batchstatuscode = 'rptover' WHERE id = %s;"
try:
# 执行SQL语句
cursor.execute(sql,BatchNo)
self.conn.commit()
print("更新条件",BatchNo)
except:
print("Error: unable to fetch data")
return ("Error: unable to fetch data")
finally:
cursor.close()
return list
def close(self):
self.conn.close()
\ No newline at end of file
......@@ -7,6 +7,7 @@
import requests,json,redis,re
from RiskComputer import RiskComputer
from IndexGet import IndexGet
from Update import UpdateId
#使用任务号获取任务信息
def getInfo_ByBatchNo(BatchNo):
......@@ -108,6 +109,9 @@ def fun(str):
fun_list.append(indexdict)
return fun_list
redisPool = redis.ConnectionPool(host='43.247.184.32', port=8967, password='Gongsibao2018',db=2)
client = redis.Redis(connection_pool=redisPool)
a = client.lrange('notifyRule',-1,-1)
......@@ -116,7 +120,6 @@ if len(a)==0:
print("notifyRule数据为空")
quit()
value =a[-1]
# print(value,"pp")
if client is None:
client.rpop('notifyRule')
quit()
......@@ -144,7 +147,6 @@ indexs=indexsGet.Subscribe(tasks['timeType'],type)#根据时间类型和企业
factors={}
for indexItem in indexs:
factorsStr=indexItem.Factors
# print(factorsStr)
factorsGrp=factorsStr.replace(":",":").split(":")
for factorItem in factorsGrp:
if factorItem not in factors and len(factorItem.lstrip().rstrip())>0:
......@@ -177,15 +179,17 @@ for factor in factors:#获取所有因子
# 获取单元格值
index_Value = getValue(batchCode,cellPos,Info_LBatch,fileCode,taxCode,timeType)
factorsnew[factor] = index_Value
# print(index_Value)
factors=factorsnew
rc=RiskComputer() #构建指标计算对象
rc.batch_No =batchCode
rc.batch_No = batchCode
rc.FactorGet(factors)#把因子装入对象
rc.IndexsGet(indexs)#把指标装入对象
rc.Compute()#指标计算
jsonstr = rc.Ret2Json()#指标输出成樊辉要的格式
print(jsonstr)
client.rpop('notifyRule')
Updqtestatus=UpdateId()
Updqtestatus.Update(batchCode)
print(batchCode,"batchCode")
print("消耗结束")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment