From 7195f208af6fab82dc9c76c365b6c75aa364dd80 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期三, 01 十一月 2023 09:07:23 +0800
Subject: [PATCH] 围栏controller名称修改

---
 ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 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..fc95160 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,14 +1,20 @@
 package com.ruoyi.sy.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.sy.domain.ArdAccessFence;
 import com.ruoyi.sy.domain.ArdSyCarLock;
+import com.ruoyi.sy.domain.ArdSyCarRtu;
 import com.ruoyi.sy.domain.ArdSyUser;
+import com.ruoyi.sy.mapper.ArdAccessFenceMapper;
+import com.ruoyi.sy.service.ArdAccessFenceService;
 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;
@@ -34,11 +40,21 @@
     private IArdSyCarService ardSyCarService;
     @Autowired
     private ArdSyCarLockService ardSyCarLockService;
+    @Autowired
+    private ArdAccessFenceService ardAccessFenceService;
 
     @GetMapping("/car")
     @ApiOperation("鏌ヨ鎵�鏈夋湭鎸傞攣鐨勮溅杈�")
     public Results car(){
         List<CarVo> list = ardSyCarLockService.car();
+        analysis(list);
+        return Results.succeed(list);
+    }
+
+    @GetMapping("/carAddOne")
+    @ApiOperation("鏌ヨ鎵�鏈夋湭鎸傞攣鐨勮溅杈嗗姞鏈溅杈嗕俊鎭�")
+    public Results carAddOne(String carId){
+        List<CarVo> list = ardSyCarLockService.carAddOne(carId);
         analysis(list);
         return Results.succeed(list);
     }
@@ -93,6 +109,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);
@@ -114,4 +156,23 @@
         return list;
     }
 
+    @GetMapping("/addCar")
+    @ApiOperation("娓呮筏鎵嬪姩娣诲姞杞﹁締鏌ヨ")
+    public AjaxResult queryCar(){
+        List<ArdAccessFence> ardAccessFences = ardAccessFenceService.all();
+        List<String> carIdList = new ArrayList<>();
+        for (int i = 0; i < ardAccessFences.size(); i++) {
+            String carId = ardAccessFences.get(i).getCarId();
+            carIdList.add(carId);
+        }
+        List<CarVo> list = ardSyCarLockService.queryCar(carIdList);
+        analysis(list);
+        return AjaxResult.success(list);
+    }
+
+    @PostMapping("/addCar")
+    @ApiOperation("娓呮筏鎵嬪姩娣诲姞杞﹁締淇濆瓨")
+    public AjaxResult queryCar(@RequestBody CarVo carVo){
+        return AjaxResult.success(ardAccessFenceService.addCar(carVo));
+    }
 }

--
Gitblit v1.9.3