Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
acccb644
Commit
acccb644
authored
Dec 23, 2020
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
月报任务
parent
e04a86bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
5 deletions
+37
-5
timed_task.py
app/utils/timed_task.py
+37
-5
No files found.
app/utils/timed_task.py
View file @
acccb644
...
@@ -5,9 +5,14 @@
...
@@ -5,9 +5,14 @@
找出 ifa 所有的客户
找出 ifa 所有的客户
进行月报生成
进行月报生成
"""
"""
import
datetime
import
time
import
time
import
traceback
import
traceback
from
app.api.engine
import
logging
,
pdf_folder
import
uuid
import
oss2
from
app.api.engine
import
logging
,
pdf_folder
,
tamp_diagnose_app_engine
,
config
,
env
import
os
import
os
from
app.api.engine
import
tamp_user_engine
,
tamp_order_engine
,
TAMP_SQL
from
app.api.engine
import
tamp_user_engine
,
tamp_order_engine
,
TAMP_SQL
...
@@ -53,9 +58,21 @@ class Customer(Base):
...
@@ -53,9 +58,21 @@ class Customer(Base):
# ui_username = Column(String(128))
# ui_username = Column(String(128))
def
call_month_report
(
ifauser_id
,
ifauser_name
,
customer_id
,
customer_name
):
def
call_month_report
(
ifauser_id
,
ifauser_name
,
customer_id
,
customer_name
):
filename
=
'{}_{}_.pdf'
.
format
(
ifauser_name
,
customer_name
)
# filename = '{}_{}_.pdf'.format(ifauser_name, customer_name)
if
os
.
path
.
exists
(
pdf_folder
+
filename
):
# if os.path.exists(pdf_folder + filename):
return
None
# return None
pdf_name
=
str
(
uuid
.
uuid4
())
+
'.pdf'
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
tamp_diagnose_app_session
=
tamp_diagnose_app
.
session
sql
=
"update hold_report set update_time='{}', update_status='{}' where ifa_id='{}' and customer_id='{}'"
.
format
(
datetime
.
datetime
.
now
(),
1
,
ifauser_id
,
customer_id
)
tamp_diagnose_app_session
.
execute
(
sql
)
print
(
'开始制作IFA: {}, 客户: {}的基金月报'
.
format
(
ifauser_name
,
customer_name
))
print
(
'开始制作IFA: {}, 客户: {}的基金月报'
.
format
(
ifauser_name
,
customer_name
))
start
=
time
.
time
()
start
=
time
.
time
()
try
:
try
:
...
@@ -68,7 +85,22 @@ def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
...
@@ -68,7 +85,22 @@ def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
logging
.
error
(
"IFAID{}: IFAName{}, 客户ID{}, 客户Name: {}的基金月报生成异常,错误追踪:{}"
.
format
(
ifauser_id
,
ifauser_name
,
customer_id
,
customer_name
,
traceback
.
format_exc
()))
logging
.
error
(
"IFAID{}: IFAName{}, 客户ID{}, 客户Name: {}的基金月报生成异常,错误追踪:{}"
.
format
(
ifauser_id
,
ifauser_name
,
customer_id
,
customer_name
,
traceback
.
format_exc
()))
print
(
"IFA: {}, 客户: {}的基金月报生成异常,错误追踪:{}"
.
format
(
ifauser_name
,
customer_name
,
traceback
.
format_exc
()))
print
(
"IFA: {}, 客户: {}的基金月报生成异常,错误追踪:{}"
.
format
(
ifauser_name
,
customer_name
,
traceback
.
format_exc
()))
finally
:
finally
:
return
None
auth
=
oss2
.
Auth
(
config
[
env
][
'oss'
][
'account'
],
config
[
env
][
'oss'
][
'password'
])
# Endpoint以杭州为例,其它Region请按实际情况填写。
bucket
=
oss2
.
Bucket
(
auth
,
'http://oss-cn-shanghai.aliyuncs.com'
,
'tamperdev'
)
# 生成下载文件的签名URL,有效时间为60s。
path
=
bucket
.
sign_url
(
'GET'
,
'productionenv/Start/'
+
pdf_name
,
60
)
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
tamp_diagnose_app_session
=
tamp_diagnose_app
.
session
sql
=
"update hold_report set update_time='{}', update_status='{}', file='{}' where ifa_id='{}' and customer_id='{}'"
.
format
(
datetime
.
datetime
.
now
(),
2
,
pdf_name
,
ifauser_id
,
customer_id
)
tamp_diagnose_app_session
.
execute
(
sql
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
data
=
[]
data
=
[]
...
...
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