|
@@ -3,6 +3,9 @@ package com.jiayue.biz.service.impl;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jiayue.biz.domain.*;
|
|
|
+import com.jiayue.biz.dto.EquipmentDto;
|
|
|
+import com.jiayue.biz.dto.ProjectInfoDto;
|
|
|
+import com.jiayue.biz.dto.SelectLabForVal;
|
|
|
import com.jiayue.biz.eunms.WindDirectionEnum;
|
|
|
import com.jiayue.biz.mapper.WindTowerDataParentTableMapper;
|
|
|
import com.jiayue.biz.service.*;
|
|
@@ -11,6 +14,7 @@ import com.jiayue.biz.util.DateTimeUtil;
|
|
|
import com.jiayue.common.core.redis.RedisCache;
|
|
|
import com.jiayue.common.utils.DateUtil;
|
|
|
import com.jiayue.common.utils.spring.SpringUtils;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -28,16 +32,25 @@ import java.util.stream.Collectors;
|
|
|
* @date 2022-05-11
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper, WindTowerDataParentTable> implements HomePageService {
|
|
|
private final WindTowerInfoService windTowerInfoService;
|
|
|
private final EquipmentAttributeService equipmentAttributeService;
|
|
|
private final WindTowerCalculationDataServiceImpl windTowerCalculationDataService;
|
|
|
- @Autowired
|
|
|
+
|
|
|
private final WindTowerDataParentTableService windTowerDataParentTableService;
|
|
|
private final StatisticsSituationService iStatisticsSituationService;
|
|
|
private final ProjectService projectService;
|
|
|
private final ElectricStationService electricStationService;
|
|
|
|
|
|
+ private final ProvincialEnergyStationsService provincialEnergyStationsService;
|
|
|
+
|
|
|
+ private final ProjectInfoService projectInfoService;
|
|
|
+ private final StationInfoService stationInfoService;
|
|
|
+
|
|
|
+ private final ProjectProgressService proProjectInfoService;
|
|
|
+ private final TotalityInfoService totalityInfoService;
|
|
|
+
|
|
|
private final BigDecimal threeParameterOne = new BigDecimal("1.146");
|
|
|
private final BigDecimal threeParameterTow = new BigDecimal("77.42");
|
|
|
private final BigDecimal threeParameterThree = new BigDecimal("1672");
|
|
@@ -46,36 +59,26 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
private final Double e = 10.0;
|
|
|
|
|
|
|
|
|
- public HomePageServiceImpl(ElectricStationService electricStationService, ProjectService projectService, WindTowerInfoService windTowerInfoService, EquipmentAttributeService equipmentAttributeService, WindTowerCalculationDataServiceImpl windTowerCalculationDataService, WindTowerDataParentTableService windTowerDataParentTableService, StatisticsSituationService iStatisticsSituationService) {
|
|
|
- this.windTowerInfoService = windTowerInfoService;
|
|
|
- this.equipmentAttributeService = equipmentAttributeService;
|
|
|
- this.windTowerCalculationDataService = windTowerCalculationDataService;
|
|
|
- this.windTowerDataParentTableService = windTowerDataParentTableService;
|
|
|
- this.iStatisticsSituationService = iStatisticsSituationService;
|
|
|
- this.projectService = projectService;
|
|
|
- this.electricStationService = electricStationService;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 风速 风功率 柱状图
|
|
|
*
|
|
|
* @param equipmentId 设备编号
|
|
|
* @return Map<String, Object>
|
|
|
*/
|
|
|
- public Map<String, Object> getWsAndWpdForHeight(String equipmentId,String month) {
|
|
|
+ public Map<String, Object> getWsAndWpdForHeight(String equipmentId, String month) {
|
|
|
List<WindTowerInfo> windTowerInfoList = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, equipmentId).list();
|
|
|
String[] heights = windTowerInfoList.get(0).getHeights().split(",");
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
- if(!month.equals("")){
|
|
|
+ if (!month.equals("")) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
try {
|
|
|
Date startDate = sdf.parse(month);
|
|
|
Date endDate = DateTimeUtil.endOfMonth(startDate);
|
|
|
- mapList = selectDataByBetweenTimeAndEquipmetId(startDate,endDate,equipmentId);
|
|
|
+ mapList = selectDataByBetweenTimeAndEquipmetId(startDate, endDate, equipmentId);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 最新一天数据
|
|
|
mapList = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
|
|
|
}
|
|
@@ -316,18 +319,18 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
* @return List<Map < String, Object>>
|
|
|
*/
|
|
|
@Override
|
|
|
- public HashMap<String, Object> homePageRose(String equipmentId, String height,String month) {
|
|
|
+ public HashMap<String, Object> homePageRose(String equipmentId, String height, String month) {
|
|
|
List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
- if(!month.equals("")){
|
|
|
+ if (!month.equals("")) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
try {
|
|
|
Date startDate = sdf.parse(month);
|
|
|
Date endDate = DateTimeUtil.endOfMonth(startDate);
|
|
|
- maps = selectDataByBetweenTimeAndEquipmetId(startDate,endDate,equipmentId);
|
|
|
+ maps = selectDataByBetweenTimeAndEquipmetId(startDate, endDate, equipmentId);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 最新一天数据
|
|
|
maps = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
|
|
|
}
|
|
@@ -418,18 +421,18 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
* @param equipmentId 设备编号
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Object> homePageCharts(String equipmentId,String month) {
|
|
|
+ public Map<String, Object> homePageCharts(String equipmentId, String month) {
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
- if(!month.equals("")){
|
|
|
+ if (!month.equals("")) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
try {
|
|
|
Date startDate = sdf.parse(month);
|
|
|
Date endDate = DateTimeUtil.endOfMonth(startDate);
|
|
|
- mapList = selectDataByBetweenTimeAndEquipmetId(startDate,endDate,equipmentId);
|
|
|
+ mapList = selectDataByBetweenTimeAndEquipmetId(startDate, endDate, equipmentId);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 最新一天数据
|
|
|
mapList = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
|
|
|
}
|
|
@@ -572,16 +575,16 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
*/
|
|
|
public Map<String, Object> getAirAndPaAndT(String equipmentId, String month) {
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
- if(!month.equals("")){
|
|
|
+ if (!month.equals("")) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
try {
|
|
|
Date startDate = sdf.parse(month);
|
|
|
Date endDate = DateTimeUtil.endOfMonth(startDate);
|
|
|
- mapList = selectDataByBetweenTimeAndEquipmetId(startDate,endDate,equipmentId);
|
|
|
+ mapList = selectDataByBetweenTimeAndEquipmetId(startDate, endDate, equipmentId);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 最新一天数据
|
|
|
mapList = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
|
|
|
}
|
|
@@ -657,8 +660,8 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
batterySum = batterySum.divide(BigDecimal.valueOf(6 * 1000), 2, RoundingMode.HALF_UP);
|
|
|
//满发小时数
|
|
|
BigDecimal hourMax = batterySum.divide(BigDecimal.valueOf(6.25), 2, RoundingMode.HALF_UP);
|
|
|
- dataMap.put("battery",batterySum);
|
|
|
- dataMap.put("hour",hourMax);
|
|
|
+ dataMap.put("battery", batterySum);
|
|
|
+ dataMap.put("hour", hourMax);
|
|
|
|
|
|
dataMap.put("t", tAve);
|
|
|
dataMap.put("air", airDensity);
|
|
@@ -668,6 +671,7 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
dataMap.put("height", height);
|
|
|
return dataMap;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 根据时间范围和设备id查询数据
|
|
|
*
|
|
@@ -678,7 +682,7 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
*/
|
|
|
public List<Map<String, Object>> selectDataByBetweenTimeAndEquipmetId(Date startTime, Date endTime, String equipmentId) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
- String key = "homepageWindDataSelect"+sdf.format(startTime)+equipmentId;
|
|
|
+ String key = "homepageWindDataSelect" + sdf.format(startTime) + equipmentId;
|
|
|
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(key);
|
|
|
if (ObjectUtil.isNotNull(cacheObj)) {
|
|
|
return (List<Map<String, Object>>) cacheObj;
|
|
@@ -687,4 +691,150 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
SpringUtils.getBean(RedisCache.class).setCacheObject(key, mapList);
|
|
|
return mapList;
|
|
|
}
|
|
|
+
|
|
|
+ //首页全省资源概述
|
|
|
+ public HashMap<String, String> getResourcesOverview() {
|
|
|
+ ProvincialEnergyStations provincialEnergyStations = provincialEnergyStationsService.getProvincialEnergyStations();
|
|
|
+ HashMap<String, String> hashMap = new HashMap<>();
|
|
|
+ hashMap.put("resourcesOverview", provincialEnergyStations.getResourcesOverview());
|
|
|
+ return hashMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取华电以及全省资源概况
|
|
|
+ public ProvincialEnergyStations getProvincialEnergyStations() {
|
|
|
+ return provincialEnergyStationsService.getProvincialEnergyStations();
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取项目类别以及项目概况
|
|
|
+ public HashMap<String, Object> getProjectSort() {
|
|
|
+ HashMap<String, Object> dataMap = new HashMap<>();
|
|
|
+ List<TotalityInfo> totalityInfos = totalityInfoService.selectTotalityInfoList();
|
|
|
+ List<ProjectInfo> projectInfoList = projectInfoService.getProjectInfoList();
|
|
|
+ //根据类别分组
|
|
|
+ Map<String, List<ProjectInfo>> four = projectInfoList.stream()
|
|
|
+ .filter(p -> !p.getProjectBasicInfo().getProjectSort().equals("four"))
|
|
|
+ .collect(Collectors.groupingBy((ProjectInfo pro) -> {
|
|
|
+ return pro.getProjectBasicInfo().getProjectSort();
|
|
|
+ }));
|
|
|
+ //循环数据 存放Id和项目名称
|
|
|
+ for (Map.Entry<String, List<ProjectInfo>> entry : four.entrySet()) {
|
|
|
+ ArrayList<ProjectInfoDto> projectInfoDtoList = new ArrayList<>();
|
|
|
+ for (ProjectInfo projectInfo : entry.getValue()) {
|
|
|
+ ProjectInfoDto projectInfoDto = new ProjectInfoDto();
|
|
|
+ projectInfoDto.setId(projectInfo.getId());
|
|
|
+ projectInfoDto.setProjectSort(projectInfo.getProjectBasicInfo().getProjectName());
|
|
|
+ projectInfoDtoList.add(projectInfoDto);
|
|
|
+ }
|
|
|
+ dataMap.put(entry.getKey(), projectInfoDtoList);
|
|
|
+ }
|
|
|
+ //项目基本信息
|
|
|
+ dataMap.put("pInfo", totalityInfos.get(0).getPInfo());
|
|
|
+
|
|
|
+ return dataMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询项目概况
|
|
|
+ public HashMap<String, Object> projectMapInfo(String projectId) {
|
|
|
+ HashMap<String, Object> dataMap = new HashMap<>();
|
|
|
+ List<ProjectInfo> projectInfoList = projectInfoService.getProjectInfoList();
|
|
|
+ //根据项目ID过滤指定数据
|
|
|
+ List<ProjectInfo> collect = projectInfoList.stream().filter(p -> p.getId().equals(projectId)).collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
+ ProjectInfo projectInfo = collect.get(0);
|
|
|
+ dataMap.put("projectOverview", projectInfo.getProjectBasicInfo().getProjectOverview());
|
|
|
+ dataMap.put("resourcesOverview", projectInfo.getProjectBasicInfo().getResourcesOverview());
|
|
|
+ //拐点坐标
|
|
|
+ dataMap.put("coordinates", projectInfo.getCoordinates());
|
|
|
+ }
|
|
|
+ //项目中所有的塔、拐点坐标、 TODO 地图四个角信息
|
|
|
+ return dataMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目测风塔下拉框
|
|
|
+ *
|
|
|
+ * @return List<SelectLabForVal>
|
|
|
+ */
|
|
|
+ public List<SelectLabForVal> projectSelect() {
|
|
|
+ List<ProjectInfo> projectInfoList = projectInfoService.getProjectInfoList();
|
|
|
+ ArrayList<SelectLabForVal> selectList = new ArrayList<>();
|
|
|
+ if (projectInfoList.size() > 0) {
|
|
|
+ //循环数据 放入项目id和项目名称
|
|
|
+ for (ProjectInfo projectInfo : projectInfoList) {
|
|
|
+ SelectLabForVal selectLabForVal = new SelectLabForVal();
|
|
|
+ selectLabForVal.setLabel(projectInfo.getProjectBasicInfo().getProjectNameEasy());
|
|
|
+ selectLabForVal.setValue(projectInfo.getId());
|
|
|
+ if (projectInfo.getEquipment().size() > 0) {
|
|
|
+ ArrayList<EquipmentDto> equipmentDtoList = new ArrayList<>();
|
|
|
+ //循环数据 放入测风塔id和测风塔名称
|
|
|
+ for (Equipment equipment : projectInfo.getEquipment()) {
|
|
|
+ EquipmentDto equipmentDto = new EquipmentDto();
|
|
|
+ equipmentDto.setLabel(equipment.getName());
|
|
|
+ equipmentDto.setValue(equipment.getId());
|
|
|
+ equipmentDtoList.add(equipmentDto);
|
|
|
+ }
|
|
|
+ selectLabForVal.setEquipmentDto(equipmentDtoList);
|
|
|
+ }
|
|
|
+ selectList.add(selectLabForVal);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return selectList;
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询场站信息以及场站列表
|
|
|
+ public HashMap<String, Object> getStationTotalityInfo() {
|
|
|
+ //总体信息
|
|
|
+ List<TotalityInfo> totalityInfos = totalityInfoService.selectTotalityInfoList();
|
|
|
+ //场站信息
|
|
|
+ List<StationInfo> stationInfos = stationInfoService.selectStationInfo();
|
|
|
+ HashMap<String, Object> stationMap = new HashMap<>();
|
|
|
+ if (totalityInfos.size() > 0) {
|
|
|
+ stationMap.put("fInfo", totalityInfos.get(0).getFInfo());
|
|
|
+ stationMap.put("gInfo", totalityInfos.get(0).getGInfo());
|
|
|
+ if (stationInfos.size() > 0) {
|
|
|
+ ArrayList<Object> arrayList = new ArrayList<>();
|
|
|
+ for (StationInfo stationInfo : stationInfos) {
|
|
|
+ HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
+ hashMap.put("id", stationInfo.getId());
|
|
|
+ hashMap.put("stationName", stationInfo.getStationBasicInfo().getStationName());
|
|
|
+ //经度
|
|
|
+ hashMap.put("longitude", stationInfo.getStationBasicInfo().getLongitude());
|
|
|
+ //纬度
|
|
|
+ hashMap.put("latitude", stationInfo.getStationBasicInfo().getLatitude());
|
|
|
+ arrayList.add(hashMap);
|
|
|
+ }
|
|
|
+ stationMap.put("station", arrayList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return stationMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询场站详细信息(风机、机型等)
|
|
|
+ */
|
|
|
+ public HashMap<String, Object> getStationInfo(String stationId) {
|
|
|
+ //场站信息
|
|
|
+ List<StationInfo> stationInfos = stationInfoService.selectStationInfo();
|
|
|
+ List<StationInfo> stationInfoList = stationInfos.stream().filter(s -> s.getId().equals(stationId)).collect(Collectors.toList());
|
|
|
+ HashMap<String, Object> dataMap = new HashMap<>();
|
|
|
+ if (stationInfoList.size() > 0) {
|
|
|
+ ArrayList<HashMap<String,Object>> arrayList = new ArrayList<>();
|
|
|
+ //根据风机类型分组
|
|
|
+ Map<String, List<FanTower>> modelMap = stationInfoList.get(0).getFanTowerList().stream()
|
|
|
+ .collect(Collectors.groupingBy(FanTower::getFanModel));
|
|
|
+ //遍历map指定key
|
|
|
+ for (Map.Entry<String, List<FanTower>> entry : modelMap.entrySet()) {
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("modelType", entry.getKey());
|
|
|
+ map.put("modelTotal", entry.getValue().size());
|
|
|
+ arrayList.add(map);
|
|
|
+ }
|
|
|
+ dataMap.put("modelT",arrayList);
|
|
|
+ dataMap.put("modelTower", stationInfoList.get(0).getFanTowerList());
|
|
|
+ }
|
|
|
+ return dataMap;
|
|
|
+ }
|
|
|
+
|
|
|
}
|