Commit ba5d6b6b authored by caotao's avatar caotao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents f29da542 f380f2df
......@@ -26,6 +26,7 @@ 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;
import org.elasticsearch.index.query.MatchPhraseQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.Aggregation;
......@@ -121,7 +122,7 @@ public class MonitorFanIdxController extends BaseController {
list.add(date1);
Map<String, Object> queryCondtion = new HashMap<>();
queryCondtion.put("color",stationBasic.getQrcodeColor());
queryCondtion.put("date",list);
queryCondtion.put("data",list);
return ResponseHelper.buildResponse(queryCondtion);
}
......@@ -1083,7 +1084,13 @@ public class MonitorFanIdxController extends BaseController {
List<String> list = Arrays.asList(keys);
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
if (!stationBasic.getStationType().equals("FDZ")) {
boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", CommonConstans.taiHeGenIndicator))).must(QueryBuilders.matchQuery("gatewayId.keyword", stationBasic.getBoosterGatewayId()));
MatchPhraseQueryBuilder queryBuilder1 = QueryBuilders.matchPhraseQuery(CommonConstans.QueryStringFrontMoudleNotKeyWord, "*逆变器*");
boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", list))
).must(QueryBuilders.matchQuery("gatewayId.keyword", stationBasic.getFanGatewayId()));
boolQueryBuilder.must(queryBuilder1);
} else {
boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", list))).must(QueryBuilders.matchQuery("gatewayId.keyword", gatewayId));
......@@ -1117,33 +1124,56 @@ public class MonitorFanIdxController extends BaseController {
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);
break;
case "月发电量":
map.put("monthNum", value);
break;
case "年发电量":
map.put("yearNum", value);
case CommonConstans.taiHeGenIndicatorDay:
map.put("dayNum", value);
break;
case CommonConstans.taiHeGenIndicatorMonth:
map.put("monthNum", value);
break;
case CommonConstans.taiHeGenIndicatorYear:
map.put("yearNum", value);
break;
if (stationBasic.getStationType().equals("FDZ")) {
map.put("name", equip.getEquipmentSpecificName().substring(0, equip.getEquipmentSpecificName().indexOf("#"))+"/"+key);
}else{
map.put("name", key);
}
if (!stationBasic.getStationType().equals("FDZ")) {
switch (equip.getEquipmentIndexName()) {
case "日发电量":
map.put("dayNum", String.format(CommonConstans.Fourdecimalplaces, Double.valueOf(value) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
break;
case "月发电量":
map.put("monthNum", String.format(CommonConstans.Fourdecimalplaces, Double.valueOf(value) * CommonConstans.pvGenPoweActorCurrentData));
break;
case "年发电量":
map.put("yearNum", String.format(CommonConstans.Fourdecimalplaces, Double.valueOf(value) * CommonConstans.pvGenPoweActorCurrentData));
}
}else{
switch (equip.getEquipmentIndexName()) {
case "日发电量":
map.put("dayNum", value);
break;
case "月发电量":
map.put("monthNum", value);
break;
case "年发电量":
map.put("yearNum", value);
// case CommonConstans.taiHeGenIndicatorDay:
// map.put("dayNum", value);
// break;
// case CommonConstans.taiHeGenIndicatorMonth:
// map.put("monthNum", value);
// break;
// case CommonConstans.taiHeGenIndicatorYear:
// map.put("yearNum", value);
// break;
}
}
}
esEquipmentsMap.add(map);
}
if (stationBasic.getStationType().equals("FDZ")) {
this.sortByFeild(esEquipmentsMap, "num");
}else{
this.sortByFeildString(esEquipmentsMap, "num");
this.sortByFeild(esEquipmentsMap,"num");
}
IPage<Map<String, Object>> page = new Page<>();
page.setTotal(esEquipmentsMap.size());
page.setSize(999);
......@@ -1172,6 +1202,14 @@ public class MonitorFanIdxController extends BaseController {
return list;
}
public static List<Map<String, Object>> sortByFeildString(List<Map<String, Object>> list, String feild) {
if (CollectionUtils.isNotEmpty(list)) {
Collections.sort(list, (m1, m2)-> String.valueOf(m1.get(feild).toString()).compareTo(String.valueOf(m2.get(feild).toString())));
}
return list;
}
//@Scheduled(cron = "0/10 * * * * ? ")
......
......@@ -217,8 +217,15 @@ public class LargeScreenImpl {
mapdta.put("NJHWC", 0d);
//平均数
List<String> value = new ArrayList<>();
List<String> ids =new ArrayList<>();
for (StationCacheInfoDto stationCacheInfoDto : gatewayId) {
ids.add(stationCacheInfoDto.getFanGatewayId());
ids.add(stationCacheInfoDto.getBoosterGatewayId());
}
// List<String> ids = gatewayId.stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
List<String> ids = gatewayId.stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
value.add(SS);
value.add(ZFS);
value.add(ZFSLJ);
......
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