引虫灯信息接口
This commit is contained in:
parent
921982ba70
commit
7ee2b1bba8
@ -4,12 +4,8 @@ package com.fastbee.deviceData.api.renke.constant;
|
|||||||
* 建大仁科设备类型常量
|
* 建大仁科设备类型常量
|
||||||
*/
|
*/
|
||||||
public class RenKeDeviceTypeConstant {
|
public class RenKeDeviceTypeConstant {
|
||||||
public static final String MET = "met";//气象设备
|
public static final String InsectsLights = "met";//引虫灯设备
|
||||||
public static final String WORM = "wormFlagship";//虫情设备
|
public static final String WORM = "wormFlagship";//虫情设备
|
||||||
public static final String Irrigation = "irrigation";//灌溉
|
|
||||||
public static final String Worm = "worm";//蠕虫
|
|
||||||
public static final String Soil = "soil";//土
|
|
||||||
public static final String Spore = "spore";//孢子
|
|
||||||
public static final String Camera = "camera";//照相机
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,49 +29,21 @@ public class RenKeUserDeviceOverview {
|
|||||||
JSONObject respBody = JSONUtil.parseObj(resultObjectStr);
|
JSONObject respBody = JSONUtil.parseObj(resultObjectStr);
|
||||||
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
||||||
Map<String,Integer> map = new HashMap<>();
|
Map<String,Integer> map = new HashMap<>();
|
||||||
|
Integer InsectsLights = 0;
|
||||||
/* Map<String, Integer> deviceTypeCountMap = realtimeDataList.stream()
|
|
||||||
.map(jsonObject -> (JSONObject) jsonObject)
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
e -> (String) e.get("deviceType"),
|
|
||||||
Collectors.summingInt(e -> 1)
|
|
||||||
));
|
|
||||||
Integer WORM = deviceTypeCountMap.getOrDefault(RenKeDeviceTypeConstant.WORM, 0);*/
|
|
||||||
//map = realtimeDataList.stream().collect(Collectors.groupingBy(obj -> ((JSONObject) obj).getStr("deviceType")));
|
|
||||||
Integer MET = 0;
|
|
||||||
Integer WORM = 0;
|
Integer WORM = 0;
|
||||||
Integer Irrigation = 0;
|
|
||||||
Integer Worm = 0;
|
|
||||||
Integer Soil =0;
|
|
||||||
Integer Spore = 0;
|
|
||||||
Integer Camera = 0;
|
|
||||||
for (Object jsonObject : realtimeDataList) {
|
for (Object jsonObject : realtimeDataList) {
|
||||||
JSONObject josnConversion = (JSONObject) jsonObject;
|
JSONObject josnConversion = (JSONObject) jsonObject;
|
||||||
if (RenKeDeviceTypeConstant.WORM.equals(josnConversion.get("deviceType"))) {
|
if (RenKeDeviceTypeConstant.WORM.equals(josnConversion.get("deviceType"))) {
|
||||||
WORM=WORM+1;
|
WORM=WORM+1;
|
||||||
} else if (RenKeDeviceTypeConstant.MET.equals(josnConversion.get("deviceType"))) {
|
} else if (RenKeDeviceTypeConstant.InsectsLights.equals(josnConversion.get("deviceType"))) {
|
||||||
MET=MET+1;
|
InsectsLights=InsectsLights+1;
|
||||||
}else if (RenKeDeviceTypeConstant.Irrigation.equals(josnConversion.get("deviceType"))) {
|
|
||||||
Irrigation=Irrigation+1;
|
|
||||||
} else if (RenKeDeviceTypeConstant.Camera.equals(josnConversion.get("deviceType"))) {
|
|
||||||
Camera=Camera+1;
|
|
||||||
} else if (RenKeDeviceTypeConstant.Worm.equals(josnConversion.get("deviceType"))) {
|
|
||||||
Worm=Worm+1;
|
|
||||||
} else if (RenKeDeviceTypeConstant.Soil.equals(josnConversion.get("deviceType"))) {
|
|
||||||
Soil=Soil+1;
|
|
||||||
} else if (RenKeDeviceTypeConstant.Spore.equals(josnConversion.get("deviceType"))) {
|
|
||||||
Spore=Spore+1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// map.put("MET",MET);
|
map.put("InsectsLights",InsectsLights);
|
||||||
// map.put("Worm",Worm);
|
|
||||||
// map.put("Irrigation",Irrigation);
|
|
||||||
// map.put("Camera",Camera);
|
|
||||||
map.put("wormFlagship",WORM);
|
map.put("wormFlagship",WORM);
|
||||||
// map.put("Soil",Soil);
|
|
||||||
// map.put("Spore",Spore);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user