public BasicResponse <List <AreaInfo> > GetPassiveAreaInfoByAssId(LongIdRequest request)
        {
            var req3           = new EmergencyLinkageConfigCacheGetAllRequest();
            var res3           = _sysEmergencyLinkageCacheService.GetAllSysEmergencyLinkageCache(req3);
            var linkageInfo    = res3.Data.FirstOrDefault(a => a.PassiveAreaAssId == request.Id.ToString());
            var passiveAreaAss = linkageInfo == null ? new List <EmergencyLinkagePassiveAreaAssInfo>() : linkageInfo.PassiveAreas;

            var req = new AreaCacheGetAllRequest();
            var res = _areaCacheService.GetAllAreaCache(req);

            if (res.Code != 100)
            {
                throw new Exception(res.Message);
            }
            var allArea = res.Data;
            //var allPassiveAreaAss = _emergencyLinkagePassiveAreaAssRepository.Datas.ToList();

            var res2 = from a in passiveAreaAss
                       join b in allArea on a.AreaId equals b.Areaid into temp
                       from ab in temp.DefaultIfEmpty()
                       //where a.PassiveAreaAssId == request.Id.ToString()
                       select ab;

            var retLis = res2.ToList();
            var ret    = new BasicResponse <List <AreaInfo> >()
            {
                Data = retLis
            };

            return(ret);
        }
        public BasicResponse <List <EnumcodeInfo> > GetMasterTriDataStateByAssId(LongIdRequest request)
        {
            var req3                  = new EmergencyLinkageConfigCacheGetAllRequest();
            var res3                  = _sysEmergencyLinkageCacheService.GetAllSysEmergencyLinkageCache(req3);
            var linkageInfo           = res3.Data.FirstOrDefault(a => a.MasterTriDataStateAssId == request.Id.ToString());
            var masterTriDataStateAss = linkageInfo == null ? new List <EmergencyLinkageMasterTriDataStateAssInfo>() : linkageInfo.MasterTriDataStates;

            var req = new EnumcodeGetByEnumTypeIDRequest()
            {
                EnumTypeId = 4.ToString()
            };
            var res = _enumcodeService.GetEnumcodeByEnumTypeID(req);

            if (res.Code != 100)
            {
                throw new Exception(res.Message);
            }

            var allDataState = res.Data;
            //var allMasterTriDataStateAss = _emergencyLinkageMasterTriDataStateAssRepository.Datas.ToList();

            var res2 = from a in masterTriDataStateAss
                       join b in allDataState on a.DataStateId equals b.LngEnumValue.ToString() into temp
                       from ab in temp.DefaultIfEmpty()
                       //where a.MasterTriDataStateAssId == request.Id.ToString()
                       select ab;

            var retLis = res2.ToList();
            var ret    = new BasicResponse <List <EnumcodeInfo> >()
            {
                Data = retLis
            };

            return(ret);
        }
        public BasicResponse <List <Jc_DevInfo> > GetMasterEquTypeInfoByAssId(LongIdRequest request)
        {
            var req3             = new EmergencyLinkageConfigCacheGetAllRequest();
            var res3             = _sysEmergencyLinkageCacheService.GetAllSysEmergencyLinkageCache(req3);
            var linkageInfo      = res3.Data.FirstOrDefault(a => a.MasterDevTypeAssId == request.Id.ToString());
            var masterDevTypeAss = linkageInfo == null
                ? new List <EmergencyLinkageMasterDevTypeAssInfo>()
                : linkageInfo.MasterDevTypes;

            var req = new DeviceDefineCacheGetAllRequest();
            var res = _deviceDefineCacheService.GetAllPointDefineCache(req);

            if (res.Code != 100)
            {
                throw new Exception(res.Message);
            }
            var allEquType = res.Data;
            //var allMasterDevTypeAss = _emergencyLinkageMasterDevTypeAssRepository.Datas.ToList();

            var res2 = from a in masterDevTypeAss
                       join b in allEquType on a.DevId equals b.Devid into temp
                       from ab in temp.DefaultIfEmpty()
                       //where a.MasterDevTypeAssId == request.Id.ToString()
                       select ab;

            var retLis = res2.ToList();
            var ret    = new BasicResponse <List <Jc_DevInfo> >()
            {
                Data = retLis
            };

            return(ret);
        }
        public BasicResponse <List <SysEmergencyLinkageInfo> > GetAllSysEmergencyLinkageList()
        {
            //var res = _Repository.GetAllSysEmergencyLinkageList();
            //var convert = ObjectConverter.CopyList<SysEmergencyLinkageModel, SysEmergencyLinkageInfo>(res).ToList();
            //var ret = new BasicResponse<List<SysEmergencyLinkageInfo>>()
            //{
            //    Data = convert
            //};
            //return ret;
            var req = new EmergencyLinkageConfigCacheGetAllRequest();
            var res = _sysEmergencyLinkageCacheService.GetAllSysEmergencyLinkageCache(req);
            var ret = new BasicResponse <List <SysEmergencyLinkageInfo> >()
            {
                Data = res.Data
            };

            return(ret);
        }
        public BasicResponse <List <GetSysEmergencyLinkageListAndStatisticsResponse> > GetSysEmergencyLinkageListAndStatistics(StringRequest request)
        {
            var lis = new List <GetSysEmergencyLinkageListAndStatisticsResponse>();

            var req2 = new LargeDataAnalysisConfigCacheGetAllRequest();
            var res2 = _largeDataAnalysisConfigCacheService.GetAllLargeDataAnalysisConfigCache(req2);
            var allLargeDataConfig = res2.Data;

            var req  = new EmergencyLinkageConfigCacheGetAllRequest();
            var res  = _sysEmergencyLinkageCacheService.GetAllSysEmergencyLinkageCache(req);
            var name = request.Str;

            List <SysEmergencyLinkageInfo> queryData;

            if (string.IsNullOrEmpty(name))
            {
                queryData = res.Data.OrderByDescending(a => a.EditTime).ToList();
            }
            else
            {
                queryData = res.Data.Where(a => a.Name == request.Str).OrderByDescending(a => a.EditTime).ToList();
            }
            foreach (var item in queryData)
            {
                var largeDataConfig     = allLargeDataConfig.FirstOrDefault(a => a.Id == item.MasterModelId);
                var largeDataConfigName = largeDataConfig == null ? "" : largeDataConfig.Name;

                var newItem = new GetSysEmergencyLinkageListAndStatisticsResponse()
                {
                    DeletePerson            = item.DeletePerson,
                    DeleteTime              = item.DeleteTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    EditPerson              = item.EditPerson,
                    EditTime                = item.EditTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    Id                      = item.Id,
                    MasterAreaAssId         = item.MasterAreaAssId,
                    MasterAreaNum           = item.MasterAreas.Count.ToString(),
                    MasterDevTypeAssId      = item.MasterDevTypeAssId,
                    MasterDevTypeNum        = item.MasterDevTypes.Count.ToString(),
                    MasterModelName         = largeDataConfigName,
                    MasterPointAssId        = item.MasterPointAssId,
                    MasterPointNum          = item.MasterPoint.Count.ToString(),
                    MasterTriDataStateAssId = item.MasterTriDataStateAssId,
                    MasterTriDataStateNum   = item.MasterTriDataStates.Count.ToString(),
                    PassiveAreaAssId        = item.PassiveAreaAssId,
                    PassiveAreaNum          = item.PassiveAreas.Count.ToString(),
                    PassivePersonAssId      = item.PassivePersonAssId,
                    PassivePersonNum        = item.PassivePersons.Count.ToString(),
                    PassivePointAssId       = item.PassivePointAssId,
                    PassivePointNum         = item.PassivePoints.Count.ToString(),
                    Name                    = item.Name,
                    Type                    = item.Type,
                    TypeName                = item.Type == 1 ? "普通联动" : "大数据分析联动",
                    Duration                = item.Duration
                };
                lis.Add(newItem);
            }

            //var name = request.Str;
            //var dt = _Repository.QueryTable(
            //    "global_SysEmergencyLinkageService_GetSysEmergencyLinkageListAndStatistics", name);

            //foreach (DataRow item in dt.Rows)
            //{
            //    var newItem = new GetSysEmergencyLinkageListAndStatisticsResponse()
            //    {
            //        DeletePerson = item["DeletePerson"].ToString(),
            //        DeleteTime = item["DeleteTimeConvert"].ToString(),
            //        EditPerson = item["EditPerson"].ToString(),
            //        EditTime = item["EditTime"].ToString(),
            //        Id = item["Id"].ToString(),
            //        MasterAreaAssId = item["MasterAreaAssId"].ToString(),
            //        MasterAreaNum = item["MasterAreaNum"].ToString(),
            //        MasterDevTypeAssId = item["MasterDevTypeAssId"].ToString(),
            //        MasterDevTypeNum = item["MasterDevTypeNum"].ToString(),
            //        MasterModelName = item["MasterModelName"] == null ? "" : item["MasterModelName"].ToString(),
            //        MasterPointAssId = item["MasterPointAssId"].ToString(),
            //        MasterPointNum = item["MasterPointNum"].ToString(),
            //        MasterTriDataStateAssId = item["MasterTriDataStateAssId"].ToString(),
            //        MasterTriDataStateNum = item["MasterTriDataStateNum"].ToString(),
            //        PassiveAreaAssId = item["PassiveAreaAssId"].ToString(),
            //        PassiveAreaNum = item["PassiveAreaNum"].ToString(),
            //        PassivePersonAssId = item["PassivePersonAssId"].ToString(),
            //        PassivePersonNum = item["PassivePersonNum"].ToString(),
            //        PassivePointAssId = item["PassivePointAssId"].ToString(),
            //        PassivePointNum = item["PassivePointNum"].ToString(),
            //        Name = item["Name"].ToString(),
            //        Type = (int)item["Type"],
            //        TypeName = (int)item["Type"] == 1 ? "普通联动" : "大数据分析联动",
            //        Duration = Convert.ToInt32(item["Duration"])
            //    };
            //    lis.Add(newItem);
            //}

            var ret = new BasicResponse <List <GetSysEmergencyLinkageListAndStatisticsResponse> >()
            {
                Data = lis
            };

            return(ret);
        }