From 63fc53379b059d4076a228c8b5b149ead84f20eb Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 15 七月 2025 16:59:52 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/controller/OpenController.java | 15 +++++++++++++++
src/main/webapp/views/index.html | 32 +++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/core/controller/OpenController.java b/src/main/java/com/zy/core/controller/OpenController.java
index a7ec4ea..d3aa0cd 100644
--- a/src/main/java/com/zy/core/controller/OpenController.java
+++ b/src/main/java/com/zy/core/controller/OpenController.java
@@ -11,20 +11,35 @@
import com.zy.core.utils.DeviceMsgUtils;
import com.zy.core.utils.FakeDeviceUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping("/open")
public class OpenController {
+ @Value("${deviceMsgConfig.gatewayId}")
+ private Integer gatewayId;
+ @Value("${deviceMsgConfig.gatewayPort}")
+ private Integer gatewayPort;
+
@Autowired
private DeviceMsgUtils deviceMsgUtils;
@Autowired
private FakeDeviceUtils fakeDeviceUtils;
+ @GetMapping("/getSystemInfo")
+ public R getSystemInfo() {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("gatewayId", gatewayId);
+ map.put("gatewayPort", gatewayPort);
+ return R.ok().add(map);
+ }
+
@GetMapping("/getDeviceList")
public R getDeviceList() {
List<DeviceConfig> deviceList = new ArrayList<>();
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index 97b8c7a..aa24eb3 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -21,7 +21,7 @@
<div style="width: 50%;">
<el-card class="box-card">
<div slot="header" class="clearfix">
- <span>妯℃嫙璁惧</span>
+ <span>妯℃嫙璁惧 - {{ systemInfo.gatewayId }}鍙风綉鍏�</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="addDeviceVisible = true">娣诲姞璁惧</el-button>
</div>
@@ -83,6 +83,10 @@
threadImpl: '',
deviceType: ''
},
+ systemInfo: {
+ gatewayId: 0,
+ gatewayPort: 0
+ },
formLabelWidth: '120px',
deviceList: []
},
@@ -91,10 +95,36 @@
},
methods: {
init() {
+ this.getSystemInfo();
+
setInterval(() => {
this.getDeviceList()
}, 100);
},
+ getSystemInfo() {
+ let that = this;
+ $.ajax({
+ url: baseUrl + "/open/getSystemInfo",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: {},
+ dataType: 'json',
+ contentType: 'application/json;charset=UTF-8',
+ method: 'GET',
+ success: function(res) {
+ if (res.code == 200) {
+ let data = res.data;
+ that.systemInfo = data
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
+ },
addDevice() {
//娣诲姞璁惧
let that = this;
--
Gitblit v1.9.1