From 2f55cebbad3dea187a5f91d16ec80a9677dab699 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 13 十一月 2024 11:16:53 +0800
Subject: [PATCH] 1

---
 src/main/java/com/yssh/controller/SuYuanController.java |   91 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 65 insertions(+), 26 deletions(-)

diff --git a/src/main/java/com/yssh/controller/SuYuanController.java b/src/main/java/com/yssh/controller/SuYuanController.java
index 4e47744..7cb6246 100644
--- a/src/main/java/com/yssh/controller/SuYuanController.java
+++ b/src/main/java/com/yssh/controller/SuYuanController.java
@@ -1,8 +1,11 @@
 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;
@@ -24,13 +27,6 @@
 
 import javax.annotation.Resource;
 
-/**
- * @author lishijia
- * @ClassName Yssh2dreliController
- * @Description Yssh2dreliController
- * @date 2022/12/3 21:21
- * @Version 1.0
- */
 @Api(tags="婧簮淇℃伅")
 @RestController
 @RequestMapping("/suYuan")
@@ -44,6 +40,9 @@
 
     @Resource
     private VocValsService vocValsService;
+
+    @Resource
+    private SocketService socketService;
 
     private final static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
 
@@ -146,20 +145,47 @@
     @ApiOperationSupport(order = 11)
     @GetMapping("/selectVocByTime")
     public Result selectVocByTime(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
-        List<VocVals> list = vocValsService.selectByTime(format.format(date));
+        String time = DateUtils.getYyyyMmDdHhMmSs(date);
+        List<VocVals> list = vocValsService.selectByTime(time);
 
         return Result.OK(list);
     }
 
-    @ApiOperation(value = "鏍规嵁X锛孻鍊兼煡璇㈠湴鍧�", notes = "鏍规嵁X锛孻鍊兼煡璇㈠湴鍧�")
+    @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锛孻鍊兼煡璇㈠湴鍧�", notes = "鏍规嵁X锛孻鍊兼煡璇㈠湴鍧�")
+    @ApiOperationSupport(order = 14)
     @GetMapping("/selectCoords")
-    public Result selectVocByTime(@RequestParam(value = "x", required = false) Integer x, @RequestParam(value = "y", required = false) Integer y) {
+    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銆乊鍊兼煡璇㈢煩褰㈡", notes = "鏍规嵁X銆乊鍊兼煡璇㈢煩褰㈡")
-    @ApiOperationSupport(order = 13)
+    @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);
@@ -167,24 +193,37 @@
         return Result.OK(suYuanService.selectRects(x, y));
     }
 
-    @ApiOperation(value = "鏍规嵁ID鍜屾棩鏈熸煡璇㈡函婧�700琛�", notes = "鏍规嵁ID鍜屾棩鏈熸煡璇㈡函婧�700琛�")
-    @ApiOperationSupport(order = 14)
-    @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 = "鏍规嵁鍚嶇О鏌ヨ婧簮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鍜屾棩鏈熸煡璇㈡函婧�46琛�", notes = "鏍规嵁ID鍜屾棩鏈熸煡璇㈡函婧�46琛�")
-    @ApiOperationSupport(order = 15)
-    @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鏌ヨ蹇�熸函婧�")
+    @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 = "鏍规嵁缁忕含搴︽煡璇㈠湴鍚�", notes = "鏍规嵁缁忕含搴︽煡璇㈠湴鍚�")
-    @ApiOperationSupport(order = 16)
-    @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 = "鍙戦�佹秷鎭�")
+    @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());
+        }
     }
 }

--
Gitblit v1.9.3