diff --git a/pom.xml b/pom.xml index e2f6d07..8df0070 100644 --- a/pom.xml +++ b/pom.xml @@ -231,6 +231,7 @@ ruoyi-generator ruoyi-common ruoyi-radius + ruoyi-gateway pom diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 890a0e1..38b4cdb 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -87,6 +87,11 @@ com.ruoyi ruoyi-radius + + com.ruoyi + ruoyi-gateway + 4.6.0 + diff --git a/ruoyi-gateway/pom.xml b/ruoyi-gateway/pom.xml new file mode 100644 index 0000000..451df07 --- /dev/null +++ b/ruoyi-gateway/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + com.ruoyi + ruoyi + 4.6.0 + + + ruoyi-gateway + + + 8 + 8 + UTF-8 + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + com.ruoyi + ruoyi-common + + + + com.ruoyi + ruoyi-framework + + + cn.hutool + hutool-all + 5.4.2 + + + org.projectlombok + lombok + + + + \ No newline at end of file diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/controller/AgreementController.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/controller/AgreementController.java new file mode 100644 index 0000000..affde22 --- /dev/null +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/controller/AgreementController.java @@ -0,0 +1,52 @@ +package com.ruoyi.gateway.lora.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.gateway.lora.domain.GatewayAgreement; +import com.ruoyi.gateway.lora.service.IGatewayAgreementService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.util.Objects; + +/** + * @Author xusd + * @Date 2024/7/24 11:52 + **/ +@Controller +@RequestMapping("/lora/agreement") +public class AgreementController extends BaseController { + + @Autowired + private IGatewayAgreementService gatewayAgreementService; + + private String prefix = "lora/agreement"; + + @RequiresPermissions("lora:agreement:view") + @GetMapping() + public String agreement(ModelMap mmap) { + GatewayAgreement gatewayAgreement = gatewayAgreementService.selectGatewayAgreementById(null); + if (Objects.isNull(gatewayAgreement)){ + gatewayAgreement = new GatewayAgreement(); + } + mmap.put("gatewayAgreement", gatewayAgreement); + return prefix + "/agreement"; + } + + /** + * 修改保存 + */ + @RequiresPermissions("system:agreement:edit") + @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult edit(GatewayAgreement gatewayAgreement) { + return toAjax(gatewayAgreementService.updateGatewayAgreement(gatewayAgreement)); + } + +} diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/domain/GatewayAgreement.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/domain/GatewayAgreement.java new file mode 100644 index 0000000..7a0686f --- /dev/null +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/domain/GatewayAgreement.java @@ -0,0 +1,153 @@ +package com.ruoyi.gateway.lora.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; + +/** + * @Author xusd + * @Date 2024/7/29 10:40 + **/ +@Data +public class GatewayAgreement extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + private String agreementType; + + /** mqtt 服务器地址 */ + @Excel(name = "mqtt 服务器地址") + private String mqttAddress; + + /** mqtt 服务器端口 */ + @Excel(name = "mqtt 服务器端口") + private String mqttPort; + + /** mqtt 客户端标识符 */ + @Excel(name = "mqtt 客户端标识符") + private String mqttFlag; + + /** mqtt 用户名 */ + @Excel(name = "mqtt 用户名") + private String mqttUser; + + /** mqtt 密码 */ + @Excel(name = "mqtt 密码") + private String mqttPassword; + + /** mqtt 清理会话 */ + @Excel(name = "mqtt 清理会话") + private String mqttClean; + + /** mqtt 遗嘱消息 */ + @Excel(name = "mqtt 遗嘱消息") + private String mqttDieMsg; + + /** mqtt 保持活动 */ + @Excel(name = "mqtt 保持活动") + private String mqttKeep; + + /** mqtt 心跳时间 */ + @Excel(name = "mqtt 心跳时间") + private String mqttHeartbeat; + + /** mqtt 主题 */ + @Excel(name = "mqtt 主题") + private String mqttTopic; + + /** socket Domain(协议族) */ + @Excel(name = "socket Domain", readConverterExp = "协=议族") + private String socketDomain; + + /** socket Type(套接字类型) */ + @Excel(name = "socket Type", readConverterExp = "套=接字类型") + private String socketType; + + /** socket Protocol(协议) */ + @Excel(name = "socket Protocol", readConverterExp = "协=议") + private String socketProtocol; + + /** socket Address(地址) */ + @Excel(name = "socket Address", readConverterExp = "地=址") + private String socketAddress; + + /** Modbus RTU 串口号 */ + @Excel(name = "Modbus RTU 串口号") + private String rtuSerialPort; + + /** Modbus RTU 波特率 */ + @Excel(name = "Modbus RTU 波特率") + private String rtuBaud; + + /** Modbus RTU 数据位 */ + @Excel(name = "Modbus RTU 数据位") + private String rtuDataBits; + + /** Modbus RTU 校验位 */ + @Excel(name = "Modbus RTU 校验位") + private String rtuCheckBit; + + /** Modbus RTU 停止位 */ + @Excel(name = "Modbus RTU 停止位") + private String rtuStopBit; + + /** Modbus TCP IP地址 */ + @Excel(name = "Modbus TCP IP地址") + private String tcpAddress; + + /** Modbus TCP 端口 */ + @Excel(name = "Modbus TCP 端口") + private String tcpPort; + + /** Modbus TCP 连接超时时间 */ + @Excel(name = "Modbus TCP 连接超时时间") + private String tcpConnectionTimeout; + + /** Modbus TCP 读取超时时间 */ + @Excel(name = "Modbus TCP 读取超时时间") + private String tcpReadTimeout; + + /** Modbus TCP 最大连接数 */ + @Excel(name = "Modbus TCP 最大连接数") + private String tcpMaxConnection; + + /** Modbus TCP 心跳间隔 */ + @Excel(name = "Modbus TCP 心跳间隔") + private String tcpHeartbeatInterval; + + /** Modbus TCP 数据包最大长度 */ + @Excel(name = "Modbus TCP 数据包最大长度") + private String tcpMaxPpacket; + + /** Modbus TCP 地址映射表 */ + @Excel(name = "Modbus TCP 地址映射表") + private String tcpAddressMapping; + + /** Fanuc IP地址 */ + @Excel(name = "Fanuc IP地址") + private String fanucAddress; + + /** Fanuc 子网掩码 */ + @Excel(name = "Fanuc 子网掩码") + private String fanucMask; + + /** Fanuc 网关地址 */ + @Excel(name = "Fanuc 网关地址") + private String fanucGatewayAddress; + + /** Fanuc DNS */ + @Excel(name = "Fanuc DNS") + private String fanucDns; + + /** Fanuc VLAN */ + @Excel(name = "Fanuc VLAN") + private String fanucVlan; + + /** Fanuc SNMP */ + @Excel(name = "Fanuc SNMP") + private String fanucSnmp; + +} diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/mapper/GatewayAgreementMapper.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/mapper/GatewayAgreementMapper.java new file mode 100644 index 0000000..d1cd02d --- /dev/null +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/mapper/GatewayAgreementMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.gateway.lora.mapper; + +import com.ruoyi.gateway.lora.domain.GatewayAgreement; + +/** + * @Author xusd + * @Date 2024/7/29 10:51 + **/ +public interface GatewayAgreementMapper { + + GatewayAgreement selectGatewayAgreementById(Long id); + + int updateGatewayAgreement(GatewayAgreement gatewayAgreement); + +} diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/service/IGatewayAgreementService.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/service/IGatewayAgreementService.java new file mode 100644 index 0000000..a9fea46 --- /dev/null +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/service/IGatewayAgreementService.java @@ -0,0 +1,27 @@ +package com.ruoyi.gateway.lora.service; + +import com.ruoyi.gateway.lora.domain.GatewayAgreement; + +/** + * @Author xusd + * @Date 2024/7/29 10:46 + **/ +public interface IGatewayAgreementService { + + /** + * 查询 + * + * @param id id + * @return com.ruoyi.gateway.lora.domain.GatewayAgreement + */ + GatewayAgreement selectGatewayAgreementById(Long id); + + /** + * 修改 + * + * @param gatewayAgreement 【请填写功能名称】 + * @return 结果 + */ + int updateGatewayAgreement(GatewayAgreement gatewayAgreement); + +} diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/service/impl/GatewayAgreementServiceImpl.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/service/impl/GatewayAgreementServiceImpl.java new file mode 100644 index 0000000..2ae6487 --- /dev/null +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/lora/service/impl/GatewayAgreementServiceImpl.java @@ -0,0 +1,33 @@ +package com.ruoyi.gateway.lora.service.impl; + +import com.ruoyi.gateway.lora.domain.GatewayAgreement; +import com.ruoyi.gateway.lora.mapper.GatewayAgreementMapper; +import com.ruoyi.gateway.lora.service.IGatewayAgreementService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Author xusd + * @Date 2024/7/29 10:49 + **/ +@Service +public class GatewayAgreementServiceImpl implements IGatewayAgreementService { + + @Autowired + private GatewayAgreementMapper gatewayAgreementMapper; + + + @Override + public GatewayAgreement selectGatewayAgreementById(Long id) { + return gatewayAgreementMapper.selectGatewayAgreementById(id); + } + + @Override + public int updateGatewayAgreement(GatewayAgreement gatewayAgreement) { + if("2".equals(gatewayAgreement.getMqttKeep())){ + gatewayAgreement.setMqttHeartbeat("0"); + } + return gatewayAgreementMapper.updateGatewayAgreement(gatewayAgreement); + } + +} diff --git a/ruoyi-gateway/src/main/resources/mapper/lora/agreement/GatewayAgreementMapper.xml b/ruoyi-gateway/src/main/resources/mapper/lora/agreement/GatewayAgreementMapper.xml new file mode 100644 index 0000000..04ece9b --- /dev/null +++ b/ruoyi-gateway/src/main/resources/mapper/lora/agreement/GatewayAgreementMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, agreement_type,mqtt_address, mqtt_port, mqtt_flag, mqtt_user, mqtt_password, mqtt_clean, mqtt_die_msg, mqtt_keep, mqtt_heartbeat, mqtt_topic, socket_domain, socket_type, socket_protocol, socket_address, rtu_serial_port, rtu_baud, rtu_data_bits, rtu_check_bit, rtu_stop_bit, tcp_address, tcp_port, tcp_connection_timeout, tcp_read_timeout, tcp_max_connection, tcp_heartbeat_interval, tcp_max_ppacket, tcp_address_mapping, fanuc_address, fanuc_mask, fanuc_gateway_address, fanuc_dns, fanuc_vlan, fanuc_snmp from gateway_agreement + + + + + + update gateway_agreement + + agreement_type = #{agreementType}, + mqtt_address = #{mqttAddress}, + mqtt_port = #{mqttPort}, + mqtt_flag = #{mqttFlag}, + mqtt_user = #{mqttUser}, + mqtt_password = #{mqttPassword}, + mqtt_clean = #{mqttClean}, + mqtt_die_msg = #{mqttDieMsg}, + mqtt_keep = #{mqttKeep}, + mqtt_heartbeat = #{mqttHeartbeat}, + mqtt_topic = #{mqttTopic}, + socket_domain = #{socketDomain}, + socket_type = #{socketType}, + socket_protocol = #{socketProtocol}, + socket_address = #{socketAddress}, + rtu_serial_port = #{rtuSerialPort}, + rtu_baud = #{rtuBaud}, + rtu_data_bits = #{rtuDataBits}, + rtu_check_bit = #{rtuCheckBit}, + rtu_stop_bit = #{rtuStopBit}, + tcp_address = #{tcpAddress}, + tcp_port = #{tcpPort}, + tcp_connection_timeout = #{tcpConnectionTimeout}, + tcp_read_timeout = #{tcpReadTimeout}, + tcp_max_connection = #{tcpMaxConnection}, + tcp_heartbeat_interval = #{tcpHeartbeatInterval}, + tcp_max_ppacket = #{tcpMaxPpacket}, + tcp_address_mapping = #{tcpAddressMapping}, + fanuc_address = #{fanucAddress}, + fanuc_mask = #{fanucMask}, + fanuc_gateway_address = #{fanucGatewayAddress}, + fanuc_dns = #{fanucDns}, + fanuc_vlan = #{fanucVlan}, + fanuc_snmp = #{fanucSnmp}, + + + \ No newline at end of file diff --git a/ruoyi-gateway/src/main/resources/templates/lora/agreement/agreement.html b/ruoyi-gateway/src/main/resources/templates/lora/agreement/agreement.html new file mode 100644 index 0000000..3035cb6 --- /dev/null +++ b/ruoyi-gateway/src/main/resources/templates/lora/agreement/agreement.html @@ -0,0 +1,370 @@ + + + + + + +
+
基本设置
+
+
+
+ + + + + + + + + + + + + +
+ +
+ +
+
+
+ + + + + + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + + + +
+ + +
+
+
+ +
+ +
+
+
+ + + + +
+ + +
+
+ +
+ +
+ +
+
+
+ + + + +
+ 确定 +
+
+
+ + + + \ No newline at end of file