Commit 251fb1ef authored by wujiang's avatar wujiang

提交离散率方法

parent 45c26a42
...@@ -1954,58 +1954,72 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1954,58 +1954,72 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public ResultsData collectingBox(String gatewayId, int current, int size) { public ResultsData collectingBox(String gatewayId, int current, int size) {
ArrayList<Map<String, Object>> resultList = new ArrayList<>(); ArrayList<Map<String, Object>> resultList = getLSV(gatewayId);
Map<String, List<String>> queryConditon = new HashMap<>();
queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); // 构建平台数据
Map<String, String> likeMap = new HashMap<>(); DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
likeMap.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "路电流"); ColModel colModelEventMovement = new ColModel("zz", "zz", "子阵", "子阵", "dataGrid", "zz");
List<ESEquipments> list = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null, ESEquipments.class, likeMap); ColModel colModelStationName = new ColModel("nbq", "nbq", "逆变器", "逆变器", "dataGrid", "nvq");
ColModel colModelEventDesc = new ColModel("hlx", "hlx", "汇流箱", "汇流箱", "dataGrid", "hlx");
Map<String, List<String>> queryConditon1 = new HashMap<>(); ColModel colModelAlarmGroupName = new ColModel("avg", "avg", "支路电流平均值", "支路电流平均值", "dataGrid", "avg");
queryConditon1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); ColModel colModelEventTime = new ColModel("lsv", "lsv", "支路电流离散率", "支路电流离散率", "dataGrid", "lsv");
Map<String, String> likeMap1 = new HashMap<>(); List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,
likeMap1.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "平均电流"); colModelAlarmGroupName, colModelEventTime);
List<ESEquipments> list1 = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null, ESEquipments.class, likeMap1); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
if (!ValidationUtil.isEmpty(list)) { }
Map<String, List<ESEquipments>> collect = list.stream().collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
for (String s : collect.keySet()) { public ArrayList<Map<String, Object>> getLSV(String gatewayId) {
List<ESEquipments> indicatorsDtos = collect.get(s);
HashMap<String, Object> resultMap = new HashMap<>(); ArrayList<Map<String, Object>> resultList = new ArrayList<>();
Double avageValue = 0.0; Map<String, List<String>> queryConditon = new HashMap<>();
avageValue = indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValueF())).mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).average().getAsDouble(); queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
avageValue = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, avageValue)); Map<String, String> likeMap = new HashMap<>();
resultMap.put("avg", avageValue); likeMap.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "路电流");
String[] name = s.split("-"); List<ESEquipments> list = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null,
resultMap.put("zz", "#" + name[0] + "子阵"); ESEquipments.class, likeMap);
resultMap.put("nbq", "逆变器" + name[1]);
resultMap.put("hlx", "#" + name[2] + "汇流箱"); Map<String, List<String>> queryConditon1 = new HashMap<>();
double lsv = 0.00; queryConditon1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
if (!ValidationUtil.isEmpty(list1)) { Map<String, String> likeMap1 = new HashMap<>();
List<ESEquipments> dtos = list1.stream().filter(e -> e.getEquipmentNumber().equals(s)).collect(Collectors.toList()); likeMap1.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "平均电流");
if (!ValidationUtil.isEmpty(dtos)) { List<ESEquipments> list1 = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null,
for (ESEquipments esEquipments : indicatorsDtos) { ESEquipments.class, likeMap1);
lsv = lsv + Math.pow(esEquipments.getValueF() - avageValue, 2);
} if (!ValidationUtil.isEmpty(list)) {
} Map<String, List<ESEquipments>> collect = list.stream()
lsv = lsv / indicatorsDtos.size(); .collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
lsv = Math.sqrt(lsv); for (String s : collect.keySet()) {
} List<ESEquipments> indicatorsDtos = collect.get(s);
resultMap.put("lsv", String.format(CommonConstans.Twodecimalplaces, lsv)); HashMap<String, Object> resultMap = new HashMap<>();
resultList.add(resultMap); Double avageValue = 0.0;
} avageValue = indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValueF()))
} .mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).average().getAsDouble();
//构建平台数据 avageValue = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, avageValue));
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList); resultMap.put("avg", avageValue);
ColModel colModelEventMovement = new ColModel("zz", "zz", "子阵", "子阵", "dataGrid", "zz"); String[] name = s.split("-");
ColModel colModelStationName = new ColModel("nbq", "nbq", "逆变器", "逆变器", "dataGrid", "nvq"); resultMap.put("zz", "#" + name[0] + "子阵");
ColModel colModelEventDesc = new ColModel("hlx", "hlx", "汇流箱", "汇流箱", "dataGrid", "hlx"); resultMap.put("nbq", "逆变器" + name[1]);
ColModel colModelAlarmGroupName = new ColModel("avg", "avg", "支路电流平均值", "支路电流平均值", "dataGrid", "avg"); resultMap.put("hlx", "#" + name[2] + "汇流箱");
ColModel colModelEventTime = new ColModel("lsl", "lsv", "支路电流离散率", "支路电流离散率", "dataGrid", "lsv"); double lsv = 0.00;
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime); if (!ValidationUtil.isEmpty(list1)) {
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); List<ESEquipments> dtos = list1.stream().filter(e -> e.getEquipmentNumber().equals(s))
return resultsData; .collect(Collectors.toList());
} if (!ValidationUtil.isEmpty(dtos)) {
for (ESEquipments esEquipments : indicatorsDtos) {
lsv = lsv + Math.pow(esEquipments.getValueF() - avageValue, 2);
}
}
lsv = lsv / indicatorsDtos.size();
lsv = Math.sqrt(lsv);
}
resultMap.put("lsv", String.format(CommonConstans.Twodecimalplaces, lsv));
resultList.add(resultMap);
}
}
return resultList;
}
public List<Map<String, Object>> solarPowerOperation(String gatewayId) { public List<Map<String, Object>> solarPowerOperation(String gatewayId) {
......
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