/// <summary>
        /// 缴费通知Json方式获取
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public JsonResult ExpenseNoticeJsonList(int pageIndex)
        {
            PageResultModel model = new PageResultModel();

            var owner = GetCurrentUser();
            //初始化查询条件
            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 => (DoorIds.Contains(u.BuildDoorId) || CompanyIds.Contains(u.BuildCompanyId));

            // 获取当前用户对应业主的缴费记录
            IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL");

            model.Result = expenseDetailsBLL.GetPageList(where, "CreateDate", false, pageIndex).Select(m => new
            {
                Id             = m.Id,
                ExpenseTitle   = string.Format("{0}缴费通知", m.PropertyExpenseType.Name),
                ExpenseContent = string.Format("{0}{1}{2}{3}的业主你好, 您{4}总计{5}元。请及时到物业办公室或登录Ai我家App缴费, 谢谢!",
                                               m.BuildDoor.BuildUnit.Build.PropertyPlace.Name,
                                               m.BuildDoor.BuildUnit.Build.BuildName,
                                               m.BuildDoor.BuildUnit.UnitName,
                                               m.BuildDoor.DoorName,
                                               m.ExpenseDateDes,
                                               m.Expense),
                CreateDate    = m.CreateDate,
                strCreateDate = m.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")
            }).ToList();

            model.Total = expenseDetailsBLL.Count(where);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
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 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 ActionResult ExpenseList(ExpenseDetailsSearchModel model)
        {
            //1.初始化默认查询模型
            DateTime today = DateTime.Today;

            if (model.BeforeDate == null)
            {
                model.BeforeDate = today.AddDays(-today.Day + 1);
            }
            if (model.EndDate == null)
            {
                model.EndDate = today;
            }

            int CurrentPlaceId = GetSessionModel().PropertyPlaceId.Value;

            DateTime endDate = model.EndDate.Value.AddDays(1);

            //2:初始化查询条件
            Expression <Func <T_HouseUserExpenseDetails, bool> > where = u => u.PropertyExpenseType.PropertyPlaceId == CurrentPlaceId &&
                                                                         u.ExpenseBeginDate < endDate && u.ExpenseEndDate >= model.BeforeDate;
            //缴费类型查询
            if (model.ExpenseTypeId != null)
            {
                where = PredicateBuilder.And(where, u => u.ExpenseTypeId == model.ExpenseTypeId.Value);
            }
            //根据缴费状态查询
            if (model.IsPayed != null)
            {
                where = PredicateBuilder.And(where, u => u.IsPayed == model.IsPayed.Value);
            }
            //楼座 单元 单元户,业主信息查询
            if (!string.IsNullOrEmpty(model.Kword))
            {
                IPropertyPlaceBLL placeBLL = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

                var place = placeBLL.GetEntity(p => p.Id == CurrentPlaceId);
                if (place.PlaceType == ConstantParam.PLACE_TYPE_HOUSE)
                {
                    where = PredicateBuilder.And(where, u => u.BuildDoor.DoorName.Contains(model.Kword) ||
                                                 u.BuildDoor.BuildUnit.Build.BuildName.Contains(model.Kword) ||
                                                 u.BuildDoor.BuildUnit.UnitName.Contains(model.Kword));
                }
                else if (place.PlaceType == ConstantParam.PLACE_TYPE_COMPANY)
                {
                    where = PredicateBuilder.And(where, u => u.BuildCompany.Name.Contains(model.Kword));
                }
            }
            //3.排序
            var sortModel = this.SettingSorting("Id", false);

            //4.调用BLL层获取分页数据
            IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL");

            model.ResultList = expenseDetailsBLL.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_HouseUserExpenseDetails>;

            //5.初始化缴费类别下拉列表和缴费状态下拉列表
            model.ExpenseTypeList = GetExpenseTypeList();
            model.IsPayedList     = GetPayedList();
            return(View(model));
        }