| | |
| | | package com.ruoyi.sy.controller; |
| | | |
| | | 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.uuid.UUID; |
| | | import com.ruoyi.sy.domain.ArdOilWall; |
| | | import com.ruoyi.sy.domain.*; |
| | | import com.ruoyi.sy.param.OilWallParam; |
| | | import com.ruoyi.sy.service.ArdOilWallService; |
| | | import com.ruoyi.sy.domain.ArdSyCar; |
| | | import com.ruoyi.sy.domain.ArdSyUser; |
| | | import com.ruoyi.sy.service.IArdSyCarService; |
| | | import com.ruoyi.sy.service.IArdSyUserService; |
| | | import com.ruoyi.sy.service.*; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.utils.result.Results; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private ArdOilWallService ardOilWallService; |
| | | |
| | | @Autowired |
| | | private IArdSyCarService carService; |
| | | private ArdAccessFenceService ardAccessFenceService; |
| | | |
| | | @Autowired |
| | | private IArdSyUserService iArdSyUserService; |
| | | private ArdAccessNumService ardAccessNumService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService sysConfigService; |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("添加电子围栏") |
| | | public Results add(@RequestBody ArdOilWall ardOilWall){ |
| | | public AjaxResult add(@RequestBody ArdOilWall ardOilWall){ |
| | | ardOilWall.setId(String.valueOf(UUID.randomUUID())); |
| | | ardOilWall.setCreateBy(SecurityUtils.getUsername()); |
| | | ardOilWall.setCreateTime(new Date()); |
| | | return Results.succeed("成功添加"+ ardOilWallService.addOilWall(ardOilWall)+"条数据"); |
| | | return AjaxResult.success("成功添加"+ ardOilWallService.addOilWall(ardOilWall)+"条数据"); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @ApiOperation("删除电子围栏") |
| | | public Results del(String id){ |
| | | return Results.succeed("成功删除"+ ardOilWallService.delOilWall(id)+"条数据"); |
| | | public AjaxResult del(String id){ |
| | | return AjaxResult.success("成功删除"+ ardOilWallService.delOilWall(id)+"条数据"); |
| | | } |
| | | |
| | | @PutMapping("/upd") |
| | | @ApiOperation("修改电子围栏") |
| | | public Results upd(@RequestBody ArdOilWall ardOilWall){ |
| | | public AjaxResult upd(@RequestBody ArdOilWall ardOilWall){ |
| | | ardOilWall.setUpdateBy(SecurityUtils.getUsername()); |
| | | ardOilWall.setUpdateTime(new Date()); |
| | | return Results.succeed("成功修改"+ ardOilWallService.updOilWall(ardOilWall)+"条数据"); |
| | | return AjaxResult.success("成功修改"+ ardOilWallService.updOilWall(ardOilWall)+"条数据"); |
| | | } |
| | | |
| | | @GetMapping("/one") |
| | | @ApiOperation("查询一条电子围栏") |
| | | public Results one(String id){ |
| | | return Results.succeed(ardOilWallService.one(id)); |
| | | public AjaxResult one(String id){ |
| | | return AjaxResult.success(ardOilWallService.one(id)); |
| | | } |
| | | |
| | | @GetMapping("/queryPage") |
| | | @ApiOperation("条件查询所有电子围栏分页") |
| | | public AjaxResult queryPage(OilWallParam oilWallParam){ |
| | | if(oilWallParam.getPageNum()==null || oilWallParam.getPageNum() == 0){ |
| | | oilWallParam.setPageNum(1); |
| | | } |
| | | if(oilWallParam.getPageSize()==null || oilWallParam.getPageSize() == 0){ |
| | | oilWallParam.setPageSize(10); |
| | | } |
| | | PageHelper.startPage(oilWallParam.getPageNum(),oilWallParam.getPageSize()); |
| | | List<ArdOilWall> list = ardOilWallService.query(oilWallParam); |
| | | return AjaxResult.success(new PageInfo<>(list)); |
| | | } |
| | | |
| | | @GetMapping("/query") |
| | | @ApiOperation("查询所有电子围栏") |
| | | public Results query(OilWallParam oilWallParam){ |
| | | return Results.succeed(ardOilWallService.query(oilWallParam)); |
| | | public AjaxResult query(){ |
| | | List<ArdOilWall> list = ardOilWallService.all(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @GetMapping("/wallCar") |
| | | @ApiOperation("所有进入围栏的车辆") |
| | | public Results wallCar(){ |
| | | //查询所有已挂载的车辆 |
| | | List<ArdSyCar> carList = carService.all(); |
| | | //获取车辆位置 |
| | | String usersId = SecurityUtils.getUserId(); |
| | | ArdSyUser ardSyUser = iArdSyUserService.userById(usersId); |
| | | String syURL = sysConfigService.getSYURL(); |
| | | for (int i = 0; i < carList.size(); i++) { |
| | | String carId = carList.get(i).getCarId(); |
| | | carService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser); |
| | | } |
| | | |
| | | return Results.succeed(); |
| | | public AjaxResult wallCar(){ |
| | | String url = sysConfigService.selectConfigByKey("minioIn")+"/"; |
| | | return AjaxResult.success(ardAccessFenceService.all(url)); |
| | | } |
| | | |
| | | @GetMapping("/rollTime") |
| | | @ApiOperation("查询时间步长") |
| | | public AjaxResult rollTime(){ |
| | | return AjaxResult.success(ardAccessNumService.queryNum()); |
| | | } |
| | | |
| | | @PostMapping("/updTime") |
| | | @ApiOperation("保存时间步长") |
| | | public AjaxResult updTime(@RequestBody ArdAccessNum ardAccessNum){ |
| | | return AjaxResult.success(ardAccessNumService.upd(ardAccessNum)); |
| | | } |
| | | |
| | | } |