From 04b879e6a0df9b171bd8bd9e85e1b419f9aadefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Tue, 5 Jul 2022 09:38:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=9C=A8=E5=8E=82=E7=BB=88?= =?UTF-8?q?=E7=AB=AF=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/third/tapis.py | 4 ++++ apps/third/views_d.py | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) 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): """