Ejemplo n.º 1
0
        public List <WorkRegistrationList> GetWorkRegistrations(GetWorkRegistrationInput input, PersonOnChargeTypeEnum type)
        {
            var query = (from reg in _projectRegistrationRepository.GetAll()
                         join user in _userRepository.GetAll() on reg.SendUserId equals user.Id into workreg
                         from user in workreg.DefaultIfEmpty()
                         where reg.ProjectId == input.ProjectId &&
                         reg.Type == input.Type && reg.PersonOnChargeType == type
                         orderby reg.CreationTime descending
                         select new WorkRegistrationList
            {
                Id = reg.Id,
                CreationTime = reg.CreationTime,
                ProjectId = reg.ProjectId,
                Title = reg.Title,
                Code = reg.Code,
                SendUserId = reg.SendUserId,
                UserName = user.Name,
                UserId = reg.SendUserId,
                TaskId = reg.TaskId,
                StepId = reg.StepId,
                PersonOnChargeType = reg.PersonOnChargeType,
                PersonOnChargeTypeName = reg.PersonOnChargeType.ToString(),
                StepName = reg.PersonOnChargeType == PersonOnChargeTypeEnum.待汇总 ? user.Name : reg.StepName
            });
            var list = query.ToList();

            for (int i = 0; i < list.Count(); i++)
            {
                var item = list[i];
                if (item.PersonOnChargeType == PersonOnChargeTypeEnum.负责人)
                {
                    item.Nodes = (from reg in _projectRegistrationRepository.GetAll()
                                  join user in _userRepository.GetAll() on reg.SendUserId equals user.Id into workreg
                                  from user in workreg.DefaultIfEmpty()
                                  where reg.ProjectId == input.ProjectId &&
                                  reg.RegistrationId == item.Id
                                  orderby reg.CreationTime descending
                                  select new WorkRegistrationList
                    {
                        Id = reg.Id,
                        CreationTime = reg.CreationTime,
                        ProjectId = reg.ProjectId,
                        Title = reg.Title,
                        Code = reg.Code,
                        SendUserId = reg.SendUserId,
                        UserName = user.Name,
                        UserId = reg.SendUserId,
                        TaskId = reg.TaskId,
                        StepId = reg.StepId,
                        PersonOnChargeType = reg.PersonOnChargeType,
                        PersonOnChargeTypeName = reg.PersonOnChargeType.ToString(),
                        StepName = user.Name
                    }).ToList();
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public async Task <List <WorkRegistrationList> > GetWorkRegPage(GetWorkRegistrationInput input)
        {
            var userId = base.AbpSession.UserId;

            var list     = new List <WorkRegistrationList>();
            var listTemp = GetWorkRegistrations(input, PersonOnChargeTypeEnum.普通);
            var types    = listTemp.GroupBy(x => x.StepName).ToList();

            foreach (var item in types)
            {
                if (list.Count(x => x.StepName == item.Key) == 0)
                {
                    list.Add(new WorkRegistrationList
                    {
                        PersonOnChargeType = PersonOnChargeTypeEnum.普通,
                        StepName           = item.Key,
                        Nodes = listTemp.Where(x => x.StepName == item.Key).ToList()
                    });
                }
            }

            var pmList   = GetWorkRegistrations(input, PersonOnChargeTypeEnum.负责人);
            var waitList = GetWorkRegistrations(input, PersonOnChargeTypeEnum.待汇总);

            if (waitList.Count() > 0)
            {
                pmList.Add(new WorkRegistrationList
                {
                    PersonOnChargeType = PersonOnChargeTypeEnum.待汇总,
                    StepName           = "待汇总",
                    Nodes = waitList
                });
            }

            if (pmList.Count() > 0)
            {
                list.Add(new WorkRegistrationList
                {
                    PersonOnChargeType = PersonOnChargeTypeEnum.已汇总,
                    StepName           = "初审汇总",
                    Nodes = pmList
                });
            }

            return(list);
        }