/// <summary> /// 获取全部园区配置 /// </summary> /// <returns></returns> public List <BaseRegionConfigModel> GetAllShowRegion() { try { return(baseRegionConfigDal.GetAllRegionConfig()); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据园区ID获取报警灯配置 /// </summary> /// <param name="regionId"></param> /// <returns></returns> public List <BaseRelayConfigModel> GetAlarmLampByRegion(int regionId) { try { List <BaseRelayConfigModel> retRelayList = new List <BaseRelayConfigModel>(); BaseRelayConfigModel relay = null; BaseRegionConfigDAL regionDal = new BaseRegionConfigDAL(); List <BaseRegionConfigModel> regionList = regionDal.GetAllRegionConfig(); List <BaseRelayConfigModel> relayList = relayDal.GetAlarmLampByRegion(regionId); for (int i = 0; i < relayList.Count; i++) { relay = new BaseRelayConfigModel(); relay.control_id = relayList[i].control_id; relay.ext3 = regionList.Where(n => n.id == relayList[i].region_id).FirstOrDefault() == null ? "" : regionList.Where(n => n.id == relayList[i].region_id).FirstOrDefault().region_code; relay.id = relayList[i].id; relay.region_id = relayList[i].region_id; relay.relay_content = relayList[i].relay_content; relay.relay_type = relayList[i].relay_type; retRelayList.Add(relay); } return(retRelayList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据角色id获取角色权限绑定Ztree展示 /// </summary> /// <param name="roleId"></param> /// <returns></returns> public List <ServPurviewInfoCustom> GetPurviewInfoByRoleId(int roleId) { try { //查询角色权限绑定 List <ServRolePurviewModel> rolePurviewList = servRolePurviewDAL.GetRolePurviewByRoleId(roleId); //查询所有的园区 List <BaseRegionConfigModel> regionList = baseRegionConfigDAL.GetAllRegionConfig(); //查询所有的权限 ServPurviewInfoQuery query = new ServPurviewInfoQuery(); List <ServPurviewInfoModel> purviewList = servPurviewInfoDAL.GetEntities(query); //List<EnumModel> purviewList = EnumClass.GetEnumModelList<EnumClass.PurviewEnum>(); ServPurviewInfoCustom purviewCustom; List <ServPurviewInfoCustom> purviewCustomList = new List <ServPurviewInfoCustom>(); for (int j = 0; j < regionList.Count; j++) { purviewCustom = new ServPurviewInfoCustom(); purviewCustom.id = regionList[j].id; purviewCustom.pid = -1; purviewCustom.sid = regionList[j].id; purviewCustom.purview_code = 0; purviewCustom.purview_name = regionList[j].region_name; purviewCustomList.Add(purviewCustom); for (int i = 0; i < purviewList.Count; i++) { purviewCustom = new ServPurviewInfoCustom(); purviewCustom.id = purviewList[i].id; //如果权限的pid=-1则pid绑定为园区id if (purviewList[i].pid == -1) { purviewCustom.pid = regionList[j].id; } else { purviewCustom.pid = Convert.ToInt32(purviewList[i].pid + "" + regionList[j].id);; } purviewCustom.sid = Convert.ToInt32(purviewList[i].purview_code + "" + regionList[j].id); purviewCustom.purview_code = purviewList[i].purview_code; purviewCustom.purview_name = purviewList[i].purview_name; ServRolePurviewModel rolePurviewModel = rolePurviewList.FirstOrDefault(n => n.purview_id == purviewList[i].purview_code && n.region_id == regionList[j].id); if (rolePurviewModel != null) { purviewCustom.@checked = true; } else { purviewCustom.@checked = false; } purviewCustomList.Add(purviewCustom); } } return(purviewCustomList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取资产巡检列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="assetType"></param> /// <param name="regionId"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="totalNumber"></param> /// <returns></returns> public List <RetCameraPatrolSchedule> GetAssetInspectionByPage(int pageIndex, int pageSize, int assetType, int regionId, string startTime, string endTime, out int totalNumber) { try { List <RetCameraPatrolSchedule> retList = new List <RetCameraPatrolSchedule>(); RetCameraPatrolSchedule retModel = null; AssetInspectionQuery query = new AssetInspectionQuery(); ServScheduleTimeConfigDAL scheduleTimeConfigDal = new ServScheduleTimeConfigDAL(); BaseRegionConfigDAL baseRegionConfigDal = new BaseRegionConfigDAL(); query.assetType = assetType; query.endTime = endTime; query.pageIndex = pageIndex; query.pageSize = pageSize; query.regionId = regionId; query.startTime = startTime; List <ServScheduleModel> list = servScheduleDal.GetAssetInspectionPage(query, out totalNumber); //获取全部园区配置 List <BaseRegionConfigModel> regionConfigList = baseRegionConfigDal.GetAllRegionConfig(); for (int i = 0; i < list.Count; i++) { retModel = new RetCameraPatrolSchedule(); retModel.content = list[i].content; retModel.create_time = list[i].create_time; retModel.cronTime = CSM.Utils.TimeExpression.GetCronTimeModel(list[i].period_expression);//生成时间表达式model retModel.span_time = list[i].span_time; #region 查询时间配置 ServScheduleTimeConfigQuery timeQuery = new ServScheduleTimeConfigQuery(); timeQuery.schedule_id = list[i].id; timeQuery.time_type = 1;//查询开始时间 ServScheduleTimeConfigModel timeModel = scheduleTimeConfigDal.GetScheduleTimeConfigByIdAndTimeType(timeQuery).FirstOrDefault(); retModel.start_execute_time = timeModel == null ? "" : timeModel.schedule_time; retModel.execute_date = timeModel == null ? "" : timeModel.schedule_date; #endregion retModel.id = list[i].id; retModel.end_execute_time = ""; retModel.end_time = list[i].end_time; retModel.period_expression = list[i].period_expression; retModel.region_id = list[i].region_id; retModel.schedule_name = list[i].schedule_name; retModel.schedule_state = list[i].schedule_state; retModel.schedule_type = list[i].schedule_type; retModel.start_time = list[i].start_time; var regionModel = regionConfigList.Where(n => n.id == list[i].region_id).FirstOrDefault(); retModel.ext10 = regionModel == null ? "" : regionModel.region_name; //备用字段10用于存储园区名称 retModel.ext7 = list[i].end_time > DateTime.Now ? "1" : "2"; //1:未过期,2:过期 retModel.ext9 = retModel.cronTime.describe; //获取表达式描述 retList.Add(retModel); } return(retList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据条件查询设备告警 /// </summary> /// <param name="regionId"></param> /// <param name="areaId"></param> /// <param name="alarmLevel"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="eventType"></param> /// <returns></returns> public System.IO.MemoryStream GetAllInformAlarmStream(int regionId, int areaId, int alarmLevel, string startTime, string endTime, int eventType) { try { BaseEventTypeBLL eventTypeBll = new BaseEventTypeBLL(); BaseRegionConfigDAL baseRegionConfigDal = new BaseRegionConfigDAL(); List <RetInformAlarmCustom> retList = new List <RetInformAlarmCustom>(); RetInformAlarmCustom retModel = null; #region 拼接DataTable列头 System.Data.DataTable table = new System.Data.DataTable(); table.Columns.Add("告警编号"); table.Columns.Add("事件名称"); table.Columns.Add("告警设备"); table.Columns.Add("告警位置"); table.Columns.Add("园区名称"); table.Columns.Add("区域名称"); table.Columns.Add("告警时间"); table.Columns.Add("告警级别"); table.Columns.Add("处理状态"); #endregion List <BaseRegionConfigModel> regionList = baseRegionConfigDal.GetAllRegionConfig();//获取所有园区配置 DefinedInformAlarmQuery query = new DefinedInformAlarmQuery(); query.alarmLevel = alarmLevel; query.regionId = regionId; query.areaId = areaId; query.startTime = startTime; query.endTime = endTime; query.eventType = eventType; List <InformAlarmCustom> informList = servInformAlarmDal.GetAllInformAlarmCondition(query); //分页获取设备报警记录 for (int i = 0; i < informList.Count; i++) { System.Data.DataRow row = table.NewRow(); row["告警编号"] = informList[i].id; row["事件名称"] = Enum.IsDefined(typeof(EnumClass.DeviceInformAlarmType), informList[i].event_type) ? Enum.GetName(typeof(EnumClass.DeviceInformAlarmType), informList[i].event_type) : " "; row["告警设备"] = informList[i].device_name; row["告警位置"] = informList[i].alarm_location; row["园区名称"] = regionList.Where(n => n.id == informList[i].region_id).FirstOrDefault() == null ? " " : regionList.Where(n => n.id == informList[i].region_id).FirstOrDefault().region_name; row["区域名称"] = informList[i].area_name; row["告警时间"] = informList[i].report_time.ToString(); row["告警级别"] = Enum.IsDefined(typeof(EnumClass.AlarmLevel), informList[i].alarm_level) ? Enum.GetName(typeof(EnumClass.AlarmLevel), informList[i].alarm_level) : " "; row["处理状态"] = Enum.IsDefined(typeof(EnumClass.InformAlarmStatus), informList[i].status) ? Enum.GetName(typeof(EnumClass.InformAlarmStatus), informList[i].status) : " "; table.Rows.Add(row); } System.IO.MemoryStream ms = CSM.Utils.ExcelHelper.DataTableToExcel(table, "sheet2"); return(ms); } catch (Exception ex) { throw ex; } }
/// <summary> /// 分页获取计划任务结果 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="regionId"></param> /// <param name="scheduleType"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="totalNumber"></param> /// <returns></returns> public List <RetScheduleResult> GetScheduleResultByPage(int pageIndex, int pageSize, int regionId, int scheduleType, string startTime, string endTime, out int totalNumber) { try { List <RetScheduleResult> retResultList = new List <RetScheduleResult>(); RetScheduleResult retScheduleModel = null; BaseRegionConfigDAL baseRegionConfigDal = new BaseRegionConfigDAL(); ServScheduleResultQuery query = new ServScheduleResultQuery(); query.endTime = endTime; query.pageIndex = pageIndex; query.pageSize = pageSize; query.regionId = regionId; query.scheduleType = scheduleType; query.startTime = startTime; List <ScheduleResultCustom> scheduleResultList = servScheduleResultDal.GetScheduleResultByPage(query, out totalNumber); //分页获取计划任务结果 List <BaseRegionConfigModel> regionList = baseRegionConfigDal.GetAllRegionConfig(); //获取所有园区配置 for (int i = 0; i < scheduleResultList.Count; i++) { retScheduleModel = new RetScheduleResult(); retScheduleModel.create_time = scheduleResultList[i].create_time; retScheduleModel.end_time = scheduleResultList[i].end_time; retScheduleModel.start_time = scheduleResultList[i].start_time; retScheduleModel.id = scheduleResultList[i].id; retScheduleModel.region_name = regionList.Where(n => n.id == scheduleResultList[i].region_id).FirstOrDefault() == null ? "--" : regionList.Where(n => n.id == scheduleResultList[i].region_id).FirstOrDefault().region_name; retScheduleModel.result_content = scheduleResultList[i].result_content; retScheduleModel.result_ext1 = scheduleResultList[i].result_ext1; retScheduleModel.result_ext2 = scheduleResultList[i].result_ext2; retScheduleModel.result_ext3 = scheduleResultList[i].result_ext3; retScheduleModel.result_ext4 = scheduleResultList[i].result_ext4; retScheduleModel.result_ext5 = scheduleResultList[i].result_ext5; retScheduleModel.result_time = scheduleResultList[i].result_time; retScheduleModel.schedule_name = scheduleResultList[i].schedule_name; retScheduleModel.schedule_state = Enum.GetName(typeof(EnumClass.ScheduleState), scheduleResultList[i].schedule_state); retScheduleModel.schedule_type = Enum.GetName(typeof(EnumClass.ScheduleType), scheduleResultList[i].schedule_type); retResultList.Add(retScheduleModel); } return(retResultList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取所有园区ID以及名称 /// </summary> /// <returns></returns> public List <EnumModel> GetAllRegion() { List <EnumModel> enumList = new List <EnumModel>(); EnumModel enumModel = null; try { BaseRegionConfigDAL baseRegionConfig = new BaseRegionConfigDAL(); List <BaseRegionConfigModel> list = baseRegionConfig.GetAllRegionConfig();//获取本地园区配置 foreach (BaseRegionConfigModel model in list) { enumModel = new EnumModel(); enumModel.key = model.id; enumModel.value = model.region_name; enumList.Add(enumModel); } return(enumList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据查询条件分页获取设备告警 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="regionId"></param> /// <param name="areaId"></param> /// <param name="alarmLevel"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="eventType"></param> /// <param name="totalNumber"></param> /// <returns></returns> public List <RetInformAlarmCustom> GetInformAlarmPage(int pageIndex, int pageSize, int regionId, int areaId, int alarmLevel, string startTime, string endTime, int eventType, out int totalNumber) { try { BaseEventTypeBLL eventTypeBll = new BaseEventTypeBLL(); BaseRegionConfigDAL baseRegionConfigDal = new BaseRegionConfigDAL(); List <RetInformAlarmCustom> retList = new List <RetInformAlarmCustom>(); RetInformAlarmCustom retModel = null; //List<BaseEventTypeModel> eventTypeList = eventTypeBll.GetAllEventType();//获取所有事件类型 List <BaseRegionConfigModel> regionList = baseRegionConfigDal.GetAllRegionConfig();//获取所有园区配置 //var childEventType = eventTypeList.Where(n => n.pid == eventType);//获取所有PID为eventType的子级事件 //List<int> eventArr = new List<int>(); //if (childEventType != null) //{ // List<BaseEventTypeModel> childEventTypeList = childEventType.ToList(); // for (int i = 0; i < childEventTypeList.Count(); i++) // { // eventArr.Add(childEventTypeList[i].id); //先用List<int>接收 // } //} DefinedInformAlarmQuery query = new DefinedInformAlarmQuery(); query.alarmLevel = alarmLevel; query.regionId = regionId; query.areaId = areaId; query.startTime = startTime; query.endTime = endTime; //query.eventType = eventArr.Count == 0 ? null : eventArr.ToArray(); //将List<int>转化为数组int[] query.eventType = eventType; query.pageIndex = pageIndex; query.pageSize = pageSize; List <InformAlarmCustom> informList = servInformAlarmDal.GetInformAlarmPage(query, out totalNumber); //分页获取设备报警记录 for (int i = 0; i < informList.Count; i++) { retModel = new RetInformAlarmCustom(); retModel.alarm_level = informList[i].alarm_level; retModel.alarm_location = informList[i].alarm_location; retModel.area_id = informList[i].area_id; retModel.area_name = informList[i].area_name; retModel.content = informList[i].content; retModel.device_code = informList[i].device_code; retModel.device_name = informList[i].device_name; retModel.event_type = informList[i].event_type; //var informAlarmEvent = eventTypeList.FirstOrDefault(n => n.id == informList[i].event_type); //查询当前事件 //if (informAlarmEvent.pid == -1) //判断是否是父级事件 //{ // retModel.event_name = informAlarmEvent.event_name; //} //else //{ // var rootEvent = eventTypeList.FirstOrDefault(n => n.id == informAlarmEvent.pid);//查询父级事件,目前事件只保留两级 // if (rootEvent != null) //找到父级事件 // { // retModel.event_name = rootEvent.event_name; // } // else //未找到父级事件 // { // retModel.event_name = "--"; // } //} retModel.event_name = Enum.IsDefined(typeof(EnumClass.DeviceInformAlarmType), informList[i].event_type) ? Enum.GetName(typeof(EnumClass.DeviceInformAlarmType), informList[i].event_type) : "--"; retModel.ext1 = informList[i].ext1; retModel.ext2 = informList[i].ext2; retModel.ext3 = informList[i].ext3; retModel.ext4 = informList[i].ext4; retModel.ext5 = informList[i].ext5; retModel.id = informList[i].id; retModel.region_id = informList[i].region_id; retModel.region_name = regionList.Where(n => n.id == informList[i].region_id).FirstOrDefault() == null ? "--" : regionList.Where(n => n.id == informList[i].region_id).FirstOrDefault().region_name; retModel.report_time = informList[i].report_time; retModel.status = informList[i].status; retList.Add(retModel); } return(retList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 分页查询获取视频巡更计划任务 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="scheduleName"></param> /// <param name="regionId"></param> /// <param name="scheduleType"></param> /// <param name="scheduleState"></param> /// <param name="validStartTime"></param> /// <param name="validEndTime"></param> /// <param name="totalNumber"></param> /// <returns></returns> public List <RetCameraPatrolSchedule> GetCameraPatrolSchedule(int pageIndex, int pageSize, string scheduleName, int regionId, int scheduleType, int scheduleState, string validStartTime, string validEndTime, out int totalNumber) { try { List <RetCameraPatrolSchedule> retList = new List <RetCameraPatrolSchedule>(); RetCameraPatrolSchedule retModel = null; BaseRegionConfigDAL baseRegionConfigDal = new BaseRegionConfigDAL(); ServScheduleTimeConfigDAL scheduleTimeConfigDal = new ServScheduleTimeConfigDAL(); ServScheduleQuery query = new ServScheduleQuery(); query.eEndTime = validEndTime; query.pageIndex = pageIndex; query.pageSize = pageSize; query.regionId = regionId; query.scheduleName = scheduleName; query.scheduleState = scheduleState; query.scheduleType = scheduleType; query.sEndTime = validStartTime; //分页获视频巡更计划任务 List <CameraPatrolSchedule> cameraPatrolScheduleList = servScheduleDal.GetCameraPatrolScheduleByPage(query, out totalNumber); //获取全部园区配置 List <BaseRegionConfigModel> regionConfigList = baseRegionConfigDal.GetAllRegionConfig(); //查询园区名称 for (int i = 0; i < cameraPatrolScheduleList.Count; i++) { retModel = new RetCameraPatrolSchedule(); retModel.content = cameraPatrolScheduleList[i].content; retModel.create_time = cameraPatrolScheduleList[i].create_time; retModel.span_time = cameraPatrolScheduleList[i].span_time; retModel.cronTime = CSM.Utils.TimeExpression.GetCronTimeModel(cameraPatrolScheduleList[i].period_expression);//生成时间表达式model #region 查询时间配置 ServScheduleTimeConfigQuery timeQuery = new ServScheduleTimeConfigQuery(); timeQuery.schedule_id = cameraPatrolScheduleList[i].id; timeQuery.time_type = 1;//查询开始时间 ServScheduleTimeConfigModel timeModel = scheduleTimeConfigDal.GetScheduleTimeConfigByIdAndTimeType(timeQuery).FirstOrDefault(); retModel.start_execute_time = timeModel == null ? "" : timeModel.schedule_time; retModel.execute_date = timeModel == null ? "" : timeModel.schedule_date; #endregion retModel.end_execute_time = ""; retModel.end_time = cameraPatrolScheduleList[i].end_time; retModel.ext1 = cameraPatrolScheduleList[i].ext1; // retModel.ext10 = cameraPatrolScheduleList[i].ext10; retModel.ext2 = cameraPatrolScheduleList[i].ext2; retModel.ext3 = cameraPatrolScheduleList[i].ext3; retModel.ext4 = cameraPatrolScheduleList[i].ext4; retModel.ext5 = cameraPatrolScheduleList[i].ext5; retModel.ext6 = cameraPatrolScheduleList[i].ext6; // retModel.ext7 = cameraPatrolScheduleList[i].ext7; retModel.ext8 = cameraPatrolScheduleList[i].ext8; // retModel.ext9 = cameraPatrolScheduleList[i].ext9; retModel.group_id = cameraPatrolScheduleList[i].group_id; retModel.group_name = cameraPatrolScheduleList[i].group_name; retModel.id = cameraPatrolScheduleList[i].id; retModel.period_expression = cameraPatrolScheduleList[i].period_expression; retModel.region_id = cameraPatrolScheduleList[i].region_id; retModel.schedule_name = cameraPatrolScheduleList[i].schedule_name; retModel.schedule_state = cameraPatrolScheduleList[i].schedule_state; retModel.schedule_type = cameraPatrolScheduleList[i].schedule_type; retModel.start_time = cameraPatrolScheduleList[i].start_time; var regionModel = regionConfigList.Where(n => n.id == cameraPatrolScheduleList[i].region_id).FirstOrDefault(); retModel.ext10 = regionModel == null ? "" : regionModel.region_name; //备用字段10用于存储园区名称 retModel.ext7 = cameraPatrolScheduleList[i].end_time > DateTime.Now ? "1" : "2"; //1:未过期,2:过期 retModel.ext9 = retModel.cronTime.describe; //获取表达式描述 retList.Add(retModel); } return(retList); } catch (Exception ex) { throw ex; } }
/// <summary> /// 报警数据拼装 /// </summary> /// <param name="sourceModel"></param> /// <param name="eventList"></param> /// <returns></returns> private AlarmRecordModel TranAlarmRecord(AlarmRecordCustom sourceModel, List <BaseEventTypeModel> eventList) { AlarmRecordModel retModel = new AlarmRecordModel(); ServDeviceInfoDAL servDeviceInfoDal = new ServDeviceInfoDAL(); BaseRegionConfigDAL baseRegionConfigDal = new BaseRegionConfigDAL(); ServPersonInfoDAL personInfoDal = new ServPersonInfoDAL(); List <BaseRegionConfigModel> regionList = baseRegionConfigDal.GetAllRegionConfig();//获取全部园区 #region 查找事件 旧版 //if (alarmEvent == null) //判断当前事件是否存在 //{ // retModel.alarmEvent = ""; // retModel.rootEventId = -1; //} //else //{ // if (alarmEvent.pid == -1) //判断是否是父级事件 // { // retModel.alarmEvent = alarmEvent.event_name; // retModel.rootEventId = alarmEvent.id; // } // else // { // var rootEvent = eventList.FirstOrDefault(n => n.id == alarmEvent.pid);//查询父级事件,目前事件只保留两级 // if (rootEvent != null) //找到父级事件 // { // retModel.alarmEvent = alarmEvent.event_name + "[" + rootEvent.event_name + "]"; // retModel.rootEventId = rootEvent.id; // } // else //未找到父级事件 // { // retModel.alarmEvent = "[" + rootEvent.event_name + "]"; // retModel.rootEventId = -1; // } // } //} #endregion #region 查找事件 //var alarmEvent = eventList.FirstOrDefault(n => n.id == sourceModel.alarm_event); //查询当前事件 //if (alarmEvent == null) //判断当前事件是否存在 //{ // retModel.alarmEvent = "--"; // retModel.rootEventId = -1; //} //else //{ // if (alarmEvent.pid == -1) //判断是否是父级事件 // { // retModel.alarmEvent = alarmEvent.event_name; // retModel.rootEventId = alarmEvent.id; // } // else // { // var rootEvent = eventList.FirstOrDefault(n => n.id == alarmEvent.pid);//查询父级事件,目前事件只保留两级 // if (rootEvent != null) //找到父级事件 // { // retModel.alarmEvent = rootEvent.event_name; // retModel.rootEventId = rootEvent.id; // } // else //未找到父级事件 // { // retModel.alarmEvent = "--"; // retModel.rootEventId = -1; // } // } //} #endregion #region 查找事件 新版 if (!string.IsNullOrEmpty(sourceModel.alarm_event) && sourceModel.alarm_event != "") { var alarmEvent = eventList.FirstOrDefault(n => n.event_code == sourceModel.alarm_event);//查找事件 if (alarmEvent != null) { if (alarmEvent.pid == -1) { retModel.alarmEvent = alarmEvent.event_name; retModel.rootEventId = alarmEvent.id; } else { var rootEvent = eventList.FirstOrDefault(n => n.id == alarmEvent.pid); if (rootEvent != null) //找到父级事件 { retModel.alarmEvent = rootEvent.event_name; retModel.rootEventId = rootEvent.id; } else //未找到父级事件 { retModel.alarmEvent = "--"; retModel.rootEventId = -1; } } } else { retModel.alarmEvent = "--"; retModel.rootEventId = -1; } } else { retModel.alarmEvent = "--"; retModel.rootEventId = -1; } #endregion // retModel.alarmEvent = eventList.Find(n => n.id == sourceModel.alarm_event) == null ? "" : eventList.Find(n => n.id == sourceModel.alarm_event).event_name;//将事件类型ID转换为事件名称 retModel.alarmLevel = Enum.IsDefined(typeof(EnumClass.AlarmLevel), sourceModel.alarm_level) ? Enum.ToObject(typeof(EnumClass.AlarmLevel), sourceModel.alarm_level).ToString() : "";//转换报警等级 retModel.alarmLocation = sourceModel.alarm_location; // retModel.alarmName = sourceModel.alarm_name; retModel.alarmName = sourceModel.alarm_code;//报警名称不显示,显示设备code retModel.alarmText = sourceModel.alarm_text; retModel.alarmTime = sourceModel.alarm_time; retModel.alarmCacheStatus = sourceModel.alarm_cache_status; retModel.alarmType = sourceModel.alarm_type; //设备报警 // retModel.confirmPersonName = "";//根据ssoid查找人员 需调用sso接口 retModel.confirmPersonName = personInfoDal.GetPersonInfoBySSOId(sourceModel.confirm_person_id) == null ? "" : personInfoDal.GetPersonInfoBySSOId(sourceModel.confirm_person_id).alias; retModel.confirmAlarmTime = sourceModel.confirm_alarm_time; retModel.confirmAlarmText = sourceModel.confirm_alarm_text; retModel.confirmResult = Enum.IsDefined(typeof(EnumClass.ConfirmAlarmResult), sourceModel.confirm_result) ? Enum.ToObject(typeof(EnumClass.ConfirmAlarmResult), sourceModel.confirm_result).ToString() : ""; retModel.confirmState = Enum.IsDefined(typeof(EnumClass.ConfirmAlarmState), sourceModel.confirm_state) ? Enum.ToObject(typeof(EnumClass.ConfirmAlarmState), sourceModel.confirm_state).ToString() : ""; // retModel.deviceName = servDeviceInfoDal.GetEntity(sourceModel.alarm_code) == null ? "未知:" + sourceModel.alarm_code : servDeviceInfoDal.GetEntity(sourceModel.alarm_code).device_name;//查询设备名称 retModel.deviceName = sourceModel.device_name == null ? "未知" : sourceModel.device_name; retModel.regionName = regionList.Where(n => n.id == sourceModel.region_id).FirstOrDefault() == null ? "" : regionList.Where(n => n.id == sourceModel.region_id).FirstOrDefault().region_name; retModel.ext1 = sourceModel.ext1; retModel.ext2 = sourceModel.ext2; retModel.ext3 = sourceModel.ext3; retModel.ext4 = sourceModel.ext4; retModel.ext5 = sourceModel.ext5; retModel.id = sourceModel.id; retModel.subSystem = Enum.IsDefined(typeof(EnumClass.SubSystem), sourceModel.alarm_subsystem) ? Enum.ToObject(typeof(EnumClass.SubSystem), sourceModel.alarm_subsystem).ToString() : "";//转换为子系统名称 return(retModel); }