private List <ICellStastic> QueryDateSpanStatList(int eNodebId, short pci, DateTime begin, DateTime end)
        {
            var dateSpanStats = new List <ICellStastic>();

            while (begin < end)
            {
                var oneDayMysqlStat = _statRepository.Get(eNodebId, pci, begin);
                if (oneDayMysqlStat != null)
                {
                    dateSpanStats.Add(oneDayMysqlStat);
                }
                else
                {
                    var oneDayStats = _repository.GetList(eNodebId, pci, begin);

                    if (oneDayStats.Any())
                    {
                        var stat = new CellStatMysql
                        {
                            Mod3Count      = oneDayStats.Sum(x => x.Mod3Count),
                            Mod6Count      = oneDayStats.Sum(x => x.Mod6Count),
                            MrCount        = oneDayStats.Sum(x => x.MrCount),
                            OverCoverCount = oneDayStats.Sum(x => x.OverCoverCount),
                            PreciseCount   = oneDayStats.Sum(x => x.PreciseCount),
                            WeakCoverCount = oneDayStats.Sum(x => x.WeakCoverCount),
                            CurrentDate    = begin,
                            ENodebId       = eNodebId,
                            Pci            = pci,
                            SectorId       =
                                _cellRepository.FirstOrDefault(x => x.ENodebId == eNodebId && x.Pci == pci)?.SectorId ??
                                0
                        };
                        dateSpanStats.Add(stat);
                        _statRepository.Insert(stat);
                        _statRepository.SaveChanges();
                    }
                }

                begin = begin.AddDays(1);
            }
            return(dateSpanStats);
        }
        public int DumpCellStat(CellStatMysql cellStat)
        {
            var existedStat =
                _statRepository.FirstOrDefault(x => x.ENodebId == cellStat.ENodebId && x.SectorId == cellStat.SectorId &&
                                               x.CurrentDate == cellStat.CurrentDate);

            if (existedStat == null)
            {
                _statRepository.Insert(cellStat);
            }
            return(_statRepository.SaveChanges());
        }