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 GetAllTopicListByType([FromUri] AllTopicPagedSearchModel 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();

                    IPostBarTopicBLL topicBLL = BLLFactory <IPostBarTopicBLL> .GetBLL("PostBarTopicBLL");

                    // 获取小区某分类下的所有主题列表
                    var list = topicBLL.GetSetTopPageList(m => m.PropertyPlaceId == model.PropertyPlaceId && m.TopicTypeId == model.TopicTypeId, model.PageIndex, ConstantParam.PAGE_SIZE).Select(m => new
                    {
                        Id           = m.Id,
                        PostDate     = m.PostDate.ToString("yyyy-MM-dd HH:mm:ss"),
                        IsTop        = m.IsTop,
                        UserImage    = m.PostUser.HeadPath,
                        UserName     = m.PostUser.UserName,
                        Title        = m.Title,
                        Content      = m.Content,
                        PicList      = m.ImgPath,
                        CommentCount = m.PostBarTopicDiscusss.Count(),
                        IsCollected  = collectedTopicIds.Contains(m.Id) ? 1 : 0,
                        TopicType    = m.PostBarTopicType.Name,
                        PostUserId   = m.PostUserId
                    }).ToList();

                    resultModel.result = list;
                    resultModel.Total  = topicBLL.Count(m => m.PropertyPlaceId == model.PropertyPlaceId && m.TopicTypeId == model.TopicTypeId);
                }
                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);
        }
示例#4
0
        public ApiPageResultModel GetSaleList([FromUri] GoodsSearchModel 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);

                    //该门店销售中的商品
                    Expression <Func <T_ShopSale, bool> > where = s => s.GoodsCategory.ShopId == model.ShopId && s.InSales == 1;
                    //如果选择了商品分类
                    if (model.GoodsCategoryId > 0)
                    {
                        where = PredicateBuilder.And(where, s => s.GoodsCategoryId == model.GoodsCategoryId);
                    }
                    //获取指定门店指定类别的商品列表
                    IShopSaleBLL SaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    resultModel.Total  = SaleBll.Count(where);
                    resultModel.result = SaleBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new
                    {
                        GoodsId        = s.Id,
                        GoodsName      = s.Title,
                        GoodsDesc      = s.Content,
                        RemainingAmout = s.RemainingAmout,
                        SellAmout      = s.OrderDetails.Where(od => od.Order.OrderStatus == ConstantParam.OrderStatus_FINISH).Select(od => od.SaledAmount).ToArray().Sum(),
                        GoodsCoverImg  = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0],
                        GoodsOtherImg  = string.IsNullOrEmpty(s.ImgPath) ? "" : s.ImgPath,
                        Price          = s.Price
                    });
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
        public ApiPageResultModel GetMyLevel2RepliesList([FromUri] Level2RepliedListModel 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);


                    IPostBarTopicDiscussBLL topicDiscussBLL = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL");

                    var level1Disscuss = topicDiscussBLL.GetEntity(m => m.Id == model.Id);
                    // 获取我的二级回复列表
                    var list = topicDiscussBLL.GetPageList(m => m.ParentId == model.Id && m.TopicId == model.TopicId, "PostTime", true, model.PageIndex, ConstantParam.PAGE_SIZE).Select(m => new
                    {
                        Id              = m.Id,
                        PostDate        = m.PostTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        UserId          = m.PostUserId,
                        UserImage       = m.PostUser.HeadPath,
                        UserName        = m.PostUser.UserName,
                        Content         = m.Content,
                        PicList         = m.ImgPath,
                        RepliedUserName = m.ReplyUser.UserName,
                        Level2ParentId  = m.ParentId
                    }).ToList();

                    resultModel.result = list;
                    resultModel.Total  = topicDiscussBLL.Count(m => m.ParentId == model.Id && m.TopicId == model.TopicId);
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
示例#6
0
        public ApiPageResultModel ShopList([FromUri] ShopSearchModel 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);

                    IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

                    Expression <Func <T_Shop, bool> > where = u => u.Type.Contains(model.Type.ToString());
                    //如果是生活小卖店或五金店
                    if (model.Type == 2 || model.Type == 3)
                    {
                        var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId);
                        where = PredicateBuilder.And(where, u => u.ShopPlaces.Count(p => placeList.Contains(p.PropertyPlaceId)) > 0);
                    }
                    resultModel.Total  = shopBll.Count(where);
                    resultModel.result = shopBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new
                    {
                        Id       = s.Id,
                        ShopName = s.ShopName,
                        Content  = s.MainSale,
                        Phone    = string.IsNullOrEmpty(s.Phone) ? "" : s.Phone,
                        Img      = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0]
                    });
                }
                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);
        }
示例#8
0
        public ApiPageResultModel GetGoodsCategoryList([FromUri] GoodsCategorySearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //获取当前用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser 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);

                    IGoodsCategoryBLL goodsBLL = BLLFactory <IGoodsCategoryBLL> .GetBLL("GoodsCategoryBLL");

                    Expression <Func <T_GoodsCategory, bool> > where = g => g.ShopId == model.ShopId;
                    // 获取商家的商品分类
                    var list = goodsBLL.GetPageList(where, model.PageIndex).Select(
                        g => new
                    {
                        Id    = g.Id,
                        Name  = g.Name,
                        Count = g.ShopSales.Count()
                    }).ToList();

                    resultModel.result = list;
                    resultModel.Total  = goodsBLL.Count(g => g.ShopId == model.ShopId);
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
示例#9
0
        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);
        }
示例#10
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);
        }
