|
|
@@ -3,6 +3,8 @@ package com.goafanti.customer.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.goafanti.common.dao.UserArchivesMapper;
|
|
|
+import com.goafanti.common.dao.UserMapper;
|
|
|
+import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.utils.HttpUtils;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
@@ -28,6 +30,8 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
|
|
|
|
|
|
@Resource
|
|
|
private SystemWebSocketHandler systemWebSocketHandler;
|
|
|
+ @Resource
|
|
|
+ private UserMapper userMapper;
|
|
|
|
|
|
@Override
|
|
|
public Object checkUser(Integer type) {
|
|
|
@@ -59,6 +63,14 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
|
|
|
|
|
|
@Override
|
|
|
public Object callNumber(InputCallNumber in) {
|
|
|
+ String msg =null;
|
|
|
+ if (StringUtils.isNotBlank(in.getUid())){
|
|
|
+ User u =userMapper.queryById(in.getUid());
|
|
|
+ if (u.getCallStatus()==1){
|
|
|
+ msg = "该用户正在通话中";
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
String url= default_url +"/openapi/"+version+"/callNumber";
|
|
|
Map<String,Object> param=new HashMap<>();
|
|
|
param.put("authentication",getAuthentication());
|
|
|
@@ -74,10 +86,16 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
|
|
|
// {"result":{"error":"0xF1000022","msg":"分机号未注册"},"data":{"seq":"20241101","response":{"seq":null,"userData":null,"result":{"error":4043309090},"data":null}}}
|
|
|
JSONObject jsonObject = JSON.parseObject(s);
|
|
|
JSONObject result = jsonObject.getJSONObject("result");
|
|
|
- String msg = result.getString("msg");
|
|
|
+ msg = result.getString("msg");
|
|
|
if (StringUtils.isNotBlank(msg)){
|
|
|
return msg;
|
|
|
}
|
|
|
+ if (StringUtils.isNotBlank(in.getUid())){
|
|
|
+ User u =new User();
|
|
|
+ u.setId(in.getUid());
|
|
|
+ u.setCallStatus(1);
|
|
|
+ userMapper.update(u);
|
|
|
+ }
|
|
|
return s;
|
|
|
}
|
|
|
|
|
|
@@ -103,6 +121,7 @@ public class UserOutboundServiceImpl extends BaseMybatisDao<UserArchivesMapper>
|
|
|
|
|
|
@Override
|
|
|
public Object callCompleted(Map<String, String[]> in) {
|
|
|
+ //需要关闭客户呼叫中
|
|
|
systemWebSocketHandler.sendMessageToUser(TokenManager.getAdminId(), new TextMessage("callCompleted"));
|
|
|
return 1;
|
|
|
}
|