统计在厂终端数
This commit is contained in:
parent
09c175d038
commit
04b879e6a0
|
@ -104,6 +104,10 @@ xxapis = {
|
||||||
"url": "/api/devicesV3/ibeacons",
|
"url": "/api/devicesV3/ibeacons",
|
||||||
"method": "post"
|
"method": "post"
|
||||||
},
|
},
|
||||||
|
"blt_list": {
|
||||||
|
"url": "/api/devicesV3/blts",
|
||||||
|
"method": "post"
|
||||||
|
},
|
||||||
"rail_create": {
|
"rail_create": {
|
||||||
"url": "/api/railsV2/add",
|
"url": "/api/railsV2/add",
|
||||||
"method": "post"
|
"method": "post"
|
||||||
|
|
|
@ -20,18 +20,33 @@ class BltViewSet(CustomGenericViewSet):
|
||||||
serializer_class = TDeviceSerializer
|
serializer_class = TDeviceSerializer
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, perms_map={'get': '*'})
|
@action(methods=['get'], detail=False, perms_map={'get': '*'})
|
||||||
def count_people_bind(self, request):
|
def count_bind(self, request):
|
||||||
"""统计绑定人员数
|
"""统计绑定定位卡人/设备数
|
||||||
|
|
||||||
统计绑定人员数
|
统计绑定定位卡人/设备数
|
||||||
"""
|
"""
|
||||||
qs = self.queryset.exclude(employee=None)
|
qs = self.queryset.exclude(employee=None, type=TDevice.DEVICE_BLT)
|
||||||
ret = {}
|
ret = {}
|
||||||
|
ret['total'] = qs.count()
|
||||||
ret['count_employee'] = qs.filter(employee__type='employee').count()
|
ret['count_employee'] = qs.filter(employee__type='employee').count()
|
||||||
ret['count_remployee'] = qs.filter(employee__type='remployee').count()
|
ret['count_remployee'] = qs.filter(employee__type='remployee').count()
|
||||||
ret['count_visitor'] = qs.filter(employee__type='visitor').count()
|
ret['count_visitor'] = qs.filter(employee__type='visitor').count()
|
||||||
return Response(ret)
|
return Response(ret)
|
||||||
|
|
||||||
|
@action(methods=['get'], detail=False, perms_map={'get': '*'})
|
||||||
|
def count_now(self, request):
|
||||||
|
"""统计在厂终端数
|
||||||
|
|
||||||
|
统计在厂终端数
|
||||||
|
"""
|
||||||
|
json = {
|
||||||
|
"pageNum": 1,
|
||||||
|
"numPerPage": 2000,
|
||||||
|
"online": "online"
|
||||||
|
}
|
||||||
|
_, res = xxClient.request(**xxapis['blt_list'], json=json)
|
||||||
|
print(res)
|
||||||
|
|
||||||
|
|
||||||
class TDeviceViewSet(ListModelMixin, CustomGenericViewSet):
|
class TDeviceViewSet(ListModelMixin, CustomGenericViewSet):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue