Commit 251fb1ef authored by wujiang's avatar wujiang

提交离散率方法

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