|
|
|
@ -91,6 +91,31 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
List<Map> ary = new ArrayList<>(); |
|
|
|
|
List<ModelVo> list = psdcModelMapper.selDevIsControlByModelName(deviceModel); |
|
|
|
|
for (ModelVo mv : list) { |
|
|
|
|
packDevInfos(data, deviceId, ary, mv); |
|
|
|
|
} |
|
|
|
|
pd.setControl_elements(ary); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return psdcDevices.stream().map(psdcDevice -> { |
|
|
|
|
DeviceStatusVo deviceStatusVo = new DeviceStatusVo(); |
|
|
|
|
BeanUtils.copyProperties(psdcDevice, deviceStatusVo); |
|
|
|
|
if (psdcDevice.getDeviceRunstatus() != null && psdcDevice.getDeviceRunstatus() == 1) { |
|
|
|
|
deviceStatusVo.setDeviceRunstatus(true); |
|
|
|
|
} else { |
|
|
|
|
deviceStatusVo.setDeviceRunstatus(false); |
|
|
|
|
} |
|
|
|
|
return deviceStatusVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 封装设备信息 |
|
|
|
|
* @param data 日期 |
|
|
|
|
* @param deviceId 设备Id |
|
|
|
|
* @param ary |
|
|
|
|
* @param mv 模型参数 |
|
|
|
|
*/ |
|
|
|
|
private void packDevInfos(Date data, Integer deviceId, List<Map> ary, ModelVo mv) { |
|
|
|
|
PsdcThermometerDataRes thermometerDataRes = thermometerRtdataMapper.selTempByDevId(deviceId, sdf.format(data)); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
Double tempValue = 0.0; |
|
|
|
@ -112,20 +137,6 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
map.put("tempValue", tempValue); |
|
|
|
|
ary.add(map); |
|
|
|
|
} |
|
|
|
|
pd.setControl_elements(ary); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return psdcDevices.stream().map(psdcDevice -> { |
|
|
|
|
DeviceStatusVo deviceStatusVo = new DeviceStatusVo(); |
|
|
|
|
BeanUtils.copyProperties(psdcDevice, deviceStatusVo); |
|
|
|
|
if (psdcDevice.getDeviceRunstatus() != null && psdcDevice.getDeviceRunstatus() == 1) { |
|
|
|
|
deviceStatusVo.setDeviceRunstatus(true); |
|
|
|
|
} else { |
|
|
|
|
deviceStatusVo.setDeviceRunstatus(false); |
|
|
|
|
} |
|
|
|
|
return deviceStatusVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DeviceStatusVo queryDeviceStatusById(Integer deviceId) { |
|
|
|
@ -406,26 +417,7 @@ public class PsdcDeviceServiceImpl implements IPsdcDeviceService { |
|
|
|
|
List<Map> ary = new ArrayList<>(); |
|
|
|
|
for (ModelVo mv : psdcModelMapper.selDevIsControlByModelName(deviceModel)) { |
|
|
|
|
Integer deviceId = pd.getDeviceId(); |
|
|
|
|
PsdcThermometerDataRes thermometerDataRes = thermometerRtdataMapper.selTempByDevId(deviceId, sdf.format(data)); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
Double tempValue = 0.0; |
|
|
|
|
map.put("controlElement", mv.getRelationField()); |
|
|
|
|
map.put("controlRemark", mv.getIoDesc()); |
|
|
|
|
if (null != thermometerDataRes) { |
|
|
|
|
switch (mv.getRelationField()) { |
|
|
|
|
case "intemp": |
|
|
|
|
tempValue = thermometerDataRes.getThermometerValueIn(); |
|
|
|
|
break; |
|
|
|
|
case "outtemp": |
|
|
|
|
tempValue = thermometerDataRes.getThermometerValueOut(); |
|
|
|
|
break; |
|
|
|
|
case "temp": |
|
|
|
|
tempValue = thermometerDataRes.getThermometerValue(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
map.put("tempValue", tempValue); |
|
|
|
|
ary.add(map); |
|
|
|
|
packDevInfos(data, deviceId, ary, mv); |
|
|
|
|
} |
|
|
|
|
if (pd.getDeviceRunstatus() != null && pd.getDeviceRunstatus() == 1) { |
|
|
|
|
deviceStatusVo.setDeviceRunstatus(true); |
|
|
|
|