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
75c3cf34
Commit
75c3cf34
authored
Jan 19, 2021
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报告列表8
parent
f262d5ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
report_service.py
app/service/report_service.py
+22
-13
No files found.
app/service/report_service.py
View file @
75c3cf34
...
@@ -29,31 +29,41 @@ def get_report_list(args):
...
@@ -29,31 +29,41 @@ def get_report_list(args):
end_time
=
args
.
get
(
'end_time'
)
end_time
=
args
.
get
(
'end_time'
)
offset
=
(
pageNumber
-
1
)
*
pageSize
offset
=
(
pageNumber
-
1
)
*
pageSize
res
=
[]
res
=
[]
allow_field
=
[
'id'
,
'customer_id'
,
'ifa_id'
,
'update_time'
,
'update_status'
,
'file'
,
'be_viewed'
,
'name'
]
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
hold_report
=
tamp_diagnose_session
.
query
(
HoldReport
)
.
filter
(
and_
(
hold_report
=
tamp_diagnose_session
.
query
(
HoldReport
)
.
filter
(
and_
(
HoldReport
.
ifa_id
==
ifa_id
,
HoldReport
.
ifa_id
==
ifa_id
,
HoldReport
.
update_time
>=
start_time
,
HoldReport
.
update_time
>=
start_time
,
HoldReport
.
update_time
<=
end_time
HoldReport
.
update_time
<=
end_time
))
.
all
()
))
hold_diagnose_report
=
tamp_diagnose_session
.
query
(
HoldDiagnoseReport
)
.
filter
(
and_
(
hold_diagnose_report
=
tamp_diagnose_session
.
query
(
HoldDiagnoseReport
)
.
filter
(
and_
(
HoldDiagnoseReport
.
ifa_id
==
ifa_id
,
HoldDiagnoseReport
.
ifa_id
==
ifa_id
,
HoldDiagnoseReport
.
update_time
>=
start_time
,
HoldDiagnoseReport
.
update_time
>=
start_time
,
HoldDiagnoseReport
.
update_time
<=
end_time
HoldDiagnoseReport
.
update_time
<=
end_time
))
.
all
()
))
periodic_report
=
tamp_diagnose_session
.
query
(
PeriodicReport
)
.
filter
(
and_
(
periodic_report
=
tamp_diagnose_session
.
query
(
PeriodicReport
)
.
filter
(
and_
(
PeriodicReport
.
ifa_id
==
ifa_id
,
PeriodicReport
.
ifa_id
==
ifa_id
,
PeriodicReport
.
update_time
>=
start_time
,
PeriodicReport
.
update_time
>=
start_time
,
PeriodicReport
.
update_time
<=
end_time
PeriodicReport
.
update_time
<=
end_time
))
.
all
()
))
if
hold_report
.
all
():
hold_report
=
[
r
.
to_dict
(
allow_field
=
allow_field
)
for
r
in
hold_report
]
else
:
hold_report
=
[]
if
hold_diagnose_report
.
all
():
hold_diagnose_report
=
[
r
.
to_dict
(
allow_field
=
allow_field
)
for
r
in
hold_diagnose_report
]
else
:
hold_diagnose_report
=
[]
if
periodic_report
.
all
():
periodic_report
=
[
r
.
to_dict
(
allow_field
=
allow_field
)
for
r
in
periodic_report
]
else
:
periodic_report
=
[]
if
type
==
0
:
if
type
==
0
:
if
hold_report
:
res
.
extend
(
hold_report
)
if
hold_diagnose_report
:
res
.
append
(
hold_diagnose_report
)
if
periodic_report
:
res
.
append
(
periodic_report
)
# res = hold_report.union_all(hold_diagnose_report).union_all(periodic_report)
# res = hold_report.union_all(hold_diagnose_report).union_all(periodic_report)
res
.
extend
(
hold_report
)
res
.
extend
(
hold_diagnose_report
)
res
.
extend
(
periodic_report
)
elif
type
==
1
:
elif
type
==
1
:
res
=
hold_report
res
=
hold_report
elif
type
==
2
:
elif
type
==
2
:
...
@@ -62,11 +72,10 @@ def get_report_list(args):
...
@@ -62,11 +72,10 @@ 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(allow_field=allow_field) for r in data]
totalSize
=
len
(
res
)
totalSize
=
len
(
res
)
data
=
res
[
offset
:
pageSize
]
data
=
res
[
offset
:
pageSize
]
if
data
:
allow_field
=
[
'id'
,
'customer_id'
,
'ifa_id'
,
'update_time'
,
'update_status'
,
'file'
,
'be_viewed'
,
'name'
]
data
=
[
r
.
to_dict
(
allow_field
=
allow_field
)
for
r
in
data
]
return
{
return
{
'content'
:
data
,
'content'
:
data
,
'pageNum'
:
pageNumber
,
'pageNum'
:
pageNumber
,
...
...
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