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