|
@@ -10,6 +10,7 @@ import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
|
|
|
@Api(tags = "EasyCallCenter365外呼管理")
|
|
@Api(tags = "EasyCallCenter365外呼管理")
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/easyCall")
|
|
@RequestMapping("/easyCall")
|
|
|
|
|
+@Slf4j
|
|
|
public class EasyCallController extends BaseController {
|
|
public class EasyCallController extends BaseController {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -56,37 +58,44 @@ public class EasyCallController extends BaseController {
|
|
|
@GetMapping("/gateway/getGatewayCompanyList")
|
|
@GetMapping("/gateway/getGatewayCompanyList")
|
|
|
public R getGatewayCompanyList() {
|
|
public R getGatewayCompanyList() {
|
|
|
List<EasyCallGatewayVO> resList = new ArrayList<>();
|
|
List<EasyCallGatewayVO> resList = new ArrayList<>();
|
|
|
- List<EasyCallGatewayVO> list = easyCallService.getGatewayList(null);
|
|
|
|
|
- // 如果原始列表为空,直接返回空列表
|
|
|
|
|
- if (list == null || list.isEmpty()) {
|
|
|
|
|
- return R.ok().put("data", resList);
|
|
|
|
|
- }
|
|
|
|
|
- SysConfig cidConf = iSysConfigService.selectConfigByConfigKey("cId.config");
|
|
|
|
|
- if (null != cidConf && StringUtils.isNotBlank(cidConf.getConfigValue())) {
|
|
|
|
|
- JSONObject jo = JSONObject.parseObject(cidConf.getConfigValue());
|
|
|
|
|
- if (null != jo && jo.containsKey("showGatewayIds")) {
|
|
|
|
|
- List<Long> gatewayIdList = jo.getJSONArray("showGatewayIds").toJavaList(Long.class);
|
|
|
|
|
- if (gatewayIdList != null && !gatewayIdList.isEmpty()) {
|
|
|
|
|
- // 将配置中的网关ID列表转换为Set集合便于快速匹配
|
|
|
|
|
- Set<Long> gatewayIdSet = gatewayIdList.stream()
|
|
|
|
|
- .filter(id -> id != null)
|
|
|
|
|
- .collect(Collectors.toSet());
|
|
|
|
|
- // 过滤list,只保留id在配置集合中的网关
|
|
|
|
|
- resList = list.stream()
|
|
|
|
|
- .filter(gateway -> gateway.getId() != null && gatewayIdSet.contains(gateway.getId()))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ try{
|
|
|
|
|
+ List<EasyCallGatewayVO> list = easyCallService.getGatewayList(null);
|
|
|
|
|
+ // 如果原始列表为空,直接返回空列表
|
|
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
|
+ return R.ok().put("data", resList);
|
|
|
|
|
+ }
|
|
|
|
|
+ SysConfig cidConf = iSysConfigService.selectConfigByConfigKey("cId.config");
|
|
|
|
|
+ if (null != cidConf && StringUtils.isNotBlank(cidConf.getConfigValue())) {
|
|
|
|
|
+ JSONObject jo = JSONObject.parseObject(cidConf.getConfigValue());
|
|
|
|
|
+ if (null != jo && jo.containsKey("showGatewayIds") && jo.containsKey("enableGateWayLimit")) {
|
|
|
|
|
+ Boolean enableGateWayLimit = jo.getBoolean("enableGateWayLimit");
|
|
|
|
|
+ List<Long> gatewayIdList = jo.getJSONArray("showGatewayIds").toJavaList(Long.class);
|
|
|
|
|
+ if (null != enableGateWayLimit && enableGateWayLimit && gatewayIdList != null && !gatewayIdList.isEmpty()) {
|
|
|
|
|
+ // 将配置中的网关ID列表转换为Set集合便于快速匹配
|
|
|
|
|
+ Set<Long> gatewayIdSet = gatewayIdList.stream()
|
|
|
|
|
+ .filter(id -> id != null)
|
|
|
|
|
+ .collect(Collectors.toSet());
|
|
|
|
|
+ // 过滤list,只保留id在配置集合中的网关
|
|
|
|
|
+ resList = list.stream()
|
|
|
|
|
+ .filter(gateway -> gateway.getId() != null && gatewayIdSet.contains(gateway.getId()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 配置为空时返回原始列表
|
|
|
|
|
+ resList = list;
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- // 配置为空时返回原始列表
|
|
|
|
|
|
|
+ // 未配置showGatewayIds时返回原始列表
|
|
|
resList = list;
|
|
resList = list;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- // 未配置showGatewayIds时返回原始列表
|
|
|
|
|
|
|
+ // 未找到配置时返回原始列表
|
|
|
resList = list;
|
|
resList = list;
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- // 未找到配置时返回原始列表
|
|
|
|
|
- resList = list;
|
|
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ log.error("获取网关列表失败", e);
|
|
|
|
|
+ return R.ok().put("msg", e.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return R.ok().put("data", resList);
|
|
return R.ok().put("data", resList);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|