|
@@ -48,6 +48,8 @@ public class MonitorInfoController {
|
|
|
private DeviceService deviceService;
|
|
|
@Autowired
|
|
|
private AlarmDetailsService alarmDetailsService;
|
|
|
+ @Autowired
|
|
|
+ private DeviceAttributeSpecsService deviceAttributeSpecsService;
|
|
|
|
|
|
@ApiOperation(value = "按场景ID查询供水量出水量耗药量耗电量")
|
|
|
@RequestMapping(value = "/findTotalUsageBySceneId",method = RequestMethod.GET)
|
|
@@ -159,7 +161,21 @@ public class MonitorInfoController {
|
|
|
//判断如果是标签则进行map中取值
|
|
|
if (item.getMonitorType().equals(0L))//标签
|
|
|
{
|
|
|
- item.setMonitorValue(String.format("%.3f", map.get(item.getAttributeId()).getDataValue()) + (StringUtils.isNotEmpty(map.get(item.getAttributeId()).getUnit())?map.get(item.getAttributeId()).getUnit():""));
|
|
|
+ //按属性ID查询标签值
|
|
|
+ DeviceAttributeSpecsEntity deviceAttributeSpecsEntity = new DeviceAttributeSpecsEntity();
|
|
|
+ deviceAttributeSpecsEntity.setAttributeId(item.getAttributeId());
|
|
|
+ List<DeviceAttributeSpecsEntity> deviceAttributeSpecsEntities = deviceAttributeSpecsService.findList(deviceAttributeSpecsEntity);
|
|
|
+ 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 {
|
|
|
+ item.setMonitorValue(String.format("%.3f", map.get(item.getAttributeId()).getDataValue()) + (StringUtils.isNotEmpty(map.get(item.getAttributeId()).getUnit()) ? map.get(item.getAttributeId()).getUnit() : ""));
|
|
|
+ }
|
|
|
//判断是否报警
|
|
|
if (mapAlarm.containsKey(item.getAttributeId()))
|
|
|
item.setIsAlarm(1);
|