public BasicResponse <List <V_DefInfo> > GetAllVideoDefCache() { var definfolist = _vdefCacheService.GetAll(new V_DefCacheGetAllRequest()).Data; var response = new BasicResponse <List <V_DefInfo> >(); response.Data = definfolist; return(response); }
/// <summary> /// 获取图形对应测点绑定信息 /// </summary> /// <param name="graphicsbaseinfrequest"></param> /// <returns></returns> public BasicResponse <DataTable> GetMapPointsInfo(GetMapPointsInfoRequest graphicsbaseinfrequest) { var response = new BasicResponse <DataTable>(); if (string.IsNullOrWhiteSpace(graphicsbaseinfrequest.GraphId)) { response.Code = -100; response.Message = "参数错误!"; return(response); } try { var graphicsrouteinfData = _Repository.GetMapPointsInfo(graphicsbaseinfrequest.GraphId); if (graphicsrouteinfData.Rows.Count > 0) { var rdefinfos = rdefCacheService.GetAllRPointDefineCache(new Sys.Safety.Request.PersonCache.RPointDefineCacheGetAllRequest()).Data; var bdefinfos = bdefCacheService.GetAll(new B_DefCacheGetAllRequest()).Data; var vdefinfos = vdefCacheService.GetAll(new V_DefCacheGetAllRequest()).Data; foreach (DataRow row in graphicsrouteinfData.Rows) { var rdefinfo = rdefinfos.FirstOrDefault(o => o.Point == row["Point"].ToString()); if (rdefinfo != null) { row["wz"] = rdefinfo.Wz; row["name"] = rdefinfo.DevName; continue; } var bdefinfo = bdefinfos.FirstOrDefault(o => o.Point == row["Point"].ToString()); if (bdefinfo != null) { row["wz"] = bdefinfo.Wz; row["name"] = bdefinfo.DevName; continue; } var vdefino = vdefinfos.FirstOrDefault(o => o.IPAddress == row["Point"].ToString()); if (vdefino != null) { row["wz"] = vdefino.Devname; row["name"] = "视频"; continue; } if (row["SysId"].ToString() == "-1") { row["name"] = "分析模型"; } } } response.Data = graphicsrouteinfData; } catch (Exception ex) { response.Code = -100; response.Message = ex.Message; this.ThrowException("GetMapPointsInfo-获取图形对应测点绑定信息", ex); } return(response); }
public BasicResponse AddEmergencylinkageconfigMasterInfoPassiveInfo( AddEmergencylinkageconfigMasterInfoPassiveInfoRequest request) { var exist = _Repository.AnySysEmergencyLinkageByLambda(a => a.Name == request.SysEmergencyLinkageInfo.Name && a.Activity == 1); if (exist) { return(new BasicResponse() { Code = 1, Message = "应急联动名称已存在!" }); } //同一个大数据分析模型只能配置一个联动 var masterModelId = request.SysEmergencyLinkageInfo.MasterModelId; if (masterModelId != "0") { var req4 = new EmergencyLinkageConfigCacheGetByConditonRequest { Predicate = a => a.MasterModelId == masterModelId }; var res4 = _sysEmergencyLinkageCacheService.GetSysEmergencyLinkageCache(req4); if (res4.Data.Count != 0) { return(new BasicResponse() { Code = 2, Message = "同一个大数据分析模型只能配置一个应急联动!" }); } } request.SysEmergencyLinkageInfo.Id = IdHelper.CreateLongId().ToString(); //主控测点关联id if (request.EmergencyLinkageMasterPointAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.MasterPointAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.MasterPointAssId = "0"; } //主控设备类型关联id if (request.EmergencyLinkageMasterDevTypeAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.MasterDevTypeAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.MasterDevTypeAssId = "0"; } //主控区域关联id if (request.EmergencyLinkageMasterAreaAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.MasterAreaAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.MasterAreaAssId = "0"; } request.SysEmergencyLinkageInfo.MasterTriDataStateAssId = IdHelper.CreateLongId().ToString(); //主控触发数据状态 //被控测点关联id if (request.EmergencyLinkagePassivePointAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.PassivePointAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.PassivePointAssId = "0"; } //被控区域关联id if (request.EmergencyLinkagePassiveAreaAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.PassiveAreaAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.PassiveAreaAssId = "0"; } //被控人员关联id if (request.EmergencyLinkagePassivePersonAssInfo.Count != 0) { request.SysEmergencyLinkageInfo.PassivePersonAssId = IdHelper.CreateLongId().ToString(); } else { request.SysEmergencyLinkageInfo.PassivePersonAssId = "0"; } foreach (var item in request.EmergencyLinkageMasterAreaAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterAreaAssId = request.SysEmergencyLinkageInfo.MasterAreaAssId; } foreach (var item in request.EmergencyLinkageMasterDevTypeAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterDevTypeAssId = request.SysEmergencyLinkageInfo.MasterDevTypeAssId; } foreach (var item in request.EmergencyLinkageMasterPointAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterPointAssId = request.SysEmergencyLinkageInfo.MasterPointAssId; } foreach (var item in request.EmergencyLinkageMasterTriDataStateAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.MasterTriDataStateAssId = request.SysEmergencyLinkageInfo.MasterTriDataStateAssId; } foreach (var item in request.EmergencyLinkagePassiveAreaAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.PassiveAreaAssId = request.SysEmergencyLinkageInfo.PassiveAreaAssId; } foreach (var item in request.EmergencyLinkagePassivePersonAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.PassivePersonAssId = request.SysEmergencyLinkageInfo.PassivePersonAssId; } var req = new V_DefCacheGetAllRequest(); var res = _vDefCacheService.GetAll(req); if (res.Code != 100) { throw new Exception(res.Message); } var allVideoPoint = res.Data; //所有视频系统测点 var res2 = _personPointDefineService.GetAllPointDefineCache(); if (res2.Code != 100) { throw new Exception(res2.Message); } var allPersonPoint = res2.Data; //所有人员定位系统测点 var req3 = new B_DefCacheGetAllRequest(); var res3 = _bDefCacheService.GetAll(req3); if (res3.Code != 100) { throw new Exception(res3.Message); } var allBroadcastPoint = res3.Data; //所有广播系统测点 foreach (var item in request.EmergencyLinkagePassivePointAssInfo) { item.Id = IdHelper.CreateLongId().ToString(); item.PassivePointAssId = request.SysEmergencyLinkageInfo.PassivePointAssId; var existMonitoringPoint = allVideoPoint.Any(a => a.Id == item.PointId); if (existMonitoringPoint) { item.Sysid = 74; } var existPersonPoint = allPersonPoint.Any(a => a.PointID == item.PointId); if (existPersonPoint) { item.Sysid = 11; } var existBroadcastPoint = allBroadcastPoint.Any(a => a.PointID == item.PointId); if (existBroadcastPoint) { item.Sysid = 12; } } request.SysEmergencyLinkageInfo.EditTime = DateTime.Now; request.SysEmergencyLinkageInfo.Activity = 1; request.SysEmergencyLinkageInfo.DeletePerson = ""; request.SysEmergencyLinkageInfo.DeleteTime = Convert.ToDateTime("1900-01-01"); request.SysEmergencyLinkageInfo.Bz1 = ""; request.SysEmergencyLinkageInfo.Bz2 = ""; request.SysEmergencyLinkageInfo.Bz3 = ""; TransactionsManager.BeginTransaction(() => { var model = ObjectConverter.Copy <SysEmergencyLinkageInfo, SysEmergencyLinkageModel>(request.SysEmergencyLinkageInfo); _Repository.AddSysEmergencyLinkage(model); foreach (var item in request.EmergencyLinkageMasterAreaAssInfo) { var model2 = ObjectConverter .Copy <EmergencyLinkageMasterAreaAssInfo, EmergencyLinkageMasterAreaAssModel>(item); _emergencyLinkageMasterAreaAssRepository.AddEmergencyLinkageMasterAreaAss(model2); } foreach (var item in request.EmergencyLinkageMasterDevTypeAssInfo) { var model3 = ObjectConverter .Copy <EmergencyLinkageMasterDevTypeAssInfo, EmergencyLinkageMasterDevTypeAssModel>(item); _emergencyLinkageMasterDevTypeAssRepository.AddEmergencyLinkageMasterDevTypeAss(model3); } foreach (var item in request.EmergencyLinkageMasterPointAssInfo) { var model4 = ObjectConverter .Copy <EmergencyLinkageMasterPointAssInfo, EmergencyLinkageMasterPointAssModel>(item); _emergencyLinkageMasterPointAssRepository.AddEmergencyLinkageMasterPointAss(model4); } foreach (var item in request.EmergencyLinkageMasterTriDataStateAssInfo) { var model5 = ObjectConverter .Copy <EmergencyLinkageMasterTriDataStateAssInfo, EmergencyLinkageMasterTriDataStateAssModel>( item); _emergencyLinkageMasterTriDataStateAssRepository.AddEmergencyLinkageMasterTriDataStateAss(model5); } foreach (var item in request.EmergencyLinkagePassiveAreaAssInfo) { var model6 = ObjectConverter .Copy <EmergencyLinkagePassiveAreaAssInfo, EmergencyLinkagePassiveAreaAssModel>(item); _emergencyLinkagePassiveAreaAssRepository.AddEmergencyLinkagePassiveAreaAss(model6); } foreach (var item in request.EmergencyLinkagePassivePersonAssInfo) { var model7 = ObjectConverter .Copy <EmergencyLinkagePassivePersonAssInfo, EmergencyLinkagePassivePersonAssModel>(item); _emergencyLinkagePassivePersonAssRepository.AddEmergencyLinkagePassivePersonAss(model7); } foreach (var item in request.EmergencyLinkagePassivePointAssInfo) { var model8 = ObjectConverter .Copy <EmergencyLinkagePassivePointAssInfo, EmergencyLinkagePassivePointAssModel>(item); _emergencyLinkagePassivePointAssRepository.AddEmergencyLinkagePassivePointAss(model8); } }); //更新缓存 request.SysEmergencyLinkageInfo.MasterAreas = request.EmergencyLinkageMasterAreaAssInfo; request.SysEmergencyLinkageInfo.MasterDevTypes = request.EmergencyLinkageMasterDevTypeAssInfo; request.SysEmergencyLinkageInfo.MasterPoint = request.EmergencyLinkageMasterPointAssInfo; request.SysEmergencyLinkageInfo.MasterTriDataStates = request.EmergencyLinkageMasterTriDataStateAssInfo; request.SysEmergencyLinkageInfo.PassiveAreas = request.EmergencyLinkagePassiveAreaAssInfo; request.SysEmergencyLinkageInfo.PassivePersons = request.EmergencyLinkagePassivePersonAssInfo; request.SysEmergencyLinkageInfo.PassivePoints = request.EmergencyLinkagePassivePointAssInfo; request.SysEmergencyLinkageInfo.EmergencyLinkageState = 0; var req2 = new EmergencyLinkageConfigCacheAddRequest { SysEmergencyLinkageInfo = request.SysEmergencyLinkageInfo }; _sysEmergencyLinkageCacheService.AddSysEmergencyLinkageCache(req2); return(new BasicResponse()); }