|
|
@@ -16,9 +16,17 @@ import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.topsail.service.config.mqtt.MqttOutConfig;
|
|
|
import com.usky.topsail.service.util.HttpClientUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpEntity;
|
|
|
+import org.springframework.http.HttpMethod;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -151,15 +159,9 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
|
|
|
//增加水表数据推送总队逻辑
|
|
|
- //QString("{\"SubType\":6,\"DeviceId\":\"%1\",\"InsertId\":%2,\"Confirmed\":false}").arg(addr).arg(insertid)
|
|
|
- HashMap<String, String> map1 = new HashMap<>();
|
|
|
- map1.put("SubType", "2");
|
|
|
- map1.put("DeviceId", device_code);
|
|
|
- map1.put("InsertId", String.valueOf(insertid1));
|
|
|
- map1.put("Confirmed", "false");
|
|
|
- String httpurl1 = "http://47.98.201.187:55335/report";
|
|
|
+ String data = "SubType=2&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
|
|
|
- String response = HttpClientUtil.doPost(httpurl1, map1, "utf-8");
|
|
|
+ String response = HttpClientUtil.doPost1("47.98.201.187", 55335, "/report", data, "utf-8");
|
|
|
System.out.println("http://47.98.201.187:55335/report response:"+response);
|
|
|
}else if (alarm.equals("262144")){
|
|
|
device_status = "WP2";
|
|
|
@@ -198,15 +200,9 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
|
|
|
//增加水表数据推送总队逻辑
|
|
|
- //QString("{\"SubType\":6,\"DeviceId\":\"%1\",\"InsertId\":%2,\"Confirmed\":false}").arg(addr).arg(insertid)
|
|
|
- HashMap<String, String> map1 = new HashMap<>();
|
|
|
- map1.put("SubType", "2");
|
|
|
- map1.put("DeviceId", device_code);
|
|
|
- map1.put("InsertId", String.valueOf(insertid1));
|
|
|
- map1.put("Confirmed", "false");
|
|
|
- String httpurl1 = "http://47.98.201.187:55335/report";
|
|
|
+ String data = "SubType=2&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
|
|
|
- String response = HttpClientUtil.doPost(httpurl1, map1, "utf-8");
|
|
|
+ String response = HttpClientUtil.doPost1("47.98.201.187", 55335, "/report", data, "utf-8");
|
|
|
System.out.println("http://47.98.201.187:55335/report response:"+response);
|
|
|
}
|
|
|
db.add(dbMap3);
|
|
|
@@ -261,15 +257,9 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
|
|
|
//增加水表数据推送总队逻辑
|
|
|
- //QString("{\"SubType\":6,\"DeviceId\":\"%1\",\"InsertId\":%2,\"Confirmed\":false}").arg(addr).arg(insertid)
|
|
|
- HashMap<String, String> map1 = new HashMap<>();
|
|
|
- map1.put("SubType", "5");
|
|
|
- map1.put("DeviceId", device_code);
|
|
|
- map1.put("InsertId", String.valueOf(insertid1));
|
|
|
- map1.put("Confirmed", "false");
|
|
|
- String httpurl1 = "http://47.98.201.187:55335/report";
|
|
|
+ String data = "SubType=5&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
|
|
|
- String response = HttpClientUtil.doPost(httpurl1, map1, "utf-8");
|
|
|
+ String response = HttpClientUtil.doPost1("47.98.201.187", 55335, "/report", data, "utf-8");
|
|
|
System.out.println("http://47.98.201.187:55335/report response:"+response);
|
|
|
}else if (alarm.equals("262144")){
|
|
|
payloadVO1.put("type","ALARM");
|
|
|
@@ -308,15 +298,9 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
|
|
|
//增加水表数据推送总队逻辑
|
|
|
- //QString("{\"SubType\":6,\"DeviceId\":\"%1\",\"InsertId\":%2,\"Confirmed\":false}").arg(addr).arg(insertid)
|
|
|
- HashMap<String, String> map1 = new HashMap<>();
|
|
|
- map1.put("SubType", "5");
|
|
|
- map1.put("DeviceId", device_code);
|
|
|
- map1.put("InsertId", String.valueOf(insertid1));
|
|
|
- map1.put("Confirmed", "false");
|
|
|
- String httpurl1 = "http://47.98.201.187:55335/report";
|
|
|
+ String data = "SubType=5&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
|
|
|
- String response = HttpClientUtil.doPost(httpurl1, map1, "utf-8");
|
|
|
+ String response = HttpClientUtil.doPost1("47.98.201.187", 55335, "/report", data, "utf-8");
|
|
|
System.out.println("http://47.98.201.187:55335/report response:"+response);
|
|
|
}
|
|
|
db.add(dbMap3);
|
|
|
@@ -342,4 +326,6 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
aaService.save(aa);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|