Commit 473f4d86 by 黄静

hj

parent 54273eb7
...@@ -15,10 +15,10 @@ FK_REDIS_PORT = env_dist.get('FK_REDIS_PORT') #获取redis端口号 ...@@ -15,10 +15,10 @@ FK_REDIS_PORT = env_dist.get('FK_REDIS_PORT') #获取redis端口号
FK_REDIS_PWD = env_dist.get('FK_REDIS_PWD') #获取redis密码 FK_REDIS_PWD = env_dist.get('FK_REDIS_PWD') #获取redis密码
FK_REDIS_DB = env_dist.get('FK_REDIS_DB') #获取redis库 FK_REDIS_DB = env_dist.get('FK_REDIS_DB') #获取redis库
print(FK_REDIS_HOST) # print(FK_REDIS_HOST)
print(FK_REDIS_PORT) # print(FK_REDIS_PORT)
print(FK_REDIS_PWD) # print(FK_REDIS_PWD)
print(FK_REDIS_DB) # print(FK_REDIS_DB)
#使用任务号获取任务信息 #使用任务号获取任务信息
def getInfo_ByBatchNo(BatchNo): def getInfo_ByBatchNo(BatchNo):
...@@ -47,7 +47,6 @@ def getInfo_ByBatchNo(BatchNo): ...@@ -47,7 +47,6 @@ def getInfo_ByBatchNo(BatchNo):
Info_task.append(AccountInfo) Info_task.append(AccountInfo)
print("返回任务信息") print("返回任务信息")
return Info_task return Info_task
# 任务信息: [{'taxCode': '123456', 'batchCode': '51', 'timeType': 'Y', 'currentIssue': '2019'}]
#获取自定义的期数 #获取自定义的期数
def customBatch(custom_currentIssue,offset,timeType): def customBatch(custom_currentIssue,offset,timeType):
...@@ -56,7 +55,6 @@ def customBatch(custom_currentIssue,offset,timeType): ...@@ -56,7 +55,6 @@ def customBatch(custom_currentIssue,offset,timeType):
batchInfo = requests.post(url,name) # 访问接口返回的信息 batchInfo = requests.post(url,name) # 访问接口返回的信息
batchInfo_New = json.loads(batchInfo.text) batchInfo_New = json.loads(batchInfo.text)
currentIssue = batchInfo_New['data'] currentIssue = batchInfo_New['data']
# print("接口计算的期数为:",currentIssue)
return currentIssue return currentIssue
#获取L期数信息 #获取L期数信息
...@@ -75,27 +73,25 @@ def Transformer(currentYear,YearyearInfo,issueNum): ...@@ -75,27 +73,25 @@ def Transformer(currentYear,YearyearInfo,issueNum):
if(len(issueNum))<2: if(len(issueNum))<2:
issueNum="0"+str(issueNum) issueNum="0"+str(issueNum)
currentIssue=str(year)+str(issueNum) currentIssue=str(year)+str(issueNum)
# print("自己计算期数为:",currentIssue)
return currentIssue return currentIssue
# 调用映射接口,转化为位置编码 # 调用映射接口,转化为位置编码
def posmap(talbe,cellPos): def posmap(coordinate,position):
talbe = str(talbe) coordinate = str(coordinate)
cellPos = str(cellPos) position = str(position)
url = 'https://fkctlapi.gongsibao.com/api/rpt/rptApi/queryPosMap' url = 'https://fkctlapi.gongsibao.com/api/rpt/rptApi/queryPosMap'
positionInfo = requests.post(url) positionInfo = requests.post(url)
positionInfo_New = json.loads(positionInfo.text) positionInfo_New = json.loads(positionInfo.text)
if positionInfo_New['status'] == 0: if positionInfo_New['status'] == 0:
posmap_result = {} posmap_result = {}
posmap_lists = positionInfo_New['data']['data'] posmap_lists = positionInfo_New['data']
for posmap_list in posmap_lists: #cellPos:坐标值;cellDesc:单元格中文编码 if position in posmap_lists:
if (posmap_list["rpttypecode"] == talbe and posmap_list["nposition"] == cellPos): posmap_result['cellDesc'] = posmap_lists[position]
posmap_result['cellDesc'] = posmap_list["position"] posmap_result['cellPos'] = ""
posmap_result['cellPos'] = "" print(posmap_result['cellDesc'],"===============因子中文编码位置")
# print(posmap_result['cellDesc'],"===============因子中文编码位置") else:
else: posmap_result['cellDesc'] = ""
posmap_result['cellDesc'] = "" posmap_result['cellPos'] = coordinate
posmap_result['cellPos'] = cellPos
else: else:
posmap_result = '因子中文编码查询错误' posmap_result = '因子中文编码查询错误'
return posmap_result return posmap_result
...@@ -133,13 +129,15 @@ def fun(str): ...@@ -133,13 +129,15 @@ def fun(str):
table=str.split("_")[0] table=str.split("_")[0]
row=str.split("_")[1] row=str.split("_")[1]
cloumn=str.split("_")[2] cloumn=str.split("_")[2]
coordinate = row+"-"+cloumn coordinate =row+"-"+cloumn
position =table+"~"+coordinate #NA~5-1
times=str.split("_")[3] times=str.split("_")[3]
nums=re.findall(r'([A-Z]+)([0-9]+)',times)[0][1] nums=re.findall(r'([A-Z]+)([0-9]+)',times)[0][1]
indexdict["table"]=table indexdict["table"]=table
indexdict["row"] = row indexdict["row"] = row
indexdict["cloumn"]= cloumn indexdict["cloumn"]= cloumn
indexdict["position"] = coordinate indexdict["coordinate"] = coordinate #因子坐标位置
indexdict["position"] = position #因子位置:表名~位置
indexdict["times"] = times indexdict["times"] = times
indexdict["nums"] = "-"+nums indexdict["nums"] = "-"+nums
indexdict["issueNum"] = nums indexdict["issueNum"] = nums
...@@ -216,7 +214,6 @@ def Previous(tasks): ...@@ -216,7 +214,6 @@ def Previous(tasks):
def report(BatchNo): def report(BatchNo):
print(BatchNo,"=============触发生成报告接口") print(BatchNo,"=============触发生成报告接口")
url = 'https://fkctlapi.gongsibao.com/api/rpt/rptApi/buildWordReport' url = 'https://fkctlapi.gongsibao.com/api/rpt/rptApi/buildWordReport'
name = {"batchid": BatchNo} name = {"batchid": BatchNo}
reportInfo = requests.post(url,name) reportInfo = requests.post(url,name)
reportInfo_New = json.loads(reportInfo.text) reportInfo_New = json.loads(reportInfo.text)
...@@ -247,10 +244,7 @@ content=result["content"] ...@@ -247,10 +244,7 @@ content=result["content"]
print(content,"content") print(content,"content")
taxTypeCode=content["taxTypeCode"]#企业性质 taxTypeCode=content["taxTypeCode"]#企业性质
accountTypeCode=content["accountTypeCode"]#会计准则 accountTypeCode=content["accountTypeCode"]#会计准则
# accountTypeCode="S"#会计准则
BatchNo=content["batchCode"] BatchNo=content["batchCode"]
# BatchNo=226
# taxTypeCode = "ST"
if taxTypeCode=="ST": if taxTypeCode=="ST":
taxTypeCode="S" taxTypeCode="S"
else: else:
...@@ -263,7 +257,6 @@ tasks=Info_task[0] ...@@ -263,7 +257,6 @@ tasks=Info_task[0]
Previous_Date=Previous(tasks) Previous_Date=Previous(tasks)
indexs=indexsGet.Subscribe(tasks['timeType'],type)#根据时间类型和企业类型获取特征s indexs=indexsGet.Subscribe(tasks['timeType'],type)#根据时间类型和企业类型获取特征s
print(tasks['timeType'],type,"==============获取查询公式条件") print(tasks['timeType'],type,"==============获取查询公式条件")
# indexs=indexsGet.Subscribe('Q','G-N')#根据时间类型和企业类型获取特征
factors={} factors={}
for indexItem in indexs: for indexItem in indexs:
factorsStr=indexItem.Factors factorsStr=indexItem.Factors
...@@ -276,11 +269,13 @@ factorsnew={} ...@@ -276,11 +269,13 @@ factorsnew={}
for factor in factors:#获取所有因子 for factor in factors:#获取所有因子
fun_list=fun(str(factor)) fun_list=fun(str(factor))
index = fun_list[0] index = fun_list[0]
cellPos=index['position'] coordinate= index['coordinate']
position=index['position']
talbe = index['table'] talbe = index['table']
batchCode = BatchNo batchCode = BatchNo
posmap_result=posmap(talbe,cellPos) # posmap_result=posmap(talbe,cellPos)
position_data = posmap_result['cellPos'] posmap_result=posmap(coordinate,position)
cellPos = posmap_result['cellPos']
cellDesc = posmap_result['cellDesc'] cellDesc = posmap_result['cellDesc']
offset = index['nums'] offset = index['nums']
times = index['times'] times = index['times']
...@@ -298,7 +293,7 @@ for factor in factors:#获取所有因子 ...@@ -298,7 +293,7 @@ for factor in factors:#获取所有因子
# 获取自定义期数 # 获取自定义期数
Info_LBatch=customBatch(currentIssue,offset,timeType) Info_LBatch=customBatch(currentIssue,offset,timeType)
# 获取单元格值 # 获取单元格值
index_Value = getValue(batchCode,cellDesc,cellPos,currentIssue,fileCode,taxCode,timeType) index_Value = getValue(batchCode,cellDesc,cellPos,currentIssue,fileCode,taxCode,timeType)
factorsnew[factor] = index_Value factorsnew[factor] = index_Value
factors=factorsnew factors=factorsnew
......
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