WindTowerStatusDataController.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.jiayue.ipfcst.console.controller;
  2. import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
  3. import com.jiayue.ipfcst.console.service.WindTowerStatusDataService;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PathVariable;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import java.util.Date;
  10. import java.util.Map;
  11. /**
  12. * 测风塔数据restful接口
  13. *
  14. * @author yh
  15. * @version 1.0
  16. * @since 2019/8/7 10:12
  17. */
  18. @RestController
  19. @Slf4j
  20. public class WindTowerStatusDataController {
  21. private final WindTowerStatusDataService windTowerStatusDataService;
  22. @Autowired
  23. public WindTowerStatusDataController(WindTowerStatusDataService windTowerStatusDataService) {
  24. this.windTowerStatusDataService = windTowerStatusDataService;
  25. }
  26. // /**
  27. // * 分页查询 测风塔数据
  28. // * @param startTime 开始时间
  29. // * @param endTime 结束时间
  30. // * @param page 页码
  31. // * @param size 条数
  32. // * @param sortOrder 排序
  33. // * @return
  34. // */
  35. // @GetMapping(value = "/windTowerStatusData/{startTime}/{endTime}/{page}/{size}/{no}")
  36. // public ResponseVO findByTimeBetweenForPaging(@PathVariable("startTime") Long startTime,
  37. // @PathVariable("endTime") Long endTime,
  38. // @PathVariable("page") Integer page,
  39. // @PathVariable("size") Integer size,
  40. // @PathVariable("no") Integer no,
  41. // String sortOrder){
  42. // Map<String,Object> map = new HashMap<>();
  43. // try{
  44. // map = windTowerStatusDataService.findByTimeBetweenForPaging(new Date(startTime),new Date(endTime),page,size,no,sortOrder);
  45. // return ResponseVO.success(map);
  46. // }catch(Exception e){
  47. // e.printStackTrace();
  48. // log.error("测风塔数据分页查询错误");
  49. // return ResponseVO.fail(e.toString());
  50. // }
  51. // }
  52. @GetMapping(value = "/windTowerStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}")
  53. public ResponseVO findByTimeBetweenAndNoAndTimeStep(@PathVariable("stationCode") String stationCode, @PathVariable("startTime") Long startTime,
  54. @PathVariable("endTime") Long endTime,
  55. @PathVariable("page") Integer page,
  56. @PathVariable("size") Integer size,
  57. @PathVariable("no") String no) {
  58. Map<String, Object> map;
  59. try {
  60. map = windTowerStatusDataService.findByTimeBetweenAndNoAndTimeStep(stationCode, new Date(startTime), new Date(endTime), page, size, no);
  61. return ResponseVO.success(map);
  62. } catch (Exception e) {
  63. e.printStackTrace();
  64. log.error("测风数据分页查询错误");
  65. return ResponseVO.fail(e.toString());
  66. }
  67. }
  68. }