public override AggRawData GetAggRawData(DateTime nowTime)
        {
            if (base.DbHelper == null)
            {
                return(null);
            }

            //if (!rwLocker.TryEnterReadLock(TimeOut))
            //    return null;
            //BaseAggConfig configTmp = ObjectHelper.DeepCopy(this.Config);
            //rwLocker.ExitReadLock();

            DateTime lastWeek = TimeStrategy.GetAggDate(config.Type, config.TimeRange, nowTime);;

            DateTime firstDay  = DateTimeHelper.GetWeekFirstDayMon(lastWeek);
            DateTime lastDay   = DateTimeHelper.GetWeekLastDaySun(lastWeek);
            DateTime beginTime = firstDay.Date;
            DateTime endTime   = lastDay.Date.AddHours(23).AddMinutes(59).AddSeconds(59);

            AggRawData data      = new AggRawData(config.Key, config.ConfigId, this.GetTimeFlg(lastWeek));
            List <int> SensorIds = config.GetSensorIds();

            foreach (int sensorId in SensorIds)
            {
                RawData tempRawData = DbHelper.Accessor.GetWeekAggRawData(sensorId, config.FactorId, config.TimeRange, beginTime, endTime);
                if (tempRawData != null && tempRawData.Values.Count > 0)
                {
                    data.Datas.Add(tempRawData);
                }
            }

            data.LastAggDatas = base.GetLastAggData();
            return(data);
        }
        public override AggRawData GetAggRawData(DateTime nowTime)
        {
            if (base.DbHelper == null)
            {
                return(null);
            }

            ///获取配置信息副本
            //if (!rwLocker.TryEnterReadLock(TimeOut))
            //    return null;
            //BaseAggConfig configTmp = ObjectHelper.DeepCopy(this.Config);
            //rwLocker.ExitReadLock();

            DateTime lastMonth = TimeStrategy.GetAggDate(config.Type, config.TimeRange, nowTime);
            int      year      = lastMonth.Year;
            int      month     = lastMonth.Month;
            int      beginDay;
            int      endDay;

            if (config.TimeRange.DateBegin == -1 || config.TimeRange.DateBegin > DateTime.DaysInMonth(year, month))
            {
                beginDay = DateTimeHelper.GetLastDayOfMonth(lastMonth);
            }
            else
            {
                beginDay = config.TimeRange.DateBegin;
            }


            if (config.TimeRange.DateEnd == -1 || config.TimeRange.DateEnd > DateTime.DaysInMonth(year, month))
            {
                endDay = DateTimeHelper.GetLastDayOfMonth(lastMonth);
            }
            else
            {
                endDay = config.TimeRange.DateEnd;
            }


            DateTime beginTime = new DateTime(year, month, beginDay, 0, 0, 0);
            DateTime endTime   = new DateTime(year, month, endDay, 23, 59, 59);

            AggRawData data      = new AggRawData(config.Key, config.ConfigId, GetTimeFlg(lastMonth));
            List <int> SensorIds = config.GetSensorIds();

            foreach (int sensorId in SensorIds)
            {
                RawData tempRawData = DbHelper.Accessor.GetMonthAggRawData(
                    sensorId,
                    config.FactorId,
                    config.TimeRange,
                    beginTime,
                    endTime);
                if (tempRawData != null && tempRawData.Values.Count > 0)
                {
                    data.Datas.Add(tempRawData);
                }
            }
            data.LastAggDatas = base.GetLastAggData();
            return(data);
        }