Commit 033f6fee authored by zhangsen's avatar zhangsen

bug修改

parent 008562e3
...@@ -219,11 +219,15 @@ public class CommonServiceImpl { ...@@ -219,11 +219,15 @@ public class CommonServiceImpl {
* @deprecated 获取指标值总和 * @deprecated 获取指标值总和
*/ */
public Double getTotalByIndicatior(String gatewayId, String indicator) { public Double getTotalByIndicatior(String gatewayId, String indicator) {
String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
//用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result = getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Double totalvalue = 0.00; Double totalvalue = 0.00;
try { try {
List<Map<String, Object>> mapList = influxdbUtil.query(sql); totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueDouble())).mapToDouble(l -> Double.parseDouble(l.getValueDouble().toString())).sum();
totalvalue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
} catch (Exception e) { } catch (Exception e) {
return totalvalue; return totalvalue;
} }
......
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