|
@@ -330,7 +330,7 @@ namespace Hotline.Api.Controllers
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
[HttpPost("batch_audit")]
|
|
[HttpPost("batch_audit")]
|
|
public async Task KnowledgeBatchAuditAsync()
|
|
public async Task KnowledgeBatchAuditAsync()
|
|
- {
|
|
|
|
|
|
+ {
|
|
// TODO: qcy 批量审核
|
|
// TODO: qcy 批量审核
|
|
}
|
|
}
|
|
|
|
|
|
@@ -340,8 +340,8 @@ namespace Hotline.Api.Controllers
|
|
/// <param name="title"></param>
|
|
/// <param name="title"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
[HttpGet("participle")]
|
|
[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);
|
|
return await _knowApplication.TitleParticiple(title);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -620,6 +620,17 @@ namespace Hotline.Api.Controllers
|
|
return _exportApplication.GetExcelFile(dto, items, "知识明细导出");
|
|
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>
|
|
/// 知识检索
|
|
/// 知识检索
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -628,75 +639,7 @@ namespace Hotline.Api.Controllers
|
|
[HttpGet("knowretrieval")]
|
|
[HttpGet("knowretrieval")]
|
|
public async Task<PagedDto<KnowledgeRetrievalDataDto>> KnowRetrieval([FromQuery] KnowledgeRetrievalPagedListDto dto)
|
|
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(dto.RetrievalType == EKnowledgeRetrievalType.All && !string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.Content.Contains(dto.Keyword!))
|
|
|
|
- //.WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.Title && !string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!))
|
|
|
|
- //.WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.Content && !string.IsNullOrEmpty(dto.Keyword), d => d.Content.Contains(dto.Keyword!))
|
|
|
|
- //.WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.Summary && !string.IsNullOrEmpty(dto.Keyword), d => d.Summary != null && d.Summary.Contains(dto.Keyword!))
|
|
|
|
- //.WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => SqlFunc.JsonLike(x.KnowledgeType, typeSpliceName))
|
|
|
|
- .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(m => m.Title.Contains(keyword) || m.Content.Contains(keyword));
|
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.Title)
|
|
|
|
- exp.Or(m => m.Title.Contains(keyword));
|
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.Content)
|
|
|
|
- exp.Or(m => m.Content.Contains(keyword));
|
|
|
|
- if (dto.RetrievalType == EKnowledgeRetrievalType.Summary)
|
|
|
|
- exp.Or(m => m.Summary != null && m.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(m => SqlFunc.JsonArrayAny(m.Keywords, keywordEntity.Id));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- sugar.Where(exp.ToExpression());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- 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>
|
|
/// <summary>
|
|
@@ -707,7 +650,7 @@ namespace Hotline.Api.Controllers
|
|
public async Task<Dictionary<string, dynamic>> GetKnowretrievalBaseData()
|
|
public async Task<Dictionary<string, dynamic>> GetKnowretrievalBaseData()
|
|
{
|
|
{
|
|
return _baseDataApplication
|
|
return _baseDataApplication
|
|
- .KnowledgeRetrievalType(new[] { 3, 4})
|
|
|
|
|
|
+ .KnowledgeRetrievalType([3, 4])
|
|
.Build();
|
|
.Build();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -957,7 +900,7 @@ namespace Hotline.Api.Controllers
|
|
dto.DefinitionModuleCode = moduleCode;
|
|
dto.DefinitionModuleCode = moduleCode;
|
|
dto.Title = knowledge.Title;
|
|
dto.Title = knowledge.Title;
|
|
return await _workflowApplication.StartWorkflowAsync(dto, id, cancellationToken: HttpContext.RequestAborted);
|
|
return await _workflowApplication.StartWorkflowAsync(dto, id, cancellationToken: HttpContext.RequestAborted);
|
|
- }
|
|
|
|
|
|
+ }
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region 知识库词库
|
|
#region 知识库词库
|
|
@@ -1017,6 +960,7 @@ namespace Hotline.Api.Controllers
|
|
var (total, items) = await _knowledgeWrodRepository.Queryable()
|
|
var (total, items) = await _knowledgeWrodRepository.Queryable()
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Tag), x => x.Tag == dto.Tag!)
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Tag), x => x.Tag == dto.Tag!)
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Classify), x => x.Classify == dto.Classify!)
|
|
.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)
|
|
.OrderByDescending(x => x.CreationTime)
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
.ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|