Commit e92810c8 authored by chenzhao's avatar chenzhao

修改代码

parent 279588a9
...@@ -10,6 +10,8 @@ import org.springframework.data.elasticsearch.annotations.FieldType; ...@@ -10,6 +10,8 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.Date; import java.util.Date;
import static org.springframework.data.elasticsearch.annotations.DateFormat.*;
/** /**
* @description: * @description:
* @author: tw * @author: tw
...@@ -33,14 +35,15 @@ public class ESEquipments { ...@@ -33,14 +35,15 @@ public class ESEquipments {
private String gatewayId; private String gatewayId;
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String isAlarm; private String isAlarm;
@Field(type = FieldType.Date, format = DateFormat.basic_date_time, index = false) // @Field(type = FieldType.Date, format = custom,pattern = "yyyy-MM-dd HH:mm:ss",index = false)
@Field(type = FieldType.Date, format = basic_date_time,index = false)
private Date createdTime; private Date createdTime;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
private String unit; private String unit;
@Field(type = FieldType.Text, index = false) @Field(type = FieldType.Text, index = false)
private String value; private String value;
@Field(type = FieldType.Double, index = false) @Field(type = FieldType.Float, index = false)
private Double valueDouble; private Float valueDouble;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
private String valueLabel; private String valueLabel;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
...@@ -59,7 +62,7 @@ public class ESEquipments { ...@@ -59,7 +62,7 @@ public class ESEquipments {
private String displayName; private String displayName;
public ESEquipments(Double valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) { public ESEquipments(Float valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble; this.valueDouble = valueDouble;
this.id = id; this.id = id;
......
...@@ -286,6 +286,11 @@ public class MonitorFanIdxController extends BaseController { ...@@ -286,6 +286,11 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type
,@RequestParam(value = "areaCode", required = false)String areaCode) { ,@RequestParam(value = "areaCode", required = false)String areaCode) {
String gatewayId = ""; String gatewayId = "";
if (null != areaCode){
List<StationCacheInfoDto> listStationCacheInfoDto = commonService.getListStationCacheInfoDto();
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
gatewayId = String.join(",", collect);
}
if (null != stationId){ if (null != stationId){
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
gatewayId = stationBasic.getBoosterGatewayId(); gatewayId = stationBasic.getBoosterGatewayId();
...@@ -736,7 +741,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -736,7 +741,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "详情基础信息") @ApiOperation(value = "详情基础信息")
@GetMapping("/getStatisticsInfo") @GetMapping("/getStatisticsInfo")
public ResponseModel<Map<String,String>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName, public ResponseModel<Map<String,Object>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName,
@RequestParam(value = "stationId", required = false) String stationId, @RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "stationType", required = false) String stationType) { @RequestParam(value = "stationType", required = false) String stationType) {
String gatewayId = ""; String gatewayId = "";
...@@ -747,8 +752,15 @@ public class MonitorFanIdxController extends BaseController { ...@@ -747,8 +752,15 @@ public class MonitorFanIdxController extends BaseController {
gatewayId = stationBasic.getBoosterGatewayId(); gatewayId = stationBasic.getBoosterGatewayId();
} }
} }
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(gatewayId,equipmentIndexName )); double sum = 0.0;
sum =list.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum();
Map<String, Object> statisticsInfo = monitorFanIndicator.getStatisticsInfo(gatewayId, equipmentIndexName);
double v = Double.parseDouble( statisticsInfo.get("mean").toString());
String load = String.format("%.2f", v / sum);
statisticsInfo.put("load",load);
return ResponseHelper.buildResponse(statisticsInfo);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
...@@ -853,7 +865,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -853,7 +865,7 @@ public class MonitorFanIdxController extends BaseController {
} }
@ApiOperation(value = "电站排名") @ApiOperation(value = "电站排名")
// @Scheduled(cron = "0/10 * * * * ? ") @Scheduled(cron = "0/10 * * * * ? ")
@GetMapping("/stationRanking") @GetMapping("/stationRanking")
public ResponseModel stationRanking() { public ResponseModel stationRanking() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
...@@ -919,11 +931,13 @@ public class MonitorFanIdxController extends BaseController { ...@@ -919,11 +931,13 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "运维数据 ") @ApiOperation(value = "运维数据 ")
@GetMapping("/operationData") @GetMapping("/operationData")
public ResponseModel<IPage<Map<String,Object>>> operationData() { public ResponseModel<IPage<Map<String,Object>>> operationData(@RequestParam(value = "areaCode", required = false)String areaCode) {
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto(); List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
if (null != areaCode){
list = list.stream().filter(e->e.getAreaCode().equals(areaCode)).collect(Collectors.toList());
}
List<Map<String,Object>> mapList = new ArrayList<>(); List<Map<String,Object>> mapList = new ArrayList<>();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList())); Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
...@@ -941,8 +955,6 @@ public class MonitorFanIdxController extends BaseController { ...@@ -941,8 +955,6 @@ public class MonitorFanIdxController extends BaseController {
result.setRecords(mapList); result.setRecords(mapList);
result.setCurrent(1); result.setCurrent(1);
result.setTotal(mapList.size()); result.setTotal(mapList.size());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
...@@ -957,23 +969,24 @@ public class MonitorFanIdxController extends BaseController { ...@@ -957,23 +969,24 @@ public class MonitorFanIdxController extends BaseController {
map.put("equipmentIndexName.keyword",value); map.put("equipmentIndexName.keyword",value);
if (null != areaCode){ if (null != areaCode){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getBelongArea().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList()); List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
map.put("gateWayId",collect); map.put("gatewayId.keyword",collect);
} }
List<? extends Terms.Bucket> lidate= commonService.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword", ESEquipments.class); List<? extends Terms.Bucket> lidate= commonService.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword", ESEquipments.class);
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.0000");
Double num = 0.00; Double num = 0.00;
for (Terms.Bucket bucket : lidate) { if (map.containsKey("gateWayId")&&map.get("gateWayId").size() > 0){
Aggregations aggregation= bucket.getAggregations(); for (Terms.Bucket bucket : lidate) {
List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null; Aggregations aggregation= bucket.getAggregations();
for (Aggregation agg : listdata) { List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null;
ParsedSum parsedSum =(ParsedSum)agg; for (Aggregation agg : listdata) {
num = Double.valueOf(format2.format(parsedSum.getValue())); ParsedSum parsedSum =(ParsedSum)agg;
num = Double.valueOf(format2.format(parsedSum.getValue()));
}
} }
} }
return ResponseHelper.buildResponse(commonService.getSocialContributionDtoList(num)); return ResponseHelper.buildResponse(commonService.getSocialContributionDtoList(num));
} }
...@@ -1105,5 +1118,57 @@ public class MonitorFanIdxController extends BaseController { ...@@ -1105,5 +1118,57 @@ public class MonitorFanIdxController extends BaseController {
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@Scheduled(cron = "0 0/10 * * * ? ")
@ApiOperation(value = "接入情况 ")
@GetMapping("/accessSituation")
public ResponseModel<Map<String,Object>> accessSituation(){
Map<String, Object> map = new LinkedHashMap<>();
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
double sum = list.stream().mapToDouble(l -> Double.parseDouble(l.getInstalledCapacity())).sum();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
for (StationType value : StationType.values()) {
List<StationCacheInfoDto> dtos = listMap.get(value.getCode());
map.put(value.getCode(),dtos == null ? 0 :dtos.size());
map.put(value.getCode()+"title",dtos == null ? 0 :dtos.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum());
}
map.put("total",list.size());
map.put("num",sum);
try {
emqKeeper.getMqttClient().publish("/accessSituation/topic",JSON.toJSONString(map).getBytes(),0,false);
} catch (MqttException e) {
}
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@Scheduled(cron = "0 0/10 * * * ? ")
@ApiOperation(value = "区域接入情况 ")
@GetMapping("/qyAccessSituation")
public ResponseModel<Map<String,Object>> qyAccessSituation(){
Map<String, Object> map = new LinkedHashMap<>();
List<StationCacheInfoDto> list = commonService.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
for (String s : belongAreaList.keySet()) {
double sum = belongAreaList.get(s).stream().mapToDouble(l -> Double.parseDouble(l.getInstalledCapacity())).sum();
Map<String, List<StationCacheInfoDto>> listMap = list.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getStationType, Collectors.toList()));
for (StationType value : StationType.values()) {
List<StationCacheInfoDto> dtos = listMap.get(value.getCode());
map.put(value.getCode(),dtos == null ? 0 :dtos.size());
map.put(value.getCode()+"title",dtos == null ? 0 :dtos.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum());
}
map.put("total",list.size());
map.put("num",sum);
try {
emqKeeper.getMqttClient().publish("/accessSituation/topic/"+"s",JSON.toJSONString(map).getBytes(),0,false);
} catch (MqttException e) {
}
}
return ResponseHelper.buildResponse(map);
}
} }
...@@ -53,7 +53,7 @@ public class StationCacheDataInit implements CommandLineRunner { ...@@ -53,7 +53,7 @@ public class StationCacheDataInit implements CommandLineRunner {
stationCacheInfoDto.setStationType(stationBasic.getStationType()); stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[","").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[","").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0)); stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,2))||mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0,3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f",sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))); stationCacheInfoDto.setInstalledCapacity(String.format("%.2f",sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
List<QueryDto> queryDtoList = new ArrayList<>(); List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId",stationBasic.getFanGatewayId())); queryDtoList.add(new QueryDto("gatewayId",stationBasic.getFanGatewayId()));
......
...@@ -14,7 +14,7 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> { ...@@ -14,7 +14,7 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
List<Map<String, String>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId); List<Map<String, String>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId);
Map<String, String> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId, Map<String, Object> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId,
@RequestParam(value ="equipmentIndexName" ) String equipmentIndexName); @RequestParam(value ="equipmentIndexName" ) String equipmentIndexName);
......
...@@ -53,7 +53,7 @@ public class LargeScreenImpl { ...@@ -53,7 +53,7 @@ public class LargeScreenImpl {
/** /**
* 全国 * 全国
*/ */
@Scheduled(cron = "0/10 * * * * ?") //@Scheduled(cron = "0/10 * * * * ?")
public Map<String, Double> getqg() { public Map<String, Double> getqg() {
Map<String, Double> mapdta = new HashMap<>(); Map<String, Double> mapdta = new HashMap<>();
mapdta.put("SS", 0d); mapdta.put("SS", 0d);
...@@ -154,10 +154,10 @@ public class LargeScreenImpl { ...@@ -154,10 +154,10 @@ public class LargeScreenImpl {
} }
@Scheduled(cron = "0/10 * * * * ?") // @Scheduled(cron = "0/10 * * * * ?")
private void sendQYYXZBMqtt(){ private void sendQYYXZBMqtt(){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode)); Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea));
for (String s : belongAreaList.keySet()) { for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList()); List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
getqy(ids,s); getqy(ids,s);
...@@ -315,7 +315,7 @@ public class LargeScreenImpl { ...@@ -315,7 +315,7 @@ public class LargeScreenImpl {
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
private void sendQYFDLMqtt(){ private void sendQYFDLMqtt(){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode)); Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea));
for (String s : belongAreaList.keySet()) { for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList()); List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
getSeriesDataqy(new Date(),ids,s); getSeriesDataqy(new Date(),ids,s);
...@@ -377,7 +377,7 @@ public class LargeScreenImpl { ...@@ -377,7 +377,7 @@ public class LargeScreenImpl {
value1.add(monthy); value1.add(monthy);
map.put("moon.keyword",value1); map.put("moon.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"value" ,"day.keyword",ESEquipments.class); List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"day.keyword",ESEquipments.class);
Map<String,Double> mapdta=new HashMap<>(); Map<String,Double> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.0000");
...@@ -426,7 +426,7 @@ public class LargeScreenImpl { ...@@ -426,7 +426,7 @@ public class LargeScreenImpl {
value1.add(monthy); value1.add(monthy);
map.put("moon.keyword",value1); map.put("moon.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"value" ,"day.keyword",ESEquipments.class); List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"day.keyword",ESEquipments.class);
Map<String,Double> mapdta=new HashMap<>(); Map<String,Double> mapdta=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.0000");
......
...@@ -1460,7 +1460,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1460,7 +1460,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return resultMap; return resultMap;
} }
public Map<String, String> getStatisticsInfo(String gatewayId ,String equipmentIndexName){ public Map<String, Object> getStatisticsInfo(String gatewayId ,String equipmentIndexName){
return temporaryDataMapper.getStatisticsInfo(gatewayId,equipmentIndexName); return temporaryDataMapper.getStatisticsInfo(gatewayId,equipmentIndexName);
} }
...@@ -1758,7 +1758,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1758,7 +1758,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void sendMqttByRanking( List< Map<String,Object>> list,String code,String topic){ public void sendMqttByRanking( List< Map<String,Object>> list,String code,String topic){
//先发送区域消息 //先发送区域消息
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongArea)); Map<String, List<StationCacheInfoDto>> belongAreaList = listStationCacheInfoDto.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getAreaCode));
for (String s : belongAreaList.keySet()) { for (String s : belongAreaList.keySet()) {
List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList()); List<String> ids = belongAreaList.get(s).stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
String idStrings = String.join(",", ids); String idStrings = String.join(",", ids);
...@@ -1769,7 +1769,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1769,7 +1769,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
result.setCurrent(1); result.setCurrent(1);
result.setTotal(resultList.size()); result.setTotal(resultList.size());
try { try {
emqKeeper.getMqttClient().publish(s+"/"+topic+"/"+code,JSON.toJSONString(result).getBytes(),0,false); emqKeeper.getMqttClient().publish(topic+"/"+code+"/"+s,JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) { } catch (MqttException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
`temporary_data` `temporary_data`
<where> <where>
<if test="gatewayId != null and gatewayId != ''"> <if test="gatewayId != null and gatewayId != ''">
gatewayId = #{gatewayId} gatewayId in( ${gatewayId})
</if> </if>
<if test="gatewayId == null or gatewayId == ''"> <if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null equipmentNumber is not null and equipmentIndexName is not null
......
...@@ -39,8 +39,8 @@ public class ESEquipments { ...@@ -39,8 +39,8 @@ public class ESEquipments {
private String unit; private String unit;
@Field(type = FieldType.Text, index = false) @Field(type = FieldType.Text, index = false)
private String value; private String value;
@Field(type = FieldType.Double, index = false) @Field(type = FieldType.Float, index = false)
private Double valueDouble; private Float valueDouble;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
private String valueLabel; private String valueLabel;
@Field(type = FieldType.Text , index = false) @Field(type = FieldType.Text , index = false)
...@@ -59,7 +59,7 @@ public class ESEquipments { ...@@ -59,7 +59,7 @@ public class ESEquipments {
private String displayName; private String displayName;
public ESEquipments(Double valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) { public ESEquipments(Float valueDouble,String id, String address, String dataType, String equipmentSpecificName, String gatewayId, String isAlarm, Date createdTime, String unit, String value, String valueLabel, String traceId, String equipmentIndexName, String equipmentNumber, String frontModule, String systemType, String pictureName, String displayName) {
this.valueDouble = valueDouble; this.valueDouble = valueDouble;
this.id = id; this.id = id;
......
...@@ -175,7 +175,7 @@ public class DemoController extends BaseController { ...@@ -175,7 +175,7 @@ public class DemoController extends BaseController {
@GetMapping("/test4") @GetMapping("/test4")
public ResponseModel<Integer> demoTest3() { public ResponseModel<Integer> demoTest3() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站 //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313"}; String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
// String [] strings = {"1669524885619085313"}; // String [] strings = {"1669524885619085313"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速"); // Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString()); // System.out.println(o.toString());
...@@ -195,7 +195,7 @@ public class DemoController extends BaseController { ...@@ -195,7 +195,7 @@ public class DemoController extends BaseController {
for (MonitorFanIndicator monitorFanIndicator : list) { for (MonitorFanIndicator monitorFanIndicator : list) {
ESEquipments eSEquipments=new ESEquipments( ESEquipments eSEquipments=new ESEquipments(
3.55, null,
monitorFanIndicator.getAddressGateway(), monitorFanIndicator.getAddressGateway(),
monitorFanIndicator.getIndexAddress(), monitorFanIndicator.getIndexAddress(),
monitorFanIndicator.getDataType(), monitorFanIndicator.getDataType(),
...@@ -212,7 +212,7 @@ public class DemoController extends BaseController { ...@@ -212,7 +212,7 @@ public class DemoController extends BaseController {
monitorFanIndicator.getFrontModule(), monitorFanIndicator.getFrontModule(),
monitorFanIndicator.getSystemType(), monitorFanIndicator.getSystemType(),
monitorFanIndicator.getPictureName(), monitorFanIndicator.getPictureName(),
"" ); monitorFanIndicator.getEquipmentNumber());
listit.add(eSEquipments); listit.add(eSEquipments);
...@@ -289,7 +289,7 @@ public class DemoController extends BaseController { ...@@ -289,7 +289,7 @@ public class DemoController extends BaseController {
ESEquipments eSEquipments=new ESEquipments( ESEquipments eSEquipments=new ESEquipments(
3.55, null,
monitorFanIndicator.getAddressGateway(), monitorFanIndicator.getAddressGateway(),
monitorFanIndicator.getIndexAddress(), monitorFanIndicator.getIndexAddress(),
monitorFanIndicator.getDataType(), monitorFanIndicator.getDataType(),
...@@ -395,7 +395,7 @@ public class DemoController extends BaseController { ...@@ -395,7 +395,7 @@ public class DemoController extends BaseController {
@ApiOperation(value = "分组求和数") @ApiOperation(value = "分组求和数")
@GetMapping("/test10") @GetMapping("/test10")
public SearchHits demoTest10() { public SearchHits demoTest10() {
QueryBuilder queryBuilder = QueryBuilders.matchQuery("equipmentIndexName", "有功功率"); QueryBuilder queryBuilder = QueryBuilders.matchQuery("equipmentIndexName", "年发电量");
...@@ -490,14 +490,13 @@ public class DemoController extends BaseController { ...@@ -490,14 +490,13 @@ public class DemoController extends BaseController {
public Map demoTest14() { public Map demoTest14() {
List<String> value=new ArrayList<>(); List<String> value=new ArrayList<>();
value.add(ss); value.add("年发电量");
value.add(zfs);
value.add(zfslj);
Map<String,List<String>> map=new HashMap<>(); Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value); map.put("equipmentIndexName.keyword",value);
// List<String> value1=new ArrayList<>(); List<String> value1=new ArrayList<>();
// value1.add("1668801435891929089"); value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1); map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class); List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword",ESEquipments.class);
......
...@@ -259,7 +259,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -259,7 +259,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览-全站功率曲线") @ApiOperation(value = "概览-全站功率曲线")
@GetMapping("/overviewWindSpeed") @GetMapping("/overviewWindSpeed")
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type) { public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type,@RequestParam(value = "areaCode", required = false)String areaCode) {
String gatewayId = ""; String gatewayId = "";
if (null != stationId){ if (null != stationId){
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
...@@ -268,6 +268,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -268,6 +268,7 @@ public class MonitorFanIdxController extends BaseController {
gatewayId = stationBasic.getFanGatewayId(); gatewayId = stationBasic.getFanGatewayId();
} }
} }
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId); Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId);
return ResponseHelper.buildResponse(detailsWindSpeed); return ResponseHelper.buildResponse(detailsWindSpeed);
......
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