diff --git a/apps/third/tapis.py b/apps/third/tapis.py index 232c0111..7b86dd1a 100755 --- a/apps/third/tapis.py +++ b/apps/third/tapis.py @@ -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" diff --git a/apps/third/views_d.py b/apps/third/views_d.py index 8f21e269..c501363b 100644 --- a/apps/third/views_d.py +++ b/apps/third/views_d.py @@ -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): """