Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
inspect_report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengjinlei
inspect_report
Commits
15bda856
Commit
15bda856
authored
Apr 27, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码整理
parent
7461aed9
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
496 additions
and
675 deletions
+496
-675
agencyapi.py
src/inspect_report/api/agencyapi.py
+0
-1
dataapi.py
src/inspect_report/api/dataapi.py
+12
-205
tasksapi.py
src/inspect_report/api/tasksapi.py
+196
-457
cron.py
src/inspect_report/cron.py
+12
-12
dbhelper.py
src/inspect_report/dbhelper.py
+246
-0
pagehelper.py
src/inspect_report/pagehelper.py
+30
-0
No files found.
src/inspect_report/api/agencyapi.py
View file @
15bda856
...
@@ -98,7 +98,6 @@ class AgencyApi(viewsets.ViewSet):
...
@@ -98,7 +98,6 @@ class AgencyApi(viewsets.ViewSet):
"""
"""
city_id
=
req
.
GET
.
get
(
'city_id'
,
''
)
city_id
=
req
.
GET
.
get
(
'city_id'
,
''
)
country_id
=
req
.
GET
.
get
(
'country_id'
,
''
)
country_id
=
req
.
GET
.
get
(
'country_id'
,
''
)
team_list
=
list
()
top
=
Country
.
objects
.
filter
(
id
=
city_id
)
.
first
()
top
=
Country
.
objects
.
filter
(
id
=
city_id
)
.
first
()
if
top
is
not
None
:
if
top
is
not
None
:
if
top
.
parent
is
None
:
if
top
.
parent
is
None
:
...
...
src/inspect_report/api/dataapi.py
View file @
15bda856
This diff is collapsed.
Click to expand it.
src/inspect_report/api/tasksapi.py
View file @
15bda856
This diff is collapsed.
Click to expand it.
src/inspect_report/cron.py
View file @
15bda856
...
@@ -16,6 +16,15 @@ score_item_service = {'服务用语': 15, '开场白': 5, '结束语': 3, '服
...
@@ -16,6 +16,15 @@ score_item_service = {'服务用语': 15, '开场白': 5, '结束语': 3, '服
score_item_business
=
{
'异议处理'
:
10
,
'业务促成'
:
10
,
'预约及流转'
:
10
,
'服务介绍'
:
10
,
'未提供报价'
:
2
,
'成功件信息核实'
:
20
}
score_item_business
=
{
'异议处理'
:
10
,
'业务促成'
:
10
,
'预约及流转'
:
10
,
'服务介绍'
:
10
,
'未提供报价'
:
2
,
'成功件信息核实'
:
20
}
def
get_remain
(
check
):
remain
=
0
if
check
[
'startTime'
]
and
check
[
'closeTime'
]:
start
=
datetime
.
strptime
(
check
[
'startTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
close
=
datetime
.
strptime
(
check
[
'closeTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
remain
=
int
(
close
-
start
)
return
remain
def
team_seat
():
def
team_seat
():
teams
=
Team
.
objects
.
values_list
(
'id'
,
'name'
)
teams
=
Team
.
objects
.
values_list
(
'id'
,
'name'
)
team_id_name
=
{
team
[
0
]:
team
[
1
]
for
team
in
teams
}
team_id_name
=
{
team
[
0
]:
team
[
1
]
for
team
in
teams
}
...
@@ -53,13 +62,8 @@ def rule_stat(start_date=None, end_date=None):
...
@@ -53,13 +62,8 @@ def rule_stat(start_date=None, end_date=None):
rules_list
=
[]
rules_list
=
[]
data
=
json
.
loads
(
result
)
data
=
json
.
loads
(
result
)
for
d
in
data
:
for
d
in
data
:
remain
=
0
remain
=
get_remain
(
check
)
if
check
[
'startTime'
]
and
check
[
'closeTime'
]:
if
'isViolation'
in
d
.
keys
()
and
d
[
'isViolation'
]
and
'rule'
in
d
.
keys
()
and
'name'
in
d
[
'rule'
]
.
keys
():
start
=
datetime
.
strptime
(
check
[
'startTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
close
=
datetime
.
strptime
(
check
[
'closeTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
remain
=
int
(
close
-
start
)
if
'isViolation'
in
d
.
keys
()
and
d
[
'isViolation'
]
and
'rule'
in
d
.
keys
()
and
'name'
in
d
[
'rule'
]
.
keys
():
name
=
d
[
'rule'
][
'name'
]
name
=
d
[
'rule'
][
'name'
]
rule_obj
=
{
'create_date'
:
start_date
,
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
rule_obj
=
{
'create_date'
:
start_date
,
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'rule'
:
name
,
'rule_num'
:
1
,
'rule'
:
name
,
'rule_num'
:
1
,
...
@@ -102,11 +106,7 @@ def seat_stat(start_date=None, end_date=None):
...
@@ -102,11 +106,7 @@ def seat_stat(start_date=None, end_date=None):
seat_list
=
[]
seat_list
=
[]
for
check
in
checks
:
for
check
in
checks
:
stat_count
+=
1
stat_count
+=
1
remain
=
0
remain
=
get_remain
(
check
)
if
check
[
'startTime'
]
and
check
[
'closeTime'
]:
start
=
datetime
.
strptime
(
check
[
'startTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
close
=
datetime
.
strptime
(
check
[
'closeTime'
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
.
timestamp
()
remain
=
int
(
close
-
start
)
if
check
[
'agentName'
]
in
seat_dict
.
keys
():
if
check
[
'agentName'
]
in
seat_dict
.
keys
():
seat
=
seat_dict
.
get
(
check
[
'agentName'
])
seat
=
seat_dict
.
get
(
check
[
'agentName'
])
seat
[
'total_session'
]
+=
1
seat
[
'total_session'
]
+=
1
...
...
src/inspect_report/dbhelper.py
0 → 100644
View file @
15bda856
This diff is collapsed.
Click to expand it.
src/inspect_report/pagehelper.py
0 → 100644
View file @
15bda856
from
django.core.paginator
import
Paginator
,
PageNotAnInteger
,
EmptyPage
from
inspect_report.models
import
Seat
def
page_with_seat_name
(
all_objects
,
page
,
page_size
,
agent
=
False
):
paginator
=
Paginator
(
all_objects
,
page_size
)
total_count
=
paginator
.
count
try
:
objects
=
paginator
.
page
(
page
)
except
PageNotAnInteger
:
objects
=
paginator
.
page
(
1
)
except
EmptyPage
:
objects
=
paginator
.
page
(
paginator
.
num_pages
)
if
agent
:
objects
=
set_object_seat_name
(
objects
)
return
total_count
,
objects
def
set_object_seat_name
(
objects
):
agent_names
=
[
x
[
'agentName'
]
for
x
in
objects
]
seats_code_name_list
=
Seat
.
objects
.
filter
(
code__in
=
agent_names
)
.
values
(
'code'
,
'name'
)
seats_code_name
=
dict
()
for
seat_code_name
in
seats_code_name_list
:
seats_code_name
[
seat_code_name
[
'code'
]]
=
seat_code_name
[
'name'
]
for
object_dict
in
objects
:
object_dict
[
'seatName'
]
=
seats_code_name
.
get
(
object_dict
[
'agentName'
],
object_dict
[
'agentName'
])
return
objects
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