2023-05-22 16:20:46 优化完善温度传感器查询接口,补充空判断处理!

master
魔神煜修罗皇 2 years ago
parent 3d928674fd
commit bd8e3dd33c
  1. 38
      psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java

@ -122,28 +122,30 @@ public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataS
List<PsdcThermometerDataRes> dataResList = psdcThermometerRtdataMapper.selWenDu(SecurityUtils.getUserId(), 16);
for (PsdcThermometerDataRes dec : dataResList ){
PsdcThermometerDataRes dataRes = psdcThermometerRtdataMapper.queryById(dec.getDeviceId(), sdf.format(date));
List<PsdcThermometerHtdata> htdata = psdcThermometerHtdataMapper.selTodayThermometer(dec.getDeviceId(), tb, te);
if (null != dataRes){
List<PsdcThermometerHtdata> htdata = psdcThermometerHtdataMapper.selTodayThermometer(dec.getDeviceId(), tb, te);
List<Double> listTemp = new ArrayList(); // 今天历史温度集合
List<String> times = new ArrayList(); // 时间轴
List<Double> listTemp = new ArrayList(); // 今天历史温度集合
List<String> times = new ArrayList(); // 时间轴
// 循环遍历今天历史数据对象集合
for (PsdcThermometerHtdata h : htdata) {
if (null != h.getThermometerValue()) {
listTemp.add(h.getThermometerValue());
}
// 循环遍历今天历史数据对象集合
for (PsdcThermometerHtdata h : htdata) {
if (null != h.getThermometerValue()) {
listTemp.add(h.getThermometerValue());
}
String t = h.getUpdateTime().split(" ")[1].substring(0, 5);
times.add(t);
String t = h.getUpdateTime().split(" ")[1].substring(0, 5);
times.add(t);
}
Map<String, Object> map3 = new HashMap();
map3.put("deviceId", dataRes.getDeviceId());
map3.put("deviceName", dataRes.getDeviceName());
map3.put("deviceTemp", dec.getThermometerValue());
map3.put("temps", listTemp);
map3.put("times", times);
ary.add(map3);
}
Map<String, Object> map3 = new HashMap();
map3.put("deviceId", dataRes.getDeviceId());
map3.put("deviceName", dataRes.getDeviceName());
map3.put("deviceTemp", dec.getThermometerValue());
map3.put("temps", listTemp);
map3.put("times", times);
ary.add(map3);
}

Loading…
Cancel
Save