Commit e97eb0f7 authored by xixinzhao's avatar xixinzhao

判断是否为数字

parent 748a98cd
...@@ -1944,8 +1944,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1944,8 +1944,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
iotIndexInfoVo.setNumber(deviceName); iotIndexInfoVo.setNumber(deviceName);
if (equipmentSpecificIndex.getIsTrend()) { if (equipmentSpecificIndex.getIsTrend()) {
if (!ObjectUtils.isEmpty(entry.getValue())){ if (!ObjectUtils.isEmpty(entry.getValue())){
BigDecimal val = new BigDecimal(String.valueOf(entry.getValue())); boolean isNum = StringUtil.isNumeric(String.valueOf(entry.getValue()));
iotIndexInfoVo.setContent(equipmentSpecificIndex.getIndexName() + (val.setScale(2, BigDecimal.ROUND_HALF_UP)) + equipmentSpecificIndex.getIndexUnitName()); if (isNum) {
BigDecimal val = new BigDecimal(String.valueOf(entry.getValue()));
iotIndexInfoVo.setContent(equipmentSpecificIndex.getIndexName() + (val.setScale(2, BigDecimal.ROUND_HALF_UP)) + equipmentSpecificIndex.getIndexUnitName());
}
} }
} else { } else {
if (pressurePumpStart.equals(equipmentSpecificIndex.getNameKey())) { if (pressurePumpStart.equals(equipmentSpecificIndex.getNameKey())) {
...@@ -2582,8 +2585,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2582,8 +2585,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} else { } else {
List<BigDecimal> bigDecimals = new ArrayList<>(); List<BigDecimal> bigDecimals = new ArrayList<>();
if (!ObjectUtils.isEmpty(mapList.get(key))) { if (!ObjectUtils.isEmpty(mapList.get(key))) {
bigDecimals.add(new BigDecimal(mapList.get(key))); boolean isNum = StringUtil.isNumeric(mapList.get(key));
stringIntegerHashMapIn.put(dateX, bigDecimals); if (isNum) {
bigDecimals.add(new BigDecimal(mapList.get(key)));
stringIntegerHashMapIn.put(dateX, bigDecimals);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment