|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.zc.business.domain.DcDevice; |
|
|
|
import com.zc.business.domain.DcMeteorologicalDetectorData; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
|
import com.zc.business.mapper.DcMeteorologicalDetectorDataMapper; |
|
|
@ -8,8 +9,10 @@ import com.zc.business.service.IDcMeteorologicalDetectorDataService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 气象检测器数据Service业务层处理 |
|
|
@ -22,7 +25,8 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica |
|
|
|
{ |
|
|
|
@Autowired |
|
|
|
private DcMeteorologicalDetectorDataMapper dcMeteorologicalDetectorDataMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private DcDeviceServiceImpl dcDeviceServiceImpl; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询气象检测器数据 |
|
|
@ -113,7 +117,36 @@ public class DcMeteorologicalDetectorDataServiceImpl implements IDcMeteorologica |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<DcMeteorologicalDetectorData> selectlistAll(DcMeteorologicalDetectorData dcMeteorologicalDetectorData) { |
|
|
|
return dcMeteorologicalDetectorDataMapper.selectlistAll(dcMeteorologicalDetectorData); |
|
|
|
Map<String,Object> parameter =new HashMap<>(); |
|
|
|
|
|
|
|
parameter.put("deviceType","3"); |
|
|
|
List<DcDevice> dcDevices = dcDeviceServiceImpl.devicePileNumberQueryDevice(parameter); |
|
|
|
Map<String, DcDevice> deviceStateMap = dcDevices.stream() |
|
|
|
.filter(Objects::nonNull) // DcDevice 对象不为空
|
|
|
|
.collect(Collectors.toMap( |
|
|
|
DcDevice::getIotDeviceId, |
|
|
|
Function.identity(), |
|
|
|
(existing, replacement) -> existing) // 重复键,默认保留第一个值
|
|
|
|
); |
|
|
|
List<DcMeteorologicalDetectorData> dcMeteorologicalDetectorDataList = dcMeteorologicalDetectorDataMapper.selectlistAll(dcMeteorologicalDetectorData); |
|
|
|
// 遍历气象检测数据并设置对应的设备状态和桩号
|
|
|
|
for (DcMeteorologicalDetectorData data : dcMeteorologicalDetectorDataList) { |
|
|
|
String iotDeviceId = data.getIotDeviceId(); |
|
|
|
if (deviceStateMap.containsKey(iotDeviceId)) { |
|
|
|
DcDevice device = deviceStateMap.get(iotDeviceId); |
|
|
|
// 设置设备状态
|
|
|
|
data.setDeviceState(device.getDeviceState()); |
|
|
|
// 设置桩号
|
|
|
|
data.setStakeMark(device.getStakeMark()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 按照桩号排序
|
|
|
|
List<DcMeteorologicalDetectorData> sortedList = dcMeteorologicalDetectorDataList.stream() |
|
|
|
.sorted(Comparator.comparing(DcMeteorologicalDetectorData::getStakeMark)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
return sortedList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|