统计在厂终端数

This commit is contained in:
曹前明 2022-07-05 11:21:58 +08:00
parent ed7ec8e780
commit df19fae6ce
1 changed files with 13 additions and 2 deletions

View File

@ -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 = {}
ret['total'] = qs.count() ret['total'] = qs.count()
ret['count_employee'] = qs.filter(employee__type='employee').count() ret['count_employee'] = qs.filter(employee__type='employee').count()
@ -45,7 +45,18 @@ class BltViewSet(CustomGenericViewSet):
"online": "online" "online": "online"
} }
_, res = xxClient.request(**xxapis['blt_list'], json=json) _, 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): class TDeviceViewSet(ListModelMixin, CustomGenericViewSet):