|
|
@@ -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;
|
|
|
@@ -118,10 +126,84 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
device_status = "WP1";
|
|
|
dbMap3.put("value","1");
|
|
|
payloadVO1.put("type","ALARM");
|
|
|
+ SpSj2017 spSj2017 = new SpSj2017();
|
|
|
+ spSj2017.setPort("TSM-10P");
|
|
|
+ spSj2017.setDeviceCode(device_code);
|
|
|
+ spSj2017.setStatus("17");
|
|
|
+ spSj2017.setAddress("127.0.0.1");
|
|
|
+ spSj2017.setNcmd("");
|
|
|
+ spSj2017.setTime(LocalDateTime.now());
|
|
|
+ spSj2017.setData1(device_status);
|
|
|
+ spSj2017.setData2(bat_level.toString());
|
|
|
+ spSj2017.setData3(CSQ.toString());
|
|
|
+ spSj2017.setData4(device_value);
|
|
|
+ spSj2017.setData5("11111111111");
|
|
|
+ spSj2017.setCllxr("");
|
|
|
+ spSj2017.setClsj(LocalDateTime.now());
|
|
|
+ spSj2017.setClr("");
|
|
|
+ spSj2017.setClnr("");
|
|
|
+ spSj2017.setClwb("");
|
|
|
+ spSj2017.setCldh("");
|
|
|
+ spSj2017.setClzt(0);
|
|
|
+ spSj2017.setCllx("");
|
|
|
+ spSj2017.setVideo("");
|
|
|
+ this.save(spSj2017);
|
|
|
+ Long insertid1 = spSj2017.getId();
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ map.put("IMEI", device_code);
|
|
|
+ map.put("insert_id", String.valueOf(insertid1));
|
|
|
+ map.put("phone", "17630065224");
|
|
|
+ map.put("time", samp_time);
|
|
|
+ map.put("evt", device_status);
|
|
|
+ String httpurl = "https://iot.usky.cn/jdxf/wxapp2.php/Home/Waterwarn/message_water";
|
|
|
+ String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
+
|
|
|
+ //增加水表数据推送总队逻辑
|
|
|
+ String data = "SubType=2&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
+
|
|
|
+ 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";
|
|
|
dbMap3.put("value","2");
|
|
|
payloadVO1.put("type","ALARM");
|
|
|
+ SpSj2017 spSj2017 = new SpSj2017();
|
|
|
+ spSj2017.setPort("TSM-10P");
|
|
|
+ spSj2017.setDeviceCode(device_code);
|
|
|
+ spSj2017.setStatus("17");
|
|
|
+ spSj2017.setAddress("127.0.0.1");
|
|
|
+ spSj2017.setNcmd("");
|
|
|
+ spSj2017.setTime(LocalDateTime.now());
|
|
|
+ spSj2017.setData1(device_status);
|
|
|
+ spSj2017.setData2(bat_level.toString());
|
|
|
+ spSj2017.setData3(CSQ.toString());
|
|
|
+ spSj2017.setData4(device_value);
|
|
|
+ spSj2017.setData5("11111111111");
|
|
|
+ spSj2017.setCllxr("");
|
|
|
+ spSj2017.setClsj(LocalDateTime.now());
|
|
|
+ spSj2017.setClr("");
|
|
|
+ spSj2017.setClnr("");
|
|
|
+ spSj2017.setClwb("");
|
|
|
+ spSj2017.setCldh("");
|
|
|
+ spSj2017.setClzt(0);
|
|
|
+ spSj2017.setCllx("");
|
|
|
+ spSj2017.setVideo("");
|
|
|
+ this.save(spSj2017);
|
|
|
+ Long insertid1 = spSj2017.getId();
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ map.put("IMEI", device_code);
|
|
|
+ map.put("insert_id", String.valueOf(insertid1));
|
|
|
+ map.put("phone", "17630065224");
|
|
|
+ map.put("time", samp_time);
|
|
|
+ map.put("evt", device_status);
|
|
|
+ String httpurl = "https://iot.usky.cn/jdxf/wxapp2.php/Home/Waterwarn/message_water";
|
|
|
+ String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
+
|
|
|
+ //增加水表数据推送总队逻辑
|
|
|
+ String data = "SubType=2&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
+
|
|
|
+ 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);
|
|
|
}else if (dev_type.equals(2)){
|
|
|
@@ -173,6 +255,12 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
map.put("evt", device_status);
|
|
|
String httpurl = "https://iot.usky.cn/jdxf/wxapp2.php/Home/Waterwarn/message_water";
|
|
|
String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
+
|
|
|
+ //增加水表数据推送总队逻辑
|
|
|
+ String data = "SubType=5&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
+
|
|
|
+ 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");
|
|
|
dbMap3.put("value","2");
|
|
|
@@ -208,6 +296,12 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
map.put("evt", device_status);
|
|
|
String httpurl = "https://iot.usky.cn/jdxf/wxapp2.php/Home/Waterwarn/message_water";
|
|
|
String httpOrgCreateTestRtn = HttpClientUtil.doPost(httpurl, map, "utf-8");
|
|
|
+
|
|
|
+ //增加水表数据推送总队逻辑
|
|
|
+ String data = "SubType=5&DeviceId="+device_code+"&InsertId="+String.valueOf(insertid1)+"&Confirmed="+"false";
|
|
|
+
|
|
|
+ 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);
|
|
|
}
|
|
|
@@ -232,4 +326,6 @@ public class SpSj2017ServiceImpl extends AbstractCrudService<SpSj2017Mapper, SpS
|
|
|
aaService.save(aa);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|