统计在厂终端数

This commit is contained in:
曹前明 2022-07-05 09:38:01 +08:00
parent 09c175d038
commit 04b879e6a0
2 changed files with 23 additions and 4 deletions

View File

@ -104,6 +104,10 @@ xxapis = {
"url": "/api/devicesV3/ibeacons",
"method": "post"
},
"blt_list": {
"url": "/api/devicesV3/blts",
"method": "post"
},
"rail_create": {
"url": "/api/railsV2/add",
"method": "post"

View File

@ -20,18 +20,33 @@ class BltViewSet(CustomGenericViewSet):
serializer_class = TDeviceSerializer
@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['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)
@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):
"""