Commit b296a9b9 authored by pengxiong's avatar pengxiong

任务10

parent 9f5986a1
...@@ -12,7 +12,7 @@ dev: ...@@ -12,7 +12,7 @@ dev:
port: 6379 port: 6379
db: 0 db: 0
log: log:
filename: /logs/tamp_course_order.log filename: /logs/fund_report.log
filemode: a filemode: a
format: "%(asctime)s %(name)s %(levelname)s %(message)s" format: "%(asctime)s %(name)s %(levelname)s %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S %a" datefmt: "%Y-%m-%d %H:%M:%S %a"
...@@ -32,7 +32,7 @@ test: ...@@ -32,7 +32,7 @@ test:
port: 6379 port: 6379
db: 0 db: 0
log: log:
filename: /logs/tamp_course_order.log filename: /logs/fund_report.log
filemode: a filemode: a
format: "%(asctime)s %(name)s %(levelname)s %(message)s" format: "%(asctime)s %(name)s %(levelname)s %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S %a" datefmt: "%Y-%m-%d %H:%M:%S %a"
...@@ -53,7 +53,7 @@ prod: ...@@ -53,7 +53,7 @@ prod:
port: 6379 port: 6379
db: 0 db: 0
log: log:
filename: /logs/tamp_course_order.log filename: /logs/fund_report.log
filemode: a filemode: a
format: "%(asctime)s %(name)s %(levelname)s %(message)s" format: "%(asctime)s %(name)s %(levelname)s %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S %a" datefmt: "%Y-%m-%d %H:%M:%S %a"
...@@ -327,5 +327,5 @@ class DataIntegrate: ...@@ -327,5 +327,5 @@ class DataIntegrate:
if __name__ == '__main__': if __name__ == '__main__':
start = time.time() 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))) print('耗时{}秒'.format(round(time.time()-start, 2)))
...@@ -51,10 +51,6 @@ class Customer(Base): ...@@ -51,10 +51,6 @@ 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):
# ifauser_id = args[0]
# ifauser_name = args[1]
# customer_id = args[2]
# customer_name = args[3]
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
...@@ -66,17 +62,15 @@ def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name): ...@@ -66,17 +62,15 @@ def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
except OSError: except OSError:
print('IFA: {}, 客户: {}的基金月报已经生成,耗时{}秒'.format(ifauser_name, customer_name, time.time()-start)) print('IFA: {}, 客户: {}的基金月报已经生成,耗时{}秒'.format(ifauser_name, customer_name, time.time()-start))
except Exception as e: 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())) print("IFA: {}, 客户: {}的基金月报生成异常,错误追踪:{}".format(ifauser_name, customer_name, traceback.format_exc()))
if __name__ == '__main__':
with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order: data = []
tamp_user_session = tamp_user.session with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order:
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;') tamp_user_session = tamp_user.session
data = res.fetchall() 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: for d in data:
call_month_report(d[0], d[2], d[1], d[3]) 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