From de71466c0ae44505a100160b35370c12267d5ba1 Mon Sep 17 00:00:00 2001 From: chy Date: Mon, 11 May 2026 00:11:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 14 +++++------ .../src/main/resources/application-prod.yml | 10 ++++---- .../src/main/resources/application.yml | 2 +- lidee-admin/src/main/resources/logback.xml | 23 ++++++++++++------- .../lidee/common/utils/http/HttpUtils.java | 12 +++++----- .../lidee/iot/data/emq/subscribeCallback.java | 6 ++--- .../impl/DeviceReportMessageServiceImpl.java | 6 ++--- .../lidee/modbus/codec/MessageAdapter.java | 2 +- .../src/main/resources/application-prod.yml | 2 +- 9 files changed, 42 insertions(+), 35 deletions(-) diff --git a/lidee-admin/src/main/resources/application-dev.yml b/lidee-admin/src/main/resources/application-dev.yml index a2e22a5..253f159 100644 --- a/lidee-admin/src/main/resources/application-dev.yml +++ b/lidee-admin/src/main/resources/application-dev.yml @@ -56,7 +56,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/lideeiot_2.0?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: root + password: gryy@8888 filters: stat,wall filter: stat: @@ -111,12 +111,12 @@ spring: max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) # mqtt 配置 mqtt: - username: iotweib # 账号 - password: gryy@8888 # 密码 - host-url: tcp://192.168.1.252:1883 # mqtt连接tcp地址 -# username: admin # 账号 -# password: lidee666 # 密码 -# host-url: tcp://127.0.0.1:1883 # mqtt连接tcp地址 +# username: iotweib # 账号 +# password: gryy@8888 # 密码 +# host-url: tcp://192.168.1.251:1883 # mqtt连接tcp地址 + username: admin # 账号 + password: lidee666 # 密码 + host-url: tcp://127.0.0.1:1883 # mqtt连接tcp地址 client-id: ${random.int} # 客户端Id,不能相同,采用随机数 ${random.value} default-topic: test # 默认主题 timeout: 30 # 超时时间 diff --git a/lidee-admin/src/main/resources/application-prod.yml b/lidee-admin/src/main/resources/application-prod.yml index e1ce1d4..9dd55a8 100644 --- a/lidee-admin/src/main/resources/application-prod.yml +++ b/lidee-admin/src/main/resources/application-prod.yml @@ -143,11 +143,11 @@ sip: # 日志配置 logging: level: - iot.lidee: debug - com.yomahub: debug - org.dromara: warn - org.springframework: warn - com.baomidou: debug + iot.lidee: error + com.yomahub: error + org.dromara: error + org.springframework: error + com.baomidou: error # Swagger配置 swagger: diff --git a/lidee-admin/src/main/resources/application.yml b/lidee-admin/src/main/resources/application.yml index 43f76cd..867e9f2 100644 --- a/lidee-admin/src/main/resources/application.yml +++ b/lidee-admin/src/main/resources/application.yml @@ -56,7 +56,7 @@ server: spring: # 环境配置,dev=开发环境,prod=生产环境 profiles: - active: prod # 环境配置,dev=开发环境,prod=生产环境 + active: dev # 环境配置,dev=开发环境,prod=生产环境 # 资源信息 messages: # 国际化资源文件路径 diff --git a/lidee-admin/src/main/resources/logback.xml b/lidee-admin/src/main/resources/logback.xml index 6ada555..d4d7c81 100644 --- a/lidee-admin/src/main/resources/logback.xml +++ b/lidee-admin/src/main/resources/logback.xml @@ -1,7 +1,14 @@ + - + @@ -28,7 +35,7 @@ - DEBUG + ERROR ACCEPT @@ -51,7 +58,7 @@ - INFO + ERROR ACCEPT @@ -129,9 +136,9 @@ - + - + @@ -145,16 +152,16 @@ - + - + - + diff --git a/lidee-common/src/main/java/iot/lidee/common/utils/http/HttpUtils.java b/lidee-common/src/main/java/iot/lidee/common/utils/http/HttpUtils.java index 126d767..26c9dbd 100644 --- a/lidee-common/src/main/java/iot/lidee/common/utils/http/HttpUtils.java +++ b/lidee-common/src/main/java/iot/lidee/common/utils/http/HttpUtils.java @@ -69,7 +69,7 @@ public class HttpUtils try { String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; - log.info("sendGet - {}", urlNameString); + //log.info("sendGet - {}", urlNameString); URL realUrl = new URL(urlNameString); URLConnection connection = realUrl.openConnection(); connection.setRequestProperty("accept", "*/*"); @@ -84,7 +84,7 @@ public class HttpUtils { result.append(line); } - log.info("recv - {}", result); + //log.info("recv - {}", result); } catch (ConnectException e) { @@ -133,7 +133,7 @@ public class HttpUtils StringBuilder result = new StringBuilder(); try { - log.info("sendPost - {}", url); + // log.info("sendPost - {}", url); URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setRequestProperty("accept", "*/*"); @@ -152,7 +152,7 @@ public class HttpUtils { result.append(line); } - log.info("recv - {}", result); + //log.info("recv - {}", result); } catch (ConnectException e) { @@ -197,7 +197,7 @@ public class HttpUtils String urlNameString = url + "?" + param; try { - log.info("sendSSLPost - {}", urlNameString); + //log.info("sendSSLPost - {}", urlNameString); SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); URL console = new URL(urlNameString); @@ -223,7 +223,7 @@ public class HttpUtils result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); } } - log.info("recv - {}", result); + //log.info("recv - {}", result); conn.disconnect(); br.close(); } diff --git a/lidee-iot-data/src/main/java/iot/lidee/iot/data/emq/subscribeCallback.java b/lidee-iot-data/src/main/java/iot/lidee/iot/data/emq/subscribeCallback.java index 1a1319f..37f1e5b 100644 --- a/lidee-iot-data/src/main/java/iot/lidee/iot/data/emq/subscribeCallback.java +++ b/lidee-iot-data/src/main/java/iot/lidee/iot/data/emq/subscribeCallback.java @@ -32,9 +32,9 @@ public class subscribeCallback implements IMqttMessageListener { @Override public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { String message = new String(mqttMessage.getPayload()); - log.info("接收消息主题 : " + topic); - log.info("接收消息Qos : " + mqttMessage.getQos()); - log.info("接收消息内容 : " + message); +// log.info("接收消息主题 : " + topic); +// log.info("接收消息Qos : " + mqttMessage.getQos()); +// log.info("接收消息内容 : " + message); //这里默认设备编号长度超过9位 String[] split = topic.split("/"); diff --git a/lidee-iot-data/src/main/java/iot/lidee/iot/data/service/impl/DeviceReportMessageServiceImpl.java b/lidee-iot-data/src/main/java/iot/lidee/iot/data/service/impl/DeviceReportMessageServiceImpl.java index 8492587..beb2c36 100644 --- a/lidee-iot-data/src/main/java/iot/lidee/iot/data/service/impl/DeviceReportMessageServiceImpl.java +++ b/lidee-iot-data/src/main/java/iot/lidee/iot/data/service/impl/DeviceReportMessageServiceImpl.java @@ -86,7 +86,7 @@ public class DeviceReportMessageServiceImpl implements IDeviceReportMessageServi String serialNumber = bo.getSerialNumber(); switch (bo.getServerType()) { case MQTT: - log.debug("=>MQ*收到设备主题[{}],消息:[{}]", bo.getTopicName(), bo.getData()); + // log.debug("=>MQ*收到设备主题[{}],消息:[{}]", bo.getTopicName(), bo.getData()); //构建消息 DeviceStatusVO deviceStatusVO = buildReport(bo); Long productId = bo.getProductId(); @@ -117,7 +117,7 @@ public class DeviceReportMessageServiceImpl implements IDeviceReportMessageServi processNoSub(reportMessage, bo.getTopicName()); break; case TCP: - log.debug("*MQ收到TCP推送消息[{}]", JSON.toJSON(bo.getThingsModelSimpleItem())); + // log.debug("*MQ收到TCP推送消息[{}]", JSON.toJSON(bo.getThingsModelSimpleItem())); DeviceStatusVO deviceStatusVO1 = deviceService.selectDeviceStatusAndTransportStatus(serialNumber); Optional.ofNullable(deviceStatusVO1).orElseThrow(() -> new ServiceException("设备不存在")); //同步设备状态 @@ -144,7 +144,7 @@ public class DeviceReportMessageServiceImpl implements IDeviceReportMessageServi */ @Override public void parseReplyMsg(DeviceReportBo bo) { - log.debug("=>MQ*收到设备回调消息,[{}]", bo); + //log.debug("=>MQ*收到设备回调消息,[{}]", bo); buildReport(bo); //获取解析协议 IProtocol protocol = selectedProtocol(bo.getProductId()); diff --git a/lidee-protocol/lidee-protocol-collect/src/main/java/iot/lidee/modbus/codec/MessageAdapter.java b/lidee-protocol/lidee-protocol-collect/src/main/java/iot/lidee/modbus/codec/MessageAdapter.java index 85f46ed..f8e42cb 100644 --- a/lidee-protocol/lidee-protocol-collect/src/main/java/iot/lidee/modbus/codec/MessageAdapter.java +++ b/lidee-protocol/lidee-protocol-collect/src/main/java/iot/lidee/modbus/codec/MessageAdapter.java @@ -50,7 +50,7 @@ public class MessageAdapter implements MessageDecoder, MessageEncoder{ Long productId = null; String devNum = new String(ByteBufUtil.getBytes(buf)); String dump = ByteBufUtil.hexDump(buf); - log.info("=>上报hex数据:{}", dump); + // log.info("=>上报hex数据:{}", dump); //这里兼容一下TCP整包发送的数据(整包==设备编号,数据一起发送) if (clientId == null){ diff --git a/lidee-record/src/main/resources/application-prod.yml b/lidee-record/src/main/resources/application-prod.yml index 2788460..baef799 100644 --- a/lidee-record/src/main/resources/application-prod.yml +++ b/lidee-record/src/main/resources/application-prod.yml @@ -64,7 +64,7 @@ swagger-ui: # [可选] 日志配置, 一般不需要改 logging: file: - name: logs/record.log + name: /opt/logs/record.log max-history: 30 max-size: 10MB total-size-cap: 300MB