public async Task <GetProjectAuditResultOutput> GetAuditAsync(GetProjectResultForEditInput input) { var ret = new GetProjectAuditResultOutput(); var service = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>() .IocManager.IocContainer.Resolve <IProjectAppService>(); var projectBase = await service.GetSingleProject(new GetSingleProjectInput() { Id = input.ProjectBaseId }); ret.ProjectInfo = projectBase; ret.ProjectBaseId = input.ProjectBaseId; var finish_query = from a in _projectPersentFinishRepository.GetAll() join b in _projectPersentFinishAllotRepository.GetAll() on a.Id equals b.FinishId join c in _projectAuditMemberRepository.GetAll() on b.AuditMembeId equals c.Id join d in _projectPersentFinishResultRepository.GetAll() on new { allotid = b.Id, userid = c.UserId } equals new { allotid = d.AllotId, userid = d.UserId } into g from r in g.DefaultIfEmpty() where c.UserAuditRole == input.AuditRoleId && c.UserId == AbpSession.UserId.Value && (r == null || (r.UserId == AbpSession.UserId.Value)) && a.ProjectId == input.ProjectBaseId select new { A = a, AllotId = b.Id, ResultId = r == null ? Guid.Empty : r.Id, CjzFile = r == null ? "" : r.CJZFiles, Files = r == null ? "" : r.Files, Amount = r == null ? 0 : r.AuditAmount, Remark = r == null ? "" : r.Remark, SurePersent = r.SurePersent, ManagerSurePersent = r.ManagerSurePersent }; foreach (var item in finish_query) { var entity = new ProjectFinishItem() { FinishId = item.A.Id, FinishName = item.A.Name, WorkDay = item.A.WorkDay, AllotId = item.AllotId }; entity.Result = new ProjectAuditResultInfoOutput(); if (item.ResultId != Guid.Empty) { entity.Result.Id = item.ResultId; entity.Result.CjzFile = await _abpFileRelationAppService.GetAsync(new GetAbpFilesInput() { BusinessId = entity.Result.Id.ToString(), BusinessType = (int)AbpFileBusinessType.工程评审CJZ结果 }); entity.Result.Files = await _abpFileRelationAppService.GetListAsync(new GetAbpFilesInput() { BusinessId = entity.Result.Id.ToString(), BusinessType = (int)AbpFileBusinessType.工程评审结果 }); entity.Result.AuditAmount = item.Amount; entity.Result.Remark = item.Remark; entity.Result.SurePersent = item.SurePersent; entity.Result.ManagerSurePersent = item.ManagerSurePersent; } ret.FinishItems.Add(entity); } //var resultType = (int)FinishResultTypeEnum.评审结果; //var auditResult_query = await _projectPersentFinishResultRepository.GetAll().FirstOrDefaultAsync(r => r.ProjectId == input.ProjectBaseId && r.UserId == AbpSession.UserId.Value && r.ResultType == resultType); //if (auditResult_query != null) //{ // ret.Result.Id = auditResult_query.Id; // if (!auditResult_query.CJZFiles.IsNullOrWhiteSpace()) // ret.Result.CjzFile = Newtonsoft.Json.JsonConvert.DeserializeObject<FileUploadFiles>(auditResult_query.CJZFiles); // if (!auditResult_query.Files.IsNullOrWhiteSpace()) // ret.Result.Files = Newtonsoft.Json.JsonConvert.DeserializeObject<List<FileUploadFiles>>(auditResult_query.Files); // ret.AuditRoleId = input.AuditRoleId; // ret.Result.AuditAmount = auditResult_query.AuditAmount; // ret.Result.Remark = auditResult_query.Remark; //} return(ret); }