Esempio n. 1
0
        /// <summary>
        /// 获取一页人员accoutid
        /// </summary>
        /// <param name="codes"></param>
        /// <returns></returns>
        private static ZWDingGetEmployeeAccountIds GetPageAccountIds(List <string> codes)
        {
            Dictionary <string, string> keyValuePairs = new Dictionary <string, string>(new RepeatDictionaryComparer());

            foreach (var item in codes)
            {
                keyValuePairs.Add("employeeCodes", item);
            }
            keyValuePairs.Add("tenantId", AgentId);
            ZWDingGetEmployeeAccountIds res = DingGovRequest <ZWDingGetEmployeeAccountIds>
                                                  (HttpMethod.Post, "/mozi/employee/listEmployeeAccountIds", keyValuePairs);

            return(res);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取人员accoutid
        /// </summary>
        /// <param name="codes"></param>
        /// <returns></returns>
        public static List <ZWDingGetEmployeeAccountIdsModel> GetAccountIds(List <string> codes)
        {
            List <ZWDingGetEmployeeAccountIdsModel> list = new List <ZWDingGetEmployeeAccountIdsModel>();

            if (codes != null && codes.Count > 0)
            {
                codes.Sort((x, y) => x.CompareTo(y)); //顺序
            }
            else
            {
                return(new List <ZWDingGetEmployeeAccountIdsModel>());
            }

            List <string> pagecodes = new List <string>();
            int           pcount    = 0;

            foreach (var codeitem in codes)
            {
                pcount = pcount + 1;
                pagecodes.Add(codeitem);
                if (pcount == GetDepartmentLimit)
                {
                    pcount = 0;
                    ZWDingGetEmployeeAccountIds res = GetPageAccountIds(pagecodes);
                    if (res.Success && res.Content.Success)
                    {
                        list.AddRange(res.Content.Data);
                    }
                    pagecodes = new List <string>();
                }
            }
            if (pagecodes.Count > 0)
            {
                ZWDingGetEmployeeAccountIds res = GetPageAccountIds(pagecodes);
                if (res.Success && res.Content.Success)
                {
                    list.AddRange(res.Content.Data);
                }
            }

            return(list);
        }