|
@@ -330,7 +330,7 @@ namespace Hotline.Api.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("batch_audit")]
|
|
|
public async Task KnowledgeBatchAuditAsync()
|
|
|
- {
|
|
|
+ {
|
|
|
// TODO: qcy 批量审核
|
|
|
}
|
|
|
|
|
@@ -340,8 +340,8 @@ namespace Hotline.Api.Controllers
|
|
|
/// <param name="title"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("participle")]
|
|
|
- public async Task<IList<KnowledgeWordOutDto>> KnowledgeKeyWord([FromQuery]string title)
|
|
|
- {
|
|
|
+ public async Task<IList<KnowledgeWordOutDto>> KnowledgeKeyWord([FromQuery] string title)
|
|
|
+ {
|
|
|
return await _knowApplication.TitleParticiple(title);
|
|
|
}
|
|
|
|
|
@@ -620,6 +620,17 @@ namespace Hotline.Api.Controllers
|
|
|
return _exportApplication.GetExcelFile(dto, items, "知识明细导出");
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 来电弹窗知识检索
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("knowretrieval")]
|
|
|
+ public async Task<PagedDto<KnowledgeRetrievalDataDto>> KnowRetrievalWindow([FromBody] KnowledgeRetrievalPagedListDto dto)
|
|
|
+ {
|
|
|
+ return (await _knowApplication.KnowRetrievalAsync(dto)).ToPaged();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 知识检索
|
|
|
/// </summary>
|
|
@@ -628,79 +639,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpGet("knowretrieval")]
|
|
|
public async Task<PagedDto<KnowledgeRetrievalDataDto>> KnowRetrieval([FromQuery] KnowledgeRetrievalPagedListDto dto)
|
|
|
{
|
|
|
- var typeSpliceName = string.Empty;
|
|
|
- var hotspotHotSpotFullName = string.Empty;
|
|
|
- if (!string.IsNullOrEmpty(dto.KnowledgeTypeId))
|
|
|
- {
|
|
|
- var type = await _knowledgeTypeRepository.GetAsync(x => x.Id == dto.KnowledgeTypeId);
|
|
|
- typeSpliceName = type?.SpliceName;
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(dto.HotspotId))
|
|
|
- {
|
|
|
- var hotspot = await _hotspotTypeRepository.GetAsync(x => x.Id == dto.HotspotId);
|
|
|
- hotspotHotSpotFullName = hotspot?.HotSpotFullName;
|
|
|
- }
|
|
|
-
|
|
|
- var sugar = _knowledgeRepository
|
|
|
- .Queryable(false, false, false)
|
|
|
- .Includes(x => x.User)
|
|
|
- .Includes(x => x.SystemOrganize)
|
|
|
- .Includes(x => x.HotspotType)
|
|
|
- .Where(x => x.IsDeleted == false)
|
|
|
- .Where(x => x.Status == EKnowledgeStatus.OnShelf)
|
|
|
- .Where(x => x.KnowledgeType.Any(t => t.KnowledgeType.KnowledgeTypeOrgs.Any(to => to.OrgId == _sessionContext.RequiredOrgId) || t.KnowledgeType.KnowledgeTypeOrgs.Any() == false))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.KnowledgeType.Any(t => t.KnowledgeTypeSpliceName.EndsWith(typeSpliceName)))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(hotspotHotSpotFullName), x => x.HotspotType.HotSpotFullName.EndsWith(hotspotHotSpotFullName!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.HotspotName), x => x.HotspotType.HotSpotFullName.EndsWith(dto.HotspotName!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.CreateOrgId), x => x.CreatorOrgId != null && x.CreatorOrgId.EndsWith(dto.CreateOrgId!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Attribution), x => x.Attribution == dto.Attribution!);
|
|
|
- if (dto.Keyword.NotNullOrEmpty())
|
|
|
- {
|
|
|
- var keywords = dto.Keyword!.SplitKeywords();
|
|
|
- var exp = Expressionable.Create<Knowledge>();
|
|
|
- foreach (var keyword in keywords)
|
|
|
- {
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.All)
|
|
|
- exp.Or(x => x.Title.Contains(keyword) || x.Content.Contains(keyword));
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.Title)
|
|
|
- exp.Or(x => x.Title.Contains(keyword));
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.Content)
|
|
|
- exp.Or(x => x.Content.Contains(keyword));
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.Summary)
|
|
|
- exp.Or(x => x.Summary != null && x.Summary.Contains(keyword));
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.KeyWord)
|
|
|
- {
|
|
|
- var keywordEntity = await _knowledgeWordRepository.GetAsync(m => m.Tag == keyword && m.IsEnable == 0);
|
|
|
- if (keywordEntity is null) continue;
|
|
|
- exp.Or(x => SqlFunc.JsonArrayAny(x.Keywords, keywordEntity.Id));
|
|
|
- }
|
|
|
- }
|
|
|
- sugar.Where(exp.ToExpression());
|
|
|
- }
|
|
|
- if (dto.Content.NotNullOrEmpty())
|
|
|
- {
|
|
|
- var keywords = dto.Content!.GetSegment();
|
|
|
- var keywordIds = _knowledgeWordRepository.Queryable()
|
|
|
- .Where(m => keywords.Contains(m.Tag))
|
|
|
- .Select(m => m.Id)
|
|
|
- .ToList();
|
|
|
- sugar = sugar.Where(x => SqlFunc.JsonArrayAny(x.Keywords, keywordIds));
|
|
|
- }
|
|
|
-
|
|
|
- switch (dto.Sort)
|
|
|
- {
|
|
|
- case "2":
|
|
|
- sugar = sugar.OrderByDescending(p => p.CollectCount);
|
|
|
- break;
|
|
|
- case "3":
|
|
|
- sugar = sugar.OrderByDescending(p => p.CreationTime);
|
|
|
- break;
|
|
|
- default:
|
|
|
- sugar = sugar.OrderByDescending(p => p.PageView);
|
|
|
- break;
|
|
|
- }
|
|
|
- var (total, temp) = await sugar.ToPagedListAsync(dto.PageIndex, dto.PageSize);
|
|
|
- return new PagedDto<KnowledgeRetrievalDataDto>(total, _mapper.Map<IReadOnlyList<KnowledgeRetrievalDataDto>>(temp));
|
|
|
+ return (await _knowApplication.KnowRetrievalAsync(dto)).ToPaged();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -961,7 +900,7 @@ namespace Hotline.Api.Controllers
|
|
|
dto.DefinitionModuleCode = moduleCode;
|
|
|
dto.Title = knowledge.Title;
|
|
|
return await _workflowApplication.StartWorkflowAsync(dto, id, cancellationToken: HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 知识库词库
|
|
@@ -1022,7 +961,7 @@ namespace Hotline.Api.Controllers
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Tag), x => x.Tag == dto.Tag!)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Classify), x => x.Classify == dto.Classify!)
|
|
|
.WhereIF(dto.IsEnable.HasValue, x => x.IsEnable == dto.IsEnable)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Synonym), x => x.Synonym != null && x.Synonym.Contains(dto.Synonym!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Synonym), x => x.Synonym != null && x.Synonym.Contains(dto.Synonym!))
|
|
|
.OrderByDescending(x => x.CreationTime)
|
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
return new PagedDto<KnowledgeWordDto>(total, _mapper.Map<IReadOnlyList<KnowledgeWordDto>>(items));
|