Exemple #1
0
        // GET: Admin
        public ActionResult Index()
        {
            if (!isAuthenticated())
            {
                return(RedirectToAction("Index", "Auth"));
            }
            StatisticsDTO statisticsDTO = new StatisticsDTO();

            statisticsDTO.NumUsers      = userBLL.Count();
            statisticsDTO.NumStations   = stationBLL.Count();
            statisticsDTO.NumLines      = lineBLL.Count();
            statisticsDTO.NumDepartures = departureBLL.Count();
            statisticsDTO.NumTickets    = ticketBLL.Count();
            return(View(statisticsDTO));
        }
Exemple #2
0
        public ActionResult Index(int id = 1)
        {
            PlatformIndexModel model = new PlatformIndexModel();

            #region 用户、公司、小区、业主个数统计

            //获取平台用户个数并赋值
            IPlatformUserBLL platformUserBll = BLLFactory <IPlatformUserBLL> .GetBLL("PlatformUserBLL");

            model.PlatformUserCount = platformUserBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //获取物业公司个数并赋值
            IPropertyCompanyBLL companyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL");

            model.CompanyCount = companyBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //获取物业小区个数并赋值
            IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

            model.PlaceCount = placeBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //获取业主个数并赋值
            IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

            model.OwnerCount = ownerBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //获取一周内登录个数
            DateTime beforeWeek = DateTime.Now.AddDays(-7);
            model.OwnerWeekLoginCount = ownerBll.Count(u => u.LatelyLoginTime >= beforeWeek);

            //获取一个月内登录个数
            DateTime beforeMonth = DateTime.Now.AddMonths(-1);
            model.OwnerMonthLoginCount = ownerBll.Count(u => u.LatelyLoginTime >= beforeMonth);

            #endregion

            #region 公司小区个数及业主个数统计(柱状图)

            //公司小区、业主个数模型集合
            var barDatas = new List <BarDataModel>();

            //获取物业公司名称及下辖小区个数及业主个数 数据并转换为Json字符串
            var companyList = companyBll.GetList(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT).ToList();
            foreach (var c in companyList)
            {
                BarDataModel data = new BarDataModel();
                //物业公司名称
                data.CompanyName = c.Name;
                var placeList = c.PropertyPlaces.Where(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //该物业公司的小区个数
                data.PlaceCount = placeList.Count();

                var userPlaces = new List <R_UserPlace>();
                //遍历物业小区
                foreach (var p in placeList)
                {
                    //遍历物业小区业主关联
                    foreach (var u in p.UserPlaces.ToList())
                    {
                        //如果不包含,则添加
                        if (!userPlaces.Contains(u))
                        {
                            userPlaces.Add(u);
                        }
                    }
                }
                //赋值 业主个数
                data.OwnerCount = userPlaces.Count;
                barDatas.Add(data);
            }
            model.BarJsonData = PropertyUtils.ModelToJsonString(barDatas);
            #endregion

            #region 小区业主列表数据
            //获取所有小区业主数据
            var list = placeBll.GetList(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT).ToList().Select(p => new OwnerDataModel()
            {
                PlaceName   = p.Name,
                CompanyName = p.Company.Name,
                OwnerCount  = p.UserPlaces.Count
            });
            //降序排序分页并赋值
            model.OwnerDatas = list.OrderByDescending(m => m.OwnerCount).ToPagedList(id, ConstantParam.PAGE_SIZE);
            #endregion

            return(View(model));
        }
        public ActionResult Index()
        {
            //构造首页数据模型
            PropertyIndexModel model = new PropertyIndexModel();

            //获取物业小区
            int CurrentPlaceId = GetSessionModel().PropertyPlaceId ?? 0;

            //获取app用户统计数据
            IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

            int appUserCount = userBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.UserPlaces.Any(up => up.PropertyPlaceId == CurrentPlaceId));

            model.AppUserCount = appUserCount;

            //获取物业用户统计数据
            IPropertyUserBLL pUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL");

            int pUserCount = pUserBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlaceId == CurrentPlaceId);

            model.PropertyUserCount = pUserCount;

            //获取新闻发布个数
            IPostBLL postBLL = BLLFactory <IPostBLL> .GetBLL("PostBLL");

            int postCount = postBLL.Count(u => u.PublishedFlag == ConstantParam.PUBLISHED_TRUE && u.PropertyPlaceId == CurrentPlaceId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            model.NoticeCount = postCount;


            //获取业主上报问题个数
            IQuestionBLL questionBLL = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

            int questionCount = questionBLL.Count(u => u.PropertyPlaceId == CurrentPlaceId);

            model.QuestionCount = questionCount;

            //获取业主上报本月未处理问题个数
            DateTime monthBegin             = DateTime.Today.AddDays(1 - DateTime.Today.Day);
            DateTime monthEnd               = DateTime.Now.Date.AddDays(1);
            int      notHandleQuestionCount = questionBLL.Count(u => u.Status == ConstantParam.NO_DISPOSE && u.UploadTime > monthBegin &&
                                                                u.UploadTime < monthEnd && u.PropertyPlaceId == CurrentPlaceId);

            model.NotHandleQuestionCount = notHandleQuestionCount;

            //获取本月巡检未处理问题个数
            IInspectionResultBLL resultBLL = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL");

            int notHandleExCount = resultBLL.Count(u => u.Status == ConstantParam.EXCEPTION && u.PlanDate >= monthBegin &&
                                                   u.PlanDate < monthEnd &&
                                                   (u.DisposeStatus == null || u.DisposeStatus == ConstantParam.NO_DISPOSE) && u.InspectionTimePlan.InspectionPlan.PropertyPlaceId == CurrentPlaceId);

            model.NotHandleExceptionCount = notHandleExCount;


            //获取最新的为题列表
            var list = questionBLL.GetPageList(q => q.PropertyPlaceId == CurrentPlaceId, "UploadTime", false, 1, 5);

            model.LatestQuestionList = list;


            //获取当前小区所属公司ID
            IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

            var place            = placeBll.GetEntity(p => p.Id == CurrentPlaceId);
            int currentCompanyId = place.CompanyId;

            //查询条件初始化
            Expression <Func <T_CompanyPost, bool> > where = u => u.CompanyId == currentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                             u.PublishStatus == ConstantParam.PUBLISHED_TRUE && u.IsOpen == ConstantParam.PUBLISHED_TRUE;

            //获取最新的5条总公司新闻公告
            ICompanyPostBLL postBll = BLLFactory <ICompanyPostBLL> .GetBLL("CompanyPostBLL");

            model.LatestCompanyPostList = postBll.GetPageList(where, "PublishedTime", false, 1, 5);

            return(View(model));
        }