package com.jiayue.ipfcst.console.controller; import com.jiayue.ipfcst.common.core.web.vo.ResponseVO; import com.jiayue.ipfcst.console.service.WindTurbineStatusDataService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.Map; @RestController @Slf4j public class WindTurbineStatusDataController { private final WindTurbineStatusDataService windTurbineStatusDataService; @Autowired public WindTurbineStatusDataController(WindTurbineStatusDataService windTurbineStatusDataService) { this.windTurbineStatusDataService = windTurbineStatusDataService; } /** * 分页查询 所有风机功率状态 * * @param startTime 开始时间 * @param endTime 结束时间 * @param page 页码 * @param size 条数 * @param no 风机编号 * @return */ @GetMapping(value = "/windTurbineStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}") public ResponseVO findByTimeBetweenForPaging(@PathVariable("stationCode") String stationCode, @PathVariable("startTime") Long startTime, @PathVariable("endTime") Long endTime, @PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("no") String no) { Map map; try { map = windTurbineStatusDataService.findByTimeBetweenForPaging(stationCode, new Date(startTime), new Date(endTime), page, size, no); return ResponseVO.success(map); } catch (Exception e) { e.printStackTrace(); log.error("风机分页查询错误"); return ResponseVO.fail(e.toString()); } } /** * 分页查询 按设备编号查询风机状态 * * @param startTime 开始时间 * @param endTime 结束时间 * @param page 页码 * @param size 条数 * @return */ @GetMapping(value = "/windTurbineStatusData/{startTime}/{endTime}/{page}/{size}/{no}") public ResponseVO findByTimeBetweenForPaging(@PathVariable("startTime") Long startTime, @PathVariable("endTime") Long endTime, @PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("no") Integer[] no, String timeSortOrder, String noSortOrder) { Map map; try { map = windTurbineStatusDataService.findByTimeBetweenAndNoForPaging(new Date(startTime), new Date(endTime), page, size, no, timeSortOrder, noSortOrder); return ResponseVO.success(map); } catch (Exception e) { e.printStackTrace(); log.error("按设备号风机分页查询错误"); return ResponseVO.fail(e.toString()); } } }