diff --git a/apps/hrm/services.py b/apps/hrm/services.py index b819d4e9..59d0994e 100755 --- a/apps/hrm/services.py +++ b/apps/hrm/services.py @@ -480,6 +480,9 @@ class HrmService: @classmethod def init_doorauth(cls): + """ + 根据third_info里的dchannels信息生成表, 后续dchannels可以不用了 + """ from apps.third.models import DoorAuth from apps.utils.snowflake import idWorker DoorAuth.objects.all().delete() @@ -493,3 +496,21 @@ class HrmService: DoorAuth(id=id, employee=ep, dchannel=TDevice.objects.get(code=i))) DoorAuth.objects.bulk_create(drs) print(f'{ind+1}-{ep.name}-doorauth已创建') + + @classmethod + def clear_bgl_r(cls): + """ + 清空办公室打卡门禁的相关方权限 + """ + from apps.third.models import DoorAuth + qs = DoorAuth.objects.filter( + employee__type='remployee', dchannel__code='1002222$7$0$0') + for ins in qs: + dh_face_card = ins.employee.third_info['dh_face_card'] + dh_id = ins.employee.third_info['dh_id'] + rdict = {"personIdsString": str(dh_id), + "cardNumberString": str(dh_face_card), "channelCode": ins.dchannel.code} + dhClient.request( + **dhapis['card_door_authority_delete'], json=rdict) + ins.delete() + print(f'{ins.employee.name}-办公室打卡权限已删除')