peicj 22 часов назад
Родитель
Сommit
38a78e27d9

+ 101 - 1
ruoyi-admin/src/main/java/com/ruoyi/aicall/controller/ApiController.java

@@ -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));
+    }
 }

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/cc/domain/CcGateways.java

@@ -11,6 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -79,5 +80,10 @@ public class CcGateways implements Serializable {
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private Map<String, Object> params = new HashMap<>();
 
+    private Integer pageSize;
+
+    private Integer pageNum;
+
+    private List<Long> gatewayIds;
 
 }

+ 7 - 0
ruoyi-admin/src/main/resources/mapper/cc/CcGatewaysMapper.xml

@@ -49,6 +49,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{purpose}
                 </foreach>
             </if>
+            <if test="gatewayIds != null and !gatewayIds.isEmpty()">
+                and id in
+                <foreach item="gatewayId" collection="gatewayIds" open="(" separator="," close=")">
+                    #{gatewayId}
+                </foreach>
+            </if>
+
         </where>
     </select>
     

+ 3 - 26
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java

@@ -292,32 +292,9 @@ public class ShiroConfig
         filterChainDefinitionMap.put("/i18n/**", "anon");
         filterChainDefinitionMap.put("/captcha/captchaImage**", "anon");
         filterChainDefinitionMap.put("/recordings/files", "anon");
-        filterChainDefinitionMap.put("/aicall/api/notice/call", "anon");
-        filterChainDefinitionMap.put("/aicall/api/ai/addCallList", "anon");
-        filterChainDefinitionMap.put("/aicall/api/common/addCallList", "anon");
-        filterChainDefinitionMap.put("/aicall/api/gateway/list", "anon");
-        filterChainDefinitionMap.put("/aicall/api/llmacount/list", "anon");
-        filterChainDefinitionMap.put("/aicall/api/voicecode/list", "anon");
-        filterChainDefinitionMap.put("/aicall/api/busigroup/list", "anon");
-        filterChainDefinitionMap.put("/aicall/api/calltask/list", "anon");
-        filterChainDefinitionMap.put("/aicall/api/records/list", "anon");
-        filterChainDefinitionMap.put("/aicall/api/ai/createTask", "anon");
-        filterChainDefinitionMap.put("/aicall/api/ai/startTask", "anon");
-        filterChainDefinitionMap.put("/aicall/api/ai/stopTask", "anon");
-        filterChainDefinitionMap.put("/aicall/api/local/addCall", "anon");
-        filterChainDefinitionMap.put("/aicall/api/phoneBar/params", "anon");
-        filterChainDefinitionMap.put("/aicall/api/phoneBar/extnum/bind", "anon");
-
-        //用户操作
-        filterChainDefinitionMap.put("/aicall/api/user/addUserOrBindExtNumReturnUser", "anon");
-        filterChainDefinitionMap.put("/aicall/api/user/editUserOrUnBindExtNum", "anon");
-        filterChainDefinitionMap.put("/aicall/api/extnum/selectUnBindCcExtNumList", "anon");
-        filterChainDefinitionMap.put("/aicall/api/extnum/edit", "anon");
-        //手动外呼
-        filterChainDefinitionMap.put("/aicall/api/getCustCommunicationInfo", "anon");
-        filterChainDefinitionMap.put("/aicall/api/add/custcallrecord", "anon");
-        filterChainDefinitionMap.put("/aicall/api/outboundcdrList", "anon");
-        filterChainDefinitionMap.put("/aicall/api/call/phone/records", "anon");
+
+        //开放公共api所有接口
+        filterChainDefinitionMap.put("/aicall/api/**", "anon");
 
 
         // 匿名访问不鉴权注解列表