fix:修改太阳能辐射模拟与预报

main
xlp 5 months ago
parent 5f519603a2
commit 528e346c83

@ -13,10 +13,7 @@ import com.cuit.solarenergy.service.DataImportService;
import com.cuit.solarenergy.service.GeoServerPubService;
import com.cuit.solarenergy.service.SolarenergyService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -58,10 +55,12 @@ public class SimulAndPredicController {
public RetResult<List<TGeoserverinfo>> getSolarSimulation(SolarPredicReq solarReq) {
try {
log.info("太阳能日总辐射实时模拟");
// 获取当前日期和时间的 Calendar 对象
String time = solarReq.getTime();
//1.辐射出图
String pathFile = solarenergyService.calSolarRadiation(RasterSolarRadiationOperation.SolarEadiationAnalysisType.DAY_TOTAL_SOLARRADIATION_AMOUNT,"", 0, 2000);
String pathFile = solarenergyService.calSolarRadiation(RasterSolarRadiationOperation.SolarEadiationAnalysisType.DAY_TOTAL_SOLARRADIATION_AMOUNT,time, 0, 2000);
//2.发布geoserverter服务并存入数据库
Long aLong = geoServerPubService.pubGeoServerAndSavetoDB("style_tyn", "EPSG:3857",pathFile, solarReq.getRegionname());
Long aLong = geoServerPubService.pubGeoServerAndSavetoDB("style_tynday", "EPSG:3857",pathFile, solarReq.getRegionname());
if (Objects.isNull(aLong)|| aLong == -1){
return RetResponse.makeErrRsp("太阳能日总辐射实时模拟服务有误");
}
@ -95,7 +94,7 @@ public class SimulAndPredicController {
//1.辐射出图
String pathFile = solarenergyService.calSolarRadiation(RasterSolarRadiationOperation.SolarEadiationAnalysisType.DAY_TOTAL_SOLARRADIATION_AMOUNT, time, 0, 2000);
//2.发布geoserverter服务并存入数据库
Long aLong = geoServerPubService.pubGeoServerAndSavetoDB("style_tyn", "EPSG:3857",pathFile, solarReq.getRegionname());
Long aLong = geoServerPubService.pubGeoServerAndSavetoDB("style_tynday", "EPSG:3857",pathFile, solarReq.getRegionname());
if (Objects.isNull(aLong)|| aLong == -1){
return RetResponse.makeErrRsp("太阳能日总辐射实时模拟服务有误");
}

@ -82,9 +82,9 @@ public class SolarenergyService {
* @param cloudcoverof10parts
*/
public String calSolarRadiation(RasterSolarRadiationOperation.SolarEadiationAnalysisType type, String time, double cloudcoverof10parts, int cellSize) {
//处理时间,如果为空,则为预测当时太阳辐射值,否则为指定日期太阳辐射值
//处理时间,如果不为空,则为预测指定日期太阳辐射值,否则为计算当前时间太阳辐射值
Calendar calendar = Calendar.getInstance();
if (StringUtils.isEmpty(time)){
if (!StringUtils.isEmpty(time) && !time.equals("")){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
calendar.setTime(simpleDateFormat.parse(time));

Loading…
Cancel
Save