예제 #1
0
        public ResponseContext <MyPublishMomentDetailType> MyPublishMomentDetail(Guid momentId, RequestHead head)
        {
            var moment = momentDao.GetMomentByMomentId(momentId);

            if (moment == null)
            {
                return(new ResponseContext <MyPublishMomentDetailType>(ErrCodeEnum.DataIsnotExist));
            }
            bool overCount = ApplyBuilder.IsOverCount(moment);
            var  userInfo  = uerInfoBiz.GetUserInfoByUid(moment.UId);

            return(new ResponseContext <MyPublishMomentDetailType>()
            {
                Data = new MyPublishMomentDetailType()
                {
                    MomentId = momentId,
                    State = moment.State,
                    ShareTitle = MomentContentBuilder.GetShareTitle(moment),
                    Address = moment.Address,
                    Latitude = moment.Latitude,
                    Longitude = moment.Longitude,
                    IsOffLine = moment.IsOffLine,
                    IsOverTime = MomentContentBuilder.IsOverTime(moment.StopTime),
                    ShareFlag = moment.State == MomentStateEnum.正常发布中,
                    VerifyStateDesc = MomentContentBuilder.VerifyStateMap(moment.State),
                    StateDesc = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo = UserInfoBuilder.BuildUserInfo(userInfo, head),
                    ContentList = MomentContentBuilder.BuilderContent(moment, false),
                    ApplyList = ApplyBuilder.GetApplyList(momentId, false, head, moment.UId),
                    CheckList = ApplyBuilder.GetCheckDetails(moment, userInfo, head)
                }
            });
        }
예제 #2
0
        public ResponseContext <MomentCheckDetailType> MomentCheckDetail(RequestContext <MomentCheckDetailRequest> request)
        {
            var moment = momentDao.GetMomentByMomentId(request.Data.MomentId);

            if (moment == null)
            {
                return(new ResponseContext <MomentCheckDetailType>(ErrCodeEnum.DataIsnotExist));
            }
            bool overCount = ApplyBuilder.IsOverCount(moment);
            var  userInfo  = uerInfoBiz.GetUserInfoByUid(moment.UId);

            return(new ResponseContext <MomentCheckDetailType>()
            {
                Data = new MomentCheckDetailType()
                {
                    MomentId = moment.MomentId,
                    State = moment.State,
                    Address = moment.Address,
                    IsOffLine = moment.IsOffLine,
                    ShareTitle = MomentContentBuilder.GetShareTitle(moment),
                    StateDesc = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList = MomentContentBuilder.BuilderContent(moment, false),
                    ApplyList = ApplyBuilder.GetCheckDetails(moment, userInfo, request.Head)
                }
            });
        }
예제 #3
0
        public ResponseContext <AskMomentDetailResponse> AskMomentDetail(Guid applyId, RequestHead head)
        {
            var response  = new ResponseContext <AskMomentDetailResponse>();
            var applyInfo = applyInfoDao.GetByApplyId(applyId);

            if (applyInfo == null)
            {
                return(response);
            }
            var myUserInfo = uerInfoBiz.GetUserInfoByUid(applyInfo.MomentUId);
            var userInfo   = uerInfoBiz.GetUserInfoByUid(applyInfo.UId);
            var moment     = MomentBuilder.GetMoment(applyInfo.MomentId);

            if (myUserInfo == null || userInfo == null || moment == null)
            {
                return(response);
            }
            response.Data = new AskMomentDetailResponse()
            {
                ApplyState     = applyInfo.ApplyState,
                ApplyStateDesc = ApplyStateMap(applyInfo.ApplyState),
                IsOverTime     = MomentContentBuilder.IsOverTime(moment.StopTime),
                MomentId       = moment.MomentId,
                ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                Address        = moment.Address,
                Latitude       = moment.Latitude,
                Longitude      = moment.Longitude,
                IsOffLine      = moment.IsOffLine,
                TextColor      = ApplyBuilder.TextColorMap(applyInfo.ApplyState),
                UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, head),
                BtnVisable     = applyInfo.ApplyState == ApplyStateEnum.申请中,
                ApplyList      = ApplyBuilder.GetApplyDetails(applyInfo.ApplyId, head, true)
            };
            return(response);
        }
