From 0789e8546f8b5e68590e5ad7f4eb1d5c54e6cc22 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 26 三月 2024 15:49:02 +0800
Subject: [PATCH] BUG
---
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 63 ++++++++++++++++++++-----------
1 files changed, 41 insertions(+), 22 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 92d6ab4..d9e9864 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
@@ -1,6 +1,9 @@
package com.ruoyi.sy.controller;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
@@ -9,10 +12,7 @@
import com.ruoyi.sy.domain.ArdSyCarRtu;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.mapper.ArdAccessFenceMapper;
-import com.ruoyi.sy.param.AddCarParam;
-import com.ruoyi.sy.param.AddRtuParam;
-import com.ruoyi.sy.param.LockTypeParam;
-import com.ruoyi.sy.param.RtuTypeParam;
+import com.ruoyi.sy.param.*;
import com.ruoyi.sy.service.*;
import com.ruoyi.sy.service.impl.ArdSyCarRtuServiceImpl;
import com.ruoyi.sy.vo.CarLockVo;
@@ -88,28 +88,45 @@
String syURL = sysConfigService.getSYURL();
Map<String,Object> map = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
List list1 = (List) map.get("list");
- JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
- String carPlate = (String) jsonObject.get("carPlate");
- carVo.setCarPlate(carPlate);
- String drvName = (String) jsonObject.get("drvName");
- carVo.setDrvName(drvName);
- String drvPhone = (String) jsonObject.get("drvPhone");
- carVo.setDrvPhone(drvPhone);
- carLockVo.setCar(carVo);
+ if(list1.size()>0){
+ JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
+ String carPlate = (String) jsonObject.get("carPlate");
+ carVo.setCarPlate(carPlate);
+ String drvName = (String) jsonObject.get("drvName");
+ carVo.setDrvName(drvName);
+ String drvPhone = (String) jsonObject.get("drvPhone");
+ carVo.setDrvPhone(drvPhone);
+ }
+
String rtu = carVo.getRtu();
carLockVo.setCarLockList(ardSyCarLockService.carLock(rtu));
ArdSyCarRtu ardSyCarRtu = ardSyCarRtuService.one(carId);
carVo.setInstallType(ardSyCarRtu.getInstallType());
carVo.setUnloadType(ardSyCarRtu.getUnloadType());
+ carLockVo.setCar(carVo);
return AjaxResult.success(carLockVo);
}
@GetMapping("/query")
@ApiOperation("鏌ヨ鎵�鏈塺tu鎸傝浇鐨勮溅杈�")
- public Results query(){
+ public Results query(LockPageParam lockPageParam){
List<CarVo> list = ardSyCarLockService.carList();
analysis(list);
- return Results.succeed(list);
+ List<CarVo> newList = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ String plate = list.get(i).getCarPlate();
+ if(lockPageParam.getCarPlate()!=null){
+ if(plate.contains(lockPageParam.getCarPlate())){
+ newList.add(list.get(i));
+ }
+ }
+ }
+ PageHelper.startPage(lockPageParam.getPageNum(),lockPageParam.getPageSize());
+ if(lockPageParam.getCarPlate()!=null){
+ return Results.succeed(new PageInfo<>(newList));
+ }else {
+ return Results.succeed(new PageInfo<>(list));
+ }
}
@PostMapping("/addLock")
@@ -204,7 +221,7 @@
@GetMapping("/lockIng")
@ApiOperation("瀹炴椂閿佺姸鎬�")
public AjaxResult lockIng(String carId) {
- return AjaxResult.success(ardSyCarLockService.lockIng(carId));
+ return ardSyCarLockService.lockIng(carId);
}
@@ -218,13 +235,15 @@
String carId = carVo.getCarId();
Map<String,Object> map = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
List list1 = (List) map.get("list");
- JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
- String carPlate = (String) jsonObject.get("carPlate");
- carVo.setCarPlate(carPlate);
- String drvName = (String) jsonObject.get("drvName");
- carVo.setDrvName(drvName);
- String drvPhone = (String) jsonObject.get("drvPhone");
- carVo.setDrvPhone(drvPhone);
+ if(list1.size()>0){
+ JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
+ String carPlate = (String) jsonObject.get("carPlate");
+ carVo.setCarPlate(carPlate);
+ String drvName = (String) jsonObject.get("drvName");
+ carVo.setDrvName(drvName);
+ String drvPhone = (String) jsonObject.get("drvPhone");
+ carVo.setDrvPhone(drvPhone);
+ }
}
return list;
}
--
Gitblit v1.9.3