From ddb23d4fa6d666ef51db3cd8e4f0f6cab7a1fe78 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 12 一月 2024 17:17:14 +0800
Subject: [PATCH] 锁
---
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java | 20 ++++++++++++--------
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 2 +-
ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java | 2 +-
3 files changed, 14 insertions(+), 10 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 fb1216d..1f46524 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
@@ -217,7 +217,7 @@
@GetMapping("/lockIng")
@ApiOperation("瀹炴椂閿佺姸鎬�")
public AjaxResult lockIng(String carId) {
- return AjaxResult.success(ardSyCarLockService.lockIng(carId));
+ return ardSyCarLockService.lockIng(carId);
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java b/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java
index de77d89..2603098 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java
@@ -51,6 +51,6 @@
AjaxResult onOff(LockTypeParam lockTypeParam) throws MqttException;
- List<ArdSyCarLock> lockIng(String carId);
+ AjaxResult lockIng(String carId);
}
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 78997a7..22a6ae9 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
@@ -387,18 +387,22 @@
}
@Override
- public List<ArdSyCarLock> lockIng(String carId) {
+ public AjaxResult lockIng(String carId) {
QueryWrapper<ArdSyCarRtu> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("car_id",carId);
ArdSyCarRtu ardSyCarRtu = rtuMapper.selectOne(queryWrapper);
- List<ArdSyCarLock> locks = lockMapper.lockList(ardSyCarRtu.getId());
- for (int i = 0; i < locks.size(); i++) {
- ArdSyCarLock ardSyCarLock = locks.get(i);
- double info = ardSyCarLock.getCurrentInfo();
- int d = (int) ((int)(info*150/138.3 - 4)/0.16);
- ardSyCarLock.setCurrentInfo((double) d);
+ if(ardSyCarRtu!=null){
+ List<ArdSyCarLock> locks = lockMapper.lockList(ardSyCarRtu.getId());
+ for (int i = 0; i < locks.size(); i++) {
+ ArdSyCarLock ardSyCarLock = locks.get(i);
+ double info = ardSyCarLock.getCurrentInfo();
+ int d = (int) ((int)(info*150/138.3 - 4)/0.16);
+ ardSyCarLock.setCurrentInfo((double) d);
+ }
+ return AjaxResult.success(locks);
+ }else {
+ return AjaxResult.error("鏃犺杞︾殑閿佹暟鎹紒");
}
- return locks;
}
--
Gitblit v1.9.3