| | |
| | | package com.iailab.module.model.api.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.*; |
| | | import com.iailab.module.model.api.mdk.dto.StScheduleRecordVO; |
| | | import com.iailab.module.model.common.utils.ApiSecurityUtils; |
| | | import com.iailab.module.model.common.utils.ExcelUtil; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | return CommonResult.success(data); |
| | | } |
| | | |
| | | @PostMapping("/schedule-model/out") |
| | | @Operation(summary = "调度模型数据下发") |
| | | public Boolean scheduleModelOut(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody MdkScheduleRespDTO dto) throws Exception { |
| | | apiSecurityUtils.validate(request); |
| | | return mcsApi.scheduleModelOut(dto); |
| | | @PostMapping("/alarm-suggest/page") |
| | | @Operation(summary = "获取预警信息和调度建议分页列表") |
| | | public CommonResult<PageResult<StAlarmAndSuggestRespVO>> getAlarmAndSuggestPage(@RequestBody StAlarmAndSuggestPageReqVO reqVO) { |
| | | PageResult<StAlarmAndSuggestRespVO> page = mcsApi.getAlarmAndSuggestPage(reqVO); |
| | | return success(BeanUtils.toBean(page, StAlarmAndSuggestRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/chart/param/list") |
| | | @Operation(summary = "图表配置列表") |
| | | public CommonResult<List<ChartParamDTO>> getChartParamList(@RequestParam("chartCode") String chartCode) { |
| | | List<ChartParamDTO> chartParamList = mcsApi.getChartParamList(chartCode); |
| | | return CommonResult.success(chartParamList); |
| | | } |
| | | |
| | | @PostMapping("/predict-data/doubleValue") |
| | | @Operation(summary = "获取多个预测项Double类型数据") |
| | | public CommonResult<Map<String, Map<String,Double>>> getPreDoubleData(@RequestBody PreDoubleDataReqVO reqVO) { |
| | | Map<String, Map<String,Double>> map = mcsApi.getPreDoubleData(reqVO); |
| | | return CommonResult.success(map); |
| | | } |
| | | |
| | | @PostMapping("/predict-data/last-value") |
| | | @Operation(summary = "获取最后预测值") |
| | | public CommonResult<Map<String, BigDecimal>> getPredictLastValue(@RequestBody PredictLastValueReqVO reqVO) { |
| | | Map<String, BigDecimal> data = mcsApi.getPredictLastValue(reqVO); |
| | | return CommonResult.success(data); |
| | | } |
| | | |
| | | @GetMapping("/schedule-data/last") |
| | | @Operation(summary = "调度模型最新结果查询") |
| | | public CommonResult<List<StScheduleRecordVO>> getLastScheduleData(@RequestParam String scheduleCode, @RequestParam Integer limit) { |
| | | if (null == limit) { |
| | | limit = 1; |
| | | } |
| | | return CommonResult.success(mcsApi.getLastScheduleData(scheduleCode,limit)); |
| | | } |
| | | |
| | | @PostMapping("/schedule-data/last/more") |
| | | @Operation(summary = "多个调度模型最新结果查询") |
| | | public CommonResult<Map<String,List<StScheduleRecordVO>>> getMoreLastScheduleData(@RequestBody Map<String,Object> params) { |
| | | if (!params.containsKey("scheduleCodes")) { |
| | | return success(new HashMap<>()); |
| | | } |
| | | Set<String> scheduleCodes = new HashSet<>(((List<String>) params.get("scheduleCodes"))); |
| | | if (CollectionUtils.isEmpty(scheduleCodes)) { |
| | | return success(new HashMap<>()); |
| | | } |
| | | Integer limit = 1; |
| | | if (params.containsKey("limit")) { |
| | | limit = Integer.parseInt(params.get("limit").toString()); |
| | | } |
| | | |
| | | Map<String,List<StScheduleRecordVO>> result = new HashMap<>(scheduleCodes.size()); |
| | | for (String scheduleCode : scheduleCodes) { |
| | | result.put(scheduleCode,mcsApi.getLastScheduleData(scheduleCode, limit)); |
| | | } |
| | | return CommonResult.success(result); |
| | | } |
| | | |
| | | @PostMapping("/predict-data/itemNo") |
| | | @Operation(summary = "查询时间范围内预测结果") |
| | | CommonResult<Map<String,List<Object[]>>> getPredictDataItemNo(@RequestBody PreDataItemNoReqVO reqVO) { |
| | | return CommonResult.success(mcsApi.getPredictDataItemNo(reqVO)); |
| | | } |
| | | |
| | | @GetMapping("/electricityPrice/list") |
| | | @Operation(summary = "电价表") |
| | | public CommonResult<List<ElectricityPriceSegmentedDTO>> getElectricityPriceList(@RequestParam("year") String year, @RequestParam("time") String time) { |
| | | List<ElectricityPriceSegmentedDTO> electricityPriceSegmentedList = mcsApi.getElectricityPriceList(year, time); |
| | | return CommonResult.success(electricityPriceSegmentedList); |
| | | } |
| | | } |