diff --git a/apps/third/views_d.py b/apps/third/views_d.py index c501363b..bbed85a0 100644 --- a/apps/third/views_d.py +++ b/apps/third/views_d.py @@ -25,7 +25,7 @@ class BltViewSet(CustomGenericViewSet): 统计绑定定位卡人/设备数 """ - qs = self.queryset.exclude(employee=None, type=TDevice.DEVICE_BLT) + qs = self.queryset.exclude(employee=None) ret = {} ret['total'] = qs.count() ret['count_employee'] = qs.filter(employee__type='employee').count() @@ -45,7 +45,18 @@ class BltViewSet(CustomGenericViewSet): "online": "online" } _, res = xxClient.request(**xxapis['blt_list'], json=json) - print(res) + ret = {} + ret['total_blt'] = res['totalCount'] + blt_list = res['recordList'] + macs = [] + for i in blt_list: + macs.append(i['mac']) + qs = self.queryset.exclude(employee=None, code__in=macs) + ret['total'] = qs.count() + ret['count_employee'] = qs.filter(employee__type='employee').count() + ret['count_remployee'] = qs.filter(employee__type='remployee').count() + ret['count_visitor'] = qs.filter(employee__type='visitor').count() + return Response(ret) class TDeviceViewSet(ListModelMixin, CustomGenericViewSet):