|
|
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; |
|
|
|
using Shentun.Peis.BigtextResultTemplates; |
|
|
|
using Shentun.Peis.CommonTables; |
|
|
|
using Shentun.Peis.HelperDto; |
|
|
|
using Shentun.Peis.Items; |
|
|
|
using Shentun.Peis.Models; |
|
|
|
using SqlSugar; |
|
|
|
using System; |
|
|
|
@ -27,19 +28,25 @@ namespace Shentun.Peis.BigtextResultTemplates |
|
|
|
private readonly BigtextResultTemplateManager _bigtextResultTemplateManager; |
|
|
|
private readonly IRepository<BigtextResultConclusion, Guid> _bigtextResultConclusionRepository; |
|
|
|
private readonly IRepository<BigtextResultDescription, Guid> _bigtextResultDescriptionRepository; |
|
|
|
private readonly IRepository<ItemBigtextResultType> _itemBigtextResultTypeRepository; |
|
|
|
private readonly IRepository<BigtextResultType, Guid> _bigtextResultTypeRepository; |
|
|
|
|
|
|
|
public BigtextResultTemplateAppService( |
|
|
|
IRepository<BigtextResultTemplate, Guid> bigtextResultTemplateRepository, |
|
|
|
CacheService cacheService, |
|
|
|
BigtextResultTemplateManager bigtextResultTemplateManager, |
|
|
|
IRepository<BigtextResultConclusion, Guid> bigtextResultConclusionRepository, |
|
|
|
IRepository<BigtextResultDescription, Guid> bigtextResultDescriptionRepository) |
|
|
|
IRepository<BigtextResultDescription, Guid> bigtextResultDescriptionRepository, |
|
|
|
IRepository<ItemBigtextResultType> itemBigtextResultTypeRepository, |
|
|
|
IRepository<BigtextResultType, Guid> bigtextResultTypeRepository) |
|
|
|
{ |
|
|
|
_bigtextResultTemplateRepository = bigtextResultTemplateRepository; |
|
|
|
_cacheService = cacheService; |
|
|
|
_bigtextResultTemplateManager = bigtextResultTemplateManager; |
|
|
|
_bigtextResultConclusionRepository = bigtextResultConclusionRepository; |
|
|
|
_bigtextResultDescriptionRepository = bigtextResultDescriptionRepository; |
|
|
|
_itemBigtextResultTypeRepository = itemBigtextResultTypeRepository; |
|
|
|
_bigtextResultTypeRepository = bigtextResultTypeRepository; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -213,6 +220,45 @@ namespace Shentun.Peis.BigtextResultTemplates |
|
|
|
return entDto; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 根据项目获取对应的词条模板、描述跟建议(多条换行合并)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/BigtextResultTemplate/GetBigtextResultTemplateWithDetail")] |
|
|
|
public async Task<List<GetBigtextResultTemplateWithDetailDto>> GetBigtextResultTemplateWithDetailAsync(ItemIdInputDto input) |
|
|
|
{ |
|
|
|
var query = (from itemBigtextResultType in await _itemBigtextResultTypeRepository.GetQueryableAsync() |
|
|
|
join bigtextResultType in await _bigtextResultTypeRepository.GetQueryableAsync() on itemBigtextResultType.BigtextResultTypeId equals bigtextResultType.Id |
|
|
|
join bigtextResultTemplate in await _bigtextResultTemplateRepository.GetQueryableAsync() on bigtextResultType.Id equals bigtextResultTemplate.BigtextResultTypeId |
|
|
|
join bigtextResultConclusion in await _bigtextResultConclusionRepository.GetQueryableAsync() on bigtextResultTemplate.Id equals bigtextResultConclusion.BigtextResultTemplateId into bigtextResultConclusionTemp |
|
|
|
from bigtextResultConclusionHaveEmpty in bigtextResultConclusionTemp.DefaultIfEmpty() |
|
|
|
join bigtextResultDescription in await _bigtextResultDescriptionRepository.GetQueryableAsync() on bigtextResultTemplate.Id equals bigtextResultDescription.BigtextResultTemplateId into bigtextResultDescriptionTemp |
|
|
|
from bigtextResultDescriptionHaveEmpty in bigtextResultDescriptionTemp.DefaultIfEmpty() |
|
|
|
where itemBigtextResultType.ItemId == input.ItemId |
|
|
|
orderby bigtextResultTemplate.DisplayOrder ascending |
|
|
|
select new |
|
|
|
{ |
|
|
|
bigtextResultTypeName = bigtextResultType.DisplayName, |
|
|
|
bigtextResultTemplateName = bigtextResultTemplate.DisplayName, |
|
|
|
bigtextResultTemplateId = bigtextResultTemplate.Id, |
|
|
|
bigtextResultConclusionHaveEmpty, |
|
|
|
bigtextResultDescriptionHaveEmpty |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
var bigtextResultTemplateGroup = query.GroupBy(g => g.bigtextResultTemplateId); |
|
|
|
|
|
|
|
var entListDto = bigtextResultTemplateGroup.Select(s => new GetBigtextResultTemplateWithDetailDto |
|
|
|
{ |
|
|
|
BigtextResultTypeName = s.FirstOrDefault().bigtextResultTypeName, |
|
|
|
BigtextResultTemplateName = s.FirstOrDefault().bigtextResultTemplateName, |
|
|
|
bigtextResultDescription = string.Join(";", s.Where(m => m.bigtextResultDescriptionHaveEmpty != null).Select(ss => ss.bigtextResultDescriptionHaveEmpty.Description).Distinct()), |
|
|
|
bigtextResultConclusion = string.Join(";", s.Where(m => m.bigtextResultConclusionHaveEmpty != null).Select(ss => ss.bigtextResultConclusionHaveEmpty.Conclusion).Distinct()) |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
return entListDto; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |