Exemple #1
0
        /// <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));
        }
        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);
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        /// <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));
        }