pdf文件名

parent 4beab589
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name : __init__.py.py
# @Time : 2020/11/23 下午4:11
# @Author : X. Peng
# @Email : acepengxiong@163.com
# @Software : PyCharm
# -----------------------------------------------------------------------------
......@@ -18,9 +18,10 @@ from app.utils.radar_chart import gen_radar_chart
class DataIntegrate:
def __init__(self, ifa_id='USER_INFO15914346866762', customer_id='202009281545001'):
def __init__(self, ifa_id='USER_INFO15914346866762', customer_id='202009281545001', pdf_name=str(uuid.uuid4()) + '.pdf'):
self.user_customer = UserCustomerResultAdaptor(ifa_id, customer_id)
self.customer_name = self.user_customer.customer_real_name
self.pdf_name = pdf_name
self.df = self.user_customer.calculate_total_data()
self.d = self.user_customer.calculate_group_result_data()
# 组合数据
......@@ -266,7 +267,7 @@ class DataIntegrate:
# save_file = "app/html/v2/monthReportV2.html"
# with open(save_file, 'w', encoding="utf-8") as f:
# f.write(monthReport_html)
html_to_pdf(monthReport_html, pdf_folder + str(uuid.uuid4()) + '.pdf')
html_to_pdf(monthReport_html, pdf_folder + self.pdf_name)
......
......@@ -38,7 +38,7 @@ class Customer(Base):
def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
print('开始制作IFA: {}, 客户: {}的基金月报'.format(ifauser_name, customer_name))
try:
DataIntegrate(ifauser_id, customer_id)
DataIntegrate(ifauser_id, customer_id, '{}_{}_.pdf'.format(ifauser_name, customer_name))
except:
print("发生异常,下一个走起!")
......@@ -51,7 +51,7 @@ with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tam
tamp_order_session = tamp_order.session
# for ifauser in ifausers:
for ifauser in ifausers[600:1000]:
for ifauser in ifausers:
# 获取某个 ifa 的所有 customer
customers = tamp_order_session.query(Ifa_Customer).\
filter_by(ifa_id = ifauser.id).all()
......
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