From 8dcf0af29d03e596a5071dfea3df3d5e89f4ff3b Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期四, 19 十月 2023 13:52:15 +0800
Subject: [PATCH] 修改RTU
---
ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarRtu.java | 2
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java | 35 +++++++++++++++++
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 28 ++++++++++++++
ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java | 5 ++
ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java | 18 +++++++++
5 files changed, 87 insertions(+), 1 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 855640f..4bd8949 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
@@ -3,12 +3,14 @@
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.sy.domain.ArdSyCarLock;
+import com.ruoyi.sy.domain.ArdSyCarRtu;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.service.ArdSyCarLockService;
import com.ruoyi.sy.service.IArdSyCarService;
import com.ruoyi.sy.service.IArdSyUserService;
import com.ruoyi.sy.vo.CarLockVo;
import com.ruoyi.sy.vo.CarVo;
+import com.ruoyi.sy.vo.RtuVo;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
@@ -93,6 +95,32 @@
return Results.succeed("鎴愬姛娣诲姞/淇敼"+ardSyCarLockService.addUpdLock(locks)+"鏉℃暟鎹�");
}
+ @GetMapping("/onrRtu")
+ @ApiOperation("鏇存敼Rtu鍓嶆煡璇�")
+ public Results onrRtu(String carId){
+ RtuVo rtuVo = ardSyCarLockService.updRtu(carId);
+ String usersId = SecurityUtils.getUserId();
+ ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
+ String syURL = sysConfigService.getSYURL();
+ Results results = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
+ Map<String,Object> map = (Map<String, Object>) results.getData();
+ List list1 = (List) map.get("list");
+ JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
+ String carPlate = (String) jsonObject.get("carPlate");
+ rtuVo.setCarPlate(carPlate);
+ String drvName = (String) jsonObject.get("drvName");
+ rtuVo.setDrvName(drvName);
+ String drvPhone = (String) jsonObject.get("drvPhone");
+ rtuVo.setDrvPhone(drvPhone);
+ return Results.succeed(rtuVo);
+ }
+
+ @PutMapping("/updRtu")
+ @ApiOperation("鏇存敼Rtu")
+ public Results updRtu(@RequestBody ArdSyCarRtu ardSyCarRtu){
+ return Results.succeed("鎴愬姛淇敼"+ardSyCarLockService.updRtuCar(ardSyCarRtu)+"鏉℃暟鎹�");
+ }
+
public List<CarVo> analysis(List<CarVo> list){
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarRtu.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarRtu.java
index c2bf70d..b02fa9b 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarRtu.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarRtu.java
@@ -7,7 +7,7 @@
* @author Administrator
*/
@Data
-public class ArdSyCarRtu extends BaseEntity {
+public class ArdSyCarRtu {
private String id;
private String carId;
private String topicSubscribe;
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 146f406..95c73e5 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
@@ -1,8 +1,10 @@
package com.ruoyi.sy.service;
import com.ruoyi.sy.domain.ArdSyCarLock;
+import com.ruoyi.sy.domain.ArdSyCarRtu;
import com.ruoyi.sy.vo.CarLockVo;
import com.ruoyi.sy.vo.CarVo;
+import com.ruoyi.sy.vo.RtuVo;
import java.util.List;
@@ -27,4 +29,7 @@
int addUpdLock(List<ArdSyCarLock> ardSyCarLock);
+ RtuVo updRtu(String carId);
+ int updRtuCar(ArdSyCarRtu ardSyCarRtu);
+
}
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 cc3f651..6ef1ba2 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
@@ -11,6 +11,7 @@
import com.ruoyi.sy.service.ArdSyCarLockService;
import com.ruoyi.sy.vo.CarLockVo;
import com.ruoyi.sy.vo.CarVo;
+import com.ruoyi.sy.vo.RtuVo;
import com.ruoyi.system.mapper.SysDeptMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -68,6 +69,9 @@
@Override
public int delCar(String id) {
rtuMapper.deleteById(id);
+ QueryWrapper<ArdSyCarLock> queryWrapper1 = new QueryWrapper<>();
+ queryWrapper1.eq("rtu_id",id);
+ lockMapper.delete(queryWrapper1);
QueryWrapper<ArdSyCar> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("reserved_1",id);
ArdSyCar ardSyCar = ardSyCarMapper.selectOne(queryWrapper);
@@ -117,6 +121,37 @@
return num;
}
+ @Override
+ public RtuVo updRtu(String carId) {
+ QueryWrapper<ArdSyCarRtu> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("car_id",carId);
+ ArdSyCarRtu ardSyCarRtu = rtuMapper.selectOne(queryWrapper);
+ RtuVo rtuVo = new RtuVo();
+ QueryWrapper<ArdSyCar> queryWrapper1 = new QueryWrapper<>();
+ queryWrapper1.eq("car_id",carId);
+ ArdSyCar ardSyCar= ardSyCarMapper.selectOne(queryWrapper1);
+ rtuVo.setCarId(ardSyCar.getCarId());
+ rtuVo.setCarPicture(ardSyCar.getCarPicture());
+ rtuVo.setCarType(ardSyCar.getCarType());
+ rtuVo.setDeptId(ardSyCar.getDeptId());
+ SysDept sysDept = sysDeptMapper.selectById(ardSyCar.getDeptId());
+ rtuVo.setDeptName(sysDept.getDeptName());
+ rtuVo.setRtu(ardSyCar.getReserved1());
+ rtuVo.setTopicPublish(ardSyCarRtu.getTopicPublish());
+ rtuVo.setTopicSubscribe(ardSyCarRtu.getTopicSubscribe());
+ return rtuVo;
+ }
+
+ @Override
+ public int updRtuCar(ArdSyCarRtu ardSyCarRtu) {
+ rtuMapper.updateById(ardSyCarRtu);
+ QueryWrapper<ArdSyCar> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("car_id",ardSyCarRtu.getCarId());
+ ArdSyCar ardSyCar = ardSyCarMapper.selectOne(queryWrapper);
+ ardSyCar.setReserved1(ardSyCarRtu.getCarId());
+ return ardSyCarMapper.updateById(ardSyCar);
+ }
+
public List<CarVo> carAnalysis(List<ArdSyCar> ardSyCars){
List<CarVo> list = new ArrayList<>();
for (int i = 0; i < ardSyCars.size(); i++) {
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
new file mode 100644
index 0000000..f022ec6
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/vo/RtuVo.java
@@ -0,0 +1,18 @@
+package com.ruoyi.sy.vo;
+
+import lombok.Data;
+
+@Data
+public class RtuVo {
+ private String carId;
+ private String carPlate;
+ private String drvName;
+ private String drvPhone;
+ private String carType;
+ private String carPicture;
+ private String deptId;
+ private String deptName;
+ private String rtu;
+ private String topicPublish;
+ private String topicSubscribe;
+}
--
Gitblit v1.9.3