From c174ae9e719c69eadb5ee280212cd376eb49d4f7 Mon Sep 17 00:00:00 2001 From: xusd Date: Thu, 8 Aug 2024 15:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysMainController.java | 121 ++++++ .../src/main/resources/static/img/jt.png | Bin 0 -> 4395 bytes .../resources/templates/index-topnav.html | 4 +- .../src/main/resources/templates/index.html | 4 +- .../src/main/resources/templates/main.html | 392 ++++++++++++------ 5 files changed, 394 insertions(+), 127 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMainController.java create mode 100644 ruoyi-admin/src/main/resources/static/img/jt.png diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMainController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMainController.java new file mode 100644 index 0000000..1558f40 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMainController.java @@ -0,0 +1,121 @@ +package com.ruoyi.web.controller.system; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.net.NetUtil; +import cn.hutool.system.HostInfo; +import cn.hutool.system.OsInfo; +import cn.hutool.system.SystemUtil; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.gateway.lora.domain.GatewayAgreement; +import com.ruoyi.gateway.lora.service.IGatewayAgreementService; +import com.ruoyi.system.service.ISysDictDataService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 首页 + * + * @Author xusd + * @Date 2024/8/7 9:36 + **/ +@RestController +@RequestMapping("/main") +public class SysMainController { + + @Resource + private IGatewayAgreementService agreementService; + + @Resource + private ISysDictDataService dictDataService; + + @GetMapping + public Map getData() { + Map map = new HashMap<>(); + OsInfo osInfo = SystemUtil.getOsInfo(); + map.put("osInfo", osInfo); + HostInfo hostInfo = SystemUtil.getHostInfo(); + map.put("hostInfo", hostInfo); + map.put("macAddress", NetUtil.getLocalMacAddress()); + map.put("UsableLocalPort", NetUtil.getUsableLocalPort()); + + //协议 + GatewayAgreement gatewayAgreement = agreementService.selectGatewayAgreementById(null); + if (Objects.nonNull(gatewayAgreement)) { + String agreementType = gatewayAgreement.getAgreementType(); + List agreements = new ArrayList<>(); + switch (agreementType) { + case "1": + map.put("agreementTypeName","MQTT"); + agreements.add("服务器地址:" + gatewayAgreement.getMqttAddress()); + agreements.add("服务器端口:" + gatewayAgreement.getMqttPort()); + agreements.add("客户端标识符:" + gatewayAgreement.getMqttFlag()); + agreements.add("用户名:" + gatewayAgreement.getMqttUser()); + agreements.add("遗嘱消息:" + gatewayAgreement.getMqttDieMsg()); + agreements.add("心跳时间:" + gatewayAgreement.getMqttHeartbeat()); + agreements.add("主题:" + gatewayAgreement.getMqttTopic()); + map.put("agreement",agreements); + break; + case "2": + map.put("agreementTypeName","Socket"); + SysDictData dictData = new SysDictData(); + dictData.setDictType("socket_domain"); + List sysDictData1 = dictDataService.selectDictDataList(dictData); + Map collect1 = sysDictData1.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel)); + agreements.add("协议族:" + collect1.get(gatewayAgreement.getSocketDomain())); + dictData.setDictType("socket_type"); + List sysDictData2 = dictDataService.selectDictDataList(dictData); + Map collect2 = sysDictData2.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel)); + agreements.add("套接字类型:" + collect2.get(gatewayAgreement.getSocketType())); + dictData.setDictType("socket_protocol"); + List sysDictData3 = dictDataService.selectDictDataList(dictData); + Map collect3 = sysDictData3.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel)); + agreements.add("协议:" + collect3.get(gatewayAgreement.getSocketProtocol())); + agreements.add("地址:" + gatewayAgreement.getSocketAddress()); + map.put("agreement",agreements); + break; + case "3": + map.put("agreementTypeName","Modbus RTU"); + agreements.add("串口号:" + gatewayAgreement.getRtuSerialPort()); + agreements.add("波特率:" + gatewayAgreement.getRtuBaud()); + agreements.add("数据位:" + gatewayAgreement.getRtuDataBits()); + agreements.add("校验位:" + gatewayAgreement.getRtuCheckBit()); + agreements.add("停止位:" + gatewayAgreement.getRtuStopBit()); + map.put("agreement",agreements); + break; + case "4": + map.put("agreementTypeName","Modbus TCP"); + agreements.add("IP地址:" + gatewayAgreement.getTcpAddress()); + agreements.add("端口:" + gatewayAgreement.getTcpPort()); + agreements.add("连接超时时间:" + gatewayAgreement.getTcpConnectionTimeout()); + agreements.add("读取超时时间:" + gatewayAgreement.getTcpReadTimeout()); + agreements.add("最大连接数:" + gatewayAgreement.getTcpMaxConnection()); + agreements.add("心跳间隔:" + gatewayAgreement.getTcpHeartbeatInterval()); + agreements.add("数据包最大长度:" + gatewayAgreement.getTcpMaxPpacket()); + agreements.add("地址映射表:" + gatewayAgreement.getTcpAddressMapping()); + map.put("agreement",agreements); + break; + case "5": + map.put("agreementTypeName","Fanuc"); + agreements.add("IP地址:" + gatewayAgreement.getFanucAddress()); + agreements.add("子网掩码:" + gatewayAgreement.getFanucMask()); + agreements.add("网关地址:" + gatewayAgreement.getFanucGatewayAddress()); + agreements.add("DNS:" + gatewayAgreement.getFanucDns()); + agreements.add("VLAN:" + gatewayAgreement.getFanucVlan()); + agreements.add("SNMP:" + gatewayAgreement.getFanucSnmp()); + map.put("agreement",agreements); + break; + default: + break; + } + } + return map; + } +} diff --git a/ruoyi-admin/src/main/resources/static/img/jt.png b/ruoyi-admin/src/main/resources/static/img/jt.png new file mode 100644 index 0000000000000000000000000000000000000000..0c2e4f6d8d035d13684fa1c5650a13752b2126a0 GIT binary patch literal 4395 zcma)=XHb((yT?P3-lY==9YMMX0@AzmUZqG8NB{{64l+dIf)OqLqaL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