搜索
您的当前位置:首页正文

防骚扰处理逻辑(四)

来源:二三娱乐

标签:redis oracle treemap 存储过程


目录结构

防骚扰实时语音处理

线程 CheckAnnoyResultThread

线程 AnnoyReportThread

cron="5 /5 * * * ?"
cron="
* * * * ?"

常量

redis的键值

某一通电话
history + "" + subccno + "" + seatId + "_" + callId

关键词集合
keyword + "" + subccno + "" + agentId

发送观澜的数据
annoy + "_" + subccno

读取数据库,获得系统默认配置

from Parameter t where t.parameterName = 'record_move_max_num' or t.parameterName = 'call_time_long' or t.parameterName = 'call_short_time' 

附上图片(由于权限限制,在Cmd中不能上传本地图片):

系统默认配置,可更改

从redis的键值中获取坐席工号

这里取到的坐席工号数,<= 当前线程默认处理的最大键值数

根据坐席ID,获取坐席用户的信息

附上图片(由于权限限制,在Cmd中不能上传本地图片):

坐席信息

处理history中的数据

  • 倒序拼接历史数据
  • 获取关键字集合,读取redis中的相关键值获取数据
  • 遍历拼接的数据
    • 判断录音是否结束,目前设置为8分钟
    • 获得坐席和客户的通话时间戳,例如 12790 13330
    • cmd不为空,客户的关注点vo
    • keywordSet不为空,关键词vo,同一个词假如匹配N次,list集合中就出现N次
  • 构造通话记录实体类vo,这里会计算静音总时长,通话总时长,其中使用到treeMap的排序(难点)
    附上图片(由于权限限制,在Cmd中不能上传本地图片):
计算静音总时长逻辑
if(endCall<=start)
{
   continue;
}
else if(startCall<start && endCall>start && endCall<=end)
{
   start = endCall;
}
else if(startCall>=start&&endCall<=end)
{
   muteTime+= (startCall-start);
   start = endCall;
}
else if(startCall>=start&&startCall<=end&&endCall>=end)

   muteTime+= (startCall-start);
   start = 0;
   end = 0;
   break;
}
else if(startCall>=end)
{
   break;
}
else if(startCall<=start && endCall>=end)
{
   start = 0;
   end = 0;
   break;
}
if(start<end)
{
   muteTime+= (end-start);
}
  • 发送短录音进行骚扰的检测,加入到redis中的annoy + "_" + subccno键值中,同时对时间戳进行正序的冒泡排序
{
  "content": "[{\"id\":\"7346\",\"talkertype\":\"1\",\"content\":\"嗯;time=19080 19140\",\"timestamp\":1508384901850,\"time\":\"11:48:21\",\"cmd\":\"\",\"userphone\":\"013805396267\",\"channelId\":\"4d6d04d2b48011e7\",\"answer\":\"\",\"answerType\":\"3\"}]",
  "fileId": "1508385904-674242",
  "callCenter": 1,
  "callTime": "2017-10-19 11:48:21",
  "voiceId": "1508385904-674242",
  "seatId": "7346",
  "callPhone": "013805396267",
  "voicePath": "",
  "platForm": "XQD-SHW"
}
  • 保存数据库,包括客户关注点list,关键词list,通话记录实体类vo

  • 上报观澜线程annoyReportThread,可以开启多个线程同时执行,会先过滤掉不在营业02部,营业07部的坐席,调用oracle的存储过程,查看录音路径,path不为空,拼接voiceId,否则为callId,开始上报防骚扰

select count(id) from AgentInfo a where a.agentId=:agentId and (a.agentWorkGroup like  '%营业02部%' or a.agentWorkGroup like '%营业07部%')
这里是oracle的存储过程调用查询
Call p_sinovoice_getrecordfilename(?,?,?,?)
create or replace procedure p_sinovoice_getrecordfilename
(
   iAgentId    number,
   iCallid     varchar2,
   ofilename   OUT varchar2,
   ofailmsg    OUT varchar2
)
as

    v_ErrCode number(6);
    v_ErrMsg varchar2(200);
begin
    p_hw_getrecordfilename(iAgentId,iCallid,ofilename,ofailmsg);

exception
 when others then
    ofailmsg := '';
end p_sinovoice_getrecordfilename;
/

finish


Top