Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
caa8801e
Commit
caa8801e
authored
Jan 18, 2021
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑报告
parent
6bc337fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
12 deletions
+70
-12
report_service.py
app/service/report_service.py
+70
-12
No files found.
app/service/report_service.py
View file @
caa8801e
...
...
@@ -128,6 +128,7 @@ def edit_report(args):
type
=
args
.
get
(
'type'
)
ifa_id
=
args
.
get
(
'ifa_id'
)
report_data
=
args
.
get
(
'report_data'
)
pdf_name
=
str
(
uuid
.
uuid4
())
+
'.pdf'
res
=
[]
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
tamp_diagnose_session
=
tamp_diagnose_app
.
session
...
...
@@ -155,9 +156,67 @@ def edit_report(args):
'report_data'
:
report_data
,
'update_time'
:
datetime
.
datetime
.
now
()
})
if
r
>
0
:
return
True
return
False
pid
=
os
.
fork
()
if
pid
==
0
:
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_
(
HoldReport
.
id
==
id
,
HoldReport
.
ifa_id
==
ifa_id
,
))
hold_diagnose_report
=
tamp_diagnose_session
.
query
(
HoldDiagnoseReport
)
.
filter
(
and_
(
HoldDiagnoseReport
.
id
==
id
,
HoldDiagnoseReport
.
ifa_id
==
ifa_id
,
))
periodic_report
=
tamp_diagnose_session
.
query
(
PeriodicReport
)
.
filter
(
and_
(
PeriodicReport
.
id
==
id
,
PeriodicReport
.
ifa_id
==
ifa_id
,
))
if
type
==
1
:
res
=
hold_report
elif
type
==
2
:
res
=
hold_diagnose_report
elif
type
==
3
:
res
=
periodic_report
if
not
res
:
return
False
res
.
update
({
'update_status'
:
1
,
'update_time'
:
datetime
.
datetime
.
now
()
})
try
:
dt
=
DataIntegrate
(
ifa_id
=
ifa_id
,
customer_id
=
res
[
0
]
.
customer_id
,
pdf_name
=
pdf_name
,
type
=
type
)
dt
.
render_data
(
data
=
json
.
loads
(
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_
(
HoldReport
.
id
==
id
,
HoldReport
.
ifa_id
==
ifa_id
,
))
hold_diagnose_report
=
tamp_diagnose_session
.
query
(
HoldDiagnoseReport
)
.
filter
(
and_
(
HoldDiagnoseReport
.
id
==
id
,
HoldDiagnoseReport
.
ifa_id
==
ifa_id
,
))
periodic_report
=
tamp_diagnose_session
.
query
(
PeriodicReport
)
.
filter
(
and_
(
PeriodicReport
.
id
==
id
,
PeriodicReport
.
ifa_id
==
ifa_id
,
))
if
type
==
1
:
res
=
hold_report
elif
type
==
2
:
res
=
hold_diagnose_report
elif
type
==
3
:
res
=
periodic_report
if
not
res
:
return
False
res
.
update
({
'file'
:
pdf_name
,
'update_status'
:
2
,
'update_time'
:
datetime
.
datetime
.
now
()
})
return
True
def
make_report
(
args
):
...
...
@@ -187,13 +246,13 @@ def make_report(args):
tamp_diagnose_session
.
add
(
report_record
)
tamp_diagnose_session
.
flush
()
record_id
=
report_record
.
id
#
pid = os.fork()
if
0
==
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
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
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_
(
...
...
@@ -221,6 +280,5 @@ def make_report(args):
'update_status'
:
2
,
'update_time'
:
datetime
.
datetime
.
now
()
})
return
True
else
:
return
True
return
{
'record_id'
:
record_id
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment