public ActionResult EditNews(int id) { IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var post = postBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (post != null) { NewsNoticeModel postModel = new NewsNoticeModel(); postModel.PostId = post.Id; postModel.Title = post.Title; postModel.Content = post.Content; postModel.SubmitUserId = post.SubmitUserId; postModel.SubmitUser = post.SubmitUser.TrueName; postModel.SubmitTime = post.SubmitTime.ToString(); postModel.SubmitUserHeadPath = post.SubmitUser.HeadPath; postModel.PublishedFlag = post.PublishedFlag == 1 ? true : false; postModel.PuslishedTime = post.PublishedTime.ToString(); return(View(postModel)); } else { return(RedirectToAction("NoticeList")); } }
public PostController(IPostService postService, IForumService forumService, IPostBLL postBLL, IForumBLL forumBLL, UserManager <ApplicationUser> userManager) { _postService = postService; _forumService = forumService; _postBLL = postBLL; _forumBLL = forumBLL; _userManager = userManager; }
/// <summary> /// 公众号首页 /// </summary> /// <returns></returns> public ActionResult Index() { HomeDataModel model = new HomeDataModel(); var owner = GetCurrentUser(); var PlaceIds = GetVerifiedPlaceIds(); //初始化查询条件 var DoorIds = owner.PropertyIdentityVerification.Where(v => v.DoorId != null && v.IsVerified == 1).Select(m => m.DoorId); var CompanyIds = owner.PropertyIdentityVerification.Where(v => v.BuildCompanyId != null && v.IsVerified == 1).Select(m => m.BuildCompanyId); Expression <Func <T_HouseUserExpenseDetails, bool> > where = u => u.IsPayed == ConstantParam.PAYED_FALSE && (DoorIds.Contains(u.BuildDoorId) || CompanyIds.Contains(u.BuildCompanyId)); // 获取当前用户对应业主的缴费记录 IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL"); model.ExpenseList = expenseDetailsBLL.GetPageList(where, "CreateDate", false, 1, 1).Select(e => new ExpenseNoticeModel { ExpenseType = e.PropertyExpenseType.Name, PlaceName = e.BuildCompanyId == null ? e.BuildDoor.BuildUnit.Build.PropertyPlace.Name : e.BuildCompany.PropertyPlace.Name, OwnerDoor = e.BuildCompanyId == null ? (e.BuildDoor.BuildUnit.Build.BuildName + e.BuildDoor.BuildUnit.UnitName + e.BuildDoor.DoorName) : e.BuildCompany.Name, ExpenseDateDes = e.ExpenseDateDes, Cost = e.Expense + "元" }).ToList(); // 获取用户关联小区的公告列表 IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Post, bool> > where1 = u => placeList.Contains(u.PropertyPlaceId) && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE; model.NewsList = postBll.GetPageList(where1, "PublishedTime", false, 1, 3).Select(p => new NewsModel { Id = p.Id, PlaceName = p.PropertyPlace.Name, propertyPic = string.IsNullOrEmpty(p.PropertyPlace.ImgThumbnail) ? "/Images/news_item_default.png" : p.PropertyPlace.ImgThumbnail, PublishTime = p.PublishedTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), Title = p.Title }).ToList(); //获取最新上报的问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); Expression <Func <T_Question, bool> > where2 = u => u.UploadUserId == owner.Id && PlaceIds.Contains(u.PropertyPlaceId); model.QuestionList = questionBll.GetPageList(where2, "Id", false, 1, 2).ToList().Select(q => new QuestionModel { Id = q.Id, PlaceName = q.PropertyPlace.Name, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, Status = q.Status, UploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'), AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration }).ToList(); return(View(model)); }
/// <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()); }
public DeletePersonalDataModel( UserManager <BlogAppUser> userManager, SignInManager <BlogAppUser> signInManager, ILogger <DeletePersonalDataModel> logger, IPostBLL postBLL) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _postBLL = postBLL; }
public ApiResultModel NewsDetail([FromUri] NewsDetailModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var post = postBll.GetEntity(p => p.Id == model.PostId && p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && p.PublishedFlag == 1); if (post != null) { // 返回详细页面url resultModel.result = new { PlaceTel = post.PropertyPlace.Tel, Url = "MobilePage/NewsDetail?id=" + model.PostId }; } else { resultModel.Msg = "新闻公告不存在"; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel NewsList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); // 获取指定物业小区id的公告列表 IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Post, bool> > where = u => placeList.Contains(u.PropertyPlaceId) && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE; // TODO:此处Content不需要全部返回,待优化 var list = postBll.GetPageList(where, "PublishedTime", false, model.PageIndex).Select(s => new { ID = s.Id, propertyName = s.PropertyPlace.Name, propertyPic = string.IsNullOrEmpty(s.PropertyPlace.ImgThumbnail) ? "/Images/news_item_default.png" : s.PropertyPlace.ImgThumbnail, pubDate = s.PublishedTime.ToString(), title = s.Title }).ToList(); resultModel.result = list; resultModel.Total = postBll.GetList(where).Count(); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ActionResult NoticeList(NewsNoticeSearchModel model) { IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); int propertyPlaceId = GetSessionModel().PropertyPlaceId.Value; Expression <Func <T_Post, bool> > where = u => u.PropertyPlaceId == propertyPlaceId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && (string.IsNullOrEmpty(model.Title) ? true : u.Title.Contains(model.Title)) && (model.PublishedFlag == null ? true : u.PublishedFlag == model.PublishedFlag.Value); //排序 var sortModel = this.SettingSorting("Id", false); model.PostList = postBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_Post>; model.StatueList = getStatueList(); return(View(model)); }
public ActionResult NewsDetail(int id) { JsonModel jm = new JsonModel(); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var post = postBll.GetEntity(p => p.Id == id && p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && p.PublishedFlag == ConstantParam.PUBLISHED_TRUE); NewsNoticeModel postModel = new NewsNoticeModel(); postModel.Title = post.Title; postModel.Content = post.Content; postModel.PuslishedTime = post.PublishedTime.Value.ToShortDateString().Replace("/", "."); return(View(postModel)); }
/// <summary> /// 物业公告详细 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult PropertyNoticeDetail(int id) { IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var post = postBll.GetEntity(m => m.Id == id); var model = new PropertyNoticeDetailModel() { Id = post.Id, PlaceName = post.PropertyPlace.Name, Content = post.Content, Title = post.Title, PublishedTime = post.PublishedTime.HasValue ? post.PublishedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" }; return(View(model)); }
public ActionResult CompanyNewNoticeList(NewsNoticeSearchModel model) { IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); int propertyCompanyId = GetSessionModel().CompanyId.Value; Expression <Func <T_Post, bool> > where = u => u.PropertyPlace.CompanyId == propertyCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && (string.IsNullOrEmpty(model.Title) ? true : u.Title.Contains(model.Title)) && (u.PublishedFlag == Property.Common.ConstantParam.PUBLISHED_TRUE); if (model.PropertyPlaceId != null) { where = PredicateBuilder.And(where, u => u.PropertyPlaceId == model.PropertyPlaceId.Value); } var sortModel = this.SettingSorting("Id", false); model.PostList = postBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_Post>; model.PropertyPlaceList = GetPropertyPlaceList(); return(View(model)); }
public ActionResult DeletePost(int id) { JsonModel jm = new JsonModel(); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); // 根据指定id值获取实体对象 var post = postBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (post != null) { // 修改指定用户记录中的已删除标识 post.DelFlag = ConstantParam.DEL_FLAG_DELETE; postBll.Update(post); //操作日志 jm.Content = "删除公告 " + post.Title; } else { jm.Msg = "该公告不存在"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
/// <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() { //构造首页数据模型 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)); }
public PostController(IPostBLL post, IHostingEnvironment environment) { _post = post; _environment = environment; }
public PostController(IPostBLL postBll) { _postBll = postBll; }
public AdminController(IAdminBLL adminBLL, IPostBLL postBLL, IProfileBLL profileBLL) { _adminBLL = adminBLL; _postBLL = postBLL; _profileBLL = profileBLL; }
public PostDetailController(IPostBLL postBll) { _postBll = postBll; }
public HomeController(ILogger <HomeController> logger, IPostBLL postBll) { _logger = logger; _postBll = postBll; }
public ActionResult AddNews(NewsNoticeModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { var sessionModel = GetSessionModel(); IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); T_Post newPost = new T_Post() { Title = model.Title, Content = model.Content, PropertyPlaceId = sessionModel.PropertyPlaceId.Value, SubmitUserId = sessionModel.UserID, SubmitTime = DateTime.Now.ToLocalTime(), PublishedFlag = model.PublishedFlag ? 1 : 0, PublishedTime = DateTime.Now.ToLocalTime() }; // 保存到数据库 postBll.Save(newPost); // 若选中“发布选项”则即时推送 if (model.PublishedFlag) { // 公告推送 //推送给业主客户端 IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); var userIds = placeBll.GetEntity(p => p.Id == newPost.PropertyPlaceId).UserPlaces.Select(m => m.UserId); if (userIds != null) { userIds = userIds.ToList(); } IUserPushBLL userPushBLL = BLLFactory <IUserPushBLL> .GetBLL("UserPushBLL"); var registrationIds = userPushBLL.GetList(p => userIds.Contains(p.UserId)).Select(p => p.RegistrationId).ToArray(); bool flag = PropertyUtils.SendPush("新闻公告", model.Title, ConstantParam.MOBILE_TYPE_OWNER, registrationIds); //推送给物业客户端 IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); var PropertyUserIds = userBll.GetList(u => u.PropertyPlaceId == newPost.PropertyPlaceId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT).Select(u => u.Id); if (PropertyUserIds != null) { PropertyUserIds = PropertyUserIds.ToList(); } IPropertyUserPushBLL propertyUserPushBLL = BLLFactory <IPropertyUserPushBLL> .GetBLL("PropertyUserPushBLL"); var propertyRegistrationIds = propertyUserPushBLL.GetList(p => PropertyUserIds.Contains(p.UserId)).Select(p => p.RegistrationId).ToArray(); bool flag1 = PropertyUtils.SendPush("新闻公告", model.Title, ConstantParam.MOBILE_TYPE_PROPERTY, propertyRegistrationIds); if (!flag || !flag1) { jm.Msg = "推送发生异常"; } } //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { // 保存异常日志 jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, 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)); }
/// <summary> /// Constructor /// </summary> /// <param name="postBLL"></param> /// <param name="userBLL"></param> public PostController(IPostBLL postBLL, IUserBLL userBLL) { this.postBLL = postBLL; this.userBLL = userBLL; }