예제 #4
0
        public ResponseContext <ApplyMomentListResponse> ApplyMomentList(RequestHead head)
        {
            var response = new ResponseContext <ApplyMomentListResponse>
            {
                Data = new ApplyMomentListResponse()
                {
                    MomentList = new List <ApplyMomentDetailType>()
                }
            };
            var applyList = applyInfoDao.GetListByUId(head.UId);

            if (applyList.IsNullOrEmpty())
            {
                return(response);
            }
            foreach (var apply in applyList)
            {
                var momentUserInfo = uerInfoBiz.GetUserInfoByUid(apply.MomentUId);
                var moment         = MomentBuilder.GetMoment(apply.MomentId);
                if (moment == null || momentUserInfo == null)
                {
                    continue;
                }

                var result = new ApplyMomentDetailType()
                {
                    ApplyId        = apply.ApplyId,
                    ApplyStateDesc = ApplyStateMap(apply.ApplyState),
                    TextColor      = ApplyBuilder.TextColorMap(apply.ApplyState),
                    ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                    MomentId       = moment.MomentId,
                    Address        = moment.Address,
                    Latitude       = moment.Latitude,
                    Longitude      = moment.Longitude,
                    IsOffLine      = moment.IsOffLine,
                    UserInfo       = UserInfoBuilder.BuildUserInfo(momentUserInfo, head),
                    ContentList    = MomentContentBuilder.BuilderContent2Contact(moment, momentUserInfo, apply.ApplyState == ApplyStateEnum.申请通过)
                };
                var applyDetaiList = applyDetailDao.GetListByApplyId(apply.ApplyId);
                if (applyDetaiList.NotEmpty())
                {
                    //最后一个对话信息
                    var applyDetail = applyDetaiList.OrderByDescending(a => a.CreateTime).First();
                    result.ApplyRemark = applyDetail.Content;
                }
                response.Data.MomentList.Add(result);
            }
            return(response);
        }
예제 #5
0
        public ResponseContext <ShareDetailResponse> ShareDetail(Guid momentId, RequestHead head)
        {
            var moment = momentDao.GetMomentByMomentId(momentId);

            if (moment == null)
            {
                return(new ResponseContext <ShareDetailResponse>(ErrCodeEnum.DataIsnotExist));
            }
            var userInfo = uerInfoBiz.GetUserInfoByUid(moment.UId);

            if (userInfo == null)
            {
                return(new ResponseContext <ShareDetailResponse>(ErrCodeEnum.DataIsnotExist));
            }
            var    applyInfo = applyInfoDao.GetByMomentIdAndUId(momentId, head.UId);
            bool   isApply   = applyInfo != null;
            bool   selfFlag  = moment.UId == head.UId;
            bool   overCount = ApplyBuilder.IsOverCount(moment);
            string btnText   = MomentContentBuilder.BtnTextMap(moment.State, moment.StopTime, isApply, selfFlag, overCount);
            string stateDesc = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount);

            return(new ResponseContext <ShareDetailResponse>()
            {
                Data = new ShareDetailResponse()
                {
                    MomentId = momentId,
                    ApplyId = isApply ? applyInfo.ApplyId : Guid.Empty,
                    ApplyFlag = isApply,
                    BtnText = btnText,
                    StateDesc = stateDesc,
                    ShareTitle = MomentContentBuilder.GetShareTitle(moment),
                    Address = moment.Address,
                    Latitude = moment.Latitude,
                    Longitude = moment.Longitude,
                    IsOffLine = moment.IsOffLine,
                    AskFlag = string.Equals(btnText, "申请参与"),
                    BtnVisable = !string.IsNullOrEmpty(btnText),
                    TextColor = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo = UserInfoBuilder.BuildUserInfo(userInfo, head),
                    ContentList = MomentContentBuilder.BuilderContent(moment, true),
                    ApplyList = ApplyBuilder.GetApplyList(momentId, true, head, moment.UId)
                }
            });
        }
