Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public ActionResult NewsList(CompanyNewsNoticeSearchModel model)
        {
            ICompanyPostBLL postBll = BLLFactory <ICompanyPostBLL> .GetBLL("CompanyPostBLL");

            int currentCompanyId = GetSessionModel().CompanyId.Value;

            Expression <Func <T_CompanyPost, bool> > where = u => u.CompanyId == currentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                             (string.IsNullOrEmpty(model.Kword) ? true : u.Title.Contains(model.Kword)) && (model.PublishedFlag == null ? true : u.PublishStatus == model.PublishedFlag.Value);

            if (model.IsOpen != null)
            {
                where = PredicateBuilder.And(where, u => u.IsOpen == model.IsOpen.Value);
            }
            //排序
            var sortModel = this.SettingSorting("Id", false);

            model.PostList   = postBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_CompanyPost>;
            model.StatusList = getStatueList();
            model.IsOpenList = getIsOpenList();
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult CompanyNewsList(SearchModel model)
        {
            //获取当前小区所属公司ID
            int CurrentPlaceId         = GetSessionModel().PropertyPlaceId.Value;
            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 &&
                                                             (string.IsNullOrEmpty(model.Kword) ? true : u.Title.Contains(model.Kword)) && u.PublishStatus == ConstantParam.PUBLISHED_TRUE &&
                                                             u.IsOpen == ConstantParam.PUBLISHED_TRUE;
            //排序
            var sortModel = this.SettingSorting("Id", false);

            //获取分页数据
            ICompanyPostBLL postBll = BLLFactory <ICompanyPostBLL> .GetBLL("CompanyPostBLL");

            var PostList = postBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex);

            return(View(PostList));
        }
Esempio n. 4
0
        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));
        }