|
@@ -120,7 +120,7 @@ public class MonitorInfoController {
|
|
|
if (imageType != null) {
|
|
|
monitorInfoEntity.setImageType(imageType);
|
|
|
}
|
|
|
- if(type!=null&&type.length>0) {
|
|
|
+ if (type != null && type.length > 0) {
|
|
|
monitorInfoEntity.setType(type[0]);
|
|
|
}
|
|
|
if (deviceId != null) {
|
|
@@ -151,25 +151,24 @@ public class MonitorInfoController {
|
|
|
DeviceAttributeSpecsEntity deviceAttributeSpecsEntity = new DeviceAttributeSpecsEntity();
|
|
|
deviceAttributeSpecsEntity.setAttributeId(item.getAttributeId());
|
|
|
List<DeviceAttributeSpecsEntity> deviceAttributeSpecsEntities = deviceAttributeSpecsService.findList(deviceAttributeSpecsEntity);
|
|
|
- if(map.containsKey(item.getAttributeId())) {
|
|
|
- Double value = map.get(item.getAttributeId()).getDataValue();
|
|
|
- if (deviceAttributeSpecsEntities.size() > 0) {
|
|
|
- if (value != null) {
|
|
|
- for (DeviceAttributeSpecsEntity specsEntity : deviceAttributeSpecsEntities)
|
|
|
- if (Integer.valueOf(specsEntity.getSpecsValue()) == value.intValue()) {
|
|
|
- item.setMonitorValue(specsEntity.getSpecsName());
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (value != null) {
|
|
|
- DeviceAttributeEntity deviceAttributeEntity = deviceAttributeService.getById(item.getAttributeId());
|
|
|
- String unit = "";
|
|
|
- if (deviceAttributeEntity != null && deviceAttributeEntity.getUnit() != null)
|
|
|
- unit = deviceAttributeEntity.getUnit();
|
|
|
- item.setMonitorValue(String.format("%.3f", map.get(item.getAttributeId()).getDataValue()) + unit);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (map.containsKey(item.getAttributeId())) {
|
|
|
+ Double value = map.get(item.getAttributeId()).getDataValue();
|
|
|
+ if (value != null) {
|
|
|
+ if (deviceAttributeSpecsEntities.size() > 0) {
|
|
|
+ for (DeviceAttributeSpecsEntity specsEntity : deviceAttributeSpecsEntities)
|
|
|
+ if (Integer.valueOf(specsEntity.getSpecsValue()) == value.intValue()) {
|
|
|
+ item.setMonitorValue(specsEntity.getSpecsName());
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ DeviceAttributeEntity deviceAttributeEntity = deviceAttributeService.getById(item.getAttributeId());
|
|
|
+ String unit = "";
|
|
|
+ if (deviceAttributeEntity != null && deviceAttributeEntity.getUnit() != null)
|
|
|
+ unit = deviceAttributeEntity.getUnit();
|
|
|
+ item.setMonitorValue(String.format("%.3f", map.get(item.getAttributeId()).getDataValue()) + unit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//判断是否报警
|
|
|
if (mapAlarm.containsKey(item.getAttributeId().intValue()))
|
|
|
item.setIsAlarm(1);
|