|
@@ -1,6 +1,8 @@
|
|
|
package com.huimv.eartag2.server;
|
|
|
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.huimv.eartag2.common.mq.Const;
|
|
|
import com.huimv.eartag2.common.utils.DateUtil;
|
|
|
import com.huimv.eartag2.service.IDataService;
|
|
@@ -121,10 +123,22 @@ public class EartagServerHandler2 extends ChannelInboundHandlerAdapter {
|
|
|
int countPlus = regexUtil.countPlus(clientAskText);
|
|
|
if (countPlus < 4) {
|
|
|
System.out.println("当前数据为不完整数据,故丢弃.>>" + clientAskText);
|
|
|
+ HashMap<String, String> paramsMap = new HashMap<>();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("result", clientAskText);
|
|
|
+ paramsMap.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+ String post = HttpRequest.post("http://115.238.57.190:8010/test01/test3")
|
|
|
+ .headerMap(paramsMap, false).body(jsonObject.toJSONString()).timeout(30 * 1000).execute().body();
|
|
|
} else {
|
|
|
//--处理客户端请求数据
|
|
|
//{拆分粘包数据}
|
|
|
JSONArray askJa = getPerData(clientAskText);
|
|
|
+ HashMap<String, String> paramsMap = new HashMap<>();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("result", askJa);
|
|
|
+ paramsMap.put("Content-Type", "application/json;charset=utf-8");
|
|
|
+ String post = HttpRequest.post("http://115.238.57.190:8010/test01/test3")
|
|
|
+ .headerMap(paramsMap, false).body(jsonObject.toJSONString()).timeout(30 * 1000).execute().body();
|
|
|
for (int a = 0; a < askJa.size(); a++) {
|
|
|
String askText = askJa.getString(a);
|
|
|
//{处理请求内容2}
|