From ad4378dff17264436c34deb33c844dce1d553c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Sat, 25 Jun 2022 10:01:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=81=E4=B9=A6=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6=20employee=5F=5Fuser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ecm/service.py | 14 ++++++++++---- apps/ecm/tasks.py | 0 apps/hrm/views.py | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 apps/ecm/tasks.py diff --git a/apps/ecm/service.py b/apps/ecm/service.py index d899c5a5..51e7dbcb 100644 --- a/apps/ecm/service.py +++ b/apps/ecm/service.py @@ -9,9 +9,9 @@ class EcmService: """事件处理服务 """ - def create_remind(cls): + def create_remind_and_speak(cls): """ - 创建事件提醒并发送通知 + 创建事件提醒并发送短信/微信/音响 """ pass @@ -62,8 +62,14 @@ class EcmService: if area: json = {"railId": data['railId'], "type": ""} _, res = xxClient.request(**xxapis['rail_ibeacon_list'], json=json) - if res['totalCount'] >= area.count_people_max: + total_count = res['totalCount'] + if total_count >= area.count_people_max: # 触发超员事件 - area.count_people = res['totalCount'] + area.count_people = total_count + area.save() + pass + elif total_count < area.count_people_min: + # 触发缺员事件 + area.count_people_min = total_count area.save() pass diff --git a/apps/ecm/tasks.py b/apps/ecm/tasks.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/hrm/views.py b/apps/hrm/views.py index 4903890c..e183f6e0 100755 --- a/apps/hrm/views.py +++ b/apps/hrm/views.py @@ -189,3 +189,4 @@ class CertificateViewSet(CustomModelViewSet): create_serializer_class = CertificateCreateUpdateSerializer update_serializer_class = CertificateCreateUpdateSerializer serializer_class = CertificateSerializer + filterset_fields = ['employee__user']