From 6b0a587bec9ce4f0730bc0da32123eecdb13977e Mon Sep 17 00:00:00 2001 From: pengxiong <18163159080@163.com> Date: Mon, 18 Jan 2021 16:28:52 +0800 Subject: [PATCH] fix2 --- app/model/tamp_diagnose_app.py | 9 ++++++--- app/service/report_service.py | 10 +++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/model/tamp_diagnose_app.py b/app/model/tamp_diagnose_app.py index f8e0435..34fac4d 100644 --- a/app/model/tamp_diagnose_app.py +++ b/app/model/tamp_diagnose_app.py @@ -138,7 +138,8 @@ class HoldDiagnoseReport(Base, BaseModel): allow_field = set(allow_field) & set(allow_field) else: allow_field = all_field - self.file = pdf_folder + self.file + if self.file: + self.file = pdf_folder + self.file data = {c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, c) for c in allow_field} with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: tamp_user_session = tamp_user.session @@ -181,7 +182,8 @@ class HoldReport(Base, BaseModel): allow_field = set(allow_field) & set(allow_field) else: allow_field = all_field - self.file = pdf_folder + self.file + if self.file: + self.file = pdf_folder + self.file data = {c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, c) for c in allow_field} with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: tamp_user_session = tamp_user.session @@ -224,7 +226,8 @@ class PeriodicReport(Base, BaseModel): allow_field = set(allow_field) & set(allow_field) else: allow_field = all_field - self.file = pdf_folder + self.file + if self.file: + self.file = pdf_folder + self.file data = {c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, c) for c in allow_field} with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: tamp_user_session = tamp_user.session diff --git a/app/service/report_service.py b/app/service/report_service.py index 727c4bc..6288a06 100644 --- a/app/service/report_service.py +++ b/app/service/report_service.py @@ -189,11 +189,11 @@ def make_report(args): record_id = report_record.id pid = os.fork() if pid == 0: - try: - dt = DataIntegrate(ifa_id=ifa_id, customer_id=customer_id, pdf_name=pdf_name, type=type) - dt.render_data(data=report_data) - except: - pass + # try: + dt = DataIntegrate(ifa_id=ifa_id, customer_id=customer_id, pdf_name=pdf_name, type=type) + dt.render_data(data=report_data) + # except: + # pass with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: tamp_diagnose_session = tamp_diagnose_app.session hold_report = tamp_diagnose_session.query(HoldReport).filter(and_( -- 2.18.1