public ApiPageResultModel GetMyTopicCollectionsList([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); var collectedTopicIds = owner.UserPostBarTopics.Select(o => o.PostBarTopicId).ToList(); // 获取我的收藏列表 var list = owner.UserPostBarTopics.Select(m => new { Id = m.PostBarTopicId, PostUserId = m.PostBarTopic.PostUserId, PostDate = m.PostBarTopic.PostDate.ToString("yyyy-MM-dd HH:mm:ss"), UserImage = m.PostBarTopic.PostUser.HeadPath, UserName = m.PostBarTopic.PostUser.UserName, Title = m.PostBarTopic.Title, Content = m.PostBarTopic.Content, PicList = m.PostBarTopic.ImgPath, TopicType = m.PostBarTopic.PostBarTopicType.Name, CommentCount = m.PostBarTopic.PostBarTopicDiscusss.Count(), PropertyPlaceId = m.PostBarTopic.PropertyPlaceId, PlaceName = m.PostBarTopic.PropertyPlace.Name, IsTop = m.PostBarTopic.IsTop, IsCollected = collectedTopicIds.Contains(m.PostBarTopicId) ? 1 : 0 }).ToList(); resultModel.result = list; resultModel.Total = owner.UserPostBarTopics.Count(); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel DisposeFeedbackList([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); //获取要公示的问题解决反馈 总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); //条件已处理和要公示 var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Question, bool> > where = u => u.Status == ConstantParam.DISPOSED && u.IsPublish == ConstantParam.PUBLISHED_TRUE && placeList.Contains(u.PropertyPlaceId); resultModel.Total = questionBll.Count(where); resultModel.result = questionBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, UploadUserName = q.UploadUser.UserName, 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, PlaceName = q.PropertyPlace.Name, DisposeDesc = q.QuestionDisposes.FirstOrDefault().DisposeDesc, DisposeUserName = string.IsNullOrEmpty(q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName) ? q.QuestionDisposes.FirstOrDefault().DisposeUser.UserName : q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName, DisposesTime = q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel OwnInspectionExceptionList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); Expression <Func <T_InspectionResult, bool> > where = u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlaceId == user.PropertyPlaceId && u.Status == ConstantParam.EXCEPTION && u.DisposerId == user.Id; //获取巡检异常总个数和分页数据 IInspectionResultBLL resultBll = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL"); resultModel.Total = resultBll.Count(where); resultModel.result = new { ExceptionList = resultBll.GetOwnInspectionResultPageList(where, model.PageIndex, ConstantParam.PAGE_SIZE).Select(r => new { Id = r.Id, PlanName = r.InspectionTimePlan.InspectionPlan.PlanName, PointName = r.InspectionPoint.PointName, Desc = string.IsNullOrEmpty(r.Desc) ? "" : r.Desc, DisposeStatus = r.DisposeStatus == null ? ConstantParam.NO_DISPOSE : r.DisposeStatus.Value, UploadTime = r.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Uploader = r.UploadUser.UserName, Imgs = string.IsNullOrEmpty(r.Imgs) ? new string[] { } : r.Imgs.Split(';'), DisposeDesc = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeDesc : "", DisposeTime = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") : "", DisposeUser = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeUser.UserName : (r.DisposerId != null ? r.Disposer.UserName : "") }) }; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel ExpensedRecordList([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); //初始化查询条件 var DoorIds = owner.PropertyIdentityVerification.Where(v => v.DoorId != null).Select(m => m.DoorId); var CompanyIds = owner.PropertyIdentityVerification.Where(v => v.BuildCompanyId != null).Select(m => m.BuildCompanyId); Expression <Func <T_HouseUserExpenseDetails, bool> > where = u => u.IsPayed == ConstantParam.PAYED_TRUE && (DoorIds.Contains(u.BuildDoorId) || CompanyIds.Contains(u.BuildCompanyId)); // 获取当前用户对应业主的缴费记录 IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL"); var list = expenseDetailsBLL.GetPageList(where, "PayedDate", false, model.PageIndex).Select(e => new { RecordId = e.Id, ExpenseTypeName = e.PropertyExpenseType.Name, ExpenseDateDes = e.ExpenseDateDes, PlaceName = e.BuildCompanyId == null ? e.BuildDoor.BuildUnit.Build.PropertyPlace.Name : e.BuildCompany.PropertyPlace.Name, Expense = e.Expense, PayedTime = e.PayedDate.Value.ToString("yyyy-MM-dd HH:mm:ss") }).ToList(); resultModel.result = list; resultModel.Total = expenseDetailsBLL.GetList(where).Count(); } 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 ApiPageResultModel CompanyNewsList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找物业用户 IPropertyUserBLL propertyUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser propertyUser = propertyUserBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果物业用户存在 if (propertyUser != null) { //如果验证Token不通过或已过期 if (DateTime.Now > propertyUser.TokenInvalidTime || model.Token != propertyUser.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 propertyUser.LatelyLoginTime = DateTime.Now; propertyUser.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); propertyUserBll.Update(propertyUser); //获取指定公司发布的公开新闻公告 ICompanyPostBLL postBll = BLLFactory <ICompanyPostBLL> .GetBLL("CompanyPostBLL"); Expression <Func <T_CompanyPost, bool> > where = u => u.CompanyId == propertyUser.PropertyPlace.CompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PublishStatus == ConstantParam.PUBLISHED_TRUE && u.IsOpen == ConstantParam.PUBLISHED_TRUE; var list = postBll.GetPageList(where, "PublishedTime", false, model.PageIndex).Select(s => new { ID = s.Id, CompanyName = s.Company.Name, CompanyIcon = string.IsNullOrEmpty(s.Company.Img) ? "/Images/news_item_default.png" : s.Company.Img, PublishedTime = s.PublishedTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), Title = s.Title }).ToList(); resultModel.result = list; resultModel.Total = postBll.Count(where); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPayResultModel LifeBillList([FromUri] PagedSearchModel model) { ApiPayResultModel resultModel = new ApiPayResultModel(); 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); ILifeBillBLL lifeBillBll = BLLFactory <ILifeBillBLL> .GetBLL("LifeBillBLL"); Expression <Func <T_LifeBill, bool> > where = u => u.UserId == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT; resultModel.TotalPay = TotalPaySum(owner.Id); resultModel.MonthPay = MonthPaySum(owner.Id); //所有的生活记账 var AllList = lifeBillBll.GetList(where, "Id", false).ToList().Select(q => new { Time = q.ConsumptionDate, AccountId = q.Id, Img = q.LifeBillType.Img, Title = q.LifeBillType.Name, Money = q.Money, Mark = q.Memo }); //所有的记账时间 List <DateTime> Datelist = lifeBillBll.GetList(where, "ConsumptionDate", false).GroupBy(u => u.ConsumptionDate).Select(a => a.Key).ToList(); List <AllLifeBillList> alllist = new List <AllLifeBillList>(); foreach (var item in Datelist) { AllLifeBillList all = new AllLifeBillList(); List <LifeBillDescModel> list = new List <LifeBillDescModel>(); var lst = AllList.Where(a => a.Time == item).ToList(); all.Time = item.ToString("yyyy-MM-dd"); foreach (var i in lst) { LifeBillDescModel LifeBill = new LifeBillDescModel(); LifeBill.AccountId = i.AccountId; LifeBill.Title = i.Title; LifeBill.Img = i.Img; LifeBill.Money = i.Money; LifeBill.Mark = i.Mark; list.Add(LifeBill); } all.AccountList = list; alllist.Add(all); } resultModel.result = alllist.Skip((model.PageIndex - 1) * 5).Take(5).ToList(); resultModel.Total = alllist.Count(); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiPageResultModel OwnQuestionList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); Expression <Func <T_Question, bool> > where = u => u.PropertyPlaceId == user.PropertyPlaceId && u.DisposerId == user.Id; //获取问题总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); resultModel.Total = questionBll.Count(where); resultModel.result = new { ownQuestionList = questionBll.GetOwnQuestionPageList(where, model.PageIndex, ConstantParam.PAGE_SIZE).Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, Status = q.Status, UploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Uploader = q.UploadUser.UserName, Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'), AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration, DisposeDesc = q.Status == ConstantParam.DISPOSED ? q.QuestionDisposes.FirstOrDefault().DisposeDesc : "", DisposeTime = q.Status == ConstantParam.DISPOSED ? q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") : "", DisposeUser = q.Status == ConstantParam.DISPOSED ? q.QuestionDisposes.FirstOrDefault().DisposeUser.UserName : (q.DisposerId != null ? q.Disposer.UserName : ""), IsPublish = q.IsPublish }) }; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }