Commit b56af54b authored by pengxiong's avatar pengxiong

修复

parent 8376e873
...@@ -5,7 +5,7 @@ from sqlalchemy import Column, DECIMAL, Date, DateTime, Index, String, Table, Te ...@@ -5,7 +5,7 @@ from sqlalchemy import Column, DECIMAL, Date, DateTime, Index, String, Table, Te
from sqlalchemy.dialects.mysql import BIGINT, INTEGER from sqlalchemy.dialects.mysql import BIGINT, INTEGER
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from app.api.engine import TAMP_SQL, tamp_user_engine from app.api.engine import TAMP_SQL, tamp_user_engine, tamp_diagnose_app_engine
from app.model.base import Base from app.model.base import Base
from app.model.base import BaseModel from app.model.base import BaseModel
...@@ -136,14 +136,21 @@ class HoldDiagnoseReport(Base, BaseModel): ...@@ -136,14 +136,21 @@ class HoldDiagnoseReport(Base, BaseModel):
else: else:
allow_field = all_field allow_field = all_field
data = {c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, c) for c in allow_field} 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: 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 tamp_user_session = tamp_user.session
tamp_diagnose_app_session = tamp_diagnose_app.session
sql = "select ui_username_mp from user_info where id = '{}'".format(self.ifa_id) sql = "select ui_username_mp from user_info where id = '{}'".format(self.ifa_id)
res = tamp_user_session.execute(sql) res = tamp_user_session.execute(sql)
sql2 = "select customer_name from tamp_diagnose_app.customer_view where id = '{}'".format(self.customer_id) sql2 = "select customer_name from tamp_diagnose_app.customer_view where id = '{}'".format(self.customer_id)
res2 = tamp_user_session.execute(sql2) res2 = tamp_diagnose_app_session.execute(sql2)
if res:
data['author_name'] = res.fetchone()[0] data['author_name'] = res.fetchone()[0]
else:
data['author_name'] = ''
if res2:
data['customer_name'] = res2.fetchone()[0] data['customer_name'] = res2.fetchone()[0]
else:
data['customer_name'] = ''
data['type'] = 2 data['type'] = 2
return data return data
...@@ -167,18 +174,22 @@ class HoldReport(Base, BaseModel): ...@@ -167,18 +174,22 @@ class HoldReport(Base, BaseModel):
allow_field = set(allow_field) & set(allow_field) allow_field = set(allow_field) & set(allow_field)
else: else:
allow_field = all_field allow_field = all_field
data = { data = {c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, c) for c in allow_field}
c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app:
c) for
c in allow_field}
with TAMP_SQL(tamp_user_engine) as tamp_user:
tamp_user_session = tamp_user.session tamp_user_session = tamp_user.session
tamp_diagnose_app_session = tamp_diagnose_app.session
sql = "select ui_username_mp from user_info where id = '{}'".format(self.ifa_id) sql = "select ui_username_mp from user_info where id = '{}'".format(self.ifa_id)
res = tamp_user_session.execute(sql) res = tamp_user_session.execute(sql)
sql2 = "select customer_name from tamp_diagnose_app.customer_view where id = '{}'".format(self.customer_id) sql2 = "select customer_name from tamp_diagnose_app.customer_view where id = '{}'".format(self.customer_id)
res2 = tamp_user_session.execute(sql2) res2 = tamp_diagnose_app_session.execute(sql2)
if res:
data['author_name'] = res.fetchone()[0] data['author_name'] = res.fetchone()[0]
else:
data['author_name'] = ''
if res2:
data['customer_name'] = res2.fetchone()[0] data['customer_name'] = res2.fetchone()[0]
else:
data['customer_name'] = ''
data['type'] = 1 data['type'] = 1
return data return data
...@@ -202,18 +213,22 @@ class PeriodicReport(Base, BaseModel): ...@@ -202,18 +213,22 @@ class PeriodicReport(Base, BaseModel):
allow_field = set(allow_field) & set(allow_field) allow_field = set(allow_field) & set(allow_field)
else: else:
allow_field = all_field allow_field = all_field
data = { data = {c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, c) for c in allow_field}
c: int(getattr(self, c).timestamp()) if isinstance(getattr(self, c), datetime.datetime) else getattr(self, with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app:
c) for
c in allow_field}
with TAMP_SQL(tamp_user_engine) as tamp_user:
tamp_user_session = tamp_user.session tamp_user_session = tamp_user.session
tamp_diagnose_app_session = tamp_diagnose_app.session
sql = "select ui_username_mp from user_info where id = '{}'".format(self.ifa_id) sql = "select ui_username_mp from user_info where id = '{}'".format(self.ifa_id)
res = tamp_user_session.execute(sql) res = tamp_user_session.execute(sql)
sql2 = "select customer_name from tamp_diagnose_app.customer_view where id = '{}'".format(self.customer_id) sql2 = "select customer_name from tamp_diagnose_app.customer_view where id = '{}'".format(self.customer_id)
res2 = tamp_user_session.execute(sql2) res2 = tamp_diagnose_app_session.execute(sql2)
if res:
data['author_name'] = res.fetchone()[0] data['author_name'] = res.fetchone()[0]
else:
data['author_name'] = ''
if res2:
data['customer_name'] = res2.fetchone()[0] data['customer_name'] = res2.fetchone()[0]
else:
data['customer_name'] = ''
data['type'] = 3 data['type'] = 3
return data return data
......
...@@ -55,6 +55,7 @@ def get_report_list(args): ...@@ -55,6 +55,7 @@ def get_report_list(args):
res = periodic_report res = periodic_report
totalSize = res.count() totalSize = res.count()
data = res.offset(offset).limit(pageSize) data = res.offset(offset).limit(pageSize)
if data:
data = [r.to_dict() for r in data] data = [r.to_dict() for r in data]
return { return {
'content': data, 'content': data,
...@@ -169,6 +170,7 @@ def make_report(args): ...@@ -169,6 +170,7 @@ def make_report(args):
args['update_time'] = datetime.datetime.now() args['update_time'] = datetime.datetime.now()
args['update_status'] = 1 args['update_status'] = 1
args.pop('type')
record_id = 0 record_id = 0
with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app:
tamp_diagnose_session = tamp_diagnose_app.session tamp_diagnose_session = tamp_diagnose_app.session
...@@ -189,6 +191,10 @@ def make_report(args): ...@@ -189,6 +191,10 @@ def make_report(args):
try: try:
dt = DataIntegrate(ifa_id=ifa_id, customer_id=customer_id, pdf_name=pdf_name, type=type) dt = DataIntegrate(ifa_id=ifa_id, customer_id=customer_id, pdf_name=pdf_name, type=type)
dt.render_data(data=report_data) 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_( hold_report = tamp_diagnose_session.query(HoldReport).filter(and_(
HoldReport.id == record_id, HoldReport.id == record_id,
HoldReport.ifa_id == ifa_id, HoldReport.ifa_id == ifa_id,
...@@ -214,7 +220,5 @@ def make_report(args): ...@@ -214,7 +220,5 @@ def make_report(args):
'update_status': 2, 'update_status': 2,
'update_time': datetime.datetime.now() 'update_time': datetime.datetime.now()
}) })
except:
pass
else: else:
return True return True
app/templates/temp_img/0123aea5-2ebb-4153-9a94-509f64182d13.png

100 KB

app/templates/temp_img/071e3256-ab4e-453e-b3f9-e595fe81e12d.png

113 KB

app/templates/temp_img/0816eaaa-b533-4195-89fe-ef394db83601.png

73.3 KB

app/templates/temp_img/08ceb9ea-fd60-4713-885c-da109c512fac.png

73.3 KB

app/templates/temp_img/0f745e23-8149-47c6-b8e3-3c6c65ec709e.png

113 KB

app/templates/temp_img/144f2a6f-6aa5-4bd1-ab32-872b14038546.png

123 KB

app/templates/temp_img/162fc23c-9b48-456e-a6fa-9a3ce6fff7cb.png

117 KB

app/templates/temp_img/16591068-6e79-42fa-ae7b-e181c82871c8.png

158 KB

app/templates/temp_img/23fd4ff6-b83b-406f-8783-f71d59fa2afd.png

113 KB

app/templates/temp_img/251dd054-d207-4ad5-8d59-c230041c224e.png

117 KB

app/templates/temp_img/297cc15e-5ea2-40e6-8be1-a1a006b57ac5.png

93.1 KB

app/templates/temp_img/2db6c5f7-996a-4885-b61b-4e1b6028eebd.png

113 KB

app/templates/temp_img/2fe4053c-d917-4a5e-aa1a-0a15764ef12e.png

73.3 KB

app/templates/temp_img/3bc8c775-48b4-4cd1-8bcd-9c8318c47c36.png

101 KB

app/templates/temp_img/3e5e59fb-4f85-410a-a7e4-678a51ad7003.png

101 KB

app/templates/temp_img/4760382e-b566-4f0d-8ef9-082b6306fde3.png

73.3 KB

app/templates/temp_img/4e3150ce-495c-4bf4-a7a1-980fbd859253.png

93.1 KB

app/templates/temp_img/4e652a4d-b31d-4271-a2f6-a27a5ac90249.png

117 KB

app/templates/temp_img/704f10bc-5655-4b31-9d63-51dc1d766039.png

158 KB

app/templates/temp_img/8b23bb71-d514-4d81-a0cc-9ae6950f1150.png

100 KB

app/templates/temp_img/a33290a0-2b3c-4659-8f83-3c949c6c86a8.png

158 KB

app/templates/temp_img/b920fa8e-0388-4e9a-b6ac-55cc28abd6ec.png

93.1 KB

app/templates/temp_img/bbe4bfee-dc0a-48db-afba-86ffdf2e3114.png

117 KB

app/templates/temp_img/c83581f2-f322-4e8f-841b-d4a29db87932.png

100 KB

app/templates/temp_img/d2d78d89-8310-4cbf-b461-701f1b1c5c86.png

73.3 KB

app/templates/temp_img/d449f303-3a80-4bca-8483-fd158b36c123.png

113 KB

app/templates/temp_img/d5fa5874-514f-454e-b64f-5c9faffd4168.png

158 KB

app/templates/temp_img/dd5795c8-ae40-4672-957f-1a0709cbaacc.png

93.1 KB

app/templates/temp_img/df7a3f6e-aaa1-4992-9ddd-4c181c4ab5e1.png

93.1 KB

app/templates/temp_img/e5be98be-5d01-4d25-bda9-e7b5328f98ec.png

93.1 KB

app/templates/temp_img/ea3c54fc-70b5-42e2-b6cf-7914113f1dba.png

158 KB

app/templates/temp_img/ea9bd931-08e0-4027-a7dd-aa7057d4d639.png

113 KB

app/templates/temp_img/f3ae34cd-7db9-40cd-b366-68531e27290b.png

73.3 KB

app/templates/temp_img/fde418c7-5155-4218-9af1-9155afbad8a4.png

117 KB

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