feat (farm): 设备中心

- 修复因设备类型id导致的数据紊乱问题
This commit is contained in:
达富斌
2025-09-30 20:30:02 +08:00
parent fc0f0e3ea3
commit 0cacab47ea
3 changed files with 12 additions and 8 deletions

View File

@@ -20,8 +20,7 @@ public class EquipmentProducerManager {
private final Map<String, DeviceService> deviceServiceMap;
public EquipmentProducerManager(List<DeviceService> deviceServices) {
this.deviceServiceMap = deviceServices.stream()
.collect(Collectors.toMap(DeviceService::getDeviceType, Function.identity()));
this.deviceServiceMap = deviceServices.stream().collect(Collectors.toMap(DeviceService::getDeviceType, Function.identity()));
}
/**

View File

@@ -125,10 +125,12 @@ public class HistoryDataListPageReqVO {
* 构建请求VO对象
*/
private static HistoryDataListPageReqVO buildRequestVO(LocalDateTime startTime, LocalDateTime endTime) {
// long startTime = startLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
// long endTime = endLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
Long beginTimeStamp = startTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
Long endTimeStamp = endTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
// long startTime = startLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
// long endTime = endLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
Long beginTimeStamp = startTime.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
Long endTimeStamp = endTime.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
log.info("查询时间戳:{}-{}", beginTimeStamp, endTimeStamp);
return new HistoryDataListPageReqVO(beginTimeStamp, endTimeStamp);
}
}

View File

@@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.farm.manager.equipmentproducer.dto.UnifiedLoginRe
import cn.iocoder.yudao.module.farm.manager.equipmentproducer.dto.soil.history.HistoryDataListPageReqVO;
import cn.iocoder.yudao.module.farm.manager.equipmentproducer.dto.soil.login.UserLoginReqVO;
import cn.iocoder.yudao.module.farm.manager.equipmentproducer.dto.soil.realtime.RealTimeDataReqVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -154,8 +155,10 @@ public class DeviceInfoServiceImpl implements DeviceInfoService {
// 获取设备商数据
switch (typeCodeMap.getOrDefault(deviceType, "other")) {
case "soil" :
DeviceInfoDetailV2RespVO.SoilInfo soilInfo = getSoilInfo(deviceUniqueId,Integer.parseInt(dateType));
target.setSoilInfo(soilInfo);
if (!StringUtils.isEmpty(dateType)) {
DeviceInfoDetailV2RespVO.SoilInfo soilInfo = getSoilInfo(deviceUniqueId,Integer.parseInt(dateType));
target.setSoilInfo(soilInfo);
}
break;
case "water_fertilizer" :
DeviceInfoDetailV2RespVO.WfInfo wfInfo = getWfInfo(deviceUniqueId);