forked from ddrilling/AsbCloudServer
#5998816 Удалил комментарии
This commit is contained in:
parent
0ad4cebdb8
commit
df0c6d3653
@ -79,20 +79,17 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
var result = new List<WellFinalDocumentsDto>();
|
var result = new List<WellFinalDocumentsDto>();
|
||||||
|
|
||||||
// Выбираем все дела, по id скважины
|
|
||||||
var wells = await context.WellFinalDocuments.Where(x => x.IdWell == idWell)
|
var wells = await context.WellFinalDocuments.Where(x => x.IdWell == idWell)
|
||||||
.ToListAsync(token)
|
.ToListAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (wells.Any())
|
if (wells.Any())
|
||||||
{
|
{
|
||||||
// Выбираем категории файлов, по данным выбранных дел
|
|
||||||
var category = await context.FileCategories
|
var category = await context.FileCategories
|
||||||
.Where(x => wells.Select(w => w.IdCategory).Contains(x.Id))
|
.Where(x => wells.Select(w => w.IdCategory).Contains(x.Id))
|
||||||
.ToListAsync(token)
|
.ToListAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
// Группируем дела по категориям
|
|
||||||
var wellFinalDocs = category
|
var wellFinalDocs = category
|
||||||
.GroupJoin(wells,
|
.GroupJoin(wells,
|
||||||
fc => fc.Id,
|
fc => fc.Id,
|
||||||
@ -104,14 +101,12 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
wellFinalDocs.ForEach(async item => {
|
wellFinalDocs.ForEach(async item => {
|
||||||
// Получение списка ответственных
|
|
||||||
var userIds = item.Wells
|
var userIds = item.Wells
|
||||||
.Select(x => x.IdUser)
|
.Select(x => x.IdUser)
|
||||||
.ToList();
|
.ToList();
|
||||||
var allUsers = await userService.GetAllAsync(token)
|
var allUsers = await userService.GetAllAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
// Получение общее количество файлов и актуальный
|
|
||||||
var fileIds = item.Wells
|
var fileIds = item.Wells
|
||||||
.Where(x => x.IdFile != null)
|
.Where(x => x.IdFile != null)
|
||||||
.Select(x => x.IdFile)
|
.Select(x => x.IdFile)
|
||||||
@ -124,7 +119,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
actualFile = fileService.GetInfoAsync(actualFileId ?? default(int), token).Result;
|
actualFile = fileService.GetInfoAsync(actualFileId ?? default(int), token).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Формирование модели дела
|
|
||||||
result.Add(new WellFinalDocumentsDto {
|
result.Add(new WellFinalDocumentsDto {
|
||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
NameCategory = item.NameCategory,
|
NameCategory = item.NameCategory,
|
||||||
@ -140,7 +134,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
public async Task<IEnumerable<UserDto>> GetPublishersAsync(int idWell, CancellationToken token)
|
public async Task<IEnumerable<UserDto>> GetPublishersAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
// Получаем отношение скважин и компаний по идентификатору скважины
|
|
||||||
var companyIds = await context.RelationCompaniesWells
|
var companyIds = await context.RelationCompaniesWells
|
||||||
.Where(x => x.IdWell == idWell).Select(x => x.IdCompany)
|
.Where(x => x.IdWell == idWell).Select(x => x.IdCompany)
|
||||||
.ToListAsync(token)
|
.ToListAsync(token)
|
||||||
@ -149,7 +142,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
var allUsers = await userService.GetAllAsync(token)
|
var allUsers = await userService.GetAllAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
// Выбираем пользователей у которых, компания совпадает со строителем вышки
|
|
||||||
return allUsers.Where(x => {
|
return allUsers.Where(x => {
|
||||||
var idCompany = x.IdCompany ?? default(int);
|
var idCompany = x.IdCompany ?? default(int);
|
||||||
return companyIds.Contains(idCompany);
|
return companyIds.Contains(idCompany);
|
||||||
@ -182,7 +174,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
public async Task<WellFinalDocumentsHistoryDto> GetFilesHistoryByIdCategory(int idWell, int idCategory, CancellationToken token)
|
public async Task<WellFinalDocumentsHistoryDto> GetFilesHistoryByIdCategory(int idWell, int idCategory, CancellationToken token)
|
||||||
{
|
{
|
||||||
// Выбираем все id файлов, по id скважины и id категории
|
|
||||||
var wellsIds = await context.WellFinalDocuments
|
var wellsIds = await context.WellFinalDocuments
|
||||||
.Where(x => idWell == x.IdWell && x.IdCategory == idCategory && x.IdFile != null)
|
.Where(x => idWell == x.IdWell && x.IdCategory == idCategory && x.IdFile != null)
|
||||||
.Select(x => (int)x.IdFile)
|
.Select(x => (int)x.IdFile)
|
||||||
|
Loading…
Reference in New Issue
Block a user