|
|
|
@ -40,6 +40,8 @@ public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataS |
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH"); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public AjaxResult selTodayThermometer() { |
|
|
|
|
|
|
|
|
@ -119,33 +121,31 @@ public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataS |
|
|
|
|
String tb = sdf.format(date) + " 00:00:00"; // 今天开始检索时间
|
|
|
|
|
String te = sdf.format(date) + " 23:59:59"; // 今天结束检索时间
|
|
|
|
|
List<Map> ary = new ArrayList<>(); |
|
|
|
|
List<PsdcThermometerDataRes> dataResList = psdcThermometerRtdataMapper.selWenDu(SecurityUtils.getUserId(), modelId, sdf.format(new Date())); |
|
|
|
|
List<PsdcThermometerDataRes> dataResList = psdcThermometerRtdataMapper.selWenDu(SecurityUtils.getUserId(), modelId, sdf3.format(date)); |
|
|
|
|
for (PsdcThermometerDataRes dec : dataResList ){ |
|
|
|
|
PsdcThermometerDataRes dataRes = psdcThermometerRtdataMapper.queryById(dec.getDeviceId(), sdf.format(date)); |
|
|
|
|
if (null != dataRes){ |
|
|
|
|
List<PsdcThermometerHtdata> htdata = psdcThermometerHtdataMapper.selTodayThermometer(dec.getDeviceId(), tb, te); |
|
|
|
|
Map<String, Object> map3 = new HashMap(); |
|
|
|
|
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()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String t = h.getUpdateTime().split(" ")[1].substring(0, 5); |
|
|
|
|
times.add(t); |
|
|
|
|
// 循环遍历今天历史数据对象集合
|
|
|
|
|
for (PsdcThermometerHtdata h : htdata) { |
|
|
|
|
if (null != h.getThermometerValue()) { |
|
|
|
|
listTemp.add(h.getThermometerValue()); |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
String t = h.getUpdateTime().split(" ")[1].substring(0, 5); |
|
|
|
|
times.add(t); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map3.put("deviceId", dec.getDeviceId()); |
|
|
|
|
map3.put("deviceName", dec.getDeviceName()); |
|
|
|
|
map3.put("deviceTemp", dec.getThermometerValue()); |
|
|
|
|
map3.put("temps", listTemp); |
|
|
|
|
map3.put("times", times); |
|
|
|
|
ary.add(map3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|