From c0c59d8dd4cf4f82935d00e2f73944e7e67a9f81 Mon Sep 17 00:00:00 2001 From: aajz Date: Tue, 2 Apr 2024 12:04:48 +0000 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BC=81=E4=B8=9A=E6=88=96?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9C=A8=E4=BD=BF=E7=94=A8=E9=92=89=E9=92=89?= =?UTF-8?q?=E6=9F=90=E4=BA=9B=E5=8A=9F=E8=83=BD=E5=90=8E=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E5=9C=A8=E9=A1=B6=E7=BA=A7id=3D1=E7=9A=84=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E4=B8=8B=E7=94=9F=E6=88=90id=E4=B8=BA=E8=B4=9F=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E9=97=A8=EF=BC=8C=E7=90=86=E5=BA=94=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=8E=89=E5=B9=B6=E5=81=9A=E6=97=A5=E5=BF=97=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aajz --- .../AppService/DingDingSyncContactsService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ContactsSync/VirtualLdap.Application/AppService/DingDingSyncContactsService.cs b/ContactsSync/VirtualLdap.Application/AppService/DingDingSyncContactsService.cs index acfcb89..cc66674 100644 --- a/ContactsSync/VirtualLdap.Application/AppService/DingDingSyncContactsService.cs +++ b/ContactsSync/VirtualLdap.Application/AppService/DingDingSyncContactsService.cs @@ -1,4 +1,4 @@ -using Abp.Application.Services; +using Abp.Application.Services; using Abp.UI; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; @@ -22,6 +22,13 @@ public class DingDingSyncContactsService : SyncContactsBase, ISyncContacts, IApp //获取钉钉所有部门 var depts = DingdingAppService.GetDepartmentList(); Logger.Debug($"钉钉返回部门信息:{JsonConvert.SerializeObject(depts)}"); + //部分企业或组织在使用钉钉某些功能后,将在顶级id=1的部门下生成id为负数的部门,理应筛选掉并做日志提醒 + var deptWithNegativeId = depts.Find(dept => dept.Id < 0); + if (deptWithNegativeId != null) + { + Logger.Debug($"找到了id为负数的部门,id: {deptWithNegativeId.Id}, name: {deptWithNegativeId.Name},现在将其删除"); + depts.Remove(deptWithNegativeId); + } //获取当前数据库中的部门 var deptList = DeptRepository.GetAllList(); -- Gitee