DDStructController.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. using DingTalk.Api;
  2. using DingTalk.Api.Request;
  3. using DingTalk.Api.Response;
  4. using Microsoft.AspNetCore.Http;
  5. using Microsoft.AspNetCore.Mvc;
  6. using Microsoft.Extensions.Configuration;
  7. using Microsoft.Extensions.Options;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text.Json;
  12. using System.Threading.Tasks;
  13. using TEAMModelOS.Models;
  14. using TEAMModelOS.SDK.DI;
  15. using TEAMModelOS.SDK.Models.Service;
  16. namespace TEAMModeBI.Controllers.DingDingStruc
  17. {
  18. [Route("dd")]
  19. [ApiController]
  20. public class DDStructController : ControllerBase
  21. {
  22. private readonly IConfiguration _configuration;
  23. //数据容器
  24. private readonly AzureCosmosFactory _azureCosmos;
  25. //文件容器
  26. private readonly AzureStorageFactory _azureStorage;
  27. //钉钉提示信息
  28. private readonly DingDing _dingDing;
  29. private readonly Option _option;
  30. public DDStructController(IConfiguration configuration, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, CoreAPIHttpService aoreAPIHttpService)
  31. {
  32. _configuration = configuration;
  33. _azureCosmos = azureCosmos;
  34. _azureStorage = azureStorage;
  35. _dingDing = dingDing;
  36. _option = option?.Value;
  37. }
  38. /// <summary>
  39. /// 获取组织架构列表
  40. /// </summary>
  41. /// <returns></returns>
  42. [ProducesDefaultResponseType]
  43. [HttpPost("ddminstruc")]
  44. public async Task<IActionResult> DDMainStruc()
  45. {
  46. string str_appKey = _configuration["DingDingAuth:appKey"];
  47. string str_appSecret = _configuration["DingDingAuth:appSecret"];
  48. //获取企业内部应用的accessToken
  49. IDingTalkClient Iclient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
  50. OapiGettokenRequest request = new OapiGettokenRequest();
  51. request.Appkey = str_appKey;
  52. request.Appsecret = str_appSecret;
  53. request.SetHttpMethod("GET");
  54. OapiGettokenResponse tokenResponse = Iclient.Execute(request);
  55. if (tokenResponse.IsError)
  56. {
  57. return Ok(new { status = 0, message = "请检查配置" });
  58. }
  59. string access_token1 = tokenResponse.AccessToken;
  60. IDingTalkClient dingTalkClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/org/union/trunk/get");
  61. OapiOrgUnionTrunkGetRequest oapiOrgUnionTrunkGetRequest = new OapiOrgUnionTrunkGetRequest();
  62. OapiOrgUnionTrunkGetResponse oapiOrgUnionTrunkGetResponse = dingTalkClient.Execute(oapiOrgUnionTrunkGetRequest, tokenResponse.AccessToken);
  63. return Ok(new { oapiOrgUnionTrunkGetResponse.RequestId , oapiOrgUnionTrunkGetResponse.Body, oapiOrgUnionTrunkGetResponse.Result });
  64. }
  65. /// <summary>
  66. /// 获取分支组织列表信息
  67. /// </summary>
  68. /// <returns></returns>
  69. [ProducesDefaultResponseType]
  70. [HttpPost("ddbranchstruc")]
  71. public async Task<IActionResult> DDBranchStruc()
  72. {
  73. string str_appKey = _configuration["DingDingAuth:appKey"];
  74. string str_appSecret = _configuration["DingDingAuth:appSecret"];
  75. //获取企业内部应用的accessToken
  76. IDingTalkClient Iclient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
  77. OapiGettokenRequest request = new OapiGettokenRequest();
  78. request.Appkey = str_appKey;
  79. request.Appsecret = str_appSecret;
  80. request.SetHttpMethod("GET");
  81. OapiGettokenResponse tokenResponse = Iclient.Execute(request);
  82. if (tokenResponse.IsError)
  83. {
  84. return Ok(new { status = 0, message = "请检查配置" });
  85. }
  86. IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/org/union/branch/get");
  87. OapiOrgUnionBranchGetRequest req = new OapiOrgUnionBranchGetRequest();
  88. OapiOrgUnionBranchGetResponse rsp = client.Execute(req, tokenResponse.AccessToken);
  89. return Ok(new { Result = rsp.Result, Body = rsp.Body, RequestId = rsp.RequestId, SubErrCode = rsp.SubErrCode, Success = rsp.Success });
  90. }
  91. /// <summary>
  92. /// 获取企业部门列表
  93. /// </summary>
  94. [ProducesDefaultResponseType]
  95. [HttpPost("get-deptlist")]
  96. public async Task<IActionResult> GetDeptList()
  97. {
  98. try
  99. {
  100. string appKey = _configuration["DingDingAuth:appKey"];
  101. string appSecret = _configuration["DingDingAuth:appSecret"];
  102. //获取access_token
  103. DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
  104. OapiGettokenRequest request = new OapiGettokenRequest();
  105. request.Appkey = appKey;
  106. request.Appsecret = appSecret;
  107. request.SetHttpMethod("Get");
  108. OapiGettokenResponse response = client.Execute(request);
  109. if (response.IsError)
  110. {
  111. return BadRequest();
  112. }
  113. //access_token的有效期为7200秒(2小时),有效期内重复获取会返回相同结果并自动续期,过期后获取会返回新的access_token
  114. string access_token = response.AccessToken;
  115. //获取一级部门列表
  116. IDingTalkClient v2ListsubClient1 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
  117. OapiV2DepartmentListsubRequest reqlistsub1 = new OapiV2DepartmentListsubRequest() { DeptId = 1L, Language = "zh_CN" };
  118. OapiV2DepartmentListsubResponse rsplistsub1 = v2ListsubClient1.Execute(reqlistsub1, access_token);
  119. List<DeptInfo> templsit = new List<DeptInfo>();
  120. if (rsplistsub1.Result != null)
  121. {
  122. foreach (var deptList in rsplistsub1.Result)
  123. {
  124. DeptInfo deptInfo = new DeptInfo();
  125. deptInfo.deptId = deptList.DeptId;
  126. deptInfo.deptName = deptList.Name;
  127. deptInfo.parentId = deptList.ParentId;
  128. //获取一级部门用户列表
  129. IDingTalkClient userListClient1 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/listid");
  130. OapiUserListidRequest reqUserList1 = new OapiUserListidRequest() { DeptId = deptList.DeptId };
  131. OapiUserListidResponse rspUserList1 = userListClient1.Execute(reqUserList1, access_token);
  132. if (rspUserList1.Result != null)
  133. {
  134. deptInfo.ddUserList = rspUserList1.Result.UseridList;
  135. }
  136. //获取用户详细信息
  137. IDingTalkClient v2UserListClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
  138. OapiV2UserGetRequest reqv2UserList = new OapiV2UserGetRequest();
  139. OapiV2UserGetResponse rspv2UserList = v2UserListClient.Execute(reqv2UserList, access_token);
  140. //获取二级部门列表
  141. OapiV2DepartmentListsubRequest reqlistsub = new OapiV2DepartmentListsubRequest() { DeptId = deptList.DeptId, Language = "zh_CN" };
  142. OapiV2DepartmentListsubResponse rsplistsub = v2ListsubClient1.Execute(reqlistsub, access_token);
  143. List<DeptBaseResponseDomain> deptBaseResponseDomainList = new List<DeptBaseResponseDomain>();
  144. if (rsplistsub.Result != null)
  145. {
  146. foreach (var deptlist2 in rsplistsub.Result)
  147. {
  148. //添加二级部门
  149. DeptBaseResponseDomain deptBaseResponseDomain2 = new DeptBaseResponseDomain();
  150. deptBaseResponseDomain2.deptId = deptlist2.DeptId;
  151. deptBaseResponseDomain2.Name = deptlist2.Name;
  152. deptBaseResponseDomain2.ParentId = deptlist2.ParentId;
  153. //获取三级部门用户列表
  154. OapiUserListidRequest reqUserList2 = new OapiUserListidRequest() { DeptId = deptlist2.DeptId };
  155. OapiUserListidResponse rspUserList2 = userListClient1.Execute(reqUserList2, access_token);
  156. if (rspUserList2.Result != null)
  157. {
  158. //添加三级部门用户
  159. deptBaseResponseDomain2.ddUserList = rspUserList2.Result.UseridList;
  160. }
  161. //获取三级部门列表
  162. OapiV2DepartmentListsubRequest reqlistsub3 = new OapiV2DepartmentListsubRequest() { DeptId = deptlist2.DeptId, Language = "zh_CN" };
  163. OapiV2DepartmentListsubResponse rsplistsub3 = v2ListsubClient1.Execute(reqlistsub3, access_token);
  164. List<DeptBaseResponseDomain> deptBaseResponseDomain3List = new List<DeptBaseResponseDomain>();
  165. if (rsplistsub3.Result != null)
  166. {
  167. foreach (var dept3List in rsplistsub3.Result)
  168. {
  169. //添加三级部门
  170. DeptBaseResponseDomain deptBaseResponseDomain3 = new DeptBaseResponseDomain();
  171. deptBaseResponseDomain3.deptId = dept3List.DeptId;
  172. deptBaseResponseDomain3.Name = dept3List.Name;
  173. deptBaseResponseDomain3.ParentId = dept3List.ParentId;
  174. //获取部门用户列表
  175. OapiUserListidRequest reqUserList3 = new OapiUserListidRequest() { DeptId = dept3List.DeptId };
  176. OapiUserListidResponse rspUserList3 = userListClient1.Execute(reqUserList3, access_token);
  177. if (rspUserList3.Result != null)
  178. {
  179. //添加三级部门的用户
  180. deptBaseResponseDomain3.ddUserList = rspUserList3.Result.UseridList;
  181. }
  182. //获取部门列表 四级目录
  183. OapiV2DepartmentListsubRequest reqlistsub4 = new OapiV2DepartmentListsubRequest() { DeptId = dept3List.DeptId, Language = "zh_CN" };
  184. OapiV2DepartmentListsubResponse rsplistsu4 = v2ListsubClient1.Execute(reqlistsub4, access_token);
  185. List<DeptBaseResponseDomain> deptBaseResponseDomain4List = new List<DeptBaseResponseDomain>();
  186. if (rsplistsu4.Result != null)
  187. {
  188. foreach (var dept4List in rsplistsu4.Result)
  189. {
  190. DeptBaseResponseDomain deptBaseResponseDomain4 = new DeptBaseResponseDomain();
  191. deptBaseResponseDomain4.deptId = dept4List.DeptId;
  192. deptBaseResponseDomain4.Name = dept4List.Name;
  193. deptBaseResponseDomain4.ParentId = dept4List.ParentId;
  194. deptBaseResponseDomain4List.Add(deptBaseResponseDomain4);
  195. //获取三级部门用户列表
  196. OapiUserListidRequest reqUserList4 = new OapiUserListidRequest() { DeptId = dept4List.DeptId };
  197. OapiUserListidResponse rspUserList4 = userListClient1.Execute(reqUserList4, access_token);
  198. if (rspUserList4.Result != null)
  199. {
  200. //添加四级部门的用户
  201. deptBaseResponseDomain4.ddUserList = rspUserList4.Result.UseridList;
  202. }
  203. }
  204. }
  205. //添加四级部门列表
  206. deptBaseResponseDomain3.LowerDeip_List = deptBaseResponseDomain4List;
  207. deptBaseResponseDomain3List.Add(deptBaseResponseDomain3);
  208. }
  209. }
  210. //添加三级部门列表
  211. deptBaseResponseDomain2.LowerDeip_List = deptBaseResponseDomain3List;
  212. deptBaseResponseDomainList.Add(deptBaseResponseDomain2);
  213. }
  214. }
  215. //添加二级部门列表
  216. deptInfo.deptList = deptBaseResponseDomainList;
  217. templsit.Add(deptInfo);
  218. }
  219. }
  220. return Ok(new { state = 200, deptlist = templsit });
  221. }
  222. catch (Exception ex)
  223. {
  224. return Ok(new { state = 1, message=$"查询失败!:状态:{ex.StackTrace}错误:{ex.Message}" }) ;
  225. }
  226. }
  227. /// <summary>
  228. /// 获取当前用户的父级集合
  229. /// </summary>
  230. /// <param name="jsonElement"></param>
  231. /// <returns></returns>
  232. [ProducesDefaultResponseType]
  233. [HttpPost("get-parentdept")]
  234. public async Task<IActionResult> GetParentDept(JsonElement jsonElement)
  235. {
  236. try
  237. {
  238. if (!jsonElement.TryGetProperty("userId", out JsonElement userId)) return Ok(new { state = 1, message = "参数错误!" });
  239. string appKey = _configuration["DingDingAuth:appKey"];
  240. string appSecret = _configuration["DingDingAuth:appSecret"];
  241. //获取access_token
  242. DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
  243. OapiGettokenRequest request = new OapiGettokenRequest();
  244. request.Appkey = appKey;
  245. request.Appsecret = appSecret;
  246. request.SetHttpMethod("Get");
  247. OapiGettokenResponse response = client.Execute(request);
  248. if (response.IsError)
  249. {
  250. return BadRequest();
  251. }
  252. //access_token的有效期为7200秒(2小时),有效期内重复获取会返回相同结果并自动续期,过期后获取会返回新的access_token
  253. string access_token = response.AccessToken;
  254. IDingTalkClient v2DeartDeptClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listparentbyuser");
  255. OapiV2DepartmentListparentbyuserRequest reqDeartDept = new OapiV2DepartmentListparentbyuserRequest() { Userid = userId.ToString() };
  256. OapiV2DepartmentListparentbyuserResponse rspDeartDept = v2DeartDeptClient.Execute(reqDeartDept, access_token);
  257. if (rspDeartDept.Result != null)
  258. {
  259. List<long> userParentDept = new List<long>();
  260. //var parentDept = rspDeartDept.Result.ParentList;
  261. foreach (var temp in rspDeartDept.Result.ParentList)
  262. {
  263. foreach (var deptTemp in temp.ParentDeptIdList)
  264. {
  265. userParentDept.Add(deptTemp);
  266. }
  267. }
  268. return Ok(new { state = 200, parentList = userParentDept });
  269. }
  270. return Ok(new { state = 2, message = "访问失败!" });
  271. }
  272. catch (Exception ex)
  273. {
  274. return Ok(new { state = 2, message = $"访问失败!状态:{ex.StackTrace} 错误:{ex.Message}" });
  275. }
  276. }
  277. /// <summary>
  278. ///
  279. /// </summary>
  280. /// <returns></returns>
  281. public async Task<IActionResult> SetDeptList(JsonElement jsonElement)
  282. {
  283. try
  284. {
  285. string appKey = _configuration["DingDingAuth:appKey"];
  286. string appSecret = _configuration["DingDingAuth:appSecret"];
  287. //获取access_token
  288. DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
  289. OapiGettokenRequest request = new OapiGettokenRequest();
  290. request.Appkey = appKey;
  291. request.Appsecret = appSecret;
  292. request.SetHttpMethod("Get");
  293. OapiGettokenResponse response = client.Execute(request);
  294. if (response.IsError)
  295. {
  296. return BadRequest();
  297. }
  298. //access_token的有效期为7200秒(2小时),有效期内重复获取会返回相同结果并自动续期,过期后获取会返回新的access_token
  299. string access_token = response.AccessToken;
  300. //获取部门列表 一级目录
  301. IDingTalkClient v2ListsubClient1 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
  302. OapiV2DepartmentListsubRequest reqlistsub1 = new OapiV2DepartmentListsubRequest() { DeptId = 1L, Language = "zh_CN" };
  303. OapiV2DepartmentListsubResponse rsplistsub1 = v2ListsubClient1.Execute(reqlistsub1, access_token);
  304. List<DeptInfo> templsit = new List<DeptInfo>();
  305. if (rsplistsub1.Result != null)
  306. {
  307. foreach (var deptList in rsplistsub1.Result)
  308. {
  309. DeptInfo deptInfo = new DeptInfo();
  310. deptInfo.deptId = deptList.DeptId;
  311. deptInfo.deptName = deptList.Name;
  312. deptInfo.parentId = deptList.ParentId;
  313. //获取一级部门用户列表
  314. IDingTalkClient userListClient1 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/listid");
  315. OapiUserListidRequest reqUserList1 = new OapiUserListidRequest() { DeptId = deptList.DeptId };
  316. OapiUserListidResponse rspUserList1 = userListClient1.Execute(reqUserList1, access_token);
  317. if (rspUserList1.Result != null)
  318. {
  319. deptInfo.ddUserList = rspUserList1.Result.UseridList;
  320. }
  321. //获取用户详细信息
  322. IDingTalkClient v2UserListClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
  323. OapiV2UserGetRequest reqv2UserList = new OapiV2UserGetRequest();
  324. OapiV2UserGetResponse rspv2UserList = v2UserListClient.Execute(reqv2UserList, access_token);
  325. //获取二级部门列表
  326. OapiV2DepartmentListsubRequest reqlistsub = new OapiV2DepartmentListsubRequest() { DeptId = deptList.DeptId, Language = "zh_CN" };
  327. OapiV2DepartmentListsubResponse rsplistsub = v2ListsubClient1.Execute(reqlistsub, access_token);
  328. List<DeptBaseResponseDomain> deptBaseResponseDomainList = new List<DeptBaseResponseDomain>();
  329. if (rsplistsub.Result != null)
  330. {
  331. foreach (var deptlist2 in rsplistsub.Result)
  332. {
  333. //添加二级部门
  334. DeptBaseResponseDomain deptBaseResponseDomain2 = new DeptBaseResponseDomain();
  335. deptBaseResponseDomain2.deptId = deptlist2.DeptId;
  336. deptBaseResponseDomain2.Name = deptlist2.Name;
  337. deptBaseResponseDomain2.ParentId = deptlist2.ParentId;
  338. //获取三级部门用户列表
  339. OapiUserListidRequest reqUserList2 = new OapiUserListidRequest() { DeptId = deptlist2.DeptId };
  340. OapiUserListidResponse rspUserList2 = userListClient1.Execute(reqUserList2, access_token);
  341. if (rspUserList2.Result != null)
  342. {
  343. //添加三级部门用户
  344. deptBaseResponseDomain2.ddUserList = rspUserList2.Result.UseridList;
  345. }
  346. //获取三级部门列表
  347. OapiV2DepartmentListsubRequest reqlistsub3 = new OapiV2DepartmentListsubRequest() { DeptId = deptlist2.DeptId, Language = "zh_CN" };
  348. OapiV2DepartmentListsubResponse rsplistsub3 = v2ListsubClient1.Execute(reqlistsub3, access_token);
  349. List<DeptBaseResponseDomain> deptBaseResponseDomain3List = new List<DeptBaseResponseDomain>();
  350. if (rsplistsub3.Result != null)
  351. {
  352. foreach (var dept3List in rsplistsub3.Result)
  353. {
  354. //添加三级部门
  355. DeptBaseResponseDomain deptBaseResponseDomain3 = new DeptBaseResponseDomain();
  356. deptBaseResponseDomain3.deptId = dept3List.DeptId;
  357. deptBaseResponseDomain3.Name = dept3List.Name;
  358. deptBaseResponseDomain3.ParentId = dept3List.ParentId;
  359. //获取部门用户列表
  360. OapiUserListidRequest reqUserList3 = new OapiUserListidRequest() { DeptId = dept3List.DeptId };
  361. OapiUserListidResponse rspUserList3 = userListClient1.Execute(reqUserList3, access_token);
  362. if (rspUserList3.Result != null)
  363. {
  364. //添加三级部门的用户
  365. deptBaseResponseDomain3.ddUserList = rspUserList3.Result.UseridList;
  366. }
  367. //获取部门列表 四级目录
  368. OapiV2DepartmentListsubRequest reqlistsub4 = new OapiV2DepartmentListsubRequest() { DeptId = dept3List.DeptId, Language = "zh_CN" };
  369. OapiV2DepartmentListsubResponse rsplistsu4 = v2ListsubClient1.Execute(reqlistsub4, access_token);
  370. List<DeptBaseResponseDomain> deptBaseResponseDomain4List = new List<DeptBaseResponseDomain>();
  371. if (rsplistsu4.Result != null)
  372. {
  373. foreach (var dept4List in rsplistsu4.Result)
  374. {
  375. DeptBaseResponseDomain deptBaseResponseDomain4 = new DeptBaseResponseDomain();
  376. deptBaseResponseDomain4.deptId = dept4List.DeptId;
  377. deptBaseResponseDomain4.Name = dept4List.Name;
  378. deptBaseResponseDomain4.ParentId = dept4List.ParentId;
  379. deptBaseResponseDomain4List.Add(deptBaseResponseDomain4);
  380. //获取三级部门用户列表
  381. OapiUserListidRequest reqUserList4 = new OapiUserListidRequest() { DeptId = dept4List.DeptId };
  382. OapiUserListidResponse rspUserList4 = userListClient1.Execute(reqUserList4, access_token);
  383. if (rspUserList4.Result != null)
  384. {
  385. //添加四级部门的用户
  386. deptBaseResponseDomain4.ddUserList = rspUserList4.Result.UseridList;
  387. }
  388. }
  389. }
  390. //添加四级部门列表
  391. deptBaseResponseDomain3.LowerDeip_List = deptBaseResponseDomain4List;
  392. deptBaseResponseDomain3List.Add(deptBaseResponseDomain3);
  393. }
  394. }
  395. //添加三级部门列表
  396. deptBaseResponseDomain2.LowerDeip_List = deptBaseResponseDomain3List;
  397. deptBaseResponseDomainList.Add(deptBaseResponseDomain2);
  398. }
  399. }
  400. //添加二级部门列表
  401. deptInfo.deptList = deptBaseResponseDomainList;
  402. templsit.Add(deptInfo);
  403. }
  404. }
  405. return Ok(new { state = 200, deptlist = templsit });
  406. }
  407. catch (Exception ex)
  408. {
  409. return Ok(new { state = 1, message = $"查询失败!:状态:{ex.StackTrace}错误:{ex.Message}" });
  410. }
  411. }
  412. public record DeptInfo
  413. {
  414. /// <summary>
  415. /// 部门ID
  416. /// </summary>
  417. public long deptId { get; set; }
  418. /// <summary>
  419. /// 部门名称
  420. /// </summary>
  421. public string deptName { get; set; }
  422. /// <summary>
  423. /// 父部门id,根部门为1
  424. /// </summary>
  425. public long parentId { get; set; }
  426. /// <summary>
  427. /// 部门集合
  428. /// </summary>
  429. public List<DeptBaseResponseDomain> deptList { get; set; }
  430. /// <summary>
  431. /// 钉钉用户列表
  432. /// </summary>
  433. public List<string> ddUserList { get; set; }
  434. }
  435. public record DeptBaseResponseDomain
  436. {
  437. /// <summary>
  438. /// 部门ID
  439. /// </summary>
  440. public long deptId { get; set; }
  441. /// <summary>
  442. /// 部门名称
  443. /// </summary>
  444. public string Name { get; set; }
  445. /// <summary>
  446. /// 父部门ID
  447. /// </summary>
  448. public long ParentId { get; set; }
  449. /// <summary>
  450. /// 下级列表
  451. /// </summary>
  452. public List<DeptBaseResponseDomain> LowerDeip_List { get; set; }
  453. /// <summary>
  454. /// 钉钉用户列表
  455. /// </summary>
  456. public List<string> ddUserList { get; set; }
  457. }
  458. }
  459. }