Merge remote-tracking branch 'origin/main'

main
xlp 5 months ago
commit 4f700a341f

@ -2,14 +2,12 @@ package com.cuit.solarenergy.controller;
import com.cuit.solarenergy.base.annotation.AopLog;
import com.cuit.solarenergy.base.annotation.AuthToken;
import com.cuit.solarenergy.entity.BaseMapVoRet;
import com.cuit.solarenergy.entity.MonitorRet;
import com.cuit.solarenergy.entity.TGeoserverinfo;
import com.cuit.solarenergy.entity.*;
import com.cuit.solarenergy.entity.vo.ret.ElementValueRet;
import com.cuit.solarenergy.entity.vo.ret.RetResponse;
import com.cuit.solarenergy.entity.vo.ret.RetResult;
import com.cuit.solarenergy.exception.ParamsException;
import com.cuit.solarenergy.service.DataImportService;
import com.cuit.solarenergy.utils.ErrorMessage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
@ -21,9 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -165,10 +161,10 @@ public class DataController {
@ApiResponse(code = 500, message = "服务器内部错误"),
@ApiResponse(code = 900, message = "失败")
})
public RetResult<List<String>> getElementInfo() {
public RetResult<List<ElementRet>> getElementInfo() {
try {
log.info("查询要素详情");
List<String> element = dataImportService.getElementInfo();
List<ElementRet> element = dataImportService.getElementInfo();
return RetResponse.makeOKRsp(element);
}catch (ParamsException e){
return RetResponse.makeErrRsp("查询要素失败!"+e.getMessage());
@ -187,10 +183,10 @@ public class DataController {
@ApiResponse(code = 500, message = "服务器内部错误"),
@ApiResponse(code = 900, message = "失败")
})
public RetResult<List<String>> getValueByElement(String Element) {
public RetResult<List<ElementValue>> getValueByElement(String Element) {
try {
log.info("根据要素详情查询具体值");
List<String> value = dataImportService.getValueByElement(Element);
List<ElementValue> value = dataImportService.getValueByElement(Element);
return RetResponse.makeOKRsp(value);
}catch (ParamsException e){
return RetResponse.makeErrRsp("查询数据失败!"+e.getMessage());
@ -218,7 +214,7 @@ public class DataController {
return RetResponse.makeErrRsp("查询监测点详情失败!"+e.getMessage());
}
}
@AopLog
@AopLog
@AuthToken
@ApiOperation("9、获取数据时间")
@PreAuthorize("hasAuthority('minio:upload')")
@ -240,4 +236,26 @@ public class DataController {
return RetResponse.makeErrRsp("获取当前时间失败!"+e.getMessage());
}
}
@AopLog
@AuthToken
@ApiOperation("10、获取要素状态")
@PreAuthorize("hasAuthority('minio:upload')")
@RequestMapping(value = "/dataimport/getElementStatus", method = {RequestMethod.GET})
@ApiResponses({
@ApiResponse(code = 200, message = "成功"),
@ApiResponse(code = 401, message = "访问未经授权"),
@ApiResponse(code = 403, message = "访问被禁止的"),
@ApiResponse(code = 404, message = "未找到访问接口"),
@ApiResponse(code = 500, message = "服务器内部错误"),
@ApiResponse(code = 900, message = "失败")
})
public RetResult<List<ElementValueRet>> getElementStatus(String element) {
try {
log.info("获取当前要素状态");
List<ElementValueRet> currentTime = dataImportService.getElementStatus(element);
return RetResponse.makeOKRsp(currentTime);
}catch (ParamsException e){
return RetResponse.makeErrRsp("获取当前时间失败!"+e.getMessage());
}
}
}

@ -0,0 +1,52 @@
package com.cuit.solarenergy.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "要素返回类")
public class ElementRet {
/**
* W.m-2
*/
@ApiModelProperty(value = "总辐射辐照度 W.m-2")
@TableField(value = "V14311")
private String ;
/**
* W.m-2
*/
@ApiModelProperty(value = "净辐射辐照度 W.m-2")
@TableField(value = "V14312")
private String ;
/**
* W.m-2
*/
@ApiModelProperty(value = "直接辐射辐照度 W.m-2")
@TableField(value = "V14313")
private String ;
/**
* W.m-2
*/
@ApiModelProperty(value = "散射辐射辐照度 W.m-2")
@TableField(value = "V14314")
private String ;
/**
* W.m-2
*/
@ApiModelProperty(value = "反射辐射辐照度 W.m-2")
@TableField(value = "V14315")
private String ;
}

@ -0,0 +1,38 @@
package com.cuit.solarenergy.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "要素值返回类")
public class ElementValue {
/**
*
*/
@TableField(value = "Station_Id_C")
private String stationIdC;
/**
* °
*/
@TableField(value = "Lat")
private String lat;
/**
* °
*/
@TableField(value = "Lon")
private String lon;
/**
*
*/
@ApiModelProperty(value = "要素值")
private String elementvalue;
}

@ -1,4 +1,4 @@
package generator.domain;
package com.cuit.solarenergy.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;

@ -0,0 +1,47 @@
package com.cuit.solarenergy.entity.vo.ret;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "要素值状态返回类")
public class ElementValueRet {
/**
*
*/
@ApiModelProperty(value = "站点名")
@TableField(value = "Station_Id_C")
private String stationIdC;
/**
* °
*/
@ApiModelProperty(value = "纬度")
@TableField(value = "Lat")
private String lat;
/**
* °
*/
@ApiModelProperty(value = "经度")
@TableField(value = "Lon")
private String lon;
/**
*
*/
@ApiModelProperty(value = "要素值")
private String elementvalue;
/**
*
*/
@ApiModelProperty(value = "状态")
private String status;
}

@ -2,6 +2,7 @@ package com.cuit.solarenergy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cuit.solarenergy.entity.ElementValue;
import com.cuit.solarenergy.entity.MapService;
import com.cuit.solarenergy.entity.TSamplingDataDetails;
import com.cuit.solarenergy.entity.vo.req.MultiRSDetectionReq;
@ -105,6 +106,20 @@ public interface TSamplingDataDetailsMapper extends BaseMapper<TSamplingDataDeta
List<YearAndCountVoRet> getAllInfoForThreeYear(String streamName);
/**
* @Description:
* @param element
* @return
*/
List<ElementValue> getValueByElement(String element);
/**
* @Description:
* @param mappedElementCode
* @return
*/
List<ElementValueRet> getElementStatus(String mappedElementCode);
}

@ -2,18 +2,26 @@ package com.cuit.solarenergy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import generator.domain.radi_chn_mul_hor;
import com.cuit.solarenergy.entity.ElementRet;
import com.cuit.solarenergy.entity.radi_chn_mul_hor;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author
* @description radi_chn_mul_horMapper
* @createDate 2024-11-27 14:23:48
* @Entity generator.domain.radi_chn_mul_hor
* @Entity com.cuit.solarenergy.entity.radi_chn_mul_hor
*/
@Mapper
public interface radi_chn_mul_horMapper extends BaseMapper<radi_chn_mul_hor> {
/**
*
* @return
*/
List<ElementRet> getElementInfo();
}

@ -1,9 +1,8 @@
package com.cuit.solarenergy.service;
import com.cuit.solarenergy.entity.BaseMapVoRet;
import com.cuit.solarenergy.entity.MonitorRet;
import com.cuit.solarenergy.entity.TGeoserverinfo;
import com.cuit.solarenergy.entity.*;
import com.cuit.solarenergy.entity.vo.ret.ElementValueRet;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -103,16 +102,17 @@ public interface DataImportService {
/**
*
*
* @return
*/
List<String> getElementInfo();
List<ElementRet> getElementInfo();
/**
*
* @param element
* @return
*/
List<String> getValueByElement(String element);
List<ElementValue> getValueByElement(String element);
/**
*
@ -132,4 +132,11 @@ public interface DataImportService {
* @return
*/
List<BaseMapVoRet> getBaseMapList();
/**
*
* @return
*/
List<ElementValueRet> getElementStatus(String element);
}

