package com.jiayue.biz.controller; import com.jiayue.biz.service.*; import com.jiayue.common.annotation.Log; import com.jiayue.common.core.controller.BaseController; import com.jiayue.common.core.domain.AjaxResult; import com.jiayue.common.core.page.TableDataInfo; import com.jiayue.common.enums.BusinessType; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.List; import java.util.Map; @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/dataQuery/RealTimeDisplay") public class RealTimeDisplayController extends BaseController { @Autowired RealTimeDisplayService realTimeDisplayService; @Autowired WindTowerDataParentTableService windTowerDataParentTableService; //湍流 @RequestMapping("/turbulence") public TableDataInfo realDisplayTur(Long startTime, Long endTime, String equipmentId, String height) { List turbulence = realTimeDisplayService.turbulence(startTime, endTime, equipmentId, height); return getDataTable(turbulence); } //威布尔 @RequestMapping("/weibull") public TableDataInfo realDisplayWeibull(Long startTime, Long endTime, String equipmentId, String height) { List weibull = realTimeDisplayService.weibull(startTime, endTime, equipmentId, height); return getDataTable(weibull); } /*12个月的测风塔数据完整性*/ @GetMapping(value = "/dataIntegrity") public AjaxResult getDataIntegrity(String equipmentId) { return AjaxResult.success(realTimeDisplayService.dataIntegrity(equipmentId)); } /** * 风速风向折线图 * * @param startTime 开始时间 * @param endTime 结束时间 * @param equipmentId 测风塔编号 * @param height 层高 * @return 风速风向 */ @GetMapping("/wsAndWd") @ResponseBody public AjaxResult selectAll(Long startTime, Long endTime, String equipmentId, String height) { Map allWs = realTimeDisplayService.selectWsAndWd(startTime, endTime, equipmentId, height); return AjaxResult.success(allWs); } //获取测风塔数据最后一条数据时间到前一周数据 时间段内所有时间点 @GetMapping("/getStartTimeAndEndTime") public AjaxResult getStartTimeAndEndTime() { return AjaxResult.success(realTimeDisplayService.getStartTimeAndEndTime()); } //风功率密度(风向玫瑰图) @GetMapping(value = "/getWindEnergyDensity") public AjaxResult getTPAndAirDensity(Long startTime, Long endTime, String equipmentId, String height) throws Exception { return AjaxResult.success(realTimeDisplayService.getWindEnergyDensity(startTime, endTime, equipmentId, height)); } //获取风切变指数(风向玫瑰图) @GetMapping(value = "/getWindShear") public AjaxResult getWindShear(Long startTime, Long endTime, String equipmentId, String height,String heightMin) { return AjaxResult.success(realTimeDisplayService.getWindShear(startTime, endTime, equipmentId, height,heightMin)); } //获取湍流(风向玫瑰图) @GetMapping(value = "/getTurbulenceIntensity") public AjaxResult getTurbulenceIntensity(Long startTime, Long endTime, String equipmentId, String height) { return AjaxResult.success(realTimeDisplayService.getTurbulenceIntensity(startTime, endTime, equipmentId, height)); } //风况对比 @GetMapping(value = "/getWindPowerDensityAndAverageWindSpeed") public AjaxResult getWindPowerDensityAndAverageWindSpeed(Long startTime, Long endTime, String height, String eqId) { return AjaxResult.success(realTimeDisplayService.getWindPowerDensityAndAverageWindSpeed(startTime, endTime, height, eqId)); } /* * 风向玫瑰图 * */ @GetMapping(value = "/getWindRose") public AjaxResult getWindRose(Long startTime, Long endTime, String equipmentId, String height) { return AjaxResult.success(realTimeDisplayService.queryCharts(startTime, endTime, equipmentId, height)); } //空气密度 @GetMapping(value = "/getTPAndAirDensity") public AjaxResult getTPAndAirDensity(Long startTime, Long endTime, String equipmentId) { return AjaxResult.success(realTimeDisplayService.queryTPAndAirDensity(startTime, endTime, equipmentId)); } /** * 根据时间分页查询测风塔数据 */ @PostMapping("/time") public AjaxResult selectTime(Integer current, Integer size, Long startTime, Long endTime, String equipmentId) { return AjaxResult.success(windTowerDataParentTableService.selectDataPageByBetweenTimeAndEquipmetId(new Date(startTime), new Date(endTime), equipmentId, current, size)); } /** * 导出测风塔数据 */ @Log(title = "测风塔数据", businessType = BusinessType.EXPORT) @GetMapping("/export") public void export(HttpServletResponse response, Long startTime, Long endTime, String equipmentId) { windTowerDataParentTableService.export(response, startTime, endTime, equipmentId); } @Log(title = "测风塔数据文件", businessType = BusinessType.EXPORT) @GetMapping("/exportAll") public void exportAll(HttpServletRequest request, HttpServletResponse response, String equipmentId,Long startTime,Long endTime) { windTowerDataParentTableService.exportAll(request, response, equipmentId,startTime,endTime); } }