示例#11
0
        public ApiPageResultModel GetTopicSortList([FromUri] TopicSortSearchModel 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 != model.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);

                    //获取小区所有主题分类列表
                    IPostBarTopicTypeBLL postBarTopicTypeBll = BLLFactory <IPostBarTopicTypeBLL> .GetBLL("PostBarTopicTypeBLL");

                    Expression <Func <T_PostBarTopicType, bool> > where = u => u.PropertyPlaceId == model.PropertyPlaceId;

                    var list = postBarTopicTypeBll.GetList(where, "Id", false).Select(s => new
                    {
                        ID   = s.Id,
                        Name = s.Name
                    }).ToList();

                    resultModel.result = list;
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
示例#12
0
        /// <summary>
        /// 获取指定门店促销分页列表数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="ShopId"></param>
        /// <returns></returns>
        public JsonResult ShopSaleList(int pageIndex, int shopId)
        {
            IShopSaleBLL SaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

            var list = SaleBll.GetPageList(s => s.GoodsCategory.ShopId == shopId, "Id", false, pageIndex).Select(s => new
            {
                Id      = s.Id,
                Title   = s.Title,
                Content = s.Content.Length > 30 ? s.Content.Substring(0, 30) : s.Content,
                SaleImg = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0]
            }).ToList();

            ApiPageResultModel model = new ApiPageResultModel();

            model.Total  = SaleBll.Count(s => s.GoodsCategory.ShopId == shopId);
            model.result = list;
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
示例#13
0
        public ApiPageResultModel GetGoodsList([FromUri] GoodsSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //获取当前用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser 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_ShopSale, bool> > where = s => s.InSales == model.InSales && s.GoodsCategory.ShopId == model.ShopId;

                    if (model.GoodsCategoryId > 0)
                    {
                        where = PredicateBuilder.And(where, s => s.GoodsCategoryId == model.GoodsCategoryId);
                    }

                    IOrderBLL orderBll = BLLFactory <IOrderBLL> .GetBLL("OrderBLL");

                    IShopSaleBLL shopSaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    var list = shopSaleBLL.GetPageList(where, "CreateTime", false, model.PageIndex).Select(
                        s => new
                    {
                        Id             = s.Id,
                        ImgThumbnail   = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';').FirstOrDefault(),
                        Title          = s.Title,
                        Price          = s.Price,
                        RemainingAmout = s.RemainingAmout,
                        SaledCount     = s.OrderDetails.Where(od => od.Order.OrderStatus == ConstantParam.OrderStatus_FINISH).Select(od => od.SaledAmount).ToArray().Sum(),
                        CreateDate     = s.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        UnShelveTime   = s.UnShelveTime.HasValue ? s.UnShelveTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
                        InSales        = s.InSales
                    });

                    resultModel.result = list;
                    resultModel.Total  = shopSaleBLL.Count(where);
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
示例#14
0
        public ApiPageResultModel OrderList([FromUri] OrderPagedSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                var user = shopUserBll.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")));
                    shopUserBll.Update(user);
                    //如果该用户还未创建门店
                    if (user.Shops.Count < 1)
                    {
                        resultModel.Msg = APIMessage.SHOP_NOEXIST;
                        return(resultModel);
                    }
                    else
                    {
                        //获取订单列表数据
                        IOrderBLL orderBll = BLLFactory <IOrderBLL> .GetBLL("OrderBLL");

                        int shopId = user.Shops.FirstOrDefault().Id;
                        Expression <Func <T_Order, bool> > where = o => o.ShopId == shopId && o.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && o.IsStoreHided == ConstantParam.DEL_FLAG_DEFAULT;
                        if (model.OrderStatus != null)
                        {
                            where = PredicateBuilder.And(where, o => o.OrderStatus == model.OrderStatus);
                        }
                        resultModel.result = orderBll.GetPageList(where, "OrderDate", false, model.PageIndex).Select(o => new
                        {
                            Id              = o.Id,
                            OrderNo         = o.OrderNo,
                            ShopId          = o.Shop.Id,
                            ShopName        = o.Shop.ShopName,
                            ShopImg         = string.IsNullOrEmpty(o.Shop.ImgThumbnail) ? "" : o.Shop.ImgThumbnail.Split(';')[0],
                            BuyUserName     = o.User.UserName,
                            BuyUserHeadPic  = o.User.HeadPath,
                            BuyUserPhone    = o.ShippingAddress.Telephone,
                            OrderTime       = o.OrderDate.ToString("yyyy-MM-dd HH:mm:ss"),
                            OrderStatus     = o.OrderStatus,
                            RecedeType      = o.RecedeType,
                            RemainingTime   = o.PayDate == null || o.PayDate.Value.AddHours(2) < DateTime.Now ? "0小时0分" : (o.PayDate.Value.AddHours(2) - DateTime.Now).Hours + "小时" + (o.PayDate.Value.AddHours(2) - DateTime.Now).Minutes + "分",
                            ExitOrderReason = o.Reason,
                            OrderPrice      = o.OrderPrice,
                            SendAddress     = o.ShippingAddress.County.City.Province.ProvinceName + o.ShippingAddress.County.City.CityName + o.ShippingAddress.County.CountyName + "  " + o.ShippingAddress.AddressDetails,
                            PayWay          = o.PayWay,
                            RefundStatus    = GetRefundResult(o.Id),
                            PayTradeNo      = o.PayTradeNo,
                            RecedeTime      = o.RecedeTime != null ? o.RecedeTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
                            Memo            = string.IsNullOrEmpty(o.Memo) ? "" : o.Memo,
                        });
                        resultModel.Total = orderBll.Count(where);
                    }
                }
                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);
        }