From d7e2fb4ef57d2fba752f6c7a25995b0b1aee98a2 Mon Sep 17 00:00:00 2001 From: duwenyuan <15600000461@163.com> Date: Wed, 31 Dec 2025 16:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=B0=E7=AB=99=E6=9C=89?= =?UTF-8?q?=E6=95=88=E7=8E=87=E4=BD=BF=E7=94=A8=E8=83=BD=E8=B0=B1=E5=88=86?= =?UTF-8?q?=E6=9E=90=E7=B3=BB=E7=BB=9F=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MapSituationDisplayServiceImpl.java | 102 ++++++++++++------ .../gis/vo/DataProvisionEfficiencyVO.java | 11 +- 2 files changed, 77 insertions(+), 36 deletions(-) diff --git a/jeecg-module-large-screen/src/main/java/org/jeecg/gis/service/impl/MapSituationDisplayServiceImpl.java b/jeecg-module-large-screen/src/main/java/org/jeecg/gis/service/impl/MapSituationDisplayServiceImpl.java index 4c2f91c..7a56a77 100644 --- a/jeecg-module-large-screen/src/main/java/org/jeecg/gis/service/impl/MapSituationDisplayServiceImpl.java +++ b/jeecg-module-large-screen/src/main/java/org/jeecg/gis/service/impl/MapSituationDisplayServiceImpl.java @@ -6,19 +6,31 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.logging.log4j.util.Strings; +import org.jeecg.common.api.vo.Result; import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.properties.HttpClientHostProperties; import org.jeecg.common.util.RedisUtil; import org.jeecg.gis.service.MapSituationDisplayService; import org.jeecg.gis.service.StationJsonData; import org.jeecg.gis.vo.DataProvisionEfficiencyVO; import org.jeecg.modules.base.entity.configuration.*; import org.jeecg.modules.base.mapper.*; +import org.jeecg.sysEmail.entity.SysEmail; +import org.jeecg.utils.HttpClientUtil; import org.springframework.stereotype.Service; + +import java.io.IOException; import java.util.List; +import java.util.Map; import java.util.Objects; + +@Slf4j @Service @RequiredArgsConstructor public class MapSituationDisplayServiceImpl implements MapSituationDisplayService { @@ -30,18 +42,21 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic private final GardsNuclearFuelFacilitiesMapper nuclearFuelFacilitiesMapper; private final GardsNuclearTestingPlantMapper nuclearTestingPlantMapper; private final GardsAcceleratorMapper acceleratorMapper; + private final HttpClientHostProperties hostProperties; /** * 查询核设施站点信息 + * * @return */ @DS("ora") @Override public List getAllNuclearfacility() { List nuclearReactors; - if(redisUtil.hasKey(CommonConstant.ALL_NUCLEARFACILITY)){ - nuclearReactors = (List) redisUtil.get(CommonConstant.ALL_NUCLEARFACILITY); - }else { + if (redisUtil.hasKey(CommonConstant.ALL_NUCLEARFACILITY)) { + nuclearReactors = + (List) redisUtil.get(CommonConstant.ALL_NUCLEARFACILITY); + } else { nuclearReactors = nuclearReactorsMapper.selectList(new LambdaQueryWrapper<>()); redisUtil.set(CommonConstant.ALL_NUCLEARFACILITY, nuclearReactors); } @@ -50,51 +65,58 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic /** * 查询反应堆站点信息 + * * @return */ @DS("ora") @Override public List getAllResearchReactors() { List researchReactors; - if(redisUtil.hasKey(CommonConstant.ALL_RESEARCH_REACTORS)){ - researchReactors = (List)redisUtil.get(CommonConstant.ALL_RESEARCH_REACTORS); - }else { + if (redisUtil.hasKey(CommonConstant.ALL_RESEARCH_REACTORS)) { + researchReactors = (List) redisUtil.get( + CommonConstant.ALL_RESEARCH_REACTORS); + } else { researchReactors = researchReactorsMapper.selectList(new LambdaQueryWrapper<>()); - redisUtil.set(CommonConstant.ALL_RESEARCH_REACTORS,researchReactors); + redisUtil.set(CommonConstant.ALL_RESEARCH_REACTORS, researchReactors); } return researchReactors; } /** * 查询后处理厂站点信息 + * * @return */ @DS("ora") @Override public List getAllNuclearFuelFacilitiy() { List nuclearFuelFacilities; - if(redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES)){ - nuclearFuelFacilities = (List)redisUtil.get(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES); - }else { - nuclearFuelFacilities = nuclearFuelFacilitiesMapper.selectList(new LambdaQueryWrapper<>()); - redisUtil.set(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES,nuclearFuelFacilities); + if (redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES)) { + nuclearFuelFacilities = (List) redisUtil.get( + CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES); + } else { + nuclearFuelFacilities = + nuclearFuelFacilitiesMapper.selectList(new LambdaQueryWrapper<>()); + redisUtil.set(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES, nuclearFuelFacilities); } - return nuclearFuelFacilities; + return nuclearFuelFacilities; } /** * 查询核试验厂站点信息 + * * @return */ @DS("ora") @Override public List getAllNuclearTestPlant() { List nuclearTestingPlants; - if(redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_TEST_PLANT)){ - nuclearTestingPlants = (List)redisUtil.get(CommonConstant.ALL_NUCLEAR_TEST_PLANT); - }else { + if (redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_TEST_PLANT)) { + nuclearTestingPlants = (List) redisUtil.get( + CommonConstant.ALL_NUCLEAR_TEST_PLANT); + } else { nuclearTestingPlants = nuclearTestingPlantMapper.selectList(new LambdaQueryWrapper<>()); - redisUtil.set(CommonConstant.ALL_NUCLEAR_TEST_PLANT,nuclearTestingPlants); + redisUtil.set(CommonConstant.ALL_NUCLEAR_TEST_PLANT, nuclearTestingPlants); } nuclearTestingPlants.forEach(gardsNuclearTestingPlant -> { gardsNuclearTestingPlant.setInfo(Strings.EMPTY); @@ -104,23 +126,24 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic /** * 查询加速器站点信息 + * * @return */ @DS("ora") @Override public List getAllAccelerator() { List accelerators; - if(redisUtil.hasKey(CommonConstant.ALL_ACCELERATOR)){ - accelerators = (List)redisUtil.get(CommonConstant.ALL_ACCELERATOR); - }else { + if (redisUtil.hasKey(CommonConstant.ALL_ACCELERATOR)) { + accelerators = (List) redisUtil.get(CommonConstant.ALL_ACCELERATOR); + } else { accelerators = acceleratorMapper.selectList(new LambdaQueryWrapper<>()); - redisUtil.set(CommonConstant.ALL_ACCELERATOR,accelerators); + redisUtil.set(CommonConstant.ALL_ACCELERATOR, accelerators); } accelerators.forEach(gardsAccelerator -> { gardsAccelerator.setFacilityName(Strings.EMPTY); gardsAccelerator.setWebsite(Strings.EMPTY); }); - return accelerators; + return accelerators; } /** @@ -131,19 +154,28 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic @DS("ora") @Override public List getDataProvisionEfficiency() { + + String url = hostProperties.getArmdHost(); + String apiUrl = url + "stationOperation/getDataProvisionEfficiency"; List stations; - if(redisUtil.hasKey(CommonConstant.ALL_STATIONS)){ - stations = (List)redisUtil.get(CommonConstant.ALL_STATIONS);; - }else { + if (redisUtil.hasKey(CommonConstant.ALL_STATIONS)) { + stations = (List) redisUtil.get(CommonConstant.ALL_STATIONS); + } else { stations = stationsMapper.selectList(new LambdaQueryWrapper<>()); - redisUtil.set(CommonConstant.ALL_STATIONS,stations); + redisUtil.set(CommonConstant.ALL_STATIONS, stations); } - JSONObject jsonObject = JSON.parseObject(StationJsonData.getJson()); - if (jsonObject.containsKey("result")) { - Object obj = jsonObject.get("result"); - if (obj instanceof JSONArray && Objects.nonNull(obj)) { - List dataProvisionEfficiency = ((JSONArray) obj).toJavaList(DataProvisionEfficiencyVO.class); - dataProvisionEfficiency.forEach(data -> { + //TODO 测试数据 + //JSONObject jsonObject = JSON.parseObject(StationJsonData.getJson()); + Map getHeaders = Map.of("Authorization", ""); + try { + ObjectMapper objectMapper = new ObjectMapper(); + String getResult = HttpClientUtil.doGet(apiUrl, getHeaders, true); // 启用 SSL + Result> result = + objectMapper.readValue(getResult, new TypeReference<>() { + }); + if (Objects.equals(result.getCode(), Result.OK().getCode())) { + List effData = result.getResult(); + effData.forEach(data -> { for (GardsStations station : stations) { if (station.getStationCode().equals(data.getStationCode())) { data.setElevation(station.getElevation()); @@ -152,8 +184,12 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic } } }); - return dataProvisionEfficiency; + return effData; + } else { + return CollUtil.newArrayList(); } + } catch (IOException ex) { + log.error(ex.getMessage(), ex); } return CollUtil.newArrayList(); } diff --git a/jeecg-module-large-screen/src/main/java/org/jeecg/gis/vo/DataProvisionEfficiencyVO.java b/jeecg-module-large-screen/src/main/java/org/jeecg/gis/vo/DataProvisionEfficiencyVO.java index 3b792f1..2946552 100644 --- a/jeecg-module-large-screen/src/main/java/org/jeecg/gis/vo/DataProvisionEfficiencyVO.java +++ b/jeecg-module-large-screen/src/main/java/org/jeecg/gis/vo/DataProvisionEfficiencyVO.java @@ -3,13 +3,14 @@ package org.jeecg.gis.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import java.io.Serializable; import java.util.Date; /** * 数据有效率 */ @Data -public class DataProvisionEfficiencyVO { +public class DataProvisionEfficiencyVO implements Serializable { private Integer id; @@ -41,9 +42,13 @@ public class DataProvisionEfficiencyVO { private Double elevation; - @JsonFormat(pattern = "yyyy-Mm-dd",timezone = "GMT+8") + private String used; + + private String efficCalculType; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date dateBegin; - @JsonFormat(pattern = "yyyy-Mm-dd",timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date dateEnd; }