Commit 23f55cc2 authored by tangwei's avatar tangwei

修改风机型号,以及风机信息按编号排序

parent 7d94387f
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorIm
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitoringServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.index.query.BoolQueryBuilder;
......@@ -1113,9 +1114,11 @@ public class MonitorFanIdxController extends BaseController {
Map<String, List<ESEquipments>> resultMap = equipments.stream().collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
for (String key : resultMap.keySet()) {
Map<String, Object> map = new HashMap<>();
map.put("name", key);
map.put("num", key);
for (ESEquipments equip : resultMap.get(key)) {
String value = String.format("%.4f", equip.getValueF());
map.put("name", equip.getEquipmentSpecificName().substring(0, equip.getEquipmentSpecificName().indexOf("#"))+"/"+key);
switch (equip.getEquipmentIndexName()) {
case "日发电量":
map.put("dayNum", value);
......@@ -1138,6 +1141,9 @@ public class MonitorFanIdxController extends BaseController {
}
esEquipmentsMap.add(map);
}
this.sortByFeild(esEquipmentsMap,"num");
IPage<Map<String, Object>> page = new Page<>();
page.setTotal(esEquipmentsMap.size());
page.setSize(999);
......@@ -1157,6 +1163,17 @@ public class MonitorFanIdxController extends BaseController {
}
public static List<Map<String, Object>> sortByFeild(List<Map<String, Object>> list, String feild) {
if (CollectionUtils.isNotEmpty(list)) {
Collections.sort(list, (m1, m2)-> Integer.valueOf(m1.get(feild).toString()).compareTo(Integer.valueOf(m2.get(feild).toString())));
}
return list;
}
//@Scheduled(cron = "0/10 * * * * ? ")
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试方法 ")
......
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