Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
473f4d86
Commit
473f4d86
authored
Feb 20, 2020
by
黄静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hj
parent
54273eb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
30 deletions
+25
-30
calc_result/main.py
+25
-30
No files found.
calc_result/main.py
View file @
473f4d86
...
...
@@ -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_DB
=
env_dist
.
get
(
'FK_REDIS_DB'
)
#获取redis库
print
(
FK_REDIS_HOST
)
print
(
FK_REDIS_PORT
)
print
(
FK_REDIS_PWD
)
print
(
FK_REDIS_DB
)
#
print(FK_REDIS_HOST)
#
print(FK_REDIS_PORT)
#
print(FK_REDIS_PWD)
#
print(FK_REDIS_DB)
#使用任务号获取任务信息
def
getInfo_ByBatchNo
(
BatchNo
):
...
...
@@ -47,7 +47,6 @@ def getInfo_ByBatchNo(BatchNo):
Info_task
.
append
(
AccountInfo
)
print
(
"返回任务信息"
)
return
Info_task
# 任务信息: [{'taxCode': '123456', 'batchCode': '51', 'timeType': 'Y', 'currentIssue': '2019'}]
#获取自定义的期数
def
customBatch
(
custom_currentIssue
,
offset
,
timeType
):
...
...
@@ -56,7 +55,6 @@ def customBatch(custom_currentIssue,offset,timeType):
batchInfo
=
requests
.
post
(
url
,
name
)
# 访问接口返回的信息
batchInfo_New
=
json
.
loads
(
batchInfo
.
text
)
currentIssue
=
batchInfo_New
[
'data'
]
# print("接口计算的期数为:",currentIssue)
return
currentIssue
#获取L期数信息
...
...
@@ -75,27 +73,25 @@ def Transformer(currentYear,YearyearInfo,issueNum):
if
(
len
(
issueNum
))
<
2
:
issueNum
=
"0"
+
str
(
issueNum
)
currentIssue
=
str
(
year
)
+
str
(
issueNum
)
# print("自己计算期数为:",currentIssue)
return
currentIssue
# 调用映射接口,转化为位置编码
def
posmap
(
talbe
,
cellPos
):
talbe
=
str
(
talb
e
)
cellPos
=
str
(
cellPos
)
def
posmap
(
coordinate
,
position
):
coordinate
=
str
(
coordinat
e
)
position
=
str
(
position
)
url
=
'https://fkctlapi.gongsibao.com/api/rpt/rptApi/queryPosMap'
positionInfo
=
requests
.
post
(
url
)
positionInfo_New
=
json
.
loads
(
positionInfo
.
text
)
if
positionInfo_New
[
'status'
]
==
0
:
posmap_result
=
{}
posmap_lists
=
positionInfo_New
[
'data'
][
'data'
]
for
posmap_list
in
posmap_lists
:
#cellPos:坐标值;cellDesc:单元格中文编码
if
(
posmap_list
[
"rpttypecode"
]
==
talbe
and
posmap_list
[
"nposition"
]
==
cellPos
):
posmap_result
[
'cellDesc'
]
=
posmap_list
[
"position"
]
posmap_result
[
'cellPos'
]
=
""
# print(posmap_result['cellDesc'],"===============因子中文编码位置")
else
:
posmap_result
[
'cellDesc'
]
=
""
posmap_result
[
'cellPos'
]
=
cellPos
posmap_lists
=
positionInfo_New
[
'data'
]
if
position
in
posmap_lists
:
posmap_result
[
'cellDesc'
]
=
posmap_lists
[
position
]
posmap_result
[
'cellPos'
]
=
""
print
(
posmap_result
[
'cellDesc'
],
"===============因子中文编码位置"
)
else
:
posmap_result
[
'cellDesc'
]
=
""
posmap_result
[
'cellPos'
]
=
coordinate
else
:
posmap_result
=
'因子中文编码查询错误'
return
posmap_result
...
...
@@ -133,13 +129,15 @@ def fun(str):
table
=
str
.
split
(
"_"
)[
0
]
row
=
str
.
split
(
"_"
)[
1
]
cloumn
=
str
.
split
(
"_"
)[
2
]
coordinate
=
row
+
"-"
+
cloumn
coordinate
=
row
+
"-"
+
cloumn
position
=
table
+
"~"
+
coordinate
#NA~5-1
times
=
str
.
split
(
"_"
)[
3
]
nums
=
re
.
findall
(
r'([A-Z]+)([0-9]+)'
,
times
)[
0
][
1
]
indexdict
[
"table"
]
=
table
indexdict
[
"row"
]
=
row
indexdict
[
"cloumn"
]
=
cloumn
indexdict
[
"position"
]
=
coordinate
indexdict
[
"coordinate"
]
=
coordinate
#因子坐标位置
indexdict
[
"position"
]
=
position
#因子位置:表名~位置
indexdict
[
"times"
]
=
times
indexdict
[
"nums"
]
=
"-"
+
nums
indexdict
[
"issueNum"
]
=
nums
...
...
@@ -216,7 +214,6 @@ def Previous(tasks):
def
report
(
BatchNo
):
print
(
BatchNo
,
"=============触发生成报告接口"
)
url
=
'https://fkctlapi.gongsibao.com/api/rpt/rptApi/buildWordReport'
name
=
{
"batchid"
:
BatchNo
}
reportInfo
=
requests
.
post
(
url
,
name
)
reportInfo_New
=
json
.
loads
(
reportInfo
.
text
)
...
...
@@ -247,10 +244,7 @@ content=result["content"]
print
(
content
,
"content"
)
taxTypeCode
=
content
[
"taxTypeCode"
]
#企业性质
accountTypeCode
=
content
[
"accountTypeCode"
]
#会计准则
# accountTypeCode="S"#会计准则
BatchNo
=
content
[
"batchCode"
]
# BatchNo=226
# taxTypeCode = "ST"
if
taxTypeCode
==
"ST"
:
taxTypeCode
=
"S"
else
:
...
...
@@ -263,7 +257,6 @@ tasks=Info_task[0]
Previous_Date
=
Previous
(
tasks
)
indexs
=
indexsGet
.
Subscribe
(
tasks
[
'timeType'
],
type
)
#根据时间类型和企业类型获取特征s
print
(
tasks
[
'timeType'
],
type
,
"==============获取查询公式条件"
)
# indexs=indexsGet.Subscribe('Q','G-N')#根据时间类型和企业类型获取特征
factors
=
{}
for
indexItem
in
indexs
:
factorsStr
=
indexItem
.
Factors
...
...
@@ -276,11 +269,13 @@ factorsnew={}
for
factor
in
factors
:
#获取所有因子
fun_list
=
fun
(
str
(
factor
))
index
=
fun_list
[
0
]
cellPos
=
index
[
'position'
]
coordinate
=
index
[
'coordinate'
]
position
=
index
[
'position'
]
talbe
=
index
[
'table'
]
batchCode
=
BatchNo
posmap_result
=
posmap
(
talbe
,
cellPos
)
position_data
=
posmap_result
[
'cellPos'
]
# posmap_result=posmap(talbe,cellPos)
posmap_result
=
posmap
(
coordinate
,
position
)
cellPos
=
posmap_result
[
'cellPos'
]
cellDesc
=
posmap_result
[
'cellDesc'
]
offset
=
index
[
'nums'
]
times
=
index
[
'times'
]
...
...
@@ -298,7 +293,7 @@ for factor in factors:#获取所有因子
# 获取自定义期数
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
factors
=
factorsnew
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment