From 46d68076bfa7b706549e0420dfe09314024e3696 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 22 十一月 2024 21:02:39 +0800
Subject: [PATCH] #读取地图文件优化
---
src/main/java/com/zy/asrs/controller/MonitorController.java | 45 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 36 insertions(+), 9 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..8751548 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.*;
@@ -322,11 +319,14 @@
}
HashMap<String, Object> map = new HashMap<>();
if (shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.OFFLINE)) {
- //璁惧绂荤嚎涓�
- map.put("deviceNo", shuttleProtocol.getShuttleNo());//璁惧鍙�-灏忚溅鍙�
- map.put("errorMsg", "璁惧绂荤嚎");//寮傚父淇℃伅
- map.put("device", "鍥涘悜杞�");//寮傚父淇℃伅
- list.add(map);
+ if (System.currentTimeMillis() - shuttleProtocol.getLastOnlineTime() > 1000 * 60 * 5) {
+ //绂荤嚎瓒呰繃浜斿垎閽�
+ //璁惧绂荤嚎涓�
+ map.put("deviceNo", shuttleProtocol.getShuttleNo());//璁惧鍙�-灏忚溅鍙�
+ map.put("errorMsg", "璁惧绂荤嚎");//寮傚父淇℃伅
+ map.put("device", "鍥涘悜杞�");//寮傚父淇℃伅
+ list.add(map);
+ }
}
if (shuttleProtocol.getErrState() == 1) {
@@ -367,6 +367,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 +397,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