Commit e5041c7c authored by zhengjinlei's avatar zhengjinlei

查询列表

parent 0276654d
......@@ -565,6 +565,42 @@ class TasksApi(viewsets.ViewSet):
return Response({'code': 0, 'msg': 'success', 'count': total_count, 'data': seats.object_list})
@action(['post'], detail=False)
def score_detail(self, req: Request):
"""
坐席得分列表
:param req:
:return:
"""
agent_name = req.data.get('agentName', '')
area = req.data.get('area', '')
page = req.data.get('page', '1')
page_size = req.data.get('page_size', '10')
start_date = req.data.get('start_date', (datetime.now() + timedelta(days=-1)).strftime('%Y-%m-%d'))
end_date = req.data.get('end_date', datetime.now().strftime('%Y-%m-%d'))
q_start_date = datetime.strptime(start_date, '%Y-%m-%d').date()
q_end_date = (datetime.strptime(end_date, '%Y-%m-%d') + + timedelta(days=1)).date()
session_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if agent_name:
session_condition['agentName'] = agent_name
if area:
session_condition['task'] = area
checks = RulesStat.objects.filter(**session_condition)\
.extra(select={'sessionCollectionId': 'sessionCollectionId'})\
.values('agentName', 'customName', 'remainTime', 'score', 'sessionCollectionId', 'sessionId', 'taskId')\
.distinct()
paginator = Paginator(checks, page_size)
total_count = paginator.count
try:
seats = paginator.page(page)
except PageNotAnInteger:
seats = paginator.page(1)
except EmptyPage:
seats = paginator.page(paginator.num_pages)
return Response({'code': 0, 'msg': 'success', 'count': total_count, 'data': seats.object_list})
@xframe_options_exempt
def rule(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment