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

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.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,9 +42,11 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
private final GardsNuclearFuelFacilitiesMapper nuclearFuelFacilitiesMapper;
private final GardsNuclearTestingPlantMapper nuclearTestingPlantMapper;
private final GardsAcceleratorMapper acceleratorMapper;
private final HttpClientHostProperties hostProperties;
/**
* 查询核设施站点信息
*
* @return
*/
@DS("ora")
@ -40,7 +54,8 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
public List<GardsNuclearReactors> getAllNuclearfacility() {
List<GardsNuclearReactors> nuclearReactors;
if (redisUtil.hasKey(CommonConstant.ALL_NUCLEARFACILITY)) {
nuclearReactors = (List<GardsNuclearReactors>) redisUtil.get(CommonConstant.ALL_NUCLEARFACILITY);
nuclearReactors =
(List<GardsNuclearReactors>) redisUtil.get(CommonConstant.ALL_NUCLEARFACILITY);
} else {
nuclearReactors = nuclearReactorsMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_NUCLEARFACILITY, nuclearReactors);
@ -50,6 +65,7 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
/**
* 查询反应堆站点信息
*
* @return
*/
@DS("ora")
@ -57,7 +73,8 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
public List<GardsResearchReactors> getAllResearchReactors() {
List<GardsResearchReactors> researchReactors;
if (redisUtil.hasKey(CommonConstant.ALL_RESEARCH_REACTORS)) {
researchReactors = (List<GardsResearchReactors>)redisUtil.get(CommonConstant.ALL_RESEARCH_REACTORS);
researchReactors = (List<GardsResearchReactors>) redisUtil.get(
CommonConstant.ALL_RESEARCH_REACTORS);
} else {
researchReactors = researchReactorsMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_RESEARCH_REACTORS, researchReactors);
@ -67,6 +84,7 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
/**
* 查询后处理厂站点信息
*
* @return
*/
@DS("ora")
@ -74,9 +92,11 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
public List<GardsNuclearFuelFacilities> getAllNuclearFuelFacilitiy() {
List<GardsNuclearFuelFacilities> nuclearFuelFacilities;
if (redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES)) {
nuclearFuelFacilities = (List<GardsNuclearFuelFacilities>)redisUtil.get(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES);
nuclearFuelFacilities = (List<GardsNuclearFuelFacilities>) redisUtil.get(
CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES);
} else {
nuclearFuelFacilities = nuclearFuelFacilitiesMapper.selectList(new LambdaQueryWrapper<>());
nuclearFuelFacilities =
nuclearFuelFacilitiesMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_NUCLEAR_FUEL_FACILITIES, nuclearFuelFacilities);
}
return nuclearFuelFacilities;
@ -84,6 +104,7 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
/**
* 查询核试验厂站点信息
*
* @return
*/
@DS("ora")
@ -91,7 +112,8 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
public List<GardsNuclearTestingPlant> getAllNuclearTestPlant() {
List<GardsNuclearTestingPlant> nuclearTestingPlants;
if (redisUtil.hasKey(CommonConstant.ALL_NUCLEAR_TEST_PLANT)) {
nuclearTestingPlants = (List<GardsNuclearTestingPlant>)redisUtil.get(CommonConstant.ALL_NUCLEAR_TEST_PLANT);
nuclearTestingPlants = (List<GardsNuclearTestingPlant>) redisUtil.get(
CommonConstant.ALL_NUCLEAR_TEST_PLANT);
} else {
nuclearTestingPlants = nuclearTestingPlantMapper.selectList(new LambdaQueryWrapper<>());
redisUtil.set(CommonConstant.ALL_NUCLEAR_TEST_PLANT, nuclearTestingPlants);
@ -104,6 +126,7 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
/**
* 查询加速器站点信息
*
* @return
*/
@DS("ora")
@ -131,19 +154,28 @@ public class MapSituationDisplayServiceImpl implements MapSituationDisplayServic
@DS("ora")
@Override
public List<DataProvisionEfficiencyVO> getDataProvisionEfficiency() {
String url = hostProperties.getArmdHost();
String apiUrl = url + "stationOperation/getDataProvisionEfficiency";
List<GardsStations> stations;
if (redisUtil.hasKey(CommonConstant.ALL_STATIONS)) {
stations = (List<GardsStations>)redisUtil.get(CommonConstant.ALL_STATIONS);;
stations = (List<GardsStations>) redisUtil.get(CommonConstant.ALL_STATIONS);
} else {
stations = stationsMapper.selectList(new LambdaQueryWrapper<>());
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<DataProvisionEfficiencyVO> dataProvisionEfficiency = ((JSONArray) obj).toJavaList(DataProvisionEfficiencyVO.class);
dataProvisionEfficiency.forEach(data -> {
//TODO 测试数据
//JSONObject jsonObject = JSON.parseObject(StationJsonData.getJson());
Map<String, String> getHeaders = Map.of("Authorization", "");
try {
ObjectMapper objectMapper = new ObjectMapper();
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) {
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();
}

View File

@ -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;
}