Commit 58e1cad4 authored by caotao's avatar caotao

1.map_region新增postion字段。2.监盘全国地图接口开发。

parent b77ef8a8
...@@ -60,4 +60,9 @@ public class MapRegion extends BaseEntity { ...@@ -60,4 +60,9 @@ public class MapRegion extends BaseEntity {
@TableField("area_code") @TableField("area_code")
private String areaCode; private String areaCode;
/**
* 省份,中间用英文逗号隔开
*/
@TableField(value = "position",typeHandler = FastjsonTypeHandler.class)
private ArrayList<String> position;
} }
...@@ -7,10 +7,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.Region; ...@@ -7,10 +7,7 @@ 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.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMapRegionService; import com.yeejoin.amos.boot.module.jxiop.api.service.IMapRegionService;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.TabDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test; import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitoringServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitoringServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.RegionServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.RegionServiceImpl;
...@@ -63,4 +60,16 @@ public class MonitoringMapController extends BaseController { ...@@ -63,4 +60,16 @@ public class MonitoringMapController extends BaseController {
public ResponseModel<List<TabDto>> getTabsByStationBasicId(@RequestParam(required = true) String stationBasicId) { public ResponseModel<List<TabDto>> getTabsByStationBasicId(@RequestParam(required = true) String stationBasicId) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId)); return ResponseHelper.buildResponse(monitoringServiceImpl.getTabsByStationBasicId(stationBasicId));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "首页地图-获取片区信息")
@GetMapping("/getAreaInfo")
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo());
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "地图首页接口")
// @GetMapping("/getMapInfoByAreaName")
// public ResponseModel<List<RegionNationWideDto>> getMapInfo(@RequestParam (value = "areaName", required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName));
// }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import java.util.List;
@Data
public class MapAreaInfoDto {
List<String> province;
List<String> position;
String areaName;
String areaCode;
String windPowerStationCount = "0";
String centralizedPhotovoltaicStationCount = "0";
String distributedPhotovoltaicStationCount = "0";
String energyStorageStationCount = "0";
String installedCapacity = "0";
String electricityGenerationOfDay = "0";
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.injector.methods.SelectOne; import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region; 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.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service @Service
...@@ -57,6 +51,10 @@ public class MonitoringServiceImpl { ...@@ -57,6 +51,10 @@ public class MonitoringServiceImpl {
@Autowired @Autowired
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
//维护的接口信息
@Autowired
MapRegionMapper mapRegionMapper;
/** /**
* 根据场站编号获取该场站的装机容量 * 根据场站编号获取该场站的装机容量
...@@ -202,7 +200,7 @@ public class MonitoringServiceImpl { ...@@ -202,7 +200,7 @@ public class MonitoringServiceImpl {
public List<TabDto> getTabsByStationBasicId(String stationBasicId) { public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId); StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>(); List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ")&&stationBasic.getStationType().length()<4) { if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0"); TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1"); TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2"); TabDto tab2 = new TabDto("运行列表", "2");
...@@ -235,4 +233,73 @@ public class MonitoringServiceImpl { ...@@ -235,4 +233,73 @@ public class MonitoringServiceImpl {
} }
return tabDtoList; return tabDtoList;
} }
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion -> {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stringArrayList.set(i, region.getRegionName());
stationBasicListAll.addAll(stationBasicList);
}
mapAreaInfoDto.setProvince(stringArrayList);
System.out.println(stationBasicListAll);
// --------------------省份名称处理结束----------------------------
//设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
//分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
//储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
//获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
//获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getStationNumber() != null) {
try {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
}
}
});
return String.format("%.2f",total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
try {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
}
}
});
return String.format("%.2f",total.get());
}
} }
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