Example #1
0
        /// <summary>
        /// 获取服务节点列表
        /// </summary>
        /// <param name="filter">查询条件</param>
        /// <returns></returns>
        public List <ServerNodeDto> GetServerNodeList(ServerNodeFilterDto filter)
        {
            var serverNodeList = serverNodeService.GetServerNodeList(CreateQueryObject(filter));

            return(serverNodeList.Select(c => c.MapTo <ServerNodeDto>()).ToList());
        }
Example #2
0
        /// <summary>
        /// 数据列表加载额外的对象数据
        /// </summary>
        /// <param name="datas">数据信息</param>
        /// <param name="query">查询对象</param>
        List <ErrorLog> LoadOtherObjectData(IEnumerable <ErrorLog> datas, IQuery query)
        {
            #region 参数判断

            if (datas.IsNullOrEmpty())
            {
                return(new List <ErrorLog>(0));
            }
            if (query == null || query.LoadPropertys == null || query.LoadPropertys.Count <= 0)
            {
                return(datas.ToList());
            }

            #endregion

            #region  务信息

            List <ServerNode> serverList = null;
            if (query.AllowLoad <ErrorLog>(c => c.Server))
            {
                List <string> serverIds = datas.Select(c => c.Server?.Id).Distinct().ToList();
                serverList = serverNodeService.GetServerNodeList(serverIds);
            }

            #endregion

            #region 工作信息

            List <Job> jobList = null;
            if (query.AllowLoad <ErrorLog>(c => c.Job))
            {
                List <string> jobIds = datas.Select(c => c.Job?.Id).Distinct().ToList();
                jobList = jobService.GetJobList(jobIds);
            }

            #endregion

            #region 执行计划

            List <Trigger> triggerList = null;
            if (query.AllowLoad <ErrorLog>(c => c.Trigger))
            {
                List <string> triggerIds = datas.Select(c => c.Trigger?.Id).Distinct().ToList();
                triggerList = triggerService.GetTriggerList(triggerIds);
            }

            #endregion

            foreach (var log in datas)
            {
                if (!serverList.IsNullOrEmpty())
                {
                    log.SetServer(serverList.FirstOrDefault(c => c.Id == log.Server?.Id));
                }
                if (!jobList.IsNullOrEmpty())
                {
                    log.SetJob(jobList.FirstOrDefault(c => c.Id == log.Job?.Id));
                }
                if (!triggerList.IsNullOrEmpty())
                {
                    log.SetTrigger(triggerList.FirstOrDefault(c => c.Id == log.Trigger?.Id));
                }
            }
            return(datas.ToList());
        }