1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package com.jiayue.ipfcst.console.controller;
- import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
- import com.jiayue.ipfcst.console.service.NwpService;
- 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.Map;
- /**
- * NWP信息restful接口
- *
- * @author yh
- * @version 1.0
- * @since 2019/8/7 10:12
- */
- @RestController
- @Slf4j
- public class NwpController {
- private final NwpService nwpService;
- @Autowired
- public NwpController(NwpService nwpService) {
- this.nwpService = nwpService;
- }
- /**
- * 按时间查询实时nwp yh
- *
- * @param startTime 开始时间
- * @param endTime 结束时间
- * @return 结果集
- */
- @GetMapping(value = "/nwp/{startTime}/{endTime}/{stationCode}")
- public ResponseVO findByForecastTimeBetween(@PathVariable("startTime") Long startTime,
- @PathVariable("endTime") Long endTime,
- @PathVariable("stationCode") String stationCode) {
- Map<String, Object> map;
- try {
- map = nwpService.findByForecastTimeBetween(startTime, endTime, stationCode);
- return ResponseVO.success(map);
- } catch (Exception e) {
- e.printStackTrace();
- log.error("nwp实时查询错误");
- return ResponseVO.fail(e.toString());
- }
- }
- /**
- * 分页查询 实时nwp
- *
- * @param startTime 开始时间
- * @param endTime 结束时间
- * @param page 页码
- * @param size 条数
- * @param sortOrder 排序
- * @return
- */
- @GetMapping(value = "/nwp/{startTime}/{endTime}/{stationCode}/{page}/{size}")
- public ResponseVO findByTimeBetweenForPaging(@PathVariable("startTime") Long startTime,
- @PathVariable("endTime") Long endTime,
- @PathVariable("stationCode") String stationCode,
- @PathVariable("page") Integer page,
- @PathVariable("size") Integer size,
- String sortOrder) {
- Map<String, Object> map;
- try {
- map = nwpService.findByTimeBetweenAndNoForPaging(startTime, endTime, stationCode, page, size, sortOrder);
- return ResponseVO.success(map);
- } catch (Exception e) {
- e.printStackTrace();
- log.error("nwp实时分页查询错误");
- return ResponseVO.fail(e.toString());
- }
- }
- }
|