@ -8,15 +8,15 @@ import com.alibaba.excel.read.metadata.ReadSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.beust.jcommander.internal.Nullable;
import com.cuit.mete.geoserver.GeoServerConfig;
import com.cuit.solarenergy.config.LayerDispConfig;
import com.cuit.solarenergy.config.MyGeoServerConfig;
import com.cuit.solarenergy.entity.*;
import com.cuit.solarenergy.entity.vo.ret.ElementValueRet;
import com.cuit.solarenergy.exception.ParamsException;
import com.cuit.solarenergy.mapper.TGeoserverinfoMapper;
import com.cuit.solarenergy.mapper.TSamplingDataDetailsMapper;
import com.cuit.solarenergy.mapper.TSiteBaseInfoMapper;
import com.cuit.solarenergy.mapper.radi_chn_mul_horMapper;
import com.cuit.solarenergy.model.poi.listener.ExcelUtil;
import com.cuit.solarenergy.model.poi.listener.ImportExcelListener;
import com.cuit.solarenergy.model.poi.listener.head.DataManageExcelModel;
@ -67,6 +67,9 @@ public class DataImportServiceImpl implements DataImportService {
LayerDispConfig layerDispConfig;
@Autowired
MyGeoServerConfig mygeoServerConfig;
@Autowired
radi_chn_mul_horMapper radichnmulhorMapper;
@ -461,14 +464,10 @@ public class DataImportServiceImpl implements DataImportService {
}
@Override
public List<String> getElementInfo() {
public List<ElementRet> getElementInfo() {
try {
List<String> elementInfo = new ArrayList<>();
elementInfo.add("辐射最大值");
elementInfo.add("辐射最小值");
elementInfo.add("紫外线最大值");
elementInfo.add("紫外线最小值");
elementInfo.add("日辐射量");
List<ElementRet> elementInfo = new ArrayList<>();
elementInfo = radichnmulhorMapper.getElementInfo();
return elementInfo;
}catch (ParamsException e){
return null;
@ -476,34 +475,30 @@ public class DataImportServiceImpl implements DataImportService {
}
@Override
public List<String> getValueByElement(String element) {
List retValue;
try {
retValue = new ArrayList<>();
switch (element) {
case "辐射最大值":
retValue.add(10);
break;
case "辐射最小值":
retValue.add(1);
break;
case "紫外线最大值":
retValue.add(20);
break;
case "紫外线最小值":
retValue.add(2);
break;
case "日辐射量":
retValue.add(5);
break;
default:
retValue = null;
break;
}
} catch (ParamsException e) {
return null;
public List<ElementValue> getValueByElement(String element) {
Map<String, String> elementMap = new HashMap<String, String>() {{
put("总辐射辐照度", "V14311");
put("净辐射辐照度", "V14312");
put("直接辐射辐照度", "V14313");
put("散射辐射辐照度", "V14314");
put("反射辐射辐照度", "V14315");
}};
try {
List<ElementValue> retValue = new ArrayList<>();
// 检查传入的中文element是否在映射关系中
String mappedElementCode = elementMap.get(element);
if (mappedElementCode != null) {
// 如果在映射关系中,使用对应的英文代码去查询数据库
retValue = tSamplingDataDetailsMapper.getValueByElement(element); // 这里传入的是中文元素名称
}
return retValue;
if (retValue != null && !retValue.isEmpty()) {
return retValue;
}
} catch (ParamsException e) {
throw new RuntimeException("Failed to get element info", e);
}
return null;
}
@Override
@ -589,6 +584,41 @@ public class DataImportServiceImpl implements DataImportService {
return baseMapVoRetList;
}
@Override
public List<ElementValueRet> getElementStatus(String element) {
Map<String, String> elementMap = new HashMap<String, String>() {{
put("总辐射辐照度", "V14311");
put("净辐射辐照度", "V14312");
put("直接辐射辐照度", "V14313");
put("散射辐射辐照度", "V14314");
put("反射辐射辐照度", "V14315");
}};
try {
List<ElementValueRet> retValue = new ArrayList<>();
// 检查传入的中文element是否在映射关系中
String mappedElementCode = elementMap.get(element);
if (mappedElementCode == null) {
// 如果映射关系中没有对应的代码,返回空列表或者抛出异常
return retValue; // 或者抛出一个自定义异常
}
// 如果在映射关系中,使用对应的英文代码去查询数据库
List<ElementValueRet> dbValues = tSamplingDataDetailsMapper.getElementStatus(mappedElementCode);
if (dbValues != null) {
for (ElementValueRet value : dbValues) {
if (value != null) {
// 设置status为"正常"
value.setStatus("正常");
retValue.add(value);
}
}
}
return retValue;
} catch (ParamsException e) {
throw new RuntimeException("Failed to get element info", e);
}
}
private String getURL(TGeoserverinfo geoBasedatageoserverinfo) {
String url = "";
String geoServerURL = "";

@ -1,7 +1,7 @@
package com.cuit.solarenergy.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import generator.domain.radi_chn_mul_hor;
import com.cuit.solarenergy.entity.radi_chn_mul_hor;
import com.cuit.solarenergy.service.radi_chn_mul_horService;
import com.cuit.solarenergy.mapper.radi_chn_mul_horMapper;
import org.springframework.stereotype.Service;

@ -1,6 +1,6 @@
package com.cuit.solarenergy.service;
import generator.domain.radi_chn_mul_hor;
import com.cuit.solarenergy.entity.radi_chn_mul_hor;
import com.baomidou.mybatisplus.extension.service.IService;
/**

@ -339,6 +339,52 @@
ORDER BY
year;
</select>
<select id="getValueByElement" resultType="com.cuit.solarenergy.entity.ElementValue">
<choose>
<when test="_parameter == '总辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14311 AS ElementValue
</when>
<when test="_parameter == '净辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14312 AS ElementValue
</when>
<when test="_parameter == '直接辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14313 AS ElementValue
</when>
<when test="_parameter == '散射辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14314 AS ElementValue
</when>
<when test="_parameter == '反射辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14315 AS ElementValue
</when>
<otherwise>
SELECT Station_Id_C, Lat, Lon, V14311 AS ElementValue, V14312 AS ElementValue, V14313 AS ElementValue, V14314 AS ElementValue, V14315 AS ElementValue
</otherwise>
</choose>
FROM radi_chn_mul_hor
</select>
<select id="getElementStatus" resultType="com.cuit.solarenergy.entity.vo.ret.ElementValueRet">
<choose>
<when test="_parameter == '总辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14311 AS ElementValue
</when>
<when test="_parameter == '净辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14312 AS ElementValue
</when>
<when test="_parameter == '直接辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14313 AS ElementValue
</when>
<when test="_parameter == '散射辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14314 AS ElementValue
</when>
<when test="_parameter == '反射辐射辐照度'">
SELECT Station_Id_C, Lat, Lon, V14315 AS ElementValue
</when>
<otherwise>
SELECT Station_Id_C, Lat, Lon, V14311 AS ElementValue, V14312 AS ElementValue, V14313 AS ElementValue, V14314 AS ElementValue, V14315 AS ElementValue
</otherwise>
</choose>
FROM radi_chn_mul_hor
</select>
<!-- 数据管理模块编辑接口-->

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cuit.solarenergy.mapper.radi_chn_mul_horMapper">
<resultMap id="BaseResultMap" type="generator.domain.radi_chn_mul_hor">
<resultMap id="BaseResultMap" type="com.cuit.solarenergy.entity.radi_chn_mul_hor">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="station_Id_C" column="Station_Id_C" jdbcType="VARCHAR"/>
<result property="station_levl" column="Station_levl" jdbcType="VARCHAR"/>
@ -89,4 +89,8 @@
RRA_Max_OTime,V14307,V14316_05,
UV_Max_OTime,SSH,API
</sql>
<select id="getElementInfo" resultType="com.cuit.solarenergy.entity.ElementRet">
SELECT V14311 AS '总辐射辐照度', V14312 AS '净辐射辐照度', V14313 AS '直接辐射辐照度', V14314 AS '散射辐射辐照度', V14315 AS '反射辐射辐照度'
FROM radi_chn_mul_hor LIMIT 1
</select>
</mapper>

@ -2,16 +2,13 @@ package com.cuit.solarenergy;
import com.cuit.solarenergy.service.radi_chn_mul_horService;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.cuit.gis.analysis.solarradiation.RasterSolarRadiationOperation;
import com.cuit.mete.musicutil.MusicQueryParameters;
import com.cuit.mete.musicutil.RadifEleInterface;
import com.cuit.mete.musicutil.SurfEleInterface;
import com.cuit.mete.musicutil.exception.*;
import com.cuit.solarenergy.service.SolarenergyService;
import generator.domain.radi_chn_mul_hor;
import com.cuit.solarenergy.entity.radi_chn_mul_hor;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

Loading…
Cancel
Save