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
ac37b4eb
Commit
ac37b4eb
authored
Jan 06, 2020
by
huangjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hj
parent
453144ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
4 deletions
+35
-4
calc_result/Update.py
+26
-0
calc_result/main.py
+9
-4
No files found.
calc_result/Update.py
0 → 100755
View file @
ac37b4eb
#!/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
calc_result/main.py
View file @
ac37b4eb
...
...
@@ -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
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