Commit 4ce938c7 authored by caotao's avatar caotao

1.运行监盘全国地图、省份地图接口接入物联监盘。

parent fa6882c4
......@@ -163,12 +163,12 @@ public class StationBasic extends BaseEntity {
* 前置网关配置的场站名称
*/
@TableField("station_core_name")
private String stationCoreName;
private String stationCoreName;
/**
* 前置配置的升压站名称
*/
@TableField("booster_core_name")
private String boosterCoreName;
private String boosterCoreName;
/**
* 装机容量
*/
......
......@@ -177,6 +177,8 @@ public class CommonConstans {
public static final String YEAR_GEN_ATTAINMENT_RATE = "年计划完成率";
//年利用小时数
public static final String YEAR_GEN_HOURS = "年利用小时数";
public static final String WIND_SPEED_THIRTY_SECONDS = "30秒平均风速";
public static final String TOTAL_RADIATION = "辐照度";
//------------------监盘服务改造新增常量结束------------------------------
......
......@@ -516,7 +516,8 @@ public class DemoController extends BaseController {
@GetMapping("/testFeignCall")
public List<CoreValuesDto> testFeignCall() {
List<CoreValuesDto> coreValuesDtos =coreCommonService.getValuesByStationNamesAndPointsNames(null,null);
monitorService.getTotalData();
// monitorService.getTotalData();
monitorService.getNationWideInfo("江西省","gis");
// Double sum = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
// Double avg = coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.DAY_POWER_GENERATION);
return coreValuesDtos;
......
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
......@@ -31,4 +32,8 @@ public class StationCacheInfoDto implements Serializable {
private String areaCode;
//
private String address;
private String stationCoreName;
private String boosterCoreName;
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public interface CoreCommonService {
/**
......@@ -26,4 +34,5 @@ public interface CoreCommonService {
* @return
*/
Double getAverageOfByPointName(List<CoreValuesDto> coreValuesDtoList,String pointName);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto;
import java.util.List;
public interface MonitorService {
public void getTotalData();
public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.feign.CoreFeignClient;
import com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
......@@ -19,14 +25,15 @@ import java.util.stream.Collectors;
public class CoreCommonServiceImpl implements CoreCommonService {
private final CoreFeignClient coreFeignClient;
@Override
public List<CoreValuesDto> getValuesByStationNamesAndPointsNames(String stationNames, String pointsNames) {
FeignClientResult<List<Object>> feignClientResult=coreFeignClient.getValues(stationNames,pointsNames);
FeignClientResult<List<Object>> feignClientResult = coreFeignClient.getValues(stationNames, pointsNames);
List<Object> list = feignClientResult.getResult();
List<CoreValuesDto> result = new ArrayList<>();
list.forEach(o -> {
CoreValuesDto coreValuesDto = JSONObject.parseObject(JSONObject.toJSONString(o),CoreValuesDto.class);
coreValuesDto.setDataMap(coreValuesDto.getData().stream().flatMap(m->m.entrySet().stream()).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue,(a,b)->b)));
CoreValuesDto coreValuesDto = JSONObject.parseObject(JSONObject.toJSONString(o), CoreValuesDto.class);
coreValuesDto.setDataMap(coreValuesDto.getData().stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> b)));
result.add(coreValuesDto);
});
return result;
......@@ -35,7 +42,7 @@ public class CoreCommonServiceImpl implements CoreCommonService {
@Override
public Double getSumOfByPointName(List<CoreValuesDto> coreValuesDtoList, String pointName) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
coreValuesDtoList =coreValuesDtoList.stream().filter(coreValuesDto -> coreValuesDto.getDataMap().size()>0&&coreValuesDto.getDataMap().containsKey(pointName)).collect(Collectors.toList());
coreValuesDtoList = coreValuesDtoList.stream().filter(coreValuesDto -> coreValuesDto.getDataMap().size() > 0 && coreValuesDto.getDataMap().containsKey(pointName)).collect(Collectors.toList());
coreValuesDtoList.forEach(coreValuesDto -> {
result.set(result.get() + Double.parseDouble(coreValuesDto.getDataMap().get(pointName).toString()));
});
......@@ -45,11 +52,11 @@ public class CoreCommonServiceImpl implements CoreCommonService {
@Override
public Double getAverageOfByPointName(List<CoreValuesDto> coreValuesDtoList, String pointName) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
coreValuesDtoList =coreValuesDtoList.stream().filter(coreValuesDto -> coreValuesDto.getDataMap().size()>0&&coreValuesDto.getDataMap().containsKey(pointName)).collect(Collectors.toList());
coreValuesDtoList = coreValuesDtoList.stream().filter(coreValuesDto -> coreValuesDto.getDataMap().size() > 0 && coreValuesDto.getDataMap().containsKey(pointName)).collect(Collectors.toList());
coreValuesDtoList.forEach(coreValuesDto -> {
result.set(result.get() + Double.parseDouble(coreValuesDto.getDataMap().get(pointName).toString()));
});
return result.get()/coreValuesDtoList.size();
return result.get() / coreValuesDtoList.size();
}
}
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