统计在厂终端数
This commit is contained in:
parent
ed7ec8e780
commit
df19fae6ce
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue