hrm ep detail返回详细定位信息

This commit is contained in:
caoqianming 2022-10-25 16:20:22 +08:00
parent 90a4e46cc8
commit 738da6d183
2 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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