From 1f19fc38b37ed1aa96802702ca406ab740a8aa6c Mon Sep 17 00:00:00 2001 From: aijinhui <aijinhui> Date: 星期四, 19 十月 2023 15:35:49 +0800 Subject: [PATCH] RTU列表 --- ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 125 +++++++++++++++++++++++++++++++---------- 1 files changed, 93 insertions(+), 32 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 a5d3a43..322a260 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,11 +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; @@ -38,6 +41,95 @@ @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); + } + + @PostMapping("/add") + @ApiOperation("娣诲姞rtu") + public Results add(String carId){ + return Results.succeed("鎴愬姛娣诲姞"+ardSyCarLockService.addRtu(carId)+"鏉℃暟鎹�"); + } + + @DeleteMapping("/del") + @ApiOperation("鍒犻櫎rtu") + public Results del(String id){ + return Results.succeed("鎴愬姛鍒犻櫎"+ardSyCarLockService.delCar(id)+"鏉℃暟鎹�"); + } + + @GetMapping("/one") + @ApiOperation("鏌ヨ涓�鏉tu鍙婇攣") + public Results one(String carId){ + CarLockVo carLockVo = new CarLockVo(); + CarVo carVo = ardSyCarLockService.carOne(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"); + carVo.setCarPlate(carPlate); + String drvName = (String) jsonObject.get("drvName"); + carVo.setDrvName(drvName); + String drvPhone = (String) jsonObject.get("drvPhone"); + carVo.setDrvPhone(drvPhone); + carLockVo.setCar(carVo); + String rtu = carVo.getRtu(); + carLockVo.setCarLockList(ardSyCarLockService.carLock(rtu)); + return Results.succeed(carLockVo); + } + + @GetMapping("/query") + @ApiOperation("鏌ヨ鎵�鏈塺tu鎸傝浇鐨勮溅杈�") + public Results query(){ + List<CarVo> list = ardSyCarLockService.carList(); + analysis(list); + return Results.succeed(list); + } + + @PostMapping("/addLock") + @ApiOperation("娣诲姞淇敼閿�") + public Results addLock(@RequestBody List<ArdSyCarLock> locks){ + 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); String syURL = sysConfigService.getSYURL(); @@ -55,38 +147,7 @@ String drvPhone = (String) jsonObject.get("drvPhone"); carVo.setDrvPhone(drvPhone); } - return Results.succeed(list); + return list; } - - @PostMapping("/add") - @ApiOperation("娣诲姞rtu") - public Results add(String carId){ - return Results.succeed("鎴愬姛娣诲姞"+ardSyCarLockService.addRtu(carId)+"鏉℃暟鎹�"); - } - - @DeleteMapping("/del") - @ApiOperation("鍒犻櫎rtu") - public Results del(String carId){ - return Results.succeed("鎴愬姛鍒犻櫎"+ardSyCarLockService.delCar(carId)+"鏉℃暟鎹�"); - } - - @GetMapping("/one") - @ApiOperation("鏌ヨ涓�鏉tu鍙婇攣") - public Results one(String carId){ - return Results.succeed(ardSyCarLockService.carLock(carId)); - } - - @GetMapping("/query") - @ApiOperation("鏌ヨ鎵�鏈塺tu鎸傝浇鐨勮溅杈�") - public Results query(){ - return Results.succeed(ardSyCarLockService.carList()); - } - - @GetMapping("/addLock") - @ApiOperation("娣诲姞淇敼閿�") - public Results addLock(@RequestBody List<ArdSyCarLock> locks){ - return Results.succeed(ardSyCarLockService.addUpdLock(locks)); - } - } -- Gitblit v1.9.3