|
|
@@ -1104,6 +1104,86 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取电话工具条的网关列表
|
|
|
+ */
|
|
|
+ @PostMapping("/myPhoneBar/params")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult getMyPhoneBaseParams(@RequestBody Map<String,String> param) {
|
|
|
+
|
|
|
+ String extNum = param.get("extNum");
|
|
|
+ String myGateway = param.get("myGateway");
|
|
|
+ if(extNum == null){
|
|
|
+ return AjaxResult.error("分机号参数缺失");
|
|
|
+ }
|
|
|
+ // 获取分机号
|
|
|
+ CcExtNum ccExtNum = ccExtNumService.selectCcExtNumByExtNum(Long.valueOf(extNum));
|
|
|
+
|
|
|
+ String extnum = ccExtNum.getExtNum().toString();
|
|
|
+ String opnum = ccExtNum.getUserCode();
|
|
|
+ String password = ccExtNum.getExtPass();
|
|
|
+ String groupId = "1";
|
|
|
+ String skillLevel = "9";
|
|
|
+ String projectId = "1";
|
|
|
+ //1.创建token
|
|
|
+ String loginToken = ccExtNumService.createToken(extnum, opnum, groupId, skillLevel, projectId);
|
|
|
+ //2.获取加密密码
|
|
|
+ String encryptStr = DESUtil.encrypt(password + "," + DateUtils.format(DateUtils.addDays(new Date(), 1), "yyyyMMddHHmm"));
|
|
|
+ encryptStr = String.format("var _phoneEncryptPassword='%s';", encryptStr);
|
|
|
+
|
|
|
+ CcGateways ccGatewaysVo = new CcGateways();
|
|
|
+ //判断指定网关还是全部网关
|
|
|
+ if(StringUtils.isNotBlank(myGateway)){
|
|
|
+ List<Long> gatewayIds = Arrays.stream(myGateway.split(","))
|
|
|
+ .map(Long::parseLong)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ccGatewaysVo.setGatewayIds(gatewayIds);
|
|
|
+ }else{
|
|
|
+ // 网关用途 0 已废弃; 1 电话条; 2 外呼任务; 3 无限制
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("purposes", Arrays.asList(1,3));
|
|
|
+ ccGatewaysVo.setParams(params);
|
|
|
+ }
|
|
|
+ //3.获取工具条网关列表
|
|
|
+ List<CcGateways> gatewaysList = ccGatewaysService.selectCcGatewaysList(ccGatewaysVo);
|
|
|
+ List<JSONObject> gatewayList = new ArrayList<>();
|
|
|
+ for (CcGateways ccGateways: gatewaysList) {
|
|
|
+ JSONObject configGateway = new JSONObject();
|
|
|
+ configGateway.put("uuid", ccGateways.getId().toString());
|
|
|
+ configGateway.put("updateTime", ccGateways.getUpdateTime());
|
|
|
+ configGateway.put("gatewayAddr", ccGateways.getGwAddr());
|
|
|
+ configGateway.put("callerNumber", ccGateways.getCaller());
|
|
|
+ configGateway.put("calleePrefix", ccGateways.getCalleePrefix());
|
|
|
+ configGateway.put("callProfile", ccGateways.getProfileName());
|
|
|
+ configGateway.put("priority", ccGateways.getPriority());
|
|
|
+ configGateway.put("concurrency", ccGateways.getMaxConcurrency());
|
|
|
+ configGateway.put("register", ccGateways.getRegister());
|
|
|
+ configGateway.put("authUsername", ccGateways.getAuthUsername());
|
|
|
+ configGateway.put("audioCodec", ccGateways.getCodec());
|
|
|
+ gatewayList.add(configGateway);
|
|
|
+ }
|
|
|
+ JSONObject callConfig = new JSONObject();
|
|
|
+
|
|
|
+ String scriptServer = ccParamsService.getParamValueByCode("call-center-server-ip-addr", "");
|
|
|
+ String scriptPort = ccParamsService.getParamValueByCode("call-center-websocket-port", "");
|
|
|
+
|
|
|
+ callConfig.put("scriptServer", scriptServer);
|
|
|
+ callConfig.put("scriptPort", scriptPort);
|
|
|
+ callConfig.put("loginToken", loginToken);
|
|
|
+ callConfig.put("encryptPsw", encryptStr);
|
|
|
+ callConfig.put("gatewayList", gatewayList);
|
|
|
+ //登录账号
|
|
|
+ callConfig.put("opNum", opnum);
|
|
|
+ //登录用户名称
|
|
|
+ SysUser sysUser = userService.selectUserByLoginName(opnum);
|
|
|
+ if(sysUser != null){
|
|
|
+ callConfig.put("userName", sysUser.getUserName());
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success(callConfig);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询未绑定的分机管理列表
|
|
|
*/
|
|
|
@@ -1404,5 +1484,25 @@ public class ApiController extends BaseController {
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 获取外呼网关列表接口
|
|
|
+ * purposes 1手动外呼电话条,2AI外呼,3不限制
|
|
|
+ * @param queryParams 网关参数
|
|
|
+ * @param req
|
|
|
+ */
|
|
|
+ @PostMapping("/gateway/myList")
|
|
|
+ @ResponseBody
|
|
|
+ public TableDataInfo getGatewayMyList(@RequestBody CcGateways queryParams, HttpServletRequest req){
|
|
|
+ // 校验请求方ip是否合法
|
|
|
+ if (!ClientIpCheck.checkIp(req)) {
|
|
|
+ TableDataInfo tableDataInfo;
|
|
|
+ tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setTotal(0);
|
|
|
+ tableDataInfo.setCode(AjaxResult.Type.NO_AUTH.value());
|
|
|
+ tableDataInfo.setMsg("未授权,请联系系统管理员添加ip白名单!");
|
|
|
+ return tableDataInfo;
|
|
|
+ }
|
|
|
+ startPage(queryParams.getPageNum(), queryParams.getPageSize());
|
|
|
+ return getDataTable(ccGatewaysService.selectCcGatewaysList(queryParams));
|
|
|
+ }
|
|
|
}
|