提交 c293d0c8 编写于 作者: Crimson's avatar Crimson

usr代码添加回调rest信息

上级 93af99eb
......@@ -114,7 +114,39 @@ public class IMService {
}
public IM hD(String im_id, IM im) {
return client.hD(im_id, im);
im = this.client.get(im_id);
if ("30".equals(im.getImwfstate())) {
// PS
PS ps = new PS();
ps.setPSId(im.getIMId());
ps = psService.get(ps.getPSId());
if (ps != null) {
ps.setImstate("30");
// psService.update(ps.getPSId(), ps);
}
if (im.getRest() != null) {
JSONArray callbackdata = JSONObject.parseArray(im.getRest());
if (callbackdata.size() > 0) {
for (int i =0; i < callbackdata.size(); i++) {
JSONObject jo = callbackdata.getJSONObject(i);
HttpMethod httpMethod = HttpMethod.valueOf(jo.getString("method"));
String url = jo.getString("url");
JSONObject params = null;
if (jo.getBoolean("containspk")) {
String replaceStr = url.substring(url.indexOf("{"), url.indexOf("}") + 1);
replaceStr = "\\" + replaceStr;
replaceStr = replaceStr.substring(0, replaceStr.length() - 1) + "\\}";
url = url.replaceAll(replaceStr, im.getIMId());
}
if (jo.getBoolean("containset")) {
params = (JSONObject) JSONObject.toJSON(ps);
}
doRestRequest(url, httpMethod, getHeader(), params);
}
}
}
}
return im;
}
public IM getDraft(String im_id, IM im) {
......@@ -234,39 +266,6 @@ public class IMService {
// 保存业务数据
this.update(im_id, im);
// FOR TEST ADD gotostep
if ("finish".equals(type) || "gotostep".equals(type)) {
// PS
PS ps = new PS();
ps.setPSId(im.getIMId());
ps = psService.get(ps.getPSId());
if (ps != null) {
ps.setImstate("30");
// psService.update(ps.getPSId(), ps);
}
if (data.getString("callbackdata") != null) {
JSONArray callbackdata = JSONObject.parseArray(data.getString("callbackdata"));
if (callbackdata.size() > 0) {
for (int i =0; i < callbackdata.size(); i++) {
JSONObject jo = callbackdata.getJSONObject(i);
HttpMethod httpMethod = HttpMethod.valueOf(jo.getString("method"));
String url = jo.getString("url");
JSONObject params = null;
if (jo.getBoolean("containspk")) {
String replaceStr = url.substring(url.indexOf("{"), url.indexOf("}") + 1);
replaceStr = "\\" + replaceStr;
replaceStr = replaceStr.substring(0, replaceStr.length() - 1) + "\\}";
url = url.replaceAll(replaceStr, im.getIMId());
}
if (jo.getBoolean("containset")) {
params = (JSONObject) JSONObject.toJSON(ps);
}
doRestRequest(url, httpMethod, getHeader(), params);
}
}
}
}
data.put("rst", "1");
return data;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册