|
@@ -40,8 +40,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
private SensorInfoMapper sensorInfoMapper;
|
|
private SensorInfoMapper sensorInfoMapper;
|
|
|
|
|
|
|
|
// 传感器类型(一一对应)
|
|
// 传感器类型(一一对应)
|
|
|
- static final String[] codeArray = {"7301","7302","7304","7303","7305","7306","7307","7308","7309","7310","5301","5401"};
|
|
|
|
|
- static final String[] typeNameArray = {"灰斗温度","压力","入口温度","出口温度","压差","风速","灰斗清扫时间","液位","流量","氢气浓度","火花信号","锁气卸灰阀开关状态"};
|
|
|
|
|
|
|
+ static final String[] codeArray = {"7301", "7302", "7304", "7303", "7305", "7306", "7307", "7308", "7309", "7310", "5301", "5401"};
|
|
|
|
|
+ static final String[] typeNameArray = {"灰斗温度", "压力", "入口温度", "出口温度", "压差", "风速", "灰斗清扫时间", "液位", "流量", "氢气浓度", "火花信号", "锁气卸灰阀开关状态"};
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -95,45 +95,46 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询 2. 监测企业点位信息
|
|
* 查询 2. 监测企业点位信息
|
|
|
|
|
+ *
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Map getMonitorMap() {
|
|
public Map getMonitorMap() {
|
|
|
- Map<String,String> resultMap = new HashMap<>();
|
|
|
|
|
|
|
+ Map<String, String> resultMap = new HashMap<>();
|
|
|
List<DeviceInfo> deviceInfos = deviceInfoMapper.findAll();
|
|
List<DeviceInfo> deviceInfos = deviceInfoMapper.findAll();
|
|
|
String deviceCodes = "";
|
|
String deviceCodes = "";
|
|
|
String deviceIds = "";
|
|
String deviceIds = "";
|
|
|
// 10.31修改 返回企业ID
|
|
// 10.31修改 返回企业ID
|
|
|
String companyIds = "";
|
|
String companyIds = "";
|
|
|
- if(!CollectionUtils.isEmpty(deviceInfos)) {
|
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(deviceInfos)) {
|
|
|
List<String> deviceCodeList = deviceInfos.stream().map(v -> v.getLongitude() + "," + v.getLatitude()).collect(Collectors.toList());
|
|
List<String> deviceCodeList = deviceInfos.stream().map(v -> v.getLongitude() + "," + v.getLatitude()).collect(Collectors.toList());
|
|
|
deviceCodes = String.join(";", deviceCodeList);
|
|
deviceCodes = String.join(";", deviceCodeList);
|
|
|
List<String> deviceIdList = deviceInfos.stream().map(v -> v.getDeviceId()).collect(Collectors.toList());
|
|
List<String> deviceIdList = deviceInfos.stream().map(v -> v.getDeviceId()).collect(Collectors.toList());
|
|
|
- deviceIds = String.join(",",deviceIdList);
|
|
|
|
|
|
|
+ deviceIds = String.join(",", deviceIdList);
|
|
|
//10.31 修改
|
|
//10.31 修改
|
|
|
List<String> companyIdList = deviceInfos.stream().map(v -> v.getCompanyId()).collect(Collectors.toList());
|
|
List<String> companyIdList = deviceInfos.stream().map(v -> v.getCompanyId()).collect(Collectors.toList());
|
|
|
- companyIds = String.join(",",companyIdList);
|
|
|
|
|
|
|
+ companyIds = String.join(",", companyIdList);
|
|
|
}
|
|
}
|
|
|
- resultMap.put("deviceCodes",deviceCodes);
|
|
|
|
|
- resultMap.put("deviceIds",deviceIds);
|
|
|
|
|
- resultMap.put("companyIds",companyIds);
|
|
|
|
|
|
|
+ resultMap.put("deviceCodes", deviceCodes);
|
|
|
|
|
+ resultMap.put("deviceIds", deviceIds);
|
|
|
|
|
+ resultMap.put("companyIds", companyIds);
|
|
|
return resultMap;
|
|
return resultMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 3.监测图层点击详情
|
|
|
|
|
|
|
+ * 3.监测图层点击详情
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<DeviceEventRespone> getMonitorLayerClickMap(String companyId, String alarmId, String deviceId) {
|
|
public List<DeviceEventRespone> getMonitorLayerClickMap(String companyId, String alarmId, String deviceId) {
|
|
|
List<DeviceEventRespone> respone = new ArrayList<>();
|
|
List<DeviceEventRespone> respone = new ArrayList<>();
|
|
|
List<DeviceEventVO> deviceEventVOS = deviceInfoMapper.getMonitorLayerClickMap(companyId, alarmId, deviceId);
|
|
List<DeviceEventVO> deviceEventVOS = deviceInfoMapper.getMonitorLayerClickMap(companyId, alarmId, deviceId);
|
|
|
System.out.println(deviceEventVOS);
|
|
System.out.println(deviceEventVOS);
|
|
|
- if(CollectionUtils.isEmpty(deviceEventVOS)) {
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(deviceEventVOS)) {
|
|
|
return respone;
|
|
return respone;
|
|
|
}
|
|
}
|
|
|
// 1、根据设备分组
|
|
// 1、根据设备分组
|
|
|
- Map<String,List<DeviceEventVO>> deviceMapList = deviceEventVOS.stream().collect(Collectors.groupingBy(DeviceEventVO::getDeviceId));
|
|
|
|
|
- deviceMapList.forEach((k,v) -> {
|
|
|
|
|
|
|
+ Map<String, List<DeviceEventVO>> deviceMapList = deviceEventVOS.stream().collect(Collectors.groupingBy(DeviceEventVO::getDeviceId));
|
|
|
|
|
+ deviceMapList.forEach((k, v) -> {
|
|
|
DeviceEventRespone deviceEventRespone = new DeviceEventRespone();
|
|
DeviceEventRespone deviceEventRespone = new DeviceEventRespone();
|
|
|
List<DeviceEventVO> monitorValue = new ArrayList<>();
|
|
List<DeviceEventVO> monitorValue = new ArrayList<>();
|
|
|
respone.add(deviceEventRespone);
|
|
respone.add(deviceEventRespone);
|
|
@@ -144,14 +145,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
deviceEventRespone.setVideoId("");
|
|
deviceEventRespone.setVideoId("");
|
|
|
// 2、根据传感器分组
|
|
// 2、根据传感器分组
|
|
|
deviceEventRespone.setMonitorValue(monitorValue);
|
|
deviceEventRespone.setMonitorValue(monitorValue);
|
|
|
- Map<String,List<DeviceEventVO>> sensorMap = v.stream().collect(Collectors.groupingBy(DeviceEventVO::getSensorId));
|
|
|
|
|
|
|
+ Map<String, List<DeviceEventVO>> sensorMap = v.stream().collect(Collectors.groupingBy(DeviceEventVO::getSensorId));
|
|
|
// m ->sensorId n -> 分组之后的对象
|
|
// m ->sensorId n -> 分组之后的对象
|
|
|
- sensorMap.forEach((m,n) ->{
|
|
|
|
|
|
|
+ sensorMap.forEach((m, n) -> {
|
|
|
DeviceEventVO deviceEventVO = n.get(0);
|
|
DeviceEventVO deviceEventVO = n.get(0);
|
|
|
Integer index = Arrays.asList(codeArray).indexOf(m);
|
|
Integer index = Arrays.asList(codeArray).indexOf(m);
|
|
|
deviceEventVO.setType(getType(index)); //得到type
|
|
deviceEventVO.setType(getType(index)); //得到type
|
|
|
monitorValue.add(deviceEventVO);
|
|
monitorValue.add(deviceEventVO);
|
|
|
- List<VideoEnentVO> videoEnentVOList = n.stream().map(vo -> {
|
|
|
|
|
|
|
+ List<VideoEnentVO> videoEnentVOList = n.stream().filter(vo -> Objects.nonNull(vo.getVideoCode())).map(vo -> {
|
|
|
VideoEnentVO videoEnentVO = new VideoEnentVO();
|
|
VideoEnentVO videoEnentVO = new VideoEnentVO();
|
|
|
videoEnentVO.setCode(vo.getVideoCode());
|
|
videoEnentVO.setCode(vo.getVideoCode());
|
|
|
videoEnentVO.setName(vo.getVideoName());
|
|
videoEnentVO.setName(vo.getVideoName());
|
|
@@ -167,30 +168,31 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取类型code
|
|
* 获取类型code
|
|
|
|
|
+ *
|
|
|
* @param codeIndex
|
|
* @param codeIndex
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
private String getType(Integer codeIndex) {
|
|
private String getType(Integer codeIndex) {
|
|
|
- if(codeIndex == null || codeIndex == -1) {
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ if (codeIndex == null || codeIndex == -1) {
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
String typeName = typeNameArray[codeIndex];
|
|
String typeName = typeNameArray[codeIndex];
|
|
|
- if(typeName.contains("温度")) {
|
|
|
|
|
|
|
+ if (typeName.contains("温度")) {
|
|
|
return "1";
|
|
return "1";
|
|
|
}
|
|
}
|
|
|
- if(typeName.contains("压力")) {
|
|
|
|
|
|
|
+ if (typeName.contains("压力")) {
|
|
|
return "2";
|
|
return "2";
|
|
|
}
|
|
}
|
|
|
- if(typeName.contains("风速")) {
|
|
|
|
|
|
|
+ if (typeName.contains("风速")) {
|
|
|
return "3";
|
|
return "3";
|
|
|
}
|
|
}
|
|
|
- if(typeName.contains("液位")) {
|
|
|
|
|
|
|
+ if (typeName.contains("液位")) {
|
|
|
return "4";
|
|
return "4";
|
|
|
}
|
|
}
|
|
|
- if(typeName.contains("流量")) {
|
|
|
|
|
|
|
+ if (typeName.contains("流量")) {
|
|
|
return "5";
|
|
return "5";
|
|
|
}
|
|
}
|
|
|
- if(typeName.contains("开关")) {
|
|
|
|
|
|
|
+ if (typeName.contains("开关")) {
|
|
|
return "6";
|
|
return "6";
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|