public BasicResponse UpdateRealTimeState(UpdateRealTimeStateRequest request) { //根据linkageId获取应急联动信息 var req = new EmergencyLinkageConfigCacheGetByKeyRequest() { Id = request.LinkageId }; var res = _sysEmergencyLinkageCacheService.GetSysEmergencyLinkageCacheByKey(req); if (res.Code != 100) { throw new Exception(res.Message); } var linkageInfo = res.Data; if (linkageInfo != null && linkageInfo.EmergencyLinkageState != Convert.ToInt32(request.State)) { linkageInfo.EmergencyLinkageState = Convert.ToInt32(request.State); var req2 = new EmergencyLinkageConfigCacheUpdateRequest() { SysEmergencyLinkageInfo = linkageInfo }; var res2 = _sysEmergencyLinkageCacheService.UpdateSysEmergencyLinkageCache(req2); if (res2.Code != 100) { throw new Exception(res2.Message); } } return(new BasicResponse()); }
public BasicResponse <List <Jc_DefInfo> > GetAllMasterPointsById(SysEmergencyLinkageGetRequest request) { List <Jc_DefInfo> masterpoints = new List <Jc_DefInfo>(); EmergencyLinkageConfigCacheGetByKeyRequest getrequest = new EmergencyLinkageConfigCacheGetByKeyRequest(); getrequest.Id = request.Id; SysEmergencyLinkageInfo item = _sysEmergencyLinkageCacheService.GetSysEmergencyLinkageCacheByKey(getrequest).Data; PointDefineCacheGetByConditonRequest pointgetrequest = new PointDefineCacheGetByConditonRequest(); if (item != null && !string.IsNullOrEmpty(item.MasterAreaAssId) && item.MasterAreaAssId != "0") { item.MasterAreas.ForEach(area => { pointgetrequest.Predicate = p => p.Areaid == area.AreaId; var areapoints = _pointDefineCacheService.GetPointDefineCache(pointgetrequest).Data; masterpoints.AddRange(areapoints); }); } else if (item != null && !string.IsNullOrEmpty(item.MasterDevTypeAssId) && item.MasterDevTypeAssId != "0") { item.MasterDevTypes.ForEach(devtype => { pointgetrequest.Predicate = p => p.Devid == devtype.DevId; var areapoints = _pointDefineCacheService.GetPointDefineCache(pointgetrequest).Data; masterpoints.AddRange(areapoints); }); } else if (item != null && !string.IsNullOrEmpty(item.MasterPointAssId) && item.MasterPointAssId != "0") { item.MasterPoint.ForEach(point => { pointgetrequest.Predicate = p => p.PointID == point.PointId; var pointdefine = _pointDefineCacheService.GetPointDefineCache(pointgetrequest).Data.FirstOrDefault(); masterpoints.Add(pointdefine); }); } var response = new BasicResponse <List <Jc_DefInfo> >(); response.Data = masterpoints; return(response); }