feat:新增太阳能辐射模拟与预报
parent
d26d9f2c23
commit
584056c038
@ -0,0 +1,85 @@
|
||||
package com.cuit.solarenergy.controller;
|
||||
|
||||
|
||||
import com.cuit.gis.analysis.solarradiation.RasterSolarRadiationOperation;
|
||||
import com.cuit.solarenergy.base.annotation.AopLog;
|
||||
import com.cuit.solarenergy.base.annotation.AuthToken;
|
||||
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.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 lombok.extern.slf4j.Slf4j;
|
||||
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.RestController;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "3、实时模拟与预报")
|
||||
@ApiSupport(order = 3)
|
||||
@Slf4j
|
||||
@RestController()
|
||||
public class SimulAndPredicController {
|
||||
|
||||
@Autowired
|
||||
SolarenergyService solarenergyService;
|
||||
|
||||
@AopLog
|
||||
@AuthToken
|
||||
@ApiOperation("1、辐射实时模拟")
|
||||
@PreAuthorize("hasAuthority('minio:upload')")
|
||||
@RequestMapping(value = "/solarenergy/getSolarSimulation", 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<String> getSolarSimulation() {
|
||||
try {
|
||||
log.info("太阳能日总辐射实时模拟");
|
||||
String s = solarenergyService.calSolarRadiation(RasterSolarRadiationOperation.SolarEadiationAnalysisType.DAY_TOTAL_SOLARRADIATION_AMOUNT, Calendar.getInstance(), 0, 2000);
|
||||
return RetResponse.makeOKRsp(s);
|
||||
}catch (RuntimeException e){
|
||||
return RetResponse.makeErrRsp("太阳能日总辐射实时模拟有误!"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@AopLog
|
||||
@AuthToken
|
||||
@ApiOperation("2、辐射预报")
|
||||
@PreAuthorize("hasAuthority('minio:upload')")
|
||||
@RequestMapping(value = "/solarenergy/getSolarPrediction", 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<String> getSolarPrediction() {
|
||||
try {
|
||||
log.info("太阳能日总辐射预报");
|
||||
// 获取当前日期和时间的 Calendar 对象
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// 给当前日期加3天
|
||||
calendar.add(Calendar.DATE, 3);
|
||||
String s = solarenergyService.calSolarRadiation(RasterSolarRadiationOperation.SolarEadiationAnalysisType.DAY_TOTAL_SOLARRADIATION_AMOUNT, calendar, 0, 2000);
|
||||
return RetResponse.makeOKRsp(s);
|
||||
}catch (RuntimeException e){
|
||||
return RetResponse.makeErrRsp("太阳能日总辐射实时模拟有误!"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue