Commit b296a9b9 authored by pengxiong's avatar pengxiong

任务10

parent 9f5986a1
......@@ -12,7 +12,7 @@ dev:
port: 6379
db: 0
log:
filename: /logs/tamp_course_order.log
filename: /logs/fund_report.log
filemode: a
format: "%(asctime)s %(name)s %(levelname)s %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S %a"
......@@ -32,7 +32,7 @@ test:
port: 6379
db: 0
log:
filename: /logs/tamp_course_order.log
filename: /logs/fund_report.log
filemode: a
format: "%(asctime)s %(name)s %(levelname)s %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S %a"
......@@ -53,7 +53,7 @@ prod:
port: 6379
db: 0
log:
filename: /logs/tamp_course_order.log
filename: /logs/fund_report.log
filemode: a
format: "%(asctime)s %(name)s %(levelname)s %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S %a"
......@@ -327,5 +327,5 @@ class DataIntegrate:
if __name__ == '__main__':
start = time.time()
DataIntegrate(ifa_id='188843568193236992', customer_id='6734729261802467328')
DataIntegrate(ifa_id='USER_INFO15916076265983', customer_id='6716613794590109696')
print('耗时{}秒'.format(round(time.time()-start, 2)))
......@@ -51,10 +51,6 @@ class Customer(Base):
# ui_username = Column(String(128))
def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
# ifauser_id = args[0]
# ifauser_name = args[1]
# customer_id = args[2]
# customer_name = args[3]
filename = '{}_{}_.pdf'.format(ifauser_name, customer_name)
if os.path.exists(pdf_folder + filename):
return None
......@@ -66,17 +62,15 @@ def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
except OSError:
print('IFA: {}, 客户: {}的基金月报已经生成,耗时{}秒'.format(ifauser_name, customer_name, time.time()-start))
except Exception as e:
logging.error("IFA: {}, 客户: {}的基金月报生成异常,错误追踪:{}".format(ifauser_name, 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()))
with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order:
tamp_user_session = tamp_user.session
res = tamp_user_session.execute('SELECT DISTINCT user_id, customer_id , realname, customer_name FROM (select f1.user_id, f1.customer_id, f2.realname,f3.customer_name from customer_order f1, user_info f2,customer_info f3 where f2.id=f1.user_id and f3.id=f1.customer_id) res;')
data = res.fetchall()
if __name__ == '__main__':
data = []
with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order:
tamp_user_session = tamp_user.session
res = tamp_user_session.execute('SELECT DISTINCT user_id, customer_id , realname, customer_name FROM (select f1.user_id, f1.customer_id, f2.realname,f3.customer_name from customer_order f1, user_info f2,customer_info f3 where f2.id=f1.user_id and f3.id=f1.customer_id) res;')
data = res.fetchall()
for d in data:
call_month_report(d[0], d[2], d[1], d[3])
# args.append((ifauser.id, ifauser.ui_username, customer_full.id, customer_full.customer_name))
# with futures.ProcessPoolExecutor(8) as executor:
# executor.map(call_month_report, args)
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