老设备 接口替换
This commit is contained in:
parent
140417fcba
commit
7657965e6c
|
@ -38,6 +38,10 @@ public class EquTask {
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedRate = 600000)
|
@Scheduled(fixedRate = 600000)
|
||||||
public void equ(){
|
public void equ(){
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("=================================================");
|
||||||
String hash = "16EA8A305FB58BE0730DD67F04F022F4";
|
String hash = "16EA8A305FB58BE0730DD67F04F022F4";
|
||||||
|
|
||||||
HttpResult httpResult = OkHttps.sync("http://10.201.35.30:8090/user/login").addBodyPara("userName", "admin")
|
HttpResult httpResult = OkHttps.sync("http://10.201.35.30:8090/user/login").addBodyPara("userName", "admin")
|
||||||
|
@ -45,24 +49,23 @@ public class EquTask {
|
||||||
.bodyType("application/json")
|
.bodyType("application/json")
|
||||||
.post();
|
.post();
|
||||||
JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class);
|
JSONObject tokenByJson = httpResult.getBody().toBean(JSONObject.class);
|
||||||
|
System.out.println("---------------------------------"+tokenByJson);
|
||||||
JSONObject dataByJson = tokenByJson.getJSONObject("data");
|
JSONObject dataByJson = tokenByJson.getJSONObject("data");
|
||||||
String token = dataByJson.getString("token");
|
String token = dataByJson.getString("token");
|
||||||
ThDevice thDevice = new ThDevice();
|
ThDevice thDevice = new ThDevice();
|
||||||
// thDevice.setDeptId(5l);
|
// thDevice.setDeptId(5l);
|
||||||
List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
|
// List<ThDevice> equLists = thDeviceMapper.selectDeviceList(thDevice);
|
||||||
equLists.forEach(e->{
|
// equLists.forEach(e->{
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
map.put("sensorUId",e.getSn());
|
map.put("token",token);
|
||||||
map.put("label",e.getName());
|
HttpResult result = OkHttps.sync("http://10.205.51.190:30100/device/getGasDeviceList?token={token}")
|
||||||
HttpResult result = OkHttps.sync("http://10.201.35.30:8090/enviSensor/select?" +
|
|
||||||
"page=1&pageSize=10&valid=0&type=5&sensorUId={sensorUId}&label={label}")
|
|
||||||
.addPathPara(map)
|
.addPathPara(map)
|
||||||
.addHeader("token", token)
|
.addHeader("token", token)
|
||||||
.get();
|
.get();
|
||||||
JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
|
JSONObject vocByJson = result.getBody().toBean(JSONObject.class);
|
||||||
JSONObject vocDataByJson = vocByJson.getJSONObject("data");
|
System.out.println("---------------------------------"+vocByJson);
|
||||||
JSONArray vocByArray = vocDataByJson.getJSONArray("array");
|
JSONArray vocByArray = vocByJson.getJSONArray("data");
|
||||||
System.out.println(vocByArray.toString());
|
System.out.println(vocByArray.toString());
|
||||||
try {
|
try {
|
||||||
Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
|
Integer integer = outSideService.insertOldDeviceData(vocByArray.toJSONString());
|
||||||
|
@ -70,7 +73,10 @@ public class EquTask {
|
||||||
jsonProcessingException.printStackTrace();
|
jsonProcessingException.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
// });
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void dateByDay(){
|
public void dateByDay(){
|
||||||
outSideService.monthTask("");
|
outSideService.monthTask("");
|
||||||
|
|
Loading…
Reference in New Issue