Browse Source

外呼系统开发

anderx 1 year ago
parent
commit
00b1766ed8

+ 2 - 1
src/main/java/com/goafanti/customer/controller/UserOutboundApiController.java

@@ -52,7 +52,8 @@ public class UserOutboundApiController  extends BaseApiController {
         if (in.getUid()==null){
             return res.error(new Error("客户编号不能为空"));
         }
-        return new Result<>().data(this.userOutboundService.callNumber(in));
+
+        return this.userOutboundService.callNumber(in);
     }
 
     /**

+ 2 - 1
src/main/java/com/goafanti/customer/service/UserOutboundService.java

@@ -1,5 +1,6 @@
 package com.goafanti.customer.service;
 
+import com.goafanti.common.bo.Result;
 import com.goafanti.customer.bo.InputCallNumber;
 
 import java.util.Map;
@@ -7,7 +8,7 @@ import java.util.Map;
 public interface UserOutboundService {
     Object checkUser(Integer type);
 
-    Object callNumber(InputCallNumber in);
+    Result callNumber(InputCallNumber in);
 
     Object blindTransferByAgent(InputCallNumber in);
 

+ 6 - 5
src/main/java/com/goafanti/customer/service/impl/UserOutboundServiceImpl.java

@@ -2,6 +2,8 @@ package com.goafanti.customer.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.bo.Error;
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.dao.UserArchivesMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.model.User;
@@ -62,13 +64,12 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
     }
 
     @Override
-    public Object callNumber(InputCallNumber in) {
+    public Result callNumber(InputCallNumber in) {
         String msg =null;
         if (StringUtils.isNotBlank(in.getUid())){
             User u =userMapper.queryById(in.getUid());
             if (u.getCallStatus()==1){
-                msg = "该用户正在通话中";
-                return msg;
+                return new Result().error(new Error("该用户正在通话中"));
             }
         }
         String url= default_url +"/openapi/"+version+"/callNumber";
@@ -88,7 +89,7 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
         JSONObject result = jsonObject.getJSONObject("result");
         msg = result.getString("msg");
         if (StringUtils.isNotBlank(msg)){
-            return msg;
+            return new Result().error(new Error(msg));
         }
         if (StringUtils.isNotBlank(in.getUid())){
             User u =new User();
@@ -96,7 +97,7 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
             u.setCallStatus(1);
             userMapper.update(u);
         }
-        return s;
+        return new Result().data("呼叫成功");
     }
 
     @Override