|
|
@@ -1,5 +1,6 @@
|
|
|
package com.fs.company.controller.company;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.aicall.domain.CcLlmAgentAccount;
|
|
|
import com.fs.aicall.service.ICompanyBindAiModelService;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
@@ -12,6 +13,8 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.CompanyInboundBind;
|
|
|
import com.fs.company.domain.EasyCallInboundCdrVO;
|
|
|
import com.fs.company.mapper.CompanyInboundBindMapper;
|
|
|
+import com.fs.company.mapper.CompanyMapper;
|
|
|
+import com.fs.company.mapper.CompanyVoiceCloneRefMapper;
|
|
|
import com.fs.company.mapper.EasyCallInboundLlmMapper;
|
|
|
import com.fs.company.service.ICompanyInboundCallManageService;
|
|
|
import com.fs.company.vo.easycall.EasyCallBizGroupVO;
|
|
|
@@ -22,14 +25,12 @@ import com.fs.company.vo.easycall.EasyCallLlmAccountVO;
|
|
|
import com.fs.company.vo.easycall.EasyCallVoiceCodeVO;
|
|
|
import com.fs.framework.security.LoginUser;
|
|
|
import com.fs.framework.service.TokenService;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -55,6 +56,13 @@ public class CompanyInboundCallManageController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ICompanyBindAiModelService companyBindAiModelService;
|
|
|
+ @Autowired
|
|
|
+ private CompanyVoiceCloneRefMapper companyVoiceCloneRefMapper;
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CompanyMapper companyMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询呼入大模型配置列表
|
|
|
@@ -213,8 +221,23 @@ public class CompanyInboundCallManageController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/voiceList")
|
|
|
public AjaxResult getVoiceList(@RequestParam("voiceSource") String voiceSource) {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long companyId = loginUser.getUser().getCompanyId();
|
|
|
+ List<Long> ttsIds = companyVoiceCloneRefMapper.selectByCompanyIdAndCompanyUserId(companyId, loginUser.getCompany().getUserId());
|
|
|
List<EasyCallVoiceCodeVO> list = inboundLlmMapper.selectVoiceListBySource(voiceSource);
|
|
|
- return AjaxResult.success(list);
|
|
|
+ List<EasyCallVoiceCodeVO> result = list.stream()
|
|
|
+ .filter(item ->
|
|
|
+ item.getPriority() == 1 || (item.getPriority() == 0 && ttsIds.contains(item.getId()))
|
|
|
+ )
|
|
|
+ .map(item -> {
|
|
|
+ EasyCallVoiceCodeVO vo = new EasyCallVoiceCodeVO();
|
|
|
+ vo.setVoiceCode(item.getVoiceCode());
|
|
|
+ vo.setVoiceName(item.getVoiceName());
|
|
|
+ vo.setVoiceSource(item.getVoiceSource());
|
|
|
+ return vo;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return AjaxResult.success(result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -231,7 +254,25 @@ public class CompanyInboundCallManageController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/gatewayList")
|
|
|
public AjaxResult getGatewayList() {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long companyId = loginUser.getUser().getCompanyId();
|
|
|
+ String gateWayList = companyMapper.getGateWayList(companyId);
|
|
|
+ String json = configService.selectConfigByKey("cId.config");
|
|
|
List<EasyCallGatewayVO> list = inboundLlmMapper.selectOutboundGatewayList();
|
|
|
+ if (null != companyId && null != list && !list.isEmpty()) {
|
|
|
+ if(StringUtils.isNotBlank(gateWayList)){
|
|
|
+ List<Long> collect = Arrays.stream(gateWayList.split(",")).map(item -> Long.valueOf(item.trim())).collect(Collectors.toList());
|
|
|
+ list = list.stream().filter(item -> collect.contains(item.getId())).collect(Collectors.toList());
|
|
|
+ }else{
|
|
|
+ if (StringUtils.isNotBlank(json)) {
|
|
|
+ JSONObject obj = JSONObject.parseObject(json);
|
|
|
+ if(null != obj && obj.containsKey("showGatewayIds")){
|
|
|
+ List<Long> showGatewayIds = obj.getJSONArray("showGatewayIds").stream().map(item -> Long.valueOf(item.toString())).collect(Collectors.toList());
|
|
|
+ list = list.stream().filter(item -> showGatewayIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
|