/// <summary> /// 物业公告列表 /// </summary> /// <returns></returns> public ActionResult PropertyNoticeList() { var owner = GetCurrentUser(); var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); ViewBag.PropertyNoticeCount = postBll.Count(m => placeList.Contains(m.PropertyPlaceId) && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && m.PublishedFlag == ConstantParam.PUBLISHED_TRUE); return(View()); }
/// <summary> /// 物业公告Json方式获取 /// </summary> /// <param name="pageIndex"></param> /// <returns></returns> public JsonResult PropertyNoticeJsonList(int pageIndex) { PageResultModel model = new PageResultModel(); var owner = GetCurrentUser(); var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var list = postBll.GetPageList(m => placeList.Contains(m.PropertyPlaceId) && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && m.PublishedFlag == ConstantParam.PUBLISHED_TRUE, "PublishedTime", false, pageIndex).Select(m => new { PropertyName = m.PropertyPlace.Name, PropertyImg = string.IsNullOrEmpty(m.PropertyPlace.ImgThumbnail) ? "/Images/news_item_default.png" : m.PropertyPlace.ImgThumbnail, Id = m.Id, Title = m.Title, PublishedTime = m.PublishedTime, strPublishedTime = m.PublishedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") }).ToList(); model.Total = postBll.Count(m => placeList.Contains(m.PropertyPlaceId) && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && m.PublishedFlag == ConstantParam.PUBLISHED_TRUE); model.Result = list; return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(int id = 1) { CompanyPlatformIndexModel model = new CompanyPlatformIndexModel(); int CurrentCompanyId = GetSessionModel().CompanyId.Value; //获取当前公司物业小区个数并赋值 IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); model.PlaceCount = placeBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.CompanyId == CurrentCompanyId); //获取当前公司下属小区物业人员总个数 IPropertyUserBLL placeUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); model.PlaceUserCount = placeUserBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //住宅业主个数 IHouseUserBLL houseUserBll = BLLFactory <IHouseUserBLL> .GetBLL("HouseUserBLL"); model.HouseUserCount = houseUserBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //办公楼业主个数 IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL"); model.BuildCompanyCount = buildCompanyBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //获取物业公告个数 IPostBLL postBLL = BLLFactory <IPostBLL> .GetBLL("PostBLL"); int postCount = postBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); model.PlacePostCount = postCount; //获取业主上报问题个数 IQuestionBLL questionBLL = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); int QuestionCount = questionBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId); //获取业主上报问题已处理个数 int DisposedQuestionCount = questionBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.DISPOSED); //设置上报问题处理率 model.QuestionDisposedRate = Convert.ToDouble(DisposedQuestionCount) / QuestionCount; //获取巡检异常个数 IInspectionResultBLL resultBLL = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL"); int InspectionExceptionCount = resultBLL.Count(u => u.InspectionTimePlan.InspectionPlan.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.EXCEPTION && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //获取巡检异常已处理个数 int DisposedInspectionExceptionCount = resultBLL.Count(u => u.InspectionTimePlan.InspectionPlan.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.EXCEPTION && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.DisposeStatus == ConstantParam.DISPOSED); //设置巡检异常处理率 model.InspectionExceptionDisposedRate = Convert.ToDouble(DisposedInspectionExceptionCount) / InspectionExceptionCount; var dataList = placeBll.GetList(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.CompanyId == CurrentCompanyId).ToList(); var ExpenseCountList = new List <ExpenseCountModel>(); foreach (var item in dataList) { var m = new ExpenseCountModel(); m.PlaceName = item.Name; //如果是住宅小区 if (item.PlaceType == ConstantParam.PLACE_TYPE_HOUSE) { IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL"); m.DoorCount = doorBll.Count(d => d.BuildUnit.Build.PropertyPlaceId == item.Id); int ExpensedDoorCount = doorBll.Count(d => d.BuildUnit.Build.PropertyPlaceId == item.Id && d.HouseUserExpenseDetails.Count > 0 && d.HouseUserExpenseDetails.OrderByDescending(e => e.CreateDate).FirstOrDefault().IsPayed == ConstantParam.PAYED_TRUE); m.ExpensedRate = Convert.ToDouble(ExpensedDoorCount) / m.DoorCount; } //如果是办公楼小区 else if (item.PlaceType == ConstantParam.PLACE_TYPE_COMPANY) { m.DoorCount = item.BuildCompanys.Count(c => c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); int ExpensedDoorCount = item.BuildCompanys.Count(c => c.HouseUserExpenseDetails.Count > 0 && c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && c.HouseUserExpenseDetails.OrderByDescending(d => d.CreateDate).FirstOrDefault().IsPayed == ConstantParam.PAYED_TRUE); m.ExpensedRate = Convert.ToDouble(ExpensedDoorCount) / m.DoorCount; } ExpenseCountList.Add(m); } model.ExpenseCountList = ExpenseCountList.OrderByDescending(m => m.ExpensedRate).ToPagedList(id, ConstantParam.PAGE_SIZE); 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)); }