employee detail 返回门禁时间范围
This commit is contained in:
parent
dd5faaf619
commit
7433d0fd04
|
|
@ -11,6 +11,7 @@ from apps.hrm.models import Certificate, ClockRecord, Employee, NotWorkRemark
|
||||||
from apps.system.serializers import DeptSimpleSerializer, UserSimpleSerializer
|
from apps.system.serializers import DeptSimpleSerializer, UserSimpleSerializer
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from apps.third.clients import dhClient
|
from apps.third.clients import dhClient
|
||||||
|
from apps.third.tapis import dhapis
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from apps.utils.tools import check_phone_e
|
from apps.utils.tools import check_phone_e
|
||||||
|
|
@ -109,6 +110,7 @@ class EmployeeSerializer(CustomModelSerializer):
|
||||||
blt_ = serializers.SerializerMethodField()
|
blt_ = serializers.SerializerMethodField()
|
||||||
photo_f = MyFilePathField(source='photo', read_only=True)
|
photo_f = MyFilePathField(source='photo', read_only=True)
|
||||||
signature_f = MyFilePathField(source='signature', read_only=True)
|
signature_f = MyFilePathField(source='signature', read_only=True)
|
||||||
|
door_range = serializers.SerializerMethodField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Employee
|
model = Employee
|
||||||
|
|
@ -121,6 +123,15 @@ class EmployeeSerializer(CustomModelSerializer):
|
||||||
return TDeviceSimpleSerializer(instance=obj.tdevice).data
|
return TDeviceSimpleSerializer(instance=obj.tdevice).data
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def get_door_range(self, obj):
|
||||||
|
third_info = obj.third_info
|
||||||
|
try:
|
||||||
|
dh_face_card = third_info['dh_face_card']
|
||||||
|
_, res = dhClient.request(**dhapis['card_detail'], params={'cardNumber': dh_face_card})
|
||||||
|
return [res['startDate'], res['endDate']]
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EmployeeNotWorkRemarkSerializer(ModelSerializer):
|
class EmployeeNotWorkRemarkSerializer(ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ dhapis = {
|
||||||
"url": "/evo-apigw/evo-brm/1.0.0/device/{deviceCode}",
|
"url": "/evo-apigw/evo-brm/1.0.0/device/{deviceCode}",
|
||||||
"method": "get"
|
"method": "get"
|
||||||
},
|
},
|
||||||
|
"card_detail": {
|
||||||
|
"url": "/evo-apigw/evo-brm/1.0.0/card/{cardNumber}",
|
||||||
|
"method": "get"
|
||||||
|
},
|
||||||
"channel_list": {
|
"channel_list": {
|
||||||
"url": "/evo-apigw/evo-brm/1.2.0/device/channel/subsystem/page",
|
"url": "/evo-apigw/evo-brm/1.2.0/device/channel/subsystem/page",
|
||||||
"method": "post"
|
"method": "post"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue