Explorar o código

外呼系统开发

anderx hai 1 ano
pai
achega
5b3d97667c

+ 10 - 0
src/main/java/com/goafanti/common/bo/InputCallCompleter.java

@@ -0,0 +1,10 @@
+package com.goafanti.common.bo;
+
+import java.util.Map;
+
+public class InputCallCompleter {
+
+    private Map<String,Object> authentication;
+
+    private Map<String,Object> notify;
+}

+ 3 - 0
src/main/java/com/goafanti/common/controller/PortalController.java

@@ -59,6 +59,7 @@ public class PortalController extends BaseController {
 	@Resource
 	private OrderService	orderService;
 
+
 	private static final String UNIT = "万元";
 
 	private static final int MULTIPLE = 20;
@@ -1022,4 +1023,6 @@ public class PortalController extends BaseController {
 		return mv;
 	}
 
+
+
 }

+ 16 - 4
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -17,6 +17,7 @@ import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.core.websocket.SystemWebSocketHandler;
+import com.goafanti.customer.service.UserOutboundService;
 import com.goafanti.expenseAccount.service.ExpenseAccountService;
 import com.goafanti.order.service.OrderNewService;
 import com.goafanti.order.service.OrderProjectService;
@@ -33,14 +34,12 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Scope;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.socket.TextMessage;
 
 import javax.annotation.Resource;
+import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
@@ -96,6 +95,8 @@ public class PublicController extends CertifyApiController {
 	private OrderNewService orderNewService;
 	@Autowired
 	private OrderProjectService orderProjectService;
+	@Resource
+	private UserOutboundService userOutboundService;
 
 	@Value(value = "${patentTemplate}")
 	private String					patentTemplate		= null;
@@ -977,4 +978,15 @@ public class PublicController extends CertifyApiController {
 		res.data("ok");
 		return res;
 	}
+
+	/**
+	 * 呼叫完成回调
+	 *
+	 */
+	@PostMapping("/callCompleted")
+	public Result callCompleted(ServletRequest request,InputCallCompleter in) {
+		Map<String, String[]> parameterMap =request.getParameterMap();
+		System.out.println(parameterMap);
+		return new Result<>().data(userOutboundService.callCompleted(parameterMap));
+	}
 }

+ 1 - 1
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -261,7 +261,7 @@
             a.last_login_time,a.open_id,a.type,
             a.reviewer,a.amb_id,a.amb_role,
             a.amb_manage,a.manager_id,a.senior_staff,
-            a.public_purview,a.expense_open_id,a.expense_super_examine
+            a.public_purview,a.expense_open_id,a.expense_super_examine,a.call_no
         from admin a left join department b on a.department_id=b.id
                      left join district_glossory c on b.province=c.id
         where a.mobile = #{mobile,jdbcType=VARCHAR}

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

@@ -3,6 +3,8 @@ package com.goafanti.customer.controller;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.model.Admin;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.InputCallNumber;
 import com.goafanti.customer.service.UserOutboundService;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -35,6 +37,12 @@ public class UserOutboundApiController  extends BaseApiController {
     @PostMapping("/callNumber")
     public Result callNumber(InputCallNumber in) {
         Result res =new Result();
+        Admin adminToken = TokenManager.getAdminToken();
+        String callNo = null;
+        if (adminToken != null) {
+            callNo = adminToken.getCallNo();
+            in.setAgent(callNo);
+        }
         if (in.getAgent()==null){
             return res.error(new Error("坐席号不能为空"));
         }
@@ -51,6 +59,12 @@ public class UserOutboundApiController  extends BaseApiController {
     @PostMapping("/blindTransferByAgent")
     public Result blindTransferByAgent(InputCallNumber in) {
         Result res =new Result();
+        Admin adminToken = TokenManager.getAdminToken();
+        String callNo = null;
+        if (adminToken != null) {
+            callNo = adminToken.getCallNo();
+            in.setAgent(callNo);
+        }
         if (in.getAgent()==null){
             return res.error(new Error("坐席号不能为空"));
         }
@@ -60,19 +74,5 @@ public class UserOutboundApiController  extends BaseApiController {
         return new Result<>().data(this.userOutboundService.blindTransferByAgent(in));
     }
 
-    /**
-     * 呼叫完成回调
-     *
-     */
-    @PostMapping("/callCompleted")
-    public Result callCompleted(InputCallNumber in) {
-        Result res =new Result();
-        if (in.getAgent()==null){
-            return res.error(new Error("坐席号不能为空"));
-        }
-        if (in.getTransAgent()==null){
-            return res.error(new Error("转移坐席号不能为空"));
-        }
-        return new Result<>().data(this.userOutboundService.callCompleted(in));
-    }
+
 }

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

@@ -2,6 +2,8 @@ package com.goafanti.customer.service;
 
 import com.goafanti.customer.bo.InputCallNumber;
 
+import java.util.Map;
+
 public interface UserOutboundService {
     Object checkUser(Integer type);
 
@@ -9,5 +11,5 @@ public interface UserOutboundService {
 
     Object blindTransferByAgent(InputCallNumber in);
 
-    Object callCompleted(InputCallNumber in);
+    Object callCompleted(Map<String, String[]> in);
 }

+ 12 - 3
src/main/java/com/goafanti/customer/service/impl/UserOutboundServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.goafanti.common.dao.UserArchivesMapper;
 import com.goafanti.common.utils.HttpUtils;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.core.websocket.SystemWebSocketHandler;
@@ -74,7 +75,9 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
         JSONObject jsonObject = JSON.parseObject(s);
         JSONObject result = jsonObject.getJSONObject("result");
         String msg = result.getString("msg");
-        if (msg!=null)return s;
+        if (StringUtils.isNotBlank(msg)){
+            return msg;
+        }
         return s;
     }
 
@@ -89,11 +92,17 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
         param.put("request",request);
         HttpUtils httpUtils=new HttpUtils();
         String s = httpUtils.sendHttpsRequest(url, "POST", param);
-        return 1;
+        JSONObject jsonObject = JSON.parseObject(s);
+        JSONObject result = jsonObject.getJSONObject("result");
+        String msg = result.getString("msg");
+        if (StringUtils.isNotBlank(msg)){
+            return msg;
+        }
+        return s;
     }
 
     @Override
-    public Object callCompleted(InputCallNumber in) {
+    public Object callCompleted(Map<String, String[]> in) {
         systemWebSocketHandler.sendMessageToUser(TokenManager.getAdminId(), new TextMessage("callCompleted"));
         return 1;
     }