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
dc66fb20
Commit
dc66fb20
authored
May 15, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改定时任务时间
parent
7005f31e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
cron.py
src/inspect_report/cron.py
+22
-12
No files found.
src/inspect_report/cron.py
View file @
dc66fb20
...
@@ -33,16 +33,22 @@ def team_seat():
...
@@ -33,16 +33,22 @@ def team_seat():
return
seat_code_team_name
return
seat_code_team_name
@
kronos
.
register
(
'30
1,6,12
* * *'
)
@
kronos
.
register
(
'30
6
* * *'
)
def
rule_stat
(
start_date
=
None
,
end_date
=
None
):
def
rule_stat
(
start_date
=
None
,
end_date
=
None
):
"""
"""
首页概述-违规项统计
首页概述-违规项统计
按照时间逻辑,录音任务头一天晚上跑,质检任务第二天凌晨五点钟跑,报表任务六点半跑
所以start_date为utc时间减去三小时足够了,至于报表的存储时间,存储当天时间即可,毕竟是当天的质检任务统计的报表
:return:
:return:
"""
"""
seat_code_team_name
=
team_seat
()
seat_code_team_name
=
team_seat
()
if
not
start_date
and
not
end_date
:
if
not
start_date
and
not
end_date
:
start_date
=
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
# 数据库中为utc时间
end_date
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
start_date
=
(
datetime
.
utcnow
()
+
timedelta
(
hours
=-
3
))
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
end_date
=
datetime
.
utcnow
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
create_date
=
(
datetime
.
strptime
(
end_date
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
+
timedelta
(
hours
=
8
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
logger
.
info
(
'[rule_stat]rule stat start...'
)
logger
.
info
(
'[rule_stat]rule stat start...'
)
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
}
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
}
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
...
@@ -63,9 +69,11 @@ def rule_stat(start_date=None, end_date=None):
...
@@ -63,9 +69,11 @@ def rule_stat(start_date=None, end_date=None):
data
=
json
.
loads
(
result
)
data
=
json
.
loads
(
result
)
for
d
in
data
:
for
d
in
data
:
remain
=
get_remain
(
check
)
remain
=
get_remain
(
check
)
if
'isViolation'
in
d
.
keys
()
and
d
[
'isViolation'
]
and
'rule'
in
d
.
keys
()
and
'name'
in
d
[
'rule'
]
.
keys
():
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'
:
create_date
,
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'rule'
:
name
,
'rule_num'
:
1
,
'rule'
:
name
,
'rule_num'
:
1
,
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'agentName'
:
check
[
'agentName'
],
'customName'
:
check
[
'customName'
],
'agentName'
:
check
[
'agentName'
],
'customName'
:
check
[
'customName'
],
...
@@ -80,7 +88,7 @@ def rule_stat(start_date=None, end_date=None):
...
@@ -80,7 +88,7 @@ def rule_stat(start_date=None, end_date=None):
logger
.
info
(
'[rule_stat]rule stat end.'
)
logger
.
info
(
'[rule_stat]rule stat end.'
)
@
kronos
.
register
(
'30
1,6,12
* * *'
)
@
kronos
.
register
(
'30
6
* * *'
)
def
seat_stat
(
start_date
=
None
,
end_date
=
None
):
def
seat_stat
(
start_date
=
None
,
end_date
=
None
):
"""
"""
首页概述-违规坐席统计
首页概述-违规坐席统计
...
@@ -88,8 +96,9 @@ def seat_stat(start_date=None, end_date=None):
...
@@ -88,8 +96,9 @@ def seat_stat(start_date=None, end_date=None):
"""
"""
seat_code_team_name
=
team_seat
()
seat_code_team_name
=
team_seat
()
if
not
start_date
and
not
end_date
:
if
not
start_date
and
not
end_date
:
start_date
=
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
start_date
=
(
datetime
.
utcnow
()
+
timedelta
(
hours
=-
3
))
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
end_date
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
end_date
=
datetime
.
utcnow
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
create_date
=
(
datetime
.
strptime
(
end_date
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
+
timedelta
(
hours
=
8
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
logger
.
info
(
'[seat_stat]violate seat stat start...'
)
logger
.
info
(
'[seat_stat]violate seat stat start...'
)
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
}
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
}
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
...
@@ -113,7 +122,7 @@ def seat_stat(start_date=None, end_date=None):
...
@@ -113,7 +122,7 @@ def seat_stat(start_date=None, end_date=None):
seat
[
'remainTime'
]
+=
remain
seat
[
'remainTime'
]
+=
remain
seat
[
'validate_session'
]
+=
1
if
check
[
'violationRuleCount'
]
>
0
else
0
seat
[
'validate_session'
]
+=
1
if
check
[
'violationRuleCount'
]
>
0
else
0
else
:
else
:
seat_dict
[
check
[
'agentName'
]]
=
{
'create_date'
:
start
_date
,
'agentName'
:
check
[
'agentName'
],
seat_dict
[
check
[
'agentName'
]]
=
{
'create_date'
:
create
_date
,
'agentName'
:
check
[
'agentName'
],
'taskId'
:
check
[
'taskId'
],
'taskId'
:
check
[
'taskId'
],
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'total_session'
:
1
}
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'total_session'
:
1
}
...
@@ -136,8 +145,9 @@ def score_stat(start_date=None, end_date=None):
...
@@ -136,8 +145,9 @@ def score_stat(start_date=None, end_date=None):
"""
"""
seat_code_team_name
=
team_seat
()
seat_code_team_name
=
team_seat
()
if
not
start_date
and
not
end_date
:
if
not
start_date
and
not
end_date
:
start_date
=
(
datetime
.
now
()
+
timedelta
(
days
=-
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
start_date
=
(
datetime
.
utcnow
()
+
timedelta
(
hours
=-
3
))
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
end_date
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
end_date
=
datetime
.
utcnow
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
create_date
=
(
datetime
.
strptime
(
end_date
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
+
timedelta
(
hours
=
8
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
logger
.
info
(
'[score_stat]seat score stat start...'
)
logger
.
info
(
'[score_stat]seat score stat start...'
)
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
}
task_condition
=
{
'hasCheck'
:
1
,
'createdAt__gte'
:
start_date
,
'createdAt__lt'
:
end_date
}
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
tasks
=
Tasks
.
objects
.
filter
(
**
task_condition
)
.
values
(
'id'
,
'name'
,
'sessionCollectionId'
)
...
@@ -179,7 +189,7 @@ def score_stat(start_date=None, end_date=None):
...
@@ -179,7 +189,7 @@ def score_stat(start_date=None, end_date=None):
seat
[
'service_score'
]
=
round
((
seat
[
'service_score'
]
+
service_score
)
/
2
,
2
)
seat
[
'service_score'
]
=
round
((
seat
[
'service_score'
]
+
service_score
)
/
2
,
2
)
seat
[
'business_score'
]
=
round
((
seat
[
'business_score'
]
+
business_score
)
/
2
,
2
)
seat
[
'business_score'
]
=
round
((
seat
[
'business_score'
]
+
business_score
)
/
2
,
2
)
else
:
else
:
seat_dict
[
check
[
'agentName'
]]
=
{
'create_date'
:
start
_date
,
'agentName'
:
check
[
'agentName'
],
seat_dict
[
check
[
'agentName'
]]
=
{
'create_date'
:
create
_date
,
'agentName'
:
check
[
'agentName'
],
'taskId'
:
check
[
'taskId'
],
'taskId'
:
check
[
'taskId'
],
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'task'
:
seat_code_team_name
.
get
(
check
[
'agentName'
],
'未找到团队'
),
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'total_session'
:
1
,
'sessionCollectionId'
:
t
[
'sessionCollectionId'
],
'total_session'
:
1
,
...
...
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