Browse Source

外呼系统开发

anderx 1 year ago
parent
commit
cc3404ef08

+ 11 - 13
src/main/java/com/goafanti/customer/service/impl/UserOutboundServiceImpl.java

@@ -130,10 +130,12 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> imple
         param.put("request",request);
         HttpUtils httpUtils=new HttpUtils();
         String s = httpUtils.sendHttpsRequest(url, "POST", param);
+        LoggerUtils.debug(getClass(),"res="+s);
         JSONObject jsonObject = JSON.parseObject(s);
         JSONObject result = jsonObject.getJSONObject("result");
         String msg = result.getString("msg");
         if (StringUtils.isNotBlank(msg)){
+            LoggerUtils.debug(getClass(),"msg="+msg);
             return new Result().error(new Error(msg));
         }
         return new Result().data("转移成功");
@@ -141,29 +143,25 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> imple
 
     @Override
     public Object pushCallCompleted(InputCallCompleter in) {
-        //{authentication=authenticationBo{customer='C322', timestamp='1732070407', seq='68197723', digest='c310ec894cee31765baa1b4f97426014'},
-        // notify={type=billing, startTime=2024-11-20 10:39:37, ringTime=2024-11-20 10:39:39, answerTime=2024-11-20 10:39:53,
-        // byeTime=2024-11-20 10:40:05, staffNo=1863336, group1=默认班组, group2=, callee=13297312076, caller=15574937814,
-        // keyPress=, taskID=0, taskName=, recordFile=/data/voicerecord/322/20241120/1863336-20241120-103953-13297312076-15574937814.mp3,
-        // service=1, session=1732070377-5753-414072, seq=1085, userData=, result=801, releaseCause=1, timeLength=12, callResult=801,
-        // typeResult=success, callResultMsg=呼叫成功客户挂断, releasePart=0}}
-
         Map<String, Object> notify = in.getNotify();
         String staffNo=String.valueOf(notify.get("staffNo"));
         Admin admin = adminMapper.selectByCallStaffNo(staffNo);
         String  startTime = String.valueOf(notify.get("startTime"));
         String callee=String.valueOf(notify.get("callee"));
-        String caller=String.valueOf(notify.get("caller"));
-        String typeResult=String.valueOf(notify.get("typeResult"));
         String timeLength=String.valueOf(notify.get("timeLength"));
+        String callResult=String.valueOf(notify.get("callResult"));
         String callResultMsg=String.valueOf(notify.get("callResultMsg"));
         String userDate=String.valueOf(notify.get("userData"));
-        String name=admin.getName();
+        String name;
+        if(admin!=null){
+            name=admin.getName();
+        }else {
+            name="暂无";
+        }
         String ContactName=null;
         String uid=null;
         if (userDate!=null){
             uid=userDate;
-
         }
         List<OrganizationContactBook> books = organizationContactBookMapper.selectUserByContact(callee);
         if (books!=null){
@@ -195,8 +193,8 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<CallLogMapper> imple
         pushCountUser(uid);
         //需要关闭客户呼叫中
         try {
-            LoggerUtils.debug(getClass(),String.format("websocket通信成功=》%s",callResultMsg));
-            systemWebSocketHandler.sendMessageToUser(admin.getId(), new TextMessage(callResultMsg));
+            LoggerUtils.debug(getClass(),String.format("websocket通信成功=》%s=%s",callResult,callResultMsg));
+            systemWebSocketHandler.sendMessageToUser(admin.getId(), new TextMessage(callResult));
         }catch (Exception e ){
             LoggerUtils.error(getClass(),"websocket通信失败");
         }