¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yssh.controller; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import com.yssh.entity.*; |
| | | import com.yssh.service.CommonService; |
| | | import com.yssh.service.SocketService; |
| | | import com.yssh.service.VocValsService; |
| | | import com.yssh.utils.DateUtils; |
| | | import com.yssh.utils.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.yssh.service.SuYuanService; |
| | | import com.yssh.utils.Result; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Api(tags="溯æºä¿¡æ¯") |
| | | @RestController |
| | | @RequestMapping("/suYuan") |
| | | @SuppressWarnings("rawtypes") |
| | | public class SuYuanController { |
| | | @Resource |
| | | private CommonService commonService; |
| | | |
| | | @Resource |
| | | private SuYuanService suYuanService; |
| | | |
| | | @Resource |
| | | private VocValsService vocValsService; |
| | | |
| | | @Resource |
| | | private SocketService socketService; |
| | | |
| | | private final static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH"); |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢2dçå徿°æ®", notes = "æ ¹æ®æ¶é´æ¥è¯¢2dçå徿°æ®") |
| | | @ApiOperationSupport(order = 1) |
| | | @GetMapping("/get2d") |
| | | public Result get2d( |
| | | @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | List<SuYuan2d> list = suYuanService.selectSuYuan2d(date); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢3dçå徿°æ®", notes = "æ ¹æ®æ¶é´æ¥è¯¢3dçå徿°æ®") |
| | | @ApiOperationSupport(order = 2) |
| | | @GetMapping("/get3d") |
| | | public Result get3d( |
| | | @RequestParam(value = "name", required = true) String name, |
| | | @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | List<SuYuan3d> list = suYuanService.selectSuYuan3d(name, date); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æº¯æº100çå徿°æ®", notes = "æ ¹æ®æ¶é´æ¥è¯¢æº¯æº100çå徿°æ®ï¼resultè¿åå¼ä¸data对åºå¼ä¸ºçå徿°æ®ï¼feedbackId为åé¦ä¸»é®ç¼å·ï¼å¨è¿è¡åé¦ä¸éè¦ä¼ é") |
| | | @ApiOperationSupport(order = 3) |
| | | @GetMapping("/get100") |
| | | public Result get100( |
| | | @RequestParam(value = "name", required = true) String name, |
| | | @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date |
| | | ) { |
| | | return Result.OK(suYuanService.selectSuYuan100(name, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æº¯æº200çå徿°æ®", notes = "æ ¹æ®æ¶é´æ¥è¯¢æº¯æº200çå徿°æ®ï¼resultè¿åå¼ä¸data对åºå¼ä¸ºçå徿°æ®ï¼feedbackId为åé¦ä¸»é®ç¼å·ï¼å¨è¿è¡åé¦ä¸éè¦ä¼ é") |
| | | @ApiOperationSupport(order = 4) |
| | | @GetMapping("/get200") |
| | | public Result get200( |
| | | @RequestParam(value = "name", required = true) String name, |
| | | @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date |
| | | ) { |
| | | return Result.OK(suYuanService.selectSuYuan200(name, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æº¯æº300çå徿°æ®", notes = "æ ¹æ®æ¶é´æ¥è¯¢æº¯æº300çå徿°æ®ï¼resultè¿åå¼ä¸data对åºå¼ä¸ºçå徿°æ®ï¼feedbackId为åé¦ä¸»é®ç¼å·ï¼å¨è¿è¡åé¦ä¸éè¦ä¼ é") |
| | | @ApiOperationSupport(order = 5) |
| | | @GetMapping("/get300") |
| | | public Result get300( |
| | | @RequestParam(value = "name", required = true) String name, |
| | | @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date |
| | | ) { |
| | | return Result.OK(suYuanService.selectSuYuan300(name, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æº¯æº500çå徿°æ®", notes = "æ ¹æ®æ¶é´æ¥è¯¢æº¯æº500çå徿°æ®ï¼resultè¿åå¼ä¸data对åºå¼ä¸ºçå徿°æ®ï¼feedbackId为åé¦ä¸»é®ç¼å·ï¼å¨è¿è¡åé¦ä¸éè¦ä¼ é") |
| | | @ApiOperationSupport(order = 6) |
| | | @GetMapping("/get500") |
| | | public Result get500( |
| | | @RequestParam(value = "name", required = true) String name, |
| | | @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date |
| | | ) { |
| | | return Result.OK(suYuanService.selectSuYuan500(name, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "è·åææçæµæ°æ®", notes = "è·åææçæµæ°æ®") |
| | | @ApiOperationSupport(order = 7) |
| | | @GetMapping("/query/{name}") |
| | | public Result getMonitorData(@PathVariable("name") String name) { |
| | | List<SuYuanMonitorData> list = suYuanService.getMonitorData(name); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ´æ°Vocsåç§°", notes = "æ´æ°Vocsåç§°") |
| | | @ApiOperationSupport(order = 8) |
| | | @GetMapping("/updateVocsName") |
| | | public Result updateVocsName(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date, |
| | | @RequestParam(value = "id", required = true) String id, |
| | | @RequestParam(value = "vocsName", required = true) String vocsName |
| | | ) { |
| | | return Result.OK(suYuanService.updateVocsName(date, id, vocsName)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®åç§°è·ååæ å¼", notes = "æ ¹æ®åç§°è·ååæ å¼") |
| | | @ApiOperationSupport(order = 9) |
| | | @GetMapping("/getCoordByName/{name}") |
| | | public Result getCoordByName(@PathVariable("name") String name) { |
| | | MonitorPointPosition point = StringUtils.isEmpty(name) ? null : commonService.select3dCheckPointByName(name); |
| | | |
| | | return Result.OK(point); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®Qxshå¼", notes = "æ ¹æ®Qxshå¼") |
| | | @ApiOperationSupport(order = 10) |
| | | @GetMapping("/queryQxsh") |
| | | public Result queryQxsh(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | List<Qxsh> list = suYuanService.queryQxsh(date); |
| | | |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®æ¶é´æ¥è¯¢Vocå¼", notes = "æ ¹æ®æ¶é´æ¥è¯¢Vocå¼") |
| | | @ApiOperationSupport(order = 11) |
| | | @GetMapping("/selectVocByTime") |
| | | public Result selectVocByTime(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | String time = DateUtils.getYyyyMmDdHhMmSs(date); |
| | | List<VocVals> list = vocValsService.selectByTime(time); |
| | | |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDåæ¥ææ¥è¯¢æº¯æº46表", notes = "æ ¹æ®IDåæ¥ææ¥è¯¢æº¯æº46表") |
| | | @ApiOperationSupport(order = 12) |
| | | @GetMapping("/selectSuYuan46ById") |
| | | public Result selectSuYuan46ById(@RequestParam(value = "id", required = true) String id, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | return Result.OK(suYuanService.selectSuYuan46ById(id, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDåæ¥ææ¥è¯¢æº¯æº700表", notes = "æ ¹æ®IDåæ¥ææ¥è¯¢æº¯æº700表") |
| | | @ApiOperationSupport(order = 13) |
| | | @GetMapping("/selectSuYuan700ById") |
| | | public Result selectSuYuan700ById(@RequestParam(value = "id", required = true) String id, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | return Result.OK(suYuanService.selectSuYuan700ById(id, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®Xï¼Y弿¥è¯¢å°å", notes = "æ ¹æ®Xï¼Y弿¥è¯¢å°å") |
| | | @ApiOperationSupport(order = 14) |
| | | @GetMapping("/selectCoords") |
| | | public Result selectCoords(@RequestParam(value = "x") Integer x, @RequestParam(value = "y") Integer y, @RequestParam(value = "isSuYuan") Integer isSuYuan) { |
| | | if (isSuYuan < 1) { |
| | | x = x / 10; |
| | | y = y / 10; |
| | | } |
| | | |
| | | return Result.OK(vocValsService.selectCoords(x, y)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®ç»çº¬åº¦æ¥è¯¢å°å", notes = "æ ¹æ®ç»çº¬åº¦æ¥è¯¢å°å") |
| | | @ApiOperationSupport(order = 15) |
| | | @GetMapping("/selectAddrByXY") |
| | | public Result selectAddrByXY(@RequestParam(value = "x", required = true) double x, @RequestParam(value = "y", required = true) double y) { |
| | | return Result.OK(suYuanService.selectAddrByXY(x, y)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®XãY弿¥è¯¢ç©å½¢æ¡", notes = "æ ¹æ®XãY弿¥è¯¢ç©å½¢æ¡") |
| | | @ApiOperationSupport(order = 16) |
| | | @GetMapping("/selectRects") |
| | | public Result selectRects(@RequestParam(value = "x[]", required = true) Double[] x, @RequestParam(value = "y[]", required = true) Double[] y) { |
| | | if (null == x || null == y || x.length == 0 || x.length != y.length) return Result.OK(null); |
| | | |
| | | return Result.OK(suYuanService.selectRects(x, y)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®åç§°æ¥è¯¢æº¯æºID", notes = "æ ¹æ®åç§°æ¥è¯¢æº¯æºID") |
| | | @ApiOperationSupport(order = 17) |
| | | @GetMapping("/selectSuYuanIdByName") |
| | | public Result selectSuYuanIdByName(@RequestParam(value = "name") String name) { |
| | | if (null == name || name.length() == 0) return Result.OK(null); |
| | | |
| | | return Result.OK(suYuanService.selectSuYuanIdByName(name)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢å¿«é溯æº") |
| | | @ApiOperationSupport(order = 18) |
| | | @GetMapping("/selectFastById") |
| | | public Result selectFastById(@RequestParam(value = "id") String id, @RequestParam(value = "date", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) { |
| | | if (StringUtils.isEmpty(id)) return Result.OK(null); |
| | | if (null == date) date = DateTime.now(); |
| | | |
| | | return Result.OK(suYuanService.selectFastById(id, date)); |
| | | } |
| | | |
| | | @ApiOperation(value = "åéæ¶æ¯") |
| | | @ApiOperationSupport(order = 19) |
| | | @GetMapping("/sendMsg") |
| | | public Result sendMsg(@RequestParam(value = "msg") String msg) { |
| | | if (StringUtils.isEmpty(msg)) return Result.error("æ¶æ¯ä¸è½ä¸ºç©º"); |
| | | |
| | | try { |
| | | String rs = socketService.sendMsg(msg); |
| | | |
| | | return Result.OK(rs); |
| | | } catch (Exception ex) { |
| | | return Result.error(ex.getMessage()); |
| | | } |
| | | } |
| | | } |