|
@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
|
|
|
public class ImUtill {
|
|
|
|
|
|
@Autowired
|
|
|
private HttpClientUtil HttpClientUtil;
|
|
|
private SpHttpClientUtil SpHttpClientUtil;
|
|
|
|
|
|
@Value("${im.im_list_get}")
|
|
|
private String im_host;
|
|
@ -75,7 +75,7 @@ public class ImUtill {
|
|
|
params.put("sender_name", receiverId);
|
|
|
params.put("content_type", contentType);
|
|
|
params.put("content", content);
|
|
|
String response = HttpClientUtil.postBody(imAddr, params);
|
|
|
String response = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -101,7 +101,7 @@ public class ImUtill {
|
|
|
if (reply != null) {
|
|
|
imAddr += ("&reply=" + reply);
|
|
|
}
|
|
|
String response = HttpClientUtil.get(imAddr, "UTF-8");
|
|
|
String response = SpHttpClientUtil.get(imAddr, "UTF-8");
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -110,7 +110,7 @@ public class ImUtill {
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("topic_id", topicId);
|
|
|
params.put("data", jsonValue);
|
|
|
HttpClientUtil.putBody(imAddr, params);
|
|
|
SpHttpClientUtil.putBody(imAddr, params);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -138,7 +138,7 @@ public class ImUtill {
|
|
|
if (reply != null) {
|
|
|
imAddr += ("&reply=" + reply);
|
|
|
}
|
|
|
String response = HttpClientUtil.get(imAddr, "UTF-8");
|
|
|
String response = SpHttpClientUtil.get(imAddr, "UTF-8");
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -163,7 +163,7 @@ public class ImUtill {
|
|
|
if (reply != null) {
|
|
|
imAddr += ("&reply=" + reply);
|
|
|
}
|
|
|
String response = HttpClientUtil.get(imAddr, "UTF-8");
|
|
|
String response = SpHttpClientUtil.get(imAddr, "UTF-8");
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -198,7 +198,7 @@ public class ImUtill {
|
|
|
if (endTime != null) {
|
|
|
imAddr += ("&endTime=" + endTime);
|
|
|
}
|
|
|
String response = HttpClientUtil.get(imAddr, "UTF-8");
|
|
|
String response = SpHttpClientUtil.get(imAddr, "UTF-8");
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -231,7 +231,7 @@ public class ImUtill {
|
|
|
if (endTime != null) {
|
|
|
imAddr += ("&endTime=" + endTime);
|
|
|
}
|
|
|
String response = HttpClientUtil.get(imAddr, "UTF-8");
|
|
|
String response = SpHttpClientUtil.get(imAddr, "UTF-8");
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -251,7 +251,7 @@ public class ImUtill {
|
|
|
params.put("content", content);
|
|
|
params.put("session_id", sessionId);
|
|
|
params.put("business_type", businessType);
|
|
|
String response = HttpClientUtil.postBody(imAddr, params);
|
|
|
String response = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -264,7 +264,7 @@ public class ImUtill {
|
|
|
public String updateSessionStatus(String sessionId, String status) {
|
|
|
String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
|
|
|
JSONObject params = new JSONObject();
|
|
|
String response = HttpClientUtil.postBody(imAddr, params);
|
|
|
String response = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -277,7 +277,7 @@ public class ImUtill {
|
|
|
public String updateTopicEvaluate(String sessionId, String status) {
|
|
|
String imAddr = im_host + "api/v2/sessions/" + sessionId + "/status?status=" + status + "&sessionId=" + sessionId;
|
|
|
JSONObject params = new JSONObject();
|
|
|
String response = HttpClientUtil.postBody(imAddr, params);
|
|
|
String response = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -298,7 +298,7 @@ public class ImUtill {
|
|
|
params.put("content", content);
|
|
|
params.put("topic_id", topicId);
|
|
|
params.put("agent", agent);
|
|
|
String response = HttpClientUtil.postBody(url, params);
|
|
|
String response = SpHttpClientUtil.postBody(url, params);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -318,7 +318,7 @@ public class ImUtill {
|
|
|
params.put("into_user", intoUser);
|
|
|
params.put("into_user_name", intoUserName);
|
|
|
params.put("content", content);
|
|
|
String response = HttpClientUtil.postBody(url, params);
|
|
|
String response = SpHttpClientUtil.postBody(url, params);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
@ -337,7 +337,7 @@ public class ImUtill {
|
|
|
params.put("end_user", endUser);
|
|
|
params.put("end_user_name", endUserName);
|
|
|
params.put("topic_id", topicId);
|
|
|
String ret = HttpClientUtil.postBody(imAddr, params);
|
|
|
String ret = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
JSONObject obj = null;
|
|
|
try {
|
|
|
obj = new JSONObject(ret);
|
|
@ -358,7 +358,7 @@ public class ImUtill {
|
|
|
String imAddr = im_host + "api/v2/sessions/" + sessionId + "/participants/" + user;
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("user", user + ":" + 0);
|
|
|
HttpClientUtil.putBody(imAddr, params);
|
|
|
SpHttpClientUtil.putBody(imAddr, params);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -377,7 +377,7 @@ public class ImUtill {
|
|
|
params.put("messages", messages.toString());
|
|
|
params.put("session_id", sessionId);
|
|
|
params.put("session_type", sessionType);
|
|
|
String ret = HttpClientUtil.postBody(imAddr, params);
|
|
|
String ret = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
JSONObject obj = null;
|
|
|
try {
|
|
|
obj = new JSONObject(ret);
|
|
@ -394,7 +394,7 @@ public class ImUtill {
|
|
|
Boolean re = false;
|
|
|
String url = im_host + "api/v2/sessions/isExist?session_id="+sessionId;
|
|
|
JSONObject params = new JSONObject();
|
|
|
String ret = HttpClientUtil.get(url, "UTF-8");
|
|
|
String ret = SpHttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject obj = null;
|
|
|
try {
|
|
|
obj = new JSONObject(ret);
|
|
@ -417,7 +417,7 @@ public class ImUtill {
|
|
|
params.put("session_name", sessionName);
|
|
|
params.put("session_type", sessionType);
|
|
|
params.put("session_id", sessionId);
|
|
|
String ret = HttpClientUtil.postBody(imAddr, params);
|
|
|
String ret = SpHttpClientUtil.postBody(imAddr, params);
|
|
|
JSONObject obj = null;
|
|
|
try {
|
|
|
obj = new JSONObject(ret);
|
|
@ -454,7 +454,7 @@ public class ImUtill {
|
|
|
+ "api/v2/sessions/topic/" + topicId + "/messages?topic_id=" + topicId + "&end=" + startMsgId
|
|
|
+ "&start=" + (endMsgId == null ? "" : endMsgId) + "&page=" + page + "&pagesize=" + pagesize + "&user=" + uid;
|
|
|
try {
|
|
|
String ret = HttpClientUtil.get(url, "UTF-8");
|
|
|
String ret = SpHttpClientUtil.get(url, "UTF-8");
|
|
|
JSONObject obj = new JSONObject(ret);
|
|
|
if (obj.getInt("status") == -1) {
|
|
|
throw new RuntimeException(obj.getString("message"));
|
|
@ -470,7 +470,7 @@ public class ImUtill {
|
|
|
public JSONArray getSessionMessage(String sessionId, String startMsgId, String endMsgId, int page, int pagesize, String uid) {
|
|
|
String url = im_host + "api/v2/sessions/" + sessionId + "/messages?session_id=" + sessionId + "&user=" + uid + "&start_message_id=" + startMsgId + "&end_message_id=" + endMsgId + "&page=" + page + "&pagesize=" + pagesize;
|
|
|
try {
|
|
|
String ret = HttpClientUtil.get(url, "UTF-8");
|
|
|
String ret = SpHttpClientUtil.get(url, "UTF-8");
|
|
|
JSONArray obj = new JSONArray(ret);
|
|
|
return obj;
|
|
|
} catch (Exception e) {
|
|
@ -494,7 +494,7 @@ public class ImUtill {
|
|
|
params.put("user_id", userId);
|
|
|
params.put("old_user_id", oldUserId);
|
|
|
params.put("session_id", sessionId);
|
|
|
String ret = HttpClientUtil.postBody(url, params);
|
|
|
String ret = SpHttpClientUtil.postBody(url, params);
|
|
|
JSONObject obj = new JSONObject(ret);
|
|
|
if (obj.getInt("status") == -1) {
|
|
|
throw new RuntimeException("人员更换失败!");
|
|
@ -516,7 +516,7 @@ public class ImUtill {
|
|
|
public JSONObject getTopic(String topicId) throws Exception {
|
|
|
String url = im_host + "api/v2/sessions/topics/" + topicId + "?topic_id=" + topicId;
|
|
|
try {
|
|
|
String ret = HttpClientUtil.get(url, "utf-8");
|
|
|
String ret = SpHttpClientUtil.get(url, "utf-8");
|
|
|
JSONObject obj = new JSONObject(ret);
|
|
|
if (obj.getInt("status") == -1) {
|
|
|
throw new RuntimeException("获取议题失败!");
|
|
@ -538,7 +538,7 @@ public class ImUtill {
|
|
|
public JSONArray getParticipants(String sessionId) {
|
|
|
String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
|
|
|
try {
|
|
|
String ret = HttpClientUtil.get(url, "utf-8");
|
|
|
String ret = SpHttpClientUtil.get(url, "utf-8");
|
|
|
return new JSONArray(ret);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("获取议题失败!");
|
|
@ -555,7 +555,7 @@ public class ImUtill {
|
|
|
public JSONArray getSessions(String sessionId) {
|
|
|
String url = im_host + "api/v2/sessions/" + sessionId + "/participants?session_id=" + sessionId;
|
|
|
try {
|
|
|
String ret = HttpClientUtil.get(url, "utf-8");
|
|
|
String ret = SpHttpClientUtil.get(url, "utf-8");
|
|
|
return new JSONArray(ret);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("获取议题失败!");
|