Beispiel #1
0
 /// <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;
     }
 }
Beispiel #2
0
 /// <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;
     }
 }