pom.xml
@@ -357,6 +357,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.7.9</version> <executions> <execution> <goals> @@ -365,17 +366,6 @@ </execution> </executions> </plugin> <!-- <plugin>--> <!-- <groupId>org.springframework.boot</groupId>--> <!-- <artifactId>spring-boot-maven-plugin</artifactId>--> <!-- <executions>--> <!-- <execution>--> <!-- <goals>--> <!-- <goal>repackage</goal>--> <!-- </goals>--> <!-- </execution>--> <!-- </executions>--> <!-- </plugin>--> </plugins> src/main/java/com/fzzy/api/data/GatewayDeviceType.java
@@ -19,6 +19,7 @@ TYPE_06("TYPE_06", "è§é¢å®é²æå头"), TYPE_07("TYPE_07", "ç²®æ åæº"), TYPE_08("TYPE_08", "æ¡é¢æææå头"), TYPE_09("TYPE_09", "åºåºæ°è±¡ç«"), TYPE_99("TYPE_99", "ç¬ç«IOT"); @@ -36,6 +37,7 @@ list.add(new ApiTrigger(TYPE_06.getCode(), TYPE_06.getName())); list.add(new ApiTrigger(TYPE_07.getCode(), TYPE_07.getName())); list.add(new ApiTrigger(TYPE_08.getCode(), TYPE_08.getName())); list.add(new ApiTrigger(TYPE_09.getCode(), TYPE_09.getName())); list.add(new ApiTrigger(TYPE_99.getCode(), TYPE_99.getName())); return list; } src/main/java/com/fzzy/gateway/GatewayUtils.java
@@ -1,13 +1,17 @@ package com.fzzy.gateway; import com.fzzy.gateway.entity.GatewayDevice; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 常é */ @Component public class GatewayUtils { @@ -41,6 +45,21 @@ return cacheMapDeviceSn.get(deviceSn); } public static List<GatewayDevice> getCacheByDeviceType(String deviceType) { List<GatewayDevice> result = new ArrayList<>(); for (GatewayDevice device : cacheMapDeviceId.values()) { if (deviceType.equals(device.getType())) result.add(device); } return result; } public static GatewayDevice getCacheByDeviceTypeOne(String deviceType) { for (GatewayDevice device : cacheMapDeviceId.values()) { if (deviceType.equals(device.getType())) return device; } return null; } public static void removeCache(GatewayDevice data) { cacheMapDeviceId.remove(data.getDeviceId()); src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java
@@ -22,7 +22,7 @@ private String timestamp; private GrainOutPut outPut; private GrainOutPut output; private GrainWeather weatherStation; src/main/java/com/fzzy/gateway/hx2023/service/OnReceiveMqttService.java
@@ -63,11 +63,11 @@ syncReqData.setAutoReplay(true); syncReqData.setDevice(device); BaseResp resp; if (GatewayDeviceProtocol.DEVICE_TEST.getCode().equals(device.getSyncProtocol())) { resp = gatewayRemoteManager.getGatewayTestService(device.getPushProtocol()).testGrain(syncReqData); } else { syncReqData.setAutoReplay(false); resp = gatewayRemoteManager.getSyncGrainService(device.getSyncProtocol()).syncGrain(syncReqData); } src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
@@ -1,12 +1,13 @@ package com.fzzy.gateway.hx2023.service; import com.alibaba.fastjson2.JSONObject; import com.fzzy.api.data.GatewayDeviceType; import com.fzzy.api.data.PushProtocol; import com.fzzy.api.utils.DateUtil; import com.fzzy.api.utils.NumberUtil; import com.fzzy.async.fzzy40.Fzzy40CommonService; import com.fzzy.async.fzzy40.entity.Fz40Grain; import com.fzzy.gateway.api.GatewayDeviceReportService; import com.fzzy.gateway.GatewayUtils; import com.fzzy.gateway.api.GatewayDeviceTestService; import com.fzzy.gateway.data.BaseReqData; import com.fzzy.gateway.data.BaseResp; @@ -341,12 +342,20 @@ outPut.setTemperature(temperature); grain.setOutPut(outPut); grain.setOutput(outPut); GatewayDevice gatewayDeviceWeather = GatewayUtils.getCacheByDeviceTypeOne(GatewayDeviceType.TYPE_09.getCode()); //æ°è±¡ä¿¡æ¯ GrainWeather weatherStation = new GrainWeather(); weatherStation.setMessageId(ScConstant.getMessageId()); weatherStation.setId(device.getDeviceId()); if (null != gatewayDeviceWeather) { weatherStation.setId(gatewayDeviceWeather.getDeviceId()); } else { weatherStation.setId(device.getDeviceId()); } weatherStation.setAirPressure(weather.getPressure()); weatherStation.setHumidity(weather.getHumidity()); weatherStation.setPm(weather.getAir_pm25()); src/main/java/com/fzzy/gateway/hx2023/websocket/WebSockDeviceMessageReport.java
ÎļþÒÑɾ³ý src/main/java/com/fzzy/gateway/hx2023/websocket/WebSockDeviceMessageSender.java
ÎļþÒÑɾ³ý src/main/java/com/fzzy/gateway/hx2023/websocket/WebSocketDeviceReport.java
ÎļþÒÑɾ³ý src/main/resources/application-proGateway.yml
@@ -5,13 +5,13 @@ datasource: #ä¸»æ°æ®æº primary: url: jdbc:mysql://127.0.0.1:3306/igds_api_5012?useUnicode=true&useSSL=false&characterEncoding=utf-8 url: jdbc:mysql://127.0.0.1:3306/igds_api_2023?useUnicode=true&useSSL=false&characterEncoding=utf-8 username: root password: Abc123.. driver-class-name: com.mysql.jdbc.Driver #æ¬¡æ°æ®æº secondary: url: jdbc:mysql://127.0.0.1:3306/igds_5012?useUnicode=true&useSSL=false&characterEncoding=utf-8 url: jdbc:mysql://127.0.0.1:3306/igds_v4?useUnicode=true&useSSL=false&characterEncoding=utf-8 username: root password: Abc123.. @@ -38,7 +38,7 @@ database: 5 host: 127.0.0.1 port: 6379 password: Redispwd.. password: # è¿æ¥æ± æå¤§è¿æ¥æ°ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ pool: max-active: 200 @@ -48,11 +48,6 @@ timeout: 6000 kafka: bootstrap-servers: 103.203.217.16:9092 security-protocol: SASL_PLAINTEXT sasl-mechanism: PLAIN sasl-jaas-config: org.apache.kafka.common.security.scram.ScramLoginModule required username=\"{username}\" password=\"{password}\";" sasl-username: sc001 sasl-password: wCV0ISwmoKwbx1lpBKMW producer: retries: 0 acks: 1 @@ -60,6 +55,12 @@ buffer-memory: 33554432 key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer properties: security.protocol: SASL_PLAINTEXT sasl.mechanism: PLAIN sasl.username: sc001 sasl.password: wCV0ISwmoKwbx1lpBKMW sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username='sc001' password='wCV0ISwmoKwbx1lpBKMW'; consumer: group-id: fzzygroup enable-auto-commit: true @@ -68,14 +69,16 @@ key-deserializer: org.apache.kafka.common.serialization.StringDeserializer value-deserializer: org.apache.kafka.common.serialization.StringDeserializer mqtt: host: tcp://10.13.4.84:11883 client-id: client-username: client-password: client-timeout: 10 client-alive-time: 20 client-max-connect-times: 5 client-topics: client-qos: 0 isOpen: false mqtt: host: tcp://127.0.0.1:1883 username: admin password: admin123321 client-inId: fzzy_client_id_in_igds_api client-outId: fzzy_client_id_out_igds_api completionTimeout: 3000 keep-alive-interval: 2 max-connect-times: 5 qos: 0 isOpen: false default-topic: mqtt/+/test1 topics: /device-message-sender/# src/main/resources/application.yml
@@ -34,4 +34,4 @@ default: companyId: 5326 file-path: C:/app/igds-api img-path: D:/IGDS/FILE/ img-path: D:/IGDS/FILE/ src/main/resources/logback-spring.xml
@@ -6,9 +6,9 @@ <property name="APP_MODEL" value="igds-api" /> <!-- devæä»¶è·¯å¾ ä¸è¬ä¸éè¦é ç½® --> <property name="DEV_LOG_HOME" value="C:/app/igds-api/log"/>\ <property name="DEV_LOG_HOME" value="D:/app/igds-api/log"/>\ <!-- proæä»¶è·¯å¾ --> <property name="PRO_LOG_HOME" value="C:/app/igds-api/log" /> <property name="PRO_LOG_HOME" value="D:/app/igds-api/log" /> <!-- linuxæä»¶è·¯å¾ --> <property name="PRO_LINUX_HOME" value="/usr/local/fzzy/igds-api/log" />