From 9764b5879c808da31101eb4e05608233ea59ec53 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期六, 16 十二月 2023 14:30:24 +0800
Subject: [PATCH] RTU
---
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java | 2
ard-work/src/main/java/com/ruoyi/sy/vo/CarVo.java | 2
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 7 +
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 123 ++++++++++++++++++++--------------------
ard-work/src/main/java/com/ruoyi/utils/data/Query.java | 7 --
ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java | 2
6 files changed, 73 insertions(+), 70 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 f24ca1a..92d6ab4 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
@@ -98,6 +98,9 @@
carLockVo.setCar(carVo);
String rtu = carVo.getRtu();
carLockVo.setCarLockList(ardSyCarLockService.carLock(rtu));
+ ArdSyCarRtu ardSyCarRtu = ardSyCarRtuService.one(carId);
+ carVo.setInstallType(ardSyCarRtu.getInstallType());
+ carVo.setUnloadType(ardSyCarRtu.getUnloadType());
return AjaxResult.success(carLockVo);
}
@@ -115,9 +118,9 @@
return Results.succeed("鎴愬姛娣诲姞/淇敼"+ardSyCarLockService.addUpdLock(locks)+"鏉℃暟鎹�");
}
- @GetMapping("/onrRtu")
+ @GetMapping("/oneRtu")
@ApiOperation("鏇存敼Rtu鍓嶆煡璇�")
- public Results onrRtu(String carId){
+ public Results oneRtu(String carId){
RtuVo rtuVo = ardSyCarLockService.updRtu(carId);
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
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 f360ce8..b53d824 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
@@ -115,14 +115,6 @@
List<ArdOilWall> ardOilWalls = ardOilWallService.accessAll();
//鏃ユ湡鏍煎紡
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //杞﹂�熸爣璁�
- Boolean stop = true;
- //鍒ゆ柇杞﹂��
- if(speed>5){
- //mqtt鍙戦�佹棦瀹歊tu鐘舵��
- feng(carId,"鏂藉皝",carRtuService,lockService);
- stop = false;
- }
//濡傛灉娌℃湁璇存槑杞﹁締鏈繘鍏ヨ娌圭偣锛岄渶瑕佸尮閰嶆墍鏈夎娌圭偣鍥存爮
if(ardAccessFence==null){
//杞﹁締鏈繘鍏ヨ娌圭偣
@@ -152,14 +144,20 @@
ardAccessFence1.setDrct(drct);
ardAccessFence1.setIsAlarm(0);
ardAccessFenceService.access(ardAccessFence1);
- if(stop){
- //mqtt鍙戦�佹棦瀹歊tu鐘舵��
- feng(carId,"瑁呮补鐐�",carRtuService,lockService);
- }
+ //mqtt鍙戦�佹棦瀹歊tu鐘舵��
+ feng(carId,"瑁呮补鐐�",carRtuService,lockService);
break;
}
}
}else {
+ //杞﹂�熸爣璁�
+ Boolean stop = true;
+ //鍒ゆ柇杞﹂��
+ if(speed>5){
+ //mqtt鍙戦�佹棦瀹歊tu鐘舵��
+ feng(carId,"鏂藉皝",carRtuService,lockService);
+ stop = false;
+ }
//甯﹂攣杞﹁締鏈夊�间紭鍏堝垽鏂槸鍚︿负鎵嬪姩娣诲姞杞﹁締
if(ardAccessFence.getIsAlarm()==1){
//1涓烘墜鍔ㄦ坊鍔犺溅杈嗘棤闇�鎶ヨ淇℃伅锛屾洿鏂颁綅缃嵆鍙�
@@ -458,77 +456,78 @@
//1瑙e皝
if(fengType==1){
//濡傛灉涓嶆槸瑙e皝灏佺姸鎬侊紝鍒欏彂閫佹柦灏佸懡浠�
- if(ardSyCarLocks.get(0).getRelayInfo()!=null){
- if(ardSyCarLocks.get(0).getRelayInfo()==0){
+ if(ardSyCarLocks.get(0).getRelayInfo()==0 || ardSyCarLocks.get(0).getRelayInfo()==null){
// Map<String,Object> map = new HashMap<>();
// map.put("A01", 110000);//瀵奸�氱涓�璺户鐢靛櫒
// map.put("A02", 110000);//瀵奸�氱浜岃矾缁х數鍣�
// map.put("res", String.valueOf(System.currentTimeMillis()));
// String mapString = com.alibaba.fastjson.JSON.toJSONString(map);
- String mapString = "{\"A01\":110000,\"A02\":110000,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
- log.debug("鑷姩瑙e皝锛�"+mapString);
- EmqClient emqClient = new EmqClient(carId+"mqttPublish"+UUID.randomUUID());
- emqClient.connect();
- emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
- log.debug("杞﹁締"+carId+"瑙e皝鍛戒护鍙戦�佹垚鍔燂紒");
- // mqttOnce.publishCar(carId,ardSyCarRtu.getTopicPublish(),String.valueOf(new JSONObject(map)),"瑙e皝");
- }
+ String mapString = "{\"A01\":110000,\"A02\":110000,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
+ log.debug("鑷姩瑙e皝锛�"+mapString);
+ EmqClient emqClient = new EmqClient(carId+"mqttPublish"+UUID.randomUUID());
+ emqClient.connect();
+ emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
+ log.debug("杞﹁締"+carId+"瑙e皝鍛戒护鍙戦�佹垚鍔燂紒");
+ // mqttOnce.publishCar(carId,ardSyCarRtu.getTopicPublish(),String.valueOf(new JSONObject(map)),"瑙e皝");
}
}
+
//0鏂藉皝
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){
- for (int j = 0; j < ardSyCarLocks.size(); j++) {
- ArdSyCarLock ardSyCarLock = ardSyCarLocks.get(j);
- String currents = ardSyCarLock.getCurrents();
- Double currentInfo = ardSyCarLock.getCurrentInfo();
- //鐢垫祦鍊间负4.0鏄叧閿佺姸鎬�
- if(currentInfo.equals(4.00) || currentInfo.equals(4)){
- lockCloseNum += 1;
- }else {
- String key = "";
- if(currents.equals("C01")){
- key = "D03";
- }else if(currents.equals("C02")){
- key = "D04";
- }
+ if(ardSyCarLocks.get(0).getRelayInfo()==1 || ardSyCarLocks.get(0).getRelayInfo()==null){
+ //閿佸紑鍏崇姸鎬�
+ 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){
+ for (int j = 0; j < ardSyCarLocks.size(); j++) {
+ ArdSyCarLock ardSyCarLock = ardSyCarLocks.get(j);
+ String currents = ardSyCarLock.getCurrents();
+ Double currentInfo = ardSyCarLock.getCurrentInfo();
+ //鐢垫祦鍊间负4.0鏄叧閿佺姸鎬�
+ if(currentInfo.equals(4.00) || currentInfo.equals(4)){
+ lockCloseNum += 1;
+ }else {
+ String key = "";
+ if(currents.equals("C01")){
+ key = "D03";
+ }else if(currents.equals("C02")){
+ key = "D04";
+ }
// Map<String,Object> map = new HashMap();
// map.put(key, 0.01);
// map.put("res", String.valueOf(System.currentTimeMillis()));
// String mapString = com.alibaba.fastjson.JSON.toJSONString(map);
- String mapString = "{\""+key+"\":0.01,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
- log.debug("鑷姩鍏抽攣锛�"+mapString);
- EmqClient emqClient = new EmqClient(carId+"mqttPublish"+UUID.randomUUID());
- emqClient.connect();
- emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
- // mqttOnce.publishCar("carId",ardSyCarRtu.getTopicPublish(),String.valueOf(new JSONObject(map)),"寮�閿侊細"+currents);
- while(true){
- ArdSyCarLock ardSyCarLock1 = lockService.getCurrentInfo(ardSyCarRtu.getId(),currents);
- Double currentInfo1 = ardSyCarLock1.getCurrentInfo();
- if(currentInfo1.equals(4.00) || currentInfo1.equals(4)){
- lockCloseNum +=1;
- break;
+ String mapString = "{\""+key+"\":0.01,\"res\":\""+String.valueOf(System.currentTimeMillis())+"\"}";
+ log.debug("鑷姩鍏抽攣锛�"+mapString);
+ EmqClient emqClient = new EmqClient(carId+"mqttPublish"+UUID.randomUUID());
+ emqClient.connect();
+ emqClient.publish(ardSyCarRtu.getTopicPublish(),mapString, QosEnum.QoS2,false);
+ // mqttOnce.publishCar("carId",ardSyCarRtu.getTopicPublish(),String.valueOf(new JSONObject(map)),"寮�閿侊細"+currents);
+ while(true){
+ ArdSyCarLock ardSyCarLock1 = lockService.getCurrentInfo(ardSyCarRtu.getId(),currents);
+ Double currentInfo1 = ardSyCarLock1.getCurrentInfo();
+ if(currentInfo1.equals(4.00) || currentInfo1.equals(4)){
+ lockCloseNum +=1;
+ break;
+ }
}
}
}
- }
- if(lockCloseNum == 2){
+ if(lockCloseNum == 2){
// Map<String,Object> map = new HashMap<>();
// map.put("A01", 100000);//鏂紑绗竴璺户鐢靛櫒
// map.put("A02", 100000);//鏂紑绗簩璺户鐢靛櫒
// map.put("res", String.valueOf(System.currentTimeMillis()));
// String mapString = com.alibaba.fastjson.JSON.toJSONString(map);
- log.debug("杞﹁締"+carId+"鏂藉皝鍛戒护鍙戦�佹垚鍔燂紒");
- // mqttOnce.publishCar(carId,ardSyCarRtu.getTopicPublish(),String.valueOf(new JSONObject(map)),"鏂藉皝");
+ 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 e2da7e7..c27a0a6 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
@@ -177,6 +177,8 @@
rtuVo.setRtu(ardSyCar.getReserved1());
rtuVo.setTopicPublish(ardSyCarRtu.getTopicPublish());
rtuVo.setTopicSubscribe(ardSyCarRtu.getTopicSubscribe());
+ rtuVo.setInstallType(ardSyCarRtu.getInstallType());
+ rtuVo.setUnloadType(ardSyCarRtu.getUnloadType());
return rtuVo;
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/vo/CarVo.java b/ard-work/src/main/java/com/ruoyi/sy/vo/CarVo.java
index 47eba1b..4bee2c3 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/vo/CarVo.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/vo/CarVo.java
@@ -17,4 +17,6 @@
private String deptId;
private String deptName;
private String rtu;
+ private Integer installType; //瑁呮补鐐� 0鏂藉皝 1瑙e皝
+ private Integer unloadType; //鍗告补鐐� 0鏂藉皝 1瑙e皝
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java b/ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java
index f022ec6..d5c4915 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java
@@ -15,4 +15,6 @@
private String rtu;
private String topicPublish;
private String topicSubscribe;
+ private Integer installType; //瑁呮补鐐� 0鏂藉皝 1瑙e皝
+ private Integer unloadType; //鍗告补鐐� 0鏂藉皝 1瑙e皝
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/data/Query.java b/ard-work/src/main/java/com/ruoyi/utils/data/Query.java
index eb69b6d..ea4d318 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/data/Query.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/data/Query.java
@@ -70,16 +70,11 @@
rtu_data_yj_8.setZHS(rs.getInt("ZHS"));
dataBridgeList.add(rtu_data_yj_8);
}
+ conn.close();
return dataBridgeList;
} catch (Exception e) {
log.error("璁惧杩愯鐘舵�佹煡璇㈠紓甯�:" + e.getMessage());
return dataBridgeList;
- } finally {
- try {
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
}
}
}
--
Gitblit v1.9.3