From 4269d20178cfab9253aacac15e1c02905c192428 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 15 十二月 2023 13:33:52 +0800
Subject: [PATCH] 设备健康列表
---
ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/MessageCallback.java | 2 +-
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java | 14 ++++++++------
ard-work/src/main/resources/mapper/sy/ArdSyCarLockMapper.xml | 2 +-
ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java | 2 +-
ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/EmqClient.java | 2 ++
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 4 ++--
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 10 +++++-----
ruoyi-admin/src/main/resources/application-dev.yml | 5 +++--
8 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
index 3ad7937..f24ca1a 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
@@ -189,13 +189,13 @@
@PostMapping("/onOff")
@ApiOperation("杩滅▼寮�閿�")
public AjaxResult onOff(@RequestBody LockTypeParam lockTypeParam) throws MqttException {
- return AjaxResult.success(ardSyCarLockService.onOff(lockTypeParam));
+ return ardSyCarLockService.onOff(lockTypeParam);
}
@PostMapping("/seal")
@ApiOperation("杩滅▼灏佸嵃")
public AjaxResult seal(@RequestBody RtuTypeParam rtuTypeParam) {
- return AjaxResult.success(ardSyCarLockService.seal(rtuTypeParam));
+ return ardSyCarLockService.seal(rtuTypeParam);
}
@GetMapping("/lockIng")
diff --git a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
index e6e13f6..f360ce8 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
@@ -479,6 +479,11 @@
if(fengType==0){
//閿佸紑鍏崇姸鎬�
int lockCloseNum = 0;
+ String mapString1 = "{\"A01\":100000,\"A02\":100000,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
+ System.out.println("鑷姩鏂藉皝锛�"+mapString1);
+ EmqClient emqClient1 = new EmqClient(carId+"mqttPublish"+UUID.randomUUID());
+ emqClient1.connect();
+ emqClient1.publish(ardSyCarRtu.getTopicPublish(),mapString1, QosEnum.QoS2,false);
//濡傛灉涓嶆槸鏂藉皝鐘舵�侊紝鍒欏彂閫佹柦灏佸懡浠�
if(ardSyCarLocks.get(0).getRelayInfo()!=null){
if(ardSyCarLocks.get(0).getRelayInfo()==1){
@@ -522,11 +527,6 @@
// map.put("A02", 100000);//鏂紑绗簩璺户鐢靛櫒
// map.put("res", String.valueOf(System.currentTimeMillis()));
// String mapString = com.alibaba.fastjson.JSON.toJSONString(map);
- String mapString = "{\"A01\":100000,\"A02\":100000,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
- System.out.println("鑷姩鏂藉皝锛�"+mapString);
- EmqClient emqClient = new EmqClient(carId+"mqttPublish"+UUID.randomUUID());
- emqClient.connect();
- emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
log.debug("杞﹁締"+carId+"鏂藉皝鍛戒护鍙戦�佹垚鍔燂紒");
// mqttOnce.publishCar(carId,ardSyCarRtu.getTopicPublish(),String.valueOf(new JSONObject(map)),"鏂藉皝");
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
index 451b9c0..e2da7e7 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
@@ -32,7 +32,7 @@
/**
* @author Administrator
*/
-@Slf4j
+@Slf4j(topic = "mqttCar")
@Service
public class ArdSyCarLockServiceImpl implements ArdSyCarLockService {
@@ -271,6 +271,11 @@
int lockCloseNum = 0;
//鏌ヨ閿佷俊鎭�
List<ArdSyCarLock> ardSyCarLocks = carLock(ardSyCarRtu.getId());
+ String mapString1 = "{\"A01\":100000,\"A02\":100000,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
+ System.out.println("鏂藉皝锛�"+mapString1);
+ EmqClient emqClient1 = new EmqClient(rtuTypeParam.getCarId()+"mqttPublish"+UUID.randomUUID());
+ emqClient1.connect();
+ emqClient1.publish(ardSyCarRtu.getTopicPublish(),mapString1, QosEnum.QoS2,false);
for (int j = 0; j < ardSyCarLocks.size(); j++) {
ArdSyCarLock ardSyCarLock = ardSyCarLocks.get(j);
String currents = ardSyCarLock.getCurrents();
@@ -295,6 +300,8 @@
emqClient.connect();
emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
// mqttOnce.publishCar("carId",ardSyCarRtu.getTopicPublish(),String.valueOf(new com.alibaba.fastjson2.JSONObject(map)),"寮�閿侊細"+currents);
+// long startTime = System.currentTimeMillis(); // 鑾峰彇寰幆寮�濮嬫椂闂�
+// long endTime = startTime + 30000; // 璁剧疆寰幆缁撴潫鏃堕棿涓哄紑濮嬫椂闂村姞涓�5绉掗挓
while(true){
ArdSyCarLock ardSyCarLock1 = getCurrentInfo(ardSyCarRtu.getId(),currents);
Double currentInfo1 = ardSyCarLock1.getCurrentInfo();
@@ -311,11 +318,6 @@
// map.put("A02", 100000);//鏂紑绗簩璺户鐢靛櫒
// map.put("res", String.valueOf(System.currentTimeMillis()));
// String mapString = JSON.toJSONString(map);
- String mapString = "{\"A01\":100000,\"A02\":100000,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
- System.out.println("鏂藉皝锛�"+mapString);
- EmqClient emqClient = new EmqClient(rtuTypeParam.getCarId()+"mqttPublish"+UUID.randomUUID());
- emqClient.connect();
- emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
return AjaxResult.success("鏂藉皝鍛戒护鍙戠敓鎴愬姛锛�");
// return AjaxResult.success(mqttOnce.publishCar(rtuTypeParam.getCarId(),ardSyCarRtu.getTopicPublish(),String.valueOf(new com.alibaba.fastjson2.JSONObject(map)),"鏂藉皝"));
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java
index fa9b91c..c679bed 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/AutoMqtt.java
@@ -12,7 +12,7 @@
import java.util.List;
import java.util.UUID;
-@Slf4j
+@Slf4j(topic = "mqttCar")
@Component
public class AutoMqtt {
diff --git a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/EmqClient.java b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/EmqClient.java
index 2c0d40c..9c8c409 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/EmqClient.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/EmqClient.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.sy.service.ArdSyCarRtuService;
+import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.IMqttClient;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
@@ -12,6 +13,7 @@
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+@Slf4j(topic = "mqttCar")
public class EmqClient {
private IMqttClient mqttClient;
diff --git a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/MessageCallback.java b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/MessageCallback.java
index 0ebac20..bc313ec 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/MessageCallback.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/qymqtt/newM/MessageCallback.java
@@ -20,7 +20,7 @@
import com.alibaba.fastjson.JSON;
-@Slf4j
+@Slf4j(topic = "mqttCar")
public class MessageCallback implements MqttCallback {
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
diff --git a/ard-work/src/main/resources/mapper/sy/ArdSyCarLockMapper.xml b/ard-work/src/main/resources/mapper/sy/ArdSyCarLockMapper.xml
index b91c775..283c83b 100644
--- a/ard-work/src/main/resources/mapper/sy/ArdSyCarLockMapper.xml
+++ b/ard-work/src/main/resources/mapper/sy/ArdSyCarLockMapper.xml
@@ -6,7 +6,7 @@
<select id="lockList" parameterType="String" resultType="com.ruoyi.sy.domain.ArdSyCarLock">
SELECT id,currents,rtu_id,current_info,relay,img_position_left,img_position_top,relay_info,lock_name FROM ard_sy_car_lock
- WHERE rtu_id = #{rtuId}
+ WHERE rtu_id = #{rtuId} order by id
</select>
</mapper>
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml
index 0ea788b..7876aa6 100644
--- a/ruoyi-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-admin/src/main/resources/application-dev.yml
@@ -33,7 +33,8 @@
rongCloud: info
cmd: info
uav: info
- sy: info
+ sy: debug
+ mqttCar: debug
## knife4j閰嶇疆
knife4j:
# knife4j澧炲己鍔熻兘,寮�鍚悗涓嬮潰鍙傛暟鎵嶇敓鏁�
@@ -51,7 +52,7 @@
endpoint: http://192.168.2.15:9001
accessKey: admin
secretKey: xzx12345
- path: G:/DATA
+ path: D:/DATA
#娴佸獟浣撹浆鐮佹湇鍔″櫒
mediamtx:
enabled: true
--
Gitblit v1.9.3