|
|
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.Util;
|
|
|
+using OASystem.API.OAMethodLib;
|
|
|
using OASystem.API.OAMethodLib.DeepSeekAPI;
|
|
|
using OASystem.API.OAMethodLib.GenericSearch;
|
|
|
using OASystem.Domain.AesEncryption;
|
|
|
@@ -30,6 +31,7 @@ namespace OASystem.API.Controllers
|
|
|
private readonly DelegationInfoRepository _groupRep;
|
|
|
private readonly DynamicSearchService<Grp_DelegationInfo> _groupSearchService;
|
|
|
private readonly DynamicSearchService<NewClientDataView> _clientSearchService;
|
|
|
+ private readonly DynamicSearchService<InvitationAIInvNameView> _invAISearchService;
|
|
|
private readonly NewClientDataRepository _clientDataRepository;
|
|
|
|
|
|
public SearchController(
|
|
|
@@ -37,6 +39,7 @@ namespace OASystem.API.Controllers
|
|
|
DelegationInfoRepository groupRep,
|
|
|
DynamicSearchService<Grp_DelegationInfo> groupSearchService,
|
|
|
DynamicSearchService<NewClientDataView> clientSearchService,
|
|
|
+ DynamicSearchService<InvitationAIInvNameView> invAISearchService,
|
|
|
NewClientDataRepository clientDataRepository
|
|
|
)
|
|
|
{
|
|
|
@@ -45,6 +48,7 @@ namespace OASystem.API.Controllers
|
|
|
_groupSearchService = groupSearchService;
|
|
|
_clientSearchService = clientSearchService;
|
|
|
_clientDataRepository = clientDataRepository;
|
|
|
+ _invAISearchService = invAISearchService;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -735,5 +739,65 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(true, $"搜索服务暂时不可用!"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 商邀AI 关键字输入提示(单字段)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="keyword">关键字</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("ClientKeywordSearch/{keyword}")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> InvAIKeywordSearch(string keyword)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 验证请求参数 _invAISearchService
|
|
|
+ if (string.IsNullOrEmpty(keyword))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, $"暂无数据!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var invNames = await GeneralMethod.InvitationAIInvName();
|
|
|
+
|
|
|
+ var searchRequest = new DynamicSearchRequest
|
|
|
+ {
|
|
|
+ Keyword = keyword,
|
|
|
+ RequireAllSingleChars = true,
|
|
|
+ PageIndex = 1,
|
|
|
+ PageSize = 999999,
|
|
|
+ FieldWeights = new Dictionary<string, int>
|
|
|
+ {
|
|
|
+ { "Name", 10 },
|
|
|
+ },
|
|
|
+ OrderBy = "SortTime"
|
|
|
+ };
|
|
|
+
|
|
|
+ // 验证字段配置
|
|
|
+ var validation = _invAISearchService.ValidateFieldConfig(
|
|
|
+ searchRequest.FieldWeights,
|
|
|
+ searchRequest.ReturnFields);
|
|
|
+
|
|
|
+ if (!validation.IsValid)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, $"暂无数据!{validation.Message}"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var result = _invAISearchService.SearchDataSource(searchRequest, invNames);
|
|
|
+
|
|
|
+ if (result.Success)
|
|
|
+ {
|
|
|
+ var view = result.Items.Select(x => x.Data).ToList();
|
|
|
+
|
|
|
+ return Ok(JsonView(true, result.Message, view, view.Count));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "暂无数据"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, $"搜索服务暂时不可用!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|