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
a1872f7b
Commit
a1872f7b
authored
Mar 30, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rule_detail 根据用户名筛选
parent
028fe762
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
config.example.py
src/config/config.example.py
+21
-0
tasksapi.py
src/inspect_report/api/tasksapi.py
+5
-1
No files found.
src/config/config.example.py
View file @
a1872f7b
...
...
@@ -20,4 +20,25 @@ TABLE_PRE = ''
name_list
=
[
'合肥'
,
'芜湖'
,
'淮北'
,
'安庆'
,
'黄山'
,
'滁州'
,
'阜阳'
,
'亳州'
,
'宿州'
,
'六安'
,
'宣城'
,
'巢湖'
,
'池州'
,
'淮南'
,
'安徽省营业部'
,
'蚌埠'
,
'马鞍山'
,
'铜陵'
]
name_code_dict
=
{
'合肥'
:
'3401'
,
'芜湖'
:
'3402'
,
'淮北'
:
'3406'
,
'安庆'
:
'3408'
,
'黄山'
:
'3410'
,
'滁州'
:
'3411'
,
'阜阳'
:
'3412'
,
'亳州'
:
'3416'
,
'宿州'
:
'3422'
,
'六安'
:
'3424'
,
'宣城'
:
'3425'
,
'巢湖'
:
'3426'
,
'池州'
:
'3429'
,
'淮南'
:
'3404'
,
'安徽省营业部'
:
'3431'
,
'蚌埠'
:
'3403'
,
'马鞍山'
:
'3405'
,
'铜陵'
:
'3407'
,
}
USER_INFO_URL
=
'http://172.17.1.74:8248/getUserInfo'
src/inspect_report/api/tasksapi.py
View file @
a1872f7b
...
...
@@ -8,7 +8,7 @@ from rest_framework.response import Response
from
inspect_report.models
import
Tasks
,
CheckSession
,
RulesStat
,
SeatStat
,
ScoreStat
,
Round
import
json
from
datetime
import
datetime
,
timedelta
from
config.config
import
TABLE_PRE
,
name_list
from
config.config
import
TABLE_PRE
,
name_list
,
name_code_dict
from
django.views.decorators.clickjacking
import
xframe_options_exempt
import
logging
from
pypinyin
import
Style
,
pinyin
...
...
@@ -516,12 +516,14 @@ class TasksApi(viewsets.ViewSet):
return
Response
({
'code'
:
0
,
'msg'
:
'success'
,
'data'
:
data_sort
,
'username'
:
username
})
@
action
([
'post'
],
detail
=
False
)
@
get_account_info
def
rule_detail
(
self
,
req
:
Request
):
"""
首页概述-违规项统计
:param req:
:return:
"""
username
=
req
.
data
.
get
(
'username'
,
''
)
tables
=
req
.
data
.
get
(
'tables'
,
''
)
rule_name
=
req
.
data
.
get
(
'rule'
,
''
)
page
=
req
.
data
.
get
(
'page'
,
'1'
)
...
...
@@ -536,6 +538,8 @@ class TasksApi(viewsets.ViewSet):
table_list
=
tables
session_condition
=
{
'create_date__gte'
:
q_start_date
,
'create_date__lt'
:
q_end_date
,
'rule'
:
rule_name
,
'sessionCollectionId__in'
:
table_list
}
if
username
in
name_list
:
session_condition
[
'agentName__iregex'
]
=
'*'
+
name_code_dict
[
username
]
+
'*'
checks
=
RulesStat
.
objects
.
filter
(
**
session_condition
)
.
values
(
'agentName'
,
'customName'
,
'remainTime'
,
'score'
,
'sessionCollectionId'
,
'sessionId'
,
'taskId'
)
paginator
=
Paginator
(
checks
,
page_size
)
...
...
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