From 2c9689ad1f2f3d80e068117b81448abd1619835c Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 26 十二月 2023 20:40:24 +0800
Subject: [PATCH] #日志采集

---
 src/main/java/com/zy/asrs/controller/MonitorController.java |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MonitorController.java b/src/main/java/com/zy/asrs/controller/MonitorController.java
index 281e3cf..45b88d9 100644
--- a/src/main/java/com/zy/asrs/controller/MonitorController.java
+++ b/src/main/java/com/zy/asrs/controller/MonitorController.java
@@ -27,10 +27,7 @@
 import com.zy.core.thread.NyShuttleThread;
 import lombok.Data;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -367,6 +364,10 @@
                     buffer.append("瓒呴噸");
                 }
 
+                if (liftProtocol.getErrorCode() > 0) {
+                    buffer.append(liftProtocol.getErrCode$());
+                }
+
                 HashMap<String, Object> map = new HashMap<>();
                 map.put("deviceNo", liftProtocol.getLiftNo());//璁惧鍙�-鎻愬崌鏈哄彿
                 map.put("errorMsg", buffer.toString());//寮傚父淇℃伅
@@ -393,6 +394,29 @@
         return R.ok().add(map);
     }
 
+    /**
+     * 鑾峰彇璁惧杩愯寮傚父缁熻
+     */
+    @GetMapping("/deviceRunErrorStatistic/{type}")
+    public R deviceRunErrorStatistic(@PathVariable("type") String type) {
+        int time = 1;//榛樿1澶�
+        if (type.equals("day")) {
+            time = 1;
+        } else if (type.equals("week")) {
+            time = 7;
+        } else if (type.equals("month")) {
+            time = 30;
+        }
+        //鑾峰彇鎻愬崌鏈鸿繍琛屽紓甯告暟鎹�
+        List<Map<String, Object>> liftList = basLiftOptMapper.selectRunErrorStatistic(time);
+        //鑾峰彇灏忚溅杩愯寮傚父鏁版嵁
+        List<Map<String, Object>> shuttleList = basShuttleOptMapper.selectRunErrorStatistic(time);
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("lift", liftList);
+        map.put("shuttle", shuttleList);
+        return R.ok().add(map);
+    }
+
 
 
 

--
Gitblit v1.9.1