From 738da6d1832bb5a9e88aec53e99ed1c60dfaf244 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 25 Oct 2022 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?hrm=20ep=20detail=E8=BF=94=E5=9B=9E=E8=AF=A6?= =?UTF-8?q?=E7=BB=86=E5=AE=9A=E4=BD=8D=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/hrm/serializers.py | 6 +++++- requirements.txt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/hrm/serializers.py b/apps/hrm/serializers.py index 3c0f69a1..db464882 100755 --- a/apps/hrm/serializers.py +++ b/apps/hrm/serializers.py @@ -16,6 +16,7 @@ from apps.third.tapis import dhapis from django.conf import settings from django.core.cache import cache from apps.utils.tools import check_id_number_e, check_phone_e, get_info_from_id +from apps.am.models import Area class EmployeeSimpleSerializer(CustomModelSerializer): @@ -44,7 +45,7 @@ class EmployeeCreateUpdateSerializer(CustomModelSerializer): exclude = EXCLUDE_FIELDS + ['is_atwork', 'last_check_time', 'not_work_remark', 'third_info', - 'type', 'name', 'phone', 'belong_dept', 'post', 'user'] + 'type', 'phone', 'belong_dept', 'post', 'user'] extra_kwargs = { 'number': {'required': True}, 'photo': {'required': True}, @@ -157,6 +158,9 @@ class EmployeeDetailSerializer(EmployeeSerializer): def get_location(self, obj): key_str = 'ep_{}'.format(obj.id) ep_loc_dict = cache.get(key_str, None) + if ep_loc_dict: + area_fix_id = ep_loc_dict.get('arex_fix_id', None) + ep_loc_dict['area_fix_name'] = Area.objects.get(id=area_fix_id).name return ep_loc_dict diff --git a/requirements.txt b/requirements.txt index bd33ab8c..2ad42d12 100755 --- a/requirements.txt +++ b/requirements.txt @@ -28,4 +28,5 @@ grpcio-tools==1.47.0 protobuf==3.20.1 pycryptodome==3.15.0 aliyun-python-sdk-core==2.13.36 +xlwt==1.3.0