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