示例#1
0
        public static List <ApplyDetailItem> GetCheckDetails(MomentEntity moment, UserInfoEntity momentUserInfo, RequestHead head)
        {
            var resultList = new List <ApplyDetailItem>()
            {
                new ApplyDetailItem()
                {
                    UserInfo       = UserInfoBuilder.BuildUserInfo(momentUserInfo, head),
                    Content        = "首次提交审核",
                    CreateTimeDesc = DateTimeHelper.GetDateDesc(moment.CreateTime, true),
                }
            };

            var applyDetaiList = applyDetailDao.GetListByMomentId(moment.MomentId);

            if (applyDetaiList.NotEmpty())
            {
                var resultDic = GetUserInfo(applyDetaiList, head);
                foreach (var item in applyDetaiList)
                {
                    resultList.Add(new ApplyDetailItem()
                    {
                        CreateTimeDesc = DateTimeHelper.GetDateDesc(item.CreateTime, true),
                        Content        = item.Content,
                        UserInfo       = resultDic[item.UId]
                    });
                }
            }
            return(resultList);
        }
示例#2
0
        /// <summary>
        /// 获取动态申请列表
        /// </summary>
        /// <param name="momentId">动态Id</param>
        /// <param name="passApply">仅仅查看申请通过数据</param>
        /// <returns></returns>
        public static List <ApplyItem> GetApplyList(Guid momentId, bool isValid, RequestHead head, long momentUId = 0)
        {
            var applyList = applyInfoDao.GetListByMomentId(momentId);

            if (applyList.IsNullOrEmpty())
            {
                return(null);
            }
            if (isValid)
            {
                applyList = applyList.Where(a => a.ApplyState == ApplyStateEnum.申请通过 || a.UId == head.UId || a.MomentUId == head.UId).ToList();
            }
            var resultList = new List <ApplyItem>();

            for (var index = 0; index < applyList.Count; index++)
            {
                var apply    = applyList[index];
                var userInfo = uerInfoBiz.GetUserInfoByUid(apply.UId);
                if (userInfo == null)
                {
                    continue;
                }
                var result = new ApplyItem()
                {
                    ApplyId        = apply.ApplyId,
                    TextColor      = TextColorMap(apply.ApplyState),
                    UserInfo       = UserInfoBuilder.BuildUserInfo(userInfo, head),
                    ShowBorder     = index != applyList.Count - 1,
                    CreateTimeDesc = DateTimeHelper.GetDateDesc(apply.CreateTime, true),
                };
                if (apply.UId == head.UId)
                {
                    result.StateDesc = StateDescMapV1(apply.ApplyState);
                }
                else
                {
                    result.StateDesc = StateDescMap(apply.ApplyState);
                }
                if (!isValid)
                {
                    var applyDetaiList = applyDetailDao.GetListByApplyId(apply.ApplyId);
                    if (applyDetaiList.NotEmpty())
                    {
                        applyDetaiList = applyDetaiList.Where(a => a.UId != momentUId).OrderByDescending(a => a.CreateTime).ToList();
                        if (applyDetaiList.NotEmpty())
                        {
                            result.Content = applyDetaiList[0].Content;
                        }
                    }
                }

                resultList.Add(result);
            }
            return(resultList);
        }
示例#3
0
        private static Dictionary <long, UserInfoType> GetUserInfo(List <ApplyDetailEntity> applyDetaiList, RequestHead head, bool serviceName = false)
        {
            var resultDic = new Dictionary <long, UserInfoType>();

            foreach (var item in applyDetaiList.GroupBy(a => a.UId))
            {
                var userInfo = UserInfoBuilder.BuildUserInfo(uerInfoBiz.GetUserInfoByUid(item.Key), head);
                if (serviceName && userInfo.UserType == UserTypeEnum.ServiceUser)
                {
                    userInfo.NickName = string.Format("{0}(客服)", userInfo.NickName);
                }
                resultDic.Add(item.Key, userInfo);
            }
            return(resultDic);
        }