From 7141d2cd0620f33d6a1b1dbd859823bc001cafdc Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 29 十二月 2023 11:04:48 +0800
Subject: [PATCH] 车牌搜索
---
ard-work/src/main/java/com/ruoyi/sy/param/ArdSyCarParam.java | 15 +++++++
ard-work/src/main/java/com/ruoyi/sy/vo/ArdSyCarVo.java | 2
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java | 45 ++--------------------
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 3 +
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 50 +++++++++++++++++++++++++
5 files changed, 74 insertions(+), 41 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
index 3513118..2b5a858 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -1,7 +1,6 @@
package com.ruoyi.sy.controller;
import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.annotation.PostConstruct;
@@ -14,7 +13,8 @@
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
-import com.ruoyi.sy.domain.ArdSyCarVo;
+import com.ruoyi.sy.param.ArdSyCarParam;
+import com.ruoyi.sy.vo.ArdSyCarVo;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.gps31.PositionContainer;
import com.ruoyi.sy.gps31.PushClientImplAlarm;
@@ -39,7 +39,6 @@
import com.ruoyi.sy.domain.ArdSyCar;
import com.ruoyi.sy.service.IArdSyCarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
@@ -122,46 +121,12 @@
@PreAuthorize("@ss.hasPermi('sy:syCar:list')")
@GetMapping("/list")
@ApiOperation("鏌ヨ涓変竴杞﹁締鍒楄〃")
- public AjaxResult list(ArdSyCar ardSyCar)
+ public AjaxResult list(ArdSyCarParam ardSyCarParam)
{
- if(ardSyCar.getPageNum()==null || ardSyCar.getPageNum() == 0){
- ardSyCar.setPageNum(1);
- }
- if(ardSyCar.getPageSize()==null || ardSyCar.getPageSize() == 0){
- ardSyCar.setPageSize(10);
- }
- PageHelper.startPage(ardSyCar.getPageNum(),ardSyCar.getPageSize());
- List<ArdSyCar> list = ardSyCarService.selectArdSyCarList(ardSyCar);
+ PageHelper.startPage(ardSyCarParam.getPageNum(),ardSyCarParam.getPageSize());
String userId = SecurityUtils.getUserId();
Map<String,Object> result = ardSyCarService.getArdSyCarAll(userId);
- List<ArdSyCarVo> ardSyCarVoList = new ArrayList<>();
- if(((String)result.get("code")).equals("200")){
- List<Map<String,Object>> list1 = (List<Map<String, Object>>) result.get("data");
- for (int i = 0; i < list.size(); i++) {
- ArdSyCar ardSyCar1 = list.get(i);
- String carId = ardSyCar1.getCarId();
- for (int j = 0; j < list1.size(); j++) {
- String carId31 = (String) list1.get(j).get("carId");
- if(carId.equals(carId31)){
- ArdSyCarVo ardSyCarVo = new ArdSyCarVo();
- ardSyCarVo.setId(ardSyCar1.getId());
- ardSyCarVo.setCarId(carId);
- ardSyCarVo.setCarBrand(ardSyCar1.getCarBrand());
- ardSyCarVo.setCarModel(ardSyCar1.getCarModel());
- ardSyCarVo.setCarPicture(ardSyCar1.getCarPicture());
- ardSyCarVo.setCarType(ardSyCar1.getCarType());
- ardSyCarVo.setDeptId(ardSyCar1.getDeptId());
- ardSyCarVo.setRemark(ardSyCar1.getRemark());
- ardSyCarVo.setCarPlate((String) list1.get(j).get("carPlate"));
- ardSyCarVoList.add(ardSyCarVo);
- break;
- }
- }
- }
- return AjaxResult.success(new PageInfo<>(ardSyCarVoList));
- }else {
- return AjaxResult.success(new PageInfo<>(list));
- }
+ return ardSyCarService.ardSyCarList(ardSyCarParam,result);
}
/**
diff --git a/ard-work/src/main/java/com/ruoyi/sy/param/ArdSyCarParam.java b/ard-work/src/main/java/com/ruoyi/sy/param/ArdSyCarParam.java
new file mode 100644
index 0000000..5bdd0bc
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/param/ArdSyCarParam.java
@@ -0,0 +1,15 @@
+package com.ruoyi.sy.param;
+
+import lombok.Data;
+
+/**
+ * @author Administrator
+ */
+@Data
+public class ArdSyCarParam {
+ private Integer pageNum = 1;
+ private Integer pageSize = 10;
+ private String carType;
+ private String carBrand;
+ private String carPlate;
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
index 1de5883..59c3e58 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -9,6 +9,7 @@
import com.ruoyi.sy.domain.ArdAccessFence;
import com.ruoyi.sy.domain.ArdSyCar;
import com.ruoyi.sy.domain.ArdSyUser;
+import com.ruoyi.sy.param.ArdSyCarParam;
import com.ruoyi.utils.result.Results;
import org.springframework.web.multipart.MultipartFile;
@@ -36,6 +37,8 @@
*/
public List<ArdSyCar> selectArdSyCarList(ArdSyCar ardSyCar);
+ AjaxResult ardSyCarList(ArdSyCarParam ardSyCarParam,Map<String,Object> result);
+
/**
* 鏂板涓変竴杞﹁締
*
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index 774ea33..05b4b69 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -15,11 +15,15 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.sy.domain.ArdAccessFence;
+import com.ruoyi.sy.param.ArdSyCarParam;
+import com.ruoyi.sy.vo.ArdSyCarVo;
import com.ruoyi.utils.gis.GisUtil;
import com.ruoyi.utils.gis.Point;
import com.ruoyi.scheduling.domian.SchedulingParam;
@@ -113,6 +117,52 @@
return ardSyCarMapper.selectArdSyCarList(ardSyCar);
}
+ @Override
+ public AjaxResult ardSyCarList(ArdSyCarParam ardSyCarParam,Map<String,Object> result) {
+ QueryWrapper<ArdSyCar> queryWrapper = new QueryWrapper<>();
+ queryWrapper.like(ardSyCarParam.getCarBrand()!=null,"car_brand",ardSyCarParam.getCarBrand())
+ .like(ardSyCarParam.getCarType()!=null,"car_type",ardSyCarParam.getCarType());
+ List<ArdSyCar> ardSyCars = ardSyCarMapper.selectList(queryWrapper);
+ List<ArdSyCarVo> ardSyCarVoList = new ArrayList<>();
+ if(((String)result.get("code")).equals("200")){
+ List<Map<String,Object>> list = (List<Map<String, Object>>) result.get("data");
+ for (int i = 0; i < ardSyCars.size(); i++) {
+ ArdSyCar ardSyCar = ardSyCars.get(i);
+ String carId = ardSyCar.getCarId();
+ for (int j = 0; j < list.size(); j++) {
+ String carId31 = (String) list.get(j).get("carId");
+ if(carId.equals(carId31)){
+ ArdSyCarVo ardSyCarVo = new ArdSyCarVo();
+ ardSyCarVo.setId(ardSyCar.getId());
+ ardSyCarVo.setCarId(carId);
+ ardSyCarVo.setCarBrand(ardSyCar.getCarBrand());
+ ardSyCarVo.setCarModel(ardSyCar.getCarModel());
+ ardSyCarVo.setCarPicture(ardSyCar.getCarPicture());
+ ardSyCarVo.setCarType(ardSyCar.getCarType());
+ ardSyCarVo.setDeptId(ardSyCar.getDeptId());
+ ardSyCarVo.setRemark(ardSyCar.getRemark());
+ ardSyCarVo.setCarPlate((String) list.get(j).get("carPlate"));
+ ardSyCarVoList.add(ardSyCarVo);
+ break;
+ }
+ }
+ }
+ if(ardSyCarParam.getCarPlate()!=null){
+ List<ArdSyCarVo> newList = new ArrayList<>();
+ for (int i = 0; i < ardSyCarVoList.size(); i++) {
+ String carPlate = ardSyCarVoList.get(i).getCarPlate();
+ if(!carPlate.contains(ardSyCarParam.getCarPlate())){
+ newList.add(ardSyCarVoList.get(i));
+ }
+ }
+ ardSyCarVoList.remove(newList);
+ }
+ return AjaxResult.success(new PageInfo<>(ardSyCarVoList));
+ }else {
+ return AjaxResult.error("31骞冲彴杩炴帴澶辫触锛岃溅鐗屽彿鑾峰彇澶辫触锛�",new PageInfo<>(ardSyCars));
+ }
+ }
+
/**
* 鏂板涓変竴杞﹁締
*
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarVo.java b/ard-work/src/main/java/com/ruoyi/sy/vo/ArdSyCarVo.java
similarity index 91%
rename from ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarVo.java
rename to ard-work/src/main/java/com/ruoyi/sy/vo/ArdSyCarVo.java
index 67d0be9..9caa032 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdSyCarVo.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/vo/ArdSyCarVo.java
@@ -1,4 +1,4 @@
-package com.ruoyi.sy.domain;
+package com.ruoyi.sy.vo;
import lombok.Data;
--
Gitblit v1.9.3