修改台站有效率使用能谱分析系统数据

This commit is contained in:
duwenyuan 2025-12-31 16:26:12 +08:00
parent b7f9a6a04d
commit d7e2fb4ef5
2 changed files with 77 additions and 36 deletions

View File

@ -6,19 +6,31 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings; import org.apache.logging.log4j.util.Strings;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.properties.HttpClientHostProperties;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.gis.service.MapSituationDisplayService; import org.jeecg.gis.service.MapSituationDisplayService;
import org.jeecg.gis.service.StationJsonData; import org.jeecg.gis.service.StationJsonData;
import org.jeecg.gis.vo.DataProvisionEfficiencyVO; import org.jeecg.gis.vo.DataProvisionEfficiencyVO;
import org.jeecg.modules.base.entity.configuration.*; import org.jeecg.modules.base.entity.configuration.*;
import org.jeecg.modules.base.mapper.*; import org.jeecg.modules.base.mapper.*;
import org.jeecg.sysEmail.entity.SysEmail;
import org.jeecg.utils.HttpClientUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
@Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class MapSituationDisplayServiceImpl implements MapSituationDisplayService { public class MapSituationDisplayServiceImpl implements MapSituationDisplayService {
@ -30,18 +42,21 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
private final GardsNuclearFuelFacilitiesMapper nuclearFuelFacilitiesMapper; private final GardsNuclearFuelFacilitiesMapper nuclearFuelFacilitiesMapper;
private final GardsNuclearTestingPlantMapper nuclearTestingPlantMapper; private final GardsNuclearTestingPlantMapper nuclearTestingPlantMapper;
private final GardsAcceleratorMapper acceleratorMapper; private final GardsAcceleratorMapper acceleratorMapper;
private final HttpClientHostProperties hostProperties;
/** /**
* 查询核设施站点信息 * 查询核设施站点信息
*
* @return * @return
*/ */
@DS("ora") @DS("ora")
@Override @Override
public List<GardsNuclearReactors> getAllNuclearfacility() { public List<GardsNuclearReactors> getAllNuclearfacility() {
List<GardsNuclearReactors> nuclearReactors; List<GardsNuclearReactors> nuclearReactors;
if(redisUtil.hasKey(CommonConstant.ALL_NUCLEARFACILITY)){ if (redisUtil.hasKey(CommonConstant.ALL_NUCLEARFACILITY)) {
nuclearReactors = (List<GardsNuclearReactors>) redisUtil.get(CommonConstant.ALL_NUCLEARFACILITY); nuclearReactors =
}else { (List<GardsNuclearReactors>) redisUtil.get(CommonConstant.ALL_NUCLEARFACILITY);
} else {
nuclearReactors = nuclearReactorsMapper.selectList(new LambdaQueryWrapper<>()); nuclearReactors = nuclearReactorsMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_NUCLEARFACILITY, nuclearReactors); redisUtil.set(CommonConstant.ALL_NUCLEARFACILITY, nuclearReactors);
} }
@ -50,51 +65,58 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
/** /**
* 查询反应堆站点信息 * 查询反应堆站点信息
*
* @return * @return
*/ */
@DS("ora") @DS("ora")
@Override @Override
public List<GardsResearchReactors> getAllResearchReactors() { public List<GardsResearchReactors> getAllResearchReactors() {
List<GardsResearchReactors> researchReactors; List<GardsResearchReactors> researchReactors;
if(redisUtil.hasKey(CommonConstant.ALL_RESEARCH_REACTORS)){ if (redisUtil.hasKey(CommonConstant.ALL_RESEARCH_REACTORS)) {
researchReactors = (List<GardsResearchReactors>)redisUtil.get(CommonConstant.ALL_RESEARCH_REACTORS); researchReactors = (List<GardsResearchReactors>) redisUtil.get(
}else { CommonConstant.ALL_RESEARCH_REACTORS);
} else {
researchReactors = researchReactorsMapper.selectList(new LambdaQueryWrapper<>()); researchReactors = researchReactorsMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_RESEARCH_REACTORS,researchReactors); redisUtil.set(CommonConstant.ALL_RESEARCH_REACTORS, researchReactors);
} }
return researchReactors; return researchReactors;
} }
/** /**
* 查询后处理厂站点信息 * 查询后处理厂站点信息
*
* @return * @return
*/ */
@DS("ora") @DS("ora")
@Override @Override
public List<GardsNuclearFuelFacilities> getAllNuclearFuelFacilitiy() { public List<GardsNuclearFuelFacilities> getAllNuclearFuelFacilitiy() {
List<GardsNuclearFuelFacilities> nuclearFuelFacilities; List<GardsNuclearFuelFacilities> nuclearFuelFacilities;
if(redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES)){ if (redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES)) {
nuclearFuelFacilities = (List<GardsNuclearFuelFacilities>)redisUtil.get(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES); nuclearFuelFacilities = (List<GardsNuclearFuelFacilities>) redisUtil.get(
}else { CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES);
nuclearFuelFacilities = nuclearFuelFacilitiesMapper.selectList(new LambdaQueryWrapper<>()); } else {
redisUtil.set(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES,nuclearFuelFacilities); nuclearFuelFacilities =
nuclearFuelFacilitiesMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES, nuclearFuelFacilities);
} }
return nuclearFuelFacilities; return nuclearFuelFacilities;
} }
/** /**
* 查询核试验厂站点信息 * 查询核试验厂站点信息
*
* @return * @return
*/ */
@DS("ora") @DS("ora")
@Override @Override
public List<GardsNuclearTestingPlant> getAllNuclearTestPlant() { public List<GardsNuclearTestingPlant> getAllNuclearTestPlant() {
List<GardsNuclearTestingPlant> nuclearTestingPlants; List<GardsNuclearTestingPlant> nuclearTestingPlants;
if(redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_TEST_PLANT)){ if (redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_TEST_PLANT)) {
nuclearTestingPlants = (List<GardsNuclearTestingPlant>)redisUtil.get(CommonConstant.ALL_NUCLEAR_TEST_PLANT); nuclearTestingPlants = (List<GardsNuclearTestingPlant>) redisUtil.get(
}else { CommonConstant.ALL_NUCLEAR_TEST_PLANT);
} else {
nuclearTestingPlants = nuclearTestingPlantMapper.selectList(new LambdaQueryWrapper<>()); nuclearTestingPlants = nuclearTestingPlantMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_NUCLEAR_TEST_PLANT,nuclearTestingPlants); redisUtil.set(CommonConstant.ALL_NUCLEAR_TEST_PLANT, nuclearTestingPlants);
} }
nuclearTestingPlants.forEach(gardsNuclearTestingPlant -> { nuclearTestingPlants.forEach(gardsNuclearTestingPlant -> {
gardsNuclearTestingPlant.setInfo(Strings.EMPTY); gardsNuclearTestingPlant.setInfo(Strings.EMPTY);
@ -104,23 +126,24 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
/** /**
* 查询加速器站点信息 * 查询加速器站点信息
*
* @return * @return
*/ */
@DS("ora") @DS("ora")
@Override @Override
public List<GardsAccelerator> getAllAccelerator() { public List<GardsAccelerator> getAllAccelerator() {
List<GardsAccelerator> accelerators; List<GardsAccelerator> accelerators;
if(redisUtil.hasKey(CommonConstant.ALL_ACCELERATOR)){ if (redisUtil.hasKey(CommonConstant.ALL_ACCELERATOR)) {
accelerators = (List<GardsAccelerator>)redisUtil.get(CommonConstant.ALL_ACCELERATOR); accelerators = (List<GardsAccelerator>) redisUtil.get(CommonConstant.ALL_ACCELERATOR);
}else { } else {
accelerators = acceleratorMapper.selectList(new LambdaQueryWrapper<>()); accelerators = acceleratorMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_ACCELERATOR,accelerators); redisUtil.set(CommonConstant.ALL_ACCELERATOR, accelerators);
} }
accelerators.forEach(gardsAccelerator -> { accelerators.forEach(gardsAccelerator -> {
gardsAccelerator.setFacilityName(Strings.EMPTY); gardsAccelerator.setFacilityName(Strings.EMPTY);
gardsAccelerator.setWebsite(Strings.EMPTY); gardsAccelerator.setWebsite(Strings.EMPTY);
}); });
return accelerators; return accelerators;
} }
/** /**
@ -131,19 +154,28 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
@DS("ora") @DS("ora")
@Override @Override
public List<DataProvisionEfficiencyVO> getDataProvisionEfficiency() { public List<DataProvisionEfficiencyVO> getDataProvisionEfficiency() {
String url = hostProperties.getArmdHost();
String apiUrl = url + "stationOperation/getDataProvisionEfficiency";
List<GardsStations> stations; List<GardsStations> stations;
if(redisUtil.hasKey(CommonConstant.ALL_STATIONS)){ if (redisUtil.hasKey(CommonConstant.ALL_STATIONS)) {
stations = (List<GardsStations>)redisUtil.get(CommonConstant.ALL_STATIONS);; stations = (List<GardsStations>) redisUtil.get(CommonConstant.ALL_STATIONS);
}else { } else {
stations = stationsMapper.selectList(new LambdaQueryWrapper<>()); stations = stationsMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_STATIONS,stations); redisUtil.set(CommonConstant.ALL_STATIONS, stations);
} }
JSONObject jsonObject = JSON.parseObject(StationJsonData.getJson()); //TODO 测试数据
if (jsonObject.containsKey("result")) { //JSONObject jsonObject = JSON.parseObject(StationJsonData.getJson());
Object obj = jsonObject.get("result"); Map<String, String> getHeaders = Map.of("Authorization", "");
if (obj instanceof JSONArray && Objects.nonNull(obj)) { try {
List<DataProvisionEfficiencyVO> dataProvisionEfficiency = ((JSONArray) obj).toJavaList(DataProvisionEfficiencyVO.class); ObjectMapper objectMapper = new ObjectMapper();
dataProvisionEfficiency.forEach(data -> { String getResult = HttpClientUtil.doGet(apiUrl, getHeaders, true); // 启用 SSL
Result<List<DataProvisionEfficiencyVO>> result =
objectMapper.readValue(getResult, new TypeReference<>() {
});
if (Objects.equals(result.getCode(), Result.OK().getCode())) {
List<DataProvisionEfficiencyVO> effData = result.getResult();
effData.forEach(data -> {
for (GardsStations station : stations) { for (GardsStations station : stations) {
if (station.getStationCode().equals(data.getStationCode())) { if (station.getStationCode().equals(data.getStationCode())) {
data.setElevation(station.getElevation()); 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(); return CollUtil.newArrayList();
} }

View File

@ -3,13 +3,14 @@ package org.jeecg.gis.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 数据有效率 * 数据有效率
*/ */
@Data @Data
public class DataProvisionEfficiencyVO { public class DataProvisionEfficiencyVO implements Serializable {
private Integer id; private Integer id;
@ -41,9 +42,13 @@ public class DataProvisionEfficiencyVO {
private Double elevation; 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; private Date dateBegin;
@JsonFormat(pattern = "yyyy-Mm-dd",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date dateEnd; private Date dateEnd;
} }