diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java index f8aad18..55c8142 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindSubordinateVo.java @@ -22,6 +22,20 @@ public class WindSubordinateVo { @ApiModelProperty(value = "机构名称") private String departName; + @ApiModelProperty(value = "地市编码") + private String areaCode; + + @ApiModelProperty(value = "地市名称") + private String areaName; + + @ApiModelProperty("经度(东经)") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Float lgtd; + + @ApiModelProperty("纬度(北纬)") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Float lttd; + @ApiModelProperty(value = "温度") private String temp; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java index b40bc9a..f98e394 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java @@ -20,11 +20,14 @@ import com.hnac.hzims.operational.station.service.IStationService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.entity.Dept; +import org.springblade.system.entity.Region; +import org.springblade.system.feign.ISysClient; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -54,6 +57,8 @@ public class WindHomeServiceImpl implements WindHomeService { private final RedisTemplate redisTemplate; + private final ISysClient sysClient; + public final static String device_cache_final = "hzims:equipment:emInfo:deviceCode.emInfoList"; /** @@ -183,6 +188,20 @@ public class WindHomeServiceImpl implements WindHomeService { Map weekWeather = this.weatherService.getWeekWeather(stations); return areas.entrySet().stream().map(entry -> { WindSubordinateVo subordinate = new WindSubordinateVo(); + // 获取第一个站点经纬度、行政编码信息 + StationEntity station = entry.getValue().get(0); + subordinate.setLttd(station.getLttd()); + subordinate.setLgtd(station.getLgtd()); + // 省市编码 + String areaCode = station.getAreaCode(); + subordinate.setAreaCode(areaCode); + if (!StringUtil.isEmpty(areaCode)) { + String[] arrCode = areaCode.split(","); + R R = sysClient.getRegion(arrCode[1]); + if (R.isSuccess() && ObjectUtil.isNotEmpty(R.getData())) { + subordinate.setAreaName(R.getData().getName()); + } + } // 机构Id subordinate.setDepartId(entry.getKey().getId()); // 机构名称 @@ -218,7 +237,8 @@ public class WindHomeServiceImpl implements WindHomeService { } } return subordinate; - }).sorted(Comparator.comparing(WindSubordinateVo::getGeneration).reversed()).collect(Collectors.toList()); + }).filter(o-> Math.abs(o.getGeneration()) > 0 || Math.abs(o.getGenerationRate()) > 0 || Math.abs(o.getGenerationComplete()) > 0 + || Math.abs(o.getFactoryUse()) > 0 || Math.abs(o.getFanUse()) > 0 ).sorted(Comparator.comparing(WindSubordinateVo::getGeneration).reversed()).collect(Collectors.toList()); } /**