同步代码
This commit is contained in:
parent
01fd0b4ca5
commit
9327c600f7
@ -8,6 +8,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 气象设备实时数据
|
||||||
|
*/
|
||||||
@RestController()
|
@RestController()
|
||||||
@RequestMapping("/meteorology")
|
@RequestMapping("/meteorology")
|
||||||
public class DeviceRealtimedataMeteorologyController {
|
public class DeviceRealtimedataMeteorologyController {
|
||||||
@ -23,4 +26,5 @@ public class DeviceRealtimedataMeteorologyController {
|
|||||||
public AjaxResult getLatestWeatherRealtimedata() {
|
public AjaxResult getLatestWeatherRealtimedata() {
|
||||||
return AjaxResult.success(deviceRealtimedataMeteorologyService.getLatestWeatherRealtimedata());
|
return AjaxResult.success(deviceRealtimedataMeteorologyService.getLatestWeatherRealtimedata());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,9 @@ public class DeviceRealtimedataMoistureController {
|
|||||||
return AjaxResult.success(deviceRealtimedataMoistureService.getLatestWeatherRealtimedata(deviceId));
|
return AjaxResult.success(deviceRealtimedataMoistureService.getLatestWeatherRealtimedata(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取墒情设备列表
|
||||||
|
*/
|
||||||
@GetMapping("/weather/pullDown")
|
@GetMapping("/weather/pullDown")
|
||||||
public AjaxResult getLatestWeatherPullDown() {
|
public AjaxResult getLatestWeatherPullDown() {
|
||||||
return AjaxResult.success(deviceInformationMoistureService.selectDeviceInformationMoistureList(null));
|
return AjaxResult.success(deviceInformationMoistureService.selectDeviceInformationMoistureList(null));
|
||||||
|
@ -17,7 +17,7 @@ public class DeviceRealtimedataWormsController extends BaseController {
|
|||||||
* 虫情实时数据
|
* 虫情实时数据
|
||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceRealtimedataWormsServiceImpl deviceRealtimedataWormsServiceImpl;
|
private DeviceRealtimedataWormsServiceImpl deviceRealtimedataWormsServiceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public class RenkeDeviceDataService {
|
|||||||
JSONObject respBody = JSONUtil.parseObj(respBodyStr);
|
JSONObject respBody = JSONUtil.parseObj(respBodyStr);
|
||||||
// System.err.println(respBodyStr);
|
// System.err.println(respBodyStr);
|
||||||
if(!respBody.get("code") .toString().equals("1000")){
|
if(!respBody.get("code") .toString().equals("1000")){
|
||||||
|
System.err.println(respBodyStr);
|
||||||
throw new ServiceException("获取设备实时数据失败!");
|
throw new ServiceException("获取设备实时数据失败!");
|
||||||
}
|
}
|
||||||
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
||||||
@ -89,7 +90,7 @@ public class RenkeDeviceDataService {
|
|||||||
//获取害虫种类以及数量
|
//获取害虫种类以及数量
|
||||||
JSONArray analyseData = JSONUtil.parseArray(entries.get("analyseData"));
|
JSONArray analyseData = JSONUtil.parseArray(entries.get("analyseData"));
|
||||||
//有害虫时保存
|
//有害虫时保存
|
||||||
if(!analyseData.isEmpty()){
|
// if(!analyseData.isEmpty()){
|
||||||
//获取拍照图片
|
//获取拍照图片
|
||||||
Object imagesUrl = entries .get("imagesUrl");
|
Object imagesUrl = entries .get("imagesUrl");
|
||||||
//获取虫情分析后的图片地址
|
//获取虫情分析后的图片地址
|
||||||
@ -97,7 +98,7 @@ public class RenkeDeviceDataService {
|
|||||||
|
|
||||||
deviceRealtimedataWorms.setPestPhotos(analyseCoordUrl.toString());
|
deviceRealtimedataWorms.setPestPhotos(analyseCoordUrl.toString());
|
||||||
deviceRealtimedataWorms.setCamera(imagesUrl.toString());
|
deviceRealtimedataWorms.setCamera(imagesUrl.toString());
|
||||||
}
|
// }
|
||||||
|
|
||||||
deviceRealtimedataWorms.setSaveTime(DateUtils.getNowDate());
|
deviceRealtimedataWorms.setSaveTime(DateUtils.getNowDate());
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@ -116,7 +117,7 @@ public class RenkeDeviceDataService {
|
|||||||
// RenkeDeviceDataService renkeDeviceDataService = new RenkeDeviceDataService();
|
// RenkeDeviceDataService renkeDeviceDataService = new RenkeDeviceDataService();
|
||||||
// renkeDeviceDataService.setData("1017240042");
|
// renkeDeviceDataService.setData("1017240042");
|
||||||
HttpResponse response1 = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataAndWormDataAIBy?deviceAddr="+"1017240042")
|
HttpResponse response1 = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataAndWormDataAIBy?deviceAddr="+"1017240042")
|
||||||
.header("token", "834991732092248683")
|
.header("token", "300591732787388355")
|
||||||
.execute();
|
.execute();
|
||||||
String respBodyStr1 = response1.body();
|
String respBodyStr1 = response1.body();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user