예제 #6
0
        public ResponseContext <SpaceMomentListResponse> SpaceMomentList(RequestContext <SpaceMomentListRequest> request)
        {
            var response = new ResponseContext <SpaceMomentListResponse>()
            {
                Data = new SpaceMomentListResponse()
                {
                    MomentList = new List <SpaceMomentDetailType>()
                }
            };
            var userInfo   = uerInfoBiz.GetUserInfoByUid(request.Data.UId);
            var momentList = momentDao.GetMomentListByUid(request.Data.UId);

            if (momentList.IsNullOrEmpty())
            {
                return(response);
            }

            foreach (var moment in momentList.Where(a => a.State == MomentStateEnum.正常发布中))
            {
                bool overCount = ApplyBuilder.IsOverCount(moment);
                var  applyList = applyInfoDao.GetListByMomentId(moment.MomentId);
                var  dto       = new SpaceMomentDetailType()
                {
                    MomentId        = moment.MomentId,
                    ShareTitle      = MomentContentBuilder.GetShareTitle(moment),
                    Address         = moment.Address,
                    Latitude        = moment.Latitude,
                    Longitude       = moment.Longitude,
                    IsOffLine       = moment.IsOffLine,
                    ApplyCountColor = "black",
                    ApplyCountDesc  = ApplyBuilder.GetApplyCountDescV1(applyList),
                    StateDesc       = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor       = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo        = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList     = MomentContentBuilder.BuilderContent(moment, false)
                };

                response.Data.MomentList.Add(dto);
            }

            return(response);
        }
예제 #7
0
        public ResponseContext <MomentCheckDetailResponse> MomentCheckList(RequestContext <MomentCheckList> request)
        {
            var response = new ResponseContext <MomentCheckDetailResponse>()
            {
                Data = new MomentCheckDetailResponse()
                {
                    MomentList = new List <MomentCheckDetailType>()
                }
            };
            var momentList = momentDao.GetMomentListByState(request.Data.State);

            if (momentList.IsNullOrEmpty())
            {
                return(response);
            }
            foreach (var moment in momentList)
            {
                var userInfo = uerInfoBiz.GetUserInfoByUid(moment.UId);
                if (userInfo == null)
                {
                    continue;
                }
                var applyList = applyDetailDao.GetListByMomentId(moment.MomentId);
                var dto       = new MomentCheckDetailType()
                {
                    MomentId       = moment.MomentId,
                    State          = moment.State,
                    ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                    Address        = moment.Address,
                    IsOffLine      = moment.IsOffLine,
                    Latitude       = moment.Latitude,
                    Longitude      = moment.Longitude,
                    ApplyCountDesc = ApplyBuilder.GetServiceCountDesc(applyList, moment.UId),
                    StateDesc      = moment.State == MomentStateEnum.审核中?"待审核":"已审核通过",
                    TextColor      = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, false),
                    UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList    = MomentContentBuilder.BuilderContent(moment, false)
                };
                response.Data.MomentList.Add(dto);
            }
            return(response);
        }
