From da0e35643839602e291311d94eb0a20a04a604fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Thu, 7 Jul 2022 18:13:40 +0800 Subject: [PATCH] label location --- apps/hrm/services.py | 13 +++++++++---- apps/third/serializers.py | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/hrm/services.py b/apps/hrm/services.py index a6471ed4..a6658cca 100755 --- a/apps/hrm/services.py +++ b/apps/hrm/services.py @@ -56,7 +56,7 @@ class HrmService: ) dhClient.request(**dhapis['person_update'], json=json_data) # 开人脸卡 长时间 - if ep.job_state in [Employee.JOB_ON] and ep.type == 'employee': + if ep.job_state in [Employee.JOB_ON]: if not ep.third_info.get('dh_face_card', None): dh_face_card = cls.open_face_card(ep=ep, dh_id=dh_id, departmentId=departmentId) else: @@ -107,9 +107,14 @@ class HrmService: cardId = res['id'] cardNumber = str(ep.id)[3:8] + rannum(5) now = datetime.now() - startDate = now.strftime("%Y-%m-%d %H:%M:%S") - endDate = (datetime(year=now.year+50, - month=now.month, day=1)).strftime("%Y-%m-%d %H:%M:%S") + if ep.type == 'employee': # 如果是内部人员 + startDate = now.strftime("%Y-%m-%d %H:%M:%S") + endDate = (datetime(year=now.year+50, + month=now.month, day=1)).strftime("%Y-%m-%d %H:%M:%S") + elif ep.type == 'remployee': + pass + elif ep.type == 'visitor': + pass json_data = { "id": cardId, "cardNumber": cardNumber, diff --git a/apps/third/serializers.py b/apps/third/serializers.py index 6d5b9274..7ec47599 100755 --- a/apps/third/serializers.py +++ b/apps/third/serializers.py @@ -47,9 +47,10 @@ class BindAreaSerializer(serializers.Serializer): class LabelLocationSerializer(CustomModelSerializer): + code = serializers.CharField(label='设备唯一标识') class Meta: model = TDevice - fields = ['type', 'location', 'area', 'areas', 'code', 'name'] + fields = ['type', 'location', 'area', 'areas', 'name', 'code'] class BindAreasSerializer(serializers.Serializer):