예제 #8
0
        public ResponseContext <ApplyMomentDetailResponse> ApplyMomentDetail(Guid applyId, RequestHead head)
        {
            var response  = new ResponseContext <ApplyMomentDetailResponse>();
            var applyInfo = applyInfoDao.GetByApplyId(applyId);

            if (applyInfo == null)
            {
                return(response);
            }
            var userInfo = uerInfoBiz.GetUserInfoByUid(applyInfo.MomentUId);
            var moment   = MomentBuilder.GetMoment(applyInfo.MomentId);

            if (userInfo == null || moment == null)
            {
                return(response);
            }
            string btnText = ApplyBuilder.BtnTextMap(applyInfo.ApplyState);

            response.Data = new ApplyMomentDetailResponse()
            {
                ApplyState     = applyInfo.ApplyState,
                ApplyStateDesc = ApplyStateMap(applyInfo.ApplyState),
                MomentId       = moment.MomentId,
                ShareTitle     = MomentContentBuilder.GetShareTitle(moment),
                BtnText        = btnText,
                Address        = moment.Address,
                Latitude       = moment.Latitude,
                Longitude      = moment.Longitude,
                IsOffLine      = moment.IsOffLine,
                NextAction     = ApplyBuilder.BtnActionMap(applyInfo.ApplyState),
                BtnVisable     = !string.IsNullOrEmpty(btnText),
                TextColor      = ApplyBuilder.TextColorMap(applyInfo.ApplyState),
                UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, head),
                ContentList    = MomentContentBuilder.BuilderContent2Contact(moment, userInfo, applyInfo.ApplyState == ApplyStateEnum.申请通过),
                ApplyList      = ApplyBuilder.GetApplyDetails(applyInfo.ApplyId, head, false)
            };
            return(response);
        }
예제 #9
0
        public ResponseContext <MyPublishListResponse> MyPublishList(RequestContext <MyPublishListRequest> request)
        {
            var response = new ResponseContext <MyPublishListResponse>()
            {
                Data = new MyPublishListResponse()
                {
                    MomentList = new List <MyPublishMomentDetailType>()
                }
            };
            var userInfo   = uerInfoBiz.GetUserInfoByUid(request.Head.UId);
            var momentList = momentDao.GetMomentListByUid(request.Head.UId);

            if (momentList.IsNullOrEmpty())
            {
                return(response);
            }
            //有用户申请的动态
            var applyMomentList = new List <MyPublishMomentDetailType>();
            //正常动态
            var commomMomentList = new List <MyPublishMomentDetailType>();

            foreach (var moment in momentList)
            {
                bool overCount = ApplyBuilder.IsOverCount(moment);
                var  applyList = applyInfoDao.GetListByMomentId(moment.MomentId);
                var  dto       = new MyPublishMomentDetailType()
                {
                    MomentId        = moment.MomentId,
                    State           = moment.State,
                    ShareTitle      = MomentContentBuilder.GetShareTitle(moment),
                    Address         = moment.Address,
                    Latitude        = moment.Latitude,
                    Longitude       = moment.Longitude,
                    IsOffLine       = moment.IsOffLine,
                    ApplyCountDesc  = ApplyBuilder.GetApplyCountDesc(applyList),
                    ApplyCountColor = "black",
                    UnReadCount     = ApplyBuilder.GetUnReadCount(applyList),
                    IsOverTime      = MomentContentBuilder.IsOverTime(moment.StopTime),
                    ShareFlag       = moment.State == MomentStateEnum.正常发布中,
                    StateDesc       = MomentContentBuilder.MomentStateMap(moment.State, moment.StopTime, overCount),
                    TextColor       = MomentContentBuilder.TextColorMap(moment.State, moment.StopTime, overCount),
                    UserInfo        = UserInfoBuilder.BuildUserInfo(userInfo, request.Head),
                    ContentList     = MomentContentBuilder.BuilderContent(moment, false)
                };
                if (applyList.NotEmpty() && applyList.Count(a => a.ApplyState == ApplyStateEnum.申请中) > 0)
                {
                    applyMomentList.Add(dto);
                }
                else
                {
                    commomMomentList.Add(dto);
                }
            }
            //有用户申请的保证置顶
            if (applyMomentList.NotEmpty())
            {
                response.Data.MomentList.AddRange(applyMomentList);
            }
            if (commomMomentList.NotEmpty())
            {
                response.Data.MomentList.AddRange(commomMomentList);
            }
            return(response);
        }